6310a439
Administrator
firs page
|
1
|
<?php
|
5f49082a
Yarik
test
|
2
3
|
namespace frontend\controllers;
|
84ebac3d
Yarik
test
|
4
|
use common\models\Blog;
|
989c83b0
Yarik
test
|
5
|
use common\models\BlogSearch;
|
5f49082a
Yarik
test
|
6
|
use common\models\CompanyInfo;
|
02524a34
Yarik
test
|
7
|
use common\models\Country;
|
9cc08528
Yarik
test
|
8
|
use common\models\Currency;
|
02524a34
Yarik
test
|
9
|
use common\models\Department;
|
ea09d15d
Yarik
test
|
10
|
use common\models\Employment;
|
5f49082a
Yarik
test
|
11
|
use common\models\Fields;
|
ea09d15d
Yarik
test
|
12
|
use common\models\Gallery;
|
989c83b0
Yarik
test
|
13
|
use common\models\GallerySearch;
|
5f49082a
Yarik
test
|
14
15
16
|
use common\models\Job;
use common\models\Language;
use common\models\Payment;
|
7eb29439
Yarik
test
|
17
|
use common\models\Portfolio;
|
989c83b0
Yarik
test
|
18
|
use common\models\PortfolioSearch;
|
7eb29439
Yarik
test
|
19
|
use common\models\PortfolioSpecialization;
|
84ebac3d
Yarik
test
|
20
|
use common\models\Project;
|
989c83b0
Yarik
test
|
21
|
use common\models\ProjectSearch;
|
5f49082a
Yarik
test
|
22
|
use common\models\Specialization;
|
02524a34
Yarik
test
|
23
|
use common\models\Team;
|
b95371cf
Yarik
test
|
24
|
use common\models\TeamSearch;
|
5f49082a
Yarik
test
|
25
26
|
use common\models\UserPayment;
use common\models\UserSpecialization;
|
ea09d15d
Yarik
test
|
27
|
use common\models\Vacancy;
|
588209fc
Yarik
test
|
28
|
use common\models\VacancySearch;
|
5f49082a
Yarik
test
|
29
30
31
32
|
use Yii;
use common\models\User;
use common\models\UserInfo;
|
a02e2fdb
Yarik
test
|
33
34
|
use yii\base\ErrorException;
use yii\db\ActiveRecord;
|
5f49082a
Yarik
test
|
35
|
use yii\filters\AccessControl;
|
588209fc
Yarik
test
|
36
|
use yii\filters\VerbFilter;
|
5f49082a
Yarik
test
|
37
38
|
use yii\web\Controller;
use yii\web\NotFoundHttpException;
|
6310a439
Administrator
firs page
|
39
|
|
5f49082a
Yarik
test
|
40
41
42
43
44
|
/**
* Site controller
*/
class AccountsController extends Controller
{
|
6e1510b2
Administrator
firs page
|
45
|
|
5f49082a
Yarik
test
|
46
|
public $layout = 'admin';
|
6e1510b2
Administrator
firs page
|
47
|
|
a02e2fdb
Yarik
test
|
48
49
|
public $defaultAction = 'general';
|
5f49082a
Yarik
test
|
50
51
52
53
54
55
56
57
58
59
60
|
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
//'actions' => ['cabinet','change-password', 'bookmarks', 'projects'],
'allow' => true,
'roles' => [ '@' ],
],
|
6310a439
Administrator
firs page
|
61
62
|
],
],
|
588209fc
Yarik
test
|
63
64
65
|
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
|
989c83b0
Yarik
test
|
66
67
68
69
70
|
'team-delete' => [ 'POST' ],
'vacancy-delete' => [ 'POST' ],
'portfolio-delete' => [ 'POST' ],
'projects-delete' => [ 'POST' ],
'blog-delete' => [ 'POST' ],
|
588209fc
Yarik
test
|
71
72
|
],
],
|
5f49082a
Yarik
test
|
73
74
|
];
}
|
6310a439
Administrator
firs page
|
75
|
|
a02e2fdb
Yarik
test
|
76
77
|
/**
* Page of additional skills, consist:
|
a02e2fdb
Yarik
test
|
78
79
80
81
|
* * working with programs;
* * education;
* * own developments and patents;
* * courses and trainings;
|
a02e2fdb
Yarik
test
|
82
83
|
* @return string
*/
|
588209fc
Yarik
test
|
84
85
86
87
88
89
90
91
92
|
public function actionAddSkills()
{
$user = \Yii::$app->user->identity;
if(!empty( \Yii::$app->request->post() )) {
Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru');
}
return $this->render('add-skills', [ 'user' => $user ]);
}
|
a02e2fdb
Yarik
test
|
93
94
|
/**
* Page of blog grid view
|
a02e2fdb
Yarik
test
|
95
96
|
* @return string
*/
|
588209fc
Yarik
test
|
97
98
|
public function actionBlog()
{
|
989c83b0
Yarik
test
|
99
100
101
102
103
104
105
|
$searchModel = new BlogSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('blog', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
|
588209fc
Yarik
test
|
106
107
|
}
|
a02e2fdb
Yarik
test
|
108
109
|
/**
* Page of creating one record of blog.
|
a02e2fdb
Yarik
test
|
110
111
|
* @return string|\yii\web\Response Page html / Redirect
*/
|
588209fc
Yarik
test
|
112
113
114
115
116
117
|
public function actionBlogCreate()
{
$blog = new Blog();
$post = \Yii::$app->request->post();
if($blog->load($post) && $blog->save()) {
return $this->redirect([
|
4c9663e0
Yarik
test
|
118
|
'blog',
|
588209fc
Yarik
test
|
119
120
121
122
123
124
|
]);
} else {
return $this->render('_blog_form', [ 'blog' => $blog ]);
}
}
|
a02e2fdb
Yarik
test
|
125
126
127
128
129
130
131
132
|
/**
* Page of editting one User's record of blog.
*
* @param integer $id ID of User's record
*
* @return string|\yii\web\Response Page html / Redirect
* @throws NotFoundHttpException if not found or someone else's post
*/
|
588209fc
Yarik
test
|
133
134
|
public function actionBlogUpdate($id)
{
|
a02e2fdb
Yarik
test
|
135
136
137
138
139
140
141
|
$user = \Yii::$app->user->identity;
$blog = $user->getBlog()
->where([ 'blog_id' => $id ])
->one();
if(!$blog instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
|
588209fc
Yarik
test
|
142
143
144
145
146
147
148
149
|
$post = \Yii::$app->request->post();
if($blog->load($post) && $blog->save()) {
return $this->redirect('blog');
} else {
return $this->render('_blog_form', [ 'blog' => $blog ]);
}
}
|
a02e2fdb
Yarik
test
|
150
151
152
153
154
155
156
157
|
/**
* Delete User's blog record
*
* @param $id ID of User's record
*
* @return \yii\web\Response Redirect
* @throws NotFoundHttpException
*/
|
989c83b0
Yarik
test
|
158
159
|
public function actionBlogDelete($id)
{
|
a02e2fdb
Yarik
test
|
160
161
162
163
164
165
|
$user = \Yii::$app->user->identity;
$blog = $user->getBlog()
->where([ 'blog_id' => $id ])
->one();
if(!$blog instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
|
5f49082a
Yarik
test
|
166
|
}
|
a02e2fdb
Yarik
test
|
167
168
|
$blog->delete();
return $this->redirect('blog');
|
70abf3e7
Administrator
add field v.1
|
169
|
}
|
6310a439
Administrator
firs page
|
170
|
|
a02e2fdb
Yarik
test
|
171
172
|
/**
* Page of contacts. Consist:
|
a02e2fdb
Yarik
test
|
173
174
175
|
* * phones;
* * social pages;
* * sites;
|
a02e2fdb
Yarik
test
|
176
177
|
* @return string page html
*/
|
588209fc
Yarik
test
|
178
|
public function actionContacts()
|
5f49082a
Yarik
test
|
179
|
{
|
a02e2fdb
Yarik
test
|
180
181
|
$user = \Yii::$app->user->identity;
$user_info = $user->userInfo;
|
588209fc
Yarik
test
|
182
183
184
185
|
if(empty( $user_info )) {
$user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]);
}
if(!empty( \Yii::$app->request->post() )) {
|
e4a014b8
Yarik
test
|
186
|
if(!empty( Yii::$app->request->post('Fields') )) {
|
2cee8b86
Yarik
test
|
187
|
|
5346fcf9
Yarik
test
|
188
189
|
Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru');
}
|
588209fc
Yarik
test
|
190
191
192
193
194
195
|
$user_info->load(\Yii::$app->request->post());
$user_info->save();
}
return $this->render('contacts', [ 'user_info' => $user_info ]);
}
|
a02e2fdb
Yarik
test
|
196
197
|
/**
* Page of description. Consist of information about User.
|
a02e2fdb
Yarik
test
|
198
199
|
* @return string page html
*/
|
588209fc
Yarik
test
|
200
201
|
public function actionDescription()
{
|
a02e2fdb
Yarik
test
|
202
203
|
$user = \Yii::$app->user->identity;
$user_info = $user->userInfo;
|
588209fc
Yarik
test
|
204
205
206
207
208
209
210
211
212
213
214
|
if(empty( $user_info )) {
$user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]);
}
$post = \Yii::$app->request->post();
if(!empty( $post )) {
$user_info->load($post);
$user_info->save();
}
return $this->render('description', [ 'user_info' => $user_info ]);
}
|
a02e2fdb
Yarik
test
|
215
216
|
/**
* Page of seniority. Consist:
|
a02e2fdb
Yarik
test
|
217
218
219
|
* * current job;
* * year of the beginning of designing
* * previous jobs
|
a02e2fdb
Yarik
test
|
220
221
|
* @return string page html
*/
|
588209fc
Yarik
test
|
222
223
|
public function actionEmployment()
{
|
a02e2fdb
Yarik
test
|
224
225
|
$user = \Yii::$app->user->identity;
$user_info = $user->userInfo;
|
3e842416
Yarik
test
|
226
227
228
|
if(empty( $user_info )) {
$user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]);
}
|
588209fc
Yarik
test
|
229
230
|
$post = \Yii::$app->request->post();
if(!empty( $post )) {
|
3e842416
Yarik
test
|
231
232
|
$user_info->load($post);
$user_info->save();
|
588209fc
Yarik
test
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
$job = [ ];
for($i = 0; $i < count($post[ 'Job' ]); $i++) {
$job[ $i ] = new Job([
'user_id' => \Yii::$app->user->getId(),
'current' => 0,
]);
}
if(Job::loadMultiple($job, $post)) {
$job[ 0 ]->current = 1;
if(Job::validateMultiple($job)) {
Job::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]);
foreach($job as $onejob) {
$onejob->save(false);
}
}
}
} else {
|
a02e2fdb
Yarik
test
|
250
251
252
|
$job = $user->getJobs()
->orderBy([ 'current' => SORT_DESC ])
->all();
|
588209fc
Yarik
test
|
253
254
255
256
257
258
259
260
261
262
263
264
265
|
if(empty( $job )) {
$job[] = new Job([
'user_id' => \Yii::$app->user->getId(),
'current' => 0,
]);
}
if(!$job[ 0 ]->current) {
array_unshift($job, new Job([
'user_id' => \Yii::$app->user->getId(),
'current' => 1,
]));
}
}
|
a02e2fdb
Yarik
test
|
266
267
268
|
return $this->render('employment', [
'job' => $job,
'user_info' => $user_info,
|
3e842416
Yarik
test
|
269
|
]);
|
588209fc
Yarik
test
|
270
271
|
}
|
e8236f44
Yarik
test
|
272
273
|
/**
* Page of User's image galleries
|
e8236f44
Yarik
test
|
274
275
|
* @return string
*/
|
588209fc
Yarik
test
|
276
277
|
public function actionGallery()
{
|
989c83b0
Yarik
test
|
278
279
|
$searchModel = new GallerySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
588209fc
Yarik
test
|
280
|
|
989c83b0
Yarik
test
|
281
282
283
284
|
return $this->render('gallery', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
|
588209fc
Yarik
test
|
285
286
|
}
|
e8236f44
Yarik
test
|
287
288
|
/**
* Page of User's videos
|
e8236f44
Yarik
test
|
289
290
|
* @return string
*/
|
9217ef8e
Administrator
09.02.16
|
291
292
293
294
295
|
public function actionGalleryVideo()
{
$user = \Yii::$app->user->identity;
|
1b56164e
Yarik
test
|
296
|
$video = Fields::getData($user->id, Gallery::className(), 'youtube');
|
9217ef8e
Administrator
09.02.16
|
297
|
|
1b56164e
Yarik
test
|
298
|
if(!empty( Yii::$app->request->post('Fields') )) {
|
3d0e6093
Administrator
15.02.16
|
299
|
Fields::saveFieldVideoData(Yii::$app->request->post('Fields'), $user->id, Gallery::className(), 'ru');
|
9217ef8e
Administrator
09.02.16
|
300
301
302
|
}
return $this->render('gallery-video', [
|
1b56164e
Yarik
test
|
303
|
'video' => $video,
|
9217ef8e
Administrator
09.02.16
|
304
305
306
307
|
'user' => $user,
]);
}
|
e8236f44
Yarik
test
|
308
309
|
/**
* Page of creating a photo gallery
|
e8236f44
Yarik
test
|
310
311
|
* @return string|\yii\web\Response
*/
|
588209fc
Yarik
test
|
312
313
314
315
316
317
|
public function actionGalleryCreate()
{
$gallery = new Gallery();
$user = \Yii::$app->user->identity;
$post = \Yii::$app->request->post();
if($gallery->load($post) && $gallery->save()) {
|
588209fc
Yarik
test
|
318
|
return $this->redirect([
|
bbc81528
Yarik
test
|
319
|
'gallery',
|
588209fc
Yarik
test
|
320
321
322
323
324
325
326
327
328
|
]);
} else {
return $this->render('_gallery_form', [
'gallery' => $gallery,
'user' => $user,
]);
}
}
|
e8236f44
Yarik
test
|
329
330
331
332
333
334
335
|
/**
* Page of updating existing photo gallery
*
* @param $id ID of Gallery
*
* @return string|\yii\web\Response
*/
|
588209fc
Yarik
test
|
336
337
|
public function actionGalleryUpdate($id)
{
|
588209fc
Yarik
test
|
338
|
$user = \Yii::$app->user->identity;
|
2e35d6bd
Yarik
test
|
339
340
341
|
$gallery = $user->getGalleries()
->where([ 'gallery_id' => $id ])
->one();
|
588209fc
Yarik
test
|
342
343
|
$post = \Yii::$app->request->post();
if($gallery->load($post) && $gallery->save()) {
|
588209fc
Yarik
test
|
344
|
return $this->redirect([
|
bbc81528
Yarik
test
|
345
|
'gallery',
|
588209fc
Yarik
test
|
346
347
348
349
350
351
352
|
]);
} else {
return $this->render('_gallery_form', [
'gallery' => $gallery,
'user' => $user,
]);
}
|
5f49082a
Yarik
test
|
353
|
}
|
6310a439
Administrator
firs page
|
354
|
|
e8236f44
Yarik
test
|
355
356
357
358
359
360
361
|
/**
* Page of deleting existing photo gallery
*
* @param $id ID of Gallery
*
* @throws \Exception
*/
|
f59447a7
Yarik
test
|
362
363
364
365
366
367
368
|
public function actionGalleryDelete($id)
{
Gallery::findOne($id)
->delete();
$this->redirect('gallery');
}
|
a02e2fdb
Yarik
test
|
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
/**
* Page of credentials. Consist:
* <ul>
* <li>
* Company info:
* <ul>
* <li>Company name</li>
* <li>Employees count</li>
* <li>Street</li>
* <li>House</li>
* </ul>
* </li>
* <li>
* User info:
* <ul>
* <li>User name</li>
* <li>User surname</li>
* <li>Email</li>
* </ul>
* </li>
* <li>
* Common info:
* <ul>
* <li>Status (free/busy)</li>
* <li>City</li>
* <li>Avatar</li>
* <li>Cover</li>
* <li>Membership</li>
* </ul>
* </li>
* </ul>
|
a02e2fdb
Yarik
test
|
400
401
|
* @return string page html
*/
|
5f49082a
Yarik
test
|
402
|
public function actionGeneral()
|
51e0a262
Yarik
test
|
403
|
{
|
a02e2fdb
Yarik
test
|
404
405
406
|
$user = \Yii::$app->user->identity;
$user_info = $user->userInfo;
$company_info = $user->companyInfo;
|
5f49082a
Yarik
test
|
407
408
|
$user = \Yii::$app->user->identity;
if(empty( $user_info )) {
|
a02e2fdb
Yarik
test
|
409
|
$user_info = new UserInfo([ 'user_id' => $user->id ]);
|
5f49082a
Yarik
test
|
410
|
}
|
54d398c7
Administrator
24.02.16
|
411
|
|
5f49082a
Yarik
test
|
412
|
if(empty( $company_info )) {
|
a02e2fdb
Yarik
test
|
413
|
$company_info = new CompanyInfo([ 'user_id' => $user->id ]);
|
5f49082a
Yarik
test
|
414
|
}
|
54d398c7
Administrator
24.02.16
|
415
|
|
5f49082a
Yarik
test
|
416
417
|
$post = \Yii::$app->request->post();
if(!empty( $post )) {
|
54d398c7
Administrator
24.02.16
|
418
419
420
421
422
423
424
425
426
427
428
|
if($user_info->load($post)){
$user_info->save();
}
if($company_info->load($post)){
$company_info->save();
}
if($user->load($post) && $user->save() ) {
|
5f49082a
Yarik
test
|
429
430
431
432
433
434
435
436
437
438
|
\Yii::$app->session->setFlash('userinfoupdate', 'Информация успешно обновлена');
} else {
\Yii::$app->session->setFlash('userinfoupdate', 'Ошибка обновления. Проверьте форму');
}
}
return $this->render('general', [
'user_info' => $user_info,
'user' => $user,
'company_info' => $company_info,
]);
|
51e0a262
Yarik
test
|
439
|
}
|
5f49082a
Yarik
test
|
440
|
|
e8236f44
Yarik
test
|
441
442
443
444
445
446
447
|
/**
* Renders form via ajax, using lastindex.
*
* @param integer $lastindex Last index of form input of current type
*
* @return string
*/
|
588209fc
Yarik
test
|
448
|
public function actionGetForm($lastindex)
|
84ebac3d
Yarik
test
|
449
|
{
|
588209fc
Yarik
test
|
450
|
return $this->renderAjax('_job_form', [ 'index' => $lastindex + 1 ]);
|
84ebac3d
Yarik
test
|
451
452
|
}
|
e8236f44
Yarik
test
|
453
454
|
/**
* Page of User's portfolio
|
e8236f44
Yarik
test
|
455
456
|
* @return string
*/
|
5f49082a
Yarik
test
|
457
|
public function actionPortfolio()
|
51e0a262
Yarik
test
|
458
|
{
|
989c83b0
Yarik
test
|
459
460
|
$searchModel = new PortfolioSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
1b56164e
Yarik
test
|
461
|
$dataProvider->pagination->pageSize = 5;
|
989c83b0
Yarik
test
|
462
463
464
465
|
return $this->render('portfolio', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
|
7eb29439
Yarik
test
|
466
467
|
}
|
e8236f44
Yarik
test
|
468
469
|
/**
* Page of creating User's portfolio records.
|
e8236f44
Yarik
test
|
470
471
|
* @return string|\yii\web\Response
*/
|
7eb29439
Yarik
test
|
472
473
|
public function actionPortfolioCreate()
{
|
2e35d6bd
Yarik
test
|
474
|
$user = \Yii::$app->user->identity;
|
7eb29439
Yarik
test
|
475
|
$portfolio = new Portfolio();
|
1b56164e
Yarik
test
|
476
477
478
479
|
$specializations = Specialization::find()
->where([ 'specialization_pid' => 0 ])
->orderBy('specialization_id')
->all();
|
2e35d6bd
Yarik
test
|
480
481
482
483
484
485
486
487
|
$galleries = $user->getGalleries()
->select([
'name',
'gallery_id',
])
->asArray()
->indexBy('gallery_id')
->column();
|
7eb29439
Yarik
test
|
488
|
$post = \Yii::$app->request->post();
|
84ebac3d
Yarik
test
|
489
|
if(!empty( $post )) {
|
7eb29439
Yarik
test
|
490
491
492
493
494
495
|
$portfolio->load($post);
$portfolio->validate();
if(!$portfolio->hasErrors()) {
$portfolio->save();
$portfolio->unlinkAll('specializations', true);
foreach($portfolio->specializationInput as $one_specialization) {
|
1b56164e
Yarik
test
|
496
|
$portfolio->link('specializations', Specialization::findOne($one_specialization));
|
7eb29439
Yarik
test
|
497
|
}
|
84ebac3d
Yarik
test
|
498
|
return $this->redirect('portfolio');
|
7eb29439
Yarik
test
|
499
500
|
}
}
|
84ebac3d
Yarik
test
|
501
|
return $this->render('_portfolio_form', [
|
1b56164e
Yarik
test
|
502
|
'portfolio' => $portfolio,
|
9fdba9c2
Administrator
15.02.16
|
503
|
'specializations' => $specializations,
|
2e35d6bd
Yarik
test
|
504
|
'galleries' => $galleries,
|
84ebac3d
Yarik
test
|
505
|
]);
|
7eb29439
Yarik
test
|
506
|
}
|
5f49082a
Yarik
test
|
507
|
|
e8236f44
Yarik
test
|
508
509
510
511
512
513
514
515
|
/**
* Page of updating User's portfolio record.
*
* @param integer $id ID of User's portfolio record
*
* @return string|\yii\web\Response
* @throws NotFoundHttpException if record not found
*/
|
7eb29439
Yarik
test
|
516
517
|
public function actionPortfolioUpdate($id)
{
|
a02e2fdb
Yarik
test
|
518
519
520
521
|
$user = \Yii::$app->user->identity;
$portfolio = $user->getPortfolios()
->where([ 'portfolio_id' => $id ])
->one();
|
2e35d6bd
Yarik
test
|
522
523
524
525
526
527
528
529
|
$galleries = $user->getGalleries()
->select([
'name',
'gallery_id',
])
->asArray()
->indexBy('gallery_id')
->column();
|
a02e2fdb
Yarik
test
|
530
531
532
|
if(!$portfolio instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
|
f7089e23
Administrator
15.02.16
|
533
|
|
1b56164e
Yarik
test
|
534
535
536
537
|
$specializations = Specialization::find()
->where([ 'specialization_pid' => 0 ])
->orderBy('specialization_id')
->all();
|
f7089e23
Administrator
15.02.16
|
538
|
|
7eb29439
Yarik
test
|
539
|
$post = \Yii::$app->request->post();
|
f7089e23
Administrator
15.02.16
|
540
|
|
84ebac3d
Yarik
test
|
541
|
if(!empty( $post )) {
|
7eb29439
Yarik
test
|
542
543
544
545
546
|
$portfolio->load($post);
$portfolio->validate();
if(!$portfolio->hasErrors()) {
$portfolio->save();
$portfolio->unlinkAll('specializations', true);
|
7eb29439
Yarik
test
|
547
|
foreach($portfolio->specializationInput as $one_specialization) {
|
e4a014b8
Yarik
test
|
548
|
$portfolio->link('specializations', Specialization::findOne($one_specialization));
|
7eb29439
Yarik
test
|
549
|
}
|
84ebac3d
Yarik
test
|
550
|
return $this->redirect('portfolio');
|
7eb29439
Yarik
test
|
551
552
|
}
}
|
f7089e23
Administrator
15.02.16
|
553
|
|
84ebac3d
Yarik
test
|
554
|
return $this->render('_portfolio_form', [
|
1b56164e
Yarik
test
|
555
|
'portfolio' => $portfolio,
|
9fdba9c2
Administrator
15.02.16
|
556
|
'specializations' => $specializations,
|
2e35d6bd
Yarik
test
|
557
|
'galleries' => $galleries,
|
84ebac3d
Yarik
test
|
558
|
]);
|
51e0a262
Yarik
test
|
559
|
}
|
5f49082a
Yarik
test
|
560
|
|
e8236f44
Yarik
test
|
561
562
563
564
565
566
567
568
|
/**
* Page of deleting User's portfolio record.
*
* @param integer $id ID of User's portfolio record
*
* @throws NotFoundHttpException
* @throws \Exception if record not found
*/
|
989c83b0
Yarik
test
|
569
570
|
public function actionPortfolioDelete($id)
{
|
a02e2fdb
Yarik
test
|
571
572
573
574
575
576
577
578
|
$user = \Yii::$app->user->identity;
$portfolio = $user->getPortfolios()
->where([ 'portfolio_id' => $id ])
->one();
if(!$portfolio instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
$portfolio->delete();
|
989c83b0
Yarik
test
|
579
580
581
|
$this->redirect('portfolio');
}
|
e8236f44
Yarik
test
|
582
583
|
/**
* Page of User's projects.
|
e8236f44
Yarik
test
|
584
585
|
* @return string
*/
|
5f49082a
Yarik
test
|
586
587
|
public function actionProjects()
{
|
989c83b0
Yarik
test
|
588
589
590
591
592
593
594
|
$searchModel = new ProjectSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('projects', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
|
5f49082a
Yarik
test
|
595
|
}
|
6310a439
Administrator
firs page
|
596
|
|
e8236f44
Yarik
test
|
597
598
|
/**
* Page of creating User's project.
|
e8236f44
Yarik
test
|
599
600
|
* @return string|\yii\web\Response
*/
|
84ebac3d
Yarik
test
|
601
602
603
|
public function actionProjectsCreate()
{
$project = new Project();
|
d36bdac6
Administrator
17.02.16
|
604
|
|
1b56164e
Yarik
test
|
605
606
607
608
|
$specializations = Specialization::find()
->where([ 'specialization_pid' => 0 ])
->orderBy('specialization_id')
->all();
|
d36bdac6
Administrator
17.02.16
|
609
|
|
84ebac3d
Yarik
test
|
610
611
612
613
614
615
616
617
|
$payment = Payment::find()
->select([
'name',
'payment_id',
])
->indexBy('payment_id')
->asArray()
->column();
|
aa182b5c
Yarik
test
|
618
619
620
621
622
623
624
625
626
|
$projects = Project::find()
->select([
'name',
'project_id',
])
->where([ 'user_id' => \Yii::$app->user->getId() ])
->indexBy('project_id')
->asArray()
->column();
|
84ebac3d
Yarik
test
|
627
|
$post = \Yii::$app->request->post();
|
aa182b5c
Yarik
test
|
628
|
if(!empty( $post )) {
|
84ebac3d
Yarik
test
|
629
630
631
|
$project->load($post);
$project->validate();
if(!$project->hasErrors()) {
|
b95371cf
Yarik
test
|
632
633
634
635
636
637
638
639
640
641
642
643
|
$date_end = new \DateTime();
switch($post[ 'Project' ][ 'date_end' ]) {
case 2:
$date_end->modify('+14 day');
break;
case 3:
$date_end->modify('+30 day');
break;
default:
$date_end->modify('+7 day');
};
$project->date_end = \Yii::$app->formatter->asDate($date_end->getTimestamp(), 'short');
|
84ebac3d
Yarik
test
|
644
645
646
|
$project->save();
$project->unlinkAll('specializations', true);
foreach($project->specializationInput as $one_specialization) {
|
aa182b5c
Yarik
test
|
647
|
$project->link('specializations', Specialization::findOne($one_specialization));
|
84ebac3d
Yarik
test
|
648
649
650
|
}
$project->unlinkAll('payments', true);
foreach($project->paymentInput as $one_payment) {
|
aa182b5c
Yarik
test
|
651
|
$project->link('payments', Payment::findOne($one_payment));
|
84ebac3d
Yarik
test
|
652
|
}
|
ea09d15d
Yarik
test
|
653
|
return $this->redirect([
|
420d3dcd
Yarik
test
|
654
|
'projects',
|
ea09d15d
Yarik
test
|
655
|
]);
|
84ebac3d
Yarik
test
|
656
657
|
}
}
|
aa182b5c
Yarik
test
|
658
|
return $this->render('_projects_form', [
|
1b56164e
Yarik
test
|
659
|
'project' => $project,
|
d36bdac6
Administrator
17.02.16
|
660
|
'specializations' => $specializations,
|
1b56164e
Yarik
test
|
661
662
|
'payment' => $payment,
'projects' => $projects,
|
aa182b5c
Yarik
test
|
663
664
665
|
]);
}
|
e8236f44
Yarik
test
|
666
667
668
669
670
671
672
673
|
/**
* Page of updating User's project.
*
* @param integer $id ID of User's project
*
* @return string
* @throws NotFoundHttpException if record not found
*/
|
aa182b5c
Yarik
test
|
674
675
|
public function actionProjectsUpdate($id)
{
|
a02e2fdb
Yarik
test
|
676
677
678
679
680
681
682
|
$user = \Yii::$app->user->identity;
$project = $user->getProjects()
->where([ 'project_id' => $id ])
->one();
if(!$project instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
|
1b56164e
Yarik
test
|
683
684
685
686
|
$specializations = Specialization::find()
->where([ 'specialization_pid' => 0 ])
->orderBy('specialization_id')
->all();
|
aa182b5c
Yarik
test
|
687
688
689
690
691
692
693
694
|
$payment = Payment::find()
->select([
'name',
'payment_id',
])
->indexBy('payment_id')
->asArray()
->column();
|
a02e2fdb
Yarik
test
|
695
696
697
698
699
700
701
702
703
704
705
706
|
$projects = $user->getProjects()
->select([
'name',
'project_id',
])
->andWhere([
'not',
[ 'project_id' => $project->project_id ],
])
->indexBy('project_id')
->asArray()
->column();
|
aa182b5c
Yarik
test
|
707
708
709
710
711
|
$post = \Yii::$app->request->post();
if(!empty( $post )) {
$project->load($post);
$project->validate();
if(!$project->hasErrors()) {
|
b95371cf
Yarik
test
|
712
713
714
715
716
717
718
719
720
721
722
723
|
$date_end = new \DateTime();
switch($post[ 'Project' ][ 'date_end' ]) {
case 2:
$date_end->modify('+14 day');
break;
case 3:
$date_end->modify('+30 day');
break;
default:
$date_end->modify('+7 day');
};
$project->date_end = \Yii::$app->formatter->asDate($date_end->getTimestamp(), 'short');
|
aa182b5c
Yarik
test
|
724
725
726
727
728
729
730
731
732
|
$project->save();
$project->unlinkAll('specializations', true);
foreach($project->specializationInput as $one_specialization) {
$project->link('specializations', Specialization::findOne($one_specialization));
}
$project->unlinkAll('payments', true);
foreach($project->paymentInput as $one_payment) {
$project->link('payments', Payment::findOne($one_payment));
}
|
420d3dcd
Yarik
test
|
733
|
return $this->redirect(['projects']);
|
aa182b5c
Yarik
test
|
734
735
736
|
}
}
return $this->render('_projects_form', [
|
1b56164e
Yarik
test
|
737
|
'project' => $project,
|
d02fd466
Yarik
test
|
738
|
'specializations' => $specializations,
|
1b56164e
Yarik
test
|
739
740
|
'payment' => $payment,
'projects' => $projects,
|
aa182b5c
Yarik
test
|
741
|
]);
|
84ebac3d
Yarik
test
|
742
743
|
}
|
e8236f44
Yarik
test
|
744
745
746
747
748
749
750
751
|
/**
* Page of deleting User's project
*
* @param integer $id ID of User's project
*
* @throws NotFoundHttpException
* @throws \Exception
*/
|
989c83b0
Yarik
test
|
752
753
|
public function actionProjectsDelete($id)
{
|
a02e2fdb
Yarik
test
|
754
755
|
$user = \Yii::$app->user->identity;
$project = $user->getProjects()
|
1b56164e
Yarik
test
|
756
757
|
->where([ 'project_id' => $id ])
->one();
|
a02e2fdb
Yarik
test
|
758
759
760
761
|
if(!$project instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
$project->delete();
|
989c83b0
Yarik
test
|
762
763
764
|
$this->redirect('projects');
}
|
e8236f44
Yarik
test
|
765
766
767
768
769
770
771
772
773
774
775
776
|
/**
* Page of editting User's service info. Consist of:
* * cost of work;
* * service specializations;
* * work geography;
* * work guarantee;
* * work on contract;
* * providing estimates;
* * purchase of materials;
* * delivery of materials;
* * minimal prepayment;
* * payment types;
|
e8236f44
Yarik
test
|
777
778
|
* @return string
*/
|
588209fc
Yarik
test
|
779
|
public function actionService()
|
ea09d15d
Yarik
test
|
780
|
{
|
ea09d15d
Yarik
test
|
781
|
$user = \Yii::$app->user->identity;
|
a02e2fdb
Yarik
test
|
782
|
$user_info = $user->userInfo;
|
588209fc
Yarik
test
|
783
784
785
|
if(empty( $user_info )) {
$user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]);
}
|
1b56164e
Yarik
test
|
786
787
788
789
|
$specializations = Specialization::find()
->where([ 'specialization_pid' => 0 ])
->orderBy('specialization_id')
->all();
|
588209fc
Yarik
test
|
790
791
792
793
794
795
796
797
|
$payment = Payment::find()
->select([
'name',
'payment_id',
])
->indexBy('payment_id')
->asArray()
->column();
|
1b56164e
Yarik
test
|
798
|
$currencies = Currency::getCurrencyDropdown();
|
ea09d15d
Yarik
test
|
799
|
$post = \Yii::$app->request->post();
|
588209fc
Yarik
test
|
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
|
if(!empty( $post )) {
$user_info->load($post);
$user_info->validate();
if(!$user_info->hasErrors()) {
$user_info->save();
$user->load($post);
$user->unlinkAll('specializations', true);
foreach($user->specializationInput as $one_specialization) {
$user->link('specializations', Specialization::findOne($one_specialization));
}
$user->unlinkAll('payments', true);
foreach($user->paymentInput as $one_payment) {
$user->link('payments', Payment::findOne($one_payment));
}
}
|
ea09d15d
Yarik
test
|
815
|
}
|
588209fc
Yarik
test
|
816
|
return $this->render('service', [
|
1b56164e
Yarik
test
|
817
818
|
'user' => $user,
'user_info' => $user_info,
|
e8236f44
Yarik
test
|
819
|
'specializations' => $specializations,
|
1b56164e
Yarik
test
|
820
821
|
'payment' => $payment,
'currencies' => $currencies,
|
588209fc
Yarik
test
|
822
|
]);
|
ea09d15d
Yarik
test
|
823
824
|
}
|
588209fc
Yarik
test
|
825
|
/**
|
e8236f44
Yarik
test
|
826
827
|
* Page of account setting. Consist of:
* * changing password;
|
e8236f44
Yarik
test
|
828
|
* @return string
|
588209fc
Yarik
test
|
829
830
|
*/
public function actionSetting()
|
ea09d15d
Yarik
test
|
831
|
{
|
ea09d15d
Yarik
test
|
832
|
$user = \Yii::$app->user->identity;
|
588209fc
Yarik
test
|
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
|
$post = \Yii::$app->request->post('User');
if(!empty( $post )) {
if(empty( $post[ 'new_password' ] )) {
$user->addError('new_password', 'Введите новый пароль');
} else {
$user->new_password = $post[ 'new_password' ];
}
if(empty( $post[ 'old_password' ] )) {
$user->addError('old_password', 'Введите новый пароль');
} else {
$user->old_password = $post[ 'old_password' ];
}
if(empty( $post[ 'password_reply' ] ) || $post[ 'password_reply' ] !== $post[ 'new_password' ]) {
$user->addError('password_reply', 'Неправильный повтор пароля');
} else {
$user->password_reply = $post[ 'password_reply' ];
}
if(!$user->hasErrors()) {
if($user->validatePassword($user->old_password)) {
$user->setPassword($user->new_password);
$user->generateAuthKey();
if($user->save()) {
\Yii::$app->session->setFlash('passwordupdate', 'Пароль успешно обновлен');
}
} else {
$user->addError('old_password', 'Неправильный старый пароль');
}
}
|
ea09d15d
Yarik
test
|
861
|
}
|
588209fc
Yarik
test
|
862
|
return $this->render('setting', [ 'user' => $user ]);
|
ea09d15d
Yarik
test
|
863
864
|
}
|
e8236f44
Yarik
test
|
865
866
|
/**
* Page of company's team
|
e8236f44
Yarik
test
|
867
868
|
* @return string
*/
|
02524a34
Yarik
test
|
869
870
|
public function actionTeam()
{
|
b95371cf
Yarik
test
|
871
872
|
$searchModel = new TeamSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
e4a014b8
Yarik
test
|
873
874
875
876
877
878
879
880
|
$departments = Department::find()
->select([
'name',
'department_id',
])
->indexBy('department_id')
->asArray()
->column();
|
b95371cf
Yarik
test
|
881
882
883
884
|
return $this->render('team', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
|
e4a014b8
Yarik
test
|
885
|
'departments' => $departments,
|
b95371cf
Yarik
test
|
886
|
]);
|
02524a34
Yarik
test
|
887
888
|
}
|
e8236f44
Yarik
test
|
889
890
|
/**
* Page of creating company's team member
|
e8236f44
Yarik
test
|
891
892
|
* @return string|\yii\web\Response
*/
|
02524a34
Yarik
test
|
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
|
public function actionTeamCreate()
{
$team = new Team();
$department = Department::find()
->select([
'name',
'department_id',
])
->indexBy('department_id')
->asArray()
->column();
$country = Country::find()
->select([ 'country_name' ])
->indexBy('country_name')
->asArray()
->column();
$post = \Yii::$app->request->post();
if($team->load($post) && $team->save()) {
return $this->redirect([
|
e4a014b8
Yarik
test
|
912
|
'team',
|
02524a34
Yarik
test
|
913
914
915
916
917
918
919
920
921
922
|
]);
} else {
return $this->render('_team_form', [
'team' => $team,
'department' => $department,
'country' => $country,
]);
}
}
|
e8236f44
Yarik
test
|
923
924
925
926
927
928
929
930
|
/**
* Page of updating company's team member info.
*
* @param integer $id ID of company's team member
*
* @return string|\yii\web\Response
* @throws NotFoundHttpException
*/
|
02524a34
Yarik
test
|
931
932
|
public function actionTeamUpdate($id)
{
|
a02e2fdb
Yarik
test
|
933
934
935
936
937
938
939
|
$user = \Yii::$app->user->identity;
$team = $user->getTeams()
->where([ 'team_id' => $id ])
->one();
if(!$team instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
|
02524a34
Yarik
test
|
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
|
$department = Department::find()
->select([
'name',
'department_id',
])
->indexBy('department_id')
->asArray()
->column();
$country = Country::find()
->select([ 'country_name' ])
->indexBy('country_name')
->asArray()
->column();
$post = \Yii::$app->request->post();
if($team->load($post) && $team->save()) {
return $this->redirect([
|
e4a014b8
Yarik
test
|
956
|
'team',
|
02524a34
Yarik
test
|
957
958
959
960
961
962
963
964
965
966
|
]);
} else {
return $this->render('_team_form', [
'team' => $team,
'department' => $department,
'country' => $country,
]);
}
}
|
e8236f44
Yarik
test
|
967
968
969
970
971
972
973
974
|
/**
* Page of deleting company's team member.
*
* @param integer $id ID of company's team member
*
* @throws NotFoundHttpException
* @throws \Exception
*/
|
588209fc
Yarik
test
|
975
976
|
public function actionTeamDelete($id)
{
|
a02e2fdb
Yarik
test
|
977
978
979
980
981
982
983
984
985
|
$user = \Yii::$app->user->identity;
$team = $user->getTeams()
->where([ 'team_id' => $id ])
->one();
if(!$team instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
$team->delete();
|
588209fc
Yarik
test
|
986
987
988
|
$this->redirect('team');
}
|
e8236f44
Yarik
test
|
989
990
|
/**
* Page of company's vacancies
|
e8236f44
Yarik
test
|
991
992
|
* @return string
*/
|
ea09d15d
Yarik
test
|
993
994
|
public function actionVacancy()
{
|
588209fc
Yarik
test
|
995
996
997
998
999
1000
1001
|
$searchModel = new VacancySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('vacancy', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
|
ea09d15d
Yarik
test
|
1002
1003
|
}
|
e8236f44
Yarik
test
|
1004
1005
|
/**
* Page of creating company's vacancies.
|
e8236f44
Yarik
test
|
1006
1007
|
* @return string|\yii\web\Response
*/
|
ea09d15d
Yarik
test
|
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
|
public function actionVacancyCreate()
{
$vacancy = new Vacancy();
$employment = Employment::find()
->select([
'name',
'employment_id',
])
->indexBy('employment_id')
->asArray()
->column();
|
1b56164e
Yarik
test
|
1019
1020
1021
1022
1023
|
$specializations = Specialization::find()
->where([ 'specialization_pid' => 0 ])
->orderBy('specialization_id')
->all();
$currencies = Currency::getCurrencyDropdown();
|
ea09d15d
Yarik
test
|
1024
|
$post = \Yii::$app->request->post();
|
02524a34
Yarik
test
|
1025
|
if(!empty( $post )) {
|
ea09d15d
Yarik
test
|
1026
1027
|
$vacancy->load($post);
$vacancy->validate();
|
ea09d15d
Yarik
test
|
1028
1029
1030
1031
1032
1033
1034
|
if(!$vacancy->hasErrors()) {
$vacancy->save();
Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru');
$vacancy->unlinkAll('employments', true);
foreach($vacancy->employmentInput as $one_employment) {
$vacancy->link('employments', Employment::findOne($one_employment));
}
|
1b56164e
Yarik
test
|
1035
1036
1037
1038
|
$vacancy->unlinkAll('specializations', true);
foreach($vacancy->specializationInput as $one_specialization) {
$vacancy->link('specializations', Specialization::findOne($one_specialization));
}
|
02524a34
Yarik
test
|
1039
|
return $this->redirect([
|
ec94728d
Yarik
test
|
1040
|
'vacancy',
|
02524a34
Yarik
test
|
1041
|
]);
|
ea09d15d
Yarik
test
|
1042
1043
1044
|
}
}
return $this->render('_vacancy_form', [
|
1b56164e
Yarik
test
|
1045
1046
1047
1048
|
'vacancy' => $vacancy,
'employment' => $employment,
'currencies' => $currencies,
'specializations' => $specializations,
|
ea09d15d
Yarik
test
|
1049
1050
1051
|
]);
}
|
e8236f44
Yarik
test
|
1052
1053
1054
1055
1056
1057
1058
1059
|
/**
* Page of updating company's vacancy.
*
* @param integer $id ID of company's vacancy.
*
* @return string|\yii\web\Response
* @throws NotFoundHttpException
*/
|
ea09d15d
Yarik
test
|
1060
1061
|
public function actionVacancyUpdate($id)
{
|
a02e2fdb
Yarik
test
|
1062
1063
|
$user = \Yii::$app->user->identity;
$vacancy = $user->getVacancies()
|
1b56164e
Yarik
test
|
1064
1065
|
->where([ 'vacancy_id' => $id ])
->one();
|
a02e2fdb
Yarik
test
|
1066
1067
1068
|
if(!$vacancy instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
|
ea09d15d
Yarik
test
|
1069
1070
1071
1072
1073
1074
1075
1076
|
$employment = Employment::find()
->select([
'name',
'employment_id',
])
->indexBy('employment_id')
->asArray()
->column();
|
1b56164e
Yarik
test
|
1077
1078
1079
1080
1081
|
$specializations = Specialization::find()
->where([ 'specialization_pid' => 0 ])
->orderBy('specialization_id')
->all();
$currencies = Currency::getCurrencyDropdown();
|
ea09d15d
Yarik
test
|
1082
|
$post = \Yii::$app->request->post();
|
02524a34
Yarik
test
|
1083
|
if(!empty( $post )) {
|
9fd076e8
Administrator
01.03.16
|
1084
|
|
ea09d15d
Yarik
test
|
1085
1086
|
$vacancy->load($post);
$vacancy->validate();
|
ea09d15d
Yarik
test
|
1087
|
if(!$vacancy->hasErrors()) {
|
9fd076e8
Administrator
01.03.16
|
1088
|
|
ea09d15d
Yarik
test
|
1089
1090
1091
1092
1093
1094
|
$vacancy->save();
Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru');
$vacancy->unlinkAll('employments', true);
foreach($vacancy->employmentInput as $one_employment) {
$vacancy->link('employments', Employment::findOne($one_employment));
}
|
1b56164e
Yarik
test
|
1095
1096
1097
1098
|
$vacancy->unlinkAll('specializations', true);
foreach($vacancy->specializationInput as $one_specialization) {
$vacancy->link('specializations', Specialization::findOne($one_specialization));
}
|
02524a34
Yarik
test
|
1099
|
return $this->redirect([
|
ec94728d
Yarik
test
|
1100
|
'vacancy',
|
02524a34
Yarik
test
|
1101
|
]);
|
ea09d15d
Yarik
test
|
1102
1103
1104
|
}
}
return $this->render('_vacancy_form', [
|
1b56164e
Yarik
test
|
1105
1106
1107
1108
|
'vacancy' => $vacancy,
'employment' => $employment,
'currencies' => $currencies,
'specializations' => $specializations,
|
ea09d15d
Yarik
test
|
1109
1110
1111
|
]);
}
|
e8236f44
Yarik
test
|
1112
1113
1114
1115
1116
1117
1118
1119
|
/**
* Page of deleting company's vacancy.
*
* @param integer $id ID of company's vacancy
*
* @throws NotFoundHttpException
* @throws \Exception
*/
|
588209fc
Yarik
test
|
1120
|
public function actionVacancyDelete($id)
|
5f49082a
Yarik
test
|
1121
|
{
|
a02e2fdb
Yarik
test
|
1122
1123
|
$user = \Yii::$app->user->identity;
$vacancy = $user->getVacancies()
|
1b56164e
Yarik
test
|
1124
1125
|
->where([ 'vacancy_id' => $id ])
->one();
|
a02e2fdb
Yarik
test
|
1126
1127
1128
1129
1130
|
if(!$vacancy instanceof ActiveRecord) {
throw new NotFoundHttpException('Запись не найдена');
}
$vacancy->delete();
|
588209fc
Yarik
test
|
1131
|
$this->redirect('vacancy');
|
6310a439
Administrator
firs page
|
1132
|
}
|
6310a439
Administrator
firs page
|
1133
|
|
5f49082a
Yarik
test
|
1134
|
/**
|
e8236f44
Yarik
test
|
1135
|
* Used to find model of User and throws exception if not found.
|
5f49082a
Yarik
test
|
1136
|
*
|
e8236f44
Yarik
test
|
1137
1138
1139
1140
|
* @param integer $id ID of User
*
* @return User if User with particular ID found
* @throws NotFoundHttpException if User with particular ID not found
|
5f49082a
Yarik
test
|
1141
1142
1143
|
*/
protected function findUser($id)
{
|
6310a439
Administrator
firs page
|
1144
|
|
5f49082a
Yarik
test
|
1145
1146
1147
1148
1149
1150
|
if($model = User::findOne([ "id" => $id ])) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
|
6310a439
Administrator
firs page
|
1151
|
|
5f49082a
Yarik
test
|
1152
|
}
|