Commit b0f143c3ff1ce0043adc2940fb5f224d216acb68
0 parents
first commit
Showing
492 changed files
with
33221 additions
and
0 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 492 files are displayed.
1 | +++ a/LICENSE.md | ||
1 | +The Yii framework is free software. It is released under the terms of | ||
2 | +the following BSD License. | ||
3 | + | ||
4 | +Copyright ยฉ 2008 by Yii Software LLC (http://www.yiisoft.com) | ||
5 | +All rights reserved. | ||
6 | + | ||
7 | +Redistribution and use in source and binary forms, with or without | ||
8 | +modification, are permitted provided that the following conditions | ||
9 | +are met: | ||
10 | + | ||
11 | + * Redistributions of source code must retain the above copyright | ||
12 | + notice, this list of conditions and the following disclaimer. | ||
13 | + * Redistributions in binary form must reproduce the above copyright | ||
14 | + notice, this list of conditions and the following disclaimer in | ||
15 | + the documentation and/or other materials provided with the | ||
16 | + distribution. | ||
17 | + * Neither the name of Yii Software LLC nor the names of its | ||
18 | + contributors may be used to endorse or promote products derived | ||
19 | + from this software without specific prior written permission. | ||
20 | + | ||
21 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
22 | +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
23 | +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
24 | +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
25 | +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
26 | +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
27 | +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
28 | +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
29 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
30 | +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
31 | +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
32 | +POSSIBILITY OF SUCH DAMAGE. |
1 | +++ a/README.md | ||
1 | +Yii 2 Advanced Project Template | ||
2 | +=============================== | ||
3 | + | ||
4 | +Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for | ||
5 | +developing complex Web applications with multiple tiers. | ||
6 | + | ||
7 | +The template includes three tiers: front end, back end, and console, each of which | ||
8 | +is a separate Yii application. | ||
9 | + | ||
10 | +The template is designed to work in a team development environment. It supports | ||
11 | +deploying the application in different environments. | ||
12 | + | ||
13 | +Documentation is at [docs/guide/README.md](docs/guide/README.md). | ||
14 | + | ||
15 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | ||
16 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | ||
17 | +[](https://travis-ci.org/yiisoft/yii2-app-advanced) | ||
18 | + | ||
19 | +DIRECTORY STRUCTURE | ||
20 | +------------------- | ||
21 | + | ||
22 | +``` | ||
23 | +common | ||
24 | + config/ contains shared configurations | ||
25 | + mail/ contains view files for e-mails | ||
26 | + models/ contains model classes used in both backend and frontend | ||
27 | +console | ||
28 | + config/ contains console configurations | ||
29 | + controllers/ contains console controllers (commands) | ||
30 | + migrations/ contains database migrations | ||
31 | + models/ contains console-specific model classes | ||
32 | + runtime/ contains files generated during runtime | ||
33 | +backend | ||
34 | + assets/ contains application assets such as JavaScript and CSS | ||
35 | + config/ contains backend configurations | ||
36 | + controllers/ contains Web controller classes | ||
37 | + models/ contains backend-specific model classes | ||
38 | + runtime/ contains files generated during runtime | ||
39 | + views/ contains view files for the Web application | ||
40 | + web/ contains the entry script and Web resources | ||
41 | +frontend | ||
42 | + assets/ contains application assets such as JavaScript and CSS | ||
43 | + config/ contains frontend configurations | ||
44 | + controllers/ contains Web controller classes | ||
45 | + models/ contains frontend-specific model classes | ||
46 | + runtime/ contains files generated during runtime | ||
47 | + views/ contains view files for the Web application | ||
48 | + web/ contains the entry script and Web resources | ||
49 | + widgets/ contains frontend widgets | ||
50 | +vendor/ contains dependent 3rd-party packages | ||
51 | +environments/ contains environment-based overrides | ||
52 | +tests contains various tests for the advanced application | ||
53 | + codeception/ contains tests developed with Codeception PHP Testing Framework | ||
54 | +``` |
1 | +++ a/backend/assets/AppAsset.php | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * @link http://www.yiiframework.com/ | ||
4 | + * @copyright Copyright (c) 2008 Yii Software LLC | ||
5 | + * @license http://www.yiiframework.com/license/ | ||
6 | + */ | ||
7 | + | ||
8 | +namespace backend\assets; | ||
9 | + | ||
10 | +use yii\web\AssetBundle; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author Qiang Xue <qiang.xue@gmail.com> | ||
14 | + * @since 2.0 | ||
15 | + */ | ||
16 | +class AppAsset extends AssetBundle | ||
17 | +{ | ||
18 | + public $basePath = '@webroot'; | ||
19 | + public $baseUrl = '@web'; | ||
20 | + public $css = [ | ||
21 | + 'css/site.css', | ||
22 | + 'css/flags32.css' | ||
23 | + ]; | ||
24 | + public $js = [ | ||
25 | + 'js/option.js' | ||
26 | + ]; | ||
27 | + public $depends = [ | ||
28 | + 'yii\web\YiiAsset', | ||
29 | + 'yii\bootstrap\BootstrapAsset', | ||
30 | + 'yii\web\JqueryAsset' | ||
31 | + ]; | ||
32 | +} |
1 | +++ a/backend/config/main.php | ||
1 | +<?php | ||
2 | + | ||
3 | +$params = array_merge( | ||
4 | + require(__DIR__ . '/../../common/config/params.php'), | ||
5 | + require(__DIR__ . '/../../common/config/params-local.php'), | ||
6 | + require(__DIR__ . '/params.php'), | ||
7 | + require(__DIR__ . '/params-local.php') | ||
8 | +); | ||
9 | + | ||
10 | +define ('IS_FRONT', FALSE); | ||
11 | + | ||
12 | +return [ | ||
13 | + 'id' => 'app-backend', | ||
14 | + 'basePath' => dirname(__DIR__), | ||
15 | + 'controllerNamespace' => 'backend\controllers', | ||
16 | + 'bootstrap' => ['log'], | ||
17 | + 'modules' => [ | ||
18 | + 'permit' => [ | ||
19 | + 'class' => 'developeruz\db_rbac\Yii2DbRbac', | ||
20 | + 'params' => [ | ||
21 | + 'userClass' => 'common\models\User' | ||
22 | + ] | ||
23 | + ], | ||
24 | + ], | ||
25 | + 'components' => [ | ||
26 | + 'user' => [ | ||
27 | + 'identityClass' => 'common\models\User', | ||
28 | + 'enableAutoLogin' => true, | ||
29 | + ], | ||
30 | + 'urlManager' => [ | ||
31 | + 'enablePrettyUrl' => true, | ||
32 | + 'showScriptName' => false, | ||
33 | + ], | ||
34 | + 'log' => [ | ||
35 | + 'traceLevel' => YII_DEBUG ? 3 : 0, | ||
36 | + 'targets' => [ | ||
37 | + [ | ||
38 | + 'class' => 'yii\log\FileTarget', | ||
39 | + 'levels' => ['error', 'warning'], | ||
40 | + ], | ||
41 | + ], | ||
42 | + ], | ||
43 | + 'errorHandler' => [ | ||
44 | + 'errorAction' => 'site/error', | ||
45 | + ], | ||
46 | + ], | ||
47 | + 'params' => $params, | ||
48 | +]; |
1 | +++ a/backend/controllers/AdminMenuController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use backend\models\AdminMenu; | ||
7 | +use backend\models\AdminMenuSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * AdminMenuController implements the CRUD actions for AdminMenu model. | ||
14 | + */ | ||
15 | +class AdminMenuController extends Controller | ||
16 | +{ | ||
17 | + public $layout = 'settings'; | ||
18 | + | ||
19 | + public function behaviors() | ||
20 | + { | ||
21 | + return [ | ||
22 | + 'verbs' => [ | ||
23 | + 'class' => VerbFilter::className(), | ||
24 | + 'actions' => [ | ||
25 | + 'delete' => ['post'], | ||
26 | + ], | ||
27 | + ], | ||
28 | + ]; | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * Lists all AdminMenu models. | ||
33 | + * @return mixed | ||
34 | + */ | ||
35 | + public function actionIndex() | ||
36 | + { | ||
37 | + $searchModel = new AdminMenuSearch(); | ||
38 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
39 | + | ||
40 | + return $this->render('index', [ | ||
41 | + 'searchModel' => $searchModel, | ||
42 | + 'dataProvider' => $dataProvider, | ||
43 | + ]); | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Displays a single AdminMenu model. | ||
48 | + * @param integer $id | ||
49 | + * @return mixed | ||
50 | + */ | ||
51 | + public function actionView($id) | ||
52 | + { | ||
53 | + return $this->render('view', [ | ||
54 | + 'model' => $this->findModel($id), | ||
55 | + ]); | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Creates a new AdminMenu model. | ||
60 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
61 | + * @return mixed | ||
62 | + */ | ||
63 | + public function actionCreate() | ||
64 | + { | ||
65 | + $model = new AdminMenu(); | ||
66 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
67 | + return $this->redirect(['view', 'id' => $model->admin_menu_id]); | ||
68 | + } else { | ||
69 | + return $this->render('create', [ | ||
70 | + 'model' => $model, | ||
71 | + ]); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * Updates an existing AdminMenu model. | ||
77 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
78 | + * @param integer $id | ||
79 | + * @return mixed | ||
80 | + */ | ||
81 | + public function actionUpdate($id) | ||
82 | + { | ||
83 | + $model = $this->findModel($id); | ||
84 | + | ||
85 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
86 | + return $this->redirect(['view', 'id' => $model->adminmenu_id]); | ||
87 | + } else { | ||
88 | + return $this->render('update', [ | ||
89 | + 'model' => $model, | ||
90 | + ]); | ||
91 | + } | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * Deletes an existing AdminMenu model. | ||
96 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
97 | + * @param integer $id | ||
98 | + * @return mixed | ||
99 | + */ | ||
100 | + public function actionDelete($id) | ||
101 | + { | ||
102 | + $this->findModel($id)->delete(); | ||
103 | + | ||
104 | + return $this->redirect(['index']); | ||
105 | + } | ||
106 | + | ||
107 | + /** | ||
108 | + * Finds the AdminMenu model based on its primary key value. | ||
109 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
110 | + * @param integer $id | ||
111 | + * @return AdminMenu the loaded model | ||
112 | + * @throws NotFoundHttpException if the model cannot be found | ||
113 | + */ | ||
114 | + protected function findModel($id) | ||
115 | + { | ||
116 | + if (($model = AdminMenu::findOne($id)) !== null) { | ||
117 | + return $model; | ||
118 | + } else { | ||
119 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
120 | + } | ||
121 | + } | ||
122 | + | ||
123 | +} |
1 | +++ a/backend/controllers/BlogController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use common\modules\blog\models\Article; | ||
6 | +use yii\base\Controller; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | + | ||
9 | +class BlogController extends Controller | ||
10 | +{ | ||
11 | + public $defaultAction = 'articles'; | ||
12 | + | ||
13 | + public function actionIndex() | ||
14 | + { | ||
15 | + echo 123; | ||
16 | + } | ||
17 | + | ||
18 | + public function actionArticles($category_id = NULL) | ||
19 | + { | ||
20 | + $dataProvider = new ActiveDataProvider([ | ||
21 | + 'query' => Article::find(), | ||
22 | + 'pagination' => [ | ||
23 | + 'pageSize' => 10 | ||
24 | + ] | ||
25 | + ]); | ||
26 | + return $this->render('articles', ['dataProvider' => $dataProvider]); | ||
27 | + } | ||
28 | + | ||
29 | +} | ||
0 | \ No newline at end of file | 30 | \ No newline at end of file |
1 | +++ a/backend/controllers/ImportController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use backend\models\Import; | ||
7 | +use yii\web\UploadedFile; | ||
8 | + | ||
9 | +class ImportController extends \yii\web\Controller | ||
10 | +{ | ||
11 | + public function actionIndex() | ||
12 | + { | ||
13 | + $model = new Import(); | ||
14 | + return $this->render('index', [ | ||
15 | + 'model' => $model | ||
16 | + ]); | ||
17 | + } | ||
18 | + | ||
19 | + public function actionUpload() | ||
20 | + { | ||
21 | + $model = new Import(); | ||
22 | + | ||
23 | + if ($model->load(Yii::$app->request->post())) | ||
24 | + { | ||
25 | + $model->file = UploadedFile::getInstances($model, 'file'); | ||
26 | + | ||
27 | + // ะะพะฟะธััะตะผ ัะฐะนะป ะฒ ะดะธัะตะบัะพัะธั | ||
28 | + $path = $_SERVER['DOCUMENT_ROOT'].'/import/'; | ||
29 | + | ||
30 | + foreach ($model->file as $file) | ||
31 | + { | ||
32 | + //var_dump(substr ($path.$file->name, 0, -10)); die; | ||
33 | + Import::importFile ($file); | ||
34 | + } | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | +} |
1 | +++ a/backend/controllers/LanguageController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use backend\models\Language; | ||
7 | +use backend\models\LanguageSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | +use frontend\models\Option; | ||
12 | +use frontend\models\OptionSearch; | ||
13 | +use frontend\models\OptionLang; | ||
14 | + | ||
15 | +/** | ||
16 | + * LanguageController implements the CRUD actions for Language model. | ||
17 | + */ | ||
18 | +class LanguageController extends Controller | ||
19 | +{ | ||
20 | + | ||
21 | + public function behaviors() | ||
22 | + { | ||
23 | + return [ | ||
24 | + 'verbs' => [ | ||
25 | + 'class' => VerbFilter::className(), | ||
26 | + 'actions' => [ | ||
27 | + 'delete' => ['post'], | ||
28 | + ], | ||
29 | + ], | ||
30 | + ]; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * Lists all Language models. | ||
35 | + * @return mixed | ||
36 | + */ | ||
37 | + public function actionIndex() | ||
38 | + { | ||
39 | + $searchModel = new LanguageSearch(); | ||
40 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
41 | + | ||
42 | + return $this->render('index', [ | ||
43 | + 'searchModel' => $searchModel, | ||
44 | + 'dataProvider' => $dataProvider, | ||
45 | + ]); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * Creates a new Language model. | ||
50 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
51 | + * @return mixed | ||
52 | + */ | ||
53 | + public function actionCreate() | ||
54 | + { | ||
55 | + if(!empty(Yii::$app->request->get('id'))) { | ||
56 | + $model = $this->findModel(Yii::$app->request->get('id')); | ||
57 | + $model->status = 1; | ||
58 | + $model->save(); | ||
59 | + return $this->redirect(['index']); | ||
60 | + } else { | ||
61 | + $searchModel = new LanguageSearch(); | ||
62 | + $dataProvider = $searchModel->searchNew(Yii::$app->request->queryParams); | ||
63 | + | ||
64 | + return $this->render('create', [ | ||
65 | + 'searchModel' => $searchModel, | ||
66 | + 'dataProvider' => $dataProvider, | ||
67 | + ]); | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Deletes an existing Language model. | ||
73 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
74 | + * @param integer $id | ||
75 | + * @return mixed | ||
76 | + */ | ||
77 | + public function actionDelete($id) | ||
78 | + { | ||
79 | + $model = $this->findModel($id); | ||
80 | + $model->status = 0; | ||
81 | + $model->save(); | ||
82 | + | ||
83 | + return $this->redirect(['index']); | ||
84 | + } | ||
85 | + | ||
86 | + public function actionDefault($id) | ||
87 | + { | ||
88 | + $model = $this->findModel($id); | ||
89 | + $models = Language::find()->where(['is_default' => 1])->all(); | ||
90 | + foreach($models as $onemodel) { | ||
91 | + $onemodel->is_default = 0; | ||
92 | + $onemodel->save(); | ||
93 | + } | ||
94 | + $model->is_default = 1; | ||
95 | + $model->save(); | ||
96 | + return $this->redirect(['index']); | ||
97 | + } | ||
98 | + /** | ||
99 | + * Finds the Language model based on its primary key value. | ||
100 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
101 | + * @param integer $id | ||
102 | + * @return Language the loaded model | ||
103 | + * @throws NotFoundHttpException if the model cannot be found | ||
104 | + */ | ||
105 | + protected function findModel($id) | ||
106 | + { | ||
107 | + if (($model = Language::findOne($id)) !== null) { | ||
108 | + return $model; | ||
109 | + } else { | ||
110 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + public function actionCreateAdress() | ||
115 | + { | ||
116 | + $form[0] = Option::create(\Yii::$app->request->post(), 'Main', 1, [['name' => 'adres', 'template' => 'text', 'translate' => true], ['name' => 'x', 'template' => 'number', 'translate' => false], ['name' => 'y', 'template' => 'number', 'translate' => false], ['name' => 'phone', 'template' => 'text', 'translate' => false], ['name' => 'name', 'template' => 'text', 'translate' => true]], true); | ||
117 | + if($form[0]['success'] == false) { | ||
118 | + return $this->render('create_adress', ['forms' => $form]); | ||
119 | + } else { | ||
120 | + return $this->redirect(['view-adress']); | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + public function actionUpdateAdress($id) | ||
125 | + { | ||
126 | + $form[0] = Option::change($id, \Yii::$app->request->post(), 'Main', 1); | ||
127 | + if($form[0]['success'] == false) { | ||
128 | + return $this->render('update_adress', ['forms' => $form]); | ||
129 | + } else { | ||
130 | + return $this->redirect(['view-adress']); | ||
131 | + } | ||
132 | + } | ||
133 | + | ||
134 | + public function actionViewAdress() | ||
135 | + { | ||
136 | + $searchModel = new OptionSearch(); | ||
137 | + | ||
138 | + $dataProvider = $searchModel->search(array_merge(Yii::$app->request->queryParams, ['OptionSearch' => ['model' => 'Main', 'name' => 'adres']])); | ||
139 | + | ||
140 | + return $this->render('view_adress', [ | ||
141 | + 'searchModel' => $searchModel, | ||
142 | + 'dataProvider' => $dataProvider, | ||
143 | + ]); | ||
144 | + } | ||
145 | + | ||
146 | + /** | ||
147 | + * Deletes an existing Option model. | ||
148 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
149 | + * @param integer $id | ||
150 | + * @return mixed | ||
151 | + */ | ||
152 | + public function actionDeleteAdress($id) | ||
153 | + { | ||
154 | + $model = $this->findModelAdress($id); | ||
155 | + $children = $model->hasMany(Option::className(), ['option_pid' => 'option_id'])->all(); | ||
156 | + $langs = array(); | ||
157 | + if(!empty($children)) { | ||
158 | + foreach($children as $child) { | ||
159 | + $langs = OptionLang::findAll(['option_language_id' => $child->option_id]); | ||
160 | + foreach($langs as $lang) { | ||
161 | + $lang->delete(); | ||
162 | + } | ||
163 | + $child->delete(); | ||
164 | + } | ||
165 | + } | ||
166 | + $langs = OptionLang::findAll(['option_language_id' => $id]); | ||
167 | + foreach($langs as $lang) { | ||
168 | + $lang->delete(); | ||
169 | + } | ||
170 | + $model->delete(); | ||
171 | + | ||
172 | + return $this->redirect(['view-adress']); | ||
173 | + } | ||
174 | + | ||
175 | + /** | ||
176 | + * Finds the Option model based on its primary key value. | ||
177 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
178 | + * @param integer $id | ||
179 | + * @return Option the loaded model | ||
180 | + * @throws NotFoundHttpException if the model cannot be found | ||
181 | + */ | ||
182 | + protected function findModelAdress($id) | ||
183 | + { | ||
184 | + if (($model = Option::findOne($id)) !== null) { | ||
185 | + return $model; | ||
186 | + } else { | ||
187 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
188 | + } | ||
189 | + } | ||
190 | +} |
1 | +++ a/backend/controllers/MenuController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use backend\models\Menu; | ||
7 | +use backend\models\MenuSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * MenuController implements the CRUD actions for Menu model. | ||
14 | + */ | ||
15 | +class MenuController extends Controller | ||
16 | +{ | ||
17 | + public function behaviors() | ||
18 | + { | ||
19 | + return [ | ||
20 | + 'verbs' => [ | ||
21 | + 'class' => VerbFilter::className(), | ||
22 | + 'actions' => [ | ||
23 | + 'delete' => ['post'], | ||
24 | + ], | ||
25 | + ], | ||
26 | + ]; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * Lists all Menu models. | ||
31 | + * @return mixed | ||
32 | + */ | ||
33 | + public function actionIndex() | ||
34 | + { | ||
35 | + $searchModel = new MenuSearch(); | ||
36 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
37 | + | ||
38 | + return $this->render('index', [ | ||
39 | + 'searchModel' => $searchModel, | ||
40 | + 'dataProvider' => $dataProvider, | ||
41 | + ]); | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Displays a single Menu model. | ||
46 | + * @param integer $id | ||
47 | + * @return mixed | ||
48 | + */ | ||
49 | + public function actionView($id) | ||
50 | + { | ||
51 | + return $this->render('view', [ | ||
52 | + 'model' => $this->findModel($id), | ||
53 | + ]); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates a new Menu model. | ||
58 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
59 | + * @return mixed | ||
60 | + */ | ||
61 | + public function actionCreate() | ||
62 | + { | ||
63 | + $model = new Menu(); | ||
64 | + | ||
65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
66 | + return $this->redirect(['view', 'id' => $model->menu_id]); | ||
67 | + } else { | ||
68 | + return $this->render('create', [ | ||
69 | + 'model' => $model, | ||
70 | + ]); | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Updates an existing Menu model. | ||
76 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
77 | + * @param integer $id | ||
78 | + * @return mixed | ||
79 | + */ | ||
80 | + public function actionUpdate($id) | ||
81 | + { | ||
82 | + $model = $this->findModel($id); | ||
83 | + | ||
84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
85 | + return $this->redirect(['view', 'id' => $model->menu_id]); | ||
86 | + } else { | ||
87 | + return $this->render('update', [ | ||
88 | + 'model' => $model, | ||
89 | + ]); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Deletes an existing Menu model. | ||
95 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
96 | + * @param integer $id | ||
97 | + * @return mixed | ||
98 | + */ | ||
99 | + public function actionDelete($id) | ||
100 | + { | ||
101 | + $this->findModel($id)->delete(); | ||
102 | + | ||
103 | + return $this->redirect(['index']); | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * Finds the Menu model based on its primary key value. | ||
108 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
109 | + * @param integer $id | ||
110 | + * @return Menu the loaded model | ||
111 | + * @throws NotFoundHttpException if the model cannot be found | ||
112 | + */ | ||
113 | + protected function findModel($id) | ||
114 | + { | ||
115 | + if (($model = Menu::findOne($id)) !== null) { | ||
116 | + return $model; | ||
117 | + } else { | ||
118 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
119 | + } | ||
120 | + } | ||
121 | + | ||
122 | +} |
1 | +++ a/backend/controllers/MenuLocationController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use backend\models\MenuLocation; | ||
7 | +use backend\models\MenuLocationSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * MenuLocationController implements the CRUD actions for MenuLocation model. | ||
14 | + */ | ||
15 | +class MenuLocationController extends Controller | ||
16 | +{ | ||
17 | + public function behaviors() | ||
18 | + { | ||
19 | + return [ | ||
20 | + 'verbs' => [ | ||
21 | + 'class' => VerbFilter::className(), | ||
22 | + 'actions' => [ | ||
23 | + 'delete' => ['post'], | ||
24 | + ], | ||
25 | + ], | ||
26 | + ]; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * Lists all MenuLocation models. | ||
31 | + * @return mixed | ||
32 | + */ | ||
33 | + public function actionIndex() | ||
34 | + { | ||
35 | + $searchModel = new MenuLocationSearch(); | ||
36 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
37 | + | ||
38 | + return $this->render('index', [ | ||
39 | + 'searchModel' => $searchModel, | ||
40 | + 'dataProvider' => $dataProvider, | ||
41 | + ]); | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Displays a single MenuLocation model. | ||
46 | + * @param integer $id | ||
47 | + * @return mixed | ||
48 | + */ | ||
49 | + public function actionView($id) | ||
50 | + { | ||
51 | + return $this->render('view', [ | ||
52 | + 'model' => $this->findModel($id), | ||
53 | + ]); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates a new MenuLocation model. | ||
58 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
59 | + * @return mixed | ||
60 | + */ | ||
61 | + public function actionCreate() | ||
62 | + { | ||
63 | + $model = new MenuLocation(); | ||
64 | + | ||
65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
66 | + return $this->redirect(['view', 'id' => $model->menu_location_id]); | ||
67 | + } else { | ||
68 | + return $this->render('create', [ | ||
69 | + 'model' => $model, | ||
70 | + ]); | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Updates an existing MenuLocation model. | ||
76 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
77 | + * @param integer $id | ||
78 | + * @return mixed | ||
79 | + */ | ||
80 | + public function actionUpdate($id) | ||
81 | + { | ||
82 | + $model = $this->findModel($id); | ||
83 | + | ||
84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
85 | + return $this->redirect(['view', 'id' => $model->menu_location_id]); | ||
86 | + } else { | ||
87 | + return $this->render('update', [ | ||
88 | + 'model' => $model, | ||
89 | + ]); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Deletes an existing MenuLocation model. | ||
95 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
96 | + * @param integer $id | ||
97 | + * @return mixed | ||
98 | + */ | ||
99 | + public function actionDelete($id) | ||
100 | + { | ||
101 | + $this->findModel($id)->delete(); | ||
102 | + | ||
103 | + return $this->redirect(['index']); | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * Finds the MenuLocation model based on its primary key value. | ||
108 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
109 | + * @param integer $id | ||
110 | + * @return MenuLocation the loaded model | ||
111 | + * @throws NotFoundHttpException if the model cannot be found | ||
112 | + */ | ||
113 | + protected function findModel($id) | ||
114 | + { | ||
115 | + if (($model = MenuLocation::findOne($id)) !== null) { | ||
116 | + return $model; | ||
117 | + } else { | ||
118 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
119 | + } | ||
120 | + } | ||
121 | +} |
1 | +++ a/backend/controllers/NewOptionsLangController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use backend\models\NewOptionsLang; | ||
7 | +use backend\models\NewOptionsLangSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * NewOptionsLangController implements the CRUD actions for NewOptionsLang model. | ||
14 | + */ | ||
15 | +class NewOptionsLangController extends Controller | ||
16 | +{ | ||
17 | + public function behaviors() | ||
18 | + { | ||
19 | + return [ | ||
20 | + 'verbs' => [ | ||
21 | + 'class' => VerbFilter::className(), | ||
22 | + 'actions' => [ | ||
23 | + 'delete' => ['post'], | ||
24 | + ], | ||
25 | + ], | ||
26 | + ]; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * Lists all NewOptionsLang models. | ||
31 | + * @return mixed | ||
32 | + */ | ||
33 | + public function actionIndex() | ||
34 | + { | ||
35 | + $searchModel = new NewOptionsLangSearch(); | ||
36 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
37 | + | ||
38 | + return $this->render('index', [ | ||
39 | + 'searchModel' => $searchModel, | ||
40 | + 'dataProvider' => $dataProvider, | ||
41 | + ]); | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Displays a single NewOptionsLang model. | ||
46 | + * @param integer $id | ||
47 | + * @return mixed | ||
48 | + */ | ||
49 | + public function actionView($id) | ||
50 | + { | ||
51 | + return $this->render('view', [ | ||
52 | + 'model' => $this->findModel($id), | ||
53 | + ]); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates a new NewOptionsLang model. | ||
58 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
59 | + * @return mixed | ||
60 | + */ | ||
61 | + public function actionCreate() | ||
62 | + { | ||
63 | + $model = new NewOptionsLang(); | ||
64 | + | ||
65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
66 | + return $this->redirect(['view', 'id' => $model->primary]); | ||
67 | + } else { | ||
68 | + return $this->render('create', [ | ||
69 | + 'model' => $model, | ||
70 | + ]); | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Updates an existing NewOptionsLang model. | ||
76 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
77 | + * @param integer $id | ||
78 | + * @return mixed | ||
79 | + */ | ||
80 | + public function actionUpdate($id) | ||
81 | + { | ||
82 | + $model = $this->findModel($id); | ||
83 | + | ||
84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
85 | + return $this->redirect(['view', 'id' => $model->primary]); | ||
86 | + } else { | ||
87 | + return $this->render('update', [ | ||
88 | + 'model' => $model, | ||
89 | + ]); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Deletes an existing NewOptionsLang model. | ||
95 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
96 | + * @param integer $id | ||
97 | + * @return mixed | ||
98 | + */ | ||
99 | + public function actionDelete($id) | ||
100 | + { | ||
101 | + $this->findModel($id)->delete(); | ||
102 | + | ||
103 | + return $this->redirect(['index']); | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * Finds the NewOptionsLang model based on its primary key value. | ||
108 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
109 | + * @param integer $id | ||
110 | + * @return NewOptionsLang the loaded model | ||
111 | + * @throws NotFoundHttpException if the model cannot be found | ||
112 | + */ | ||
113 | + protected function findModel($id) | ||
114 | + { | ||
115 | + if (($model = NewOptionsLang::findOne($id)) !== null) { | ||
116 | + return $model; | ||
117 | + } else { | ||
118 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
119 | + } | ||
120 | + } | ||
121 | +} |
1 | +++ a/backend/controllers/OptionController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use frontend\models\Option; | ||
7 | +use frontend\models\OptionSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | +use frontend\models\OptionLang; | ||
12 | + | ||
13 | +/** | ||
14 | + * OptionController implements the CRUD actions for Option model. | ||
15 | + */ | ||
16 | +class OptionController extends Controller | ||
17 | +{ | ||
18 | + public function behaviors() | ||
19 | + { | ||
20 | + return [ | ||
21 | + 'verbs' => [ | ||
22 | + 'class' => VerbFilter::className(), | ||
23 | + 'actions' => [ | ||
24 | + 'delete' => ['post'], | ||
25 | + ], | ||
26 | + ], | ||
27 | + ]; | ||
28 | + } | ||
29 | + | ||
30 | + /** | ||
31 | + * Lists all Option models. | ||
32 | + * @return mixed | ||
33 | + */ | ||
34 | + public function actionIndex() | ||
35 | + { | ||
36 | + $searchModel = new OptionSearch(); | ||
37 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
38 | + | ||
39 | + return $this->render('index', [ | ||
40 | + 'searchModel' => $searchModel, | ||
41 | + 'dataProvider' => $dataProvider, | ||
42 | + ]); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * Displays a single Option model. | ||
47 | + * @param integer $id | ||
48 | + * @return mixed | ||
49 | + */ | ||
50 | + public function actionView($id) | ||
51 | + { | ||
52 | + return $this->render('view', [ | ||
53 | + 'model' => $this->findModel($id), | ||
54 | + ]); | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Creates a new Option model. | ||
59 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
60 | + * @return mixed | ||
61 | + */ | ||
62 | + public function actionCreate() | ||
63 | + { | ||
64 | + $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text', 'translate' => true], ['name' => 'adres', 'template' => 'text', 'translate' => false]]); | ||
65 | + if($form[0]['success'] == false) { | ||
66 | + return $this->render('create', ['forms' => $form]); | ||
67 | + } else { | ||
68 | + return $this->redirect(['index']); | ||
69 | + } | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * Updates an existing Option model. | ||
74 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
75 | + * @param integer $id | ||
76 | + * @return mixed | ||
77 | + */ | ||
78 | + public function actionUpdate($id) | ||
79 | + { | ||
80 | + $form[0] = Option::change($id, \Yii::$app->request->post(), 'User', 10); | ||
81 | + if($form[0]['success'] == false) { | ||
82 | + return $this->render('update', ['forms' => $form]); | ||
83 | + } else { | ||
84 | + return $this->redirect(['view', 'id' => $id]); | ||
85 | + } | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Deletes an existing Option model. | ||
90 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
91 | + * @param integer $id | ||
92 | + * @return mixed | ||
93 | + */ | ||
94 | + public function actionDelete($id) | ||
95 | + { | ||
96 | + $model = $this->findModel($id); | ||
97 | + $children = $model->hasMany(Option::className(), ['parent_id' => 'option_id'])->all(); | ||
98 | + $langs = array(); | ||
99 | + if(!empty($children)) { | ||
100 | + foreach($children as $child) { | ||
101 | + $langs = OptionLang::findAll(['id' => $child->option_id]); | ||
102 | + foreach($langs as $lang) { | ||
103 | + $lang->delete(); | ||
104 | + } | ||
105 | + $child->delete(); | ||
106 | + } | ||
107 | + } | ||
108 | + $langs = OptionLang::findAll(['id' => $id]); | ||
109 | + foreach($langs as $lang) { | ||
110 | + $lang->delete(); | ||
111 | + } | ||
112 | + $model->delete(); | ||
113 | + | ||
114 | + return $this->redirect(['index']); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * Finds the Option model based on its primary key value. | ||
119 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
120 | + * @param integer $id | ||
121 | + * @return Option the loaded model | ||
122 | + * @throws NotFoundHttpException if the model cannot be found | ||
123 | + */ | ||
124 | + protected function findModel($id) | ||
125 | + { | ||
126 | + if (($model = Option::findOne($id)) !== null) { | ||
127 | + return $model; | ||
128 | + } else { | ||
129 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
130 | + } | ||
131 | + } | ||
132 | +} |
1 | +++ a/backend/controllers/SettingsController.php | ||
1 | +<?php | ||
2 | +namespace backend\controllers; | ||
3 | + | ||
4 | +use Yii; | ||
5 | +use yii\filters\AccessControl; | ||
6 | +use yii\web\Controller; | ||
7 | +use common\models\LoginForm; | ||
8 | +use yii\filters\VerbFilter; | ||
9 | +use backend\models\Profile; | ||
10 | +use common\models\User; | ||
11 | +use frontend\models\Option; | ||
12 | +use yii\data\ActiveDataProvider; | ||
13 | +use yii\validators\BooleanValidator; | ||
14 | +use yii\validators\StringValidator; | ||
15 | +/** | ||
16 | + * Site controller | ||
17 | + */ | ||
18 | +class SettingsController extends Controller | ||
19 | +{ | ||
20 | + public $layout = 'settings'; | ||
21 | + /** | ||
22 | + * @inheritdoc | ||
23 | + */ | ||
24 | + public function actions() | ||
25 | + { | ||
26 | + return [ | ||
27 | + 'error' => [ | ||
28 | + 'class' => 'yii\web\ErrorAction', | ||
29 | + ], | ||
30 | + ]; | ||
31 | + } | ||
32 | + | ||
33 | + public function actionIndex() | ||
34 | + { | ||
35 | + return $this->render('index'); | ||
36 | + } | ||
37 | + | ||
38 | +} |
1 | +++ a/backend/controllers/SiteController.php | ||
1 | +<?php | ||
2 | +namespace backend\controllers; | ||
3 | + | ||
4 | +use Yii; | ||
5 | +use yii\filters\AccessControl; | ||
6 | +use yii\web\Controller; | ||
7 | +use common\models\LoginForm; | ||
8 | +use yii\filters\VerbFilter; | ||
9 | +use backend\models\Profile; | ||
10 | +use common\models\User; | ||
11 | +use frontend\models\Option; | ||
12 | +use yii\data\ActiveDataProvider; | ||
13 | +use yii\validators\BooleanValidator; | ||
14 | +use yii\validators\StringValidator; | ||
15 | +/** | ||
16 | + * Site controller | ||
17 | + */ | ||
18 | +class SiteController extends Controller | ||
19 | +{ | ||
20 | + /** | ||
21 | + * @inheritdoc | ||
22 | + */ | ||
23 | + public function behaviors() | ||
24 | + { | ||
25 | + return [ | ||
26 | + 'access' => [ | ||
27 | + 'class' => AccessControl::className(), | ||
28 | + 'except' => ['login', 'error'], | ||
29 | + 'rules' => [ | ||
30 | + [ | ||
31 | + 'allow' => true, | ||
32 | + 'roles' => ['@'] | ||
33 | + ], | ||
34 | + ], | ||
35 | + ], | ||
36 | + 'verbs' => [ | ||
37 | + 'class' => VerbFilter::className(), | ||
38 | + 'actions' => [ | ||
39 | + 'logout' => ['post'], | ||
40 | + 'delete-req' => ['post'] | ||
41 | + ], | ||
42 | + ], | ||
43 | + ]; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * @inheritdoc | ||
48 | + */ | ||
49 | + public function actions() | ||
50 | + { | ||
51 | + return [ | ||
52 | + 'error' => [ | ||
53 | + 'class' => 'yii\web\ErrorAction', | ||
54 | + ], | ||
55 | + ]; | ||
56 | + } | ||
57 | + | ||
58 | + public function actionIndex() | ||
59 | + { | ||
60 | +/* | ||
61 | + if (Yii::$app->user->can('site/index')) | ||
62 | + { | ||
63 | + | ||
64 | + } | ||
65 | + else | ||
66 | + { | ||
67 | + Yii::$app->getSession()->setFlash('error', 'ะะพัััะฟ ะทะฐะบััั..'); | ||
68 | + | ||
69 | + return $this->redirect('/'); | ||
70 | + } | ||
71 | +*/ | ||
72 | + return $this->render('index'); | ||
73 | + } | ||
74 | + | ||
75 | + public function actionLogin() | ||
76 | + { | ||
77 | + if (!\Yii::$app->user->isGuest) { | ||
78 | + return $this->goHome(); | ||
79 | + } | ||
80 | + | ||
81 | + $model = new LoginForm(); | ||
82 | + if ($model->load(Yii::$app->request->post()) && $model->login()) { | ||
83 | + return $this->goBack(); | ||
84 | + } else { | ||
85 | + return $this->render('login', [ | ||
86 | + 'model' => $model, | ||
87 | + ]); | ||
88 | + } | ||
89 | + } | ||
90 | + | ||
91 | + public function actionLogout() | ||
92 | + { | ||
93 | + Yii::$app->user->logout(); | ||
94 | + | ||
95 | + return $this->goHome(); | ||
96 | + } | ||
97 | + | ||
98 | + | ||
99 | + /** | ||
100 | + * Displays Profile page. | ||
101 | + * | ||
102 | + * @return mixed | ||
103 | + */ | ||
104 | + public function actionProfile() | ||
105 | + { | ||
106 | + $model = new Profile(); | ||
107 | + | ||
108 | + $model->saveProfile(); | ||
109 | + | ||
110 | + return $this->render('profile', [ | ||
111 | + 'model' => $model, | ||
112 | + ]); | ||
113 | + } | ||
114 | + | ||
115 | + public function actionRequests($id = 0) { | ||
116 | + if($id != 0) { | ||
117 | + Option::markOld($id); | ||
118 | + $this->redirect(['site/requests']); | ||
119 | + } | ||
120 | + $query = Option::find()->where(['model' => 'Feedback', 'model_id' => 1, 'parent_id' => null]); | ||
121 | + $provider = new ActiveDataProvider([ | ||
122 | + 'query' => $query, | ||
123 | + 'pagination' => [ | ||
124 | + 'pageSize' => 2, | ||
125 | + ], | ||
126 | + 'sort' => [ | ||
127 | + 'defaultOrder' => [ | ||
128 | + 'created_at' => SORT_DESC | ||
129 | + ] | ||
130 | + ] | ||
131 | + ]); | ||
132 | + $data = $provider->getModels(); | ||
133 | + return $this->render('requests', [ | ||
134 | + 'dataProvider' => $provider | ||
135 | + ]); | ||
136 | + } | ||
137 | + | ||
138 | + public function actionDeleteReq($id) { | ||
139 | + $model = Option::findOne($id); | ||
140 | + if(!is_null($model) && $model->delete()) { | ||
141 | + return $this->redirect(['site/requests']); | ||
142 | + } else{ | ||
143 | + Yii::$app->session->setFlash('post_error', $model->getFirstErrors()); | ||
144 | + return $this->redirect('[site/requests]'); | ||
145 | + } | ||
146 | + } | ||
147 | + | ||
148 | + public function actionTest() | ||
149 | + { | ||
150 | + echo "<pre>"; | ||
151 | + //var_dump(Yii::$app->getAuthManager()->getRole('CHUVAK')); | ||
152 | + //var_dump(Yii::$app->getAuthManager()->assign(Yii::$app->getAuthManager()->getRole('CHUVAK'), Yii::$app->user->getId())); | ||
153 | + var_dump(Yii::$app->getAuthManager()->getRoles()); | ||
154 | + echo "</pre>"; | ||
155 | + return $this->render('index'); | ||
156 | + } | ||
157 | + | ||
158 | +} |
1 | +++ a/backend/controllers/TerminController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use backend\models\Termin; | ||
7 | +use backend\models\TerminSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | +use backend\models\TerminLang; | ||
12 | +use backend\models\TerminStructure; | ||
13 | +use yii\filters\AccessControl; | ||
14 | + | ||
15 | +/** | ||
16 | + * TerminController implements the CRUD actions for Termin model. | ||
17 | + */ | ||
18 | +class TerminController extends Controller | ||
19 | +{ | ||
20 | + public function behaviors() | ||
21 | + { | ||
22 | + return [ | ||
23 | + 'access' => [ | ||
24 | + 'class' => AccessControl::className(), | ||
25 | + 'except' => ['login', 'error', 'index', 'create', 'update'], | ||
26 | + 'rules' => [ | ||
27 | + [ | ||
28 | + 'allow' => true, | ||
29 | + 'roles' => ['admin'] | ||
30 | + ], | ||
31 | + ], | ||
32 | + ], | ||
33 | + 'verbs' => [ | ||
34 | + 'class' => VerbFilter::className(), | ||
35 | + 'actions' => [ | ||
36 | + 'logout' => ['post'], | ||
37 | + 'delete-req' => ['post'] | ||
38 | + ], | ||
39 | + ], | ||
40 | + ]; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Lists all Termin models. | ||
45 | + * @return mixed | ||
46 | + */ | ||
47 | + public function actionIndex() | ||
48 | + { | ||
49 | + $searchModel = new TerminSearch(); | ||
50 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
51 | + | ||
52 | + return $this->render('index', [ | ||
53 | + 'searchModel' => $searchModel, | ||
54 | + 'dataProvider' => $dataProvider, | ||
55 | + ]); | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Displays a single Termin model. | ||
60 | + * @param integer $id | ||
61 | + * @return mixed | ||
62 | + */ | ||
63 | + public function actionView($id) | ||
64 | + { | ||
65 | + return $this->render('view', [ | ||
66 | + 'model' => $this->findModel($id), | ||
67 | + ]); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Creates a new Termin model. | ||
72 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
73 | + * @return mixed | ||
74 | + */ | ||
75 | + public function actionCreate() | ||
76 | + { | ||
77 | + $model = new Termin(); | ||
78 | + $model_lang = new TerminLang(); | ||
79 | + | ||
80 | + if ($model->load(Yii::$app->request->post()) | ||
81 | + && $model_lang->load(Yii::$app->request->post())) | ||
82 | + { | ||
83 | + $model->save(); | ||
84 | + $model_lang->termin_id = $model->termin_id; | ||
85 | + $model_lang->save(); | ||
86 | + | ||
87 | + return $this->redirect(['view', 'id' => $model->termin_id]); | ||
88 | + } | ||
89 | + else | ||
90 | + { | ||
91 | + return $this->render('create', [ | ||
92 | + 'model' => $model, | ||
93 | + 'model_lang' => $model_lang, | ||
94 | + ]); | ||
95 | + } | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * Updates an existing Termin model. | ||
100 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
101 | + * @param integer $id | ||
102 | + * @return mixed | ||
103 | + */ | ||
104 | + public function actionUpdate($id) | ||
105 | + { | ||
106 | + $model = $this->findModel($id); | ||
107 | + $model_lang = TerminLang::findOne($id); | ||
108 | + $model_pid = TerminStructure::findOne($id)->getRelation('terminPid')->one(); | ||
109 | + | ||
110 | + //var_dump(Yii::$app->request->post()); | ||
111 | + //var_dump($model_pid->termin->termin_id); die; | ||
112 | + | ||
113 | + if ($model->load(Yii::$app->request->post()) | ||
114 | + && $model_lang->load(Yii::$app->request->post()) | ||
115 | + && $model_pid->load(Yii::$app->request->post()) | ||
116 | + ) | ||
117 | + { | ||
118 | + $model->save(); | ||
119 | + $model_lang->save(); | ||
120 | + $model_pid->termin_pid = $model_pid->termin->termin_id; | ||
121 | + | ||
122 | + return $this->redirect(['view', 'id' => $model->termin_id]); | ||
123 | + } | ||
124 | + else | ||
125 | + { | ||
126 | + return $this->render('update', [ | ||
127 | + 'model' => $model, | ||
128 | + 'model_lang' => $model_lang, | ||
129 | + 'model_pid' => $model_pid, | ||
130 | + ]); | ||
131 | + } | ||
132 | + } | ||
133 | + | ||
134 | + /** | ||
135 | + * Deletes an existing Termin model. | ||
136 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
137 | + * @param integer $id | ||
138 | + * @return mixed | ||
139 | + */ | ||
140 | + public function actionDelete($id) | ||
141 | + { | ||
142 | + $this->findModel($id)->delete(); | ||
143 | + | ||
144 | + return $this->redirect(['index']); | ||
145 | + } | ||
146 | + | ||
147 | + /** | ||
148 | + * Finds the Termin model based on its primary key value. | ||
149 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
150 | + * @param integer $id | ||
151 | + * @return Termin the loaded model | ||
152 | + * @throws NotFoundHttpException if the model cannot be found | ||
153 | + */ | ||
154 | + protected function findModel($id) | ||
155 | + { | ||
156 | + if (($model = Termin::findOne($id)) !== null) { | ||
157 | + return $model; | ||
158 | + } else { | ||
159 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
160 | + } | ||
161 | + } | ||
162 | +} |
1 | +++ a/backend/controllers/UserController.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\User; | ||
7 | +use backend\models\UserSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * UserController implements the CRUD actions for User model. | ||
14 | + */ | ||
15 | +class UserController extends Controller | ||
16 | +{ | ||
17 | + public function behaviors() | ||
18 | + { | ||
19 | + return [ | ||
20 | + 'verbs' => [ | ||
21 | + 'class' => VerbFilter::className(), | ||
22 | + 'actions' => [ | ||
23 | + 'delete' => ['post'], | ||
24 | + ], | ||
25 | + ], | ||
26 | + ]; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * Lists all User models. | ||
31 | + * @return mixed | ||
32 | + */ | ||
33 | + public function actionIndex() | ||
34 | + { | ||
35 | + $searchModel = new UserSearch(); | ||
36 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
37 | + | ||
38 | + return $this->render('index', [ | ||
39 | + 'searchModel' => $searchModel, | ||
40 | + 'dataProvider' => $dataProvider, | ||
41 | + ]); | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Displays a single User model. | ||
46 | + * @param integer $id | ||
47 | + * @return mixed | ||
48 | + */ | ||
49 | + public function actionView($id) | ||
50 | + { | ||
51 | + return $this->render('view', [ | ||
52 | + 'model' => $this->findModel($id), | ||
53 | + ]); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Creates a new User model. | ||
58 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
59 | + * @return mixed | ||
60 | + */ | ||
61 | + public function actionCreate() | ||
62 | + { | ||
63 | + $model = new User(); | ||
64 | + | ||
65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
66 | + return $this->redirect(['view', 'id' => $model->id]); | ||
67 | + } else { | ||
68 | + return $this->render('create', [ | ||
69 | + 'model' => $model, | ||
70 | + ]); | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Updates an existing User model. | ||
76 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
77 | + * @param integer $id | ||
78 | + * @return mixed | ||
79 | + */ | ||
80 | + public function actionUpdate($id) | ||
81 | + { | ||
82 | + $model = $this->findModel($id); | ||
83 | + | ||
84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
85 | + return $this->redirect(['view', 'id' => $model->id]); | ||
86 | + } else { | ||
87 | + return $this->render('update', [ | ||
88 | + 'model' => $model, | ||
89 | + ]); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Deletes an existing User model. | ||
95 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
96 | + * @param integer $id | ||
97 | + * @return mixed | ||
98 | + */ | ||
99 | + public function actionDelete($id) | ||
100 | + { | ||
101 | + $this->findModel($id)->delete(); | ||
102 | + | ||
103 | + return $this->redirect(['index']); | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * Finds the User model based on its primary key value. | ||
108 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
109 | + * @param integer $id | ||
110 | + * @return User the loaded model | ||
111 | + * @throws NotFoundHttpException if the model cannot be found | ||
112 | + */ | ||
113 | + protected function findModel($id) | ||
114 | + { | ||
115 | + if (($model = User::findOne($id)) !== null) { | ||
116 | + return $model; | ||
117 | + } else { | ||
118 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
119 | + } | ||
120 | + } | ||
121 | +} |
1 | +++ a/backend/models/AdminMenu.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "admin_menu". | ||
9 | + * | ||
10 | + * @property integer $admin_menu_id | ||
11 | + * @property integer $admin_menu_pid | ||
12 | + * @property integer $status | ||
13 | + * @property integer $hide_min | ||
14 | + * @property integer $sort | ||
15 | + * @property string $name | ||
16 | + * @property string $path | ||
17 | + * @property string $param | ||
18 | + * | ||
19 | + * @property AdminMenu $parent | ||
20 | + * @property AdminMenu[] $adminMenus | ||
21 | + * @property AdminMenuAccessGroup[] $adminMenuAccessGroups | ||
22 | + * @property AdminMenuAccessUser[] $adminMenuAccessUsers | ||
23 | + */ | ||
24 | +class AdminMenu extends \yii\db\ActiveRecord | ||
25 | +{ | ||
26 | + | ||
27 | + public $parentt; | ||
28 | + /** | ||
29 | + * @inheritdoc | ||
30 | + */ | ||
31 | + public static function tableName() | ||
32 | + { | ||
33 | + return 'admin_menu'; | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * @inheritdoc | ||
38 | + */ | ||
39 | + public function rules() | ||
40 | + { | ||
41 | + return [ | ||
42 | + [['admin_menu_pid', 'status', 'hide_min', 'sort'], 'integer'], | ||
43 | + [['name'], 'required'], | ||
44 | + [['name', 'path', 'param','parentt'], 'string'] | ||
45 | + ]; | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * @inheritdoc | ||
50 | + */ | ||
51 | + public function attributeLabels() | ||
52 | + { | ||
53 | + return [ | ||
54 | + 'admin_menu_id' => Yii::t('app', 'Admin menu ID'), | ||
55 | + 'admin_menu_pid' => Yii::t('app', 'Admin menu parent ID'), | ||
56 | + 'status' => Yii::t('app', 'Status'), | ||
57 | + 'hide_min' => Yii::t('app', 'Hide Min'), | ||
58 | + 'sort' => Yii::t('app', 'Sort'), | ||
59 | + 'name' => Yii::t('app', 'Name'), | ||
60 | + 'path' => Yii::t('app', 'Path'), | ||
61 | + 'param' => Yii::t('app', 'Params'), | ||
62 | + 'parentt' => Yii::t('app', 'Parent item') | ||
63 | + ]; | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * @return \yii\db\ActiveQuery | ||
68 | + */ | ||
69 | + public function getParent() | ||
70 | + { | ||
71 | + return $this->hasOne(AdminMenu::className(), ['admin_menu_id' => 'admin_menu_pid']); | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * @return \yii\db\ActiveQuery | ||
76 | + */ | ||
77 | + public function getAdminMenus() | ||
78 | + { | ||
79 | + return $this->hasMany(AdminMenu::className(), ['admin_menu_pid' => 'admin_menu_id']); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * @return \yii\db\ActiveQuery | ||
84 | + */ | ||
85 | + public function getAdminMenuAccessGroups() | ||
86 | + { | ||
87 | + return $this->hasMany(AdminMenuAccessGroup::className(), ['admin_menu_id' => 'admin_menu_id']); | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * @return \yii\db\ActiveQuery | ||
92 | + */ | ||
93 | + public function getAdminMenuAccessUsers() | ||
94 | + { | ||
95 | + return $this->hasMany(AdminMenuAccessUser::className(), ['admin_menu_id' => 'admin_menu_id']); | ||
96 | + } | ||
97 | + | ||
98 | + public static function buildMenu($withValues = false) | ||
99 | + { | ||
100 | + $result = []; | ||
101 | + $roots = self::find()->where(['admin_menu_pid' => NULL])->with(['adminMenus'])->all(); | ||
102 | + foreach($roots as $root) { | ||
103 | + if($root->adminMenus) { | ||
104 | + $result[] = ['label' => Yii::t('app', $root->name), 'id' => $root->admin_menu_id, 'options' => ['class' => 'header']]; | ||
105 | + foreach($root->adminMenus as $submenu) { | ||
106 | + if($submenu->adminMenus) { | ||
107 | + $items = []; | ||
108 | + foreach($submenu->adminMenus as $item) { | ||
109 | + $items[] = ['label' => Yii::t('app', $item->name), 'id' => $item->admin_menu_id, 'icon' => 'fa fa-circle-o', 'url' => array_merge([$item->path], \common\models\Tools::parseUrlParams($item->param))]; | ||
110 | + } | ||
111 | + $result[] = ['label' => Yii::t('app', $submenu->name), 'id' => $submenu->admin_menu_id, 'icon' => 'fa fa-circle-o', 'url' => '#', 'items' => $items]; | ||
112 | + unset($items); | ||
113 | + } else { | ||
114 | + $result[] = ['label' => Yii::t('app', $submenu->name), 'id' => $submenu->admin_menu_id, 'icon' => 'fa fa-circle-o', 'url' => array_merge([$submenu->path], \common\models\Tools::parseUrlParams($submenu->param))]; | ||
115 | + } | ||
116 | + } | ||
117 | + } | ||
118 | + } | ||
119 | + return $result; | ||
120 | + } | ||
121 | + | ||
122 | + public static function buildMenuSelect() | ||
123 | + { | ||
124 | + $result = []; | ||
125 | + $roots = self::find()->where(['admin_menu_pid' => NULL])->with(['adminMenus'])->all(); | ||
126 | + foreach($roots as $root) { | ||
127 | + if($root->adminMenus) { | ||
128 | + $items = []; | ||
129 | + foreach($root->adminMenus as $submenu) { | ||
130 | + $items[] = ['label' => Yii::t('app', $submenu->name), 'id' => $submenu->admin_menu_id]; | ||
131 | + } | ||
132 | + $result[] = ['label' => Yii::t('app', $root->name), 'id' => $root->admin_menu_id, 'items' => $items]; | ||
133 | + unset($items); | ||
134 | + } else { | ||
135 | + $result[] = ['label' => Yii::t('app', $root->name), 'id' => $root->admin_menu_id]; | ||
136 | + } | ||
137 | + } | ||
138 | + return $result; | ||
139 | + } | ||
140 | + | ||
141 | + public function beforeSave($insert) | ||
142 | + { | ||
143 | + if (parent::beforeSave($insert)) { | ||
144 | + if(!$this->admin_menu_pid) { | ||
145 | + $this->admin_menu_pid = NULL; | ||
146 | + } | ||
147 | + return true; | ||
148 | + } else { | ||
149 | + return false; | ||
150 | + } | ||
151 | + } | ||
152 | +} |
1 | +++ a/backend/models/AdminMenuAccessGroup.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "admin_menu_access_group". | ||
9 | + * | ||
10 | + * @property integer $admin_menu_access_group_id | ||
11 | + * @property integer $admin_menu_id | ||
12 | + * @property string $group | ||
13 | + * | ||
14 | + * @property AdminMenu $menu | ||
15 | + * @property AuthRule $group0 | ||
16 | + */ | ||
17 | +class AdminMenuAccessGroup extends \yii\db\ActiveRecord | ||
18 | +{ | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public static function tableName() | ||
23 | + { | ||
24 | + return 'admin_menu_access_group'; | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * @inheritdoc | ||
29 | + */ | ||
30 | + public function rules() | ||
31 | + { | ||
32 | + return [ | ||
33 | + [['admin_menu_id'], 'integer'], | ||
34 | + [['group'], 'string'] | ||
35 | + ]; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * @inheritdoc | ||
40 | + */ | ||
41 | + public function attributeLabels() | ||
42 | + { | ||
43 | + return [ | ||
44 | + 'admin_menu_access_group_id' => Yii::t('app', 'Admin Access Group ID'), | ||
45 | + 'admin_menu_id' => Yii::t('app', 'Admin Menu ID'), | ||
46 | + 'group' => Yii::t('app', 'Group'), | ||
47 | + ]; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * @return \yii\db\ActiveQuery | ||
52 | + */ | ||
53 | + public function getMenu() | ||
54 | + { | ||
55 | + return $this->hasOne(AdminMenu::className(), ['admin_menu_id' => 'admin_menu_id']); | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * @return \yii\db\ActiveQuery | ||
60 | + */ | ||
61 | + public function getGroup0() | ||
62 | + { | ||
63 | + return $this->hasOne(AuthRule::className(), ['name' => 'group']); | ||
64 | + } | ||
65 | +} |
1 | +++ a/backend/models/AdminMenuAccessUser.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use common\models\User; | ||
6 | +use Yii; | ||
7 | + | ||
8 | +/** | ||
9 | + * This is the model class for table "admin_menu_access_user". | ||
10 | + * | ||
11 | + * @property integer $admin_menu_id | ||
12 | + * @property integer $user_id | ||
13 | + * @property integer $admin_menu_access_user_id | ||
14 | + * | ||
15 | + * @property AdminMenu $menu | ||
16 | + * @property User $user | ||
17 | + */ | ||
18 | +class AdminMenuAccessUser extends \yii\db\ActiveRecord | ||
19 | +{ | ||
20 | + /** | ||
21 | + * @inheritdoc | ||
22 | + */ | ||
23 | + public static function tableName() | ||
24 | + { | ||
25 | + return 'admin_menu_access_user'; | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * @inheritdoc | ||
30 | + */ | ||
31 | + public function rules() | ||
32 | + { | ||
33 | + return [ | ||
34 | + [['admin_menu_id', 'user_id'], 'integer'] | ||
35 | + ]; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * @inheritdoc | ||
40 | + */ | ||
41 | + public function attributeLabels() | ||
42 | + { | ||
43 | + return [ | ||
44 | + 'admin_menu_id' => Yii::t('app', 'Admin Menu ID'), | ||
45 | + 'user_id' => Yii::t('app', 'User ID'), | ||
46 | + 'admin_menu_access_user_id' => Yii::t('app', 'Admin Menu Access User ID'), | ||
47 | + ]; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * @return \yii\db\ActiveQuery | ||
52 | + */ | ||
53 | + public function getMenu() | ||
54 | + { | ||
55 | + return $this->hasOne(AdminMenu::className(), ['admin_menu_id' => 'admin_menu_id']); | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * @return \yii\db\ActiveQuery | ||
60 | + */ | ||
61 | + public function getUser() | ||
62 | + { | ||
63 | + return $this->hasOne(User::className(), ['id' => 'user_id']); | ||
64 | + } | ||
65 | +} |
1 | +++ a/backend/models/AdminMenuSearch.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use backend\models\AdminMenu; | ||
9 | + | ||
10 | +/** | ||
11 | + * AdminMenuSearch represents the model behind the search form about `backend\models\AdminMenu`. | ||
12 | + */ | ||
13 | +class AdminMenuSearch extends AdminMenu | ||
14 | +{ | ||
15 | + | ||
16 | + | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function rules() | ||
21 | + { | ||
22 | + return [ | ||
23 | + [['admin_menu_id', 'admin_menu_pid', 'status', 'hide_min', 'sort'], 'integer'], | ||
24 | + [['name', 'path', 'param','parentt'], 'safe'], | ||
25 | + ]; | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * @inheritdoc | ||
30 | + */ | ||
31 | + public function scenarios() | ||
32 | + { | ||
33 | + // bypass scenarios() implementation in the parent class | ||
34 | + return Model::scenarios(); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Creates data provider instance with search query applied | ||
39 | + * | ||
40 | + * @param array $params | ||
41 | + * | ||
42 | + * @return ActiveDataProvider | ||
43 | + */ | ||
44 | + public function search($params) | ||
45 | + { | ||
46 | + $query = AdminMenu::find(); | ||
47 | + | ||
48 | + $dataProvider = new ActiveDataProvider([ | ||
49 | + 'query' => $query, | ||
50 | + 'pagination' => [ | ||
51 | + 'pageSize' => 5 | ||
52 | + ], | ||
53 | + 'sort' => [ | ||
54 | + 'attributes' => [ | ||
55 | + 'admin_menu_id', | ||
56 | + 'name', | ||
57 | + 'path', | ||
58 | + 'param', | ||
59 | + 'status', | ||
60 | + 'hide_min', | ||
61 | + 'parentt' => [ | ||
62 | + 'asc' => ['name' => SORT_ASC], | ||
63 | + 'desc' => ['name' => SORT_DESC], | ||
64 | + 'default' => SORT_DESC | ||
65 | + ] | ||
66 | + ] | ||
67 | + ] | ||
68 | + ]); | ||
69 | + | ||
70 | + $this->load($params); | ||
71 | + | ||
72 | + if (!$this->validate()) { | ||
73 | + // uncomment the following line if you do not want to return any records when validation fails | ||
74 | + // $query->where('0=1'); | ||
75 | + return $dataProvider; | ||
76 | + } | ||
77 | + | ||
78 | + $query->andFilterWhere([ | ||
79 | + 'admin_menu_id' => $this->admin_menu_id, | ||
80 | + 'admin_menu_pid' => $this->admin_menu_pid, | ||
81 | + 'status' => $this->status, | ||
82 | + 'hide_min' => $this->hide_min, | ||
83 | + 'sort' => $this->sort | ||
84 | + ]); | ||
85 | + | ||
86 | + | ||
87 | + $query->andFilterWhere(['like', 'name', $this->name]) | ||
88 | + ->andFilterWhere(['like', 'path', $this->path]) | ||
89 | + ->andFilterWhere(['like', 'param', $this->param]) | ||
90 | + ->andFilterWhere(['in', 'admin_menu_pid', $this->find()->select(['admin_menu_id'])->andFilterWhere(['like', 'name', $this->parentt])->column()]); | ||
91 | + | ||
92 | + return $dataProvider; | ||
93 | + } | ||
94 | +} |
1 | +++ a/backend/models/Import.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use common\models\Tools; | ||
8 | +use common\models\Termin; | ||
9 | +use yii\web\UploadedFile; | ||
10 | + | ||
11 | +/** | ||
12 | + * Import ัะพะฒะฐัะพะฒ | ||
13 | + */ | ||
14 | +class Import extends \yii\db\ActiveRecord | ||
15 | +{ | ||
16 | + public $file; | ||
17 | + | ||
18 | + /** | ||
19 | + * @inheritdoc | ||
20 | + */ | ||
21 | + public function rules() | ||
22 | + { | ||
23 | + return [ | ||
24 | + [['file'], 'file', 'skipOnEmpty' => false, 'extensions' => 'csv', 'maxFiles' => 2], | ||
25 | + ]; | ||
26 | + } | ||
27 | + | ||
28 | + static function importFile ($filename) | ||
29 | + { | ||
30 | + // ัะพะทะดะฐะตะผ ะฟะฐะฟะบั | ||
31 | + if (! is_dir ($path = $_SERVER['DOCUMENT_ROOT'].'/import/')) | ||
32 | + { | ||
33 | + mkdir ($path, 0777, true); | ||
34 | + } | ||
35 | + | ||
36 | + // ะบะพะฟะธััะตะผ ัะฐะนะป | ||
37 | + copy ($filename->tempName, $path.$filename->name); | ||
38 | + | ||
39 | + // ะฟะพ ัะผะพะปัะฐะฝะธั | ||
40 | + // $termin_pid MEGA ะะะกะขะซะะฌ!!! ะญัะพ ะบะฐัะตะณะพัะธั "ะะฐัะฐะปะพะณ ัะพะฒะฐัะพะฒ", | ||
41 | + // ะฟะพะด ะบะพัะพััั ะฟะพะดััะณัััััั ัะตัะผะธะฝั, ะบะพัะพััะต ะฝะฐ ะฝะฐัะปะธ ัะตะฑะต parent | ||
42 | + $termin_pid = 8; | ||
43 | + // $template_id ัะฐะฑะปะพะฝ ะบะฐัะตะณะพัะธะน | ||
44 | + $template_id = 3; | ||
45 | + $language_id = 2; | ||
46 | + $type = 'H'; | ||
47 | + | ||
48 | + // ะผะฐััะธะฒ ะดะปั ะธะผะฟะพััะฟ ัะพะฒะฐัะพะฒ | ||
49 | + $MASS = []; | ||
50 | + | ||
51 | + // ะพัะบััะฒะฐะตะผ ัะฐะนะป ะธ ะฟะตัะตะฑะธัะฐะตะผ | ||
52 | + $fp = fopen ($path.$filename->name, 'r'); | ||
53 | + while ($ROW = fgetcsv ($fp, 10000, ';')) | ||
54 | + { | ||
55 | + // ัะธััะธะผ | ||
56 | + foreach ($ROW as $key => &$value) | ||
57 | + { | ||
58 | + $value = trim ($value) == 'NULL' ? NULL : trim ($value); | ||
59 | + } | ||
60 | + | ||
61 | + $ROW['category_title'] = $ROW[0]; | ||
62 | + $ROW['group_title'] = $ROW[1]; | ||
63 | + $ROW['subgroup_title'] = $ROW[2]; | ||
64 | + | ||
65 | + // ะฟัะพะฒะตััะตะผ ะตัะปะธ ัะตัะตะท "," | ||
66 | + | ||
67 | + // var_dump($array[1]); die; | ||
68 | + | ||
69 | + // ะผะฐััะธะฒ ะดะปั ะฟะพะธัะบะฐ/ะดะพะฑะฐะฒะปะตะฝะธั ัะตัะผะธะฝะฐ | ||
70 | + $basic = [ | ||
71 | + 'type' => $type, | ||
72 | + 'language_id' => $language_id, | ||
73 | + 'template_id' => $template_id, | ||
74 | + ]; | ||
75 | + | ||
76 | + // ะบะฐัะตะณะพัะธั | ||
77 | + if ($ROW['category_title'] == NULL) | ||
78 | + { | ||
79 | + CONTINUE; | ||
80 | + } | ||
81 | + | ||
82 | + $termin_id = Termin::addIfNotExists ($basic + [ | ||
83 | + 'termin_title' => $ROW['category_title'], | ||
84 | + 'termin_pid' => $termin_pid, // MEGA ะะะกะขะซะะฌ!!! | ||
85 | + ]); | ||
86 | + | ||
87 | + // ะฟะพะดะณััะฟะฟะฐ | ||
88 | + if ($ROW['group_title'] != NULL) | ||
89 | + { | ||
90 | + $termin_id = Termin::addIfNotExists ($basic + [ | ||
91 | + 'termin_title' => $ROW['group_title'], | ||
92 | + 'termin_pid' => $termin_id, | ||
93 | + ]); | ||
94 | + } | ||
95 | + | ||
96 | + // ะณััะฟะฟะฐ | ||
97 | + if ($ROW['subgroup_title'] != NULL) | ||
98 | + { | ||
99 | + $termin_id = Termin::addIfNotExists ($basic + [ | ||
100 | + 'termin_title' => $ROW['subgroup_title'], | ||
101 | + 'termin_pid' => $termin_id, | ||
102 | + ]); | ||
103 | + } | ||
104 | + | ||
105 | + } | ||
106 | + | ||
107 | + // ัะดะฐะปัะตะผ ัะฐะนะป | ||
108 | + chmod($path.$filename->name, 0777); | ||
109 | + unlink ($path.$filename->name); | ||
110 | + | ||
111 | +/* | ||
112 | + echo '<pre>'; | ||
113 | + | ||
114 | + var_dump($category); | ||
115 | + var_dump($group); | ||
116 | + var_dump($subgroup); | ||
117 | + | ||
118 | + echo '</pre>'; | ||
119 | + | ||
120 | + // ะะะฉะะ | ||
121 | + // PRODUCT | ||
122 | + ะััะธะบัะป | ||
123 | + ะะฐัะตะณะพัะธั | ||
124 | + ะััะฟะฟะฐ | ||
125 | + ะะพะดะณััะฟะฟะฐ | ||
126 | + ะะฟะธัะฐะฝะธะต | ||
127 | + ะจััะธั -ะบะพะด | ||
128 | + | ||
129 | + // ะกะะ ะะะะงะะะ ะะะ ะะะ. ะะะะฏ | ||
130 | + // ??? | ||
131 | + ะขะพัะณะพะฒะฐั ะผะฐัะบะฐ | ||
132 | + ะัะพะธะทะฒะพะดะธัะตะปั | ||
133 | + ID | ||
134 | + ะะฐะธะผะตะฝะพะฒะฐะฝะธะต | ||
135 | + ะบะพะป-ะฒะพ ะฒ ะฟะฐะบะตัะต | ||
136 | + ะะด. ะะทะผ | ||
137 | + ะพะฟั / ัะพะทะฝะธัะฐ | ||
138 | + ะะธะฐะผะตัั ัะปัะฟะบะธ min | ||
139 | + ะะธะฐะผะตัั ัะปัะฟะบะธ max | ||
140 | + ะะดะธะฝะธัะฐ ะธะทะผะตัะตะฝะธั | ||
141 | + ะฆะฒะตั ัะปัะฟะบะธ | ||
142 | + ะฆะฒะตั ัะปัะฟะบะธ (ัะธะปััั) | ||
143 | + ะฆะฒะตั ะผัะบะพัะธ ัะฒะตั ะผัะบะพัะธ (ัะธะปััั) | ||
144 | + ะะปะธะฝะฐ ะฝะพะถะบะธ min | ||
145 | + ะะปะธะฝะฐ ะฝะพะถะบะธ max | ||
146 | + ะะดะธะฝะธัะฐ ะธะทะผะตัะตะฝะธั | ||
147 | + ะฟัะธะผะตัะฐะฝะธะต | ||
148 | +*/ | ||
149 | + } | ||
150 | + | ||
151 | + public function findTerminOneQuery ($type, $name, $parent_name) | ||
152 | + { | ||
153 | +/* | ||
154 | + return yii::$app->db->createCommand(' | ||
155 | + SELECT | ||
156 | + `termin`.termin_id, `parent`.termin_id as termin_pid | ||
157 | + FROM `termin` | ||
158 | + INNER JOIN `termin_lang` ON `termin_lang`.termin_alias = "'.$name.'" | ||
159 | + INNER JOIN `termin_relation` ON `termin_relation`.termin_id = `termin`.termin_id | ||
160 | + LEFT JOIN ( | ||
161 | + IF NOT EXISTS (SELECT * | ||
162 | + FROM `termin_lang` | ||
163 | + INNER JOIN `termin` ON `termin`.termin_id = `termin_lang`.termin_id | ||
164 | + AND `termin`.type = "'.$type.'" | ||
165 | + WHERE `termin_lang`.termin_alias = "'.$parent_name.'" | ||
166 | + ) | ||
167 | + THEN (SELECT * | ||
168 | + FROM `termin_lang` | ||
169 | + INNER JOIN `termin` ON `termin`.termin_id = `termin_lang`.termin_id | ||
170 | + AND `termin`.type = "'.$type.'" | ||
171 | + WHERE `termin_lang`.termin_alias = "'.$parent_name.'" | ||
172 | + ) | ||
173 | + ELSE (SELECT * | ||
174 | + FROM `termin_lang` | ||
175 | + INNER JOIN `termin` ON `termin`.termin_id = `termin_lang`.termin_id | ||
176 | + AND `termin`.type = "'.$type.'" | ||
177 | + ) | ||
178 | + ) as `parent` ON `parent`.termin_id = `termin_relation`.termin_pid | ||
179 | + WHERE `termin`.type = "'.$type.'" | ||
180 | + ')->queryOne(); | ||
181 | +*/ | ||
182 | + } | ||
183 | + | ||
184 | +} |
1 | +++ a/backend/models/Language.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "language". | ||
9 | + * | ||
10 | + * @property integer $language_id | ||
11 | + * @property string $lang_code | ||
12 | + * @property boolean $is_default | ||
13 | + * @property string $language_name | ||
14 | + * @property boolean $active | ||
15 | + */ | ||
16 | +class Language extends \yii\db\ActiveRecord | ||
17 | +{ | ||
18 | + /** | ||
19 | + * @inheritdoc | ||
20 | + */ | ||
21 | + public static function tableName() | ||
22 | + { | ||
23 | + return 'language'; | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * @inheritdoc | ||
28 | + */ | ||
29 | + public function rules() | ||
30 | + { | ||
31 | + return [ | ||
32 | + [['lang_code', 'language_name'], 'required'], | ||
33 | + [['is_default', 'active'], 'boolean'], | ||
34 | + [['lang_code'], 'string', 'max' => 4], | ||
35 | + [['language_name'], 'string', 'max' => 255] | ||
36 | + ]; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * @inheritdoc | ||
41 | + */ | ||
42 | + public function attributeLabels() | ||
43 | + { | ||
44 | + return [ | ||
45 | + 'language_id' => Yii::t('app', 'Language ID'), | ||
46 | + 'lang_code' => Yii::t('app', 'Lang Code'), | ||
47 | + 'is_default' => Yii::t('app', 'Is Default'), | ||
48 | + 'language_name' => Yii::t('app', 'Language Name'), | ||
49 | + 'active' => Yii::t('app', 'Active'), | ||
50 | + ]; | ||
51 | + } | ||
52 | +} |
1 | +++ a/backend/models/LanguageSearch.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use backend\models\Language; | ||
9 | + | ||
10 | +/** | ||
11 | + * LanguageSearch represents the model behind the search form about `backend\models\Language`. | ||
12 | + */ | ||
13 | +class LanguageSearch extends Language | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['language_id'], 'integer'], | ||
22 | + [['language_code', 'language_name'], 'safe'], | ||
23 | + [['is_default', 'status'], 'boolean'], | ||
24 | + ]; | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * @inheritdoc | ||
29 | + */ | ||
30 | + public function scenarios() | ||
31 | + { | ||
32 | + // bypass scenarios() implementation in the parent class | ||
33 | + return Model::scenarios(); | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * Creates data provider instance with search query applied | ||
38 | + * | ||
39 | + * @param array $params | ||
40 | + * | ||
41 | + * @return ActiveDataProvider | ||
42 | + */ | ||
43 | + public function search($params) | ||
44 | + { | ||
45 | + $query = Language::find(); | ||
46 | + | ||
47 | + $dataProvider = new ActiveDataProvider([ | ||
48 | + 'query' => $query, | ||
49 | + ]); | ||
50 | + | ||
51 | + $this->load($params); | ||
52 | + | ||
53 | + if (!$this->validate()) { | ||
54 | + // uncomment the following line if you do not want to return any records when validation fails | ||
55 | + // $query->where('0=1'); | ||
56 | + return $dataProvider; | ||
57 | + } | ||
58 | + | ||
59 | + $query->andFilterWhere([ | ||
60 | + 'language_id' => $this->language_id, | ||
61 | + 'is_default' => $this->is_default, | ||
62 | + 'status' => $this->status, | ||
63 | + ]); | ||
64 | + | ||
65 | + $query->andFilterWhere(['like', 'language_code', $this->language_code]) | ||
66 | + ->andFilterWhere(['like', 'language_name', $this->language_name]) | ||
67 | + ->andWhere(['status' => '1']) | ||
68 | + ->andWhere(['>', 'language_id', '0']); | ||
69 | + | ||
70 | + return $dataProvider; | ||
71 | + } | ||
72 | + | ||
73 | + public function searchNew($params) | ||
74 | + { | ||
75 | + $query = Language::find(); | ||
76 | + | ||
77 | + $dataProvider = new ActiveDataProvider([ | ||
78 | + 'query' => $query, | ||
79 | + ]); | ||
80 | + | ||
81 | + $this->load($params); | ||
82 | + | ||
83 | + if (!$this->validate()) { | ||
84 | + // uncomment the following line if you do not want to return any records when validation fails | ||
85 | + // $query->where('0=1'); | ||
86 | + return $dataProvider; | ||
87 | + } | ||
88 | + | ||
89 | + $query->andFilterWhere([ | ||
90 | + 'language_id' => $this->language_id, | ||
91 | + 'is_default' => $this->is_default, | ||
92 | + 'status' => $this->status, | ||
93 | + ]); | ||
94 | + | ||
95 | + $query->andFilterWhere(['like', 'language_code', $this->language_code]) | ||
96 | + ->andFilterWhere(['like', 'language_name', $this->language_name]) | ||
97 | + ->andWhere(['status' => '0']); | ||
98 | + | ||
99 | + return $dataProvider; | ||
100 | + } | ||
101 | +} |
1 | +++ a/backend/models/Menu.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "menu". | ||
9 | + * | ||
10 | + * @property integer $menu_id | ||
11 | + * @property integer $menu_pid | ||
12 | + * @property integer $level | ||
13 | + * @property integer $termin_id | ||
14 | + * @property integer $show | ||
15 | + * @property integer $is_open | ||
16 | + * @property integer $menu_location_id | ||
17 | + * @property integer $sortorder | ||
18 | + * @property string $name | ||
19 | + * @property string $url | ||
20 | + * | ||
21 | + * @property Termin $termin | ||
22 | + */ | ||
23 | +class Menu extends \yii\db\ActiveRecord | ||
24 | +{ | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public static function tableName() | ||
29 | + { | ||
30 | + return 'menu'; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * @inheritdoc | ||
35 | + */ | ||
36 | + public function rules() | ||
37 | + { | ||
38 | + return [ | ||
39 | + [['menu_id', 'menu_pid', 'level', 'termin_id', 'status', 'is_open', 'menu_location_id', 'sort'], 'required'], | ||
40 | + [['menu_id', 'menu_pid', 'level', 'termin_id', 'status', 'is_open', 'menu_location_id', 'sort'], 'integer'], | ||
41 | + [['name', 'url'], 'string', 'max' => 250] | ||
42 | + ]; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * @inheritdoc | ||
47 | + */ | ||
48 | + public function attributeLabels() | ||
49 | + { | ||
50 | + return [ | ||
51 | + 'menu_id' => Yii::t('app', 'Menu ID'), | ||
52 | + 'menu_pid' => Yii::t('app', 'Menu Pid'), | ||
53 | + 'level' => Yii::t('app', 'Level'), | ||
54 | + 'termin_id' => Yii::t('app', 'Termin ID'), | ||
55 | + 'status' => Yii::t('app', 'Show'), | ||
56 | + 'is_open' => Yii::t('app', 'Is Open'), | ||
57 | + 'menu_location_id' => Yii::t('app', 'Menu Location ID'), | ||
58 | + 'sort' => Yii::t('app', 'Sortorder'), | ||
59 | + 'name' => Yii::t('app', 'Name'), | ||
60 | + 'url' => Yii::t('app', 'Url'), | ||
61 | + ]; | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * @return \yii\db\ActiveQuery | ||
66 | + */ | ||
67 | + public function getTermin() | ||
68 | + { | ||
69 | + return $this->hasOne(Termin::className(), ['termin_id' => 'termin_id']); | ||
70 | + } | ||
71 | + | ||
72 | + public function getMenuList ($location_name) | ||
73 | + { | ||
74 | + return yii::$app->db->createCommand(' | ||
75 | + SELECT | ||
76 | + menu.menu_id, menu.menu_pid, menu.level, | ||
77 | + termin_lang.termin_title, termin_lang.termin_alias | ||
78 | + FROM menu | ||
79 | + INNER JOIN menu_location ON menu_location.menu_location_id = menu.menu_location_id | ||
80 | + AND menu_location.menu_location_name = \''.$location_name.'\' | ||
81 | + INNER JOIN termin ON termin.termin_id = menu.termin_id | ||
82 | + INNER JOIN termin_lang ON termin_lang.termin_id = menu.termin_id | ||
83 | + AND termin_lang.language_id = '.Yii::$app->params['language_id'].' | ||
84 | + ORDER BY menu.level ASC, menu.sort ASC | ||
85 | + ')->queryAll(); | ||
86 | +/* | ||
87 | + return $this->find() | ||
88 | + ->selectOption('termin_lang.termin_title') | ||
89 | + ->from('menu') | ||
90 | + ->join( | ||
91 | + 'INNER JOIN', | ||
92 | + 'termin_lang.termin_id = menu.termin_id', | ||
93 | + ['language_id' => yii::$app->params['language_id']]) | ||
94 | + ->all(); | ||
95 | + */ | ||
96 | + } | ||
97 | + | ||
98 | + public function getTerminLang() | ||
99 | + { | ||
100 | + return $this->hasOne(TerminLang::className(), ['termin_id' => 'termin_id']); | ||
101 | + } | ||
102 | +} |
1 | +++ a/backend/models/MenuLocation.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "menu_location". | ||
9 | + * | ||
10 | + * @property integer $menu_location_id | ||
11 | + * @property string $menu_location_name | ||
12 | + * | ||
13 | + * @property MenuLocationLang[] $menuLocationLangs | ||
14 | + * @property Language[] $langs | ||
15 | + */ | ||
16 | +class MenuLocation extends \yii\db\ActiveRecord | ||
17 | +{ | ||
18 | + /** | ||
19 | + * @inheritdoc | ||
20 | + */ | ||
21 | + public static function tableName() | ||
22 | + { | ||
23 | + return 'menu_location'; | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * @inheritdoc | ||
28 | + */ | ||
29 | + public function rules() | ||
30 | + { | ||
31 | + return [ | ||
32 | + [['menu_location_id'], 'required'], | ||
33 | + [['menu_location_id'], 'integer'], | ||
34 | + [['menu_location_name'], 'string', 'max' => 250] | ||
35 | + ]; | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * @inheritdoc | ||
40 | + */ | ||
41 | + public function attributeLabels() | ||
42 | + { | ||
43 | + return [ | ||
44 | + 'menu_location_id' => Yii::t('app', 'Menu Location ID'), | ||
45 | + 'menu_location_name' => Yii::t('app', 'Menu Location Name'), | ||
46 | + ]; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * @return \yii\db\ActiveQuery | ||
51 | + */ | ||
52 | + public function getMenuLocationLangs() | ||
53 | + { | ||
54 | + return $this->hasMany(MenuLocationLang::className(), ['menu_location_id' => 'menu_location_id']); | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * @return \yii\db\ActiveQuery | ||
59 | + */ | ||
60 | + public function getLangs() | ||
61 | + { | ||
62 | + return $this->hasMany(Language::className(), ['language_id' => 'language_id'])->viaTable('menu_location_lang', ['menu_location_id' => 'menu_location_id']); | ||
63 | + } | ||
64 | +} |
1 | +++ a/backend/models/MenuLocationLang.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "menu_location_lang". | ||
9 | + * | ||
10 | + * @property integer $menu_location_id | ||
11 | + * @property string $menu_location_title | ||
12 | + * @property integer $language_id | ||
13 | + * | ||
14 | + * @property Language $lang | ||
15 | + * @property MenuLocation $menuLocation | ||
16 | + */ | ||
17 | +class MenuLocationLang extends \yii\db\ActiveRecord | ||
18 | +{ | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public static function tableName() | ||
23 | + { | ||
24 | + return 'menu_location_lang'; | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * @inheritdoc | ||
29 | + */ | ||
30 | + public function rules() | ||
31 | + { | ||
32 | + return [ | ||
33 | + [['menu_location_id', 'menu_location_title', 'language_id'], 'required'], | ||
34 | + [['menu_location_id', 'language_id'], 'integer'], | ||
35 | + [['menu_location_title'], 'string', 'max' => 250] | ||
36 | + ]; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * @inheritdoc | ||
41 | + */ | ||
42 | + public function attributeLabels() | ||
43 | + { | ||
44 | + return [ | ||
45 | + 'menu_location_id' => Yii::t('app', 'Menu Location ID'), | ||
46 | + 'menu_location_title' => Yii::t('app', 'Menu Location Title'), | ||
47 | + 'language_id' => Yii::t('app', 'Lang ID'), | ||
48 | + ]; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * @return \yii\db\ActiveQuery | ||
53 | + */ | ||
54 | + public function getLang() | ||
55 | + { | ||
56 | + return $this->hasOne(Language::className(), ['language_id' => 'language_id']); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * @return \yii\db\ActiveQuery | ||
61 | + */ | ||
62 | + public function getMenuLocation() | ||
63 | + { | ||
64 | + return $this->hasOne(MenuLocation::className(), ['menu_location_id' => 'menu_location_id']); | ||
65 | + } | ||
66 | +} |
1 | +++ a/backend/models/MenuLocationSearch.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use backend\models\MenuLocation; | ||
9 | + | ||
10 | +/** | ||
11 | + * MenuLocationSearch represents the model behind the search form about `backend\models\MenuLocation`. | ||
12 | + */ | ||
13 | +class MenuLocationSearch extends MenuLocation | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['menu_location_id'], 'integer'], | ||
22 | + [['menu_location_name'], '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 = MenuLocation::find(); | ||
45 | + | ||
46 | + $dataProvider = new ActiveDataProvider([ | ||
47 | + 'query' => $query, | ||
48 | + ]); | ||
49 | + | ||
50 | + $this->load($params); | ||
51 | + | ||
52 | + if (!$this->validate()) { | ||
53 | + // uncomment the following line if you do not want to return any records when validation fails | ||
54 | + // $query->where('0=1'); | ||
55 | + return $dataProvider; | ||
56 | + } | ||
57 | + | ||
58 | + $query->andFilterWhere([ | ||
59 | + 'menu_location_id' => $this->menu_location_id, | ||
60 | + ]); | ||
61 | + | ||
62 | + $query->andFilterWhere(['like', 'menu_location_name', $this->menu_location_name]); | ||
63 | + | ||
64 | + return $dataProvider; | ||
65 | + } | ||
66 | +} |
1 | +++ a/backend/models/MenuSearch.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use backend\models\Menu; | ||
9 | + | ||
10 | +/** | ||
11 | + * MenuSearch represents the model behind the search form about `backend\models\Menu`. | ||
12 | + */ | ||
13 | +class MenuSearch extends Menu | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['menu_id', 'menu_pid', 'level', 'termin_id', 'status', 'is_open', 'menu_location_id', 'sort'], 'integer'], | ||
22 | + [['name', 'url'], '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 = Menu::find(); | ||
45 | + | ||
46 | + $dataProvider = new ActiveDataProvider([ | ||
47 | + 'query' => $query, | ||
48 | + ]); | ||
49 | + | ||
50 | + $this->load($params); | ||
51 | + | ||
52 | + if (! $this->validate()) | ||
53 | + { | ||
54 | + // uncomment the following line if you do not want to return any records when validation fails | ||
55 | + // $query->where('0=1'); | ||
56 | + return $dataProvider; | ||
57 | + } | ||
58 | + | ||
59 | + $query->andFilterWhere([ | ||
60 | + 'menu_id' => $this->menu_id, | ||
61 | + 'menu_pid' => $this->menu_pid, | ||
62 | + 'level' => $this->level, | ||
63 | + 'termin_id' => $this->termin_id, | ||
64 | + 'status' => $this->status, | ||
65 | + 'is_open' => $this->is_open, | ||
66 | + 'menu_location_id' => $this->menu_location_id, | ||
67 | + 'sort' => $this->sort, | ||
68 | + ]); | ||
69 | + | ||
70 | + $query->andFilterWhere(['like', 'name', $this->name]) | ||
71 | + ->andFilterWhere(['like', 'url', $this->url]); | ||
72 | + | ||
73 | + return $dataProvider; | ||
74 | + } | ||
75 | +} |
1 | +++ a/backend/models/NewOptions.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "new_options". | ||
9 | + * | ||
10 | + * @property integer $id | ||
11 | + * @property string $model | ||
12 | + * @property integer $model_id | ||
13 | + * @property string $name | ||
14 | + * @property string $template | ||
15 | + * @property integer $parent_id | ||
16 | + */ | ||
17 | +class NewOptions extends \yii\db\ActiveRecord | ||
18 | +{ | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public static function tableName() | ||
23 | + { | ||
24 | + return 'new_options'; | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * @inheritdoc | ||
29 | + */ | ||
30 | + public function rules() | ||
31 | + { | ||
32 | + return [ | ||
33 | + [['model_id', 'parent_id'], 'integer'], | ||
34 | + [['name', 'template'], 'required'], | ||
35 | + [['model', 'name', 'template'], 'string', 'max' => 255] | ||
36 | + ]; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * @inheritdoc | ||
41 | + */ | ||
42 | + public function attributeLabels() | ||
43 | + { | ||
44 | + return [ | ||
45 | + 'id' => Yii::t('app', 'ID'), | ||
46 | + 'model' => Yii::t('app', 'Model'), | ||
47 | + 'model_id' => Yii::t('app', 'Model ID'), | ||
48 | + 'name' => Yii::t('app', 'Name'), | ||
49 | + 'template' => Yii::t('app', 'Template'), | ||
50 | + 'parent_id' => Yii::t('app', 'Parent ID'), | ||
51 | + ]; | ||
52 | + } | ||
53 | +} |
1 | +++ a/backend/models/NewOptionsLang.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "new_options_lang". | ||
9 | + * | ||
10 | + * @property integer $primary | ||
11 | + * @property integer $id | ||
12 | + * @property integer $language_id | ||
13 | + * @property string $value | ||
14 | + */ | ||
15 | +class NewOptionsLang extends \yii\db\ActiveRecord | ||
16 | +{ | ||
17 | + const SCENARIO_ADD = 'add'; | ||
18 | + const SCENARIO_UPDATE = 'update'; | ||
19 | + | ||
20 | + /** | ||
21 | + * @inheritdoc | ||
22 | + */ | ||
23 | + public static function tableName() | ||
24 | + { | ||
25 | + return 'new_options_lang'; | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * @inheritdoc | ||
30 | + */ | ||
31 | + public function rules() | ||
32 | + { | ||
33 | + return [ | ||
34 | + [['id', 'value'], 'required'], | ||
35 | + [['id', 'language_id'], 'integer'], | ||
36 | + [['value'], 'string'] | ||
37 | + ]; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * @inheritdoc | ||
42 | + */ | ||
43 | + public function attributeLabels() | ||
44 | + { | ||
45 | + return [ | ||
46 | + 'primary' => Yii::t('app', 'Primary'), | ||
47 | + 'id' => Yii::t('app', 'ID'), | ||
48 | + 'language_id' => Yii::t('app', 'Lang ID'), | ||
49 | + 'value' => Yii::t('app', 'Value'), | ||
50 | + ]; | ||
51 | + } | ||
52 | +} |
1 | +++ a/backend/models/NewOptionsLangSearch.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use backend\models\NewOptionsLang; | ||
9 | + | ||
10 | +/** | ||
11 | + * NewOptionsLangSearch represents the model behind the search form about `backend\models\NewOptionsLang`. | ||
12 | + */ | ||
13 | +class NewOptionsLangSearch extends NewOptionsLang | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['primary', 'id', 'language_id'], 'integer'], | ||
22 | + [['value'], '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 = NewOptionsLang::find(); | ||
45 | + | ||
46 | + $dataProvider = new ActiveDataProvider([ | ||
47 | + 'query' => $query, | ||
48 | + ]); | ||
49 | + | ||
50 | + $this->load($params); | ||
51 | + | ||
52 | + if (!$this->validate()) { | ||
53 | + // uncomment the following line if you do not want to return any records when validation fails | ||
54 | + // $query->where('0=1'); | ||
55 | + return $dataProvider; | ||
56 | + } | ||
57 | + | ||
58 | + $query->andFilterWhere([ | ||
59 | + 'primary' => $this->primary, | ||
60 | + 'id' => $this->id, | ||
61 | + 'language_id' => $this->language_id, | ||
62 | + ]); | ||
63 | + | ||
64 | + $query->andFilterWhere(['like', 'value', $this->value]); | ||
65 | + | ||
66 | + return $dataProvider; | ||
67 | + } | ||
68 | +} |
1 | +++ a/backend/models/Profile.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use common\models\User; | ||
8 | +use yii\base\Object; | ||
9 | + | ||
10 | +/** | ||
11 | + * ContactForm is the model behind the contact form. | ||
12 | + */ | ||
13 | +class Profile extends Model | ||
14 | +{ | ||
15 | + public $firstname; | ||
16 | + public $lastname; | ||
17 | + public $middlename; | ||
18 | + public $username; | ||
19 | + public $password; | ||
20 | + public $email; | ||
21 | + | ||
22 | + public function __construct() | ||
23 | + { | ||
24 | + parent::__construct(); | ||
25 | + | ||
26 | + $this->lastname = \Yii::$app->user->identity->lastname; | ||
27 | + $this->firstname = \Yii::$app->user->identity->firstname; | ||
28 | + $this->middlename = \Yii::$app->user->identity->middlename; | ||
29 | + $this->username = \Yii::$app->user->identity->username; | ||
30 | + $this->email = \Yii::$app->user->identity->email; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * @inheritdoc | ||
35 | + */ | ||
36 | + public function rules() | ||
37 | + { | ||
38 | + return [ | ||
39 | + // name, email, subject and body are required | ||
40 | + [['firstname', 'lastname', 'email', 'password', 'middlename', 'username'], 'required'], | ||
41 | + // email has to be a valid email address | ||
42 | + ['email', 'email'], | ||
43 | + ]; | ||
44 | + } | ||
45 | + | ||
46 | + public function saveProfile() | ||
47 | + { | ||
48 | + if ($this->load(Yii::$app->request->post())) | ||
49 | + { | ||
50 | + $user = User::find()->where(['id' => Yii::$app->user->identity->id])->one(); | ||
51 | + | ||
52 | + $user->lastname = $this->lastname; | ||
53 | + $user->firstname = $this->firstname; | ||
54 | + $user->middlename = $this->middlename; | ||
55 | + $user->username = $this->username; | ||
56 | + $user->email = $this->email; | ||
57 | + $user->password_hash = Yii::$app->security->generatePasswordHash($this->password); | ||
58 | + | ||
59 | + $user->save(); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | +} |
1 | +++ a/backend/models/Termin.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\Tools; | ||
7 | + | ||
8 | +/** | ||
9 | + * This is the model class for table "termin". | ||
10 | + * | ||
11 | + * @property integer $termin_id | ||
12 | + * @property string $termin_name | ||
13 | + * @property integer $is_book | ||
14 | + * | ||
15 | + * @property Menu[] $menus | ||
16 | + * @property TerminLang[] $terminLangs | ||
17 | + * @property Language[] $langs | ||
18 | + * @property TerminStructure[] $terminStructures | ||
19 | + */ | ||
20 | +class Termin extends \yii\db\ActiveRecord | ||
21 | +{ | ||
22 | + var $termin_title; | ||
23 | + var $termin_pid; | ||
24 | + | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public static function tableName() | ||
29 | + { | ||
30 | + return 'termin'; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * @inheritdoc | ||
35 | + */ | ||
36 | + public function rules() | ||
37 | + { | ||
38 | + return [ | ||
39 | + [['is_book'], 'integer'], | ||
40 | + [['termin_pid'], 'safe'], | ||
41 | + [['termin_title'], 'string', 'max' => 250], | ||
42 | + [['termin_name'], 'string', 'max' => 250] | ||
43 | + ]; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * @inheritdoc | ||
48 | + */ | ||
49 | + public function attributeLabels() | ||
50 | + { | ||
51 | + return [ | ||
52 | + 'termin_id' => Yii::t('app', 'termin'), | ||
53 | + 'termin_name' => Yii::t('app', 'name').' (SYSTEM NAME)', | ||
54 | + 'is_book' => Yii::t('app', 'book'), | ||
55 | + ]; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * ะัะฟะพะปะฝัะตั ะฟะพะธัะบ ะฟะพ ะฟะฐัะฐะผะตััะฐะผ | ||
60 | + * @param array $param ะฟัะธะฝะธะผะฐะตั [termin_id, language_id, return_one, return_field, show_all] | ||
61 | + * @return array one | array all | string ะทะฝะฐัะตะฝะธะต ะผะฐัะธะฒะฐ | ||
62 | + */ | ||
63 | + public function finInfo (array $params = []) | ||
64 | + { | ||
65 | + Tools::ifNotExist ($params, array ( | ||
66 | + 'termin_id' => false, | ||
67 | + 'termin_pid' => false, | ||
68 | + 'language_id' => Yii::$app->params['language_id'], | ||
69 | + 'return_one' => false, | ||
70 | + 'return_field' => false, | ||
71 | + 'show_all' => false, | ||
72 | + 'to_array' => true, | ||
73 | + 'pid_title' => false, | ||
74 | + )); | ||
75 | + | ||
76 | + $WHERE = $SELECT = array (); | ||
77 | + | ||
78 | + $model = new self(); | ||
79 | + | ||
80 | + $SELECT[] = 'termin.*'; | ||
81 | + $query = $model->find(); | ||
82 | + | ||
83 | + if ($params['termin_id']) | ||
84 | + { | ||
85 | + $WHERE['termin.termin_id'] = $params['termin_id']; | ||
86 | + } | ||
87 | + | ||
88 | + // ะฟะตัะตะฒะพะด | ||
89 | + $SELECT[] = 'termin_lang.*'; | ||
90 | + $query->join( | ||
91 | + 'INNER JOIN', 'termin_lang', | ||
92 | + 'termin.termin_id = termin_lang.termin_id' | ||
93 | + ); | ||
94 | + | ||
95 | + if ($params['language_id']) | ||
96 | + { | ||
97 | + $WHERE['termin_lang.language_id'] = $params['language_id']; | ||
98 | + } | ||
99 | + | ||
100 | + // ััััะบัััะฐ | ||
101 | + $SELECT[] = 'termin_structure.*'; | ||
102 | + $query->join( | ||
103 | + 'INNER JOIN', 'termin_structure', | ||
104 | + 'termin.termin_id = termin_structure.termin_id' | ||
105 | + ); | ||
106 | + | ||
107 | + if ($params['termin_pid'] !== false) | ||
108 | + { | ||
109 | + $WHERE['termin_structure.termin_pid'] = $params['termin_pid']; | ||
110 | + } | ||
111 | + | ||
112 | + if ($params['pid_title']) | ||
113 | + { | ||
114 | + $SELECT[] = 'termin_pid_lang.termin_title as termin_pid_title'; | ||
115 | + $query->join( | ||
116 | + 'LEFT JOIN', 'termin_lang as termin_pid_lang', | ||
117 | + 'termin_pid_lang.termin_id = termin_structure.termin_pid' | ||
118 | + ); | ||
119 | + } | ||
120 | + | ||
121 | + // SELECT | ||
122 | + if (! empty ($SELECT)) | ||
123 | + { | ||
124 | + $query->select($SELECT); | ||
125 | + } | ||
126 | + | ||
127 | + // WHERE | ||
128 | + if (! empty ($WHERE)) | ||
129 | + { | ||
130 | + $query->where($WHERE); | ||
131 | + } | ||
132 | + | ||
133 | + if ($params['to_array']) | ||
134 | + { | ||
135 | + $query = $query->asArray(); | ||
136 | + } | ||
137 | + | ||
138 | + if ($params['return_one'] || $params['return_field']) | ||
139 | + { | ||
140 | + | ||
141 | + $result = $params['return_field'] ? $query->one($params['return_field']) : $query->one(); | ||
142 | + } | ||
143 | + else | ||
144 | + { | ||
145 | + $result = $query->all(); | ||
146 | + } | ||
147 | + | ||
148 | + return $result; | ||
149 | + } | ||
150 | + | ||
151 | + /** | ||
152 | + * @return \yii\db\ActiveQuery | ||
153 | + */ | ||
154 | + public function getMenus() | ||
155 | + { | ||
156 | + return $this->hasMany(Menu::className(), ['termin_id' => 'termin_id']); | ||
157 | + } | ||
158 | + | ||
159 | + /** | ||
160 | + * @return \yii\db\ActiveQuery | ||
161 | + */ | ||
162 | + public function getTerminLangs() | ||
163 | + { | ||
164 | + return $this->hasMany(TerminLang::className(), ['termin_id' => 'termin_id']); | ||
165 | + } | ||
166 | + | ||
167 | + /** | ||
168 | + * @return \yii\db\ActiveQuery | ||
169 | + */ | ||
170 | + public function getLangs() | ||
171 | + { | ||
172 | + return $this->hasMany(Language::className(), ['language_id' => 'language_id']) | ||
173 | + ->viaTable('termin_lang', ['termin_id' => 'termin_id']); | ||
174 | + } | ||
175 | + | ||
176 | + /** | ||
177 | + * @return \yii\db\ActiveQuery | ||
178 | + */ | ||
179 | + public function getTerminStructures() | ||
180 | + { | ||
181 | + return $this->hasMany(TerminStructure::className(), ['termin_id' => 'termin_id']); | ||
182 | + } | ||
183 | + | ||
184 | +} |
1 | +++ a/backend/models/TerminLang.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "termin_lang". | ||
9 | + * | ||
10 | + * @property integer $termin_id | ||
11 | + * @property integer $language_id | ||
12 | + * @property string $termin_title | ||
13 | + * @property string $termin_alias | ||
14 | + * | ||
15 | + * @property Language $lang | ||
16 | + * @property Termin $termin | ||
17 | + */ | ||
18 | +class TerminLang extends \yii\db\ActiveRecord | ||
19 | +{ | ||
20 | + /** | ||
21 | + * @inheritdoc | ||
22 | + */ | ||
23 | + public static function tableName() | ||
24 | + { | ||
25 | + return 'termin_lang'; | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * @inheritdoc | ||
30 | + */ | ||
31 | + public function rules() | ||
32 | + { | ||
33 | + return [ | ||
34 | + [['language_id'], 'required'], | ||
35 | + [['language_id'], 'integer'], | ||
36 | + [['termin_title', 'termin_alias'], 'string', 'max' => 250] | ||
37 | + ]; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * @inheritdoc | ||
42 | + */ | ||
43 | + public function attributeLabels() | ||
44 | + { | ||
45 | + return [ | ||
46 | + 'termin_id' => Yii::t('app', 'Termin ID'), | ||
47 | + 'language_id' => Yii::t('app', 'Lang ID'), | ||
48 | + 'termin_title' => Yii::t('app', 'Termin Title'), | ||
49 | + 'termin_alias' => Yii::t('app', 'Termin Alias'), | ||
50 | + ]; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * @return \yii\db\ActiveQuery | ||
55 | + */ | ||
56 | + public function getLang() | ||
57 | + { | ||
58 | + return $this->hasOne(Language::className(), ['language_id' => 'language_id']); | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * @return \yii\db\ActiveQuery | ||
63 | + */ | ||
64 | + public function getTermin() | ||
65 | + { | ||
66 | + return $this->hasOne(Termin::className(), ['termin_id' => 'termin_id']); | ||
67 | + } | ||
68 | +} |
1 | +++ a/backend/models/TerminRelation.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "termin_relation". | ||
9 | + * | ||
10 | + * @property integer $termin_id | ||
11 | + * @property integer $termin_id_related | ||
12 | + */ | ||
13 | +class TerminRelation extends \yii\db\ActiveRecord | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public static function tableName() | ||
19 | + { | ||
20 | + return 'termin_relation'; | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * @inheritdoc | ||
25 | + */ | ||
26 | + public function rules() | ||
27 | + { | ||
28 | + return [ | ||
29 | + [['termin_id', 'termin_id_related'], 'integer'] | ||
30 | + ]; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * @inheritdoc | ||
35 | + */ | ||
36 | + public function attributeLabels() | ||
37 | + { | ||
38 | + return [ | ||
39 | + 'termin_id' => Yii::t('app', 'Termin ID'), | ||
40 | + 'termin_id_related' => Yii::t('app', 'Termin Id Related'), | ||
41 | + ]; | ||
42 | + } | ||
43 | +} |
1 | +++ a/backend/models/TerminSearch.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use backend\models\Termin; | ||
9 | + | ||
10 | +/** | ||
11 | + * TerminSearch represents the model behind the search form about `backend\models\Termin`. | ||
12 | + */ | ||
13 | +class TerminSearch extends Termin | ||
14 | +{ | ||
15 | + var $termin_parent_title; | ||
16 | + | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function rules() | ||
21 | + { | ||
22 | + return [ | ||
23 | + [['termin_id', 'is_book'], 'integer'], | ||
24 | + [['termin_name', 'termin_title', 'termin_parent_title'], 'safe'], | ||
25 | + ]; | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * @inheritdoc | ||
30 | + */ | ||
31 | + public function scenarios() | ||
32 | + { | ||
33 | + // bypass scenarios() implementation in the parent class | ||
34 | + return Model::scenarios(); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Creates data provider instance with search query applied | ||
39 | + * | ||
40 | + * @param array $params | ||
41 | + * | ||
42 | + * @return ActiveDataProvider | ||
43 | + */ | ||
44 | + public function search($params) | ||
45 | + { | ||
46 | + $query = Termin::find(); | ||
47 | + $query->select('*'); | ||
48 | + | ||
49 | + $dataProvider = new ActiveDataProvider([ | ||
50 | + 'query' => $query, | ||
51 | + ]); | ||
52 | + | ||
53 | + $this->load($params); | ||
54 | + | ||
55 | + if (!$this->validate()) { | ||
56 | + // uncomment the following line if you do not want to return any records when validation fails | ||
57 | + // $query->where('0=1'); | ||
58 | + return $dataProvider; | ||
59 | + } | ||
60 | + | ||
61 | + $query->joinWith(['terminLangs', 'terminStructures']); | ||
62 | + | ||
63 | + $query->andFilterWhere([ | ||
64 | + 'termin_id' => $this->termin_id, | ||
65 | + 'is_book' => $this->is_book, | ||
66 | + ]); | ||
67 | + | ||
68 | + $query->andFilterWhere(['like', 'termin_name', $this->termin_name]); | ||
69 | + $query->andFilterWhere(['like', TerminLang::tableName().'.termin_title', $this->termin_title]); | ||
70 | + //$query->andFilterWhere(['like', 'termin_title', $this->termin_title]); | ||
71 | + | ||
72 | + return $dataProvider; | ||
73 | + } | ||
74 | +} |
1 | +++ a/backend/models/TerminStructure.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "termin_structure". | ||
9 | + * | ||
10 | + * @property integer $termin_id | ||
11 | + * @property integer $termin_pid | ||
12 | + * | ||
13 | + * @property Termin $termin | ||
14 | + */ | ||
15 | +class TerminStructure extends \yii\db\ActiveRecord | ||
16 | +{ | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public static function tableName() | ||
21 | + { | ||
22 | + return 'termin_structure'; | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public function rules() | ||
29 | + { | ||
30 | + return [ | ||
31 | + [['termin_id', 'termin_pid'], 'required'], | ||
32 | + [['termin_id', 'termin_pid'], 'integer'] | ||
33 | + ]; | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * @inheritdoc | ||
38 | + */ | ||
39 | + public function attributeLabels() | ||
40 | + { | ||
41 | + return [ | ||
42 | + 'termin_id' => Yii::t('app', 'Termin ID'), | ||
43 | + 'termin_pid' => Yii::t('app', 'Termin Pid'), | ||
44 | + ]; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * @return \yii\db\ActiveQuery | ||
49 | + */ | ||
50 | + public function getTermin() | ||
51 | + { | ||
52 | + return $this->hasOne(Termin::className(), ['termin_id' => 'termin_id']); | ||
53 | + } | ||
54 | + | ||
55 | + public function getParent() | ||
56 | + { | ||
57 | + return $this->hasOne(Termin::className(), ['termin_id' => 'termin_pid']); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * @return \yii\db\ActiveQuery | ||
62 | + */ | ||
63 | + public function getTerminPid() | ||
64 | + { | ||
65 | + return $this->hasMany(TerminLang::className(), ['termin_id' => 'termin_pid']); | ||
66 | + } | ||
67 | +} |
1 | +++ a/backend/models/UserSearch.php | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use common\models\User; | ||
9 | + | ||
10 | +/** | ||
11 | + * UserSearch represents the model behind the search form about `common\models\User`. | ||
12 | + */ | ||
13 | +class UserSearch extends User | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['id', 'status', 'created_at', 'updated_at'], 'integer'], | ||
22 | + [['username', 'lastname', 'firstname', 'middlename', 'auth_key', 'password_hash', 'password_reset_token', 'email'], '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 = User::find(); | ||
45 | + | ||
46 | + $dataProvider = new ActiveDataProvider([ | ||
47 | + 'query' => $query, | ||
48 | + ]); | ||
49 | + | ||
50 | + $this->load($params); | ||
51 | + | ||
52 | + if (!$this->validate()) { | ||
53 | + // uncomment the following line if you do not want to return any records when validation fails | ||
54 | + // $query->where('0=1'); | ||
55 | + return $dataProvider; | ||
56 | + } | ||
57 | + | ||
58 | + $query->andFilterWhere([ | ||
59 | + 'id' => $this->id, | ||
60 | + 'status' => $this->status, | ||
61 | + 'created_at' => $this->created_at, | ||
62 | + 'updated_at' => $this->updated_at, | ||
63 | + ]); | ||
64 | + | ||
65 | + $query->andFilterWhere(['like', 'username', $this->username]) | ||
66 | + ->andFilterWhere(['like', 'lastname', $this->lastname]) | ||
67 | + ->andFilterWhere(['like', 'firstname', $this->firstname]) | ||
68 | + ->andFilterWhere(['like', 'middlename', $this->middlename]) | ||
69 | + ->andFilterWhere(['like', 'auth_key', $this->auth_key]) | ||
70 | + ->andFilterWhere(['like', 'password_hash', $this->password_hash]) | ||
71 | + ->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token]) | ||
72 | + ->andFilterWhere(['like', 'email', $this->email]); | ||
73 | + | ||
74 | + return $dataProvider; | ||
75 | + } | ||
76 | +} |
1 | +++ a/backend/views/_language/_form.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Language */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="language-form"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin(); ?> | ||
14 | + <?php /*?> | ||
15 | + <?= $form->field($model[0], 'lang_code')->textInput(['maxlength' => true]) ?> | ||
16 | + | ||
17 | + <?= $form->field($model[0], 'is_default')->checkBox() ?> | ||
18 | + | ||
19 | + <?= $form->field($model[1], 'lang_title')->textInput(['maxlength' => true])?> | ||
20 | + | ||
21 | + <div class="form-group"> | ||
22 | + <?= Html::submitButton($model[0]->isNewRecord ? Yii::t('app', 'Create', array('name' => 'ะะผั')) : Yii::t('app', 'Update'), ['class' => $model[0]->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
23 | + </div> | ||
24 | + */ ?> | ||
25 | + <?php ActiveForm::end(); ?> | ||
26 | + | ||
27 | +</div> |
1 | +++ a/backend/views/_language/_search.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\LanguageSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="language-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'language_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'lang_code') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'is_default') ?> | ||
23 | + | ||
24 | + <div class="form-group"> | ||
25 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
26 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
27 | + </div> | ||
28 | + | ||
29 | + <?php ActiveForm::end(); ?> | ||
30 | + | ||
31 | +</div> |
1 | +++ a/backend/views/_language/create.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Language */ | ||
8 | + | ||
9 | +/*$this->title = Yii::t('app', 'Create Language'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title;*/ | ||
12 | +echo $this->render('index', $layoutdata); | ||
13 | +?> | ||
14 | +<div class="lang-column-2"> | ||
15 | + | ||
16 | + <?= $this->render('_form', [ | ||
17 | + 'model' => $model | ||
18 | + ]) ?> | ||
19 | +</div> | ||
0 | \ No newline at end of file | 20 | \ No newline at end of file |
1 | +++ a/backend/views/_language/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel backend\models\LanguageSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | +$this->registerCssFile('/backend/web/css/language.css'); | ||
10 | +$this->registerJsFile('/backend/web/js/language.js', ['depends' => ['yii\web\JqueryAsset'], 'position' => $this::POS_END]); | ||
11 | +$this->title = Yii::t('app', 'Settings'); | ||
12 | +$this->params['breadcrumbs'][] = $this->title; | ||
13 | +?> | ||
14 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
15 | + <div class="lang-column-1"> | ||
16 | + <h1><?= Html::encode($this->title) ?></h1> | ||
17 | + <ul class="settings_menu sidebar-menu"> | ||
18 | + <li> | ||
19 | + <a href="#collapseLanguages" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguages"><?php echo \Yii::t('app', 'languages');?></a> | ||
20 | + <ul class="collapse settings_menu_inner" id="collapseLanguages"> | ||
21 | + <li> | ||
22 | + <a href="#collapseLanguagesList" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesList"><?php echo \Yii::t('app', 'languages_list');?></a> | ||
23 | + <?= Html::a('', ['create'], ['class' => 'glyphicon glyphicon-plus']) ?> | ||
24 | + <div class="collapse" id="collapseLanguagesList"> | ||
25 | + <?= GridView::widget([ | ||
26 | + 'dataProvider' => $dataProvider, | ||
27 | + 'filterModel' => $searchModel, | ||
28 | + 'columns' => [ | ||
29 | + ['class' => 'yii\grid\SerialColumn'], | ||
30 | + | ||
31 | + 'language_id', | ||
32 | + 'lang_code', | ||
33 | + 'is_default', | ||
34 | + | ||
35 | + ['class' => 'yii\grid\ActionColumn'], | ||
36 | + ], | ||
37 | + ]); ?> | ||
38 | + </div> | ||
39 | + </li> | ||
40 | + <li> | ||
41 | + <a href="#collapseLanguagesStaticFront" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesStaticFront"><?php echo \Yii::t('app', 'languages_static_front');?></a> | ||
42 | + <div class="collapse" id="collapseLanguagesStaticFront"> | ||
43 | + <?= GridView::widget([ | ||
44 | + 'dataProvider' => $dataProvider, | ||
45 | + 'filterModel' => $searchModel, | ||
46 | + 'columns' => [ | ||
47 | + ['class' => 'yii\grid\SerialColumn'], | ||
48 | + | ||
49 | + 'language_id', | ||
50 | + 'lang_code', | ||
51 | + 'is_default', | ||
52 | + | ||
53 | + ['class' => 'yii\grid\ActionColumn'], | ||
54 | + ], | ||
55 | + ]); ?> | ||
56 | + </div> | ||
57 | + </li> | ||
58 | + <li> | ||
59 | + <a href="#collapseLanguagesStaticAdmin" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesStaticAdmin"><?php echo \Yii::t('app', 'languages_static_admin');?></a> | ||
60 | + <div class="collapse" id="collapseLanguagesStaticAdmin"> | ||
61 | + <?= GridView::widget([ | ||
62 | + 'dataProvider' => $dataProvider, | ||
63 | + 'filterModel' => $searchModel, | ||
64 | + 'columns' => [ | ||
65 | + ['class' => 'yii\grid\SerialColumn'], | ||
66 | + | ||
67 | + 'language_id', | ||
68 | + 'lang_code', | ||
69 | + 'is_default', | ||
70 | + | ||
71 | + ['class' => 'yii\grid\ActionColumn'], | ||
72 | + ], | ||
73 | + ]); ?> | ||
74 | + </div> | ||
75 | + </li> | ||
76 | + </ul> | ||
77 | + </li> | ||
78 | + <li> | ||
79 | + <a href="#collapseRoles" data-toggle="collapse" aria-expanded="false" aria-controls="collapseRoles"><?php echo \Yii::t('app', 'roles');?></a> | ||
80 | + <ul class="collapse settings_menu_inner" id="collapseRoles"> | ||
81 | + <li>Ipsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum Ipsum</li> | ||
82 | + <li>Ipsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum Ipsum</li> | ||
83 | + </ul> | ||
84 | + </li> | ||
85 | + </ul> | ||
86 | + </div> |
1 | +++ a/backend/views/_language/update.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model backend\models\Language */ | ||
7 | + | ||
8 | +/*$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Language', | ||
10 | +]) . ' ' . $model->language_id; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->language_id, 'url' => ['view', 'id' => $model->language_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update');*/ | ||
14 | +echo $this->render('index', $layoutdata); | ||
15 | +?> | ||
16 | +<div class="lang-column-2"> | ||
17 | + | ||
18 | + <?= $this->render('_form', [ | ||
19 | + 'model' => $model, | ||
20 | + ]) ?> | ||
21 | + | ||
22 | +</div> |
1 | +++ a/backend/views/_language/view.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Language */ | ||
8 | + | ||
9 | +/*$this->title = $model->language_id; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title;*/ | ||
12 | +echo $this->render('index', $layoutdata); | ||
13 | +?> | ||
14 | +<div class="lang-column-2"> | ||
15 | + <?= DetailView::widget([ | ||
16 | + 'model' => $model, | ||
17 | + 'attributes' => [ | ||
18 | + 'language_id', | ||
19 | + 'lang_code', | ||
20 | + 'is_default', | ||
21 | + ], | ||
22 | + ]) ?> | ||
23 | + <p> | ||
24 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->language_id], ['class' => 'btn btn-primary']) ?> | ||
25 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->language_id], [ | ||
26 | + 'class' => 'btn btn-danger', | ||
27 | + 'data' => [ | ||
28 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | ||
29 | + 'method' => 'post', | ||
30 | + ], | ||
31 | + ]) ?> | ||
32 | + </p> | ||
33 | +</div> | ||
0 | \ No newline at end of file | 34 | \ No newline at end of file |
1 | +++ a/backend/views/admin-menu/_form.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use backend\models\AdminMenu; | ||
4 | +use common\models\Tools; | ||
5 | +use yii\helpers\Html; | ||
6 | +use yii\widgets\ActiveForm; | ||
7 | + | ||
8 | +/* @var $this yii\web\View */ | ||
9 | +/* @var $model backend\models\AdminMenu */ | ||
10 | +/* @var $form yii\widgets\ActiveForm */ | ||
11 | +?> | ||
12 | + | ||
13 | +<div class="admin-menu-form"> | ||
14 | + | ||
15 | + <?php $form = ActiveForm::begin(); ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'name')->textInput() ?> | ||
18 | + | ||
19 | + <?= $form->field($model, 'status')->checkbox() ?> | ||
20 | + | ||
21 | + <?= $form->field($model, 'hide_min')->checkbox() ?> | ||
22 | + | ||
23 | + <?= $form->field($model, 'path')->textInput() ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'param')->textInput() ?> | ||
26 | + | ||
27 | + <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> | ||
28 | + <div class="panel panel-default"> | ||
29 | + <div class="panel-heading" role="tab" id="headingOne"> | ||
30 | + <h4 class="panel-title"> | ||
31 | + <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> | ||
32 | + <?= Yii::t('app', 'Parent menu item') ?> | ||
33 | + </a> | ||
34 | + </h4> | ||
35 | + </div> | ||
36 | + <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne"> | ||
37 | + <ul class="list-group checkboxer"> | ||
38 | + <?php | ||
39 | + $roots = AdminMenu::buildMenuSelect(); | ||
40 | + echo $form->field($model, 'admin_menu_pid', ['options' => ['class' => 'form-group list-group-item level0 checkboxer_container', 'tag' => 'li']])->error(false)->radio(['value' => 0, 'uncheck' => null, 'label' => Yii::t('app', 'root'), 'labelOptions' => ['class' => 'checkboxer_label']]); | ||
41 | + foreach($roots as $root) { | ||
42 | + echo $form->field($model, 'admin_menu_pid', ['options' => ['class' => 'form-group list-group-item level1 checkboxer_container', 'tag' => 'li']])->error(false)->radio(['value' => $root['id'], 'uncheck' => null, 'label' => Yii::t('app', $root['label']), 'labelOptions' => ['class' => 'checkboxer_label']]); | ||
43 | + if($root['items']) { | ||
44 | + foreach($root['items'] as $submenu) { | ||
45 | + echo $form->field($model, 'admin_menu_pid', ['options' => ['class' => 'form-group list-group-item level2 checkboxer_container', 'tag' => 'li']])->error(false)->radio(['value' => $submenu['id'], 'uncheck' => null, 'label' => Yii::t('app', $submenu['label']), 'labelOptions' => ['class' => 'checkboxer_label']]); | ||
46 | + } | ||
47 | + } | ||
48 | + } | ||
49 | + ?> | ||
50 | + </ul> | ||
51 | + </div> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + | ||
55 | + <div class="form-group"> | ||
56 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => ($model->isNewRecord ? 'btn btn-success' : 'btn btn-primary') . ' btn-flat']) ?> | ||
57 | + </div> | ||
58 | + | ||
59 | + <?php ActiveForm::end(); ?> | ||
60 | + | ||
61 | +</div> |
1 | +++ a/backend/views/admin-menu/_search.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\AdminMenuSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="admin-menu-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, 'parent_id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'active') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'hide_min') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'sort') ?> | ||
27 | + | ||
28 | + <?php // echo $form->field($model, 'name') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'path') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'params') ?> | ||
33 | + | ||
34 | + <div class="form-group"> | ||
35 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
36 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
37 | + </div> | ||
38 | + | ||
39 | + <?php ActiveForm::end(); ?> | ||
40 | + | ||
41 | +</div> |
1 | +++ a/backend/views/admin-menu/create.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\AdminMenu */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Admin Menu'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Admin Menus'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="admin-menu-create"> | ||
14 | + <div class="box box-primary"> | ||
15 | + <div class="box-body"> | ||
16 | + <?= $this->render('_form', [ | ||
17 | + 'model' => $model, | ||
18 | + ]) ?> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + | ||
22 | +</div> |
1 | +++ a/backend/views/admin-menu/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel backend\models\AdminMenuSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Admin Menus'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="admin-menu-index box box-primary"> | ||
14 | + | ||
15 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
16 | + | ||
17 | + <?= GridView::widget([ | ||
18 | + 'dataProvider' => $dataProvider, | ||
19 | + 'filterModel' => $searchModel, | ||
20 | + 'showFooter' => true, | ||
21 | + 'layout' => "<div class='box-header with-border admin_grid_action'> | ||
22 | + <div class='action_link'>" | ||
23 | + .Html::a(Yii::t('app', 'Create Admin Menu'), ['create'], ['class' => 'btn btn-success btn-flat']). | ||
24 | + "</div> | ||
25 | + <div class='pull-right'> | ||
26 | + {pager} | ||
27 | + </div> | ||
28 | + </div> | ||
29 | + <div class='box-body no-padding table-responsive'> | ||
30 | + {items} | ||
31 | + </div> | ||
32 | + <div class='box-footer admin_grid_action'> | ||
33 | + <div class='action_link'>" | ||
34 | + .Html::a(Yii::t('app', 'Create Admin Menu'), ['create'], ['class' => 'btn btn-success btn-flat']). | ||
35 | + "</div> | ||
36 | + <div class='pull-right'> | ||
37 | + {pager} | ||
38 | + </div> | ||
39 | + </div>", | ||
40 | + 'columns' => [ | ||
41 | + ['class' => 'yii\grid\ActionColumn'], | ||
42 | + 'admin_menu_id', | ||
43 | + 'name', | ||
44 | + 'path', | ||
45 | + 'param', | ||
46 | + [ | ||
47 | + 'format' => 'raw', | ||
48 | + 'filter' => [ | ||
49 | + '1'=>'ะัะพะฑัะฐะถะฐัััั', | ||
50 | + '0'=>'ะกะบััััะต', | ||
51 | + ], | ||
52 | + 'value' => function($data){ | ||
53 | + if($data->status){ | ||
54 | + $status_img = '<i style="color: #008000" class="glyphicon glyphicon-ok"></i>'; | ||
55 | + } else { | ||
56 | + $status_img = '<i style="color: red" class="glyphicon glyphicon-remove"></i>'; | ||
57 | + } | ||
58 | + return $status_img; | ||
59 | + }, | ||
60 | + 'attribute'=>'status', | ||
61 | + ], | ||
62 | + [ | ||
63 | + 'attribute' => 'parentt', | ||
64 | + 'content' => | ||
65 | + function($model, $key, $index, $column) { | ||
66 | + if($model->parent->admin_menu_id) { | ||
67 | + return $model->parent->name; | ||
68 | + } else { | ||
69 | + return '<i class="small">'.Yii::t('app', 'ะะพัะฝะตะฒะพะน ัะปะตะผะตะฝั').'</i>'; | ||
70 | + } | ||
71 | + } | ||
72 | + ], | ||
73 | + [ | ||
74 | + 'format' => 'raw', | ||
75 | + 'filter' => [ | ||
76 | + '1'=>'ะัะพะฑัะฐะถะฐัััั', | ||
77 | + '0'=>'ะกะบััััะต', | ||
78 | + ], | ||
79 | + 'value' => function($data){ | ||
80 | + if($data->hide_min){ | ||
81 | + $status_img = '<i style="color: #008000" class="glyphicon glyphicon-ok"></i>'; | ||
82 | + } else { | ||
83 | + $status_img = '<i style="color: red" class="glyphicon glyphicon-remove"></i>'; | ||
84 | + } | ||
85 | + return $status_img; | ||
86 | + }, | ||
87 | + 'attribute'=>'hide_min', | ||
88 | + ], | ||
89 | + ], | ||
90 | + ]); ?> | ||
91 | + | ||
92 | +</div> |
1 | +++ a/backend/views/admin-menu/update.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model backend\models\AdminMenu */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update') . ': ' . $model->name; | ||
9 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Admin Menus'), 'url' => ['index']]; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->admin_menu_id]]; | ||
11 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
12 | +?> | ||
13 | +<div class="admin-menu-update"> | ||
14 | + | ||
15 | + <?= $this->render('_form', [ | ||
16 | + 'model' => $model, | ||
17 | + ]) ?> | ||
18 | + | ||
19 | +</div> |
1 | +++ a/backend/views/admin-menu/view.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\AdminMenu */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Admin Menus').': '.$model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Admin Menus'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | + | ||
14 | +<div class="admin-menu-view box box-primary"> | ||
15 | +<?= DetailView::widget([ | ||
16 | + 'model' => $model, | ||
17 | + 'attributes' => [ | ||
18 | + 'admin_menu_id', | ||
19 | + 'admin_menu_pid', | ||
20 | + 'status', | ||
21 | + 'hide_min', | ||
22 | + 'sort', | ||
23 | + 'name', | ||
24 | + 'path', | ||
25 | + 'param', | ||
26 | + ], | ||
27 | + ]) ?> | ||
28 | + | ||
29 | + <div class="box-footer with-border"> | ||
30 | + <p> | ||
31 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->admin_menu_id], ['class' => 'btn btn-primary btn-flat']) ?> | ||
32 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->admin_menu_id], [ | ||
33 | + 'class' => 'btn btn-danger btn-flat', | ||
34 | + 'data' => [ | ||
35 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | ||
36 | + 'method' => 'post', | ||
37 | + ], | ||
38 | + ]) ?> | ||
39 | + <?= Html::a(Yii::t('app', 'Back'), ['index'], ['class' => 'btn btn-default btn-flat']) ?> | ||
40 | + </p> | ||
41 | + </div> | ||
42 | + | ||
43 | +</div> | ||
0 | \ No newline at end of file | 44 | \ No newline at end of file |
1 | +++ a/backend/views/blog/articles.php | ||
1 | +<?php | ||
2 | +use yii\grid\ActionColumn; | ||
3 | +use yii\grid\Column; | ||
4 | +use yii\grid\GridView; | ||
5 | +use common\modules\blog\models\Article; | ||
6 | +use common\models\Language; | ||
7 | + | ||
8 | +echo GridView::widget([ | ||
9 | + 'dataProvider' => $dataProvider, | ||
10 | + 'columns' => [ | ||
11 | + 'id', | ||
12 | + 'code', | ||
13 | + 'create_at', | ||
14 | + [ | ||
15 | + 'value' => function($data) { | ||
16 | + return $data->author0->firstname.' '.$data->author0->lastname; | ||
17 | + }, | ||
18 | + 'header' => Yii::t('app', 'Author') | ||
19 | + ], | ||
20 | + [ | ||
21 | + 'class' => Column::className(), | ||
22 | + 'header' => Yii::t('app', 'Name'), | ||
23 | + 'content' => function($model, $key, $index, $column) { | ||
24 | + return $model->getArticleLangs()->where(['language_id' => Language::getDefaultLang()->language_id])->one()->name; | ||
25 | + } | ||
26 | + ], | ||
27 | + [ | ||
28 | + 'class' => ActionColumn::className(), | ||
29 | + 'template' => '{update} {delete}' | ||
30 | + ] | ||
31 | + ] | ||
32 | +]); | ||
0 | \ No newline at end of file | 33 | \ No newline at end of file |
1 | +++ a/backend/views/import/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | +use yii\helpers\ArrayHelper; | ||
6 | +use kartik\select2\Select2; | ||
7 | + | ||
8 | +/* @var $this yii\web\View */ | ||
9 | +/* @var $model common\models\Menu */ | ||
10 | +/* @var $form yii\widgets\ActiveForm */ | ||
11 | +?> | ||
12 | + | ||
13 | +<div class="menu-form"> | ||
14 | + | ||
15 | + <?php | ||
16 | + $form = ActiveForm::begin([ | ||
17 | + 'action' => '/backend/web/index.php?r=import/upload', | ||
18 | + 'options' => [ | ||
19 | + 'enctype' => 'multipart/form-data', | ||
20 | + 'class' => 'import', | ||
21 | + ] | ||
22 | + ]); | ||
23 | + ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'file[]')->fileInput(['multiple' => true ]) ?> | ||
26 | + | ||
27 | + <div class="form-group"> | ||
28 | + <?= Html::submitButton('button', ['class' => 'btn btn-primary']) ?> | ||
29 | + </div> | ||
30 | + | ||
31 | + <?php ActiveForm::end(); ?> | ||
32 | + | ||
33 | +</div> |
1 | +++ a/backend/views/language/_form_adress.php | ||
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\Option */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="option-form"> | ||
12 | + <?php $form = ActiveForm::begin(); ?> | ||
13 | + <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | ||
14 | + <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | ||
15 | + <?php if($multiple) {?><p class="text-right"><span class="glyphicon glyphicon-plus add_row"></span></p><?php }?> | ||
16 | + <?php if(empty($models)) { | ||
17 | + ?> | ||
18 | + <div class="form-group" id="main_row"> | ||
19 | + <div class="form-wrapper"> | ||
20 | + <?php foreach($fields as $index => $field) { | ||
21 | + ?> | ||
22 | + <div class="fields_block"> | ||
23 | + <label for="Option[0][value][<?=$field['name']?>]" class="pull-left"><?php echo Yii::t('app', $field['name']); ?></label> | ||
24 | + <?php | ||
25 | + if($field['translate']) { ?><p class="text-right"><span class="glyphicon glyphicon-globe add_lang pull-right"></span></p><?php } | ||
26 | + ?> | ||
27 | + <div class="clearfix"></div> | ||
28 | + <input type="hidden" name="Option[0][<?=$field['name']?>][template]" value="<?=$field['template']?>"/> | ||
29 | + <input type="hidden" name="Option[0][<?=$field['name']?>][translate]" value="<?=$field['translate']?>"/> | ||
30 | + <input type="<?=$field['template']?>" name="Option[0][value][<?=$field['name']?>]" class="form-control required main_input" required/> | ||
31 | + <?php | ||
32 | + if($field['translate']) { | ||
33 | + ?> | ||
34 | + <div class="lang_inputs" style="display: none"> | ||
35 | + <?php | ||
36 | + foreach($model->getLangs() as $lang) { | ||
37 | + ?> | ||
38 | + <div class="form-group"> | ||
39 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
40 | + <div class="col-xs-11"><input type="<?=$field['template']?>" name="Option[0][lang][<?=$field['name']?>][<?=$lang['language_id']?>]" class="form-control" /></div> | ||
41 | + <div class="clearfix"></div> | ||
42 | + </div> | ||
43 | + <?php | ||
44 | + } | ||
45 | + ?> | ||
46 | + </div> | ||
47 | + <?php | ||
48 | + } | ||
49 | + ?> | ||
50 | + </div> | ||
51 | + <?php | ||
52 | + }?> | ||
53 | + <p class="text-right"><span class="glyphicon glyphicon-minus remove_lang pull-right"></span></p> | ||
54 | + <hr /> | ||
55 | + </div> | ||
56 | + </div> | ||
57 | + <?php | ||
58 | + } else { | ||
59 | + $first = 1; | ||
60 | + foreach($models as $index => $row) { | ||
61 | + foreach($row as $key => $value) { | ||
62 | + if(!$modellang[$index][$key][0]->hasErrors('value')) { | ||
63 | + continue; | ||
64 | + } | ||
65 | + if($first) { | ||
66 | + ?> | ||
67 | + <div class="form-group" id="main_row"> | ||
68 | + <?php | ||
69 | + } | ||
70 | + ?> | ||
71 | + <div class="form-wrapper"> | ||
72 | + <div class="fields_block"> | ||
73 | + <label for="Option[0][<?=$key?>]"><?php echo Yii::t('app', $key); ?></label> | ||
74 | + <input type="hidden" name="Option[0][template]" value="<?=$value->template?>"/> | ||
75 | + <input type="<?=$value->template?>" name="Option[0][value][<?=$key?>]" class="form-control required main_input" required value="<?=$modellang[$index][$key][0]->value?>"/> | ||
76 | + <div class="help-block"><?=$modellang[$index][$key][0]->getFirstError('value')?></div> | ||
77 | + <?php | ||
78 | + if($field['translate']) { | ||
79 | + ?> | ||
80 | + <div class="lang_inputs"> | ||
81 | + <?php | ||
82 | + foreach($value->getLangs() as $lang) { | ||
83 | + ?> | ||
84 | + <div class="form-group"> | ||
85 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
86 | + <div class="col-xs-11"><input type="<?=$value->template?>" name="Option[0][lang][<?=$key?>][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$index][$key][$lang['language_id']]->value?>"/></div> | ||
87 | + </div> | ||
88 | + <?php | ||
89 | + } | ||
90 | + ?> | ||
91 | + </div> | ||
92 | + <?php | ||
93 | + } ?> | ||
94 | + </div> | ||
95 | + <?php | ||
96 | + if($first) { | ||
97 | + ?> | ||
98 | + <p class="text-right"><span class="glyphicon glyphicon-minus remove_lang pull-right"></span></p> | ||
99 | + <hr /> | ||
100 | + </div> | ||
101 | + </div> | ||
102 | + <?php | ||
103 | + $first = 0; | ||
104 | + } | ||
105 | + ?> | ||
106 | + <?php | ||
107 | + } | ||
108 | + } | ||
109 | + }?> | ||
110 | + | ||
111 | + <div class="form-group"> | ||
112 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
113 | + </div> | ||
114 | + | ||
115 | + <?php ActiveForm::end(); ?> | ||
116 | + <script> | ||
117 | + var form = '<?= $form->getId()?>'; | ||
118 | + </script> | ||
119 | +</div> |
1 | +++ a/backend/views/language/_form_adress_edit.php | ||
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\Option */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="option-form"> | ||
12 | + <?php $form = ActiveForm::begin(); ?> | ||
13 | + <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | ||
14 | + <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | ||
15 | + <?php foreach($models as $id => $row) { | ||
16 | + ?> | ||
17 | + <label for="Option[<?=$id?>][<?=$key?>]"><?php echo Yii::t('app', $row->name); ?></label> | ||
18 | + <input type="hidden" name="Option[<?=$id?>][id]" value="<?=$id?>" /> | ||
19 | + <input type="hidden" name="Option[<?=$id?>][template]" value="<?=$row->template?>"/> | ||
20 | + <input type="<?=$row->template?>" name="Option[<?=$id?>][value][<?=$row->name?>]" class="form-control required" required value="<?=$modellang[$id][0]->value?>"/> | ||
21 | + <?php if($row->hasErrors()) { ?><div class="help-block"><?php echo $modellang[$id][0]->getFirstError('value');?></div> <?php } ?> | ||
22 | + <?php | ||
23 | + if($row->translate) { | ||
24 | + foreach($row->getLangs() as $language_id => $lang) { | ||
25 | + ?> | ||
26 | + <div class="form-group"> | ||
27 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
28 | + <div class="col-xs-11"><input type="<?=$row->template?>" name="Option[<?=$id?>][lang][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$id][$lang['language_id']]->value?>"/></div> | ||
29 | + </div> | ||
30 | + <?php | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
34 | + }?> | ||
35 | + | ||
36 | + <div class="form-group"> | ||
37 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
38 | + </div> | ||
39 | + | ||
40 | + <?php ActiveForm::end(); ?> | ||
41 | +</div> |
1 | +++ a/backend/views/language/_search.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\LanguageSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="language-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'language_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'lang_code') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'is_default')->checkbox() ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'language_name') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'active')->checkbox() ?> | ||
27 | + | ||
28 | + <div class="form-group"> | ||
29 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
30 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
31 | + </div> | ||
32 | + | ||
33 | + <?php ActiveForm::end(); ?> | ||
34 | + | ||
35 | +</div> |
1 | +++ a/backend/views/language/create.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | +use yii\grid\Column; | ||
6 | + | ||
7 | +/* @var $this yii\web\View */ | ||
8 | +/* @var $searchModel backend\models\LanguageSearch */ | ||
9 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
10 | + | ||
11 | +$this->title = Yii::t('app', 'Languages'); | ||
12 | +$this->params['breadcrumbs'][] = $this->title; | ||
13 | +echo $this->render('layout'); | ||
14 | +?> | ||
15 | +<div class="lang-column-2"> | ||
16 | + | ||
17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
18 | + | ||
19 | + <?= GridView::widget([ | ||
20 | + 'dataProvider' => $dataProvider, | ||
21 | + 'filterModel' => $searchModel, | ||
22 | + 'layout' => "{items}", | ||
23 | + 'columns' => [ | ||
24 | + [ | ||
25 | + 'class' => Column::className(), | ||
26 | + 'content' => function($model, $key, $index, $column) { | ||
27 | + return '<span class="f32"><span class="flag '.$model->country_code.'"></span></span>'; | ||
28 | + } | ||
29 | + ], | ||
30 | + 'language_name', | ||
31 | + 'lang_code', | ||
32 | + [ | ||
33 | + 'class' => 'yii\grid\ActionColumn', | ||
34 | + 'template' => '{create}', | ||
35 | + 'buttons' => [ | ||
36 | + 'create' => function ($url, $model, $key) { | ||
37 | + return Html::a('', $url, ['class' => 'glyphicon glyphicon-plus', 'title' => Yii::t('app', 'Create Language')]); | ||
38 | + }, | ||
39 | + ], | ||
40 | + ] | ||
41 | + ] | ||
42 | + ]); ?> | ||
43 | + | ||
44 | + <p class="text-right"> | ||
45 | + <?= Html::a(Yii::t('app', 'Cancel'), ['index'], ['class' => 'btn btn-success']) ?> | ||
46 | + </p> | ||
47 | + | ||
48 | +</div> |
1 | +++ a/backend/views/language/create_adress.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model frontend\models\Option */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Option'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +echo $this->render('layout'); | ||
13 | +?> | ||
14 | +<div class="lang-column-2"> | ||
15 | + <?php foreach($forms as $oneform) { | ||
16 | + echo $this->render('_form_adress', $oneform); | ||
17 | + }?> | ||
18 | + | ||
19 | +</div> |
1 | +++ a/backend/views/language/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | +use yii\grid\Column; | ||
6 | + | ||
7 | +/* @var $this yii\web\View */ | ||
8 | +/* @var $searchModel backend\models\LanguageSearch */ | ||
9 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
10 | + | ||
11 | +$this->title = Yii::t('app', 'Languages'); | ||
12 | +$this->params['breadcrumbs'][] = $this->title; | ||
13 | +echo $this->render('layout'); | ||
14 | +?> | ||
15 | +<div class="lang-column-2"> | ||
16 | + | ||
17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
18 | + | ||
19 | + <?= GridView::widget([ | ||
20 | + 'dataProvider' => $dataProvider, | ||
21 | + 'filterModel' => $searchModel, | ||
22 | + 'layout' => "{items}", | ||
23 | + 'columns' => [ | ||
24 | + [ | ||
25 | + 'class' => Column::className(), | ||
26 | + 'content' => function($model, $key, $index, $column) { | ||
27 | + return '<span class="f32"><span class="flag '.$model->country_code.'"></span></span>'; | ||
28 | + } | ||
29 | + ], | ||
30 | + 'language_name', | ||
31 | + 'language_code', | ||
32 | + 'is_default:boolean', | ||
33 | + [ | ||
34 | + 'class' => 'yii\grid\ActionColumn', | ||
35 | + 'template' => '{default} {delete}', | ||
36 | + 'buttons' => [ | ||
37 | + 'default' => function ($url, $model, $key) { | ||
38 | + return Html::a('', $model->is_default?'#':$url, ['class' => $model->is_default?'glyphicon glyphicon-star':'glyphicon glyphicon-star-empty', 'title' => Yii::t('app', 'Make default')]); | ||
39 | + }, | ||
40 | + ], | ||
41 | + ] | ||
42 | + ] | ||
43 | + ]); ?> | ||
44 | + | ||
45 | + <p class="text-right"> | ||
46 | + <?= Html::a(Yii::t('app', 'Create Language'), ['create'], ['class' => 'btn btn-success']) ?> | ||
47 | + </p> | ||
48 | + | ||
49 | +</div> |
1 | +++ a/backend/views/language/layout.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel backend\models\LanguageSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | +$this->registerCssFile('/backend/web/css/language.css'); | ||
10 | +$this->registerJsFile('/backend/web/js/language.js', ['depends' => ['yii\web\JqueryAsset'], 'position' => $this::POS_END]); | ||
11 | +$this->title = Yii::t('app', 'Settings'); | ||
12 | +$this->params['breadcrumbs'][] = $this->title; | ||
13 | +?> | ||
14 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
15 | + <div class="lang-column-1"> | ||
16 | + <h1><?= Html::encode($this->title) ?></h1> | ||
17 | + <ul class="settings_menu sidebar-menu"> | ||
18 | + <li> | ||
19 | + <a href="#collapseLanguages" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguages"><?php echo \Yii::t('app', 'languages');?></a> | ||
20 | + <ul class="collapse settings_menu_inner" id="collapseLanguages"> | ||
21 | + <li> | ||
22 | + <?= Html::a(Yii::t('app', 'Language list'), ['index']) ?> | ||
23 | + </li> | ||
24 | + <li> | ||
25 | + <a href="#collapseLanguagesStaticFront" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesStaticFront"><?php echo \Yii::t('app', 'languages_static_front');?></a> | ||
26 | + </li> | ||
27 | + <li> | ||
28 | + <a href="#collapseLanguagesStaticAdmin" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesStaticAdmin"><?php echo \Yii::t('app', 'languages_static_admin');?></a> | ||
29 | + </li> | ||
30 | + </ul> | ||
31 | + </li> | ||
32 | + <li> | ||
33 | + <a href="#collapseRoles" data-toggle="collapse" aria-expanded="false" aria-controls="collapseRoles"><?php echo \Yii::t('app', 'roles');?></a> | ||
34 | + <ul class="collapse settings_menu_inner" id="collapseRoles"> | ||
35 | + <li>Ipsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum Ipsum</li> | ||
36 | + <li>Ipsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum Ipsum</li> | ||
37 | + </ul> | ||
38 | + </li> | ||
39 | + <li> | ||
40 | + <?= Html::a(Yii::t('app', 'adress'), ['view-adress'])?> | ||
41 | + </li> | ||
42 | + </ul> | ||
43 | + </div> |
1 | +++ a/backend/views/language/update.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model backend\models\Language */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Language', | ||
10 | +]) . ' ' . $model->language_id; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->language_id, 'url' => ['view', 'id' => $model->language_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="language-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
1 | +++ a/backend/views/language/update_adress.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model frontend\models\Option */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Option', | ||
10 | +]) . ' ' . $forms[0]['models'][\Yii::$app->request->get('id')]->name; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $forms[0]['models'][\Yii::$app->request->get('id')]->name, 'url' => ['view', 'id' => $forms[0]['models'][\Yii::$app->request->get('id')]->option_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +echo $this->render('layout'); | ||
15 | +?> | ||
16 | +<div class="lang-column-2"> | ||
17 | + <?php foreach($forms as $oneform) { | ||
18 | + echo $this->render('_form_adress_edit', $oneform); | ||
19 | + }?> | ||
20 | + | ||
21 | +</div> |
1 | +++ a/backend/views/language/view.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Language */ | ||
8 | + | ||
9 | +$this->title = $model->language_id; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="language-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->language_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->language_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 | + 'language_id', | ||
32 | + 'lang_code', | ||
33 | + 'is_default:boolean', | ||
34 | + 'language_name', | ||
35 | + 'active:boolean', | ||
36 | + ], | ||
37 | + ]) ?> | ||
38 | + | ||
39 | +</div> |
1 | +++ a/backend/views/language/view_adress.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | +use yii\grid\Column; | ||
6 | +use frontend\models\OptionLang; | ||
7 | + | ||
8 | +/* @var $this yii\web\View */ | ||
9 | +/* @var $searchModel backend\models\LanguageSearch */ | ||
10 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
11 | + | ||
12 | +$this->title = Yii::t('app', 'Languages'); | ||
13 | +$this->params['breadcrumbs'][] = $this->title; | ||
14 | +echo $this->render('layout'); | ||
15 | +?> | ||
16 | +<div class="lang-column-2"> | ||
17 | + | ||
18 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
19 | + | ||
20 | + <?= GridView::widget([ | ||
21 | + 'dataProvider' => $dataProvider, | ||
22 | + 'layout' => "{items}", | ||
23 | + 'columns' => [ | ||
24 | + [ | ||
25 | + 'class' => 'yii\grid\Column', | ||
26 | + 'content' => function($model, $key, $index, $column) { | ||
27 | + return OptionLang::find()->select('value')->where(['language_id' => 0, 'id' => $model->option_id])->scalar(); | ||
28 | + }, | ||
29 | + 'header' => Yii::t('app', 'adress_name') | ||
30 | + ], | ||
31 | + [ | ||
32 | + 'class' => 'yii\grid\ActionColumn', | ||
33 | + 'template' => '{update-adress} {delete-adress}', | ||
34 | + 'buttons' => [ | ||
35 | + 'update-adress' => function ($url, $model, $key) { | ||
36 | + return Html::a('', $url, ['class' => 'glyphicon glyphicon-pencil', 'title' => Yii::t('app', 'Change')]); | ||
37 | + }, | ||
38 | + 'delete-adress' => function ($url, $model, $key) { | ||
39 | + return Html::a('', $url, ['class' => 'glyphicon glyphicon-trash', 'title' => Yii::t('app', 'Delete')]); | ||
40 | + }, | ||
41 | + ], | ||
42 | + ] | ||
43 | + ] | ||
44 | + ]); ?> | ||
45 | + | ||
46 | + <p class="text-right"> | ||
47 | + <?= Html::a(Yii::t('app', 'Create adress'), ['create-adress'], ['class' => 'btn btn-success']) ?> | ||
48 | + </p> | ||
49 | + | ||
50 | +</div> |
1 | +++ a/backend/views/layouts/content.php | ||
1 | +<?php | ||
2 | +use yii\widgets\Breadcrumbs; | ||
3 | +use dmstr\widgets\Alert; | ||
4 | +use yii\helpers\Html; | ||
5 | + | ||
6 | +?> | ||
7 | +<div class="content-wrapper"> | ||
8 | + <section class="content-header"> | ||
9 | + <?php if (isset($this->blocks['content-header'])) { ?> | ||
10 | + <h1><?= $this->blocks['content-header'] ?></h1> | ||
11 | + <?php } else { ?> | ||
12 | + <h1> | ||
13 | + <?php | ||
14 | + if ($this->title !== null) { | ||
15 | + echo \yii\helpers\Html::encode($this->title); | ||
16 | + } else { | ||
17 | + echo \yii\helpers\Inflector::camel2words( | ||
18 | + \yii\helpers\Inflector::id2camel($this->context->module->id) | ||
19 | + ); | ||
20 | + echo ($this->context->module->id !== \Yii::$app->id) ? '<small>Module</small>' : ''; | ||
21 | + } ?> | ||
22 | + </h1> | ||
23 | + <?php } ?> | ||
24 | + | ||
25 | + <?= | ||
26 | + Breadcrumbs::widget( | ||
27 | + [ | ||
28 | + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | ||
29 | + ] | ||
30 | + ) ?> | ||
31 | + </section> | ||
32 | + | ||
33 | + <section class="content"> | ||
34 | + <?= Alert::widget() ?> | ||
35 | + <?= $content ?> | ||
36 | + </section> | ||
37 | +</div> | ||
38 | + | ||
39 | +<footer class="main-footer"> | ||
40 | + <div class="pull-right hidden-xs"> | ||
41 | + <b>Version</b> 2.0 | ||
42 | + </div> | ||
43 | + <strong>Copyright © 2014-2015 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights | ||
44 | + reserved. | ||
45 | +</footer> | ||
46 | + | ||
47 | +<!-- Control Sidebar --> | ||
48 | +<aside class="control-sidebar control-sidebar-dark"> | ||
49 | + <!-- Create the tabs --> | ||
50 | + <ul class="nav nav-tabs nav-justified control-sidebar-tabs"> | ||
51 | + <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li> | ||
52 | + <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li> | ||
53 | + </ul> | ||
54 | + <!-- Tab panes --> | ||
55 | + <div class="tab-content"> | ||
56 | + <!-- Home tab content --> | ||
57 | + <div class="tab-pane" id="control-sidebar-home-tab"> | ||
58 | + <h3 class="control-sidebar-heading">Recent Activity</h3> | ||
59 | + <ul class='control-sidebar-menu'> | ||
60 | + <li> | ||
61 | + <a href='javascript::;'> | ||
62 | + <i class="menu-icon fa fa-birthday-cake bg-red"></i> | ||
63 | + | ||
64 | + <div class="menu-info"> | ||
65 | + <h4 class="control-sidebar-subheading">Langdon's Birthday</h4> | ||
66 | + | ||
67 | + <p>Will be 23 on April 24th</p> | ||
68 | + </div> | ||
69 | + </a> | ||
70 | + </li> | ||
71 | + <li> | ||
72 | + <a href='javascript::;'> | ||
73 | + <i class="menu-icon fa fa-user bg-yellow"></i> | ||
74 | + | ||
75 | + <div class="menu-info"> | ||
76 | + <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4> | ||
77 | + | ||
78 | + <p>New phone +1(800)555-1234</p> | ||
79 | + </div> | ||
80 | + </a> | ||
81 | + </li> | ||
82 | + <li> | ||
83 | + <a href='javascript::;'> | ||
84 | + <i class="menu-icon fa fa-envelope-o bg-light-blue"></i> | ||
85 | + | ||
86 | + <div class="menu-info"> | ||
87 | + <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4> | ||
88 | + | ||
89 | + <p>nora@example.com</p> | ||
90 | + </div> | ||
91 | + </a> | ||
92 | + </li> | ||
93 | + <li> | ||
94 | + <a href='javascript::;'> | ||
95 | + <i class="menu-icon fa fa-file-code-o bg-green"></i> | ||
96 | + | ||
97 | + <div class="menu-info"> | ||
98 | + <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4> | ||
99 | + | ||
100 | + <p>Execution time 5 seconds</p> | ||
101 | + </div> | ||
102 | + </a> | ||
103 | + </li> | ||
104 | + </ul> | ||
105 | + <!-- /.control-sidebar-menu --> | ||
106 | + | ||
107 | + <h3 class="control-sidebar-heading">Tasks Progress</h3> | ||
108 | + <ul class='control-sidebar-menu'> | ||
109 | + <li> | ||
110 | + <a href='javascript::;'> | ||
111 | + <h4 class="control-sidebar-subheading"> | ||
112 | + Custom Template Design | ||
113 | + <span class="label label-danger pull-right">70%</span> | ||
114 | + </h4> | ||
115 | + | ||
116 | + <div class="progress progress-xxs"> | ||
117 | + <div class="progress-bar progress-bar-danger" style="width: 70%"></div> | ||
118 | + </div> | ||
119 | + </a> | ||
120 | + </li> | ||
121 | + <li> | ||
122 | + <a href='javascript::;'> | ||
123 | + <h4 class="control-sidebar-subheading"> | ||
124 | + Update Resume | ||
125 | + <span class="label label-success pull-right">95%</span> | ||
126 | + </h4> | ||
127 | + | ||
128 | + <div class="progress progress-xxs"> | ||
129 | + <div class="progress-bar progress-bar-success" style="width: 95%"></div> | ||
130 | + </div> | ||
131 | + </a> | ||
132 | + </li> | ||
133 | + <li> | ||
134 | + <a href='javascript::;'> | ||
135 | + <h4 class="control-sidebar-subheading"> | ||
136 | + Laravel Integration | ||
137 | + <span class="label label-waring pull-right">50%</span> | ||
138 | + </h4> | ||
139 | + | ||
140 | + <div class="progress progress-xxs"> | ||
141 | + <div class="progress-bar progress-bar-warning" style="width: 50%"></div> | ||
142 | + </div> | ||
143 | + </a> | ||
144 | + </li> | ||
145 | + <li> | ||
146 | + <a href='javascript::;'> | ||
147 | + <h4 class="control-sidebar-subheading"> | ||
148 | + Back End Framework | ||
149 | + <span class="label label-primary pull-right">68%</span> | ||
150 | + </h4> | ||
151 | + | ||
152 | + <div class="progress progress-xxs"> | ||
153 | + <div class="progress-bar progress-bar-primary" style="width: 68%"></div> | ||
154 | + </div> | ||
155 | + </a> | ||
156 | + </li> | ||
157 | + </ul> | ||
158 | + <!-- /.control-sidebar-menu --> | ||
159 | + | ||
160 | + </div> | ||
161 | + <!-- /.tab-pane --> | ||
162 | + | ||
163 | + <!-- Settings tab content --> | ||
164 | + <div class="tab-pane" id="control-sidebar-settings-tab"> | ||
165 | + <form method="post"> | ||
166 | + <h3 class="control-sidebar-heading">General Settings</h3> | ||
167 | + | ||
168 | + <div class="form-group"> | ||
169 | + <label class="control-sidebar-subheading"> | ||
170 | + Report panel usage | ||
171 | + <input type="checkbox" class="pull-right" checked/> | ||
172 | + </label> | ||
173 | + | ||
174 | + <p> | ||
175 | + Some information about this general settings option | ||
176 | + </p> | ||
177 | + </div> | ||
178 | + <!-- /.form-group --> | ||
179 | + | ||
180 | + <div class="form-group"> | ||
181 | + <label class="control-sidebar-subheading"> | ||
182 | + Allow mail redirect | ||
183 | + <input type="checkbox" class="pull-right" checked/> | ||
184 | + </label> | ||
185 | + | ||
186 | + <p> | ||
187 | + Other sets of options are available | ||
188 | + </p> | ||
189 | + </div> | ||
190 | + <!-- /.form-group --> | ||
191 | + | ||
192 | + <div class="form-group"> | ||
193 | + <label class="control-sidebar-subheading"> | ||
194 | + Expose author name in posts | ||
195 | + <input type="checkbox" class="pull-right" checked/> | ||
196 | + </label> | ||
197 | + | ||
198 | + <p> | ||
199 | + Allow the user to show his name in blog posts | ||
200 | + </p> | ||
201 | + </div> | ||
202 | + <!-- /.form-group --> | ||
203 | + | ||
204 | + <h3 class="control-sidebar-heading">Chat Settings</h3> | ||
205 | + | ||
206 | + <div class="form-group"> | ||
207 | + <label class="control-sidebar-subheading"> | ||
208 | + Show me as online | ||
209 | + <input type="checkbox" class="pull-right" checked/> | ||
210 | + </label> | ||
211 | + </div> | ||
212 | + <!-- /.form-group --> | ||
213 | + | ||
214 | + <div class="form-group"> | ||
215 | + <label class="control-sidebar-subheading"> | ||
216 | + Turn off notifications | ||
217 | + <input type="checkbox" class="pull-right"/> | ||
218 | + </label> | ||
219 | + </div> | ||
220 | + <!-- /.form-group --> | ||
221 | + | ||
222 | + <div class="form-group"> | ||
223 | + <label class="control-sidebar-subheading"> | ||
224 | + Delete chat history | ||
225 | + <a href="javascript::;" class="text-red pull-right"><i class="fa fa-trash-o"></i></a> | ||
226 | + </label> | ||
227 | + </div> | ||
228 | + <!-- /.form-group --> | ||
229 | + </form> | ||
230 | + <?=Html::a( | ||
231 | + \Yii::t('app', 'settings'), | ||
232 | + ['/language'], | ||
233 | + ['data-method' => 'post', 'class' => 'btn btn-default btn-flat'] | ||
234 | + )?> | ||
235 | + </div> | ||
236 | + <!-- /.tab-pane --> | ||
237 | + </div> | ||
238 | +</aside><!-- /.control-sidebar --> | ||
239 | +<!-- Add the sidebar's background. This div must be placed | ||
240 | + immediately after the control sidebar --> | ||
241 | +<div class='control-sidebar-bg'></div> | ||
0 | \ No newline at end of file | 242 | \ No newline at end of file |
1 | +++ a/backend/views/layouts/header.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\helpers\Url; | ||
5 | + | ||
6 | +$username = Yii::$app->user->identity->firstname.' '.Yii::$app->user->identity->lastname; | ||
7 | + | ||
8 | +/* @var $this \yii\web\View */ | ||
9 | +/* @var $content string */ | ||
10 | +?> | ||
11 | + | ||
12 | +<header class="main-header"> | ||
13 | + | ||
14 | + <?= Html::a('<span class="logo-mini">APP</span><span class="logo-lg">' . Yii::$app->name . '</span>', Yii::$app->homeUrl, ['class' => 'logo']) ?> | ||
15 | + | ||
16 | + <nav class="navbar navbar-static-top" role="navigation"> | ||
17 | + | ||
18 | + <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> | ||
19 | + <span class="sr-only">Toggle navigation</span> | ||
20 | + </a> | ||
21 | + | ||
22 | + <div class="navbar-custom-menu"> | ||
23 | + | ||
24 | + <ul class="nav navbar-nav"> | ||
25 | + | ||
26 | + <!-- search form --> | ||
27 | + <li class="header-search"> | ||
28 | + <form action="#" method="get" class="sidebar-form"> | ||
29 | + <div class="input-group"> | ||
30 | + <input type="text" name="q" class="form-control" placeholder="Search..."/> | ||
31 | + <span class="input-group-btn"> | ||
32 | + <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i> | ||
33 | + </button> | ||
34 | + </span> | ||
35 | + </div> | ||
36 | + </form> | ||
37 | + </li> | ||
38 | + <!-- /.search form --> | ||
39 | + <!-- Messages: style can be found in dropdown.less--> | ||
40 | + <li class="dropdown messages-menu"> | ||
41 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | ||
42 | + <i class="fa fa-envelope-o"></i> | ||
43 | + <span class="label label-success">4</span> | ||
44 | + </a> | ||
45 | + <ul class="dropdown-menu"> | ||
46 | + <li class="header">You have 4 messages</li> | ||
47 | + <li> | ||
48 | + <!-- inner menu: contains the actual data --> | ||
49 | + <ul class="menu"> | ||
50 | + <li><!-- start message --> | ||
51 | + <a href="#"> | ||
52 | + <div class="pull-left"> | ||
53 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" | ||
54 | + alt="User Image"/> | ||
55 | + </div> | ||
56 | + <h4> | ||
57 | + Support Team | ||
58 | + <small><i class="fa fa-clock-o"></i> 5 mins</small> | ||
59 | + </h4> | ||
60 | + <p>Why not buy a new awesome theme?</p> | ||
61 | + </a> | ||
62 | + </li> | ||
63 | + <!-- end message --> | ||
64 | + <li> | ||
65 | + <a href="#"> | ||
66 | + <div class="pull-left"> | ||
67 | + <img src="<?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle" | ||
68 | + alt="user image"/> | ||
69 | + </div> | ||
70 | + <h4> | ||
71 | + AdminLTE Design Team | ||
72 | + <small><i class="fa fa-clock-o"></i> 2 hours</small> | ||
73 | + </h4> | ||
74 | + <p>Why not buy a new awesome theme?</p> | ||
75 | + </a> | ||
76 | + </li> | ||
77 | + <li> | ||
78 | + <a href="#"> | ||
79 | + <div class="pull-left"> | ||
80 | + <img src="<?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle" | ||
81 | + alt="user image"/> | ||
82 | + </div> | ||
83 | + <h4> | ||
84 | + Developers | ||
85 | + <small><i class="fa fa-clock-o"></i> Today</small> | ||
86 | + </h4> | ||
87 | + <p>Why not buy a new awesome theme?</p> | ||
88 | + </a> | ||
89 | + </li> | ||
90 | + <li> | ||
91 | + <a href="#"> | ||
92 | + <div class="pull-left"> | ||
93 | + <img src="<?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle" | ||
94 | + alt="user image"/> | ||
95 | + </div> | ||
96 | + <h4> | ||
97 | + Sales Department | ||
98 | + <small><i class="fa fa-clock-o"></i> Yesterday</small> | ||
99 | + </h4> | ||
100 | + <p>Why not buy a new awesome theme?</p> | ||
101 | + </a> | ||
102 | + </li> | ||
103 | + <li> | ||
104 | + <a href="#"> | ||
105 | + <div class="pull-left"> | ||
106 | + <img src="<?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle" | ||
107 | + alt="user image"/> | ||
108 | + </div> | ||
109 | + <h4> | ||
110 | + Reviewers | ||
111 | + <small><i class="fa fa-clock-o"></i> 2 days</small> | ||
112 | + </h4> | ||
113 | + <p>Why not buy a new awesome theme?</p> | ||
114 | + </a> | ||
115 | + </li> | ||
116 | + </ul> | ||
117 | + </li> | ||
118 | + <li class="footer"><a href="#">See All Messages</a></li> | ||
119 | + </ul> | ||
120 | + </li> | ||
121 | + <li class="dropdown notifications-menu"> | ||
122 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | ||
123 | + <i class="fa fa-bell-o"></i> | ||
124 | + <span class="label label-warning">10</span> | ||
125 | + </a> | ||
126 | + <ul class="dropdown-menu"> | ||
127 | + <li class="header">You have 10 notifications</li> | ||
128 | + <li> | ||
129 | + <!-- inner menu: contains the actual data --> | ||
130 | + <ul class="menu"> | ||
131 | + <li> | ||
132 | + <a href="#"> | ||
133 | + <i class="fa fa-users text-aqua"></i> 5 new members joined today | ||
134 | + </a> | ||
135 | + </li> | ||
136 | + <li> | ||
137 | + <a href="#"> | ||
138 | + <i class="fa fa-warning text-yellow"></i> Very long description here that may | ||
139 | + not fit into the page and may cause design problems | ||
140 | + </a> | ||
141 | + </li> | ||
142 | + <li> | ||
143 | + <a href="#"> | ||
144 | + <i class="fa fa-users text-red"></i> 5 new members joined | ||
145 | + </a> | ||
146 | + </li> | ||
147 | + | ||
148 | + <li> | ||
149 | + <a href="#"> | ||
150 | + <i class="fa fa-shopping-cart text-green"></i> 25 sales made | ||
151 | + </a> | ||
152 | + </li> | ||
153 | + <li> | ||
154 | + <a href="#"> | ||
155 | + <i class="fa fa-user text-red"></i> You changed your username | ||
156 | + </a> | ||
157 | + </li> | ||
158 | + </ul> | ||
159 | + </li> | ||
160 | + <li class="footer"><a href="#">View all</a></li> | ||
161 | + </ul> | ||
162 | + </li> | ||
163 | + <!-- Tasks: style can be found in dropdown.less --> | ||
164 | + <li class="dropdown tasks-menu"> | ||
165 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | ||
166 | + <i class="fa fa-flag-o"></i> | ||
167 | + <span class="label label-danger">9</span> | ||
168 | + </a> | ||
169 | + <ul class="dropdown-menu"> | ||
170 | + <li class="header">You have 9 tasks</li> | ||
171 | + <li> | ||
172 | + <!-- inner menu: contains the actual data --> | ||
173 | + <ul class="menu"> | ||
174 | + <li><!-- Task item --> | ||
175 | + <a href="#"> | ||
176 | + <h3> | ||
177 | + Design some buttons | ||
178 | + <small class="pull-right">20%</small> | ||
179 | + </h3> | ||
180 | + <div class="progress xs"> | ||
181 | + <div class="progress-bar progress-bar-aqua" style="width: 20%" | ||
182 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | ||
183 | + aria-valuemax="100"> | ||
184 | + <span class="sr-only">20% Complete</span> | ||
185 | + </div> | ||
186 | + </div> | ||
187 | + </a> | ||
188 | + </li> | ||
189 | + <!-- end task item --> | ||
190 | + <li><!-- Task item --> | ||
191 | + <a href="#"> | ||
192 | + <h3> | ||
193 | + Create a nice theme | ||
194 | + <small class="pull-right">40%</small> | ||
195 | + </h3> | ||
196 | + <div class="progress xs"> | ||
197 | + <div class="progress-bar progress-bar-green" style="width: 40%" | ||
198 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | ||
199 | + aria-valuemax="100"> | ||
200 | + <span class="sr-only">40% Complete</span> | ||
201 | + </div> | ||
202 | + </div> | ||
203 | + </a> | ||
204 | + </li> | ||
205 | + <!-- end task item --> | ||
206 | + <li><!-- Task item --> | ||
207 | + <a href="#"> | ||
208 | + <h3> | ||
209 | + Some task I need to do | ||
210 | + <small class="pull-right">60%</small> | ||
211 | + </h3> | ||
212 | + <div class="progress xs"> | ||
213 | + <div class="progress-bar progress-bar-red" style="width: 60%" | ||
214 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | ||
215 | + aria-valuemax="100"> | ||
216 | + <span class="sr-only">60% Complete</span> | ||
217 | + </div> | ||
218 | + </div> | ||
219 | + </a> | ||
220 | + </li> | ||
221 | + <!-- end task item --> | ||
222 | + <li><!-- Task item --> | ||
223 | + <a href="#"> | ||
224 | + <h3> | ||
225 | + Make beautiful transitions | ||
226 | + <small class="pull-right">80%</small> | ||
227 | + </h3> | ||
228 | + <div class="progress xs"> | ||
229 | + <div class="progress-bar progress-bar-yellow" style="width: 80%" | ||
230 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | ||
231 | + aria-valuemax="100"> | ||
232 | + <span class="sr-only">80% Complete</span> | ||
233 | + </div> | ||
234 | + </div> | ||
235 | + </a> | ||
236 | + </li> | ||
237 | + <!-- end task item --> | ||
238 | + </ul> | ||
239 | + </li> | ||
240 | + <li class="footer"> | ||
241 | + <a href="#">View all tasks</a> | ||
242 | + </li> | ||
243 | + </ul> | ||
244 | + </li> | ||
245 | + <!-- User Account: style can be found in dropdown.less --> | ||
246 | + | ||
247 | + <li class="dropdown user user-menu"> | ||
248 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | ||
249 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="user-image" alt="User Image"/> | ||
250 | + <span class="hidden-xs"><?=$username; ?></span> | ||
251 | + </a> | ||
252 | + <ul class="dropdown-menu"> | ||
253 | + <!-- User image --> | ||
254 | + <li class="user-header"> | ||
255 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" | ||
256 | + alt="User Image"/> | ||
257 | + | ||
258 | + <p> | ||
259 | + <?=$username; ?> - Web Developer | ||
260 | + <small>Member since Nov. 2012</small> | ||
261 | + </p> | ||
262 | + </li> | ||
263 | + <!-- | ||
264 | + Menu Body | ||
265 | + <li class="user-body"> | ||
266 | + <div class="col-xs-4 text-center"> | ||
267 | + <a href="#">Followers</a> | ||
268 | + </div> | ||
269 | + <div class="col-xs-4 text-center"> | ||
270 | + <a href="#">Sales</a> | ||
271 | + </div> | ||
272 | + <div class="col-xs-4 text-center"> | ||
273 | + <a href="#">Friends</a> | ||
274 | + </div> | ||
275 | + </li> | ||
276 | + --> | ||
277 | + <!-- Menu Footer--> | ||
278 | + <li class="user-footer"> | ||
279 | + <div class="pull-left"> | ||
280 | + <a href="<?=Url::toRoute('site/profile'); ?>" class="btn btn-default btn-flat">Profile</a> | ||
281 | + </div> | ||
282 | + <div class="pull-right"> | ||
283 | + <?= Html::a( | ||
284 | + 'Sign out', | ||
285 | + ['/site/logout'], | ||
286 | + ['data-method' => 'post', 'class' => 'btn btn-default btn-flat'] | ||
287 | + ) ?> | ||
288 | + </div> | ||
289 | + </li> | ||
290 | + </ul> | ||
291 | + </li> | ||
292 | + | ||
293 | + <!-- User Account: style can be found in dropdown.less --> | ||
294 | + <li> | ||
295 | + <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a> | ||
296 | + </li> | ||
297 | + </ul> | ||
298 | + </div> | ||
299 | + </nav> | ||
300 | +</header> |
1 | +++ a/backend/views/layouts/left.php | ||
1 | +<aside class="main-sidebar"> | ||
2 | + | ||
3 | + <section class="sidebar"> | ||
4 | + | ||
5 | + <!-- Sidebar user panel --> | ||
6 | + <div class="user-panel"> | ||
7 | + <div class="pull-left image"> | ||
8 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" alt="User Image"/> | ||
9 | + </div> | ||
10 | + <div class="pull-left info"> | ||
11 | + <p>Alexander Pierce</p> | ||
12 | + | ||
13 | + <a href="#"><i class="fa fa-circle text-success"></i> Online</a> | ||
14 | + </div> | ||
15 | + </div> | ||
16 | + | ||
17 | + <?= dmstr\widgets\Menu::widget([ | ||
18 | + 'options' => ['class' => 'sidebar-menu'], | ||
19 | + 'items' => array_merge( | ||
20 | + \backend\models\AdminMenu::buildMenu(), | ||
21 | + [ | ||
22 | + ['label' => Yii::t('app', 'Settings'), 'url' => ['/settings/index'], 'icon' => 'fa fa-gear'] | ||
23 | + ] | ||
24 | + ), | ||
25 | + ]) ?> | ||
26 | + | ||
27 | + </section> | ||
28 | + | ||
29 | +</aside> |
1 | +++ a/backend/views/layouts/main-login.php | ||
1 | +<?php | ||
2 | +use backend\assets\AppAsset; | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this \yii\web\View */ | ||
6 | +/* @var $content string */ | ||
7 | + | ||
8 | +dmstr\web\AdminLteAsset::register($this); | ||
9 | +?> | ||
10 | +<?php $this->beginPage() ?> | ||
11 | +<!DOCTYPE html> | ||
12 | +<html lang="<?= Yii::$app->language ?>"> | ||
13 | +<head> | ||
14 | + <meta charset="<?= Yii::$app->charset ?>"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
16 | + <?= Html::csrfMetaTags() ?> | ||
17 | + <title><?= Html::encode($this->title) ?></title> | ||
18 | + <?php $this->head() ?> | ||
19 | +</head> | ||
20 | +<body class="login-page"> | ||
21 | + | ||
22 | +<?php $this->beginBody() ?> | ||
23 | + | ||
24 | + <?= $content ?> | ||
25 | + | ||
26 | +<?php $this->endBody() ?> | ||
27 | +</body> | ||
28 | +</html> | ||
29 | +<?php $this->endPage() ?> |
1 | +++ a/backend/views/layouts/main.php | ||
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | + | ||
4 | +/* @var $this \yii\web\View */ | ||
5 | +/* @var $content string */ | ||
6 | + | ||
7 | + | ||
8 | +if (Yii::$app->controller->action->id === 'login') { | ||
9 | +/** | ||
10 | + * Do not use this code in your template. Remove it. | ||
11 | + * Instead, use the code $this->layout = '//main-login'; in your controller. | ||
12 | + */ | ||
13 | + echo $this->render( | ||
14 | + 'main-login', | ||
15 | + ['content' => $content] | ||
16 | + ); | ||
17 | +} else { | ||
18 | + | ||
19 | + if (class_exists('backend\assets\AppAsset')) { | ||
20 | + backend\assets\AppAsset::register($this); | ||
21 | + } else { | ||
22 | + app\assets\AppAsset::register($this); | ||
23 | + } | ||
24 | + | ||
25 | + dmstr\web\AdminLteAsset::register($this); | ||
26 | + | ||
27 | + $directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist'); | ||
28 | + ?> | ||
29 | + <?php $this->beginPage() ?> | ||
30 | + <!DOCTYPE html> | ||
31 | + <html lang="<?= Yii::$app->language ?>"> | ||
32 | + <head> | ||
33 | + <meta charset="<?= Yii::$app->charset ?>"/> | ||
34 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
35 | + <?= Html::csrfMetaTags() ?> | ||
36 | + <title><?= Html::encode($this->title) ?></title> | ||
37 | + <?php $this->head() ?> | ||
38 | + </head> | ||
39 | + <body class="skin-blue sidebar-mini"> | ||
40 | + <?php $this->beginBody() ?> | ||
41 | + <div class="wrapper"> | ||
42 | + | ||
43 | + <?= $this->render( | ||
44 | + 'header.php', | ||
45 | + ['directoryAsset' => $directoryAsset] | ||
46 | + ) ?> | ||
47 | + | ||
48 | + <?= $this->render( | ||
49 | + 'left.php', | ||
50 | + ['directoryAsset' => $directoryAsset] | ||
51 | + ) | ||
52 | + ?> | ||
53 | + | ||
54 | + <?= $this->render( | ||
55 | + 'content.php', | ||
56 | + ['content' => $content, 'directoryAsset' => $directoryAsset] | ||
57 | + ) ?> | ||
58 | + | ||
59 | + </div> | ||
60 | + | ||
61 | + <?php $this->endBody() ?> | ||
62 | + </body> | ||
63 | + </html> | ||
64 | + <?php $this->endPage() ?> | ||
65 | +<?php } ?> |
1 | +++ a/backend/views/layouts/settings.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use dmstr\widgets\Menu; | ||
4 | +use yii\widgets\Breadcrumbs; | ||
5 | +use yii\helpers\Html; | ||
6 | + | ||
7 | +/* @var $content string */ | ||
8 | +$this->beginContent('@app/views/layouts/main.php'); | ||
9 | +?> | ||
10 | + <div class="row"> | ||
11 | + <div class="col-md-3"> | ||
12 | + <div class="box box-solid"> | ||
13 | + <div class="box-header with-border"> | ||
14 | + <h3 class="box-title"><?=Yii::t('app', 'Settings categories')?></h3> | ||
15 | + <div class="box-tools"> | ||
16 | + <button type="button" class="btn btn-box-tool" data-widget="collapse"> | ||
17 | + <i class="fa fa-minus"></i> | ||
18 | + </button> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="box-body no-padding"> | ||
22 | + <?php | ||
23 | + echo Menu::widget([ | ||
24 | + 'options' => [ | ||
25 | + 'class' => 'nav nav-pills nav-stacked' | ||
26 | + ], | ||
27 | + 'items' => [ | ||
28 | + ['label' => Yii::t('app', 'Admin Menus'), 'url' => ['/admin-menu/index'], 'icon' => 'fa fa-navicon'], | ||
29 | + ['label' => Yii::t('app', 'Next menu item'), 'url' => ['#'], 'icon' => 'fa fa-arrow-circle-o-right'], | ||
30 | + ], | ||
31 | + ]); | ||
32 | + ?> | ||
33 | + </div> | ||
34 | + </div> | ||
35 | + </div> | ||
36 | + <div class="col-md-9"> | ||
37 | + <?= $content ?> | ||
38 | + </div> | ||
39 | + </div> | ||
40 | +<?php $this->endContent() ?> | ||
0 | \ No newline at end of file | 41 | \ No newline at end of file |
1 | +++ a/backend/views/menu-location/_form.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\MenuLocation */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="menu-location-form"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin(); ?> | ||
14 | + | ||
15 | + <?= $form->field($model, 'menu_location_id')->textInput() ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'menu_location_name')->textInput(['maxlength' => true]) ?> | ||
18 | + | ||
19 | + <?= $form->field($model->menuLocationLangs[0], 'menu_location_title')->textInput() ?> | ||
20 | + | ||
21 | + <div class="form-group"> | ||
22 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
23 | + </div> | ||
24 | + | ||
25 | + <?php ActiveForm::end(); ?> | ||
26 | + | ||
27 | +</div> |
1 | +++ a/backend/views/menu-location/_search.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\MenuSearchLocation */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="menu-location-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'menu_location_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'menu_location_name') ?> | ||
21 | + | ||
22 | + <div class="form-group"> | ||
23 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
24 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
25 | + </div> | ||
26 | + | ||
27 | + <?php ActiveForm::end(); ?> | ||
28 | + | ||
29 | +</div> |
1 | +++ a/backend/views/menu-location/create.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\MenuLocation */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Menu Location'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Menu Locations'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="menu-location-create"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
1 | +++ a/backend/views/menu-location/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel backend\models\MenuLocation */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Menu Locations'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="menu-location-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').' '.Yii::t('app', 'location'), ['create'], ['class' => 'btn btn-success']) ?> | ||
20 | + </p> | ||
21 | + | ||
22 | + <?= GridView::widget([ | ||
23 | + 'dataProvider' => $dataProvider, | ||
24 | + 'filterModel' => $searchModel, | ||
25 | + 'columns' => [ | ||
26 | + ['class' => 'yii\grid\SerialColumn'], | ||
27 | + | ||
28 | + 'menu_location_id', | ||
29 | + 'menu_location_name', | ||
30 | + [ | ||
31 | + 'attribute' => 'menu_location_title', | ||
32 | + 'value' => function ($model) | ||
33 | + { | ||
34 | + | ||
35 | + return $model->menuLocationLangs[0]->menu_location_title; | ||
36 | + }, | ||
37 | + ], | ||
38 | + | ||
39 | + ['class' => 'yii\grid\ActionColumn'], | ||
40 | + ], | ||
41 | + ]); ?> | ||
42 | + | ||
43 | +</div> |
1 | +++ a/backend/views/menu-location/update.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model backend\models\MenuLocation */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Menu Location', | ||
10 | +]) . ' ' . $model->menu_location_id; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Menu Locations'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->menu_location_id, 'url' => ['view', 'id' => $model->menu_location_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="menu-location-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
1 | +++ a/backend/views/menu-location/view.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\MenuLocation */ | ||
8 | + | ||
9 | +$this->title = $model->menu_location_id; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Menu Locations'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="menu-location-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->menu_location_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->menu_location_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 | + 'menu_location_id', | ||
32 | + 'menu_location_name', | ||
33 | + ], | ||
34 | + ]) ?> | ||
35 | + | ||
36 | +</div> |
1 | +++ a/backend/views/menu/_form.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Menu */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="menu-form"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin(); ?> | ||
14 | + | ||
15 | + <?= $form->field($model, 'menu_id')->textInput() ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'menu_pid')->textInput() ?> | ||
18 | + | ||
19 | + <?= $form->field($model, 'level')->textInput() ?> | ||
20 | + | ||
21 | + <?= $form->field($model, 'termin_id')->textInput() ?> | ||
22 | + | ||
23 | + <?= $form->field($model, 'status')->textInput() ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'is_open')->textInput() ?> | ||
26 | + | ||
27 | + <?= $form->field($model, 'menu_location_id')->textInput() ?> | ||
28 | + | ||
29 | + <?= $form->field($model, 'sort')->textInput() ?> | ||
30 | + | ||
31 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | ||
32 | + | ||
33 | + <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?> | ||
34 | + | ||
35 | + <div class="form-group"> | ||
36 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
37 | + </div> | ||
38 | + | ||
39 | + <?php ActiveForm::end(); ?> | ||
40 | + | ||
41 | +</div> |
1 | +++ a/backend/views/menu/_search.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\MenuSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="menu-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'menu_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'menu_pid') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'level') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'termin_id') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'status') ?> | ||
27 | + | ||
28 | + <?php // echo $form->field($model, 'is_open') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'menu_location_id') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'sortorder') ?> | ||
33 | + | ||
34 | + <?php // echo $form->field($model, 'name') ?> | ||
35 | + | ||
36 | + <?php // echo $form->field($model, 'url') ?> | ||
37 | + | ||
38 | + <div class="form-group"> | ||
39 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
40 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
41 | + </div> | ||
42 | + | ||
43 | + <?php ActiveForm::end(); ?> | ||
44 | + | ||
45 | +</div> |
1 | +++ a/backend/views/menu/create.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Menu */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Menu'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Menus'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="menu-create"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
1 | +++ a/backend/views/menu/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel backend\models\MenuSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Menus'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="menu-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').' '.Yii::t('app', 'menu'), ['create'], ['class' => 'btn btn-success']) ?> | ||
20 | + <?= Html::a(Yii::t('app', 'Create').' '.Yii::t('app', 'location'), ['/menu-location/'], ['class' => 'btn btn-primary']) ?> | ||
21 | + </p> | ||
22 | + | ||
23 | + <?= GridView::widget([ | ||
24 | + 'dataProvider' => $dataProvider, | ||
25 | + 'filterModel' => $searchModel, | ||
26 | + 'columns' => [ | ||
27 | + ['class' => 'yii\grid\SerialColumn'], | ||
28 | +/* | ||
29 | + [ | ||
30 | + 'attribute' => Yii::t('app', 'termin'), | ||
31 | + 'value' => function ($model) | ||
32 | + { | ||
33 | + return empty ($model->termin_id) ? '-' : $model->terminLang->termin_title; | ||
34 | + }, | ||
35 | + ], | ||
36 | + */ | ||
37 | + 'menu_pid', | ||
38 | + 'level', | ||
39 | + | ||
40 | + ['class' => 'yii\grid\ActionColumn'], | ||
41 | + ], | ||
42 | + ]); ?> | ||
43 | + | ||
44 | +</div> |
1 | +++ a/backend/views/menu/update.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model backend\models\Menu */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Menu', | ||
10 | +]) . ' ' . $model->name; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Menus'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->menu_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="menu-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
1 | +++ a/backend/views/menu/view.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Menu */ | ||
8 | + | ||
9 | +$this->title = $model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Menus'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="menu-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->menu_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->menu_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 | + 'menu_id', | ||
32 | + 'menu_pid', | ||
33 | + 'level', | ||
34 | + 'termin_id', | ||
35 | + 'status', | ||
36 | + 'is_open', | ||
37 | + 'menu_location_id', | ||
38 | + 'sort', | ||
39 | + 'name', | ||
40 | + 'url:url', | ||
41 | + ], | ||
42 | + ]) ?> | ||
43 | + | ||
44 | +</div> |
1 | +++ a/backend/views/new-options-lang/_form.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\NewOptionsLang */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="new-options-lang-form"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin(); ?> | ||
14 | + | ||
15 | + <?= $form->field($model, 'id')->textInput() ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'language_id')->textInput() ?> | ||
18 | + | ||
19 | + <?= $form->field($model, 'value')->textarea(['rows' => 6]) ?> | ||
20 | + | ||
21 | + <div class="form-group"> | ||
22 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
23 | + </div> | ||
24 | + | ||
25 | + <?php ActiveForm::end(); ?> | ||
26 | + | ||
27 | +</div> |
1 | +++ a/backend/views/new-options-lang/_search.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\NewOptionsLangSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="new-options-lang-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'primary') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'language_id') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'value') ?> | ||
25 | + | ||
26 | + <div class="form-group"> | ||
27 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
28 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
29 | + </div> | ||
30 | + | ||
31 | + <?php ActiveForm::end(); ?> | ||
32 | + | ||
33 | +</div> |
1 | +++ a/backend/views/new-options-lang/create.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\NewOptionsLang */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create New Options Lang'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'New Options Langs'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="new-options-lang-create"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
1 | +++ a/backend/views/new-options-lang/index.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel backend\models\NewOptionsLangSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'New Options Langs'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="new-options-lang-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 New Options Lang'), ['create'], ['class' => 'btn btn-success']) ?> | ||
20 | + </p> | ||
21 | + | ||
22 | + <?= GridView::widget([ | ||
23 | + 'dataProvider' => $dataProvider, | ||
24 | + 'filterModel' => $searchModel, | ||
25 | + 'columns' => [ | ||
26 | + ['class' => 'yii\grid\SerialColumn'], | ||
27 | + | ||
28 | + 'primary', | ||
29 | + 'id', | ||
30 | + 'language_id', | ||
31 | + 'value:ntext', | ||
32 | + | ||
33 | + ['class' => 'yii\grid\ActionColumn'], | ||
34 | + ], | ||
35 | + ]); ?> | ||
36 | + | ||
37 | +</div> |
1 | +++ a/backend/views/new-options-lang/update.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model backend\models\NewOptionsLang */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'New Options Lang', | ||
10 | +]) . ' ' . $model->primary; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'New Options Langs'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->primary, 'url' => ['view', 'id' => $model->primary]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="new-options-lang-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
1 | +++ a/backend/views/new-options-lang/view.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\NewOptionsLang */ | ||
8 | + | ||
9 | +$this->title = $model->primary; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'New Options Langs'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="new-options-lang-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->primary], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->primary], [ | ||
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 | + 'primary', | ||
32 | + 'id', | ||
33 | + 'language_id', | ||
34 | + 'value:ntext', | ||
35 | + ], | ||
36 | + ]) ?> | ||
37 | + | ||
38 | +</div> |
1 | +++ a/backend/views/option/_form.php | ||
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\Option */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="option-form"> | ||
12 | + <?php $form = ActiveForm::begin(); ?> | ||
13 | + <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | ||
14 | + <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | ||
15 | + <p class="text-right"><span class="glyphicon glyphicon-plus add_row"></span></p> | ||
16 | + <?php if(empty($models)) { | ||
17 | + ?> | ||
18 | + <div class="form-group" id="main_row"> | ||
19 | + <?php foreach($fields as $index => $field) { | ||
20 | + ?> | ||
21 | + <div class="fields_block"> | ||
22 | + <label for="Option[0][<?=$field['name']?>]"><?php echo Yii::t('app', $field['name']); ?></label> | ||
23 | + <?php | ||
24 | + if($field['translate']) { ?><p class="text-right"><span class="glyphicon glyphicon-globe add_lang"></span></p><?php } | ||
25 | + ?> | ||
26 | + <input type="hidden" name="Option[0][<?=$field['name']?>][template]" value="<?=$field['template']?>"/> | ||
27 | + <input type="hidden" name="Option[0][<?=$field['name']?>][translate]" value="<?=$field['translate']?>"/> | ||
28 | + <input type="<?=$field['template']?>" name="Option[0][value][<?=$field['name']?>]" class="form-control required main_input" required/> | ||
29 | + <?php | ||
30 | + if($field['translate']) { | ||
31 | + ?> | ||
32 | + <div class="lang_inputs" style="display: none"> | ||
33 | + <?php | ||
34 | + foreach($model->getLangs() as $lang) { | ||
35 | + ?> | ||
36 | + <div class="form-group"> | ||
37 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
38 | + <div class="col-xs-11"><input type="<?=$field['template']?>" name="Option[0][lang][<?=$field['name']?>][<?=$lang['language_id']?>]" class="form-control" /></div> | ||
39 | + <div class="clearfix"></div> | ||
40 | + </div> | ||
41 | + <?php | ||
42 | + } | ||
43 | + ?> | ||
44 | + </div> | ||
45 | + <?php | ||
46 | + } | ||
47 | + ?> | ||
48 | + </div> | ||
49 | + <?php | ||
50 | + }?> | ||
51 | + </div> | ||
52 | + <?php | ||
53 | + } else { | ||
54 | + $first = 1; | ||
55 | + foreach($models as $index => $row) { | ||
56 | + foreach($row as $key => $value) { | ||
57 | + if(!$modellang[$index][$key][0]->hasErrors('value')) { | ||
58 | + continue; | ||
59 | + } | ||
60 | + if($first) { | ||
61 | + ?> | ||
62 | + <div class="form-group" id="main_row"> | ||
63 | + <?php | ||
64 | + } | ||
65 | + ?> | ||
66 | + <div class="fields_block"> | ||
67 | + <label for="Option[0][<?=$key?>]"><?php echo Yii::t('app', $key); ?></label> | ||
68 | + <input type="hidden" name="Option[0][template]" value="<?=$value->template?>"/> | ||
69 | + <input type="<?=$value->template?>" name="Option[0][value][<?=$key?>]" class="form-control required main_input" required value="<?=$modellang[$index][$key][0]->value?>"/> | ||
70 | + <div class="help-block"><?=$modellang[$index][$key][0]->getFirstError('value')?></div> | ||
71 | + <?php | ||
72 | + if($field['translate']) { | ||
73 | + ?> | ||
74 | + <div class="lang_inputs"> | ||
75 | + <?php | ||
76 | + foreach($value->getLangs() as $lang) { | ||
77 | + ?> | ||
78 | + <div class="form-group"> | ||
79 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
80 | + <div class="col-xs-11"><input type="<?=$value->template?>" name="Option[0][lang][<?=$key?>][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$index][$key][$lang['language_id']]->value?>"/></div> | ||
81 | + </div> | ||
82 | + <?php | ||
83 | + } | ||
84 | + ?> | ||
85 | + </div> | ||
86 | + <?php | ||
87 | + } ?> | ||
88 | + </div> | ||
89 | + <?php | ||
90 | + if($first) { | ||
91 | + ?> | ||
92 | + </div> | ||
93 | + <?php | ||
94 | + $first = 0; | ||
95 | + } | ||
96 | + } | ||
97 | + } | ||
98 | + }?> | ||
99 | + | ||
100 | + <div class="form-group"> | ||
101 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
102 | + </div> | ||
103 | + | ||
104 | + <?php ActiveForm::end(); ?> | ||
105 | + <script> | ||
106 | + $(function() { | ||
107 | + var counter = 0; | ||
108 | + $(document).on('click', '.add_row', function() { | ||
109 | + counter++; | ||
110 | + var clone = $('#main_row').clone().html().replace(new RegExp("Option\\[0\\]", 'g'), "Option["+counter+"]"); | ||
111 | + $(clone).appendTo('#<?=$form->getId()?>'); | ||
112 | + $('#<?=$form->getId()?> button[type=submit]').parent().appendTo('#<?=$form->getId()?>'); | ||
113 | + }); | ||
114 | + $(document).on('click', '.add_lang', function() { | ||
115 | + var field_block = $(this).parent().parent(); | ||
116 | + if($(this).hasClass('active')) { | ||
117 | + $(field_block).find('.main_input').attr('required', '').show(); | ||
118 | + $(field_block).find('.lang_inputs').hide(); | ||
119 | + $(this).removeClass('active'); | ||
120 | + } else { | ||
121 | + $(field_block).find('.main_input').removeAttr('required').hide(); | ||
122 | + $(field_block).find('.lang_inputs').show(); | ||
123 | + $(this).addClass('active'); | ||
124 | + } | ||
125 | + }); | ||
126 | + }); | ||
127 | + </script> | ||
128 | +</div> |
1 | +++ a/backend/views/option/_form_edit.php | ||
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\Option */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="option-form"> | ||
12 | + <?php $form = ActiveForm::begin(); ?> | ||
13 | + <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | ||
14 | + <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | ||
15 | + <?php foreach($models as $id => $row) { | ||
16 | + ?> | ||
17 | + <label for="Option[<?=$id?>][<?=$key?>]"><?php echo Yii::t('app', $key); ?></label> | ||
18 | + <input type="hidden" name="Option[<?=$id?>][id]" value="<?=$id?>" /> | ||
19 | + <input type="hidden" name="Option[<?=$id?>][template]" value="<?=$row->template?>"/> | ||
20 | + <input type="<?=$row->template?>" name="Option[<?=$id?>][value][<?=$row->name?>]" class="form-control required" required value="<?=$modellang[$id][0]->value?>"/> | ||
21 | + <?php if($row->hasErrors()) { ?><div class="help-block"><?php echo $modellang[$id][0]->getFirstError('value');?></div> <?php } ?> | ||
22 | + <?php | ||
23 | + if($row->translate) { | ||
24 | + foreach($row->getLangs() as $language_id => $lang) { | ||
25 | + ?> | ||
26 | + <div class="form-group"> | ||
27 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | ||
28 | + <div class="col-xs-11"><input type="<?=$row->template?>" name="Option[<?=$id?>][lang][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$id][$lang['language_id']]->value?>"/></div> | ||
29 | + </div> | ||
30 | + <?php | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
34 | + }?> | ||
35 | + | ||
36 | + <div class="form-group"> | ||
37 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
38 | + </div> | ||
39 | + | ||
40 | + <?php ActiveForm::end(); ?> | ||
41 | +</div> |
1 | +++ a/backend/views/option/_search.php | ||
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\OptionSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="option-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'option_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'model') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'model_id') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'name') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'template') ?> | ||
27 | + | ||
28 | + <?php // echo $form->field($model, 'parent_id') ?> | ||
29 | + | ||
30 | + <div class="form-group"> | ||
31 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
32 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
33 | + </div> | ||
34 | + | ||
35 | + <?php ActiveForm::end(); ?> | ||
36 | + | ||
37 | +</div> |
1 | +++ a/backend/views/option/create.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model frontend\models\Option */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Option'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="option-create"> | ||
14 | + <h1><?= Html::encode($this->title) ?></h1> | ||
15 | + <?php foreach($forms as $oneform) { | ||
16 | + echo $this->render('_form', $oneform); | ||
17 | + }?> | ||
18 | + | ||
19 | +</div> |
1 | +++ a/backend/views/option/index.php | ||
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\OptionSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Options'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="col-xs-6"> | ||
14 | + <div class="option-index"> | ||
15 | + | ||
16 | + <h1><?= Html::encode($this->title) ?></h1> | ||
17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
18 | + | ||
19 | + <p> | ||
20 | + <?= Html::a(Yii::t('app', 'Create Option'), ['create'], ['class' => 'btn btn-success']) ?> | ||
21 | + </p> | ||
22 | + | ||
23 | + <?= GridView::widget([ | ||
24 | + 'dataProvider' => $dataProvider, | ||
25 | + 'filterModel' => $searchModel, | ||
26 | + 'columns' => [ | ||
27 | + ['class' => 'yii\grid\SerialColumn'], | ||
28 | + | ||
29 | + 'option_id', | ||
30 | + 'model', | ||
31 | + 'model_id', | ||
32 | + 'name', | ||
33 | + 'template', | ||
34 | + // 'parent_id', | ||
35 | + | ||
36 | + ['class' => 'yii\grid\ActionColumn'], | ||
37 | + ], | ||
38 | + ]); ?> | ||
39 | + | ||
40 | + </div> | ||
41 | +</div> | ||
42 | +<div class="col-xs-6"> | ||
43 | + <div class="option-index"> | ||
44 | + | ||
45 | + <h1><?= Html::encode($this->title) ?></h1> | ||
46 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
47 | + | ||
48 | + <p> | ||
49 | + <?= Html::a(Yii::t('app', 'Create Option'), ['create'], ['class' => 'btn btn-success']) ?> | ||
50 | + </p> | ||
51 | + | ||
52 | + <?= GridView::widget([ | ||
53 | + 'dataProvider' => $dataProvider, | ||
54 | + 'filterModel' => $searchModel, | ||
55 | + 'columns' => [ | ||
56 | + ['class' => 'yii\grid\SerialColumn'], | ||
57 | + | ||
58 | + 'option_id', | ||
59 | + 'model', | ||
60 | + 'model_id', | ||
61 | + 'name', | ||
62 | + 'template', | ||
63 | + // 'parent_id', | ||
64 | + | ||
65 | + ['class' => 'yii\grid\ActionColumn'], | ||
66 | + ], | ||
67 | + ]); ?> | ||
68 | + | ||
69 | + </div> | ||
70 | +</div> | ||
71 | +<div class="clearfix"></div> | ||
0 | \ No newline at end of file | 72 | \ No newline at end of file |
1 | +++ a/backend/views/option/update.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model frontend\models\Option */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Option', | ||
10 | +]) . ' ' . $forms[0]['models'][\Yii::$app->request->get('id')]->name; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $forms[0]['models'][\Yii::$app->request->get('id')]->name, 'url' => ['view', 'id' => $forms[0]['models'][\Yii::$app->request->get('id')]->option_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="option-update"> | ||
16 | + <h1><?= Html::encode($this->title) ?></h1> | ||
17 | + <?php foreach($forms as $oneform) { | ||
18 | + echo $this->render('_form_edit', $oneform); | ||
19 | + }?> | ||
20 | + | ||
21 | +</div> |
1 | +++ a/backend/views/option/view.php | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model frontend\models\Option */ | ||
8 | + | ||
9 | +$this->title = $model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="option-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->option_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->option_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 | + 'option_id', | ||
32 | + 'model', | ||
33 | + 'model_id', | ||
34 | + 'name', | ||
35 | + 'template', | ||
36 | + 'parent_id', | ||
37 | + ], | ||
38 | + ]) ?> | ||
39 | + | ||
40 | +</div> |