Commit b3e1a4251f5c5a0b29a0f7903d4d032ef8ea78ef
Merge remote-tracking branch 'origin/master'
# Conflicts: # common/models/User.php
Showing
22 changed files
with
316 additions
and
126 deletions
Show diff stats
1 | +<?php | |
2 | + | |
3 | +namespace common\components; | |
4 | + | |
5 | +use common\models\User; | |
6 | +use common\models\UserInfo; | |
7 | +use Yii; | |
8 | +use yii\base\BootstrapInterface; | |
9 | +use yii\db\Expression; | |
10 | + | |
11 | + | |
12 | +class UserCheck implements BootstrapInterface | |
13 | +{ | |
14 | + public function bootstrap($app){ | |
15 | + \Yii::$app->on(\yii\base\Application::EVENT_BEFORE_REQUEST, function ($event) { | |
16 | + | |
17 | + if(\Yii::$app->user->identity instanceof User){ | |
18 | + $userInfo = \Yii::$app->user->identity->userInfo; | |
19 | + $expression = new Expression('NOW()'); | |
20 | + $userInfo->date_visit = (new \yii\db\Query)->select($expression)->scalar(); | |
21 | + $userInfo->save(); | |
22 | + } | |
23 | + | |
24 | + }); | |
25 | + return $app; | |
26 | + } | |
27 | + | |
28 | +} | |
0 | 29 | \ No newline at end of file | ... | ... |
common/models/Fields.php
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | namespace common\models; |
4 | 4 | |
5 | 5 | use Yii; |
6 | +use yii\helpers\ArrayHelper; | |
6 | 7 | |
7 | 8 | /** |
8 | 9 | * This is the model class for table "{{%fields}}". |
... | ... | @@ -55,7 +56,11 @@ class Fields extends \yii\db\ActiveRecord |
55 | 56 | } |
56 | 57 | |
57 | 58 | public static function getData($id, $model, $type){ |
58 | - return self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all(); | |
59 | + $data = ArrayHelper::toArray(self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all()); | |
60 | + print_r($data); | |
61 | + | |
62 | + die(); | |
63 | + return self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->indexBy('parent_key')->all(); | |
59 | 64 | } |
60 | 65 | |
61 | 66 | ... | ... |
common/models/User.php
... | ... | @@ -337,6 +337,21 @@ |
337 | 337 | { |
338 | 338 | return true; |
339 | 339 | } |
340 | + public function getCompanyInfo(){ | |
341 | + return $this->hasOne(CompanyInfo::className(), ['user_id' => 'id']); | |
342 | + } | |
343 | + | |
344 | + public function getLiveTime(){ | |
345 | + | |
346 | + $now = new \DateTime('now'); | |
347 | + $date1 = new \DateTime(date ('Y-m-d H:i:s',$this->created_at)); | |
348 | + return \Yii::$app->formatter->asRelativeTime($date1->diff($now)); | |
349 | + } | |
350 | + | |
351 | + public function getIsPerformer() | |
352 | + { | |
353 | + return true; | |
354 | + } | |
340 | 355 | |
341 | 356 | public function getIsCustomer() |
342 | 357 | { | ... | ... |
common/models/UserInfo.php
... | ... | @@ -72,6 +72,18 @@ class UserInfo extends \yii\db\ActiveRecord |
72 | 72 | ]; |
73 | 73 | } |
74 | 74 | |
75 | + | |
76 | + public function getBusyText(){ | |
77 | + return $this->busy ? 'Занят' : 'Свободный'; | |
78 | + } | |
79 | + | |
80 | + | |
81 | + public function getLastVisit(){ | |
82 | + return \Yii::$app->formatter->asRelativeTime($this->date_visit); | |
83 | + } | |
84 | + | |
85 | + | |
86 | + | |
75 | 87 | /** |
76 | 88 | * @inheritdoc |
77 | 89 | */ | ... | ... |
common/modules/file/controllers/UploaderController.php
... | ... | @@ -50,7 +50,7 @@ class UploaderController extends Controller { |
50 | 50 | $e1_height = $height/$width; |
51 | 51 | |
52 | 52 | |
53 | - if($this->isBigger($width,$height,$w,$h)){ | |
53 | +// if($this->isBigger($width,$height,$w,$h)){ | |
54 | 54 | if($e_width<$e1_width){ |
55 | 55 | |
56 | 56 | $new_width = $width*($e_width/$e1_width); |
... | ... | @@ -68,10 +68,10 @@ class UploaderController extends Controller { |
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | - } else { | |
72 | - $img->save($imageAliasSave, array('flatten' => false)); | |
73 | - return true; | |
74 | - } | |
71 | +// } else { | |
72 | +// $img->save($imageAliasSave, array('flatten' => false)); | |
73 | +// return true; | |
74 | +// } | |
75 | 75 | |
76 | 76 | |
77 | 77 | Image::crop($imageAlias, $width, $height,[$x,$y]) |
... | ... | @@ -140,7 +140,7 @@ class UploaderController extends Controller { |
140 | 140 | |
141 | 141 | if ($request) { |
142 | 142 | |
143 | - $model->multi = $request['multi']; | |
143 | + $model->multi = isset($request['multi'])? 1 : 0; | |
144 | 144 | |
145 | 145 | $model->file = UploadedFile::getInstance($model, 'file'); |
146 | 146 | ... | ... |
common/widgets/views/courses_field.php
... | ... | @@ -4,11 +4,11 @@ |
4 | 4 | ?> |
5 | 5 | <fieldset> |
6 | 6 | |
7 | - <legend>Пройденные курсы, тренинги</legend> | |
7 | + <div class="skills-title">Пройденные курсы, тренинги</div> | |
8 | 8 | |
9 | - <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
10 | 9 | |
11 | 10 | |
11 | + <div class="field_list"> | |
12 | 12 | <?php $t = 0; |
13 | 13 | for($i = 1; $i <= count($model); $i++): |
14 | 14 | $row = $i; |
... | ... | @@ -25,8 +25,8 @@ |
25 | 25 | <?= Html::endTag('div') ?> |
26 | 26 | <?php $i = ++$t; ?> |
27 | 27 | <?php endfor; ?> |
28 | - | |
29 | - | |
28 | + </div> | |
29 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
30 | 30 | </fieldset> |
31 | 31 | <script> |
32 | 32 | var start_i_<?=$this->context->id?> = <?=$i?>; |
... | ... | @@ -39,15 +39,14 @@ |
39 | 39 | function () |
40 | 40 | { |
41 | 41 | var block = $ (this) |
42 | - .parent ('fieldset'); | |
42 | + .siblings('.field_list'); | |
43 | 43 | var block_id = $ (this) |
44 | 44 | .parent ('fieldset'); |
45 | 45 | var sub_block = '<div class="form-group" >' + |
46 | - '<input type="text" placeholder="Курсы, тренинги" class="form-control" value="" name="Fields[courses][' + start_i_<?=$this->context->id?>++ + '][0][name]" />' + | |
46 | + '<input type="text" placeholder="Курсы, тренинги" class="form-control" value="" name="Fields[courses][' + start_i_<?=$this->context->id?> + '][0][name]" />' + | |
47 | 47 | '<input type="number" class="form-control" value="" name="Fields[courses][' + start_i_<?=$this->context->id?>++ + '][1][year]" />' + |
48 | 48 | '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>' + |
49 | 49 | '<div>'; |
50 | - console.log (block); | |
51 | 50 | block.append (sub_block); |
52 | 51 | } |
53 | 52 | ); | ... | ... |
common/widgets/views/development_field.php
... | ... | @@ -4,11 +4,9 @@ |
4 | 4 | ?> |
5 | 5 | <fieldset> |
6 | 6 | |
7 | - <legend>Собственные разработки, патенты</legend> | |
8 | - | |
9 | - <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
10 | - | |
7 | + <div class="skills-title">Собственные разработки, патенты</div> | |
11 | 8 | |
9 | + <div class="field_list"> | |
12 | 10 | <?php $t = 0; |
13 | 11 | for($i = 1; $i <= count($model); $i++): |
14 | 12 | $row = $i; |
... | ... | @@ -26,7 +24,8 @@ |
26 | 24 | <?php $i = ++$t; ?> |
27 | 25 | <?php endfor; ?> |
28 | 26 | |
29 | - | |
27 | + </div> | |
28 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
30 | 29 | </fieldset> |
31 | 30 | <script> |
32 | 31 | var start_i_<?=$this->context->id?> = <?=$i?>; |
... | ... | @@ -39,11 +38,11 @@ |
39 | 38 | function () |
40 | 39 | { |
41 | 40 | var block = $ (this) |
42 | - .parent ('fieldset'); | |
41 | + .siblings('.field_list'); | |
43 | 42 | var block_id = $ (this) |
44 | 43 | .parent ('fieldset'); |
45 | 44 | var sub_block = '<div class="form-group" >' + |
46 | - '<input type="text" placeholder="Телефон" class="form-control" value="" name="Fields[development][' + start_i_<?=$this->context->id?>++ + '][0][name]" />' + | |
45 | + '<input type="text" placeholder="Телефон" class="form-control" value="" name="Fields[development][' + start_i_<?=$this->context->id?> + '][0][name]" />' + | |
47 | 46 | '<input type="number" class="form-control" value="" name="Fields[development][' + start_i_<?=$this->context->id?>++ + '][1][year]" />' + |
48 | 47 | '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>' + |
49 | 48 | '<div>'; | ... | ... |
common/widgets/views/education_field.php
... | ... | @@ -4,12 +4,14 @@ |
4 | 4 | ?> |
5 | 5 | <fieldset> |
6 | 6 | |
7 | - <legend>Образование</legend> | |
8 | - | |
9 | - <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
7 | +<div class="skills-title">Образование</div> | |
10 | 8 | |
9 | + <div class="field_list"> | |
11 | 10 | |
12 | 11 | <?php $t = 0; |
12 | + | |
13 | + $label = 0; // add this var | |
14 | + | |
13 | 15 | for($i = 1; $i <= count($model); $i++): |
14 | 16 | $row = $i; |
15 | 17 | |
... | ... | @@ -19,18 +21,27 @@ |
19 | 21 | 'class' => 'form-group', |
20 | 22 | 'id' => isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0, |
21 | 23 | ]) ?> |
22 | - <input type="text" placeholder="Название" class="form-control" value="<?= isset( $model[ $t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][0][name]"/> | |
23 | - <input type="number" class="form-control" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][1][year_from]"/> | |
24 | - <input type="number" class="form-control" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][2][year_to]"/> | |
24 | + <input id="edu-name-<?= ++$label ?>" type="text" placeholder="Название" class="form-control custom-input-2" value="<?= isset( $model[ $t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][0][name]"/> | |
25 | + <label for="edu-name-<?= $label ?>"></label> | |
26 | + | |
27 | + <input id="edu-to-<?= ++$label ?>" type="number" class="form-control form-control custom-input-2 custom-input-2-date" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][1][year_from]"/> | |
28 | + <label for="edu-to-<?= $label ?>"></label> | |
29 | + | |
30 | + <input id="edu-out-<?= ++$label ?>" type="number" class="form-control form-control custom-input-2 custom-input-2-date" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][2][year_to]"/> | |
31 | + <label for="edu-out-<?= $label ?>"></label> | |
32 | + | |
25 | 33 | <span data-id="<?= isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> |
26 | 34 | <?= Html::endTag('div') ?> |
27 | 35 | <?php $i = ++$t; ?> |
28 | 36 | <?php endfor; ?> |
29 | 37 | |
30 | - | |
38 | + </div> | |
39 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
31 | 40 | </fieldset> |
41 | + | |
32 | 42 | <script> |
33 | 43 | var start_i_<?=$this->context->id?> = <?=$i?>; |
44 | + var start_label_<?=$this->context->id?> = <?=$label?>; // add this var | |
34 | 45 | $ (document) |
35 | 46 | .ready ( |
36 | 47 | function () |
... | ... | @@ -40,13 +51,16 @@ |
40 | 51 | function () |
41 | 52 | { |
42 | 53 | var block = $ (this) |
43 | - .parent ('fieldset'); | |
54 | + .siblings('.field_list'); | |
44 | 55 | var block_id = $ (this) |
45 | 56 | .parent ('fieldset'); |
46 | 57 | var sub_block = '<div class="form-group" >' + |
47 | - '<input type="text" placeholder="Название" class="form-control" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][0][name]" />' + | |
48 | - '<input type="number" class="form-control" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][1][year_from]" />' + | |
49 | - '<input type="number" class="form-control" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][2][year_to]" />' + | |
58 | + '<input id="edu-name-' + ++start_label_<?=$this->context->id?> +'" type="text" placeholder="" class="form-control custom-input-2" value="" name="Fields[education][' + start_i_<?=$this->context->id?> + '][0][name]" />' + | |
59 | + '<label for="edu-name-' + start_label_<?=$this->context->id?> +'"></label>'+ | |
60 | + '<input id="edu-to-' + ++start_label_<?=$this->context->id?> +'" type="number" class="form-control custom-input-2 custom-input-2-date" value="" name="Fields[education][' + start_i_<?=$this->context->id?> + '][1][year_from]" />' + | |
61 | + '<label for="edu-to-' + start_label_<?=$this->context->id?> +'"></label>'+ | |
62 | + '<input id="edu-out-' + ++start_label_<?=$this->context->id?> +'"" type="number" class="form-control custom-input-2 custom-input-2-date" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][2][year_to]" />' + | |
63 | + '<label for="edu-out-' + start_label_<?=$this->context->id?> +'"></label>'+ | |
50 | 64 | '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>' + |
51 | 65 | '<div>'; |
52 | 66 | console.log (block); | ... | ... |
common/widgets/views/phone_field.php
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | |
6 | 6 | <legend>Телефон</legend> |
7 | 7 | |
8 | - <p class="btn btn-success add_field_<?=$this->context->id?>">Добавить поле</p> | |
8 | + <div class="field_list"> | |
9 | 9 | |
10 | 10 | |
11 | 11 | <?php $t = 0; for($i=1; $i <= count($model); $i++): |
... | ... | @@ -20,14 +20,16 @@ |
20 | 20 | <?php $i = ++ $t; ?> |
21 | 21 | <?php endfor; ?> |
22 | 22 | |
23 | - | |
23 | + </div> | |
24 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
24 | 25 | |
25 | 26 | </fieldset> |
26 | 27 | <script> |
27 | 28 | var start_i_<?=$this->context->id?> = <?=$i?>; |
28 | 29 | $( document ).ready(function(){ |
29 | 30 | $('.add_field_<?=$this->context->id?>').click(function(){ |
30 | - var block = $(this).parent('fieldset'); | |
31 | + var block = $ (this) | |
32 | + .siblings('.field_list'); | |
31 | 33 | var block_id = $(this).parent('fieldset'); |
32 | 34 | var sub_block = '<div class="form-group" >'+ |
33 | 35 | '<input type="text" placeholder="Телефон" class="form-control" value="" name="Fields[phone]['+ start_i_<?=$this->context->id?>++ +'][0][phone]" />'+ | ... | ... |
common/widgets/views/requirements_field.php
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | |
7 | 7 | <legend>Требования</legend> |
8 | 8 | |
9 | - <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
9 | + <div class="field_list"> | |
10 | 10 | |
11 | 11 | |
12 | 12 | <?php $t = 0; |
... | ... | @@ -25,7 +25,8 @@ |
25 | 25 | <?php $i = ++$t; ?> |
26 | 26 | <?php endfor; ?> |
27 | 27 | |
28 | - | |
28 | + </div> | |
29 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
29 | 30 | </fieldset> |
30 | 31 | <script> |
31 | 32 | var start_i_<?=$this->context->id?> = <?=$i?>; |
... | ... | @@ -38,7 +39,7 @@ |
38 | 39 | function () |
39 | 40 | { |
40 | 41 | var block = $ (this) |
41 | - .parent ('fieldset'); | |
42 | + .siblings('.field_list'); | |
42 | 43 | var block_id = $ (this) |
43 | 44 | .parent ('fieldset'); |
44 | 45 | var sub_block = '<div class="form-group" >' + | ... | ... |
common/widgets/views/site_field.php
... | ... | @@ -5,7 +5,7 @@ use yii\helpers\Html; |
5 | 5 | |
6 | 6 | <legend>Сайт</legend> |
7 | 7 | |
8 | - <p class="btn btn-success add_field_<?=$this->context->id?>">Добавить поле</p> | |
8 | + <div class="field_list"> | |
9 | 9 | |
10 | 10 | |
11 | 11 | <?php $t = 0; for($i=1; $i <= count($model); $i++): |
... | ... | @@ -20,14 +20,16 @@ use yii\helpers\Html; |
20 | 20 | <?php $i = ++ $t; ?> |
21 | 21 | <?php endfor; ?> |
22 | 22 | |
23 | - | |
23 | + </div> | |
24 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
24 | 25 | |
25 | 26 | </fieldset> |
26 | 27 | <script> |
27 | 28 | var start_i_<?=$this->context->id?> = <?=$i?>; |
28 | 29 | $( document ).ready(function(){ |
29 | 30 | $('.add_field_<?=$this->context->id?>').click(function(){ |
30 | - var block = $(this).parent('fieldset'); | |
31 | + var block = $ (this) | |
32 | + .siblings('.field_list'); | |
31 | 33 | var block_id = $(this).parent('fieldset'); |
32 | 34 | var sub_block = '<div class="form-group" >'+ |
33 | 35 | '<input type="text" placeholder="Телефон" class="form-control" value="" name="Fields[site]['+ start_i_<?=$this->context->id?>++ +'][0][site]" />'+ | ... | ... |
common/widgets/views/soft_field.php
... | ... | @@ -4,9 +4,9 @@ |
4 | 4 | ?> |
5 | 5 | <fieldset> |
6 | 6 | |
7 | - <legend>Работа с программами</legend> | |
7 | + <div class="skills-title">Работа с программами</div> | |
8 | 8 | |
9 | - <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
9 | + <div class="field_list"> | |
10 | 10 | |
11 | 11 | |
12 | 12 | <?php $t = 0; |
... | ... | @@ -19,13 +19,14 @@ |
19 | 19 | 'class' => 'form-group', |
20 | 20 | 'id' => isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0, |
21 | 21 | ]) ?> |
22 | - <input type="text" placeholder="Программа" class="form-control" value="<?= isset( $model[ $t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[soft][<?= $row ?>][0][soft]"/> | |
22 | + <input type="text" placeholder="" class="form-control custom-input-2" value="<?= isset( $model[ $t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[soft][<?= $row ?>][0][soft]"/> | |
23 | 23 | <span data-id="<?= isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> |
24 | 24 | <?= Html::endTag('div') ?> |
25 | 25 | <?php $i = ++$t; ?> |
26 | 26 | <?php endfor; ?> |
27 | 27 | |
28 | - | |
28 | + </div> | |
29 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
29 | 30 | </fieldset> |
30 | 31 | <script> |
31 | 32 | var start_i_<?=$this->context->id?> = <?=$i?>; |
... | ... | @@ -38,11 +39,11 @@ |
38 | 39 | function () |
39 | 40 | { |
40 | 41 | var block = $ (this) |
41 | - .parent ('fieldset'); | |
42 | + .siblings('.field_list'); | |
42 | 43 | var block_id = $ (this) |
43 | 44 | .parent ('fieldset'); |
44 | 45 | var sub_block = '<div class="form-group" >' + |
45 | - '<input type="text" placeholder="Программа" class="form-control" value="" name="Fields[soft][' + start_i_<?=$this->context->id?>++ + '][0][soft]" />' + | |
46 | + '<input type="text" placeholder="" class="form-control custom-input-2" value="" name="Fields[soft][' + start_i_<?=$this->context->id?>++ + '][0][soft]" />' + | |
46 | 47 | '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>' + |
47 | 48 | '<div>'; |
48 | 49 | console.log (block); | ... | ... |
common/widgets/views/youtube_field.php
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | |
7 | 7 | <legend>Видео с Youtube</legend> |
8 | 8 | |
9 | - <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
9 | + <div class="field_list"> | |
10 | 10 | |
11 | 11 | |
12 | 12 | <?php $t = 0; |
... | ... | @@ -24,7 +24,8 @@ |
24 | 24 | <?= Html::endTag('div') ?> |
25 | 25 | <?php $i = ++$t; ?> |
26 | 26 | <?php endfor; ?> |
27 | - | |
27 | + </div> | |
28 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | |
28 | 29 | |
29 | 30 | </fieldset> |
30 | 31 | <script> |
... | ... | @@ -38,7 +39,7 @@ |
38 | 39 | function () |
39 | 40 | { |
40 | 41 | var block = $ (this) |
41 | - .parent ('fieldset'); | |
42 | + .siblings('.field_list'); | |
42 | 43 | var block_id = $ (this) |
43 | 44 | .parent ('fieldset'); |
44 | 45 | var sub_block = '<div class="form-group" >' + | ... | ... |
1 | +<?php | |
2 | +namespace frontend\components; | |
3 | + | |
4 | + | |
5 | +use Yii; | |
6 | +use yii\base\Component; | |
7 | +use yii\base\InvalidConfigException; | |
8 | +use common\models\User; | |
9 | + | |
10 | +class UserInfo extends Component | |
11 | +{ | |
12 | + public function getUser() | |
13 | + { | |
14 | + if(\Yii::$app->user->isGuest){ | |
15 | + die('guest'); | |
16 | + } else { | |
17 | + return User::findOne(\Yii::$app->user->id); | |
18 | + } | |
19 | + | |
20 | + } | |
21 | + | |
22 | +} | |
0 | 23 | \ No newline at end of file | ... | ... |
frontend/config/main.php
... | ... | @@ -13,11 +13,23 @@ return [ |
13 | 13 | 'id' => 'app-frontend', |
14 | 14 | 'basePath' => dirname(__DIR__), |
15 | 15 | //'bootstrap' => ['log', 'PageController'], |
16 | - 'bootstrap' => ['log'], | |
16 | +// 'bootstrap' => ['log'], | |
17 | 17 | 'controllerNamespace' => 'frontend\controllers', |
18 | 18 | 'modules' => [ |
19 | 19 | |
20 | 20 | ], |
21 | + 'bootstrap' => [ | |
22 | + | |
23 | + // название класса | |
24 | + 'common\components\UserCheck', | |
25 | + | |
26 | + | |
27 | + // анонимная функция | |
28 | + function () { | |
29 | + return new common\components\UserCheck; | |
30 | + } | |
31 | + ], | |
32 | + | |
21 | 33 | 'components' => [ |
22 | 34 | //'PageController'=>[ |
23 | 35 | // 'class' => 'frontend\controllers\PageController' |
... | ... | @@ -29,6 +41,11 @@ return [ |
29 | 41 | 'identityClass' => 'common\models\User', |
30 | 42 | 'enableAutoLogin' => true, |
31 | 43 | ], |
44 | + 'userinfo' => [ | |
45 | + | |
46 | + 'class' => 'frontend\components\UserInfo', | |
47 | + | |
48 | + ], | |
32 | 49 | 'log' => [ |
33 | 50 | 'traceLevel' => YII_DEBUG ? 3 : 0, |
34 | 51 | 'targets' => [ |
... | ... | @@ -47,6 +64,7 @@ return [ |
47 | 64 | 'showScriptName' => false, |
48 | 65 | 'rules' => [ |
49 | 66 | 'landing/<view:[\w-]+>' => 'landing/view', |
67 | + 'performer/common/<performer_id:[\w-]+>' => 'performer/common', | |
50 | 68 | ] |
51 | 69 | ], |
52 | 70 | ], | ... | ... |
frontend/controllers/PerformerController.php
1 | 1 | <?php |
2 | 2 | namespace frontend\controllers; |
3 | 3 | |
4 | +use common\models\Fields; | |
5 | +use common\widgets\FieldEditor; | |
4 | 6 | use Yii; |
5 | 7 | use common\models\LoginForm; |
6 | 8 | use frontend\models\PasswordResetRequestForm; |
... | ... | @@ -30,8 +32,6 @@ class PerformerController extends Controller |
30 | 32 | { |
31 | 33 | public $layout = 'performer'; |
32 | 34 | |
33 | - public $defaultAction = 'common'; | |
34 | - | |
35 | 35 | /** |
36 | 36 | * @inheritdoc |
37 | 37 | */ |
... | ... | @@ -48,14 +48,28 @@ class PerformerController extends Controller |
48 | 48 | ]; |
49 | 49 | } |
50 | 50 | |
51 | + | |
51 | 52 | public function actionIndex() |
52 | 53 | { |
53 | - $this->redirect(['site/index']); | |
54 | + $this->redirect('site/index'); | |
55 | + | |
54 | 56 | } |
55 | 57 | |
56 | - public function actionCommon(/*$performer_id*/) | |
58 | + public function actionCommon($performer_id) | |
57 | 59 | { |
58 | - return $this->render('common'); | |
60 | + if(\Yii::$app->user->identity instanceof User && \Yii::$app->user->identity->id == $performer_id ){ | |
61 | + $user = \Yii::$app->user->identity; | |
62 | + } else { | |
63 | + $user = User::findOne($performer_id); | |
64 | + } | |
65 | + | |
66 | + | |
67 | + $educations = Fields::getData($user->id,$user::className(),'education'); | |
68 | + | |
69 | + return $this->render('common',[ | |
70 | + 'user' => $user, | |
71 | + 'educations' => $educations | |
72 | + ]); | |
59 | 73 | } |
60 | 74 | |
61 | 75 | public function actionPortfolio(/*$performer_id*/) | ... | ... |
frontend/views/accounts/add-skills.php
... | ... | @@ -12,31 +12,57 @@ use \common\widgets\MultiLangForm; |
12 | 12 | $this->title = 'Дополнительные навыки'; |
13 | 13 | $this->params['breadcrumbs'][] = $this->title; |
14 | 14 | ?> |
15 | -<h1><?= $this->title ?></h1> | |
15 | + <div class="login-left-column-title"><?= $this->title ?></div> | |
16 | 16 | <?php |
17 | 17 | $form = ActiveForm::begin(); |
18 | 18 | ?> |
19 | -<?= FieldEditor::widget ( | |
20 | - [ | |
21 | - 'template' => 'soft', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
22 | - ] | |
23 | -); ?> | |
24 | -<?= FieldEditor::widget ( | |
25 | - [ | |
26 | - 'template' => 'education', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
27 | - ] | |
28 | -); ?> | |
29 | -<?= FieldEditor::widget ( | |
30 | - [ | |
31 | - 'template' => 'development', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
32 | - ] | |
33 | -); ?> | |
34 | -<?= FieldEditor::widget ( | |
35 | - [ | |
36 | - 'template' => 'courses', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
37 | - ] | |
38 | -); ?> | |
39 | - <?= Html::submitButton('Обновить') ?> | |
19 | +<div class="skills-admin-wrapper style"> | |
20 | + <div class="input-blocks-wrapper"> | |
21 | + <div class="input-blocks"> | |
22 | + <?= FieldEditor::widget ( | |
23 | + [ | |
24 | + 'template' => 'soft', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
25 | + ] | |
26 | + ); ?> | |
27 | + </div> | |
28 | + </div> | |
29 | + | |
30 | + <div class="input-blocks-wrapper"> | |
31 | + <div class="input-blocks"> | |
32 | + <?= FieldEditor::widget ( | |
33 | + [ | |
34 | + 'template' => 'education', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
35 | + ] | |
36 | + ); ?> | |
37 | + </div> | |
38 | + </div> | |
39 | + | |
40 | + <div class="input-blocks-wrapper"> | |
41 | + <div class="input-blocks"> | |
42 | + <?= FieldEditor::widget ( | |
43 | + [ | |
44 | + 'template' => 'development', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
45 | + ] | |
46 | + ); ?> | |
47 | + </div> | |
48 | + </div> | |
49 | + | |
50 | + <div class="input-blocks-wrapper"> | |
51 | + <div class="input-blocks"> | |
52 | + <?= FieldEditor::widget ( | |
53 | + [ | |
54 | + 'template' => 'courses', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
55 | + ] | |
56 | + ); ?> | |
57 | + </div> | |
58 | + </div> | |
59 | + | |
60 | + <div class="input-blocks-wrapper"> | |
61 | + <div class="input-blocks"> | |
62 | + <?= Html::submitButton('Обновить') ?> | |
63 | + </div> | |
64 | + </div> | |
65 | +</div> | |
40 | 66 | <?php |
41 | 67 | $form->end(); |
42 | 68 | ?> |
43 | 69 | \ No newline at end of file | ... | ... |
frontend/views/accounts/general.php
frontend/views/layouts/admin.php
frontend/views/layouts/performer.php
1 | 1 | <?php |
2 | 2 | |
3 | +use yii\helpers\Html; | |
3 | 4 | use yii\widgets\Breadcrumbs; |
4 | 5 | use yii\widgets\Menu; |
5 | 6 | |
6 | 7 | \frontend\assets\AppAsset::register($this); |
7 | 8 | /* @var $content string */ |
8 | 9 | $this->beginContent('@app/views/layouts/main.php'); |
10 | + | |
9 | 11 | ?> |
10 | 12 | <div class="section-box content"> |
11 | - <div class="section-box-16" style="background: url('/images/blog/box-16.jpg') no-repeat"> | |
13 | + <div class="section-box-16" style="background: url('<?= Yii::$app->user->identity->userInfo->poster;?>') 50% no-repeat"> | |
12 | 14 | <div class="box-wr"> |
13 | 15 | <div class="box-all"> |
14 | 16 | <div class="blog-buttons-wr style"> |
... | ... | @@ -90,28 +92,37 @@ $this->beginContent('@app/views/layouts/main.php'); |
90 | 92 | <div class="performance-vacancy-sidebar-comm style">30 отзывов</div> |
91 | 93 | <a href="#" class="performance-vacancy-sidebar-write style">написать отзыв</a> |
92 | 94 | </div> |
93 | - <div class="performer-vacancy-sidebar-img style"><img src="/images/ded-foto.jpg" alt=""/></div> | |
95 | + <div class="performer-vacancy-sidebar-img style"> | |
96 | + <?= Html::img(Yii::$app->user->identity->userInfo->image);?> | |
97 | + </div> | |
94 | 98 | <div class="performer-vacancy-sidebar-all style"> |
95 | 99 | <div class="performer-vacancy-sidebar-soc style"> |
96 | 100 | <ul> |
97 | - <li><a target="_blank" href="#"><img src="/images/ico-fb.png" alt=""/></a></li> | |
98 | - <li><a target="_blank" href="#"><img src="/images/ico-tw.png" alt=""/></a></li> | |
99 | - <li><a target="_blank" href="#"><img src="/images/ico-in.png" alt=""/></a></li> | |
100 | - <li><a target="_blank" href="#"><img src="/images/ico-vk.png" alt=""/></a></li> | |
101 | + <li> | |
102 | + <?= Html::a(Html::img('/images/ico-fb.png'),[Yii::$app->user->identity->userInfo->social_fb],['target'=>'_blank'])?> | |
103 | + </li> | |
104 | + <li> | |
105 | + <?= Html::a(Html::img('/images/ico-tw.png'),[Yii::$app->user->identity->userInfo->social_t],['target'=>'_blank'])?> | |
106 | + </li> | |
107 | + <li> | |
108 | + <?= Html::a(Html::img('/images/ico-in.png'),[Yii::$app->user->identity->userInfo->social_in],['target'=>'_blank'])?> | |
109 | + </li> | |
110 | + <li> | |
111 | + <?= Html::a(Html::img('/images/ico-vk.png'),[Yii::$app->user->identity->userInfo->social_vk],['target'=>'_blank'])?> | |
112 | + </li> | |
101 | 113 | </ul> |
102 | 114 | </div> |
103 | 115 | <div class="performer-vacancy-sidebar-views style"> |
104 | 116 | <ul class="style"> |
105 | - <li><img src="/images/sidebar-ico/ico-1.png" alt=""/><div class="sidebarvievstxt">2562 просмотра</div></li> | |
106 | - <li><img src="/images/sidebar-ico/ico-9.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Статус: </span>свободен</div></li> | |
107 | - <li><img src="/images/sidebar-ico/ico-2.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">На сайте: </span>1г. 8 мес.</div></li> | |
108 | - <li><img src="/images/sidebar-ico/ico-3.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Последний визит:<br /></span>2 дня назад</div></li> | |
109 | - <li><img src="/images/sidebar-ico/ico-10.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Трудовой стаж:<br /></span>10 лет 6 месяцев</div></li> | |
110 | - <li><img src="/images/sidebar-ico/ico-11.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Звание в МФП:<br /></span>кандидат в МФП</div></li> | |
111 | - <li><img src="/images/sidebar-ico/ico-4.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Последнее обновление: </span>1 ноября 2015</div></li> | |
112 | - <li><img src="/images/sidebar-ico/ico-12.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Стоимость работ:<br /></span>от 500 грн за час</div></li> | |
117 | + <li><img src="/images/sidebar-ico/ico-1.png" alt=""/><div class="sidebarvievstxt"><?= Yii::$app->user->identity->userInfo->view_count?> просмотра</div></li> | |
118 | + <li><img src="/images/sidebar-ico/ico-9.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Статус: </span><?= Yii::$app->user->identity->userInfo->busyText?></div></li> | |
119 | + <li><img src="/images/sidebar-ico/ico-2.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">На сайте: </span><?= Yii::$app->user->identity->liveTime?></div></li> | |
120 | + <li><img src="/images/sidebar-ico/ico-3.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Последний визит:<br /></span><?= Yii::$app->user->identity->userInfo->lastVisit?></div></li> | |
121 | + <li><img src="/images/sidebar-ico/ico-10.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Трудовой стаж:<br /></span><?= Yii::$app->user->identity->userInfo->experience?></div></li> | |
122 | + <li><img src="/images/sidebar-ico/ico-11.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Звание в МФП:<br /></span><?= Yii::$app->user->identity->userInfo->rank?></div></li> | |
123 | + <li><img src="/images/sidebar-ico/ico-12.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Стоимость работ:<br /></span><?= Yii::$app->user->identity->userInfo->salary?></div></li> | |
113 | 124 | <li><img src="/images/sidebar-ico/ico-13.png" alt=""/><div class="sidebarvievstxt">Наличный, безналичный расчет, электронные деньги</div></li> |
114 | - <li><img src="/images/sidebar-ico/ico-14.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Текущее место работы:<br /></span>ООО “Дизайнер”</div></li> | |
125 | + <li><img src="/images/sidebar-ico/ico-14.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Текущее место работы:<br /></span><?= Yii::$app->user->identity->userInfo->job?></div></li> | |
115 | 126 | |
116 | 127 | </ul> |
117 | 128 | </div> | ... | ... |
frontend/views/performer/common.php
... | ... | @@ -2,46 +2,25 @@ |
2 | 2 | |
3 | 3 | use \yii\helpers\Html; |
4 | 4 | |
5 | -/* @var $this yii\web\View */ | |
5 | +/* @var $this yii\web\View | |
6 | + * @var $user common\models\User | |
7 | + */ | |
6 | 8 | |
7 | 9 | $this->title = 'My Yii Application'; |
8 | 10 | ?> |
9 | 11 | <div class="proektant-profile-content"> |
10 | 12 | <div class="proektant-profile-hidden-txt"> |
11 | - <p>Дизайнер, проектировщик, визуализатор.</p> | |
12 | - <p>Предоставление строительной бригады с большим опытом работы.</p> | |
13 | - <p>Ремонт "Под ключ".</p> | |
14 | - <p>Оказываю весь спектр услуг в области дизайна интерьеров в Сочи. Начиная с разработки дизайн — проекта и заканчивая финишной отделкой помещений.</p> | |
15 | - | |
16 | - <p>Зверям алкаем геенна забудь ветром. Уж До зрит Ты Со вы Идет сидя Он воды злак Се Во. Ли пить свод ей да Се очах ты быть се мя края роду. . Меч ком умы всё был нег оно над. Так умом Умом уме жену нее Лию неба зрит лик дух пир. </p> | |
17 | - <p>Оком рек чтя Под мир роз сон Тем Сына лиры Век. Рожденный рабствуют праведник Умудряйся. Незаконно Посвятясь Провождай Царствует. Их яд до не небрежа во Вы об ко Незримы общница. . Моя оставлять или ослепляет цел мужествен Смиренных всемирный раз праведный тук. Схохлена Змеистых пробавил весельем ветряных. Во Соделалось устремится Не мя Поработают От благовенья. Сад родом Жертв Уже Катит Тем струя Сам Самый Пук холме. Обильным сочетает разделил разность Страдать чувствия. </p> | |
18 | - <p>Неба поет Живя Весь Горе. Мука ль вы Их дней он ИЗ НА Нощи Вы были паки то Кого. Из он ни Из. Ее То Им на НА. Дух тли Мир тих. На Доблести бы пророках от во Мы да Подвигни. То до во ея За ко. Зла Они без шум жен мои зло. Се ты да то Кто за Ея мя За. Возводит Пастушья удаленьи ИСТИННОЕ БРАТСКОЕ </p> | |
19 | - <p>Се презирая се Ту НА струится черплешь яр восторге восхитят всемочны. До Те Являлся Ты Из погреби им Внимает На Ангелов тревога пройдут. То ПОМОЩЬ вещать ах им об Те По Ты ты отсвет языком грехах. По Полна их Со во новое На Ты же вверх всяка. . Фурии Дай тем Вот истин остов Броня воплю сад лик. Пламенны начальна творенье облекись ароматно. Ту он от милосердье со Правосудие По На ПОДРАЖАНИЕ. Уз из Да воздушных Заповедям полагаюсь окруженно пламенной Аз То. </p> | |
20 | - <p>Тя пиитах льщуся беседу се ст Их. Ваш Или чтит ходи Неба идут сует Где чуд. Вод Доднесь вид все неслися Блеснет Час Глотает поя воздуха белизна вер. Дав простирают Проникнули полагаться тма нас кою. Ко Те За ИЗ бы ея ты во</p> | |
13 | + <?= $user->userInfo->about?> | |
21 | 14 | </div> |
22 | 15 | <a href="#" class="profile-see-all"></a> |
23 | 16 | <div class="proektant-profile-courses-wr style"> |
17 | + <?php foreach( $educations as $education):?> | |
24 | 18 | <div class="proektant-profile-courses"> |
25 | 19 | <div class="proektant-profile-courses-title">Образование:</div> |
26 | - <div class="proektant-profile-courses-year">1996-2000</div> | |
27 | - <div class="proektant-profile-courses-content">Сочинский государственный университет, специальность "Дизайнер среды".</div> | |
28 | - </div> | |
29 | - | |
30 | - <div class="proektant-profile-courses"> | |
31 | - <div class="proektant-profile-courses-title">Собственные разработки, патенты:</div> | |
32 | - <div class="proektant-profile-courses-year">2006</div> | |
33 | - <div class="proektant-profile-courses-content">Патент "Технология сборки деревянной клеенной стены".</div> | |
34 | - <div class="proektant-profile-courses-year">2014</div> | |
35 | - <div class="proektant-profile-courses-content">Патент "Способ литья центробежным способом".</div> | |
36 | - </div> | |
37 | - | |
38 | - <div class="proektant-profile-courses"> | |
39 | - <div class="proektant-profile-courses-title">Курсы, тренинги:</div> | |
40 | - <div class="proektant-profile-courses-year">2003</div> | |
41 | - <div class="proektant-profile-courses-content">Тренинг "Основы САПР и 2D черчения и проектирования на компьютере".</div> | |
42 | - <div class="proektant-profile-courses-year">2014</div> | |
43 | - <div class="proektant-profile-courses-content">Курс "Архитектурное моделирование".</div> | |
20 | + <div class="proektant-profile-courses-year"><?= $education->year_from ?>-<?= $education->year_to ?></div> | |
21 | + <div class="proektant-profile-courses-content"><?= $education->name ?></div> | |
44 | 22 | </div> |
23 | + <?php endforeach; ?> | |
45 | 24 | </div> |
46 | 25 | |
47 | 26 | <div class="proektant-profile-statistic-wr style"> | ... | ... |
frontend/web/css/style.css
... | ... | @@ -4567,7 +4567,7 @@ ul.download-list-files li:hover .download-link {transition: 0.2s; opacity: 1; -m |
4567 | 4567 | .custom-input-2.fix-input-2 {width: 100%} |
4568 | 4568 | .custom-input-2:focus, .selectize-input input:focus {box-shadow: 1px 2px 2px 0px rgba(215, 215, 215, 0.75) inset; transition: 0.1s} |
4569 | 4569 | |
4570 | -.input-blocks label { | |
4570 | +.input-blocks label, .skills-title { | |
4571 | 4571 | font-size: 13px; |
4572 | 4572 | color: inherit; |
4573 | 4573 | font-weight: 700; |
... | ... | @@ -5413,4 +5413,45 @@ ul.menu-admin li.logout-li, ul.menu-admin li.logout-li a, ul.menu-admin li:last- |
5413 | 5413 | top: 25px; |
5414 | 5414 | left: 288px; |
5415 | 5415 | } |
5416 | -.success_download .not-file-mb-adm{display: none} | |
5417 | 5416 | \ No newline at end of file |
5417 | +.success_download .not-file-mb-adm{display: none} | |
5418 | +.skills-title {border-bottom: none} | |
5419 | +.skills-admin-wrapper {margin-top: 29px} | |
5420 | +.skills-admin-wrapper .btn{ | |
5421 | + border: none; | |
5422 | + background: none; | |
5423 | + color: #0072bc; | |
5424 | + border-bottom: 1px dashed #0072bc; | |
5425 | + padding: 0; | |
5426 | + border-radius: 0; | |
5427 | + line-height: 13px; | |
5428 | +} | |
5429 | +.skills-admin-wrapper .btn:focus, .skills-admin-wrapper .btn:active{ | |
5430 | + background: none; | |
5431 | + color: #003AA7; | |
5432 | + box-shadow: none; | |
5433 | +} | |
5434 | +.skills-admin-wrapper .glyphicon-trash:before { | |
5435 | + content: '' !important; | |
5436 | + width: 13px; | |
5437 | + height: 13px; | |
5438 | + cursor: pointer; | |
5439 | + background: url("/images/delete-ico.png") no-repeat; | |
5440 | + display: block; | |
5441 | +} | |
5442 | +.skills-admin-wrapper .custom-input-2 { | |
5443 | + border-radius: 0; | |
5444 | + outline: none; | |
5445 | +} | |
5446 | +.skills-admin-wrapper .custom-input-2:focus{border: 1px solid #dcdcdc;} | |
5447 | +.skills-admin-wrapper .form-group {position: relative} | |
5448 | +.skills-admin-wrapper .glyphicon { | |
5449 | + position: absolute; | |
5450 | + top: 50%; | |
5451 | + margin-top: -7px; | |
5452 | + right: -18px; | |
5453 | +} | |
5454 | +.custom-input-2.custom-input-2-date { | |
5455 | + width: 60px; | |
5456 | + padding: 0; | |
5457 | + padding-left: 12px; | |
5458 | +} | |
5418 | 5459 | \ No newline at end of file | ... | ... |