Commit 71f66dcaae4b85793bd3ebbc5d0b53b16ecbf092
1 parent
29b842c0
add Vitaliy's widgets
Showing
32 changed files
with
1209 additions
and
15 deletions
Show diff stats
1 | +# yii console command | |
2 | +/yii | |
3 | + | |
4 | +# phpstorm project files | |
5 | +.idea | |
6 | + | |
7 | +# netbeans project files | |
8 | +nbproject | |
9 | + | |
10 | +# zend studio for eclipse project files | |
11 | +.buildpath | |
12 | +.project | |
13 | +.settings | |
14 | + | |
15 | +# windows thumbnail cache | |
16 | +Thumbs.db | |
17 | + | |
18 | +# composer vendor dir | |
19 | +/vendor | |
20 | + | |
21 | +# composer itself is not needed | |
22 | +composer.phar | |
23 | + | |
24 | +# Mac DS_Store Files | |
25 | +.DS_Store | |
26 | + | |
27 | +# phpunit itself is not needed | |
28 | +phpunit.phar | |
29 | +# local phpunit config | |
30 | +/phpunit.xml | ... | ... |
.htaccess
1 | +AddDefaultCharset utf-8 | |
1 | 2 | <IfModule mod_rewrite.c> |
2 | 3 | |
4 | + | |
3 | 5 | Options +FollowSymlinks |
4 | 6 | |
5 | 7 | RewriteEngine On |
... | ... | @@ -10,6 +12,9 @@ |
10 | 12 | |
11 | 13 | RewriteBase / |
12 | 14 | # deal with admin first |
15 | + | |
16 | + | |
17 | + | |
13 | 18 | RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] |
14 | 19 | |
15 | 20 | RewriteCond %{REQUEST_URI} ^/(admin) |
... | ... | @@ -59,7 +64,7 @@ |
59 | 64 | |
60 | 65 | RewriteCond %{REQUEST_FILENAME} !-d |
61 | 66 | |
62 | - RewriteRule ^.*$ frontend/web/index.php | |
67 | + RewriteRule ^.*$ frontend/web/index.php [L] | |
63 | 68 | |
64 | 69 | </IfModule> |
65 | 70 | |
... | ... | @@ -67,5 +72,4 @@ |
67 | 72 | <IfModule mod_php5.c> |
68 | 73 | php_value upload_max_filesize 20M |
69 | 74 | php_value post_max_size 30M |
70 | - php_value error_reporting 22527 | |
71 | 75 | </IfModule> |
72 | 76 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace backend\controllers; | |
4 | + | |
5 | +use Yii; | |
6 | +use common\models\Specialization; | |
7 | +use common\models\SpecializationSearch; | |
8 | +use yii\web\Controller; | |
9 | +use yii\web\NotFoundHttpException; | |
10 | +use yii\filters\VerbFilter; | |
11 | + | |
12 | +/** | |
13 | + * SpecializationController implements the CRUD actions for Specialization model. | |
14 | + */ | |
15 | +class SpecializationController 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 Specialization models. | |
34 | + * @return mixed | |
35 | + */ | |
36 | + public function actionIndex() | |
37 | + { | |
38 | + $searchModel = new SpecializationSearch(); | |
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 Specialization 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 Specialization 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 Specialization(); | |
67 | + | |
68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
69 | + return $this->redirect(['view', 'id' => $model->specialization_id]); | |
70 | + } else { | |
71 | + return $this->render('create', [ | |
72 | + 'model' => $model, | |
73 | + ]); | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + /** | |
78 | + * Updates an existing Specialization 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->specialization_id]); | |
89 | + } else { | |
90 | + return $this->render('update', [ | |
91 | + 'model' => $model, | |
92 | + ]); | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * Deletes an existing Specialization 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 Specialization 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 Specialization the loaded model | |
114 | + * @throws NotFoundHttpException if the model cannot be found | |
115 | + */ | |
116 | + protected function findModel($id) | |
117 | + { | |
118 | + if (($model = Specialization::findOne($id)) !== null) { | |
119 | + return $model; | |
120 | + } else { | |
121 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
122 | + } | |
123 | + } | |
124 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace backend\controllers; | |
4 | + | |
5 | +use Yii; | |
6 | +use common\models\UserInfo; | |
7 | +use frontend\models\UserSearch; | |
8 | +use yii\web\Controller; | |
9 | +use yii\web\NotFoundHttpException; | |
10 | +use yii\filters\VerbFilter; | |
11 | + | |
12 | +/** | |
13 | + * UserInfoTestController implements the CRUD actions for UserInfo model. | |
14 | + */ | |
15 | +class UserInfoTestController 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 UserInfo models. | |
34 | + * @return mixed | |
35 | + */ | |
36 | + public function actionIndex() | |
37 | + { | |
38 | + $searchModel = new UserSearch(); | |
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 UserInfo 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 UserInfo 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 UserInfo(); | |
67 | + | |
68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
69 | + return $this->redirect(['view', 'id' => $model->user_info_id]); | |
70 | + } else { | |
71 | + return $this->render('create', [ | |
72 | + 'model' => $model, | |
73 | + ]); | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + /** | |
78 | + * Updates an existing UserInfo 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->user_info_id]); | |
89 | + } else { | |
90 | + return $this->render('update', [ | |
91 | + 'model' => $model, | |
92 | + ]); | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * Deletes an existing UserInfo 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 UserInfo 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 UserInfo the loaded model | |
114 | + * @throws NotFoundHttpException if the model cannot be found | |
115 | + */ | |
116 | + protected function findModel($id) | |
117 | + { | |
118 | + if (($model = UserInfo::findOne($id)) !== null) { | |
119 | + return $model; | |
120 | + } else { | |
121 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
122 | + } | |
123 | + } | |
124 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace backend\controllers; | |
4 | + | |
5 | +use Yii; | |
6 | +use common\models\User; | |
7 | +use frontend\models\UserSearch; | |
8 | +use yii\web\Controller; | |
9 | +use yii\web\NotFoundHttpException; | |
10 | +use yii\filters\VerbFilter; | |
11 | + | |
12 | +/** | |
13 | + * UserTestController implements the CRUD actions for User model. | |
14 | + */ | |
15 | +class UserTestController 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 User models. | |
34 | + * @return mixed | |
35 | + */ | |
36 | + public function actionIndex() | |
37 | + { | |
38 | + $searchModel = new UserSearch(); | |
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 User 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 User 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 User(); | |
67 | + | |
68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
69 | + return $this->redirect(['view', 'id' => $model->id]); | |
70 | + } else { | |
71 | + return $this->render('create', [ | |
72 | + 'model' => $model, | |
73 | + ]); | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + /** | |
78 | + * Updates an existing User 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->id]); | |
89 | + } else { | |
90 | + return $this->render('update', [ | |
91 | + 'model' => $model, | |
92 | + ]); | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * Deletes an existing User 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 User 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 User the loaded model | |
114 | + * @throws NotFoundHttpException if the model cannot be found | |
115 | + */ | |
116 | + protected function findModel($id) | |
117 | + { | |
118 | + if (($model = User::findOne($id)) !== null) { | |
119 | + return $model; | |
120 | + } else { | |
121 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
122 | + } | |
123 | + } | |
124 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | +use yii\helpers\ArrayHelper; | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\Specialization */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="specialization-form"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin(); ?> | |
14 | + | |
15 | + <?= $form->field($model, 'specialization_pid')->dropDownList(ArrayHelper::map($model->find()->all(), 'specialization_id', 'specialization_name'), ['prompt' => 'Выберие родителя']) ?> | |
16 | + <?= $form->field($model, 'specialization_name')->textInput(['maxlength' => true]) ?> | |
17 | + | |
18 | + <div class="form-group"> | |
19 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
20 | + </div> | |
21 | + | |
22 | + <?php ActiveForm::end(); ?> | |
23 | + | |
24 | +</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\SpecializationSearch */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="specialization-search"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin([ | |
14 | + 'action' => ['index'], | |
15 | + 'method' => 'get', | |
16 | + ]); ?> | |
17 | + | |
18 | + <?= $form->field($model, 'specialization_id') ?> | |
19 | + | |
20 | + <?= $form->field($model, 'specialization_pid') ?> | |
21 | + | |
22 | + <?= $form->field($model, 'specialization_name') ?> | |
23 | + | |
24 | + <div class="form-group"> | |
25 | + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | |
26 | + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | |
27 | + </div> | |
28 | + | |
29 | + <?php ActiveForm::end(); ?> | |
30 | + | |
31 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\Specialization */ | |
8 | + | |
9 | +$this->title = 'Create Specialization'; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Specializations', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="specialization-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\SpecializationSearch */ | |
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | + | |
10 | +$this->title = 'Specializations'; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="specialization-index"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | + | |
18 | + <p> | |
19 | + <?= Html::a('Create Specialization', ['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 | + 'specialization_id', | |
28 | + [ | |
29 | + 'attribute' => 'specialization_parent_name', | |
30 | + 'value' => 'parent.specialization_name' | |
31 | + ], | |
32 | + 'specialization_name', | |
33 | + | |
34 | + ['class' => 'yii\grid\ActionColumn'], | |
35 | + ], | |
36 | + ]); ?> | |
37 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | +/* @var $this yii\web\View */ | |
6 | +/* @var $model common\models\Specialization */ | |
7 | + | |
8 | +$this->title = 'Update Specialization: ' . ' ' . $model->specialization_id; | |
9 | +$this->params['breadcrumbs'][] = ['label' => 'Specializations', 'url' => ['index']]; | |
10 | +$this->params['breadcrumbs'][] = ['label' => $model->specialization_id, 'url' => ['view', 'id' => $model->specialization_id]]; | |
11 | +$this->params['breadcrumbs'][] = 'Update'; | |
12 | +?> | |
13 | +<div class="specialization-update"> | |
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\widgets\DetailView; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\Specialization */ | |
8 | + | |
9 | +$this->title = $model->specialization_id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Specializations', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="specialization-view"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p> | |
18 | + <?= Html::a('Update', ['update', 'id' => $model->specialization_id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a('Delete', ['delete', 'id' => $model->specialization_id], [ | |
20 | + 'class' => 'btn btn-danger', | |
21 | + 'data' => [ | |
22 | + 'confirm' => '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 | + 'specialization_id', | |
32 | + 'specialization_pid', | |
33 | + 'specialization_name', | |
34 | + ], | |
35 | + ]) ?> | |
36 | + | |
37 | +</div> | ... | ... |
common/config/main.php
... | ... | @@ -49,8 +49,8 @@ return [ |
49 | 49 | ] |
50 | 50 | ], |
51 | 51 | ], |
52 | - 'authManager' => [ | |
53 | - 'class' => 'yii\rbac\DbManager', | |
52 | + 'authManager' => [ | |
53 | + 'class' => 'yii\rbac\DbManager', | |
54 | 54 | ], |
55 | 55 | |
56 | 56 | //подключаем конфигурации API соц сетей для авторизации |
... | ... | @@ -151,7 +151,7 @@ return [ |
151 | 151 | 'clientSecret' => '...', |
152 | 152 | 'clientPublic' => '...', |
153 | 153 | 'title' => 'Odnoklas.', |
154 | - ], | |
154 | + ], | |
155 | 155 | ], |
156 | 156 | ], |
157 | 157 | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "specialization". | |
9 | + * | |
10 | + * @property integer $specialization_id | |
11 | + * @property integer $specialization_pid | |
12 | + * @property string $specialization_name | |
13 | + */ | |
14 | +class Specialization extends \yii\db\ActiveRecord | |
15 | +{ | |
16 | + /** | |
17 | + * @inheritdoc | |
18 | + */ | |
19 | + public static function tableName() | |
20 | + { | |
21 | + return 'specialization'; | |
22 | + } | |
23 | + | |
24 | + /** | |
25 | + * @inheritdoc | |
26 | + */ | |
27 | + public function rules() | |
28 | + { | |
29 | + return [ | |
30 | + [['specialization_pid'], 'integer'], | |
31 | + [['specialization_pid'], 'default', 'value' => '0',], | |
32 | + [['specialization_name'], 'required'], | |
33 | + [['specialization_name'], 'string', 'max' => 255], | |
34 | + ]; | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * @inheritdoc | |
39 | + */ | |
40 | + public function attributeLabels() | |
41 | + { | |
42 | + return [ | |
43 | + 'specialization_id' => 'Specialization ID', | |
44 | + 'specialization_pid' => 'Specialization Pid', | |
45 | + 'specialization_name' => 'Specialization Name', | |
46 | + 'specialization_parent_name' => 'Specialization Parent Name', | |
47 | + ]; | |
48 | + } | |
49 | + | |
50 | + | |
51 | + public function getParent() | |
52 | + { | |
53 | + return $this->hasOne(self::className(), ['specialization_id' => 'specialization_pid']); | |
54 | + } | |
55 | + | |
56 | +} | ... | ... |
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\Specialization; | |
9 | + | |
10 | +/** | |
11 | + * SpecializationSearch represents the model behind the search form about `\common\models\Specialization`. | |
12 | + */ | |
13 | +class SpecializationSearch extends Specialization | |
14 | +{ | |
15 | + | |
16 | + public $specialization_parent_name; | |
17 | + /** | |
18 | + * @inheritdoc | |
19 | + */ | |
20 | + public function rules() | |
21 | + { | |
22 | + return [ | |
23 | + [['specialization_id'], 'integer'], | |
24 | + [['specialization_pid','specialization_parent_name'], 'string'], | |
25 | + [['specialization_name'], 'safe'], | |
26 | + ]; | |
27 | + } | |
28 | + | |
29 | + /** | |
30 | + * @inheritdoc | |
31 | + */ | |
32 | + public function scenarios() | |
33 | + { | |
34 | + // bypass scenarios() implementation in the parent class | |
35 | + return Model::scenarios(); | |
36 | + } | |
37 | + | |
38 | + /** | |
39 | + * Creates data provider instance with search query applied | |
40 | + * | |
41 | + * @param array $params | |
42 | + * | |
43 | + * @return ActiveDataProvider | |
44 | + */ | |
45 | + public function search($params) | |
46 | + { | |
47 | + $query = Specialization::find(); | |
48 | + | |
49 | + // add conditions that should always apply here | |
50 | + | |
51 | + $dataProvider = new ActiveDataProvider([ | |
52 | + 'query' => $query, | |
53 | + ]); | |
54 | + | |
55 | + $this->load($params); | |
56 | + | |
57 | + if (!$this->validate()) { | |
58 | + // uncomment the following line if you do not want to return any records when validation fails | |
59 | + // $query->where('0=1'); | |
60 | + return $dataProvider; | |
61 | + } | |
62 | + | |
63 | + | |
64 | + | |
65 | + // grid filtering conditions | |
66 | + $query->andFilterWhere([ | |
67 | + 'specialization_id' => $this->specialization_id, | |
68 | + 'specialization_pid' => !empty($this->specialization_parent_name) ? array_keys(Specialization::find()->select('specialization_id')->FilterWhere(['like', 'specialization_name',$this->specialization_parent_name])->asArray()->indexBy('specialization_id')->all()) : $this->specialization_parent_name | |
69 | + ]); | |
70 | + | |
71 | + $query->andFilterWhere(['like', 'specialization_name', $this->specialization_name]); | |
72 | + | |
73 | + return $dataProvider; | |
74 | + } | |
75 | +} | ... | ... |
console/migrations/m160202_084703_specialization.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160202_084703_specialization extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $tableOptions = null; | |
10 | + | |
11 | + $this->createTable('{{%specialization}}', [ | |
12 | + 'specialization_id' => $this->primaryKey(), | |
13 | + 'specialization_pid' => $this->integer(), | |
14 | + 'specialization_name' => $this->string(255)->notNull() | |
15 | + ], $tableOptions); | |
16 | + | |
17 | + } | |
18 | + | |
19 | + public function down() | |
20 | + { | |
21 | + $this->dropTable('{{%specialization}}'); | |
22 | + } | |
23 | +} | ... | ... |
frontend/config/main.php
... | ... | @@ -18,7 +18,7 @@ return [ |
18 | 18 | 'modules' => [ |
19 | 19 | |
20 | 20 | ], |
21 | - 'components' => [ | |
21 | + 'components' => [ | |
22 | 22 | //'PageController'=>[ |
23 | 23 | // 'class' => 'frontend\controllers\PageController' |
24 | 24 | //], |
... | ... | @@ -44,7 +44,7 @@ return [ |
44 | 44 | 'urlManager' => [ |
45 | 45 | 'baseUrl' => '/', |
46 | 46 | 'enablePrettyUrl' => true, |
47 | - 'showScriptName' => false, | |
47 | + 'showScriptName' => false, | |
48 | 48 | 'rules' => [ |
49 | 49 | 'landing/<view:[\w-]+>' => 'landing/view', |
50 | 50 | ] | ... | ... |
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\User */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="user-form"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin(); ?> | |
14 | + | |
15 | + <?= $form->field($model, 'status')->textInput() ?> | |
16 | + | |
17 | + <div class="form-group"> | |
18 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
19 | + </div> | |
20 | + | |
21 | + <?php ActiveForm::end(); ?> | |
22 | + | |
23 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model frontend\models\UserSearch */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="user-search"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin([ | |
14 | + 'action' => ['index'], | |
15 | + 'method' => 'get', | |
16 | + ]); ?> | |
17 | + | |
18 | + <?= $form->field($model, 'id') ?> | |
19 | + | |
20 | + <?= $form->field($model, 'username') ?> | |
21 | + | |
22 | + <?= $form->field($model, 'lastname') ?> | |
23 | + | |
24 | + <?= $form->field($model, 'firstname') ?> | |
25 | + | |
26 | + <?= $form->field($model, 'middlename') ?> | |
27 | + | |
28 | + <?php // echo $form->field($model, 'auth_key') ?> | |
29 | + | |
30 | + <?php // echo $form->field($model, 'password_hash') ?> | |
31 | + | |
32 | + <?php // echo $form->field($model, 'password_reset_token') ?> | |
33 | + | |
34 | + <?php // echo $form->field($model, 'email') ?> | |
35 | + | |
36 | + <?php // echo $form->field($model, 'status') ?> | |
37 | + | |
38 | + <?php // echo $form->field($model, 'created_at') ?> | |
39 | + | |
40 | + <?php // echo $form->field($model, 'updated_at') ?> | |
41 | + | |
42 | + <div class="form-group"> | |
43 | + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | |
44 | + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | |
45 | + </div> | |
46 | + | |
47 | + <?php ActiveForm::end(); ?> | |
48 | + | |
49 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\User */ | |
8 | + | |
9 | +$this->title = 'Create User'; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-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 frontend\models\UserSearch */ | |
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | + | |
10 | +$this->title = 'Users'; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-index"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | + | |
18 | + <p> | |
19 | + <?= Html::a('Create User', ['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 | + 'id', | |
28 | + 'username', | |
29 | + 'lastname', | |
30 | + 'firstname', | |
31 | + 'middlename', | |
32 | + // 'auth_key', | |
33 | + // 'password_hash', | |
34 | + // 'password_reset_token', | |
35 | + // 'email:email', | |
36 | + // 'status', | |
37 | + // 'created_at', | |
38 | + // 'updated_at', | |
39 | + | |
40 | + ['class' => 'yii\grid\ActionColumn'], | |
41 | + ], | |
42 | + ]); ?> | |
43 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | +/* @var $this yii\web\View */ | |
6 | +/* @var $model common\models\User */ | |
7 | + | |
8 | +$this->title = 'Update User: ' . ' ' . $model->id; | |
9 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | |
10 | +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; | |
11 | +$this->params['breadcrumbs'][] = 'Update'; | |
12 | +?> | |
13 | +<div class="user-update"> | |
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\widgets\DetailView; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\User */ | |
8 | + | |
9 | +$this->title = $model->id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-view"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p> | |
18 | + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
20 | + 'class' => 'btn btn-danger', | |
21 | + 'data' => [ | |
22 | + 'confirm' => '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 | + 'id', | |
32 | + 'username', | |
33 | + 'lastname', | |
34 | + 'firstname', | |
35 | + 'middlename', | |
36 | + 'auth_key', | |
37 | + 'password_hash', | |
38 | + 'password_reset_token', | |
39 | + 'email:email', | |
40 | + 'status', | |
41 | + 'created_at', | |
42 | + 'updated_at', | |
43 | + ], | |
44 | + ]) ?> | |
45 | + | |
46 | +</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\UserInfo */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="user-info-form"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin(); ?> | |
14 | + | |
15 | + <?= $form->field($model, 'user_id')->textInput() ?> | |
16 | + | |
17 | + <?= $form->field($model, 'view_count')->textInput() ?> | |
18 | + | |
19 | + <?= $form->field($model, 'busy')->textInput(['maxlength' => true]) ?> | |
20 | + | |
21 | + <?= $form->field($model, 'date_visit')->textInput() ?> | |
22 | + | |
23 | + <?= $form->field($model, 'experience')->textInput() ?> | |
24 | + | |
25 | + <?= $form->field($model, 'rank')->textInput(['maxlength' => true]) ?> | |
26 | + | |
27 | + <?= $form->field($model, 'salary')->textInput(['maxlength' => true]) ?> | |
28 | + | |
29 | + <?= $form->field($model, 'job')->textInput(['maxlength' => true]) ?> | |
30 | + | |
31 | + <?= $form->field($model, 'location')->textInput(['maxlength' => true]) ?> | |
32 | + | |
33 | + <?= $form->field($model, 'soft')->textInput() ?> | |
34 | + | |
35 | + <?= $form->field($model, 'guarantee')->textInput() ?> | |
36 | + | |
37 | + <?= $form->field($model, 'contract')->textInput() ?> | |
38 | + | |
39 | + <?= $form->field($model, 'estimate')->textInput() ?> | |
40 | + | |
41 | + <?= $form->field($model, 'purchase')->textInput() ?> | |
42 | + | |
43 | + <?= $form->field($model, 'delivery')->textInput() ?> | |
44 | + | |
45 | + <?= $form->field($model, 'prepayment')->textInput() ?> | |
46 | + | |
47 | + <?= $form->field($model, 'about')->textarea(['rows' => 6]) ?> | |
48 | + | |
49 | + <div class="form-group"> | |
50 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
51 | + </div> | |
52 | + | |
53 | + <?php ActiveForm::end(); ?> | |
54 | + | |
55 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model frontend\models\UserSearch */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="user-info-search"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin([ | |
14 | + 'action' => ['index'], | |
15 | + 'method' => 'get', | |
16 | + ]); ?> | |
17 | + | |
18 | + <?= $form->field($model, 'user_id') ?> | |
19 | + | |
20 | + <?= $form->field($model, 'view_count') ?> | |
21 | + | |
22 | + <?= $form->field($model, 'busy') ?> | |
23 | + | |
24 | + <?= $form->field($model, 'date_visit') ?> | |
25 | + | |
26 | + <?= $form->field($model, 'experience') ?> | |
27 | + | |
28 | + <?php // echo $form->field($model, 'rank') ?> | |
29 | + | |
30 | + <?php // echo $form->field($model, 'salary') ?> | |
31 | + | |
32 | + <?php // echo $form->field($model, 'job') ?> | |
33 | + | |
34 | + <?php // echo $form->field($model, 'location') ?> | |
35 | + | |
36 | + <?php // echo $form->field($model, 'soft') ?> | |
37 | + | |
38 | + <?php // echo $form->field($model, 'user_info_id') ?> | |
39 | + | |
40 | + <?php // echo $form->field($model, 'guarantee') ?> | |
41 | + | |
42 | + <?php // echo $form->field($model, 'contract') ?> | |
43 | + | |
44 | + <?php // echo $form->field($model, 'estimate') ?> | |
45 | + | |
46 | + <?php // echo $form->field($model, 'purchase') ?> | |
47 | + | |
48 | + <?php // echo $form->field($model, 'delivery') ?> | |
49 | + | |
50 | + <?php // echo $form->field($model, 'prepayment') ?> | |
51 | + | |
52 | + <?php // echo $form->field($model, 'about') ?> | |
53 | + | |
54 | + <div class="form-group"> | |
55 | + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | |
56 | + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | |
57 | + </div> | |
58 | + | |
59 | + <?php ActiveForm::end(); ?> | |
60 | + | |
61 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\UserInfo */ | |
8 | + | |
9 | +$this->title = 'Create User Info'; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'User Infos', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-info-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 frontend\models\UserSearch */ | |
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
9 | + | |
10 | +$this->title = 'User Infos'; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-info-index"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
17 | + | |
18 | + <p> | |
19 | + <?= Html::a('Create User Info', ['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 | + 'user_id', | |
28 | + 'view_count', | |
29 | + 'busy', | |
30 | + 'date_visit', | |
31 | + 'experience', | |
32 | + // 'rank', | |
33 | + // 'salary', | |
34 | + // 'job', | |
35 | + // 'location', | |
36 | + // 'soft', | |
37 | + // 'user_info_id', | |
38 | + // 'guarantee', | |
39 | + // 'contract', | |
40 | + // 'estimate', | |
41 | + // 'purchase', | |
42 | + // 'delivery', | |
43 | + // 'prepayment', | |
44 | + // 'about:ntext', | |
45 | + | |
46 | + ['class' => 'yii\grid\ActionColumn'], | |
47 | + ], | |
48 | + ]); ?> | |
49 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | +/* @var $this yii\web\View */ | |
6 | +/* @var $model common\models\UserInfo */ | |
7 | + | |
8 | +$this->title = 'Update User Info: ' . ' ' . $model->user_info_id; | |
9 | +$this->params['breadcrumbs'][] = ['label' => 'User Infos', 'url' => ['index']]; | |
10 | +$this->params['breadcrumbs'][] = ['label' => $model->user_info_id, 'url' => ['view', 'id' => $model->user_info_id]]; | |
11 | +$this->params['breadcrumbs'][] = 'Update'; | |
12 | +?> | |
13 | +<div class="user-info-update"> | |
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\widgets\DetailView; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\UserInfo */ | |
8 | + | |
9 | +$this->title = $model->user_info_id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'User Infos', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="user-info-view"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p> | |
18 | + <?= Html::a('Update', ['update', 'id' => $model->user_info_id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a('Delete', ['delete', 'id' => $model->user_info_id], [ | |
20 | + 'class' => 'btn btn-danger', | |
21 | + 'data' => [ | |
22 | + 'confirm' => '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 | + 'user_id', | |
32 | + 'view_count', | |
33 | + 'busy', | |
34 | + 'date_visit', | |
35 | + 'experience', | |
36 | + 'rank', | |
37 | + 'salary', | |
38 | + 'job', | |
39 | + 'location', | |
40 | + 'soft', | |
41 | + 'user_info_id', | |
42 | + 'guarantee', | |
43 | + 'contract', | |
44 | + 'estimate', | |
45 | + 'purchase', | |
46 | + 'delivery', | |
47 | + 'prepayment', | |
48 | + 'about:ntext', | |
49 | + ], | |
50 | + ]) ?> | |
51 | + | |
52 | +</div> | ... | ... |
87.3 KB