fbdb1f1c
Yarik
test
|
1
|
<?php
|
35b03e57
Administrator
add yii jquery
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
namespace frontend\controllers;
use common\models\CustomerSearch;
use common\models\Project;
use common\models\Specialization;
use common\models\UserInfo;
use common\models\Vacancy;
use frontend\models\SearchPerformerForm;
use Yii;
use common\models\LoginForm;
use frontend\models\PasswordResetRequestForm;
use frontend\models\ResetPasswordForm;
use frontend\models\SignupForm;
use frontend\models\ContactForm;
use frontend\models\Options;
use frontend\models\OptionValues;
use yii\base\InvalidParamException;
use yii\data\ActiveDataProvider;
use yii\data\Pagination;
use yii\helpers\ArrayHelper;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use frontend\models\OptionsToValues;
use yii\validators\EmailValidator;
use common\models\User;
use yii\helpers\VarDumper;
use common\models\Page;
use frontend\models\Option;
use common\models\Social;
|
fbdb1f1c
Yarik
test
|
33
34
|
/**
|
2fd40ee7
Yarik
test
|
35
|
* Site controller
|
fbdb1f1c
Yarik
test
|
36
|
*/
|
2fd40ee7
Yarik
test
|
37
|
class SearchController extends Controller
|
fbdb1f1c
Yarik
test
|
38
|
{
|
6dd6c4bf
Administrator
17.02.16
|
39
|
|
2fd40ee7
Yarik
test
|
40
|
public $defaultAction = 'common';
|
fbdb1f1c
Yarik
test
|
41
|
|
2fd40ee7
Yarik
test
|
42
43
44
45
46
47
48
49
|
/**
* @inheritdoc
*/
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
|
f94a00a6
Yarik
test
|
50
|
],
|
2fd40ee7
Yarik
test
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : NULL,
],
];
}
public function actionProject()
{
$projects = new ActiveDataProvider([
'query' => Project::find(),
'pagination' => [
'pageSize' => 9,
],
]);
return $this->render('project', [
'projects' => $projects,
]);
}
public function actionCustomer()
{
$model = new CustomerSearch();
$dataProvider = $model->search(Yii::$app->request->queryParams);
$dataProvider->setPagination([
'pageSize' => 5,
]);
|
2fd40ee7
Yarik
test
|
78
|
$model->load(Yii::$app->request->queryParams);
|
2fd40ee7
Yarik
test
|
79
80
81
|
return $this->render('customer', [
'model' => $model,
'dataProvider' => $dataProvider,
|
2fd40ee7
Yarik
test
|
82
83
84
|
]);
}
|
2fd40ee7
Yarik
test
|
85
|
|
2fd40ee7
Yarik
test
|
86
|
|
35b03e57
Administrator
add yii jquery
|
87
88
|
public function actionPerformer()
{
|
eb7e82fb
Administrator
29.02.16
|
89
|
|
35b03e57
Administrator
add yii jquery
|
90
91
92
93
94
95
96
97
98
99
100
101
102
|
$specializationArray = [];
$specialization = Specialization::find()->where(['specialization_id'=> Specialization::find()->select('specialization_id')
->andWhere('specialization_pid != 0')
->column()])
->all();
foreach(ArrayHelper::index($specialization,'specialization_id') as $spec){
$array = $spec->hasChildrenInArray($specialization);
if($array){
$specializationArray[$spec->specialization_name] = $array;
}
|
2fd40ee7
Yarik
test
|
103
|
}
|
eb7e82fb
Administrator
29.02.16
|
104
|
|
35b03e57
Administrator
add yii jquery
|
105
106
107
108
109
110
111
112
113
114
115
|
$searchModel = new SearchPerformerForm();
return $this->render('performer',[
'dataProvider' => $searchModel->search(Yii::$app->request->queryParams),
'specialization' => $specializationArray,
'model'=> $searchModel
]);
}
|
2fd40ee7
Yarik
test
|
116
117
|
public function actionVacancy()
{
|
eb7e82fb
Administrator
29.02.16
|
118
|
|
2fd40ee7
Yarik
test
|
119
|
$query = Vacancy::find();
|
eb7e82fb
Administrator
29.02.16
|
120
|
|
35b03e57
Administrator
add yii jquery
|
121
|
$countQuery = clone $query;
|
eb7e82fb
Administrator
29.02.16
|
122
|
|
2fd40ee7
Yarik
test
|
123
124
125
126
|
$pagination = new Pagination([
'totalCount' => $countQuery->count(),
'pageSize' => 15,
]);
|
eb7e82fb
Administrator
29.02.16
|
127
|
|
2fd40ee7
Yarik
test
|
128
129
|
$vacancy = $query->offset($pagination->offset)
->limit($pagination->limit);
|
eb7e82fb
Administrator
29.02.16
|
130
|
|
2fd40ee7
Yarik
test
|
131
132
133
134
135
136
137
138
139
140
|
$provider = new ActiveDataProvider([
'query' => $vacancy,
'pagination' => false,
'sort' => [
'defaultOrder' => [
'date_add' => SORT_DESC,
'name' => SORT_ASC,
],
],
]);
|
eb7e82fb
Administrator
29.02.16
|
141
|
|
2fd40ee7
Yarik
test
|
142
143
144
145
146
|
return $this->render('vacancy', [
'provider' => $provider,
'pagination' => $pagination,
]);
}
|
eb7e82fb
Administrator
29.02.16
|
147
|
|
7fc05ac5
Yarik
test
|
148
|
}
|