Commit cbb1e4f4b2f94df91233fa08dbaa45250ed358b7
Merge remote-tracking branch 'origin/master'
Showing
50 changed files
with
294 additions
and
180 deletions
Show diff stats
backend/assets/AppAsset.php
backend/views/specialization/_form.php
... | ... | @@ -14,15 +14,24 @@ use yii\helpers\ArrayHelper; |
14 | 14 | |
15 | 15 | <?= $form->field($model, 'specialization_pid')->dropDownList(ArrayHelper::map($model->find()->all(), 'specialization_id', 'specialization_name'), ['prompt' => 'Выберие родителя']) ?> |
16 | 16 | <?= $form->field($model, 'specialization_name')->textInput(['maxlength' => true]) ?> |
17 | - <?= \common\widgets\ImageUploader::widget([ | |
18 | - 'model'=> $model, | |
19 | - 'field'=>'img', | |
20 | - 'width'=>240, | |
21 | - 'height'=>160, | |
22 | - 'multi'=>false, | |
23 | - 'gallery' =>$model->img, | |
24 | - 'name' => 'Загрузить картинку' | |
25 | - ]); ?> | |
17 | + | |
18 | + <?php | |
19 | + | |
20 | + echo $form->field($model, 'background')->textInput(); | |
21 | + | |
22 | + if($model->specialization_pid == 0 && !empty($model->specialization_id) ){ | |
23 | + echo \common\widgets\ImageUploader::widget([ | |
24 | + 'model'=> $model, | |
25 | + 'field'=>'image', | |
26 | + 'width'=>940, | |
27 | + 'height'=>324, | |
28 | + 'multi'=>false, | |
29 | + 'gallery' =>$model->image, | |
30 | + 'name' => 'Загрузить картинку' | |
31 | + ]); | |
32 | + } | |
33 | + ?> | |
34 | + | |
26 | 35 | <div class="form-group"> |
27 | 36 | <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> |
28 | 37 | </div> | ... | ... |
backend/web/js/fieldWidget.js
1 | -$('body').on('click', '.delete-field-item', function(){ | |
1 | +$(document).ready(function(){ | |
2 | + $('body').on('click', '.delete-field-item', function(){ | |
2 | 3 | |
3 | - $(this).parent('.form-group').remove(); | |
4 | + $(this).parent('.form-group').remove(); | |
4 | 5 | |
5 | -}); | |
6 | + }); | |
6 | 7 | |
7 | 8 | |
8 | -$('.add_field').click(function(){ | |
9 | - var block = $('.fields_video_result'); | |
10 | - var sub_block = '<div class="form-group">'+ | |
11 | - '<input type="text" class="form-control" value="" name="Fields[video]['+ start_i++ +'][value]">'+ | |
12 | - '<span data-id="none" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+ | |
13 | - '<div>'; | |
14 | - block.append(sub_block); | |
15 | 9 | |
10 | + $('.add_field').click(function(){ | |
11 | + var block = $('.fields_video_result'); | |
12 | + var sub_block = '<div class="form-group">'+ | |
13 | + '<input type="text" class="form-control" value="" name="Fields[video]['+ start_i++ +'][value]">'+ | |
14 | + '<span data-id="none" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+ | |
15 | + '<div>'; | |
16 | + block.append(sub_block); | |
17 | + | |
18 | + }); | |
16 | 19 | }); |
17 | 20 | \ No newline at end of file | ... | ... |
common/models/Specialization.php
... | ... | @@ -10,10 +10,11 @@ use Yii; |
10 | 10 | * @property integer $specialization_id |
11 | 11 | * @property integer $specialization_pid |
12 | 12 | * @property string $specialization_name |
13 | + * @property string $image | |
14 | + * @property string $background | |
13 | 15 | */ |
14 | 16 | class Specialization extends \yii\db\ActiveRecord |
15 | 17 | { |
16 | - public $img; | |
17 | 18 | /** |
18 | 19 | * @inheritdoc |
19 | 20 | */ |
... | ... | @@ -28,10 +29,10 @@ class Specialization extends \yii\db\ActiveRecord |
28 | 29 | public function rules() |
29 | 30 | { |
30 | 31 | return [ |
31 | - [['specialization_pid'], 'integer'], | |
32 | + [['specialization_pid','status'], 'integer'], | |
32 | 33 | [['specialization_pid'], 'default', 'value' => '0',], |
33 | 34 | [['specialization_name'], 'required'], |
34 | - [['specialization_name'], 'string', 'max' => 255], | |
35 | + [['specialization_name','image','background'], 'string', 'max' => 255], | |
35 | 36 | ]; |
36 | 37 | } |
37 | 38 | |
... | ... | @@ -45,6 +46,9 @@ class Specialization extends \yii\db\ActiveRecord |
45 | 46 | 'specialization_pid' => 'Specialization Pid', |
46 | 47 | 'specialization_name' => 'Specialization Name', |
47 | 48 | 'specialization_parent_name' => 'Specialization Parent Name', |
49 | + 'image' => 'Картинка', | |
50 | + 'background' => 'Background', | |
51 | + 'status' => 'Status', | |
48 | 52 | ]; |
49 | 53 | } |
50 | 54 | |
... | ... | @@ -54,4 +58,9 @@ class Specialization extends \yii\db\ActiveRecord |
54 | 58 | return $this->hasOne(self::className(), ['specialization_id' => 'specialization_pid']); |
55 | 59 | } |
56 | 60 | |
61 | + public function getChildren() | |
62 | + { | |
63 | + return $this->hasMany(self::className(), ['specialization_pid' => 'specialization_id']); | |
64 | + } | |
65 | + | |
57 | 66 | } | ... | ... |
common/models/UserInfo.php
... | ... | @@ -63,7 +63,7 @@ class UserInfo extends \yii\db\ActiveRecord |
63 | 63 | return [ |
64 | 64 | [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'], |
65 | 65 | [['date_visit'], 'safe'], |
66 | - [['experience', 'soft', 'guarantee', 'about', 'city', 'country'], 'string'], | |
66 | + [['experience', 'soft', 'guarantee', 'about', 'city', 'country', 'image', 'poster'], 'string'], | |
67 | 67 | [['prepayment'], 'number'], |
68 | 68 | |
69 | 69 | [['rank', 'location'], 'string', 'max' => 50], | ... | ... |
common/widgets/FieldEditor.php
common/widgets/views/education_field.php
1 | 1 | <?php |
2 | 2 | use yii\helpers\Html; |
3 | + | |
3 | 4 | ?> |
4 | 5 | <fieldset> |
5 | 6 | |
... | ... | @@ -8,16 +9,20 @@ use yii\helpers\Html; |
8 | 9 | <p class="btn btn-success add_field">Добавить поле</p> |
9 | 10 | |
10 | 11 | |
11 | - <?php for($i=1; $i <= count($model); $i++): | |
12 | + <?php | |
13 | + $t = 0; | |
14 | + for($i=1; $i <= count($model); $i++): | |
12 | 15 | $row = $i; |
16 | + | |
13 | 17 | ?> |
14 | 18 | |
15 | 19 | <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> |
16 | - <input type="text" placeholder="С" class="form-control" value="<?= isset($model[$i]['value']) ? $model[$i]['value'] : '' ?>" name="Fields[education][<?=$row?>][0][year_from]" /> | |
17 | - <input type="text" placeholder="По" class="form-control" value="<?= isset($model[++$i]['value']) ? $model[$i]['value'] : '' ?>" name="Fields[education][<?=$row?>][1][year_to]" /> | |
18 | - <textarea placeholder="Место" name="Fields[education][<?=$row?>][2][place]" /><?= isset($model[++$i]['value']) ? $model[$i]['value'] : '' ?></textarea> | |
20 | + <input type="text" placeholder="С" class="form-control" value="<?= isset($model[$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[education][<?=$row?>][0][year_from]" /> | |
21 | + <input type="text" placeholder="По" class="form-control" value="<?= isset($model[++$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[education][<?=$row?>][1][year_to]" /> | |
22 | + <textarea placeholder="Место" name="Fields[education][<?=$row?>][2][place]" /><?= isset($model[++$t]['value']) ? $model[$t]['value'] : '' ?></textarea> | |
19 | 23 | <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> |
20 | 24 | <?= Html::endTag('div')?> |
25 | + <?php $i = ++ $t; ?> | |
21 | 26 | <?php endfor; ?> |
22 | 27 | |
23 | 28 | |
... | ... | @@ -30,7 +35,7 @@ use yii\helpers\Html; |
30 | 35 | var block = $(this).parent('fieldset'); |
31 | 36 | var block_id = $(this).parent('fieldset'); |
32 | 37 | var sub_block = '<div class="form-group" >'+ |
33 | - '<input type="text" placeholder="С" class="form-control" value="" name="Fields[education]['+ start_i++ +'][0][year_from]" />'+ | |
38 | + '<input type="text" placeholder="С" class="form-control" value="" name="Fields[education]['+ ++start_i +'][0][year_from]" />'+ | |
34 | 39 | '<input type="text" placeholder="По" class="form-control" value="" name="Fields[education]['+ start_i +'][1][year_to]" />'+ |
35 | 40 | '<textarea placeholder="Место" name="Fields[education]['+ start_i +'][2][place]" /></textarea>'+ |
36 | 41 | '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+ | ... | ... |
1 | +<?php | |
2 | +use yii\helpers\Html; | |
3 | +?> | |
4 | +<fieldset> | |
5 | + | |
6 | + <legend>Образование</legend> | |
7 | + | |
8 | + <p class="btn btn-success add_field">Добавить поле</p> | |
9 | + | |
10 | + | |
11 | + <?php $t = 0; for($i=1; $i <= count($model); $i++): | |
12 | + $row = $i; | |
13 | + | |
14 | + ?> | |
15 | + | |
16 | + <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> | |
17 | + <input type="text" placeholder="Телефон" class="form-control" value="<?= isset($model[$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[phone][<?=$row?>][0][phone]" /> | |
18 | + <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> | |
19 | + <?= Html::endTag('div')?> | |
20 | + <?php $i = ++ $t; ?> | |
21 | + <?php endfor; ?> | |
22 | + | |
23 | + | |
24 | + | |
25 | +</fieldset> | |
26 | +<script> | |
27 | + $( document ).ready(function(){ | |
28 | + var start_i = <?=$i?>; | |
29 | + $('.add_field').click(function(){ | |
30 | + var block = $(this).parent('fieldset'); | |
31 | + var block_id = $(this).parent('fieldset'); | |
32 | + var sub_block = '<div class="form-group" >'+ | |
33 | + '<input type="text" placeholder="Телефон" class="form-control" value="" name="Fields[phone]['+ start_i++ +'][0][phone]" />'+ | |
34 | + '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+ | |
35 | + '<div>'; | |
36 | + block.append(sub_block); | |
37 | + | |
38 | + }); | |
39 | + }); | |
40 | +</script> | |
41 | + | |
42 | + | ... | ... |
composer.lock
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
5 | 5 | "This file is @generated automatically" |
6 | 6 | ], |
7 | - "hash": "d07e2c10b604fb6b814d10b2de6dcd2f", | |
7 | + "hash": "5f5473586959d0912177c3dace19c844", | |
8 | 8 | "content-hash": "2d0acd792b2e28f03338a962c2923bbe", |
9 | 9 | "packages": [ |
10 | 10 | { |
... | ... | @@ -204,16 +204,16 @@ |
204 | 204 | }, |
205 | 205 | { |
206 | 206 | "name": "bower-asset/jquery.inputmask", |
207 | - "version": "3.2.5", | |
207 | + "version": "3.2.7", | |
208 | 208 | "source": { |
209 | 209 | "type": "git", |
210 | 210 | "url": "https://github.com/RobinHerbots/jquery.inputmask.git", |
211 | - "reference": "d08264a678865849c808359d126e3bddb9ec87a6" | |
211 | + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38" | |
212 | 212 | }, |
213 | 213 | "dist": { |
214 | 214 | "type": "zip", |
215 | - "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/d08264a678865849c808359d126e3bddb9ec87a6", | |
216 | - "reference": "d08264a678865849c808359d126e3bddb9ec87a6", | |
215 | + "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/5a72c563b502b8e05958a524cdfffafe9987be38", | |
216 | + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38", | |
217 | 217 | "shasum": "" |
218 | 218 | }, |
219 | 219 | "require": { |
... | ... | @@ -615,16 +615,16 @@ |
615 | 615 | }, |
616 | 616 | { |
617 | 617 | "name": "kartik-v/yii2-krajee-base", |
618 | - "version": "v1.7.9", | |
618 | + "version": "1.8.2", | |
619 | 619 | "source": { |
620 | 620 | "type": "git", |
621 | 621 | "url": "https://github.com/kartik-v/yii2-krajee-base.git", |
622 | - "reference": "6f10fd0a0bfccd729764c65fa65eb4ccf2cbade9" | |
622 | + "reference": "0c274e31e4392cbafc5fe158eae81738794e02ce" | |
623 | 623 | }, |
624 | 624 | "dist": { |
625 | 625 | "type": "zip", |
626 | - "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/6f10fd0a0bfccd729764c65fa65eb4ccf2cbade9", | |
627 | - "reference": "6f10fd0a0bfccd729764c65fa65eb4ccf2cbade9", | |
626 | + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/0c274e31e4392cbafc5fe158eae81738794e02ce", | |
627 | + "reference": "0c274e31e4392cbafc5fe158eae81738794e02ce", | |
628 | 628 | "shasum": "" |
629 | 629 | }, |
630 | 630 | "require": { |
... | ... | @@ -657,7 +657,7 @@ |
657 | 657 | "widget", |
658 | 658 | "yii2" |
659 | 659 | ], |
660 | - "time": "2015-11-25 07:03:35" | |
660 | + "time": "2016-01-10 12:26:29" | |
661 | 661 | }, |
662 | 662 | { |
663 | 663 | "name": "kartik-v/yii2-widget-select2", |
... | ... | @@ -665,12 +665,12 @@ |
665 | 665 | "source": { |
666 | 666 | "type": "git", |
667 | 667 | "url": "https://github.com/kartik-v/yii2-widget-select2.git", |
668 | - "reference": "701bf8069a85fafbac1ced54dcd00e579e60471b" | |
668 | + "reference": "519241c7360a0470624f24d872741e1ea880de75" | |
669 | 669 | }, |
670 | 670 | "dist": { |
671 | 671 | "type": "zip", |
672 | 672 | "url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/519241c7360a0470624f24d872741e1ea880de75", |
673 | - "reference": "701bf8069a85fafbac1ced54dcd00e579e60471b", | |
673 | + "reference": "519241c7360a0470624f24d872741e1ea880de75", | |
674 | 674 | "shasum": "" |
675 | 675 | }, |
676 | 676 | "require": { |
... | ... | @@ -705,7 +705,7 @@ |
705 | 705 | "widget", |
706 | 706 | "yii2" |
707 | 707 | ], |
708 | - "time": "2016-01-10 16:51:42" | |
708 | + "time": "2016-02-01 02:19:01" | |
709 | 709 | }, |
710 | 710 | { |
711 | 711 | "name": "lusitanian/oauth", |
... | ... | @@ -1080,12 +1080,12 @@ |
1080 | 1080 | "source": { |
1081 | 1081 | "type": "git", |
1082 | 1082 | "url": "https://github.com/yiisoft/yii2-framework.git", |
1083 | - "reference": "e4359f68b70caede1e09ecefb56e9435f7d140af" | |
1083 | + "reference": "7ccbfdf4cfb0ce025e27455dc3e516af23eb2800" | |
1084 | 1084 | }, |
1085 | 1085 | "dist": { |
1086 | 1086 | "type": "zip", |
1087 | 1087 | "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/7ccbfdf4cfb0ce025e27455dc3e516af23eb2800", |
1088 | - "reference": "e4359f68b70caede1e09ecefb56e9435f7d140af", | |
1088 | + "reference": "7ccbfdf4cfb0ce025e27455dc3e516af23eb2800", | |
1089 | 1089 | "shasum": "" |
1090 | 1090 | }, |
1091 | 1091 | "require": { |
... | ... | @@ -1166,7 +1166,7 @@ |
1166 | 1166 | "framework", |
1167 | 1167 | "yii2" |
1168 | 1168 | ], |
1169 | - "time": "2016-01-23 08:43:29" | |
1169 | + "time": "2016-01-28 20:15:10" | |
1170 | 1170 | }, |
1171 | 1171 | { |
1172 | 1172 | "name": "yiisoft/yii2-bootstrap", |
... | ... | @@ -1319,12 +1319,12 @@ |
1319 | 1319 | "source": { |
1320 | 1320 | "type": "git", |
1321 | 1321 | "url": "https://github.com/yiisoft/yii2-jui.git", |
1322 | - "reference": "7ab7ff56bd54500212523e38f5fe3b9210325041" | |
1322 | + "reference": "1425ab29929dd195f468d3c4eb340ab509f28b83" | |
1323 | 1323 | }, |
1324 | 1324 | "dist": { |
1325 | 1325 | "type": "zip", |
1326 | 1326 | "url": "https://api.github.com/repos/yiisoft/yii2-jui/zipball/1425ab29929dd195f468d3c4eb340ab509f28b83", |
1327 | - "reference": "7ab7ff56bd54500212523e38f5fe3b9210325041", | |
1327 | + "reference": "1425ab29929dd195f468d3c4eb340ab509f28b83", | |
1328 | 1328 | "shasum": "" |
1329 | 1329 | }, |
1330 | 1330 | "require": { |
... | ... | @@ -1361,7 +1361,7 @@ |
1361 | 1361 | "jQuery UI", |
1362 | 1362 | "yii2" |
1363 | 1363 | ], |
1364 | - "time": "2015-12-07 11:33:55" | |
1364 | + "time": "2015-12-24 06:23:53" | |
1365 | 1365 | }, |
1366 | 1366 | { |
1367 | 1367 | "name": "yiisoft/yii2-swiftmailer", |
... | ... | @@ -1448,12 +1448,12 @@ |
1448 | 1448 | "source": { |
1449 | 1449 | "type": "git", |
1450 | 1450 | "url": "https://github.com/fzaninotto/Faker.git", |
1451 | - "reference": "de2ed3bbe68254efeff68db60092fc8ed5298055" | |
1451 | + "reference": "b312ab9d0c446971069e22a524fec01c7cddc75e" | |
1452 | 1452 | }, |
1453 | 1453 | "dist": { |
1454 | 1454 | "type": "zip", |
1455 | - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/e493d3dc48d15a6d44e213d02c729ad61cc758a9", | |
1456 | - "reference": "de2ed3bbe68254efeff68db60092fc8ed5298055", | |
1455 | + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/b312ab9d0c446971069e22a524fec01c7cddc75e", | |
1456 | + "reference": "b312ab9d0c446971069e22a524fec01c7cddc75e", | |
1457 | 1457 | "shasum": "" |
1458 | 1458 | }, |
1459 | 1459 | "require": { |
... | ... | @@ -1490,7 +1490,7 @@ |
1490 | 1490 | "faker", |
1491 | 1491 | "fixtures" |
1492 | 1492 | ], |
1493 | - "time": "2016-01-08 14:16:18" | |
1493 | + "time": "2016-02-01 17:08:46" | |
1494 | 1494 | }, |
1495 | 1495 | { |
1496 | 1496 | "name": "phpspec/php-diff", |
... | ... | @@ -1671,12 +1671,12 @@ |
1671 | 1671 | "source": { |
1672 | 1672 | "type": "git", |
1673 | 1673 | "url": "https://github.com/yiisoft/yii2-gii.git", |
1674 | - "reference": "d1a58d8c64f9075960665dc5347f5906ecb063cf" | |
1674 | + "reference": "bb0eba84639a99bff6c8bc9e803bd8ac3ab66297" | |
1675 | 1675 | }, |
1676 | 1676 | "dist": { |
1677 | 1677 | "type": "zip", |
1678 | - "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/d1a58d8c64f9075960665dc5347f5906ecb063cf", | |
1679 | - "reference": "d1a58d8c64f9075960665dc5347f5906ecb063cf", | |
1678 | + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/bb0eba84639a99bff6c8bc9e803bd8ac3ab66297", | |
1679 | + "reference": "bb0eba84639a99bff6c8bc9e803bd8ac3ab66297", | |
1680 | 1680 | "shasum": "" |
1681 | 1681 | }, |
1682 | 1682 | "require": { |
... | ... | @@ -1716,7 +1716,7 @@ |
1716 | 1716 | "gii", |
1717 | 1717 | "yii2" |
1718 | 1718 | ], |
1719 | - "time": "2016-01-15 17:12:14" | |
1719 | + "time": "2016-02-02 07:11:51" | |
1720 | 1720 | } |
1721 | 1721 | ], |
1722 | 1722 | "aliases": [], | ... | ... |
console/migrations/m160202_090343_user_add_fields.php
100644 → 100755
... | ... | @@ -8,8 +8,8 @@ class m160202_090343_user_add_fields extends Migration |
8 | 8 | public function up() |
9 | 9 | { |
10 | 10 | $this->addColumn('user', 'type', $this->smallInteger()); |
11 | - $this->addColumn('user_info', 'image', $this->integer()); | |
12 | - $this->addColumn('user_info', 'poster', $this->integer()); | |
11 | + $this->addColumn('user_info', 'image', $this->string()); | |
12 | + $this->addColumn('user_info', 'poster', $this->string()); | |
13 | 13 | $this->addColumn('user_info', 'member', $this->smallInteger()); |
14 | 14 | |
15 | 15 | $this->createTable('{{%company_info}}', [ | ... | ... |
console/migrations/m160202_094943_user_info_country_city.php
100644 → 100755
console/migrations/m160203_133308_add_field_specialization.php
100644 → 100755
console/migrations/m160203_140144_add_field_user_info.php
100644 → 100755
console/migrations/m160204_103008_add_payment_connections.php
0 → 100644
1 | +<?php | |
2 | + use yii\db\Migration; | |
3 | + | |
4 | + class m160204_103008_add_payment_connections extends Migration | |
5 | + { | |
6 | + public function up () | |
7 | + { | |
8 | + $this->createTable ( | |
9 | + '{{%payment}}', [ | |
10 | + 'payment_id' => $this->primaryKey (), 'name' => $this->string (255) | |
11 | + ->notNull (), 'status' => $this->integer () | |
12 | + ->defaultValue (1), | |
13 | + ], null | |
14 | + ); | |
15 | + $this->batchInsert ('{{%payment}}', ['name'], [['Наличный расчет'], ['Безналичный расчет'], ['Электронные деньги']]); | |
16 | + $this->createTable ( | |
17 | + '{{%user_payment}}', [ | |
18 | + 'user_payment_id' => $this->primaryKey (), 'user_id' => $this->integer (), 'payment_id' => $this->integer (), | |
19 | + ] | |
20 | + ); | |
21 | + $this->createTable ( | |
22 | + '{{%user_specialization}}', [ | |
23 | + 'user_specialization_id' => $this->primaryKey (), 'user_id' => $this->integer (), 'specialization_id' => $this->integer (), | |
24 | + ] | |
25 | + ); | |
26 | + $this->addForeignKey ('user_speialization_specialization', '{{%user_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE'); | |
27 | + $this->addForeignKey ('user_payment_payment', '{{%user_payment}}', 'payment_id', '{{%payment}}', 'payment_id', 'CASCADE', 'CASCADE'); | |
28 | + } | |
29 | + | |
30 | + public function down () | |
31 | + { | |
32 | + $this->dropTable ('{{%payment}}'); | |
33 | + $this->dropTable('{{%user_specialization}}'); | |
34 | + $this->dropTable('{{%user_payment}}'); | |
35 | + } | |
36 | + /* | |
37 | + // Use safeUp/safeDown to run migration code within a transaction | |
38 | + public function safeUp() | |
39 | + { | |
40 | + } | |
41 | + | |
42 | + public function safeDown() | |
43 | + { | |
44 | + } | |
45 | + */ | |
46 | + } | ... | ... |
frontend/assets/AppAsset.php
... | ... | @@ -6,7 +6,6 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | namespace frontend\assets; |
9 | - | |
10 | 9 | use yii\web\AssetBundle; |
11 | 10 | |
12 | 11 | /** |
... | ... | @@ -20,7 +19,7 @@ class AppAsset extends AssetBundle |
20 | 19 | public $css = [ |
21 | 20 | 'css/style.css', |
22 | 21 | '/admin/css/flags32.css', |
23 | - //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', | |
22 | + 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', | |
24 | 23 | ]; |
25 | 24 | public $js = [ |
26 | 25 | '/js/script.js', |
... | ... | @@ -35,9 +34,11 @@ class AppAsset extends AssetBundle |
35 | 34 | '/js/forms.js', |
36 | 35 | '/js/jquery.MultiFile.js', |
37 | 36 | '/js/myGallery_min.js', |
37 | + 'js/fieldWidget.js' | |
38 | 38 | ]; |
39 | 39 | public $depends = [ |
40 | 40 | 'yii\web\YiiAsset', |
41 | + 'backend\assets\FileUploadAsset' | |
41 | 42 | ]; |
42 | 43 | public $jsOptions = array( |
43 | 44 | 'position' => \yii\web\View::POS_HEAD | ... | ... |
frontend/controllers/AccountsController.php
... | ... | @@ -48,11 +48,10 @@ class AccountsController extends Controller |
48 | 48 | |
49 | 49 | $langs = Language::getActiveLanguages(); |
50 | 50 | |
51 | - | |
52 | 51 | if ($user->load(Yii::$app->request->post()) && $user->save()) { |
53 | 52 | $user->userInfo->load(Yii::$app->request->post()); |
54 | 53 | $user->userInfo->save(); |
55 | - Fields::saveFieldData( Yii::$app->request->post('Fields'), $user->id, $user::className()); | |
54 | + Fields::saveFieldData( Yii::$app->request->post('Fields'), $user->id, $user::className(),'ru'); | |
56 | 55 | return $this->render('cabinet', [ |
57 | 56 | 'user' => $user, |
58 | 57 | 'user_info' => $user->userInfo, |
... | ... | @@ -151,6 +150,9 @@ class AccountsController extends Controller |
151 | 150 | |
152 | 151 | public function actionContacts() |
153 | 152 | { |
153 | + if(!empty(\Yii::$app->request->post())) { | |
154 | + Fields::saveFieldData( Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(),'ru'); | |
155 | + } | |
154 | 156 | $user_info = UserInfo::find()->where(['user_id' => \Yii::$app->user->getId()])->one(); |
155 | 157 | if(empty($user_info)) { |
156 | 158 | $user_info = new UserInfo(['user_id' => \Yii::$app->user->getId()]); |
... | ... | @@ -170,16 +172,29 @@ class AccountsController extends Controller |
170 | 172 | |
171 | 173 | public function actionEmployment() |
172 | 174 | { |
173 | - $job = Job::find()->where(['user_id' => \Yii::$app->user->getId()])->orderBy(['current' => SORT_DESC])->all(); | |
174 | - if(empty($job)) { | |
175 | - $job[] = new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 0]); | |
176 | - } | |
177 | - if(!$job[0]->current) { | |
178 | - array_unshift($job, new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 1])); | |
179 | - } | |
180 | - if(!empty(\Yii::$app->request->post())) { | |
181 | - var_dump(\Yii::$app->request->post()); | |
182 | - die(); | |
175 | + $post = \Yii::$app->request->post(); | |
176 | + if(!empty($post)) { | |
177 | + $job = []; | |
178 | + for($i = 0; $i < count($post['Job']); $i++) { | |
179 | + $job[$i] = new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 0]); | |
180 | + } | |
181 | + if(Job::loadMultiple($job, $post)) { | |
182 | + $job[0]->current = 1; | |
183 | + if(Job::validateMultiple($job)) { | |
184 | + Job::deleteAll(['user_id' => \Yii::$app->user->getId()]); | |
185 | + foreach($job as $onejob) { | |
186 | + $onejob->save(false); | |
187 | + } | |
188 | + } | |
189 | + } | |
190 | + } else { | |
191 | + $job = Job::find()->where(['user_id' => \Yii::$app->user->getId()])->orderBy(['current' => SORT_DESC])->all(); | |
192 | + if(empty($job)) { | |
193 | + $job[] = new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 0]); | |
194 | + } | |
195 | + if(!$job[0]->current) { | |
196 | + array_unshift($job, new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 1])); | |
197 | + } | |
183 | 198 | } |
184 | 199 | return $this->render('employment', ['job' => $job]); |
185 | 200 | } | ... | ... |
frontend/controllers/CompanyInfoController.php
100644 → 100755
frontend/controllers/SiteController.php
1 | 1 | <?php |
2 | 2 | namespace frontend\controllers; |
3 | 3 | |
4 | +use common\models\Specialization; | |
4 | 5 | use common\models\UserInfo; |
5 | 6 | use Yii; |
6 | 7 | use common\models\LoginForm; |
... | ... | @@ -62,7 +63,11 @@ class SiteController extends Controller |
62 | 63 | */ |
63 | 64 | public function actionIndex() |
64 | 65 | { |
65 | - return $this->render('index'); | |
66 | + $specializations = Specialization::find()->where(['specialization_pid'=>0])->all(); | |
67 | + | |
68 | + return $this->render('index',[ | |
69 | + 'specializations' => $specializations, | |
70 | + ]); | |
66 | 71 | } |
67 | 72 | |
68 | 73 | /** | ... | ... |
frontend/views/accounts/_form.php
... | ... | @@ -6,21 +6,22 @@ use \common\widgets\MultiLangForm; |
6 | 6 | |
7 | 7 | $this->title = 'Мой профиль'; |
8 | 8 | $this->params['breadcrumbs'][] = $this->title; |
9 | + $user = \Yii::$app->user->identity; | |
9 | 10 | ?> |
10 | 11 | |
11 | 12 | <h1><?= $this->title ?></h1> |
12 | - | |
13 | - | |
14 | - | |
15 | 13 | <?php |
16 | - | |
17 | -$form = $this->render('_form', [ | |
18 | - 'user' => $user, | |
19 | - 'user_info' => $user_info, | |
20 | -]); | |
21 | - | |
22 | -echo MultiLangForm::widget(['form'=>$form]); | |
23 | - | |
14 | +$form = ActiveForm::begin(); | |
15 | +?> | |
16 | +<?= \common\widgets\FieldEditor::widget([ | |
17 | + 'template'=>'phone', | |
18 | + 'item_id'=> $user->id, | |
19 | + 'model'=>'common\models\User', | |
20 | + 'language'=>'ru' | |
21 | +]); ?> | |
22 | +<?php | |
23 | + echo Html::submitButton('submit'); | |
24 | + $form->end(); | |
24 | 25 | ?> |
25 | 26 | |
26 | 27 | ... | ... |
... | ... | @@ -19,9 +19,6 @@ |
19 | 19 | <p>Текущее место работы:</p> |
20 | 20 | <div class="current_job_inputs"> |
21 | 21 | <?php |
22 | - echo $form->field ($current, '[0]current') | |
23 | - ->label (false) | |
24 | - ->hiddenInput (['value' => 1]); | |
25 | 22 | echo $form->field ($current, '[0]name') |
26 | 23 | ->label ('Название') |
27 | 24 | ->textInput (); |
... | ... | @@ -76,6 +73,7 @@ |
76 | 73 | </div> |
77 | 74 | <?php |
78 | 75 | echo Html::button('Добавить место работы', ['id' => 'add_job_button']); |
76 | + echo Html::submitButton('Обновить'); | |
79 | 77 | $form->end (); |
80 | 78 | ?> |
81 | 79 | <script> | ... | ... |
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | use common\models\Option; |
9 | 9 | use common\models\User; |
10 | 10 | use common\models\UserInfo; |
11 | + use common\widgets\ImageUploader; | |
11 | 12 | use yii\helpers\Html; |
12 | 13 | use yii\widgets\ActiveForm; |
13 | 14 | use \common\widgets\MultiLangForm; |
... | ... | @@ -69,6 +70,24 @@ |
69 | 70 | ->label ('Членство в МФП') |
70 | 71 | ->hint ('Выберите если хотите стать членом МФП и наш менеджер свяжется с Вами.') |
71 | 72 | ->radioList ([0 => 'Не хочу', 1 => 'Хочу стать']); |
73 | + echo ImageUploader::widget([ | |
74 | + 'model'=> $user_info, | |
75 | + 'field'=>'image', | |
76 | + 'width'=>100, | |
77 | + 'height'=>100, | |
78 | + 'multi'=>false, | |
79 | + 'gallery' =>$user_info->image, | |
80 | + 'name' => 'Загрузить аватар' | |
81 | + ]); | |
82 | + echo ImageUploader::widget([ | |
83 | + 'model'=> $user_info, | |
84 | + 'field'=>'poster', | |
85 | + 'width'=>1200, | |
86 | + 'height'=>600, | |
87 | + 'multi'=>false, | |
88 | + 'gallery' =>$user_info->poster, | |
89 | + 'name' => 'Загрузить постер' | |
90 | + ]); | |
72 | 91 | echo Html::submitButton('Обновить', ['class' => 'btn btn-primary']); |
73 | 92 | $form->end (); |
74 | 93 | ?> | ... | ... |
frontend/views/layouts/admin.php
... | ... | @@ -9,18 +9,6 @@ $this->beginContent('@app/views/layouts/main.php'); |
9 | 9 | ?> |
10 | 10 | <div class="wrap"> |
11 | 11 | <div class="container"> |
12 | - <div class="left_block"> | |
13 | - <?php | |
14 | - echo Menu::widget([ | |
15 | - 'options' => ['class' => 'nav nav-pills nav-stacked'], | |
16 | - 'items' => [ | |
17 | - ['label' => 'Кабинет', 'url' => ['accounts/cabinet']], | |
18 | - | |
19 | - ['label' => 'Выход', 'url' => ['/site/logout']], | |
20 | - ], | |
21 | - ]); | |
22 | - ?> | |
23 | - </div> | |
24 | 12 | <div class="right_block"> |
25 | 13 | <?= Breadcrumbs::widget([ |
26 | 14 | 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], |
... | ... | @@ -71,6 +59,10 @@ $this->beginContent('@app/views/layouts/main.php'); |
71 | 59 | 'label' => 'Галерея', |
72 | 60 | 'url' => ['accounts/gallery'], |
73 | 61 | ], |
62 | + [ | |
63 | + 'label' => 'Выход', | |
64 | + 'url' => ['/site/logout'] | |
65 | + ], | |
74 | 66 | ], |
75 | 67 | ]); |
76 | 68 | ?> | ... | ... |
frontend/views/layouts/performer.php
frontend/views/site/index.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | use \yii\helpers\Html; |
4 | - | |
5 | -/* @var $this yii\web\View */ | |
4 | +use \common\models\Specialization; | |
5 | +/** | |
6 | + * @var $this yii\web\View | |
7 | + * @var $specializations common\models\Specialization | |
8 | + */ | |
6 | 9 | |
7 | 10 | $this->title = 'My Yii Application'; |
8 | 11 | ?> |
... | ... | @@ -49,83 +52,29 @@ $this->title = 'My Yii Application'; |
49 | 52 | <div class="menu-two-wrapp-title">Специализация работ по исполнителям</div> |
50 | 53 | <div class="menu-two-wrapp" style="background: url('/images/menu-pic-1.jpg') 100% 100% no-repeat"> |
51 | 54 | <ul class="content-menu-first"> |
52 | - <li data-img="/images/menu-pic-1-2.jpg"> | |
53 | - <span data-menu-bg="#bb0f3f" style="background: #bb0f3f"></span><a href="#">Жилые</a> | |
54 | - <ul> | |
55 | - <li> | |
56 | - <a href="#">Жилые дома</a> | |
57 | - <ul> | |
58 | - <li><a href="#">Дизайн</a></li> | |
59 | - <li> | |
60 | - <a href="#">Разработка градостроительной документации</a> | |
61 | - <ul> | |
62 | - <li><a href="#">Архитекторы</a></li> | |
63 | - <li><a href="#">Junior-архитекторы</a></li> | |
64 | - </ul> | |
65 | - </li> | |
66 | - <li><a href="#">Проектирование объектов архитектуры</a></li> | |
67 | - <li><a href="#">Инжиниринговая деятельность в сфере строительства</a> | |
68 | - <ul> | |
69 | - <li><a href="#">йййййй</a></li> | |
70 | - <li><a href="#">ййййййййййй</a></li> | |
71 | - </ul> | |
72 | - </li> | |
73 | - <li><a href="#">Анимация и реклама</a></li> | |
74 | - </ul> | |
75 | - </li> | |
76 | - <li><a href="#">Виллы</a></li> | |
77 | - <li><a href="#">Коттеджи</a></li> | |
78 | - <li><a href="#">Гостиницы</a></li> | |
79 | - <li> | |
80 | - <a href="#">Базы отдыха</a> | |
81 | - <ul> | |
82 | - <li><a href="#">2---2</a></li> | |
83 | - <li><a href="#">2---3</a></li> | |
84 | - <li><a href="#">2---4</a></li> | |
85 | - </ul> | |
86 | - </li> | |
87 | - <li><a href="#">Таунхаусы</a></li> | |
88 | - <li><a href="#">Квартиры</a></li> | |
89 | - <li><a href="#">Квартиры</a></li> | |
90 | - <li><a href="#">Квартиры</a></li> | |
91 | - </ul> | |
92 | - </li> | |
93 | - <li data-img="/images/menu-pic-1.jpg"> | |
94 | - <span data-menu-bg="#ea640b" style="background: #ea640b"></span><a href="#">Офисные</a> | |
95 | - <ul> | |
96 | - <li> | |
97 | - <a href="#">Коттеджи</a> | |
98 | - <ul> | |
99 | - <li><a href="#">1---1</a></li> | |
100 | - <li> | |
101 | - <a href="#">1---2</a> | |
102 | - <ul> | |
103 | - <li><a href="#">Архитекторы</a></li> | |
104 | - <li><a href="#">Junior-архитекторы</a></li> | |
105 | - </ul> | |
106 | - </li> | |
107 | - <li><a href="#">1---3</a></li> | |
108 | - <li><a href="#">1---4</a></li> | |
109 | - </ul> | |
110 | - </li> | |
111 | - <li><a href="#">Гостиницы</a></li> | |
112 | - <li> | |
113 | - <a href="#">Базы отдыха</a> | |
114 | - <ul> | |
115 | - <li><a href="#">2---2</a></li> | |
116 | - <li><a href="#">2---3</a></li> | |
117 | - <li><a href="#">2---4</a></li> | |
118 | - </ul> | |
119 | - </li> | |
120 | - </ul> | |
121 | - </li> | |
122 | - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#f7a901" style="background: #f7a901"></span><a href="#">Торговые</a></li> | |
123 | - <li data-img="/images/menu-pic-1.jpg"><span data-menu-bg="#53a827" style="background: #53a827"></span><a href="#">Мосты</a></li> | |
124 | - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#018232" style="background: #018232"></span><a href="#">Дороги</a></li> | |
125 | - <li data-img="/images/menu-pic-1.jpg"><span data-menu-bg="#02857d" style="background: #02857d"></span><a href="#">Сооружения</a></li> | |
126 | - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#019abf" style="background: #019abf"></span><a href="#">Склады</a></li> | |
127 | - <li data-img="/images/menu-pic-1.jpg"><span data-menu-bg="#116da8" style="background: #116da8"></span><a href="#">Заводы</a></li> | |
128 | - <li data-img="/images/menu-pic-1-2.jpg"><span data-menu-bg="#413e7f" style="background: #413e7f"></span><a href="#">Разное</a></li> | |
55 | + <?php foreach($specializations as $specialization):?> | |
56 | + <li data-img="<?= $specialization->image?>"> | |
57 | + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name?></a> | |
58 | + <ul> | |
59 | + <?php foreach($specialization->children as $child_first):?> | |
60 | + | |
61 | + <?php if($child_first instanceof Specialization):?> | |
62 | + <li> | |
63 | + <a href="#"><?= $child_first->specialization_name?></a> | |
64 | + <ul> | |
65 | + <?php foreach($child_first->children as $child_second):?> | |
66 | + <?php if($child_first instanceof Specialization): ?> | |
67 | + <li><a href="#"><?= $child_second->specialization_name?></a></li> | |
68 | + <?php endif;?> | |
69 | + <?php endforeach; ?> | |
70 | + </ul> | |
71 | + </li> | |
72 | + <?php endif; ?> | |
73 | + <?php endforeach; ?> | |
74 | + | |
75 | + </ul> | |
76 | + </li> | |
77 | + <?php endforeach; ?> | |
129 | 78 | </ul> |
130 | 79 | </div> |
131 | 80 | </div> | ... | ... |
1 | +$(document).ready(function(){ | |
2 | + $('body').on('click', '.delete-field-item', function(){ | |
3 | + console.log('sfddf'); | |
4 | + $(this).parent('.form-group').remove(); | |
5 | + | |
6 | + }); | |
7 | + | |
8 | + | |
9 | + $('.add_field').click(function(){ | |
10 | + var block = $('.fields_video_result'); | |
11 | + var sub_block = '<div class="form-group">'+ | |
12 | + '<input type="text" class="form-control" value="" name="Fields[video]['+ start_i++ +'][value]">'+ | |
13 | + '<span data-id="none" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+ | |
14 | + '<div>'; | |
15 | + block.append(sub_block); | |
16 | + | |
17 | + }); | |
18 | +}); | ... | ... |