Commit e8236f4408c40a8a5f9a5c03612382d4ec962721
1 parent
9e040221
test
Showing
12 changed files
with
586 additions
and
173 deletions
Show diff stats
common/models/CompanyInfo.php
@@ -31,7 +31,9 @@ class CompanyInfo extends \yii\db\ActiveRecord | @@ -31,7 +31,9 @@ class CompanyInfo extends \yii\db\ActiveRecord | ||
31 | { | 31 | { |
32 | return [ | 32 | return [ |
33 | [['name', 'street', 'house'], 'string'], | 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,11 +44,11 @@ class CompanyInfo extends \yii\db\ActiveRecord | ||
42 | { | 44 | { |
43 | return [ | 45 | return [ |
44 | 'company_info_id' => Yii::t('app', 'Company Info ID'), | 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/User.php
@@ -4,7 +4,10 @@ | @@ -4,7 +4,10 @@ | ||
4 | use Yii; | 4 | use Yii; |
5 | use yii\base\NotSupportedException; | 5 | use yii\base\NotSupportedException; |
6 | use yii\behaviors\TimestampBehavior; | 6 | use yii\behaviors\TimestampBehavior; |
7 | + use yii\db\ActiveQuery; | ||
7 | use yii\db\ActiveRecord; | 8 | use yii\db\ActiveRecord; |
9 | + use yii\rbac\ManagerInterface; | ||
10 | + use yii\rbac\Role; | ||
8 | use yii\web\IdentityInterface; | 11 | use yii\web\IdentityInterface; |
9 | use developeruz\db_rbac\interfaces\UserRbacInterface; | 12 | use developeruz\db_rbac\interfaces\UserRbacInterface; |
10 | 13 | ||
@@ -23,11 +26,6 @@ | @@ -23,11 +26,6 @@ | ||
23 | */ | 26 | */ |
24 | class User extends ActiveRecord implements IdentityInterface, UserRbacInterface | 27 | class User extends ActiveRecord implements IdentityInterface, UserRbacInterface |
25 | { | 28 | { |
26 | - | ||
27 | - /** | ||
28 | - * @var array EAuth attributes | ||
29 | - */ | ||
30 | - | ||
31 | const STATUS_DELETED = 0; | 29 | const STATUS_DELETED = 0; |
32 | const STATUS_ACTIVE = 10; | 30 | const STATUS_ACTIVE = 10; |
33 | 31 | ||
@@ -294,11 +292,21 @@ | @@ -294,11 +292,21 @@ | ||
294 | $this->password_reset_token = NULL; | 292 | $this->password_reset_token = NULL; |
295 | } | 293 | } |
296 | 294 | ||
295 | + /** | ||
296 | + * Returns name of the User | ||
297 | + * | ||
298 | + * @return string | ||
299 | + */ | ||
297 | public function getUserName() | 300 | public function getUserName() |
298 | { | 301 | { |
299 | return $this->username; | 302 | return $this->username; |
300 | } | 303 | } |
301 | 304 | ||
305 | + /** | ||
306 | + * Return array of all User's roles | ||
307 | + * | ||
308 | + * @return array | ||
309 | + */ | ||
302 | public function getRoles() | 310 | public function getRoles() |
303 | { | 311 | { |
304 | $auth = \Yii::$app->authManager; | 312 | $auth = \Yii::$app->authManager; |
@@ -306,6 +314,13 @@ | @@ -306,6 +314,13 @@ | ||
306 | return $roles; | 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 | protected function getRoleChildrenRecursive($roles, $auth, $result = [ ]) | 324 | protected function getRoleChildrenRecursive($roles, $auth, $result = [ ]) |
310 | { | 325 | { |
311 | if(is_array($roles) && !empty( $roles )) { | 326 | if(is_array($roles) && !empty( $roles )) { |
@@ -322,42 +337,74 @@ | @@ -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 | public function getUserInfo() | 345 | public function getUserInfo() |
332 | { | 346 | { |
333 | return $this->hasOne(UserInfo::className(), [ 'user_id' => 'id' ]); | 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 | public function getIsPerformer() | 357 | public function getIsPerformer() |
337 | { | 358 | { |
338 | return true; | 359 | return true; |
339 | } | 360 | } |
340 | 361 | ||
362 | + /** | ||
363 | + * Return CompanyInfo for this User | ||
364 | + * | ||
365 | + * @return \yii\db\ActiveQuery | ||
366 | + */ | ||
341 | public function getCompanyInfo() | 367 | public function getCompanyInfo() |
342 | { | 368 | { |
343 | return $this->hasOne(CompanyInfo::className(), [ 'user_id' => 'id' ]); | 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 | public function getPhones() | 377 | public function getPhones() |
347 | { | 378 | { |
348 | return Fields::getData($this->id, self::className(), 'phone'); | 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 | public function getSite() | 387 | public function getSite() |
352 | { | 388 | { |
353 | return Fields::getData($this->id, self::className(), 'site'); | 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 | public function getAddress() | 398 | public function getAddress() |
357 | { | 399 | { |
358 | return $this->userInfo->country . ', ' . $this->userInfo->city . ', ' . $this->companyInfo->street . ', ' . $this->companyInfo->house; | 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 | public function getLiveTime() | 408 | public function getLiveTime() |
362 | { | 409 | { |
363 | $now = new \DateTime('now'); | 410 | $now = new \DateTime('now'); |
@@ -365,17 +412,34 @@ | @@ -365,17 +412,34 @@ | ||
365 | return \Yii::$app->formatter->asRelativeTime($date1->diff($now)); | 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 | public function getIsCustomer() | 422 | public function getIsCustomer() |
369 | { | 423 | { |
370 | return true; | 424 | return true; |
371 | } | 425 | } |
372 | 426 | ||
427 | + /** | ||
428 | + * Return array of payments types accepted by the user. | ||
429 | + * | ||
430 | + * @return ActiveQuery | ||
431 | + */ | ||
373 | public function getPayments() | 432 | public function getPayments() |
374 | { | 433 | { |
375 | return $this->hasMany(Payment::className(), [ 'payment_id' => 'payment_id' ]) | 434 | return $this->hasMany(Payment::className(), [ 'payment_id' => 'payment_id' ]) |
376 | ->viaTable('user_payment', [ 'user_id' => 'id' ]); | 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 | public function getPaymentInput() | 443 | public function getPaymentInput() |
380 | { | 444 | { |
381 | return $this->getPayments() | 445 | return $this->getPayments() |
@@ -383,27 +447,62 @@ | @@ -383,27 +447,62 @@ | ||
383 | ->column(); | 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 | public function setPaymentInput($value) | 455 | public function setPaymentInput($value) |
387 | { | 456 | { |
388 | $this->paymentInput = $value; | 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 | public function getSpecializations() | 465 | public function getSpecializations() |
392 | { | 466 | { |
393 | return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ]) | 467 | return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ]) |
394 | ->viaTable('user_specialization', [ 'user_id' => 'id' ]); | 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 | public function getBlog() | 476 | public function getBlog() |
398 | { | 477 | { |
399 | return $this->hasMany(Blog::className(), [ 'user_id' => 'id' ]); | 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 | public function getJobs() | 486 | public function getJobs() |
403 | { | 487 | { |
404 | return $this->hasMany(Job::className(), [ 'user_id' => 'id' ]); | 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 | public function getSpecializationInput() | 506 | public function getSpecializationInput() |
408 | { | 507 | { |
409 | return $this->getSpecializations() | 508 | return $this->getSpecializations() |
@@ -411,26 +510,51 @@ | @@ -411,26 +510,51 @@ | ||
411 | ->column(); | 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 | public function setSpecializationInput($value) | 518 | public function setSpecializationInput($value) |
415 | { | 519 | { |
416 | $this->specializationInput = $value; | 520 | $this->specializationInput = $value; |
417 | } | 521 | } |
418 | 522 | ||
523 | + /** | ||
524 | + * Return array of User's portfolios. | ||
525 | + * | ||
526 | + * @return ActiveQuery | ||
527 | + */ | ||
419 | public function getPortfolios() | 528 | public function getPortfolios() |
420 | { | 529 | { |
421 | return $this->hasMany(Portfolio::className(), [ 'user_id' => 'id' ]); | 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 | public function getProjects() | 538 | public function getProjects() |
425 | { | 539 | { |
426 | return $this->hasMany(Project::className(), [ 'user_id' => 'id' ]); | 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 | public function getTeams() | 548 | public function getTeams() |
430 | { | 549 | { |
431 | return $this->hasMany(Team::className(), [ 'user_id' => 'id' ]); | 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 | public function getVacancies() | 558 | public function getVacancies() |
435 | { | 559 | { |
436 | return $this->hasMany(Vacancy::className(), [ 'user_id' => 'id' ]); | 560 | return $this->hasMany(Vacancy::className(), [ 'user_id' => 'id' ]); |
common/models/UserInfo.php
1 | <?php | 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,7 +21,7 @@ class AdminAsset extends AssetBundle | ||
21 | 'css/style.css', | 21 | 'css/style.css', |
22 | 'css/art_box.css', | 22 | 'css/art_box.css', |
23 | '/admin/css/flags32.css', | 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 | public $js = [ | 26 | public $js = [ |
27 | 'js/script.js', | 27 | 'js/script.js', |
frontend/controllers/AccountsController.php
@@ -275,6 +275,11 @@ | @@ -275,6 +275,11 @@ | ||
275 | ]); | 275 | ]); |
276 | } | 276 | } |
277 | 277 | ||
278 | + /** | ||
279 | + * Page of User's image galleries | ||
280 | + * | ||
281 | + * @return string | ||
282 | + */ | ||
278 | public function actionGallery() | 283 | public function actionGallery() |
279 | { | 284 | { |
280 | $searchModel = new GallerySearch(); | 285 | $searchModel = new GallerySearch(); |
@@ -286,6 +291,11 @@ | @@ -286,6 +291,11 @@ | ||
286 | ]); | 291 | ]); |
287 | } | 292 | } |
288 | 293 | ||
294 | + /** | ||
295 | + * Page of User's videos | ||
296 | + * | ||
297 | + * @return string | ||
298 | + */ | ||
289 | public function actionGalleryVideo() | 299 | public function actionGalleryVideo() |
290 | { | 300 | { |
291 | 301 | ||
@@ -305,7 +315,11 @@ | @@ -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 | public function actionGalleryCreate() | 323 | public function actionGalleryCreate() |
310 | { | 324 | { |
311 | $gallery = new Gallery(); | 325 | $gallery = new Gallery(); |
@@ -325,6 +339,13 @@ | @@ -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 | public function actionGalleryUpdate($id) | 349 | public function actionGalleryUpdate($id) |
329 | { | 350 | { |
330 | $gallery = Gallery::findOne($id); | 351 | $gallery = Gallery::findOne($id); |
@@ -344,6 +365,13 @@ | @@ -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 | public function actionGalleryDelete($id) | 375 | public function actionGalleryDelete($id) |
348 | { | 376 | { |
349 | Gallery::findOne($id) | 377 | Gallery::findOne($id) |
@@ -415,11 +443,23 @@ | @@ -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 | public function actionGetForm($lastindex) | 453 | public function actionGetForm($lastindex) |
419 | { | 454 | { |
420 | return $this->renderAjax('_job_form', [ 'index' => $lastindex + 1 ]); | 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 | public function actionPortfolio() | 463 | public function actionPortfolio() |
424 | { | 464 | { |
425 | $searchModel = new PortfolioSearch(); | 465 | $searchModel = new PortfolioSearch(); |
@@ -431,6 +471,11 @@ | @@ -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 | public function actionPortfolioCreate() | 479 | public function actionPortfolioCreate() |
435 | { | 480 | { |
436 | $portfolio = new Portfolio(); | 481 | $portfolio = new Portfolio(); |
@@ -457,6 +502,14 @@ | @@ -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 | public function actionPortfolioUpdate($id) | 513 | public function actionPortfolioUpdate($id) |
461 | { | 514 | { |
462 | $user = \Yii::$app->user->identity; | 515 | $user = \Yii::$app->user->identity; |
@@ -493,6 +546,14 @@ | @@ -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 | public function actionPortfolioDelete($id) | 557 | public function actionPortfolioDelete($id) |
497 | { | 558 | { |
498 | $user = \Yii::$app->user->identity; | 559 | $user = \Yii::$app->user->identity; |
@@ -506,6 +567,11 @@ | @@ -506,6 +567,11 @@ | ||
506 | $this->redirect('portfolio'); | 567 | $this->redirect('portfolio'); |
507 | } | 568 | } |
508 | 569 | ||
570 | + /** | ||
571 | + * Page of User's projects. | ||
572 | + * | ||
573 | + * @return string | ||
574 | + */ | ||
509 | public function actionProjects() | 575 | public function actionProjects() |
510 | { | 576 | { |
511 | $searchModel = new ProjectSearch(); | 577 | $searchModel = new ProjectSearch(); |
@@ -517,6 +583,11 @@ | @@ -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 | public function actionProjectsCreate() | 591 | public function actionProjectsCreate() |
521 | { | 592 | { |
522 | $project = new Project(); | 593 | $project = new Project(); |
@@ -585,6 +656,14 @@ | @@ -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 | public function actionProjectsUpdate($id) | 667 | public function actionProjectsUpdate($id) |
589 | { | 668 | { |
590 | $user = \Yii::$app->user->identity; | 669 | $user = \Yii::$app->user->identity; |
@@ -658,6 +737,14 @@ | @@ -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 | public function actionProjectsDelete($id) | 748 | public function actionProjectsDelete($id) |
662 | { | 749 | { |
663 | $user = \Yii::$app->user->identity; | 750 | $user = \Yii::$app->user->identity; |
@@ -671,6 +758,21 @@ | @@ -671,6 +758,21 @@ | ||
671 | $this->redirect('projects'); | 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 | public function actionService() | 776 | public function actionService() |
675 | { | 777 | { |
676 | $user = \Yii::$app->user->identity; | 778 | $user = \Yii::$app->user->identity; |
@@ -678,14 +780,7 @@ | @@ -678,14 +780,7 @@ | ||
678 | if(empty( $user_info )) { | 780 | if(empty( $user_info )) { |
679 | $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); | 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 | $payment = Payment::find() | 784 | $payment = Payment::find() |
690 | ->select([ | 785 | ->select([ |
691 | 'name', | 786 | 'name', |
@@ -714,13 +809,16 @@ | @@ -714,13 +809,16 @@ | ||
714 | return $this->render('service', [ | 809 | return $this->render('service', [ |
715 | 'user' => $user, | 810 | 'user' => $user, |
716 | 'user_info' => $user_info, | 811 | 'user_info' => $user_info, |
717 | - 'specialization' => $specialization, | 812 | + 'specializations' => $specializations, |
718 | 'payment' => $payment, | 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 | public function actionSetting() | 823 | public function actionSetting() |
726 | { | 824 | { |
@@ -757,6 +855,11 @@ | @@ -757,6 +855,11 @@ | ||
757 | return $this->render('setting', [ 'user' => $user ]); | 855 | return $this->render('setting', [ 'user' => $user ]); |
758 | } | 856 | } |
759 | 857 | ||
858 | + /** | ||
859 | + * Page of company's team | ||
860 | + * | ||
861 | + * @return string | ||
862 | + */ | ||
760 | public function actionTeam() | 863 | public function actionTeam() |
761 | { | 864 | { |
762 | $searchModel = new TeamSearch(); | 865 | $searchModel = new TeamSearch(); |
@@ -768,6 +871,11 @@ | @@ -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 | public function actionTeamCreate() | 879 | public function actionTeamCreate() |
772 | { | 880 | { |
773 | $team = new Team(); | 881 | $team = new Team(); |
@@ -799,6 +907,14 @@ | @@ -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 | public function actionTeamUpdate($id) | 918 | public function actionTeamUpdate($id) |
803 | { | 919 | { |
804 | $user = \Yii::$app->user->identity; | 920 | $user = \Yii::$app->user->identity; |
@@ -836,6 +952,14 @@ | @@ -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 | public function actionTeamDelete($id) | 963 | public function actionTeamDelete($id) |
840 | { | 964 | { |
841 | $user = \Yii::$app->user->identity; | 965 | $user = \Yii::$app->user->identity; |
@@ -850,6 +974,11 @@ | @@ -850,6 +974,11 @@ | ||
850 | $this->redirect('team'); | 974 | $this->redirect('team'); |
851 | } | 975 | } |
852 | 976 | ||
977 | + /** | ||
978 | + * Page of company's vacancies | ||
979 | + * | ||
980 | + * @return string | ||
981 | + */ | ||
853 | public function actionVacancy() | 982 | public function actionVacancy() |
854 | { | 983 | { |
855 | $searchModel = new VacancySearch(); | 984 | $searchModel = new VacancySearch(); |
@@ -861,6 +990,11 @@ | @@ -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 | public function actionVacancyCreate() | 998 | public function actionVacancyCreate() |
865 | { | 999 | { |
866 | $vacancy = new Vacancy(); | 1000 | $vacancy = new Vacancy(); |
@@ -895,6 +1029,14 @@ | @@ -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 | public function actionVacancyUpdate($id) | 1040 | public function actionVacancyUpdate($id) |
899 | { | 1041 | { |
900 | $user = \Yii::$app->user->identity; | 1042 | $user = \Yii::$app->user->identity; |
@@ -935,6 +1077,14 @@ | @@ -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 | public function actionVacancyDelete($id) | 1088 | public function actionVacancyDelete($id) |
939 | { | 1089 | { |
940 | $user = \Yii::$app->user->identity; | 1090 | $user = \Yii::$app->user->identity; |
@@ -950,10 +1100,12 @@ | @@ -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 | protected function findUser($id) | 1110 | protected function findUser($id) |
959 | { | 1111 | { |
frontend/controllers/PerformerController.php
@@ -25,6 +25,18 @@ class PerformerController extends Controller | @@ -25,6 +25,18 @@ class PerformerController extends Controller | ||
25 | public $user; | 25 | public $user; |
26 | public $defaultAction = 'common'; | 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 | * @inheritdoc | 41 | * @inheritdoc |
30 | */ | 42 | */ |
frontend/controllers/SiteController.php
@@ -104,7 +104,6 @@ class SiteController extends Controller | @@ -104,7 +104,6 @@ class SiteController extends Controller | ||
104 | public function actionIndex() | 104 | public function actionIndex() |
105 | { | 105 | { |
106 | $specializations = Specialization::find()->where(['specialization_pid'=>0])->orderBy('specialization_id')->all(); | 106 | $specializations = Specialization::find()->where(['specialization_pid'=>0])->orderBy('specialization_id')->all(); |
107 | - | ||
108 | return $this->render('index',[ | 107 | return $this->render('index',[ |
109 | 'specializations' => $specializations, | 108 | 'specializations' => $specializations, |
110 | ]); | 109 | ]); |
frontend/views/accounts/_vacancy_form.php
@@ -7,8 +7,10 @@ | @@ -7,8 +7,10 @@ | ||
7 | use common\models\Vacancy; | 7 | use common\models\Vacancy; |
8 | use common\widgets\FieldEditor; | 8 | use common\widgets\FieldEditor; |
9 | use common\widgets\ImageUploader; | 9 | use common\widgets\ImageUploader; |
10 | + use kartik\select2\Select2; | ||
10 | use mihaildev\ckeditor\CKEditor; | 11 | use mihaildev\ckeditor\CKEditor; |
11 | use yii\helpers\Html; | 12 | use yii\helpers\Html; |
13 | + use yii\web\JsExpression; | ||
12 | use yii\widgets\ActiveForm; | 14 | use yii\widgets\ActiveForm; |
13 | 15 | ||
14 | $this->title = 'Вакансии'; | 16 | $this->title = 'Вакансии'; |
@@ -29,8 +31,28 @@ | @@ -29,8 +31,28 @@ | ||
29 | <?= $form->field($vacancy, 'user_name') | 31 | <?= $form->field($vacancy, 'user_name') |
30 | ->textInput() ?> | 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 | <?= $form->field($vacancy, 'employmentInput') | 57 | <?= $form->field($vacancy, 'employmentInput') |
36 | ->checkboxList($employment) ?> | 58 | ->checkboxList($employment) ?> |
frontend/views/accounts/general.php
@@ -82,7 +82,6 @@ | @@ -82,7 +82,6 @@ | ||
82 | <div class="input-blocks-wrapper"> | 82 | <div class="input-blocks-wrapper"> |
83 | <div class="input-blocks"> | 83 | <div class="input-blocks"> |
84 | <?= $form->field ($company_info, 'name', ['options' => ['class' => 'form-group company_info']]) | 84 | <?= $form->field ($company_info, 'name', ['options' => ['class' => 'form-group company_info']]) |
85 | - ->label ('Название компании') | ||
86 | ->textInput (['class'=> 'custom-input-2']); | 85 | ->textInput (['class'=> 'custom-input-2']); |
87 | ?> | 86 | ?> |
88 | </div> | 87 | </div> |
@@ -90,7 +89,6 @@ | @@ -90,7 +89,6 @@ | ||
90 | <div class="input-blocks-wrapper"> | 89 | <div class="input-blocks-wrapper"> |
91 | <div class="input-blocks"> | 90 | <div class="input-blocks"> |
92 | <?= $form->field ($company_info, 'staff', ['options' => ['class' => 'form-group company_info']]) | 91 | <?= $form->field ($company_info, 'staff', ['options' => ['class' => 'form-group company_info']]) |
93 | - ->label ('Количество сотрудников') | ||
94 | ->textInput (['class'=> 'custom-input-2','type'=>'number']); | 92 | ->textInput (['class'=> 'custom-input-2','type'=>'number']); |
95 | ?> | 93 | ?> |
96 | </div> | 94 | </div> |
@@ -117,10 +115,23 @@ | @@ -117,10 +115,23 @@ | ||
117 | </div> | 115 | </div> |
118 | <div class="input-blocks-wrapper"> | 116 | <div class="input-blocks-wrapper"> |
119 | <div class="input-blocks"> | 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 | </div> | 135 | </div> |
125 | </div> | 136 | </div> |
126 | <div class="input-blocks-wrapper"> | 137 | <div class="input-blocks-wrapper"> |
@@ -147,14 +158,12 @@ | @@ -147,14 +158,12 @@ | ||
147 | 158 | ||
148 | <div class="input-blocks street-input"> | 159 | <div class="input-blocks street-input"> |
149 | <?= $form->field ($company_info, 'street', ['options' => ['class' => 'form-group company_info']]) | 160 | <?= $form->field ($company_info, 'street', ['options' => ['class' => 'form-group company_info']]) |
150 | - ->label ('Улица') | ||
151 | ->textInput (['class'=> 'custom-input-2']); | 161 | ->textInput (['class'=> 'custom-input-2']); |
152 | ?> | 162 | ?> |
153 | </div> | 163 | </div> |
154 | 164 | ||
155 | <div class="input-blocks home-input"> | 165 | <div class="input-blocks home-input"> |
156 | <?= $form->field ($company_info, 'house', ['options' => ['class' => 'form-group company_info']]) | 166 | <?= $form->field ($company_info, 'house', ['options' => ['class' => 'form-group company_info']]) |
157 | - ->label ('Дом') | ||
158 | ->textInput (['class'=> 'custom-input-2']); | 167 | ->textInput (['class'=> 'custom-input-2']); |
159 | ?> | 168 | ?> |
160 | </div> | 169 | </div> |
@@ -163,7 +172,6 @@ | @@ -163,7 +172,6 @@ | ||
163 | <div class="input-blocks-wrapper "> | 172 | <div class="input-blocks-wrapper "> |
164 | <div class="input-blocks"> | 173 | <div class="input-blocks"> |
165 | <?= $form->field ($user, 'email') | 174 | <?= $form->field ($user, 'email') |
166 | - ->label ('Email') | ||
167 | ->textInput (['class'=> 'custom-input-2']); | 175 | ->textInput (['class'=> 'custom-input-2']); |
168 | ?> | 176 | ?> |
169 | </div> | 177 | </div> |
frontend/views/accounts/service.php
@@ -5,8 +5,10 @@ | @@ -5,8 +5,10 @@ | ||
5 | * @var string[] $specialization | 5 | * @var string[] $specialization |
6 | * @var string[] $payment | 6 | * @var string[] $payment |
7 | */ | 7 | */ |
8 | + use common\models\Specialization; | ||
8 | use common\models\User; | 9 | use common\models\User; |
9 | use common\models\UserInfo; | 10 | use common\models\UserInfo; |
11 | + use yii\helpers\ArrayHelper; | ||
10 | use yii\helpers\Html; | 12 | use yii\helpers\Html; |
11 | use yii\widgets\ActiveForm; | 13 | use yii\widgets\ActiveForm; |
12 | 14 | ||
@@ -40,11 +42,31 @@ | @@ -40,11 +42,31 @@ | ||
40 | 42 | ||
41 | 43 | ||
42 | <div class="input-blocks-wrapper"> | 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 | </div> | 70 | </div> |
49 | <div class="input-blocks-wrapper"> | 71 | <div class="input-blocks-wrapper"> |
50 | <div class="input-blocks" style="color: red"> | 72 | <div class="input-blocks" style="color: red"> |
@@ -67,8 +89,8 @@ | @@ -67,8 +89,8 @@ | ||
67 | <?= $form->field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ]) | 89 | <?= $form->field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ]) |
68 | ->label('Работа по договору') | 90 | ->label('Работа по договору') |
69 | ->radioList([ | 91 | ->radioList([ |
70 | - 0 => 'Да', | ||
71 | - 1 => 'Нет', | 92 | + 1 => 'Да', |
93 | + 0 => 'Нет', | ||
72 | ], | 94 | ], |
73 | [ | 95 | [ |
74 | 'item' => function($index, $label, $name, $checked, $value) { | 96 | 'item' => function($index, $label, $name, $checked, $value) { |
@@ -89,8 +111,8 @@ | @@ -89,8 +111,8 @@ | ||
89 | <?= $form->field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ]) | 111 | <?= $form->field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ]) |
90 | ->label('Предоставляете смету') | 112 | ->label('Предоставляете смету') |
91 | ->radioList([ | 113 | ->radioList([ |
92 | - 0 => 'Да', | ||
93 | - 1 => 'Нет', | 114 | + 1 => 'Да', |
115 | + 0 => 'Нет', | ||
94 | ], [ | 116 | ], [ |
95 | 'item' => function($index, $label, $name, $checked, $value) { | 117 | 'item' => function($index, $label, $name, $checked, $value) { |
96 | $return = '<div class="admin-who-check">'; | 118 | $return = '<div class="admin-who-check">'; |
@@ -110,8 +132,8 @@ | @@ -110,8 +132,8 @@ | ||
110 | <?= $form->field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ]) | 132 | <?= $form->field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ]) |
111 | ->label('Делаете сами закупку материалов') | 133 | ->label('Делаете сами закупку материалов') |
112 | ->radioList([ | 134 | ->radioList([ |
113 | - 0 => 'Да', | ||
114 | - 1 => 'Нет', | 135 | + 1 => 'Да', |
136 | + 0 => 'Нет', | ||
115 | ], [ | 137 | ], [ |
116 | 'item' => function($index, $label, $name, $checked, $value) { | 138 | 'item' => function($index, $label, $name, $checked, $value) { |
117 | $return = '<div class="admin-who-check">'; | 139 | $return = '<div class="admin-who-check">'; |
@@ -130,8 +152,8 @@ | @@ -130,8 +152,8 @@ | ||
130 | <?= $form->field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ]) | 152 | <?= $form->field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ]) |
131 | ->label('Занимаетесь сами доставкой материалов') | 153 | ->label('Занимаетесь сами доставкой материалов') |
132 | ->radioList([ | 154 | ->radioList([ |
133 | - 0 => 'Да', | ||
134 | - 1 => 'Нет', | 155 | + 1 => 'Да', |
156 | + 0 => 'Нет', | ||
135 | ], [ | 157 | ], [ |
136 | 'item' => function($index, $label, $name, $checked, $value) { | 158 | 'item' => function($index, $label, $name, $checked, $value) { |
137 | $return = '<div class="admin-who-check">'; | 159 | $return = '<div class="admin-who-check">'; |
frontend/views/layouts/performer.php
@@ -101,16 +101,16 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -101,16 +101,16 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
101 | <div class="performer-vacancy-sidebar-soc style"> | 101 | <div class="performer-vacancy-sidebar-soc style"> |
102 | <ul> | 102 | <ul> |
103 | <li> | 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 | </li> | 105 | </li> |
106 | <li> | 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 | </li> | 108 | </li> |
109 | <li> | 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 | </li> | 111 | </li> |
112 | <li> | 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 | </li> | 114 | </li> |
115 | </ul> | 115 | </ul> |
116 | </div> | 116 | </div> |
@@ -124,7 +124,7 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -124,7 +124,7 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
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> | 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 | <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> | 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 | <li><img src="/images/sidebar-ico/ico-13.png" alt=""/><div class="sidebarvievstxt"><?= implode(', ',ArrayHelper::getColumn($this->params['user']->payments,'name'))?></div></li> | 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 | </ul> | 129 | </ul> |
130 | </div> | 130 | </div> |
frontend/views/performer/common.php
@@ -145,7 +145,7 @@ $this->title = 'My Yii Application'; | @@ -145,7 +145,7 @@ $this->title = 'My Yii Application'; | ||
145 | <div class="style"> | 145 | <div class="style"> |
146 | <div class="profile-site"> | 146 | <div class="profile-site"> |
147 | <img src="/images/ico-site.png" alt=""/> | 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 | </div> | 149 | </div> |
150 | </div> | 150 | </div> |
151 | <?php endforeach; ?> | 151 | <?php endforeach; ?> |