Commit b95371cf3492cba539a0ea081008056592611aff
1 parent
bb94410b
test
Showing
15 changed files
with
910 additions
and
307 deletions
Show diff stats
common/config/main.php
@@ -46,6 +46,9 @@ return [ | @@ -46,6 +46,9 @@ return [ | ||
46 | 'cache' => [ | 46 | 'cache' => [ |
47 | 'class' => 'yii\caching\FileCache', | 47 | 'class' => 'yii\caching\FileCache', |
48 | ], | 48 | ], |
49 | + 'formatter' => [ | ||
50 | + 'booleanFormat' => ['Нет', 'Да'], | ||
51 | + ], | ||
49 | 'urlManager' => [ | 52 | 'urlManager' => [ |
50 | 'enablePrettyUrl' => true, | 53 | 'enablePrettyUrl' => true, |
51 | 'showScriptName' => false, | 54 | 'showScriptName' => false, |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use common\models\Team; | ||
9 | + | ||
10 | +/** | ||
11 | + * TeamSearch represents the model behind the search form about `common\models\Team`. | ||
12 | + */ | ||
13 | +class TeamSearch extends Team | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['team_id', 'user_id', 'department_id', 'user_add_id', 'experience_from'], 'integer'], | ||
22 | + [['firstname', 'lastname', 'middlename', 'link', 'position', 'date_add', 'photo', 'country_id'], 'safe'], | ||
23 | + ]; | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * @inheritdoc | ||
28 | + */ | ||
29 | + public function scenarios() | ||
30 | + { | ||
31 | + // bypass scenarios() implementation in the parent class | ||
32 | + return Model::scenarios(); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * Creates data provider instance with search query applied | ||
37 | + * | ||
38 | + * @param array $params | ||
39 | + * | ||
40 | + * @return ActiveDataProvider | ||
41 | + */ | ||
42 | + public function search($params) | ||
43 | + { | ||
44 | + $query = Team::find(); | ||
45 | + | ||
46 | + // add conditions that should always apply here | ||
47 | + | ||
48 | + $dataProvider = new ActiveDataProvider([ | ||
49 | + 'query' => $query, | ||
50 | + ]); | ||
51 | + | ||
52 | + $this->load($params); | ||
53 | + | ||
54 | + if (!$this->validate()) { | ||
55 | + // uncomment the following line if you do not want to return any records when validation fails | ||
56 | + // $query->where('0=1'); | ||
57 | + return $dataProvider; | ||
58 | + } | ||
59 | + | ||
60 | + // grid filtering conditions | ||
61 | + $query->andFilterWhere([ | ||
62 | + 'team_id' => $this->team_id, | ||
63 | + 'user_id' => $this->user_id, | ||
64 | + 'department_id' => $this->department_id, | ||
65 | + 'date_add' => $this->date_add, | ||
66 | + 'user_add_id' => $this->user_add_id, | ||
67 | + 'experience_from' => $this->experience_from, | ||
68 | + ]); | ||
69 | + | ||
70 | + $query->andFilterWhere(['like', 'firstname', $this->firstname]) | ||
71 | + ->andFilterWhere(['like', 'lastname', $this->lastname]) | ||
72 | + ->andFilterWhere(['like', 'middlename', $this->middlename]) | ||
73 | + ->andFilterWhere(['like', 'link', $this->link]) | ||
74 | + ->andFilterWhere(['like', 'position', $this->position]) | ||
75 | + ->andFilterWhere(['like', 'photo', $this->photo]) | ||
76 | + ->andFilterWhere(['like', 'country_id', $this->country_id]); | ||
77 | + | ||
78 | + return $dataProvider; | ||
79 | + } | ||
80 | +} |
common/models/User.php
1 | <?php | 1 | <?php |
2 | -namespace common\models; | ||
3 | - | ||
4 | -use Yii; | ||
5 | -use yii\base\NotSupportedException; | ||
6 | -use yii\behaviors\TimestampBehavior; | ||
7 | -use yii\db\ActiveRecord; | ||
8 | -use yii\web\IdentityInterface; | ||
9 | -use developeruz\db_rbac\interfaces\UserRbacInterface; | ||
10 | - | ||
11 | -/** | ||
12 | - * User model | ||
13 | - * | ||
14 | - * @property integer $id | ||
15 | - * @property string $username | ||
16 | - * @property string $password_hash | ||
17 | - * @property string $password_reset_token | ||
18 | - * @property string $email | ||
19 | - * @property string $auth_key | ||
20 | - * @property integer $status | ||
21 | - * @property integer $created_at | ||
22 | - * @property integer $updated_at | ||
23 | - * @property string $password write-only password | ||
24 | - */ | ||
25 | -class User extends ActiveRecord implements IdentityInterface, UserRbacInterface | ||
26 | -{ | ||
27 | - /** | ||
28 | - * @var array EAuth attributes | ||
29 | - */ | ||
30 | - | ||
31 | - const STATUS_DELETED = 0; | ||
32 | - const STATUS_ACTIVE = 10; | ||
33 | - public $profile; | ||
34 | - public $old_password; | ||
35 | - public $new_password; | ||
36 | - public $password_reply; | 2 | + namespace common\models; |
37 | 3 | ||
38 | - /** | ||
39 | - * @inheritdoc | ||
40 | - */ | ||
41 | - public static function tableName() | ||
42 | - { | ||
43 | - return '{{%user}}'; | ||
44 | - } | 4 | + use Yii; |
5 | + use yii\base\NotSupportedException; | ||
6 | + use yii\behaviors\TimestampBehavior; | ||
7 | + use yii\db\ActiveRecord; | ||
8 | + use yii\web\IdentityInterface; | ||
9 | + use developeruz\db_rbac\interfaces\UserRbacInterface; | ||
45 | 10 | ||
46 | /** | 11 | /** |
47 | - * @inheritdoc | 12 | + * User model |
13 | + * @property integer $id | ||
14 | + * @property string $username | ||
15 | + * @property string $password_hash | ||
16 | + * @property string $password_reset_token | ||
17 | + * @property string $email | ||
18 | + * @property string $auth_key | ||
19 | + * @property integer $status | ||
20 | + * @property integer $created_at | ||
21 | + * @property integer $updated_at | ||
22 | + * @property string $password write-only password | ||
48 | */ | 23 | */ |
49 | - public function behaviors() | 24 | + class User extends ActiveRecord implements IdentityInterface, UserRbacInterface |
50 | { | 25 | { |
51 | - return [ | ||
52 | - TimestampBehavior::className(), | ||
53 | - ]; | ||
54 | - } | ||
55 | 26 | ||
56 | - /** | ||
57 | - * @inheritdoc | ||
58 | - */ | ||
59 | - public function rules() | ||
60 | - { | ||
61 | - return [ | ||
62 | - ['status', 'default', 'value' => self::STATUS_ACTIVE], | ||
63 | - ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], | ||
64 | - [['username', 'lastname', 'firstname', 'middlename'], 'string', 'max' => 255], | ||
65 | - [['firstname'], 'required'], | ||
66 | - [['type'], 'in', 'range' => [1, 2]], | ||
67 | - [['type'], 'default', 'value' => '1',], | ||
68 | - ]; | ||
69 | - } | 27 | + /** |
28 | + * @var array EAuth attributes | ||
29 | + */ | ||
70 | 30 | ||
71 | - /** | ||
72 | - * @inheritdoc | ||
73 | - */ | ||
74 | - public static function findIdentity($id) { | ||
75 | - if(Yii::$app->getSession()->has('user-'.$id)) { | ||
76 | - if (Yii::$app->getSession()->has('user-'.$id)) { | ||
77 | - return new self(Yii::$app->getSession()->get('user-'.$id)); | 31 | + const STATUS_DELETED = 0; |
32 | + const STATUS_ACTIVE = 10; | ||
33 | + | ||
34 | + public $profile; | ||
35 | + | ||
36 | + public $old_password; | ||
37 | + | ||
38 | + public $new_password; | ||
39 | + | ||
40 | + public $password_reply; | ||
41 | + | ||
42 | + /** | ||
43 | + * @inheritdoc | ||
44 | + */ | ||
45 | + public static function tableName() | ||
46 | + { | ||
47 | + return '{{%user}}'; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * @inheritdoc | ||
52 | + */ | ||
53 | + public function behaviors() | ||
54 | + { | ||
55 | + return [ | ||
56 | + TimestampBehavior::className(), | ||
57 | + ]; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * @inheritdoc | ||
62 | + */ | ||
63 | + public function rules() | ||
64 | + { | ||
65 | + return [ | ||
66 | + [ | ||
67 | + 'status', | ||
68 | + 'default', | ||
69 | + 'value' => self::STATUS_ACTIVE, | ||
70 | + ], | ||
71 | + [ | ||
72 | + 'status', | ||
73 | + 'in', | ||
74 | + 'range' => [ | ||
75 | + self::STATUS_ACTIVE, | ||
76 | + self::STATUS_DELETED, | ||
77 | + ], | ||
78 | + ], | ||
79 | + [ | ||
80 | + [ | ||
81 | + 'username', | ||
82 | + 'lastname', | ||
83 | + 'firstname', | ||
84 | + 'middlename', | ||
85 | + ], | ||
86 | + 'string', | ||
87 | + 'max' => 255, | ||
88 | + ], | ||
89 | + [ | ||
90 | + [ 'firstname' ], | ||
91 | + 'required', | ||
92 | + ], | ||
93 | + [ | ||
94 | + [ 'type' ], | ||
95 | + 'in', | ||
96 | + 'range' => [ | ||
97 | + 1, | ||
98 | + 2, | ||
99 | + ], | ||
100 | + ], | ||
101 | + [ | ||
102 | + [ 'type' ], | ||
103 | + 'default', | ||
104 | + 'value' => '1', | ||
105 | + ], | ||
106 | + [ | ||
107 | + [ | ||
108 | + 'specializationInput', | ||
109 | + 'paymentInput', | ||
110 | + ], | ||
111 | + 'safe', | ||
112 | + ], | ||
113 | + ]; | ||
114 | + } | ||
115 | + | ||
116 | + /** | ||
117 | + * @inheritdoc | ||
118 | + */ | ||
119 | + public static function findIdentity($id) | ||
120 | + { | ||
121 | + if(Yii::$app->getSession() | ||
122 | + ->has('user-' . $id) | ||
123 | + ) { | ||
124 | + if(Yii::$app->getSession() | ||
125 | + ->has('user-' . $id) | ||
126 | + ) { | ||
127 | + return new self(Yii::$app->getSession() | ||
128 | + ->get('user-' . $id)); | ||
129 | + } else { | ||
130 | + return isset( self::$users[ $id ] ) ? new self(self::$users[ $id ]) : NULL; | ||
131 | + } | ||
132 | + } else { | ||
133 | + return static::findOne([ | ||
134 | + 'id' => $id, | ||
135 | + 'status' => self::STATUS_ACTIVE, | ||
136 | + ]); | ||
78 | } | 137 | } |
79 | - else { | ||
80 | - return isset(self::$users[$id]) ? new self(self::$users[$id]) : null; | ||
81 | - } | ||
82 | - } | ||
83 | - else { | ||
84 | - return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); | 138 | + |
85 | } | 139 | } |
86 | - | ||
87 | - } | ||
88 | - /** | ||
89 | - * @param \nodge\eauth\ServiceBase $service | ||
90 | - * @return User | ||
91 | - * @throws ErrorException | ||
92 | - */ | ||
93 | - public static function findByEAuth($service) { | ||
94 | - if (!$service->getIsAuthenticated()) { | ||
95 | - throw new ErrorException('EAuth user should be authenticated before creating identity.'); | 140 | + |
141 | + /** | ||
142 | + * @param \nodge\eauth\ServiceBase $service | ||
143 | + * | ||
144 | + * @return User | ||
145 | + * @throws ErrorException | ||
146 | + */ | ||
147 | + public static function findByEAuth($service) | ||
148 | + { | ||
149 | + if(!$service->getIsAuthenticated()) { | ||
150 | + throw new ErrorException('EAuth user should be authenticated before creating identity.'); | ||
151 | + } | ||
152 | + $id = $service->getServiceName() . '-' . $service->getId(); | ||
153 | + $attributes = [ | ||
154 | + 'id' => $id, | ||
155 | + 'username' => $service->getAttribute('name'), | ||
156 | + 'authKey' => md5($id), | ||
157 | + 'profile' => $service->getAttributes(), | ||
158 | + ]; | ||
159 | + $attributes[ 'profile' ][ 'service' ] = $service->getServiceName(); | ||
160 | + Yii::$app->getSession() | ||
161 | + ->set('user-' . $id, $attributes); | ||
162 | + return new self($attributes); | ||
96 | } | 163 | } |
97 | - $id = $service->getServiceName().'-'.$service->getId(); | ||
98 | - $attributes = array( | ||
99 | - 'id' => $id, | ||
100 | - 'username' => $service->getAttribute('name'), | ||
101 | - 'authKey' => md5($id), | ||
102 | - 'profile' => $service->getAttributes(), | ||
103 | - ); | ||
104 | - $attributes['profile']['service'] = $service->getServiceName(); | ||
105 | - Yii::$app->getSession()->set('user-'.$id, $attributes); | ||
106 | - return new self($attributes); | ||
107 | - } | ||
108 | 164 | ||
109 | - public $authKey; | 165 | + public $authKey; |
110 | 166 | ||
111 | - /** | ||
112 | - * @inheritdoc | ||
113 | - */ | ||
114 | - public static function findIdentityByAccessToken($token, $type = null) | ||
115 | - { | ||
116 | - throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); | ||
117 | - } | 167 | + /** |
168 | + * @inheritdoc | ||
169 | + */ | ||
170 | + public static function findIdentityByAccessToken($token, $type = NULL) | ||
171 | + { | ||
172 | + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); | ||
173 | + } | ||
118 | 174 | ||
119 | - /** | ||
120 | - * Finds user by username | ||
121 | - * | ||
122 | - * @param string $username | ||
123 | - * @return static|null | ||
124 | - */ | ||
125 | - public static function findByUsername($username) | ||
126 | - { | ||
127 | - return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); | ||
128 | - } | 175 | + /** |
176 | + * Finds user by username | ||
177 | + * | ||
178 | + * @param string $username | ||
179 | + * | ||
180 | + * @return static|null | ||
181 | + */ | ||
182 | + public static function findByUsername($username) | ||
183 | + { | ||
184 | + return static::findOne([ | ||
185 | + 'username' => $username, | ||
186 | + 'status' => self::STATUS_ACTIVE, | ||
187 | + ]); | ||
188 | + } | ||
129 | 189 | ||
130 | - /** | ||
131 | - * Finds user by password reset token | ||
132 | - * | ||
133 | - * @param string $token password reset token | ||
134 | - * @return static|null | ||
135 | - */ | ||
136 | - public static function findByPasswordResetToken($token) | ||
137 | - { | ||
138 | - if (!static::isPasswordResetTokenValid($token)) { | ||
139 | - return null; | 190 | + /** |
191 | + * Finds user by password reset token | ||
192 | + * | ||
193 | + * @param string $token password reset token | ||
194 | + * | ||
195 | + * @return static|null | ||
196 | + */ | ||
197 | + public static function findByPasswordResetToken($token) | ||
198 | + { | ||
199 | + if(!static::isPasswordResetTokenValid($token)) { | ||
200 | + return NULL; | ||
201 | + } | ||
202 | + | ||
203 | + return static::findOne([ | ||
204 | + 'password_reset_token' => $token, | ||
205 | + 'status' => self::STATUS_ACTIVE, | ||
206 | + ]); | ||
140 | } | 207 | } |
141 | 208 | ||
142 | - return static::findOne([ | ||
143 | - 'password_reset_token' => $token, | ||
144 | - 'status' => self::STATUS_ACTIVE, | ||
145 | - ]); | ||
146 | - } | 209 | + /** |
210 | + * Finds out if password reset token is valid | ||
211 | + * | ||
212 | + * @param string $token password reset token | ||
213 | + * | ||
214 | + * @return boolean | ||
215 | + */ | ||
216 | + public static function isPasswordResetTokenValid($token) | ||
217 | + { | ||
218 | + if(empty( $token )) { | ||
219 | + return false; | ||
220 | + } | ||
147 | 221 | ||
148 | - /** | ||
149 | - * Finds out if password reset token is valid | ||
150 | - * | ||
151 | - * @param string $token password reset token | ||
152 | - * @return boolean | ||
153 | - */ | ||
154 | - public static function isPasswordResetTokenValid($token) | ||
155 | - { | ||
156 | - if (empty($token)) { | ||
157 | - return false; | 222 | + $timestamp = (int) substr($token, strrpos($token, '_') + 1); |
223 | + $expire = Yii::$app->params[ 'user.passwordResetTokenExpire' ]; | ||
224 | + return $timestamp + $expire >= time(); | ||
158 | } | 225 | } |
159 | 226 | ||
160 | - $timestamp = (int) substr($token, strrpos($token, '_') + 1); | ||
161 | - $expire = Yii::$app->params['user.passwordResetTokenExpire']; | ||
162 | - return $timestamp + $expire >= time(); | ||
163 | - } | 227 | + /** |
228 | + * @inheritdoc | ||
229 | + */ | ||
230 | + public function getId() | ||
231 | + { | ||
232 | + return $this->getPrimaryKey(); | ||
233 | + } | ||
164 | 234 | ||
165 | - /** | ||
166 | - * @inheritdoc | ||
167 | - */ | ||
168 | - public function getId() | ||
169 | - { | ||
170 | - return $this->getPrimaryKey(); | ||
171 | - } | 235 | + /** |
236 | + * @inheritdoc | ||
237 | + */ | ||
238 | + public function getAuthKey() | ||
239 | + { | ||
240 | + return $this->auth_key; | ||
241 | + } | ||
172 | 242 | ||
173 | - /** | ||
174 | - * @inheritdoc | ||
175 | - */ | ||
176 | - public function getAuthKey() | ||
177 | - { | ||
178 | - return $this->auth_key; | ||
179 | - } | 243 | + /** |
244 | + * @inheritdoc | ||
245 | + */ | ||
246 | + public function validateAuthKey($authKey) | ||
247 | + { | ||
248 | + return $this->getAuthKey() === $authKey; | ||
249 | + } | ||
180 | 250 | ||
181 | - /** | ||
182 | - * @inheritdoc | ||
183 | - */ | ||
184 | - public function validateAuthKey($authKey) | ||
185 | - { | ||
186 | - return $this->getAuthKey() === $authKey; | ||
187 | - } | 251 | + /** |
252 | + * Validates password | ||
253 | + * | ||
254 | + * @param string $password password to validate | ||
255 | + * | ||
256 | + * @return boolean if password provided is valid for current user | ||
257 | + */ | ||
258 | + public function validatePassword($password) | ||
259 | + { | ||
260 | + return Yii::$app->security->validatePassword($password, $this->password_hash); | ||
261 | + } | ||
188 | 262 | ||
189 | - /** | ||
190 | - * Validates password | ||
191 | - * | ||
192 | - * @param string $password password to validate | ||
193 | - * @return boolean if password provided is valid for current user | ||
194 | - */ | ||
195 | - public function validatePassword($password) | ||
196 | - { | ||
197 | - return Yii::$app->security->validatePassword($password, $this->password_hash); | ||
198 | - } | 263 | + /** |
264 | + * Generates password hash from password and sets it to the model | ||
265 | + * | ||
266 | + * @param string $password | ||
267 | + */ | ||
268 | + public function setPassword($password) | ||
269 | + { | ||
270 | + $this->password_hash = Yii::$app->security->generatePasswordHash($password); | ||
271 | + } | ||
199 | 272 | ||
200 | - /** | ||
201 | - * Generates password hash from password and sets it to the model | ||
202 | - * | ||
203 | - * @param string $password | ||
204 | - */ | ||
205 | - public function setPassword($password) | ||
206 | - { | ||
207 | - $this->password_hash = Yii::$app->security->generatePasswordHash($password); | ||
208 | - } | 273 | + /** |
274 | + * Generates "remember me" authentication key | ||
275 | + */ | ||
276 | + public function generateAuthKey() | ||
277 | + { | ||
278 | + $this->auth_key = Yii::$app->security->generateRandomString(); | ||
279 | + } | ||
209 | 280 | ||
210 | - /** | ||
211 | - * Generates "remember me" authentication key | ||
212 | - */ | ||
213 | - public function generateAuthKey() | ||
214 | - { | ||
215 | - $this->auth_key = Yii::$app->security->generateRandomString(); | ||
216 | - } | 281 | + /** |
282 | + * Generates new password reset token | ||
283 | + */ | ||
284 | + public function generatePasswordResetToken() | ||
285 | + { | ||
286 | + $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); | ||
287 | + } | ||
217 | 288 | ||
218 | - /** | ||
219 | - * Generates new password reset token | ||
220 | - */ | ||
221 | - public function generatePasswordResetToken() | ||
222 | - { | ||
223 | - $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); | ||
224 | - } | 289 | + /** |
290 | + * Removes password reset token | ||
291 | + */ | ||
292 | + public function removePasswordResetToken() | ||
293 | + { | ||
294 | + $this->password_reset_token = NULL; | ||
295 | + } | ||
225 | 296 | ||
226 | - /** | ||
227 | - * Removes password reset token | ||
228 | - */ | ||
229 | - public function removePasswordResetToken() | ||
230 | - { | ||
231 | - $this->password_reset_token = null; | ||
232 | - } | ||
233 | - | ||
234 | - public function getUserName() | ||
235 | - { | ||
236 | - return $this->username; | ||
237 | - } | 297 | + public function getUserName() |
298 | + { | ||
299 | + return $this->username; | ||
300 | + } | ||
238 | 301 | ||
239 | - public function getRoles() | ||
240 | - { | ||
241 | - $auth = \Yii::$app->authManager; | ||
242 | - $roles = $this->getRoleChildrenRecursive($auth->getRolesByUser($this->id), $auth); | ||
243 | - return $roles; | ||
244 | - } | 302 | + public function getRoles() |
303 | + { | ||
304 | + $auth = \Yii::$app->authManager; | ||
305 | + $roles = $this->getRoleChildrenRecursive($auth->getRolesByUser($this->id), $auth); | ||
306 | + return $roles; | ||
307 | + } | ||
245 | 308 | ||
246 | - protected function getRoleChildrenRecursive($roles, $auth, $result = []) | ||
247 | - { | ||
248 | - if(is_array($roles) && !empty($roles)) | 309 | + protected function getRoleChildrenRecursive($roles, $auth, $result = [ ]) |
249 | { | 310 | { |
250 | - foreach($roles as $role => $item) | ||
251 | - { | ||
252 | - if(!($item instanceof \yii\rbac\Role)) { | ||
253 | - continue; | 311 | + if(is_array($roles) && !empty( $roles )) { |
312 | + foreach($roles as $role => $item) { | ||
313 | + if(!( $item instanceof \yii\rbac\Role )) { | ||
314 | + continue; | ||
315 | + } | ||
316 | + $result[] = $role; | ||
317 | + $result = self::getRoleChildrenRecursive($auth->getChildren($role), $auth, $result); | ||
254 | } | 318 | } |
255 | - $result[] = $role; | ||
256 | - $result = self::getRoleChildrenRecursive($auth->getChildren($role), $auth, $result); | 319 | + return $result; |
320 | + } else { | ||
321 | + return $result; | ||
257 | } | 322 | } |
258 | - return $result; | ||
259 | - } else { | ||
260 | - return $result; | ||
261 | } | 323 | } |
262 | - } | ||
263 | 324 | ||
264 | -// public function afterSave ($insert, $changedAttributes) | ||
265 | -// { | ||
266 | -// parent::afterSave ($insert, $changedAttributes); | ||
267 | -// \Yii::$app->options->createOptions($this->id); | ||
268 | -// } | 325 | + // public function afterSave ($insert, $changedAttributes) |
326 | + // { | ||
327 | + // parent::afterSave ($insert, $changedAttributes); | ||
328 | + // \Yii::$app->options->createOptions($this->id); | ||
329 | + // } | ||
269 | 330 | ||
270 | - public function getUserInfo(){ | ||
271 | - return $this->hasOne(UserInfo::className(), ['user_id' => 'id']); | ||
272 | - } | 331 | + public function getUserInfo() |
332 | + { | ||
333 | + return $this->hasOne(UserInfo::className(), [ 'user_id' => 'id' ]); | ||
334 | + } | ||
273 | 335 | ||
274 | - public function getIsPerformer() | ||
275 | - { | ||
276 | - return true; | ||
277 | - } | 336 | + public function getIsPerformer() |
337 | + { | ||
338 | + return true; | ||
339 | + } | ||
340 | + | ||
341 | + public function getIsCustomer() | ||
342 | + { | ||
343 | + return true; | ||
344 | + } | ||
345 | + | ||
346 | + public function getPayments() | ||
347 | + { | ||
348 | + return $this->hasMany(Payment::className(), [ 'payment_id' => 'payment_id' ]) | ||
349 | + ->viaTable('user_payment', [ 'user_id' => 'id' ]); | ||
350 | + } | ||
351 | + | ||
352 | + public function getPaymentInput() | ||
353 | + { | ||
354 | + return $this->getPayments() | ||
355 | + ->asArray() | ||
356 | + ->column(); | ||
357 | + } | ||
358 | + | ||
359 | + public function setPaymentInput($value) | ||
360 | + { | ||
361 | + $this->paymentInput = $value; | ||
362 | + } | ||
363 | + | ||
364 | + public function getSpecializations() | ||
365 | + { | ||
366 | + return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ]) | ||
367 | + ->viaTable('user_specialization', [ 'user_id' => 'id' ]); | ||
368 | + } | ||
369 | + | ||
370 | + public function getSpecializationInput() | ||
371 | + { | ||
372 | + return $this->getSpecializations() | ||
373 | + ->asArray() | ||
374 | + ->column(); | ||
375 | + } | ||
376 | + | ||
377 | + public function setSpecializationInput($value) | ||
378 | + { | ||
379 | + $this->specializationInput = $value; | ||
380 | + } | ||
278 | 381 | ||
279 | - public function getIsCustomer() | ||
280 | - { | ||
281 | - return true; | ||
282 | } | 382 | } |
283 | -} |
frontend/controllers/AccountsController.php
@@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
16 | use common\models\Project; | 16 | use common\models\Project; |
17 | use common\models\Specialization; | 17 | use common\models\Specialization; |
18 | use common\models\Team; | 18 | use common\models\Team; |
19 | + use common\models\TeamSearch; | ||
19 | use common\models\UserPayment; | 20 | use common\models\UserPayment; |
20 | use common\models\UserSpecialization; | 21 | use common\models\UserSpecialization; |
21 | use common\models\Vacancy; | 22 | use common\models\Vacancy; |
@@ -269,43 +270,13 @@ | @@ -269,43 +270,13 @@ | ||
269 | 270 | ||
270 | public function actionService() | 271 | public function actionService() |
271 | { | 272 | { |
273 | + $user = \Yii::$app->user->identity; | ||
272 | $user_info = UserInfo::find() | 274 | $user_info = UserInfo::find() |
273 | ->where([ 'user_id' => \Yii::$app->user->getId() ]) | 275 | ->where([ 'user_id' => \Yii::$app->user->getId() ]) |
274 | ->one(); | 276 | ->one(); |
275 | if(empty( $user_info )) { | 277 | if(empty( $user_info )) { |
276 | $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); | 278 | $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); |
277 | } | 279 | } |
278 | - $post = \Yii::$app->request->post(); | ||
279 | - if(!empty( $post )) { | ||
280 | - $user_info->load($post); | ||
281 | - $user_info->save(); | ||
282 | - $user_specialization_values = [ ]; | ||
283 | - $user_payment_values = [ ]; | ||
284 | - UserSpecialization::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]); | ||
285 | - UserPayment::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]); | ||
286 | - foreach($post[ 'UserSpecialization' ][ 'specialization_id' ] as $index => $value) { | ||
287 | - $user_specialization_values[] = (new UserSpecialization([ | ||
288 | - 'user_id' => \Yii::$app->user->getId(), | ||
289 | - 'specialization_id' => $value, | ||
290 | - ]))->save(); | ||
291 | - } | ||
292 | - foreach($post[ 'UserPayment' ][ 'payment_id' ] as $index => $value) { | ||
293 | - $user_payment_values[] = (new UserPayment([ | ||
294 | - 'user_id' => \Yii::$app->user->getId(), | ||
295 | - 'payment_id' => $value, | ||
296 | - ]))->save(); | ||
297 | - } | ||
298 | - } | ||
299 | - $user_specialization = UserSpecialization::find() | ||
300 | - ->where([ 'user_id' => \Yii::$app->user->getId() ]) | ||
301 | - ->select([ 'specialization_id' ]) | ||
302 | - ->column(); | ||
303 | - $user_payment = UserPayment::find() | ||
304 | - ->where([ 'user_id' => \Yii::$app->user->getId() ]) | ||
305 | - ->select([ 'payment_id' ]) | ||
306 | - ->column(); | ||
307 | - $user_specialization_input = new UserSpecialization([ 'user_id' => \Yii::$app->user->getId() ]); | ||
308 | - $user_payment_input = new UserPayment([ 'user_id' => \Yii::$app->user->getId() ]); | ||
309 | $specialization = Specialization::find() | 280 | $specialization = Specialization::find() |
310 | ->select([ | 281 | ->select([ |
311 | 'specialization_name', | 282 | 'specialization_name', |
@@ -322,14 +293,28 @@ | @@ -322,14 +293,28 @@ | ||
322 | ->indexBy('payment_id') | 293 | ->indexBy('payment_id') |
323 | ->asArray() | 294 | ->asArray() |
324 | ->column(); | 295 | ->column(); |
296 | + $post = \Yii::$app->request->post(); | ||
297 | + if(!empty( $post )) { | ||
298 | + $user_info->load($post); | ||
299 | + $user_info->validate(); | ||
300 | + if(!$user_info->hasErrors()) { | ||
301 | + $user_info->save(); | ||
302 | + $user->load($post); | ||
303 | + $user->unlinkAll('specializations', true); | ||
304 | + foreach($user->specializationInput as $one_specialization) { | ||
305 | + $user->link('specializations', Specialization::findOne($one_specialization)); | ||
306 | + } | ||
307 | + $user->unlinkAll('payments', true); | ||
308 | + foreach($user->paymentInput as $one_payment) { | ||
309 | + $user->link('payments', Payment::findOne($one_payment)); | ||
310 | + } | ||
311 | + } | ||
312 | + } | ||
325 | return $this->render('service', [ | 313 | return $this->render('service', [ |
326 | - 'user_info' => $user_info, | ||
327 | - 'specialization' => $specialization, | ||
328 | - 'user_specialization' => $user_specialization, | ||
329 | - 'user_specialization_input' => $user_specialization_input, | ||
330 | - 'payment' => $payment, | ||
331 | - 'user_payment' => $user_payment, | ||
332 | - 'user_payment_input' => $user_payment_input, | 314 | + 'user' => $user, |
315 | + 'user_info' => $user_info, | ||
316 | + 'specialization' => $specialization, | ||
317 | + 'payment' => $payment, | ||
333 | ]); | 318 | ]); |
334 | } | 319 | } |
335 | 320 | ||
@@ -437,6 +422,18 @@ | @@ -437,6 +422,18 @@ | ||
437 | $project->load($post); | 422 | $project->load($post); |
438 | $project->validate(); | 423 | $project->validate(); |
439 | if(!$project->hasErrors()) { | 424 | if(!$project->hasErrors()) { |
425 | + $date_end = new \DateTime(); | ||
426 | + switch($post[ 'Project' ][ 'date_end' ]) { | ||
427 | + case 2: | ||
428 | + $date_end->modify('+14 day'); | ||
429 | + break; | ||
430 | + case 3: | ||
431 | + $date_end->modify('+30 day'); | ||
432 | + break; | ||
433 | + default: | ||
434 | + $date_end->modify('+7 day'); | ||
435 | + }; | ||
436 | + $project->date_end = \Yii::$app->formatter->asDate($date_end->getTimestamp(), 'short'); | ||
440 | $project->save(); | 437 | $project->save(); |
441 | $project->unlinkAll('specializations', true); | 438 | $project->unlinkAll('specializations', true); |
442 | foreach($project->specializationInput as $one_specialization) { | 439 | foreach($project->specializationInput as $one_specialization) { |
@@ -497,6 +494,18 @@ | @@ -497,6 +494,18 @@ | ||
497 | $project->load($post); | 494 | $project->load($post); |
498 | $project->validate(); | 495 | $project->validate(); |
499 | if(!$project->hasErrors()) { | 496 | if(!$project->hasErrors()) { |
497 | + $date_end = new \DateTime(); | ||
498 | + switch($post[ 'Project' ][ 'date_end' ]) { | ||
499 | + case 2: | ||
500 | + $date_end->modify('+14 day'); | ||
501 | + break; | ||
502 | + case 3: | ||
503 | + $date_end->modify('+30 day'); | ||
504 | + break; | ||
505 | + default: | ||
506 | + $date_end->modify('+7 day'); | ||
507 | + }; | ||
508 | + $project->date_end = \Yii::$app->formatter->asDate($date_end->getTimestamp(), 'short'); | ||
500 | $project->save(); | 509 | $project->save(); |
501 | $project->unlinkAll('specializations', true); | 510 | $project->unlinkAll('specializations', true); |
502 | foreach($project->specializationInput as $one_specialization) { | 511 | foreach($project->specializationInput as $one_specialization) { |
@@ -568,7 +577,13 @@ | @@ -568,7 +577,13 @@ | ||
568 | 577 | ||
569 | public function actionTeam() | 578 | public function actionTeam() |
570 | { | 579 | { |
571 | - return $this->render('team'); | 580 | + $searchModel = new TeamSearch(); |
581 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
582 | + | ||
583 | + return $this->render('team', [ | ||
584 | + 'searchModel' => $searchModel, | ||
585 | + 'dataProvider' => $dataProvider, | ||
586 | + ]); | ||
572 | } | 587 | } |
573 | 588 | ||
574 | public function actionTeamCreate() | 589 | public function actionTeamCreate() |
1 | +<?php | ||
2 | + | ||
3 | +namespace frontend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\Team; | ||
7 | +use common\models\TeamSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * TeamController implements the CRUD actions for Team model. | ||
14 | + */ | ||
15 | +class TeamController extends Controller | ||
16 | +{ | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function behaviors() | ||
21 | + { | ||
22 | + return [ | ||
23 | + 'verbs' => [ | ||
24 | + 'class' => VerbFilter::className(), | ||
25 | + 'actions' => [ | ||
26 | + 'delete' => ['POST'], | ||
27 | + ], | ||
28 | + ], | ||
29 | + ]; | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * Lists all Team models. | ||
34 | + * @return mixed | ||
35 | + */ | ||
36 | + public function actionIndex() | ||
37 | + { | ||
38 | + $searchModel = new TeamSearch(); | ||
39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
40 | + | ||
41 | + return $this->render('index', [ | ||
42 | + 'searchModel' => $searchModel, | ||
43 | + 'dataProvider' => $dataProvider, | ||
44 | + ]); | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Displays a single Team model. | ||
49 | + * @param integer $id | ||
50 | + * @return mixed | ||
51 | + */ | ||
52 | + public function actionView($id) | ||
53 | + { | ||
54 | + return $this->render('view', [ | ||
55 | + 'model' => $this->findModel($id), | ||
56 | + ]); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Creates a new Team model. | ||
61 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
62 | + * @return mixed | ||
63 | + */ | ||
64 | + public function actionCreate() | ||
65 | + { | ||
66 | + $model = new Team(); | ||
67 | + | ||
68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
69 | + return $this->redirect(['view', 'id' => $model->team_id]); | ||
70 | + } else { | ||
71 | + return $this->render('create', [ | ||
72 | + 'model' => $model, | ||
73 | + ]); | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Updates an existing Team model. | ||
79 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
80 | + * @param integer $id | ||
81 | + * @return mixed | ||
82 | + */ | ||
83 | + public function actionUpdate($id) | ||
84 | + { | ||
85 | + $model = $this->findModel($id); | ||
86 | + | ||
87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
88 | + return $this->redirect(['view', 'id' => $model->team_id]); | ||
89 | + } else { | ||
90 | + return $this->render('update', [ | ||
91 | + 'model' => $model, | ||
92 | + ]); | ||
93 | + } | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * Deletes an existing Team model. | ||
98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
99 | + * @param integer $id | ||
100 | + * @return mixed | ||
101 | + */ | ||
102 | + public function actionDelete($id) | ||
103 | + { | ||
104 | + $this->findModel($id)->delete(); | ||
105 | + | ||
106 | + return $this->redirect(['index']); | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * Finds the Team model based on its primary key value. | ||
111 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
112 | + * @param integer $id | ||
113 | + * @return Team the loaded model | ||
114 | + * @throws NotFoundHttpException if the model cannot be found | ||
115 | + */ | ||
116 | + protected function findModel($id) | ||
117 | + { | ||
118 | + if (($model = Team::findOne($id)) !== null) { | ||
119 | + return $model; | ||
120 | + } else { | ||
121 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
122 | + } | ||
123 | + } | ||
124 | +} |
frontend/views/accounts/_projects_form.php
@@ -86,10 +86,9 @@ | @@ -86,10 +86,9 @@ | ||
86 | 86 | ||
87 | <?= $form->field($project, 'date_end') | 87 | <?= $form->field($project, 'date_end') |
88 | ->dropDownList([ | 88 | ->dropDownList([ |
89 | - 'День', | ||
90 | - 'Неделю', | ||
91 | - 'Месяц', | ||
92 | - 'Год', | 89 | + 1 => 'Неделя', |
90 | + 2 => '2 неделю', | ||
91 | + 3 => 'Месяц', | ||
93 | ]) ?> | 92 | ]) ?> |
94 | 93 | ||
95 | <?= Html::submitButton('Добавить') ?> | 94 | <?= Html::submitButton('Добавить') ?> |
frontend/views/accounts/service.php
1 | <?php | 1 | <?php |
2 | /** | 2 | /** |
3 | + * @var User $user | ||
3 | * @var UserInfo $user_info | 4 | * @var UserInfo $user_info |
4 | * @var string[] $specialization | 5 | * @var string[] $specialization |
5 | - * @var integer[] $user_specialization | ||
6 | - * @var UserSpecialization $user_specialization_input | ||
7 | * @var string[] $payment | 6 | * @var string[] $payment |
8 | - * @var integer[] $user_payment | ||
9 | - * @var UserPayment $user_payment_input | ||
10 | */ | 7 | */ |
8 | + use common\models\User; | ||
11 | use common\models\UserInfo; | 9 | use common\models\UserInfo; |
12 | - use common\models\UserPayment; | ||
13 | - use common\models\UserSpecialization; | ||
14 | use yii\helpers\Html; | 10 | use yii\helpers\Html; |
15 | use yii\widgets\ActiveForm; | 11 | use yii\widgets\ActiveForm; |
16 | 12 | ||
17 | $this->title = 'Мой профиль'; | 13 | $this->title = 'Мой профиль'; |
18 | $this->params[ 'breadcrumbs' ][] = $this->title; | 14 | $this->params[ 'breadcrumbs' ][] = $this->title; |
19 | - $user_specialization_input->specialization_id = $user_specialization; | ||
20 | - $user_payment_input->payment_id = $user_payment; | ||
21 | ?> | 15 | ?> |
22 | <h1><?= $this->title ?></h1> | 16 | <h1><?= $this->title ?></h1> |
23 | <p>Рекомендуем детально заполнить для исполнителя. Это сильно влияет на количество заказов.</p> | 17 | <p>Рекомендуем детально заполнить для исполнителя. Это сильно влияет на количество заказов.</p> |
@@ -30,7 +24,7 @@ | @@ -30,7 +24,7 @@ | ||
30 | ]) | 24 | ]) |
31 | ->label('Стоимость работ') | 25 | ->label('Стоимость работ') |
32 | ->textInput() ?> | 26 | ->textInput() ?> |
33 | -<?= $form->field($user_specialization_input, 'specialization_id') | 27 | +<?= $form->field($user, 'specializationInput') |
34 | ->label('Специализация услуг') | 28 | ->label('Специализация услуг') |
35 | ->checkboxList($specialization) ?> | 29 | ->checkboxList($specialization) ?> |
36 | <?= $form->field($user_info, 'guarantee', [ | 30 | <?= $form->field($user_info, 'guarantee', [ |
@@ -69,7 +63,7 @@ | @@ -69,7 +63,7 @@ | ||
69 | ]) | 63 | ]) |
70 | ->label('Минимальная предоплата за работы') | 64 | ->label('Минимальная предоплата за работы') |
71 | ->textInput() ?> | 65 | ->textInput() ?> |
72 | -<?= $form->field($user_payment_input, 'payment_id') | 66 | +<?= $form->field($user, 'paymentInput') |
73 | ->label('Способы оплаты') | 67 | ->label('Способы оплаты') |
74 | ->checkboxList($payment) ?> | 68 | ->checkboxList($payment) ?> |
75 | <?= Html::submitButton('Обновить') ?> | 69 | <?= Html::submitButton('Обновить') ?> |
1 | +<?php | ||
2 | + /** | ||
3 | + * @var TeamSearch $searchModel | ||
4 | + * @var ActiveDataProvider $dataProvider | ||
5 | + */ | ||
6 | + use common\models\TeamSearch; | ||
7 | + use yii\data\ActiveDataProvider; | ||
8 | + use yii\grid\GridView; | ||
9 | + use yii\helpers\Html; | ||
10 | + | ||
11 | + $this->title = 'Команда'; | ||
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
13 | +?> | ||
14 | + <h1><?= $this->title ?></h1> | ||
15 | + <p> | ||
16 | + <?= Html::a(Yii::t('app', 'Добавить'), [ 'team-create' ], [ 'class' => 'btn btn-success' ]) ?> | ||
17 | + </p> | ||
18 | +<?= GridView::widget([ | ||
19 | + 'dataProvider' => $dataProvider, | ||
20 | + 'filterModel' => $searchModel, | ||
21 | + 'columns' => [ | ||
22 | + [ | ||
23 | + 'attribute' => 'team_id', | ||
24 | + 'label' => 'ID', | ||
25 | + ], | ||
26 | + [ | ||
27 | + 'value' => function($model, $key, $index, $column) { | ||
28 | + return $model->lastname.' '.$model->firstname.' '.$model->middlename; | ||
29 | + }, | ||
30 | + 'label' => 'ФИО', | ||
31 | + ], | ||
32 | + [ | ||
33 | + 'value' => function($model, $key, $index, $column) { | ||
34 | + return \Yii::$app->formatter->asBoolean(!empty($model->link)); | ||
35 | + }, | ||
36 | + 'label' => 'Участник МФП', | ||
37 | + ], | ||
38 | + [ | ||
39 | + 'attribute' => 'department.name', | ||
40 | + 'label' => 'Отдел компании', | ||
41 | + ], | ||
42 | + [ | ||
43 | + 'value' => function($model, $key, $index, $column) { | ||
44 | + return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from; | ||
45 | + }, | ||
46 | + 'label' => 'Опыл, лет', | ||
47 | + ], | ||
48 | + 'team_id', | ||
49 | + 'user_id', | ||
50 | + 'firstname', | ||
51 | + 'lastname', | ||
52 | + 'middlename', | ||
53 | + // 'link', | ||
54 | + // 'position', | ||
55 | + // 'department_id', | ||
56 | + // 'date_add', | ||
57 | + // 'user_add_id', | ||
58 | + // 'photo', | ||
59 | + // 'country_id', | ||
60 | + // 'experience_from', | ||
61 | + | ||
62 | + [ 'class' => 'yii\grid\ActionColumn' ], | ||
63 | + ], | ||
64 | +]); ?> | ||
0 | \ No newline at end of file | 65 | \ No newline at end of file |
frontend/views/layouts/admin.php
@@ -34,7 +34,7 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -34,7 +34,7 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
34 | ], | 34 | ], |
35 | [ | 35 | [ |
36 | 'label' => 'Трудовой стаж', | 36 | 'label' => 'Трудовой стаж', |
37 | - 'url' => ['accounts/'], | 37 | + 'url' => ['accounts/employment'], |
38 | ], | 38 | ], |
39 | [ | 39 | [ |
40 | 'label' => 'Дополнительные навыки', | 40 | 'label' => 'Дополнительные навыки', |
@@ -42,30 +42,30 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -42,30 +42,30 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
42 | ], | 42 | ], |
43 | [ | 43 | [ |
44 | 'label' => 'Описание', | 44 | 'label' => 'Описание', |
45 | - 'url' => ['accounts/'], | 45 | + 'url' => ['accounts/description'], |
46 | ], | 46 | ], |
47 | 47 | ||
48 | [ | 48 | [ |
49 | 'label' => 'Команда', | 49 | 'label' => 'Команда', |
50 | - 'url' => ['accounts/'], | 50 | + 'url' => ['accounts/team'], |
51 | ], | 51 | ], |
52 | 52 | ||
53 | [ | 53 | [ |
54 | 'label' => 'Вакансии', | 54 | 'label' => 'Вакансии', |
55 | - 'url' => ['accounts/'], | 55 | + 'url' => ['accounts/vacancy'], |
56 | ], | 56 | ], |
57 | [ | 57 | [ |
58 | 'label' => 'Ваши проекты', | 58 | 'label' => 'Ваши проекты', |
59 | - 'url' => ['accounts/'], | 59 | + 'url' => ['accounts/projects'], |
60 | ], | 60 | ], |
61 | [ | 61 | [ |
62 | 'label' => 'Портфолио', | 62 | 'label' => 'Портфолио', |
63 | - 'url' => ['accounts/portfolio-create'], | 63 | + 'url' => ['accounts/portfolio'], |
64 | ], | 64 | ], |
65 | 65 | ||
66 | [ | 66 | [ |
67 | 'label' => 'Блог', | 67 | 'label' => 'Блог', |
68 | - 'url' => ['accounts/blog-create'], | 68 | + 'url' => ['accounts/blog'], |
69 | ], | 69 | ], |
70 | [ | 70 | [ |
71 | 'label' => 'Галерея', | 71 | 'label' => 'Галерея', |
@@ -73,15 +73,15 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -73,15 +73,15 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
73 | ], | 73 | ], |
74 | [ | 74 | [ |
75 | 'label' => 'Сообщения', | 75 | 'label' => 'Сообщения', |
76 | - 'url' => ['accounts/'], | 76 | + 'url' => ['chat/list'], |
77 | ], | 77 | ], |
78 | [ | 78 | [ |
79 | 'label' => 'Уведомления о проектах', | 79 | 'label' => 'Уведомления о проектах', |
80 | - 'url' => ['accounts/'], | 80 | + 'url' => ['accounts/projects'], |
81 | ], | 81 | ], |
82 | [ | 82 | [ |
83 | 'label' => 'Закладки', | 83 | 'label' => 'Закладки', |
84 | - 'url' => ['accounts/'], | 84 | + 'url' => ['accounts/bookmarks'], |
85 | ], | 85 | ], |
86 | [ | 86 | [ |
87 | 'label' => 'Настройка аккаунта', | 87 | 'label' => 'Настройка аккаунта', |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Team */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="team-form"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin(); ?> | ||
14 | + | ||
15 | + <?= $form->field($model, 'firstname')->textInput(['maxlength' => true]) ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'lastname')->textInput(['maxlength' => true]) ?> | ||
18 | + | ||
19 | + <?= $form->field($model, 'middlename')->textInput(['maxlength' => true]) ?> | ||
20 | + | ||
21 | + <?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?> | ||
22 | + | ||
23 | + <?= $form->field($model, 'position')->textInput(['maxlength' => true]) ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'department_id')->textInput() ?> | ||
26 | + | ||
27 | + <?= $form->field($model, 'photo')->textInput(['maxlength' => true]) ?> | ||
28 | + | ||
29 | + <?= $form->field($model, 'country_id')->textInput(['maxlength' => true]) ?> | ||
30 | + | ||
31 | + <?= $form->field($model, 'experience_from')->textInput() ?> | ||
32 | + | ||
33 | + <div class="form-group"> | ||
34 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
35 | + </div> | ||
36 | + | ||
37 | + <?php ActiveForm::end(); ?> | ||
38 | + | ||
39 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\TeamSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="team-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'team_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'user_id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'firstname') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'lastname') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'middlename') ?> | ||
27 | + | ||
28 | + <?php // echo $form->field($model, 'link') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'position') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'department_id') ?> | ||
33 | + | ||
34 | + <?php // echo $form->field($model, 'date_add') ?> | ||
35 | + | ||
36 | + <?php // echo $form->field($model, 'user_add_id') ?> | ||
37 | + | ||
38 | + <?php // echo $form->field($model, 'photo') ?> | ||
39 | + | ||
40 | + <?php // echo $form->field($model, 'country_id') ?> | ||
41 | + | ||
42 | + <?php // echo $form->field($model, 'experience_from') ?> | ||
43 | + | ||
44 | + <div class="form-group"> | ||
45 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
46 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
47 | + </div> | ||
48 | + | ||
49 | + <?php ActiveForm::end(); ?> | ||
50 | + | ||
51 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Team */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Team'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Teams'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="team-create"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel common\models\TeamSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Teams'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="team-index"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
17 | + | ||
18 | + <p> | ||
19 | + <?= Html::a(Yii::t('app', 'Create Team'), ['create'], ['class' => 'btn btn-success']) ?> | ||
20 | + </p> | ||
21 | + <?= GridView::widget([ | ||
22 | + 'dataProvider' => $dataProvider, | ||
23 | + 'filterModel' => $searchModel, | ||
24 | + 'columns' => [ | ||
25 | + ['class' => 'yii\grid\SerialColumn'], | ||
26 | + | ||
27 | + 'team_id', | ||
28 | + 'user_id', | ||
29 | + 'firstname', | ||
30 | + 'lastname', | ||
31 | + 'middlename', | ||
32 | + // 'link', | ||
33 | + // 'position', | ||
34 | + // 'department_id', | ||
35 | + // 'date_add', | ||
36 | + // 'user_add_id', | ||
37 | + // 'photo', | ||
38 | + // 'country_id', | ||
39 | + // 'experience_from', | ||
40 | + | ||
41 | + ['class' => 'yii\grid\ActionColumn'], | ||
42 | + ], | ||
43 | + ]); ?> | ||
44 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model common\models\Team */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Team', | ||
10 | +]) . ' ' . $model->team_id; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Teams'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->team_id, 'url' => ['view', 'id' => $model->team_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="team-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Team */ | ||
8 | + | ||
9 | +$this->title = $model->team_id; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Teams'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="team-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->team_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->team_id], [ | ||
20 | + 'class' => 'btn btn-danger', | ||
21 | + 'data' => [ | ||
22 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | ||
23 | + 'method' => 'post', | ||
24 | + ], | ||
25 | + ]) ?> | ||
26 | + </p> | ||
27 | + | ||
28 | + <?= DetailView::widget([ | ||
29 | + 'model' => $model, | ||
30 | + 'attributes' => [ | ||
31 | + 'team_id', | ||
32 | + 'user_id', | ||
33 | + 'firstname', | ||
34 | + 'lastname', | ||
35 | + 'middlename', | ||
36 | + 'link', | ||
37 | + 'position', | ||
38 | + 'department_id', | ||
39 | + 'date_add', | ||
40 | + 'user_add_id', | ||
41 | + 'photo', | ||
42 | + 'country_id', | ||
43 | + 'experience_from', | ||
44 | + ], | ||
45 | + ]) ?> | ||
46 | + | ||
47 | +</div> |