Commit 9b1d53630bc99fe7f241f773d0b8ea5dbb0e47f7

Authored by Administrator
2 parents 1e6ac995 e8236f44

Merge remote-tracking branch 'origin/master'

common/models/CompanyInfo.php
... ... @@ -31,7 +31,9 @@ class CompanyInfo extends \yii\db\ActiveRecord
31 31 {
32 32 return [
33 33 [['name', 'street', 'house'], 'string'],
34   - [['staff', 'hide_mail'], 'integer']
  34 + [['hide_mail'], 'integer'],
  35 + [['staff'], 'default', 'value' => 1],
  36 + [['staff'], 'integer', 'min' => 1],
35 37 ];
36 38 }
37 39  
... ... @@ -42,11 +44,11 @@ class CompanyInfo extends \yii\db\ActiveRecord
42 44 {
43 45 return [
44 46 'company_info_id' => Yii::t('app', 'Company Info ID'),
45   - 'name' => Yii::t('app', 'Name'),
46   - 'staff' => Yii::t('app', 'Staff'),
47   - 'street' => Yii::t('app', 'Street'),
48   - 'house' => Yii::t('app', 'House'),
49   - 'hide_mail' => Yii::t('app', 'Hide Mail'),
  47 + 'name' => Yii::t('app', 'Название компании'),
  48 + 'staff' => Yii::t('app', 'Количество сотрудников'),
  49 + 'street' => Yii::t('app', 'Улица'),
  50 + 'house' => Yii::t('app', 'Дом'),
  51 + 'hide_mail' => Yii::t('app', 'не публиковать Email'),
50 52 ];
51 53 }
52 54 }
... ...
common/models/Job.php
... ... @@ -45,13 +45,15 @@ class Job extends \yii\db\ActiveRecord
45 45  
46 46 public function getExpTime()
47 47 {
48   - if($this->date_end){
  48 + if($this->date_end && $this->date_start){
49 49 $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start));
50 50 return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $this->date_end))));
  51 + } elseif($this->date_start) {
  52 + $now = new \DateTime();
  53 + $date = new \DateTime(date('Y-m-d H:i:s', strtotime($this->date_start)));
  54 + return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime()));
51 55 } else {
52   - $now = new \DateTime('now');
53   - $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start));
54   - return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $now))));
  56 + return 'неизвестна дата начала';
55 57 }
56 58  
57 59 }
... ...
common/models/User.php
... ... @@ -4,7 +4,10 @@
4 4 use Yii;
5 5 use yii\base\NotSupportedException;
6 6 use yii\behaviors\TimestampBehavior;
  7 + use yii\db\ActiveQuery;
7 8 use yii\db\ActiveRecord;
  9 + use yii\rbac\ManagerInterface;
  10 + use yii\rbac\Role;
8 11 use yii\web\IdentityInterface;
9 12 use developeruz\db_rbac\interfaces\UserRbacInterface;
10 13  
... ... @@ -23,11 +26,6 @@
23 26 */
24 27 class User extends ActiveRecord implements IdentityInterface, UserRbacInterface
25 28 {
26   -
27   - /**
28   - * @var array EAuth attributes
29   - */
30   -
31 29 const STATUS_DELETED = 0;
32 30 const STATUS_ACTIVE = 10;
33 31  
... ... @@ -294,11 +292,21 @@
294 292 $this->password_reset_token = NULL;
295 293 }
296 294  
  295 + /**
  296 + * Returns name of the User
  297 + *
  298 + * @return string
  299 + */
297 300 public function getUserName()
298 301 {
299 302 return $this->username;
300 303 }
301 304  
  305 + /**
  306 + * Return array of all User's roles
  307 + *
  308 + * @return array
  309 + */
302 310 public function getRoles()
303 311 {
304 312 $auth = \Yii::$app->authManager;
... ... @@ -306,6 +314,13 @@
306 314 return $roles;
307 315 }
308 316  
  317 + /**
  318 + * @param Role[] $roles User roles returned by [ManagerInterface]->[getRolesByUser($id)]
  319 + * @param ManagerInterface $auth Auth manager
  320 + * @param array $result
  321 + *
  322 + * @return array
  323 + */
309 324 protected function getRoleChildrenRecursive($roles, $auth, $result = [ ])
310 325 {
311 326 if(is_array($roles) && !empty( $roles )) {
... ... @@ -322,42 +337,74 @@
322 337 }
323 338 }
324 339  
325   - // public function afterSave ($insert, $changedAttributes)
326   - // {
327   - // parent::afterSave ($insert, $changedAttributes);
328   - // \Yii::$app->options->createOptions($this->id);
329   - // }
330   -
  340 + /**
  341 + * Return UserInfo for this User
  342 + *
  343 + * @return \yii\db\ActiveQuery
  344 + */
331 345 public function getUserInfo()
332 346 {
333 347 return $this->hasOne(UserInfo::className(), [ 'user_id' => 'id' ]);
334 348 }
335 349  
  350 + /**
  351 + * Check if User is Performer
  352 + *
  353 + * <i>currently in development mode</i>
  354 + *
  355 + * @return bool
  356 + */
336 357 public function getIsPerformer()
337 358 {
338 359 return true;
339 360 }
340 361  
  362 + /**
  363 + * Return CompanyInfo for this User
  364 + *
  365 + * @return \yii\db\ActiveQuery
  366 + */
341 367 public function getCompanyInfo()
342 368 {
343 369 return $this->hasOne(CompanyInfo::className(), [ 'user_id' => 'id' ]);
344 370 }
345 371  
  372 + /**
  373 + * Return array of User's phones
  374 + *
  375 + * @return array
  376 + */
346 377 public function getPhones()
347 378 {
348 379 return Fields::getData($this->id, self::className(), 'phone');
349 380 }
350 381  
  382 + /**
  383 + * Return array of User's site
  384 + *
  385 + * @return array
  386 + */
351 387 public function getSite()
352 388 {
353 389 return Fields::getData($this->id, self::className(), 'site');
354 390 }
355 391  
  392 + /**
  393 + * Return full address of User in view like:
  394 + *
  395 + * <code>{country}, {city}, {street}, {house}</code>
  396 + * @return string
  397 + */
356 398 public function getAddress()
357 399 {
358 400 return $this->userInfo->country . ', ' . $this->userInfo->city . ', ' . $this->companyInfo->street . ', ' . $this->companyInfo->house;
359 401 }
360 402  
  403 + /**
  404 + * Return relative interval of time from User registration date until now.
  405 + *
  406 + * @return string
  407 + */
361 408 public function getLiveTime()
362 409 {
363 410 $now = new \DateTime('now');
... ... @@ -365,17 +412,34 @@
365 412 return \Yii::$app->formatter->asRelativeTime($date1->diff($now));
366 413 }
367 414  
  415 + /**
  416 + * Check if User is Customer
  417 + *
  418 + * <i>currently in development</i>
  419 + *
  420 + * @return bool
  421 + */
368 422 public function getIsCustomer()
369 423 {
370 424 return true;
371 425 }
372 426  
  427 + /**
  428 + * Return array of payments types accepted by the user.
  429 + *
  430 + * @return ActiveQuery
  431 + */
373 432 public function getPayments()
374 433 {
375 434 return $this->hasMany(Payment::className(), [ 'payment_id' => 'payment_id' ])
376 435 ->viaTable('user_payment', [ 'user_id' => 'id' ]);
377 436 }
378 437  
  438 + /**
  439 + * Return array of Payment IDs, accepted by the user.
  440 + *
  441 + * @return integer[]
  442 + */
379 443 public function getPaymentInput()
380 444 {
381 445 return $this->getPayments()
... ... @@ -383,27 +447,62 @@
383 447 ->column();
384 448 }
385 449  
  450 + /**
  451 + * Setter which allow to set User's payment ID's for further saving to the DB.
  452 + *
  453 + * @param integer[] $value
  454 + */
386 455 public function setPaymentInput($value)
387 456 {
388 457 $this->paymentInput = $value;
389 458 }
390 459  
  460 + /**
  461 + * Return array of Specializations in which the User works.
  462 + *
  463 + * @return ActiveQuery
  464 + */
391 465 public function getSpecializations()
392 466 {
393 467 return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ])
394 468 ->viaTable('user_specialization', [ 'user_id' => 'id' ]);
395 469 }
396 470  
  471 + /**
  472 + * Return array of User's blogs
  473 + *
  474 + * @return ActiveQuery
  475 + */
397 476 public function getBlog()
398 477 {
399 478 return $this->hasMany(Blog::className(), [ 'user_id' => 'id' ]);
400 479 }
401 480  
  481 + /**
  482 + * Return array of User's jobs.
  483 + *
  484 + * @return ActiveQuery
  485 + */
402 486 public function getJobs()
403 487 {
404 488 return $this->hasMany(Job::className(), [ 'user_id' => 'id' ]);
405 489 }
406 490  
  491 + /**
  492 + * Return ActiveRecord of current User's place of work.
  493 + *
  494 + * @return ActiveQuery
  495 + */
  496 + public function getCurrentJob()
  497 + {
  498 + return $this->hasOne(Job::className(), ['user_id' => 'id'])->where(['current' => 1]);
  499 + }
  500 +
  501 + /**
  502 + * Return array of User's specialization IDs
  503 + *
  504 + * @return integer[]
  505 + */
407 506 public function getSpecializationInput()
408 507 {
409 508 return $this->getSpecializations()
... ... @@ -411,26 +510,51 @@
411 510 ->column();
412 511 }
413 512  
  513 + /**
  514 + * Setter which allow to set User's specializations for further saving to the DB.
  515 + *
  516 + * @param integer[] $value
  517 + */
414 518 public function setSpecializationInput($value)
415 519 {
416 520 $this->specializationInput = $value;
417 521 }
418 522  
  523 + /**
  524 + * Return array of User's portfolios.
  525 + *
  526 + * @return ActiveQuery
  527 + */
419 528 public function getPortfolios()
420 529 {
421 530 return $this->hasMany(Portfolio::className(), [ 'user_id' => 'id' ]);
422 531 }
423 532  
  533 + /**
  534 + * Return array of User's projects.
  535 + *
  536 + * @return ActiveQuery
  537 + */
424 538 public function getProjects()
425 539 {
426 540 return $this->hasMany(Project::className(), [ 'user_id' => 'id' ]);
427 541 }
428 542  
  543 + /**
  544 + * Return array of company's Team members.
  545 + *
  546 + * @return ActiveQuery
  547 + */
429 548 public function getTeams()
430 549 {
431 550 return $this->hasMany(Team::className(), [ 'user_id' => 'id' ]);
432 551 }
433 552  
  553 + /**
  554 + * Return array of company's Vacancies.
  555 + *
  556 + * @return ActiveQuery
  557 + */
434 558 public function getVacancies()
435 559 {
436 560 return $this->hasMany(Vacancy::className(), [ 'user_id' => 'id' ]);
... ...
common/models/UserInfo.php
1 1 <?php
2 2  
3   -namespace common\models;
4   -
5   -use Yii;
6   -
7   -/**
8   - * This is the model class for table "user_info".
9   - *
10   - * @property integer $user_id
11   - * @property integer $view_count
12   - * @property string $busy
13   - * @property string $date_visit
14   - * @property string $experience
15   - * @property string $rank
16   - * @property string $salary
17   - * @property string $job
18   - * @property string $location
19   - * @property string $soft
20   - * @property integer $user_info_id
21   - * @property string $guarantee
22   - * @property integer $contract
23   - * @property integer $estimate
24   - * @property integer $purchase
25   - * @property integer $delivery
26   - * @property double $prepayment
27   - * @property string $about
28   - * @property integer $type
29   - */
30   -class UserInfo extends \yii\db\ActiveRecord
31   -{
32   - // Константа обознащающая физическое лицо
33   - const USER_TYPE_FIZ = 1;
34   -
35   - // Константа обозначающая компанию
36   - const USER_TYPE_COMPANY = 2;
37   -
38   - // Константа обозначающая, что компания/физ.лицо свободно
39   - const USER_STATUS_FREE = 1;
40   -
41   - // Константа обозначающая, что компания/физ.лицо занято
42   - const USER_STATUS_BUSY = 2;
43   -
44   - // Константа обозначающая, что компания/физ.лицо хочет стать членом МФП
45   - const USER_MEMBER_FALSE = 1;
46   -
47   - // Константа обозначающая, что компания/физ.лицо не хочет стать членом МФП
48   - const USER_MEMBER_TRUE = 2;
49   -
50   - /**
51   - * @inheritdoc
52   - */
53   - public static function tableName()
54   - {
55   - return 'user_info';
56   - }
57   -
58   - /**
59   - * @inheritdoc
60   - */
61   - public function rules()
62   - {
63   - return [
64   - [['contract', 'estimate', 'purchase', 'delivery','is_customer','is_freelancer'], 'integer'],
65   - [['date_visit'], 'safe'],
66   - [['soft', 'guarantee', 'about', 'city', 'country', 'image', 'poster', 'social_vk', 'social_fb', 'social_in', 'social_t'], 'string'],
67   - [['prepayment'], 'number'],
68   - [['experience'], 'integer', 'max' => date('Y'), 'min' => 1950],
69   - [['experience'], 'default', 'value' => date('Y')],
70   - [['rank', 'location'], 'string', 'max' => 50],
71   - [['salary', 'job'], 'string', 'max' => 255],
72   - [['busy', 'member'], 'boolean'],
73   - ];
74   - }
75   -
76   -
77   - public function getBusyText(){
78   - return $this->busy ? 'Занят' : 'Свободный';
79   - }
80   -
81   -
82   - public function getLastVisit(){
83   - return \Yii::$app->formatter->asRelativeTime(new \DateTime($this->date_visit));
84   - }
85   -
  3 + namespace common\models;
86 4  
  5 + use Yii;
87 6  
88 7 /**
89   - * @inheritdoc
  8 + * This is the model class for table "user_info".
  9 + * @property integer $user_id
  10 + * @property integer $view_count
  11 + * @property string $busy
  12 + * @property string $date_visit
  13 + * @property string $experience
  14 + * @property string $rank
  15 + * @property string $salary
  16 + * @property string $job
  17 + * @property string $location
  18 + * @property string $soft
  19 + * @property integer $user_info_id
  20 + * @property string $guarantee
  21 + * @property integer $contract
  22 + * @property integer $estimate
  23 + * @property integer $purchase
  24 + * @property integer $delivery
  25 + * @property double $prepayment
  26 + * @property string $about
  27 + * @property integer $type
90 28 */
91   - public function attributeLabels()
  29 + class UserInfo extends \yii\db\ActiveRecord
92 30 {
93   - return [
94   - 'user_id' => Yii::t('app', 'User ID'),
95   - 'view_count' => Yii::t('app', 'View Count'),
96   - 'busy' => Yii::t('app', 'Busy'),
97   - 'date_visit' => Yii::t('app', 'Date Visit'),
98   - 'experience' => Yii::t('app', 'Experience'),
99   - 'rank' => Yii::t('app', 'Rank'),
100   - 'salary' => Yii::t('app', 'Salary'),
101   - 'job' => Yii::t('app', 'Job'),
102   - 'location' => Yii::t('app', 'Location'),
103   - 'soft' => Yii::t('app', 'Soft'),
104   - 'user_info_id' => Yii::t('app', 'User Info ID'),
105   - 'guarantee' => Yii::t('app', 'Guarantee'),
106   - 'contract' => Yii::t('app', 'Contract'),
107   - 'estimate' => Yii::t('app', 'Estimate'),
108   - 'purchase' => Yii::t('app', 'Purchase'),
109   - 'delivery' => Yii::t('app', 'Delivery'),
110   - 'prepayment' => Yii::t('app', 'Prepayment'),
111   - 'about' => Yii::t('app', 'About'),
112   - 'type' => Yii::t('app', 'Is Default'),
113   - 'alt_location' => 'Город не в списке',
114   - 'is_customer' => '',
115   - 'is_freelancer' => '',
116 31  
117   - ];
  32 + // Константа обознащающая физическое лицо
  33 + const USER_TYPE_FIZ = 1;
  34 +
  35 + // Константа обозначающая компанию
  36 + const USER_TYPE_COMPANY = 2;
  37 +
  38 + // Константа обозначающая, что компания/физ.лицо свободно
  39 + const USER_STATUS_FREE = 1;
  40 +
  41 + // Константа обозначающая, что компания/физ.лицо занято
  42 + const USER_STATUS_BUSY = 2;
  43 +
  44 + // Константа обозначающая, что компания/физ.лицо хочет стать членом МФП
  45 + const USER_MEMBER_FALSE = 1;
  46 +
  47 + // Константа обозначающая, что компания/физ.лицо не хочет стать членом МФП
  48 + const USER_MEMBER_TRUE = 2;
  49 +
  50 + /**
  51 + * @inheritdoc
  52 + */
  53 + public static function tableName()
  54 + {
  55 + return 'user_info';
  56 + }
  57 +
  58 + /**
  59 + * @inheritdoc
  60 + */
  61 + public function rules()
  62 + {
  63 + return [
  64 + [
  65 + [
  66 + 'contract',
  67 + 'estimate',
  68 + 'purchase',
  69 + 'delivery',
  70 + 'is_customer',
  71 + 'is_freelancer',
  72 + ],
  73 + 'integer',
  74 + ],
  75 + [
  76 + [ 'date_visit' ],
  77 + 'safe',
  78 + ],
  79 + [
  80 + [
  81 + 'soft',
  82 + 'guarantee',
  83 + 'about',
  84 + 'city',
  85 + 'country',
  86 + 'image',
  87 + 'poster',
  88 + 'social_vk',
  89 + 'social_fb',
  90 + 'social_in',
  91 + 'social_t',
  92 + ],
  93 + 'string',
  94 + ],
  95 + [
  96 + [ 'prepayment' ],
  97 + 'number',
  98 + ],
  99 + [
  100 + [ 'experience' ],
  101 + 'integer',
  102 + 'max' => date('Y'),
  103 + 'min' => 1950,
  104 + ],
  105 + [
  106 + [ 'experience' ],
  107 + 'default',
  108 + 'value' => date('Y'),
  109 + ],
  110 + [
  111 + [
  112 + 'rank',
  113 + 'location',
  114 + ],
  115 + 'string',
  116 + 'max' => 50,
  117 + ],
  118 + [
  119 + [
  120 + 'salary',
  121 + 'job',
  122 + ],
  123 + 'string',
  124 + 'max' => 255,
  125 + ],
  126 + [
  127 + [
  128 + 'busy',
  129 + 'member',
  130 + ],
  131 + 'boolean',
  132 + ],
  133 + [
  134 + [ 'view_count', 'busy', 'member' ],
  135 + 'default',
  136 + 'value' => 0,
  137 + ],
  138 + ];
  139 + }
  140 +
  141 + public function getBusyText()
  142 + {
  143 + return $this->busy ? 'Занят' : 'Свободный';
  144 + }
  145 +
  146 + public function getLastVisit()
  147 + {
  148 + return \Yii::$app->formatter->asRelativeTime(new \DateTime($this->date_visit));
  149 + }
  150 +
  151 + /**
  152 + * @inheritdoc
  153 + */
  154 + public function attributeLabels()
  155 + {
  156 + return [
  157 + 'user_id' => Yii::t('app', 'User ID'),
  158 + 'view_count' => Yii::t('app', 'Количество просмотров'),
  159 + 'busy' => Yii::t('app', 'Статус'),
  160 + 'date_visit' => Yii::t('app', 'Дата визита'),
  161 + 'experience' => Yii::t('app', 'Опыт работы'),
  162 + 'rank' => Yii::t('app', 'Rank'),
  163 + 'salary' => Yii::t('app', 'Зарплата'),
  164 + 'job' => Yii::t('app', 'Место работы'),
  165 + 'location' => Yii::t('app', 'Место расположения'),
  166 + 'soft' => Yii::t('app', 'Работа с программами'),
  167 + 'user_info_id' => Yii::t('app', 'User Info ID'),
  168 + 'guarantee' => Yii::t('app', 'Гарантия качества работ'),
  169 + 'contract' => Yii::t('app', 'Работа по договору'),
  170 + 'estimate' => Yii::t('app', 'Предоставляете смету'),
  171 + 'purchase' => Yii::t('app', 'Делаете сами закупку материалов'),
  172 + 'delivery' => Yii::t('app', 'Занимаетесь сами доставкой материалов'),
  173 + 'prepayment' => Yii::t('app', 'Минимальная предоплата за работы'),
  174 + 'about' => Yii::t('app', 'О себе'),
  175 + 'type' => Yii::t('app', 'Is Default'),
  176 + 'member' => Yii::t('app', 'Членство в МФП'),
  177 + 'alt_location' => 'Город не в списке',
  178 + 'country' => Yii::t('app', 'Страна'),
  179 + 'city' => Yii::t('app', 'Город'),
  180 + 'image' => Yii::t('app', 'Аватар'),
  181 + 'poster' => Yii::t('app', 'Подложка'),
  182 + 'social_vk' => Yii::t('app', 'Vk.com'),
  183 + 'social_fb' => Yii::t('app', 'FaceBook.com'),
  184 + 'social_in' => Yii::t('app', 'LinkedIn.com'),
  185 + 'social_t' => Yii::t('app', 'Twitter.com'),
  186 + 'is_customer' => '',
  187 + 'is_freelancer' => '',
  188 +
  189 + ];
  190 + }
118 191 }
119   -}
... ...
frontend/assets/AdminAsset.php
... ... @@ -21,7 +21,7 @@ class AdminAsset extends AssetBundle
21 21 'css/style.css',
22 22 'css/art_box.css',
23 23 '/admin/css/flags32.css',
24   - 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin',
  24 + //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin',
25 25 ];
26 26 public $js = [
27 27 'js/script.js',
... ...
frontend/controllers/AccountsController.php
... ... @@ -275,6 +275,11 @@
275 275 ]);
276 276 }
277 277  
  278 + /**
  279 + * Page of User's image galleries
  280 + *
  281 + * @return string
  282 + */
278 283 public function actionGallery()
279 284 {
280 285 $searchModel = new GallerySearch();
... ... @@ -286,6 +291,11 @@
286 291 ]);
287 292 }
288 293  
  294 + /**
  295 + * Page of User's videos
  296 + *
  297 + * @return string
  298 + */
289 299 public function actionGalleryVideo()
290 300 {
291 301  
... ... @@ -305,7 +315,11 @@
305 315 ]);
306 316 }
307 317  
308   -
  318 + /**
  319 + * Page of creating a photo gallery
  320 + *
  321 + * @return string|\yii\web\Response
  322 + */
309 323 public function actionGalleryCreate()
310 324 {
311 325 $gallery = new Gallery();
... ... @@ -325,6 +339,13 @@
325 339 }
326 340 }
327 341  
  342 + /**
  343 + * Page of updating existing photo gallery
  344 + *
  345 + * @param $id ID of Gallery
  346 + *
  347 + * @return string|\yii\web\Response
  348 + */
328 349 public function actionGalleryUpdate($id)
329 350 {
330 351 $gallery = Gallery::findOne($id);
... ... @@ -344,6 +365,13 @@
344 365 }
345 366 }
346 367  
  368 + /**
  369 + * Page of deleting existing photo gallery
  370 + *
  371 + * @param $id ID of Gallery
  372 + *
  373 + * @throws \Exception
  374 + */
347 375 public function actionGalleryDelete($id)
348 376 {
349 377 Gallery::findOne($id)
... ... @@ -415,11 +443,23 @@
415 443 ]);
416 444 }
417 445  
  446 + /**
  447 + * Renders form via ajax, using lastindex.
  448 + *
  449 + * @param integer $lastindex Last index of form input of current type
  450 + *
  451 + * @return string
  452 + */
418 453 public function actionGetForm($lastindex)
419 454 {
420 455 return $this->renderAjax('_job_form', [ 'index' => $lastindex + 1 ]);
421 456 }
422 457  
  458 + /**
  459 + * Page of User's portfolio
  460 + *
  461 + * @return string
  462 + */
423 463 public function actionPortfolio()
424 464 {
425 465 $searchModel = new PortfolioSearch();
... ... @@ -431,6 +471,11 @@
431 471 ]);
432 472 }
433 473  
  474 + /**
  475 + * Page of creating User's portfolio records.
  476 + *
  477 + * @return string|\yii\web\Response
  478 + */
434 479 public function actionPortfolioCreate()
435 480 {
436 481 $portfolio = new Portfolio();
... ... @@ -457,6 +502,14 @@
457 502 ]);
458 503 }
459 504  
  505 + /**
  506 + * Page of updating User's portfolio record.
  507 + *
  508 + * @param integer $id ID of User's portfolio record
  509 + *
  510 + * @return string|\yii\web\Response
  511 + * @throws NotFoundHttpException if record not found
  512 + */
460 513 public function actionPortfolioUpdate($id)
461 514 {
462 515 $user = \Yii::$app->user->identity;
... ... @@ -493,6 +546,14 @@
493 546 ]);
494 547 }
495 548  
  549 + /**
  550 + * Page of deleting User's portfolio record.
  551 + *
  552 + * @param integer $id ID of User's portfolio record
  553 + *
  554 + * @throws NotFoundHttpException
  555 + * @throws \Exception if record not found
  556 + */
496 557 public function actionPortfolioDelete($id)
497 558 {
498 559 $user = \Yii::$app->user->identity;
... ... @@ -506,6 +567,11 @@
506 567 $this->redirect('portfolio');
507 568 }
508 569  
  570 + /**
  571 + * Page of User's projects.
  572 + *
  573 + * @return string
  574 + */
509 575 public function actionProjects()
510 576 {
511 577 $searchModel = new ProjectSearch();
... ... @@ -517,6 +583,11 @@
517 583 ]);
518 584 }
519 585  
  586 + /**
  587 + * Page of creating User's project.
  588 + *
  589 + * @return string|\yii\web\Response
  590 + */
520 591 public function actionProjectsCreate()
521 592 {
522 593 $project = new Project();
... ... @@ -585,6 +656,14 @@
585 656 ]);
586 657 }
587 658  
  659 + /**
  660 + * Page of updating User's project.
  661 + *
  662 + * @param integer $id ID of User's project
  663 + *
  664 + * @return string
  665 + * @throws NotFoundHttpException if record not found
  666 + */
588 667 public function actionProjectsUpdate($id)
589 668 {
590 669 $user = \Yii::$app->user->identity;
... ... @@ -658,6 +737,14 @@
658 737 ]);
659 738 }
660 739  
  740 + /**
  741 + * Page of deleting User's project
  742 + *
  743 + * @param integer $id ID of User's project
  744 + *
  745 + * @throws NotFoundHttpException
  746 + * @throws \Exception
  747 + */
661 748 public function actionProjectsDelete($id)
662 749 {
663 750 $user = \Yii::$app->user->identity;
... ... @@ -671,6 +758,21 @@
671 758 $this->redirect('projects');
672 759 }
673 760  
  761 + /**
  762 + * Page of editting User's service info. Consist of:
  763 + * * cost of work;
  764 + * * service specializations;
  765 + * * work geography;
  766 + * * work guarantee;
  767 + * * work on contract;
  768 + * * providing estimates;
  769 + * * purchase of materials;
  770 + * * delivery of materials;
  771 + * * minimal prepayment;
  772 + * * payment types;
  773 + *
  774 + * @return string
  775 + */
674 776 public function actionService()
675 777 {
676 778 $user = \Yii::$app->user->identity;
... ... @@ -678,14 +780,7 @@
678 780 if(empty( $user_info )) {
679 781 $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]);
680 782 }
681   - $specialization = Specialization::find()
682   - ->select([
683   - 'specialization_name',
684   - 'specialization_id',
685   - ])
686   - ->indexBy('specialization_id')
687   - ->asArray()
688   - ->column();
  783 + $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
689 784 $payment = Payment::find()
690 785 ->select([
691 786 'name',
... ... @@ -714,13 +809,16 @@
714 809 return $this->render('service', [
715 810 'user' => $user,
716 811 'user_info' => $user_info,
717   - 'specialization' => $specialization,
  812 + 'specializations' => $specializations,
718 813 'payment' => $payment,
719 814 ]);
720 815 }
721 816  
722 817 /**
723   - * $user User
  818 + * Page of account setting. Consist of:
  819 + * * changing password;
  820 + *
  821 + * @return string
724 822 */
725 823 public function actionSetting()
726 824 {
... ... @@ -757,6 +855,11 @@
757 855 return $this->render('setting', [ 'user' => $user ]);
758 856 }
759 857  
  858 + /**
  859 + * Page of company's team
  860 + *
  861 + * @return string
  862 + */
760 863 public function actionTeam()
761 864 {
762 865 $searchModel = new TeamSearch();
... ... @@ -768,6 +871,11 @@
768 871 ]);
769 872 }
770 873  
  874 + /**
  875 + * Page of creating company's team member
  876 + *
  877 + * @return string|\yii\web\Response
  878 + */
771 879 public function actionTeamCreate()
772 880 {
773 881 $team = new Team();
... ... @@ -799,6 +907,14 @@
799 907 }
800 908 }
801 909  
  910 + /**
  911 + * Page of updating company's team member info.
  912 + *
  913 + * @param integer $id ID of company's team member
  914 + *
  915 + * @return string|\yii\web\Response
  916 + * @throws NotFoundHttpException
  917 + */
802 918 public function actionTeamUpdate($id)
803 919 {
804 920 $user = \Yii::$app->user->identity;
... ... @@ -836,6 +952,14 @@
836 952 }
837 953 }
838 954  
  955 + /**
  956 + * Page of deleting company's team member.
  957 + *
  958 + * @param integer $id ID of company's team member
  959 + *
  960 + * @throws NotFoundHttpException
  961 + * @throws \Exception
  962 + */
839 963 public function actionTeamDelete($id)
840 964 {
841 965 $user = \Yii::$app->user->identity;
... ... @@ -850,6 +974,11 @@
850 974 $this->redirect('team');
851 975 }
852 976  
  977 + /**
  978 + * Page of company's vacancies
  979 + *
  980 + * @return string
  981 + */
853 982 public function actionVacancy()
854 983 {
855 984 $searchModel = new VacancySearch();
... ... @@ -861,6 +990,11 @@
861 990 ]);
862 991 }
863 992  
  993 + /**
  994 + * Page of creating company's vacancies.
  995 + *
  996 + * @return string|\yii\web\Response
  997 + */
864 998 public function actionVacancyCreate()
865 999 {
866 1000 $vacancy = new Vacancy();
... ... @@ -895,6 +1029,14 @@
895 1029 ]);
896 1030 }
897 1031  
  1032 + /**
  1033 + * Page of updating company's vacancy.
  1034 + *
  1035 + * @param integer $id ID of company's vacancy.
  1036 + *
  1037 + * @return string|\yii\web\Response
  1038 + * @throws NotFoundHttpException
  1039 + */
898 1040 public function actionVacancyUpdate($id)
899 1041 {
900 1042 $user = \Yii::$app->user->identity;
... ... @@ -935,6 +1077,14 @@
935 1077 ]);
936 1078 }
937 1079  
  1080 + /**
  1081 + * Page of deleting company's vacancy.
  1082 + *
  1083 + * @param integer $id ID of company's vacancy
  1084 + *
  1085 + * @throws NotFoundHttpException
  1086 + * @throws \Exception
  1087 + */
938 1088 public function actionVacancyDelete($id)
939 1089 {
940 1090 $user = \Yii::$app->user->identity;
... ... @@ -950,10 +1100,12 @@
950 1100 }
951 1101  
952 1102 /**
953   - * @param $id
  1103 + * Used to find model of User and throws exception if not found.
954 1104 *
955   - * @return User
956   - * @throws NotFoundHttpException
  1105 + * @param integer $id ID of User
  1106 + *
  1107 + * @return User if User with particular ID found
  1108 + * @throws NotFoundHttpException if User with particular ID not found
957 1109 */
958 1110 protected function findUser($id)
959 1111 {
... ...
frontend/controllers/PerformerController.php
... ... @@ -25,6 +25,18 @@ class PerformerController extends Controller
25 25 public $user;
26 26 public $defaultAction = 'common';
27 27  
  28 + public function afterAction($action, $result)
  29 + {
  30 + if(!empty($action->controller->actionParams['performer_id'])) {
  31 + $performer_id = $action->controller->actionParams['performer_id'];
  32 + $user = User::findOne($performer_id);
  33 + if(!empty($user->userInfo)) {
  34 + $user->userInfo->updateCounters(['view_count' => 1]);
  35 + }
  36 + }
  37 + return parent::afterAction($action, $result);
  38 + }
  39 +
28 40 /**
29 41 * @inheritdoc
30 42 */
... ... @@ -145,7 +157,7 @@ class PerformerController extends Controller
145 157 }
146 158  
147 159  
148   - $query = Blog::find(['user_id'=>$performer_id]);
  160 + $query = $user->getBlog();
149 161  
150 162 $countQuery = clone $query;
151 163  
... ... @@ -179,8 +191,7 @@ class PerformerController extends Controller
179 191  
180 192  
181 193 $article = Blog::findOne(['link'=>$link,'user_id'=>$performer_id]);
182   - $article->view_count ++;
183   - $article->save();
  194 + $article->updateCounters(['view_count' => 1]);
184 195  
185 196  
186 197 return $this->render('blog-view',[
... ...
frontend/controllers/SiteController.php
... ... @@ -104,7 +104,6 @@ class SiteController extends Controller
104 104 public function actionIndex()
105 105 {
106 106 $specializations = Specialization::find()->where(['specialization_pid'=>0])->orderBy('specialization_id')->all();
107   -
108 107 return $this->render('index',[
109 108 'specializations' => $specializations,
110 109 ]);
... ...
frontend/views/accounts/_portfolio_form.php
... ... @@ -89,24 +89,6 @@ use yii\web\JsExpression;
89 89 <div class="not-file-mb-adm">До 3 Мб файл</div>
90 90 </div>
91 91  
92   - <div class="input-blocks-wrapper admin-avatar portfolio-foto-admin hidden-foto foto-portfolio-adm">
93   - <div class="gen-admin-title">Фото главное</div>
94   - <div class="not-file-txt-adm">Файл не выбран</div>
95   - <?= ImageUploader::widget([
96   - 'model'=> $portfolio,
97   - 'field'=>'cover',
98   - 'width'=>100,
99   - 'height'=>100,
100   - 'multi'=>false,
101   - 'gallery' =>$portfolio->cover,
102   - 'name' => 'Загрузить'
103   - ]);
104   - ?>
105   - <div class="not-file-mb-adm">До 3 Мб файл</div>
106   - </div>
107   -
108   -
109   -
110 92 <div class="input-blocks-wrapper">
111 93 <div class="input-blocks">
112 94 <?=
... ...
frontend/views/accounts/_vacancy_form.php
... ... @@ -7,8 +7,10 @@
7 7 use common\models\Vacancy;
8 8 use common\widgets\FieldEditor;
9 9 use common\widgets\ImageUploader;
  10 + use kartik\select2\Select2;
10 11 use mihaildev\ckeditor\CKEditor;
11 12 use yii\helpers\Html;
  13 + use yii\web\JsExpression;
12 14 use yii\widgets\ActiveForm;
13 15  
14 16 $this->title = 'Вакансии';
... ... @@ -29,8 +31,28 @@
29 31 <?= $form->field($vacancy, 'user_name')
30 32 ->textInput() ?>
31 33  
32   -<?= $form->field($vacancy, 'city')
33   - ->textInput() ?>
  34 +<div class="input-blocks-wrapper">
  35 + <div class="input-blocks">
  36 + <?=
  37 + $form->field($vacancy, 'city')->widget(Select2::classname(), [
  38 + 'options' => ['placeholder' => 'Выбор города ...'],
  39 + 'pluginOptions' => [
  40 + 'allowClear' => true,
  41 + 'minimumInputLength' => 3,
  42 + 'ajax' => [
  43 + 'url' => \yii\helpers\Url::to(['site/city']),
  44 + 'dataType' => 'json',
  45 + 'data' => new JsExpression('function(params) { return {q:params.term}; }')
  46 + ],
  47 + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
  48 + 'templateResult' => new JsExpression('function(city) { return city.text; }'),
  49 + 'templateSelection' => new JsExpression('function (city) { return city.text; }'),
  50 + ],
  51 + ]);
  52 + ?>
  53 +
  54 + </div>
  55 +</div>
34 56  
35 57 <?= $form->field($vacancy, 'employmentInput')
36 58 ->checkboxList($employment) ?>
... ...
frontend/views/accounts/general.php
... ... @@ -82,7 +82,6 @@
82 82 <div class="input-blocks-wrapper">
83 83 <div class="input-blocks">
84 84 <?= $form->field ($company_info, 'name', ['options' => ['class' => 'form-group company_info']])
85   - ->label ('Название компании')
86 85 ->textInput (['class'=> 'custom-input-2']);
87 86 ?>
88 87 </div>
... ... @@ -90,7 +89,6 @@
90 89 <div class="input-blocks-wrapper">
91 90 <div class="input-blocks">
92 91 <?= $form->field ($company_info, 'staff', ['options' => ['class' => 'form-group company_info']])
93   - ->label ('Количество сотрудников')
94 92 ->textInput (['class'=> 'custom-input-2','type'=>'number']);
95 93 ?>
96 94 </div>
... ... @@ -117,10 +115,23 @@
117 115 </div>
118 116 <div class="input-blocks-wrapper">
119 117 <div class="input-blocks">
120   - <?= $form->field ($user_info, 'country')
121   - ->label ('Ваша страна')
122   - ->textInput (['class'=> 'custom-input-2']);
123   - ?>
  118 + <?=
  119 + $form->field($user_info, 'country')->widget(Select2::classname(), [
  120 + 'options' => ['placeholder' => 'Выбор страны ...'],
  121 + 'pluginOptions' => [
  122 + 'allowClear' => true,
  123 + 'minimumInputLength' => 3,
  124 + 'ajax' => [
  125 + 'url' => \yii\helpers\Url::to(['site/country']),
  126 + 'dataType' => 'json',
  127 + 'data' => new JsExpression('function(params) { return {q:params.term}; }')
  128 + ],
  129 + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
  130 + 'templateResult' => new JsExpression('function(country) { return country.text; }'),
  131 + 'templateSelection' => new JsExpression('function (country) { return country.text; }'),
  132 + ],
  133 + ]);
  134 + ?>
124 135 </div>
125 136 </div>
126 137 <div class="input-blocks-wrapper">
... ... @@ -147,14 +158,12 @@
147 158  
148 159 <div class="input-blocks street-input">
149 160 <?= $form->field ($company_info, 'street', ['options' => ['class' => 'form-group company_info']])
150   - ->label ('Улица')
151 161 ->textInput (['class'=> 'custom-input-2']);
152 162 ?>
153 163 </div>
154 164  
155 165 <div class="input-blocks home-input">
156 166 <?= $form->field ($company_info, 'house', ['options' => ['class' => 'form-group company_info']])
157   - ->label ('Дом')
158 167 ->textInput (['class'=> 'custom-input-2']);
159 168 ?>
160 169 </div>
... ... @@ -163,7 +172,6 @@
163 172 <div class="input-blocks-wrapper ">
164 173 <div class="input-blocks">
165 174 <?= $form->field ($user, 'email')
166   - ->label ('Email')
167 175 ->textInput (['class'=> 'custom-input-2']);
168 176 ?>
169 177 </div>
... ...
frontend/views/accounts/service.php
... ... @@ -5,8 +5,10 @@
5 5 * @var string[] $specialization
6 6 * @var string[] $payment
7 7 */
  8 + use common\models\Specialization;
8 9 use common\models\User;
9 10 use common\models\UserInfo;
  11 + use yii\helpers\ArrayHelper;
10 12 use yii\helpers\Html;
11 13 use yii\widgets\ActiveForm;
12 14  
... ... @@ -40,11 +42,31 @@
40 42  
41 43  
42 44 <div class="input-blocks-wrapper">
43   - <div class="input-blocks">
44   - <?= $form->field($user, 'specializationInput')
45   - ->label('Специализация услуг')
46   - ->checkboxList($specialization) ?>
47   - </div>
  45 + <ul class="content-menu-first">
  46 + <?php foreach($specializations as $specialization):?>
  47 + <li data-img="<?= $specialization->image?>">
  48 + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name?></a>
  49 + <ul>
  50 + <?php foreach($specialization->children as $child_first):?>
  51 +
  52 + <?php if($child_first instanceof Specialization):?>
  53 + <li>
  54 + <a href="#"><?= $child_first->specialization_name?></a>
  55 + <ul>
  56 + <?php foreach($child_first->children as $child_second):?>
  57 + <?php if($child_first instanceof Specialization): ?>
  58 + <li><a href="#"><?= Html::checkbox('User[specializationInput][]', in_array($child_second->specialization_id, ArrayHelper::getColumn($user->specializations,'specialization_id')),['value' => $child_second->specialization_id, 'label' =>$child_second->specialization_name])?></a></li>
  59 + <?php endif;?>
  60 + <?php endforeach; ?>
  61 + </ul>
  62 + </li>
  63 + <?php endif; ?>
  64 + <?php endforeach; ?>
  65 +
  66 + </ul>
  67 + </li>
  68 + <?php endforeach; ?>
  69 + </ul>
48 70 </div>
49 71 <div class="input-blocks-wrapper">
50 72 <div class="input-blocks" style="color: red">
... ... @@ -67,8 +89,8 @@
67 89 <?= $form->field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ])
68 90 ->label('Работа по договору')
69 91 ->radioList([
70   - 0 => 'Да',
71   - 1 => 'Нет',
  92 + 1 => 'Да',
  93 + 0 => 'Нет',
72 94 ],
73 95 [
74 96 'item' => function($index, $label, $name, $checked, $value) {
... ... @@ -89,8 +111,8 @@
89 111 <?= $form->field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ])
90 112 ->label('Предоставляете смету')
91 113 ->radioList([
92   - 0 => 'Да',
93   - 1 => 'Нет',
  114 + 1 => 'Да',
  115 + 0 => 'Нет',
94 116 ], [
95 117 'item' => function($index, $label, $name, $checked, $value) {
96 118 $return = '<div class="admin-who-check">';
... ... @@ -110,8 +132,8 @@
110 132 <?= $form->field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ])
111 133 ->label('Делаете сами закупку материалов')
112 134 ->radioList([
113   - 0 => 'Да',
114   - 1 => 'Нет',
  135 + 1 => 'Да',
  136 + 0 => 'Нет',
115 137 ], [
116 138 'item' => function($index, $label, $name, $checked, $value) {
117 139 $return = '<div class="admin-who-check">';
... ... @@ -130,8 +152,8 @@
130 152 <?= $form->field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ])
131 153 ->label('Занимаетесь сами доставкой материалов')
132 154 ->radioList([
133   - 0 => 'Да',
134   - 1 => 'Нет',
  155 + 1 => 'Да',
  156 + 0 => 'Нет',
135 157 ], [
136 158 'item' => function($index, $label, $name, $checked, $value) {
137 159 $return = '<div class="admin-who-check">';
... ...
frontend/views/layouts/performer.php
... ... @@ -101,16 +101,16 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
101 101 <div class="performer-vacancy-sidebar-soc style">
102 102 <ul>
103 103 <li>
104   - <?= Html::a(Html::img('/images/ico-fb.png'),[$this->params['user']->userInfo->social_fb],['target'=>'_blank'])?>
  104 + <?= Html::a(Html::img('/images/ico-fb.png'),"{$this->params['user']->userInfo->social_fb}",['target'=>'_blank'])?>
105 105 </li>
106 106 <li>
107   - <?= Html::a(Html::img('/images/ico-tw.png'),[$this->params['user']->userInfo->social_t],['target'=>'_blank'])?>
  107 + <?= Html::a(Html::img('/images/ico-tw.png'),"{$this->params['user']->userInfo->social_t}", ['target'=>'_blank'])?>
108 108 </li>
109 109 <li>
110   - <?= Html::a(Html::img('/images/ico-in.png'),[$this->params['user']->userInfo->social_in],['target'=>'_blank'])?>
  110 + <?= Html::a(Html::img('/images/ico-in.png'),"{$this->params['user']->userInfo->social_in}",['target'=>'_blank'])?>
111 111 </li>
112 112 <li>
113   - <?= Html::a(Html::img('/images/ico-vk.png'),[$this->params['user']->userInfo->social_vk],['target'=>'_blank'])?>
  113 + <?= Html::a(Html::img('/images/ico-vk.png'),"{$this->params['user']->userInfo->social_vk}",['target'=>'_blank'])?>
114 114 </li>
115 115 </ul>
116 116 </div>
... ... @@ -124,7 +124,7 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
124 124 <li><img src="/images/sidebar-ico/ico-11.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Звание в МФП:<br /></span><?= $this->params['user']->userInfo->rank?></div></li>
125 125 <li><img src="/images/sidebar-ico/ico-12.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Стоимость работ:<br /></span><?= $this->params['user']->userInfo->salary?></div></li>
126 126 <li><img src="/images/sidebar-ico/ico-13.png" alt=""/><div class="sidebarvievstxt"><?= implode(', ',ArrayHelper::getColumn($this->params['user']->payments,'name'))?></div></li>
127   - <li><img src="/images/sidebar-ico/ico-14.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Текущее место работы:<br /></span><?= $this->params['user']->userInfo->job?></div></li>
  127 + <li><img src="/images/sidebar-ico/ico-14.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Текущее место работы:<br /></span><?= $this->params['user']->currentJob->name?></div></li>
128 128  
129 129 </ul>
130 130 </div>
... ...
frontend/views/performer/_blog_list_view.php
... ... @@ -16,12 +16,12 @@ use yii\helpers\Url;
16 16 <span></span><p><?= $model->view_count?></p>
17 17 </div>
18 18 <div class="blog-post-comm-num">
19   - <span></span><p><?= $model->view_count?></p>
  19 + <span></span><p>XX</p>
20 20 </div>
21 21 </div>
22 22 <div class="blog-post-content style">
23 23 <?= Html::a(Html::img($model->cover), Url::toRoute(['/performer/blog-view','performer_id'=>$this->params['user']->id,'link'=>$model->link]));?>
24   - <?= StringHelper::truncate($model->description, 1500)?>
  24 + <?= StringHelper::truncate($model->description, 1500, '...', null, true)?>
25 25 </div>
26 26 <?= Html::a('<span>Подробнее</span>', Url::toRoute(['performer/blog-view','performer_id'=>$this->params['user']->id,'link'=>$model->link]),['class'=>'blog-post-see-all style']);?>
27 27 </div>
28 28 \ No newline at end of file
... ...
frontend/views/performer/common.php
... ... @@ -145,7 +145,7 @@ $this-&gt;title = &#39;My Yii Application&#39;;
145 145 <div class="style">
146 146 <div class="profile-site">
147 147 <img src="/images/ico-site.png" alt=""/>
148   - <a href="<?= $site['site']?>" target="_blank">Сайт</a>
  148 + <a href="http://<?= $site['site']?>" target="_blank"><?= $site['site']?></a>
149 149 </div>
150 150 </div>
151 151 <?php endforeach; ?>
... ...
frontend/views/performer/portfolio_list_view.php
... ... @@ -2,8 +2,6 @@
2 2 use yii\helpers\ArrayHelper;
3 3 use yii\helpers\Html;
4 4 use yii\helpers\StringHelper;
5   -
6   -
7 5 ?>
8 6 <div class="portfolio-project-blocks-wr">
9 7 <div class="portfolio-project-blocks-img-title">
... ...
frontend/views/performer/workplace.php
1 1 <?php
  2 + /**
  3 + * @var yii\web\View $this
  4 + * @var User $user
  5 + */
  6 + use common\models\User;
2 7  
3   -use \yii\helpers\Html;
4   -
5   -/* @var $this yii\web\View */
6   -$this->params['user'] = $user;
7   -$this->title = 'My Yii Application';
  8 + $this->params[ 'user' ] = $user;
  9 + $this->title = 'My Yii Application';
8 10 ?>
9 11 <div class="performer-vacancy-vacant-title-reclam-wr style">
10 12 <div class="workplace-wr">
11 13 <div class="workplace-title style"><p>Опыт работы</p></div>
12 14 <div class="workplace-experience-wr style">
13   -
14   - <?php foreach($user->jobs as $job):?>
  15 + <?php foreach($user->jobs as $job): ?>
15 16 <div class="workplace-experience-post">
16 17 <div class="workplace-experience-post-title"><?= $job->name ?></div>
17   - <div class="workplace-experience-post-date"><?= $job->date_start ?>-<?= $job->date_end ?> (<?= $job->expTime ?>)</div>
  18 + <div class="workplace-experience-post-date">
  19 + <?php
  20 + if(!empty($job->date_start) && !empty($job->date_end)) {
  21 + echo $job->date_start . '-' . $job->date_end . ' (' . $job->expTime . ')';
  22 + } elseif(!empty($job->date_start)) {
  23 + echo 'с ' . $job->date_start . ' (' . $job->expTime . ')';
  24 + } elseif(!empty($job->date_end)) {
  25 + echo 'до ' . $job->date_end;
  26 + }
  27 + ?>
  28 + </div>
18 29 <div class="workplace-experience-post-vacancy"><?= $job->position ?></div>
19 30 </div>
20 31 <?php endforeach; ?>
21 32  
22 33  
23   -
24 34 </div>
25 35 </div>
26 36 </div>
27 37 \ No newline at end of file
... ...