Commit 02524a34fbb8468611780494fdaf1d01ccf18b01
1 parent
ea09d15d
test
Showing
14 changed files
with
701 additions
and
10 deletions
Show diff stats
common/config/main.php
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "country". | |
9 | + * | |
10 | + * @property integer $country_id | |
11 | + * @property integer $oid | |
12 | + * @property string $country_name | |
13 | + * @property string $country_name_en | |
14 | + */ | |
15 | +class Country extends \yii\db\ActiveRecord | |
16 | +{ | |
17 | + /** | |
18 | + * @inheritdoc | |
19 | + */ | |
20 | + public static function tableName() | |
21 | + { | |
22 | + return 'country'; | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * @inheritdoc | |
27 | + */ | |
28 | + public function rules() | |
29 | + { | |
30 | + return [ | |
31 | + [['oid'], 'integer'], | |
32 | + [['country_name', 'country_name_en'], 'string', 'max' => 255], | |
33 | + ]; | |
34 | + } | |
35 | + | |
36 | + /** | |
37 | + * @inheritdoc | |
38 | + */ | |
39 | + public function attributeLabels() | |
40 | + { | |
41 | + return [ | |
42 | + 'country_id' => Yii::t('app', 'Country ID'), | |
43 | + 'oid' => Yii::t('app', 'Oid'), | |
44 | + 'country_name' => Yii::t('app', 'Country Name'), | |
45 | + 'country_name_en' => Yii::t('app', 'Country Name En'), | |
46 | + ]; | |
47 | + } | |
48 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "department". | |
9 | + * | |
10 | + * @property integer $department_id | |
11 | + * @property string $name | |
12 | + * | |
13 | + * @property Team[] $teams | |
14 | + */ | |
15 | +class Department extends \yii\db\ActiveRecord | |
16 | +{ | |
17 | + /** | |
18 | + * @inheritdoc | |
19 | + */ | |
20 | + public static function tableName() | |
21 | + { | |
22 | + return 'department'; | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * @inheritdoc | |
27 | + */ | |
28 | + public function rules() | |
29 | + { | |
30 | + return [ | |
31 | + [['name'], 'string', 'max' => 255], | |
32 | + ]; | |
33 | + } | |
34 | + | |
35 | + /** | |
36 | + * @inheritdoc | |
37 | + */ | |
38 | + public function attributeLabels() | |
39 | + { | |
40 | + return [ | |
41 | + 'department_id' => Yii::t('app', 'Department ID'), | |
42 | + 'name' => Yii::t('app', 'Name'), | |
43 | + ]; | |
44 | + } | |
45 | + | |
46 | + /** | |
47 | + * @return \yii\db\ActiveQuery | |
48 | + */ | |
49 | + public function getTeams() | |
50 | + { | |
51 | + return $this->hasMany(Team::className(), ['department_id' => 'department_id']); | |
52 | + } | |
53 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "employment". | |
9 | + * | |
10 | + * @property integer $employment_id | |
11 | + * @property string $name | |
12 | + * | |
13 | + * @property VacancyEmployment[] $vacancyEmployments | |
14 | + */ | |
15 | +class Employment extends \yii\db\ActiveRecord | |
16 | +{ | |
17 | + /** | |
18 | + * @inheritdoc | |
19 | + */ | |
20 | + public static function tableName() | |
21 | + { | |
22 | + return 'employment'; | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * @inheritdoc | |
27 | + */ | |
28 | + public function rules() | |
29 | + { | |
30 | + return [ | |
31 | + [['name'], 'string', 'max' => 255], | |
32 | + ]; | |
33 | + } | |
34 | + | |
35 | + /** | |
36 | + * @inheritdoc | |
37 | + */ | |
38 | + public function attributeLabels() | |
39 | + { | |
40 | + return [ | |
41 | + 'employment_id' => Yii::t('app', 'Employment ID'), | |
42 | + 'name' => Yii::t('app', 'Name'), | |
43 | + ]; | |
44 | + } | |
45 | + | |
46 | + /** | |
47 | + * @return \yii\db\ActiveQuery | |
48 | + */ | |
49 | + public function getVacancyEmployments() | |
50 | + { | |
51 | + return $this->hasMany(VacancyEmployment::className(), ['employment_id' => 'employment_id']); | |
52 | + } | |
53 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use Yii; | |
6 | + use yii\behaviors\BlameableBehavior; | |
7 | + use yii\behaviors\TimestampBehavior; | |
8 | + use yii\db\Expression; | |
9 | + | |
10 | + /** | |
11 | + * This is the model class for table "team". | |
12 | + * @property integer $team_id | |
13 | + * @property integer $user_id | |
14 | + * @property string $firstname | |
15 | + * @property string $lastname | |
16 | + * @property string $midlename | |
17 | + * @property string $link | |
18 | + * @property string $position | |
19 | + * @property integer $department_id | |
20 | + * @property string $experience_from | |
21 | + * @property string $date_add | |
22 | + * @property integer $user_add_id | |
23 | + * @property string $photo | |
24 | + * @property string $country_id | |
25 | + */ | |
26 | + class Team extends \yii\db\ActiveRecord | |
27 | + { | |
28 | + | |
29 | + /** | |
30 | + * @inheritdoc | |
31 | + */ | |
32 | + public static function tableName() | |
33 | + { | |
34 | + return 'team'; | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * @inheritdoc | |
39 | + */ | |
40 | + public function behaviors() | |
41 | + { | |
42 | + return [ | |
43 | + [ | |
44 | + 'class' => BlameableBehavior::className(), | |
45 | + 'createdByAttribute' => 'user_id', | |
46 | + 'updatedByAttribute' => false, | |
47 | + ], | |
48 | + [ | |
49 | + 'class' => TimestampBehavior::className(), | |
50 | + 'createdAtAttribute' => 'date_add', | |
51 | + 'updatedAtAttribute' => false, | |
52 | + 'value' => new Expression('NOW()'), | |
53 | + ], | |
54 | + ]; | |
55 | + } | |
56 | + | |
57 | + /** | |
58 | + * @inheritdoc | |
59 | + */ | |
60 | + public function rules() | |
61 | + { | |
62 | + return [ | |
63 | + [ | |
64 | + [ | |
65 | + 'firstname', | |
66 | + 'lastname', | |
67 | + 'position', | |
68 | + 'country_id', | |
69 | + ], | |
70 | + 'required', | |
71 | + ], | |
72 | + [ | |
73 | + [ | |
74 | + 'department_id', | |
75 | + ], | |
76 | + 'integer', | |
77 | + ], | |
78 | + [ | |
79 | + [ | |
80 | + 'experience_from', | |
81 | + ], | |
82 | + 'safe', | |
83 | + ], | |
84 | + [ | |
85 | + [ | |
86 | + 'firstname', | |
87 | + 'lastname', | |
88 | + 'midlename', | |
89 | + 'link', | |
90 | + 'position', | |
91 | + 'photo', | |
92 | + 'country_id', | |
93 | + ], | |
94 | + 'string', | |
95 | + 'max' => 255, | |
96 | + ], | |
97 | + ]; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * @inheritdoc | |
102 | + */ | |
103 | + public function attributeLabels() | |
104 | + { | |
105 | + return [ | |
106 | + 'team_id' => Yii::t('app', 'Team ID'), | |
107 | + 'user_id' => Yii::t('app', 'User ID'), | |
108 | + 'firstname' => Yii::t('app', 'Имя'), | |
109 | + 'lastname' => Yii::t('app', 'Фамилия'), | |
110 | + 'midlename' => Yii::t('app', 'Отчество'), | |
111 | + 'link' => Yii::t('app', 'Ссылка на профиль МФП'), | |
112 | + 'position' => Yii::t('app', 'Должность'), | |
113 | + 'department_id' => Yii::t('app', 'Отдел компании'), | |
114 | + 'experience_from' => Yii::t('app', 'Опыт'), | |
115 | + 'date_add' => Yii::t('app', 'дата добавления'), | |
116 | + 'user_add_id' => Yii::t('app', 'User Add ID'), | |
117 | + 'photo' => Yii::t('app', 'Фото'), | |
118 | + 'country_id' => Yii::t('app', 'Страна'), | |
119 | + ]; | |
120 | + } | |
121 | + | |
122 | + public function getDepartment() | |
123 | + { | |
124 | + return $this->hasOne(Department::className(), [ 'department_id' => 'department_id' ]); | |
125 | + } | |
126 | + | |
127 | + } | ... | ... |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use Yii; | |
6 | + use yii\behaviors\BlameableBehavior; | |
7 | + use yii\behaviors\TimestampBehavior; | |
8 | + use yii\db\Expression; | |
9 | + | |
10 | + /** | |
11 | + * This is the model class for table "vacancy". | |
12 | + * @property integer $vacancy_id | |
13 | + * @property integer $user_id | |
14 | + * @property string $name | |
15 | + * @property string $link | |
16 | + * @property string $date_add | |
17 | + * @property integer $user_add_id | |
18 | + * @property integer $view_count | |
19 | + * @property string $user_name | |
20 | + * @property string $city | |
21 | + * @property string $description | |
22 | + * @property Employment[] $employments | |
23 | + * @property VacancyEmployment[] $vacancyEmployments | |
24 | + */ | |
25 | + class Vacancy extends \yii\db\ActiveRecord | |
26 | + { | |
27 | + | |
28 | + /** | |
29 | + * @inheritdoc | |
30 | + */ | |
31 | + public static function tableName() | |
32 | + { | |
33 | + return 'vacancy'; | |
34 | + } | |
35 | + | |
36 | + /** | |
37 | + * @inheritdoc | |
38 | + */ | |
39 | + public function behaviors() | |
40 | + { | |
41 | + return [ | |
42 | + [ | |
43 | + 'class' => BlameableBehavior::className(), | |
44 | + 'createdByAttribute' => 'user_id', | |
45 | + 'updatedByAttribute' => false, | |
46 | + ], | |
47 | + [ | |
48 | + 'class' => TimestampBehavior::className(), | |
49 | + 'createdAtAttribute' => 'date_add', | |
50 | + 'updatedAtAttribute' => false, | |
51 | + 'value' => new Expression('NOW()'), | |
52 | + ], | |
53 | + ]; | |
54 | + } | |
55 | + | |
56 | + /** | |
57 | + * @inheritdoc | |
58 | + */ | |
59 | + public function rules() | |
60 | + { | |
61 | + return [ | |
62 | + [ | |
63 | + [ 'name' ], | |
64 | + 'required', | |
65 | + ], | |
66 | + [ | |
67 | + [ 'description' ], | |
68 | + 'string', | |
69 | + ], | |
70 | + [ | |
71 | + ['employmentInput'], | |
72 | + 'safe', | |
73 | + ], | |
74 | + [ | |
75 | + [ | |
76 | + 'name', | |
77 | + 'link', | |
78 | + 'user_name', | |
79 | + 'city', | |
80 | + ], | |
81 | + 'string', | |
82 | + 'max' => 255, | |
83 | + ], | |
84 | + ]; | |
85 | + } | |
86 | + | |
87 | + /** | |
88 | + * @inheritdoc | |
89 | + */ | |
90 | + public function attributeLabels() | |
91 | + { | |
92 | + return [ | |
93 | + 'vacancy_id' => Yii::t('app', 'Vacancy ID'), | |
94 | + 'user_id' => Yii::t('app', 'User ID'), | |
95 | + 'name' => Yii::t('app', 'Название'), | |
96 | + 'link' => Yii::t('app', 'URL'), | |
97 | + 'date_add' => Yii::t('app', 'Дата добавления'), | |
98 | + 'user_add_id' => Yii::t('app', 'User Add ID'), | |
99 | + 'view_count' => Yii::t('app', 'Количество просмотров'), | |
100 | + 'user_name' => Yii::t('app', 'Контактное лицо'), | |
101 | + 'city' => Yii::t('app', 'Город'), | |
102 | + 'description' => Yii::t('app', 'Описание'), | |
103 | + 'employmentInput' => Yii::t('app', 'Вид занятости'), | |
104 | + ]; | |
105 | + } | |
106 | + | |
107 | + /** | |
108 | + * @return \yii\db\ActiveQuery | |
109 | + */ | |
110 | + public function getVacancyEmployments() | |
111 | + { | |
112 | + return $this->hasMany(VacancyEmployment::className(), [ 'vacancy_id' => 'vacancy_id' ]); | |
113 | + } | |
114 | + | |
115 | + public function getEmployments() | |
116 | + { | |
117 | + return $this->hasMany(Employment::className(), [ 'employment_id' => 'employment_id' ]) | |
118 | + ->viaTable('vacancy_employment', [ 'vacancy_id' => 'vacancy_id' ]); | |
119 | + } | |
120 | + | |
121 | + public function getEmploymentInput() | |
122 | + { | |
123 | + return $this->getEmployments() | |
124 | + ->asArray() | |
125 | + ->column(); | |
126 | + } | |
127 | + | |
128 | + public function setEmploymentInput($value) | |
129 | + { | |
130 | + $this->employmentInput = $value; | |
131 | + } | |
132 | + | |
133 | + } | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "vacancy_employment". | |
9 | + * | |
10 | + * @property integer $vacancy_employment | |
11 | + * @property integer $vacancy_id | |
12 | + * @property integer $employment_id | |
13 | + * | |
14 | + * @property Employment $employment | |
15 | + * @property Vacancy $vacancy | |
16 | + */ | |
17 | +class VacancyEmployment extends \yii\db\ActiveRecord | |
18 | +{ | |
19 | + /** | |
20 | + * @inheritdoc | |
21 | + */ | |
22 | + public static function tableName() | |
23 | + { | |
24 | + return 'vacancy_employment'; | |
25 | + } | |
26 | + | |
27 | + /** | |
28 | + * @inheritdoc | |
29 | + */ | |
30 | + public function rules() | |
31 | + { | |
32 | + return [ | |
33 | + [['vacancy_id', 'employment_id'], 'integer'], | |
34 | + [['employment_id'], 'exist', 'skipOnError' => true, 'targetClass' => Employment::className(), 'targetAttribute' => ['employment_id' => 'employment_id']], | |
35 | + [['vacancy_id'], 'exist', 'skipOnError' => true, 'targetClass' => Vacancy::className(), 'targetAttribute' => ['vacancy_id' => 'vacancy_id']], | |
36 | + ]; | |
37 | + } | |
38 | + | |
39 | + /** | |
40 | + * @inheritdoc | |
41 | + */ | |
42 | + public function attributeLabels() | |
43 | + { | |
44 | + return [ | |
45 | + 'vacancy_employment' => Yii::t('app', 'Vacancy Employment'), | |
46 | + 'vacancy_id' => Yii::t('app', 'Vacancy ID'), | |
47 | + 'employment_id' => Yii::t('app', 'Employment ID'), | |
48 | + ]; | |
49 | + } | |
50 | + | |
51 | + /** | |
52 | + * @return \yii\db\ActiveQuery | |
53 | + */ | |
54 | + public function getEmployment() | |
55 | + { | |
56 | + return $this->hasOne(Employment::className(), ['employment_id' => 'employment_id']); | |
57 | + } | |
58 | + | |
59 | + /** | |
60 | + * @return \yii\db\ActiveQuery | |
61 | + */ | |
62 | + public function getVacancy() | |
63 | + { | |
64 | + return $this->hasOne(Vacancy::className(), ['vacancy_id' => 'vacancy_id']); | |
65 | + } | |
66 | +} | ... | ... |
console/migrations/m160208_101449_team.php
... | ... | @@ -13,7 +13,7 @@ class m160208_101449_team extends Migration |
13 | 13 | 'user_id' => $this->integer()->notNull(), |
14 | 14 | 'firstname' => $this->string(255)->notNull(), |
15 | 15 | 'lastname' => $this->string(255)->notNull(), |
16 | - 'midlename' => $this->string(255), | |
16 | + 'middlename' => $this->string(255), | |
17 | 17 | 'link' => $this->string(255), |
18 | 18 | 'position' => $this->string(255)->notNull(), |
19 | 19 | 'department_id' => $this->integer()->notNull(), | ... | ... |
console/migrations/m160209_151553_employment_data.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | + use yii\db\Migration; | |
4 | + | |
5 | + class m160209_151553_employment_data extends Migration | |
6 | + { | |
7 | + | |
8 | + public function up() | |
9 | + { | |
10 | + $this->batchInsert('{{%employment}}', [ 'name' ], [ | |
11 | + [ 'Проектная' ], | |
12 | + [ 'Полная' ], | |
13 | + [ 'Не полная' ], | |
14 | + [ 'Удаленная' ], | |
15 | + ]); | |
16 | + } | |
17 | + | |
18 | + public function down() | |
19 | + { | |
20 | + $this->delete('employment'); | |
21 | + } | |
22 | + | |
23 | + /* | |
24 | + // Use safeUp/safeDown to run migration code within a transaction | |
25 | + public function safeUp() | |
26 | + { | |
27 | + } | |
28 | + | |
29 | + public function safeDown() | |
30 | + { | |
31 | + } | |
32 | + */ | |
33 | + } | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160210_085744_department extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->createTable('{{%department}}', ['department_id' => $this->primaryKey(), 'name' => $this->string()]); | |
10 | + $this->addForeignKey('team_department_key', '{{%team}}', 'department_id', '{{%department}}', 'department_id'); | |
11 | + } | |
12 | + | |
13 | + public function down() | |
14 | + { | |
15 | + $this->dropForeignKey('team_department_key', '{{%team}}'); | |
16 | + $this->dropTable('{{%department}}'); | |
17 | + } | |
18 | + | |
19 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160210_101931_country extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->createTable('{{%country}}', [ | |
10 | + 'country_id' => $this->primaryKey(), | |
11 | + 'oid' => $this->integer(), | |
12 | + 'country_name' => $this->string(), | |
13 | + 'country_name_en' => $this->string(), | |
14 | + ]); | |
15 | + } | |
16 | + | |
17 | + public function down() | |
18 | + { | |
19 | + $this->dropTable('{{%country}}'); | |
20 | + } | |
21 | + | |
22 | +} | ... | ... |
frontend/controllers/AccountsController.php
... | ... | @@ -3,6 +3,8 @@ |
3 | 3 | |
4 | 4 | use common\models\Blog; |
5 | 5 | use common\models\CompanyInfo; |
6 | + use common\models\Country; | |
7 | + use common\models\Department; | |
6 | 8 | use common\models\Employment; |
7 | 9 | use common\models\Fields; |
8 | 10 | use common\models\Gallery; |
... | ... | @@ -13,6 +15,7 @@ |
13 | 15 | use common\models\PortfolioSpecialization; |
14 | 16 | use common\models\Project; |
15 | 17 | use common\models\Specialization; |
18 | + use common\models\Team; | |
16 | 19 | use common\models\UserPayment; |
17 | 20 | use common\models\UserSpecialization; |
18 | 21 | use common\models\Vacancy; |
... | ... | @@ -531,7 +534,7 @@ |
531 | 534 | $user = \Yii::$app->user->identity; |
532 | 535 | $post = \Yii::$app->request->post(); |
533 | 536 | if($gallery->load($post) && $gallery->save()) { |
534 | - Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); | |
537 | + Fields::saveFieldData(Yii::$app->request->post('Fields'), $gallery->gallery_id, Gallery::className(), 'ru'); | |
535 | 538 | return $this->redirect([ |
536 | 539 | 'gallery-update', |
537 | 540 | 'id' => $gallery->gallery_id, |
... | ... | @@ -563,6 +566,73 @@ |
563 | 566 | } |
564 | 567 | } |
565 | 568 | |
569 | + public function actionTeam() | |
570 | + { | |
571 | + return $this->render('team'); | |
572 | + } | |
573 | + | |
574 | + public function actionTeamCreate() | |
575 | + { | |
576 | + $team = new Team(); | |
577 | + $department = Department::find() | |
578 | + ->select([ | |
579 | + 'name', | |
580 | + 'department_id', | |
581 | + ]) | |
582 | + ->indexBy('department_id') | |
583 | + ->asArray() | |
584 | + ->column(); | |
585 | + $country = Country::find() | |
586 | + ->select([ 'country_name' ]) | |
587 | + ->indexBy('country_name') | |
588 | + ->asArray() | |
589 | + ->column(); | |
590 | + $post = \Yii::$app->request->post(); | |
591 | + if($team->load($post) && $team->save()) { | |
592 | + return $this->redirect([ | |
593 | + 'team-update', | |
594 | + 'id' => $team->team_id, | |
595 | + ]); | |
596 | + } else { | |
597 | + return $this->render('_team_form', [ | |
598 | + 'team' => $team, | |
599 | + 'department' => $department, | |
600 | + 'country' => $country, | |
601 | + ]); | |
602 | + } | |
603 | + } | |
604 | + | |
605 | + public function actionTeamUpdate($id) | |
606 | + { | |
607 | + $team = Team::findOne($id); | |
608 | + $department = Department::find() | |
609 | + ->select([ | |
610 | + 'name', | |
611 | + 'department_id', | |
612 | + ]) | |
613 | + ->indexBy('department_id') | |
614 | + ->asArray() | |
615 | + ->column(); | |
616 | + $country = Country::find() | |
617 | + ->select([ 'country_name' ]) | |
618 | + ->indexBy('country_name') | |
619 | + ->asArray() | |
620 | + ->column(); | |
621 | + $post = \Yii::$app->request->post(); | |
622 | + if($team->load($post) && $team->save()) { | |
623 | + return $this->redirect([ | |
624 | + 'team-update', | |
625 | + 'id' => $team->team_id, | |
626 | + ]); | |
627 | + } else { | |
628 | + return $this->render('_team_form', [ | |
629 | + 'team' => $team, | |
630 | + 'department' => $department, | |
631 | + 'country' => $country, | |
632 | + ]); | |
633 | + } | |
634 | + } | |
635 | + | |
566 | 636 | public function actionVacancy() |
567 | 637 | { |
568 | 638 | $this->render('vacancy'); |
... | ... | @@ -580,7 +650,7 @@ |
580 | 650 | ->asArray() |
581 | 651 | ->column(); |
582 | 652 | $post = \Yii::$app->request->post(); |
583 | - if(!empty($post)) { | |
653 | + if(!empty( $post )) { | |
584 | 654 | $vacancy->load($post); |
585 | 655 | $vacancy->validate(); |
586 | 656 | if(!$vacancy->hasErrors()) { |
... | ... | @@ -590,11 +660,14 @@ |
590 | 660 | foreach($vacancy->employmentInput as $one_employment) { |
591 | 661 | $vacancy->link('employments', Employment::findOne($one_employment)); |
592 | 662 | } |
593 | - return $this->redirect(['vacancy-update', 'id' => $vacancy->vacancy_id]); | |
663 | + return $this->redirect([ | |
664 | + 'vacancy-update', | |
665 | + 'id' => $vacancy->vacancy_id, | |
666 | + ]); | |
594 | 667 | } |
595 | 668 | } |
596 | 669 | return $this->render('_vacancy_form', [ |
597 | - 'vacancy' => $vacancy, | |
670 | + 'vacancy' => $vacancy, | |
598 | 671 | 'employment' => $employment, |
599 | 672 | ]); |
600 | 673 | } |
... | ... | @@ -611,7 +684,7 @@ |
611 | 684 | ->asArray() |
612 | 685 | ->column(); |
613 | 686 | $post = \Yii::$app->request->post(); |
614 | - if(!empty($post)) { | |
687 | + if(!empty( $post )) { | |
615 | 688 | $vacancy->load($post); |
616 | 689 | $vacancy->validate(); |
617 | 690 | if(!$vacancy->hasErrors()) { |
... | ... | @@ -621,11 +694,14 @@ |
621 | 694 | foreach($vacancy->employmentInput as $one_employment) { |
622 | 695 | $vacancy->link('employments', Employment::findOne($one_employment)); |
623 | 696 | } |
624 | - return $this->redirect(['vacancy-update', 'id' => $vacancy->vacancy_id]); | |
697 | + return $this->redirect([ | |
698 | + 'vacancy-update', | |
699 | + 'id' => $vacancy->vacancy_id, | |
700 | + ]); | |
625 | 701 | } |
626 | 702 | } |
627 | 703 | return $this->render('_vacancy_form', [ |
628 | - 'vacancy' => $vacancy, | |
704 | + 'vacancy' => $vacancy, | |
629 | 705 | 'employment' => $employment, |
630 | 706 | ]); |
631 | 707 | } | ... | ... |
frontend/views/accounts/_gallery_form.php
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | |
54 | 54 | <?= FieldEditor::widget ( |
55 | 55 | [ |
56 | - 'template' => 'youtube', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru', | |
56 | + 'template' => 'youtube', 'item_id' => $gallery->gallery_id, 'model' => 'common\models\Gallery', 'language' => 'ru', | |
57 | 57 | ] |
58 | 58 | ); ?> |
59 | 59 | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var Team $team | |
4 | + * @var string[] $department | |
5 | + * @var string[] $country | |
6 | + */ | |
7 | + use common\models\Team; | |
8 | + use common\widgets\ImageUploader; | |
9 | + use mihaildev\ckeditor\CKEditor; | |
10 | + use yii\helpers\Html; | |
11 | + use yii\jui\DatePicker; | |
12 | + use yii\widgets\ActiveForm; | |
13 | + | |
14 | + $this->title = 'Мой профиль'; | |
15 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
16 | +?> | |
17 | +<h1><?= $this->title ?></h1> | |
18 | + | |
19 | +<?php | |
20 | + $form = ActiveForm::begin(); | |
21 | +?> | |
22 | + | |
23 | +<?= $form->field($team, 'lastname') | |
24 | + ->textInput() ?> | |
25 | + | |
26 | +<?= $form->field($team, 'firstname') | |
27 | + ->textInput() ?> | |
28 | + | |
29 | +<?= $form->field($team, 'middlename') | |
30 | + ->textInput() ?> | |
31 | + | |
32 | +<?= $form->field($team, 'link') | |
33 | + ->textInput() ?> | |
34 | + | |
35 | +<?= $form->field($team, 'position') | |
36 | + ->textInput() ?> | |
37 | + | |
38 | +<?= $form->field($team, 'department_id') | |
39 | + ->dropDownList($department) ?> | |
40 | + | |
41 | +<?= $form->field($team, 'experience_from', [ 'template' => "{label}, с {input} года \n{hint}\n{error}" ]) | |
42 | + ->input('number') ?> | |
43 | + | |
44 | +<?= $form->field($team, 'country_id') | |
45 | + ->dropDownList($country) ?> | |
46 | + | |
47 | +<?= ImageUploader::widget([ | |
48 | + 'model' => $team, | |
49 | + 'field' => 'photo', | |
50 | + 'width' => 100, | |
51 | + 'height' => 100, | |
52 | + 'multi' => false, | |
53 | + 'gallery' => $team->photo, | |
54 | + 'name' => 'Загрузить фото', | |
55 | +]); ?> | |
56 | + | |
57 | +<?= Html::submitButton('Добавить') ?> | |
58 | + | |
59 | +<?php | |
60 | + $form->end(); | |
61 | +?> | ... | ... |