Commit 0829b346c10199fc542f057aa3c2daa5a031f7d7

Authored by andryeyev
1 parent e3ec491c

- термины

backend/controllers/PageController.php deleted
1 -<?php  
2 -  
3 -namespace backend\controllers;  
4 -  
5 -use Yii;  
6 -use common\models\Page;  
7 -use backend\models\SearchPage;  
8 -use yii\web\Controller;  
9 -use yii\web\NotFoundHttpException;  
10 -use yii\filters\VerbFilter;  
11 -use common\models\PageLang;  
12 -  
13 -/**  
14 - * PageController implements the CRUD actions for Page model.  
15 - */  
16 -class PageController 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 - /**  
32 - * Lists all Page models.  
33 - * @return mixed  
34 - */  
35 - public function actionIndex()  
36 - {  
37 - $searchModel = new SearchPage();  
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 Page 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 Page 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 Page();  
66 -  
67 - if ($model->load(Yii::$app->request->post()) && $model->save())  
68 - {  
69 - // сохраняем в таблицу page_lang  
70 - $model2 = new PageLang();  
71 -  
72 - // передаем переменные  
73 - $model2->attributes = $_POST['Page'];  
74 - $model2->page_id = $model->page_id;  
75 - $model2->lang_id = Yii::$app->lang_id;  
76 -  
77 - // сохраняем  
78 - $model2->save();  
79 -  
80 - return $this->redirect(['view', 'id' => $model->page_id]);  
81 - }  
82 - else  
83 - {  
84 - return $this->render('create', [  
85 - 'model' => $model,  
86 - ]);  
87 - }  
88 - }  
89 -  
90 - /**  
91 - * Updates an existing Page model.  
92 - * If update is successful, the browser will be redirected to the 'view' page.  
93 - * @param integer $id  
94 - * @return mixed  
95 - */  
96 - public function actionUpdate($id)  
97 - {  
98 - $model = $this->findModel($id);  
99 -  
100 - if ($model->load(Yii::$app->request->post()) && $model->save())  
101 - {  
102 - // сохраняем в таблицу page_lang  
103 - $model2 = new PageLang();  
104 -  
105 - // передаем переменные  
106 - if ($array = $model->findPageLangField($_POST['Page']))  
107 - {  
108 - // сохраняем  
109 - $model2->updateAll($array, ['page_id' => $id, 'lang_id' => Yii::$app->lang_id]);  
110 - }  
111 -  
112 - return $this->redirect(['view', 'id' => $model->page_id]);  
113 - }  
114 - else  
115 - {  
116 - return $this->render('update', [  
117 - 'model' => $model,  
118 - ]);  
119 - }  
120 - }  
121 -  
122 - /**  
123 - * Deletes an existing Page model.  
124 - * If deletion is successful, the browser will be redirected to the 'index' page.  
125 - * @param integer $id  
126 - * @return mixed  
127 - */  
128 - public function actionDelete($id)  
129 - {  
130 - // удаляем page  
131 - $this->findModel($id)->delete();  
132 -  
133 - // удаляем page_lang  
134 - $model2 = new PageLang();  
135 - $model2->deleteAll('page_id = '.(int)$id);  
136 -  
137 - return $this->redirect(['index']);  
138 - }  
139 -  
140 - /**  
141 - * Finds the Page model based on its primary key value.  
142 - * If the model is not found, a 404 HTTP exception will be thrown.  
143 - * @param integer $id  
144 - * @return Page the loaded model  
145 - * @throws NotFoundHttpException if the model cannot be found  
146 - */  
147 - protected function findModel($id)  
148 - {  
149 - if (($model = Page::findOne(['page_id' => $id])) !== null) {  
150 - return $model;  
151 - } else {  
152 - throw new NotFoundHttpException('The requested page does not exist.');  
153 - }  
154 - }  
155 -}  
backend/controllers/TerminController.php deleted
1 -<?php  
2 -  
3 -namespace backend\controllers;  
4 -  
5 -use Yii;  
6 -use common\models\Termin;  
7 -use backend\models\SearchTermin;  
8 -use yii\web\Controller;  
9 -use yii\web\NotFoundHttpException;  
10 -use yii\filters\VerbFilter;  
11 -  
12 -/**  
13 - * TerminController implements the CRUD actions for Termin model.  
14 - */  
15 -class TerminController 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 Termin models.  
31 - * @return mixed  
32 - */  
33 - public function actionIndex()  
34 - {  
35 - $searchModel = new SearchTermin();  
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 Termin 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 Termin 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 Termin();  
64 -  
65 - if ($model->load(Yii::$app->request->post()) && $model->save()) {  
66 - return $this->redirect(['view', 'id' => $model->termin_id]);  
67 - } else {  
68 - return $this->render('create', [  
69 - 'model' => $model,  
70 - ]);  
71 - }  
72 - }  
73 -  
74 - /**  
75 - * Updates an existing Termin 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->termin_id]);  
86 - } else {  
87 - return $this->render('update', [  
88 - 'model' => $model,  
89 - ]);  
90 - }  
91 - }  
92 -  
93 - /**  
94 - * Deletes an existing Termin 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 Termin 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 Termin the loaded model  
111 - * @throws NotFoundHttpException if the model cannot be found  
112 - */  
113 - protected function findModel($id)  
114 - {  
115 - if (($model = Termin::findOne($id)) !== null) {  
116 - return $model;  
117 - } else {  
118 - throw new NotFoundHttpException('The requested page does not exist.');  
119 - }  
120 - }  
121 -}  
backend/controllers/Termin_langController.php deleted
1 -<?php  
2 -  
3 -namespace backend\controllers;  
4 -  
5 -use Yii;  
6 -use common\models\TerminLang;  
7 -use backend\models\TerminLangSearch;  
8 -use yii\web\Controller;  
9 -use yii\web\NotFoundHttpException;  
10 -use yii\filters\VerbFilter;  
11 -use common\models\Termin;  
12 -use common\models\TerminOption;  
13 -  
14 -/**  
15 - * Termin_langController implements the CRUD actions for TerminLang model.  
16 - */  
17 -class Termin_langController extends Controller  
18 -{  
19 - var $lang_id = 1;  
20 -  
21 - public function behaviors()  
22 - {  
23 - $this->castyl();  
24 -  
25 - return [  
26 - 'verbs' => [  
27 - 'class' => VerbFilter::className(),  
28 - 'actions' => [  
29 - 'delete' => ['post'],  
30 - ],  
31 - ],  
32 - ];  
33 - }  
34 -  
35 - public function castyl()  
36 - {  
37 - $this->lang_id = isset ($_GET['lang_id']) ? $_GET['lang_id'] : 1;  
38 - }  
39 -  
40 - /**  
41 - * Lists all TerminLang models.  
42 - * @return mixed  
43 - */  
44 - public function actionIndex()  
45 - {  
46 - $searchModel = new TerminLangSearch();  
47 - $searchModel->lang_id = $this->lang_id;  
48 -  
49 - $dataProvider = $searchModel->search(Yii::$app->request->queryParams);  
50 -  
51 - return $this->render('index', [  
52 - 'searchModel' => $searchModel,  
53 - 'dataProvider' => $dataProvider,  
54 - ]);  
55 - }  
56 -  
57 - /**  
58 - * Displays a single TerminLang model.  
59 - * @param integer $termin_id  
60 - * @param integer $lang_id  
61 - * @return mixed  
62 - */  
63 - public function actionView($termin_id)  
64 - {  
65 - return $this->render('view', [  
66 - 'model' => $this->findModel($termin_id, $this->lang_id),  
67 - ]);  
68 - }  
69 -  
70 - /**  
71 - * Creates a new TerminLang 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 - $termin = new Termin();  
78 - $termin_lang = new TerminLang();  
79 -  
80 - if ($termin_lang->load(Yii::$app->request->post())) {  
81 -  
82 - $termin->termin_id = '';  
83 - $termin->save();  
84 - $termin_lang->termin_id = $termin->termin_id;  
85 - $termin_lang->save();  
86 -  
87 - return $this->redirect(['index']);  
88 - } else {  
89 - return $this->render('create', [  
90 - 'termin_lang' => $termin_lang,  
91 - 'termin' => $termin,  
92 - ]);  
93 - }  
94 - }  
95 -  
96 - public function actionCreate_parent($termin_id)  
97 - {  
98 - $termin = new Termin();  
99 - $termin_lang = new TerminLang();  
100 - $termin_option = new TerminOption();  
101 -  
102 - if ($termin_lang->load(Yii::$app->request->post())) {  
103 -  
104 - $termin->termin_id = '';  
105 - $termin->save();  
106 - // var_dump($termin->termin_id);die();  
107 - $termin_lang->termin_id = $termin->termin_id;  
108 - $termin_lang->save();  
109 -  
110 - $termin_option->termin_id = $termin->termin_id;  
111 - $termin_option->termin_pid = $termin_id;  
112 - $termin_option->save();  
113 -  
114 -  
115 - return $this->redirect(['index']);  
116 - } else {  
117 - return $this->render('create', [  
118 - 'termin_lang' => $termin_lang,  
119 - 'termin' => $termin,  
120 - ]);  
121 - }  
122 - }  
123 -  
124 - /**  
125 - * Updates an existing TerminLang model.  
126 - * If update is successful, the browser will be redirected to the 'view' page.  
127 - * @param integer $termin_id  
128 - * @param integer $lang_id  
129 - * @return mixed  
130 - */  
131 - public function actionUpdate($termin_id)  
132 - {  
133 - $model = $this->findModel($termin_id, $this->lang_id);  
134 -  
135 - if ($model->load(Yii::$app->request->post()) && $model->save()) {  
136 - return $this->redirect(['view', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id]);  
137 - } else {  
138 - return $this->render('update', [  
139 - 'model' => $model,  
140 - ]);  
141 - }  
142 - }  
143 -  
144 - /**  
145 - * Deletes an existing TerminLang model.  
146 - * If deletion is successful, the browser will be redirected to the 'index' page.  
147 - * @param integer $termin_id  
148 - * @param integer $lang_id  
149 - * @return mixed  
150 - */  
151 - public function actionDelete($termin_id)  
152 - {  
153 - $this->findModel($termin_id, $this->lang_id)->delete();  
154 -  
155 - return $this->redirect(['index']);  
156 - }  
157 -  
158 - /**  
159 - * Finds the TerminLang model based on its primary key value.  
160 - * If the model is not found, a 404 HTTP exception will be thrown.  
161 - * @param integer $termin_id  
162 - * @param integer $lang_id  
163 - * @return TerminLang the loaded model  
164 - * @throws NotFoundHttpException if the model cannot be found  
165 - */  
166 - protected function findModel($termin_id)  
167 - {  
168 - if (($model = TerminLang::findOne(['termin_id' => $termin_id, 'lang_id' => $this->lang_id])) !== null) {  
169 - return $model;  
170 - } else {  
171 - throw new NotFoundHttpException('The requested page does not exist.');  
172 - }  
173 - }  
174 -}  
backend/controllers/_LanguageController.php deleted
1 -<?php  
2 -  
3 -namespace backend\controllers;  
4 -  
5 -use Yii;  
6 -use backend\models\Language;  
7 -use backend\models\LanguageLang;  
8 -use backend\models\LanguageSearch;  
9 -use yii\web\Controller;  
10 -use yii\web\NotFoundHttpException;  
11 -use yii\filters\VerbFilter;  
12 -  
13 -/**  
14 - * LanguageController implements the CRUD actions for Language model.  
15 - */  
16 -class LanguageController extends Controller  
17 -{  
18 - public $layoutdata;  
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 Language models.  
33 - * @return mixed  
34 - */  
35 - public function init() {  
36 - parent::init();  
37 - $this->layoutdata = $this->layoutData();  
38 - }  
39 - public function layoutData() {  
40 - $searchModel = new LanguageSearch();  
41 - $dataProvider = $searchModel->search(Yii::$app->request->queryParams);  
42 - return [  
43 - 'searchModel' => $searchModel,  
44 - 'dataProvider' => $dataProvider,  
45 - ];  
46 - }  
47 - public function actionIndex()  
48 - {  
49 - return $this->render('index', $this->layoutdata);  
50 - }  
51 -  
52 - /**  
53 - * Displays a single Language model.  
54 - * @param integer $id  
55 - * @return mixed  
56 - */  
57 - public function actionView($id)  
58 - {  
59 - return $this->render('view', [  
60 - 'model' => $this->findModel($id),  
61 - 'layoutdata' => $this->layoutdata  
62 - ]);  
63 - }  
64 -  
65 - /**  
66 - * Creates a new Language model.  
67 - * If creation is successful, the browser will be redirected to the 'view' page.  
68 - * @return mixed  
69 - */  
70 - public function actionCreate()  
71 - {  
72 - $model[0] = new Language();  
73 - $model[1] = new LanguageLang();  
74 - if ($model[0]->load(Yii::$app->request->post()) && $model[0]->save()) {  
75 - $model[1]->language_id = $model[0]->language_id;  
76 - if($model[1]->load(Yii::$app->request->post()) && $model[1]->save()) {  
77 - return $this->redirect(['view', 'id' => $model[0]->language_id]);  
78 - } else {  
79 - return $this->render('create', [  
80 - 'model' => $model,  
81 - 'layoutdata' => $this->layoutdata  
82 - ]);  
83 - }  
84 - } else {  
85 - return $this->render('create', [  
86 - 'model' => $model,  
87 - 'layoutdata' => $this->layoutdata  
88 - ]);  
89 - }  
90 - }  
91 -  
92 - /**  
93 - * Updates an existing Language model.  
94 - * If update is successful, the browser will be redirected to the 'view' page.  
95 - * @param integer $id  
96 - * @return mixed  
97 - */  
98 - public function actionUpdate($id)  
99 - {  
100 - $model[0] = $this->findModel($id);  
101 - $model[1] = LanguageLang::findOne(['language_id' => $id]);  
102 -  
103 - if ($model[0]->load(Yii::$app->request->post()) && $model[1]->load(Yii::$app->request->post()) && $model[0]->save() && $model[1]->save()) {  
104 - return $this->redirect(['view', 'id' => $model[0]->language_id]);  
105 - } else {  
106 - return $this->render('update', [  
107 - 'model' => $model,  
108 - 'layoutdata' => $this->layoutdata  
109 - ]);  
110 - }  
111 - }  
112 -  
113 - /**  
114 - * Deletes an existing Language model.  
115 - * If deletion is successful, the browser will be redirected to the 'index' page.  
116 - * @param integer $id  
117 - * @return mixed  
118 - */  
119 - public function actionDelete($id)  
120 - {  
121 - $this->findModel($id)->delete();  
122 -  
123 - return $this->redirect(['index']);  
124 - }  
125 -  
126 - /**  
127 - * Finds the Language model based on its primary key value.  
128 - * If the model is not found, a 404 HTTP exception will be thrown.  
129 - * @param integer $id  
130 - * @return Language the loaded model  
131 - * @throws NotFoundHttpException if the model cannot be found  
132 - */  
133 - protected function findModel($id)  
134 - {  
135 - if (($model = Language::findOne($id)) !== null) {  
136 - return $model;  
137 - } else {  
138 - throw new NotFoundHttpException('The requested page does not exist.');  
139 - }  
140 - }  
141 -}  
backend/models/_Language.php deleted
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 integer $is_default  
13 - */  
14 -class Language extends \yii\db\ActiveRecord  
15 -{  
16 - /**  
17 - * @inheritdoc  
18 - */  
19 - public static function tableName()  
20 - {  
21 - return 'language';  
22 - }  
23 -  
24 - /**  
25 - * @inheritdoc  
26 - */  
27 - public function rules()  
28 - {  
29 - return [  
30 - [['lang_code', 'is_default'], 'required'],  
31 - [['is_default'], 'integer'],  
32 - [['lang_code'], 'string', 'max' => 4]  
33 - ];  
34 - }  
35 -  
36 - /**  
37 - * @inheritdoc  
38 - */  
39 - public function attributeLabels()  
40 - {  
41 - return [  
42 - 'language_id' => Yii::t('app', 'Language ID'),  
43 - 'lang_code' => Yii::t('app', 'Lang Code'),  
44 - 'is_default' => Yii::t('app', 'Is Default'),  
45 - ];  
46 - }  
47 -}  
backend/views/page/_form.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -use yii\widgets\ActiveForm;  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\Page */  
8 -/* @var $form yii\widgets\ActiveForm */  
9 -?>  
10 -  
11 -<div class="page-form">  
12 -  
13 - <?php $form = ActiveForm::begin(); ?>  
14 -  
15 - <h2><?= Yii::t('field', 'common'); ?></h2>  
16 -  
17 - <?  
18 - // по умолчанию  
19 - if (empty ($model->date_add))  
20 - {  
21 - $model->date_add = date('Y-m-d');  
22 - }  
23 -  
24 - echo $form->field($model, 'date_add')->widget(\yii\jui\DatePicker::classname(), [  
25 - 'language' => yii::$app->language,  
26 - 'dateFormat' => 'yyyy-MM-dd',  
27 - ]);  
28 - ?>  
29 -  
30 - <?= $form->field($model, 'template_id')->textInput() ?>  
31 -  
32 - <?= $form->field($model, 'image_id')->textInput() ?>  
33 -  
34 - <?= $form->field($model, 'show')->dropDownList(['1' => Yii::t('action', 'show'), '0' => Yii::t('action', 'hide')]) ?>  
35 -  
36 - <h2><?= Yii::t('field', 'lang'); ?></h2>  
37 -  
38 - <?= $form->field($model, 'title')->textInput() ?>  
39 -  
40 - <?= $form->field($model, 'meta_title')->textarea() ?>  
41 -  
42 - <?= $form->field($model, 'meta_description')->textarea() ?>  
43 -  
44 - <?= $form->field($model, 'text')->textarea(['row' => 4]) ?>  
45 -  
46 - <?= $form->field($model, 'page_alias')->textInput() ?>  
47 -  
48 - <div class="form-group">  
49 - <?= Html::submitButton(  
50 - $model->isNewRecord ?  
51 - Yii::t('action', 'add') :  
52 - Yii::t('action', 'update'),  
53 - ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']  
54 - ) ?>  
55 - </div>  
56 -  
57 - <?php ActiveForm::end(); ?>  
58 -  
59 -</div>  
backend/views/page/_search.php deleted
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\SearchPage */  
8 -/* @var $form yii\widgets\ActiveForm */  
9 -?>  
10 -  
11 -<div class="page-search">  
12 -  
13 - <?php $form = ActiveForm::begin([  
14 - 'action' => ['index'],  
15 - 'method' => 'get',  
16 - ]); ?>  
17 -  
18 - <?= $form->field($model, 'page_id') ?>  
19 -  
20 - <?= $form->field($model, 'date_add') ?>  
21 -  
22 - <?= $form->field($model, 'template_id') ?>  
23 -  
24 - <?= $form->field($model, 'image_id') ?>  
25 -  
26 - <?= $form->field($model, 'show') ?>  
27 -  
28 - <div class="form-group">  
29 - <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>  
30 - <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>  
31 - </div>  
32 -  
33 - <?php ActiveForm::end(); ?>  
34 -  
35 -</div>  
backend/views/page/create.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\Page */  
8 -  
9 -$this->title = 'Create Page';  
10 -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="page-create">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <?= $this->render('_form', [  
18 - 'model' => $model,  
19 - ]) ?>  
20 -  
21 -</div>  
backend/views/page/index.php deleted
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\SearchPage */  
8 -/* @var $dataProvider yii\data\ActiveDataProvider */  
9 -  
10 -$this->title = 'Pages';  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="page-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('action', 'add'), ['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 - 'page_id',  
29 - 'date_add',  
30 - 'title',  
31 - 'template_id',  
32 - 'show',  
33 -  
34 - ['class' => 'yii\grid\ActionColumn'],  
35 - ],  
36 - ]); ?>  
37 -  
38 -</div>  
backend/views/page/update.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -  
5 -/* @var $this yii\web\View */  
6 -/* @var $model common\models\Page */  
7 -  
8 -$this->title = Yii::t('action', 'edit').': ' . ' ' . $model->title;  
9 -$this->params['breadcrumbs'][] = ['label' => Yii::t('field', 'page'), 'url' => ['index']];  
10 -$this->params['breadcrumbs'][] = ['label' => $model->page_id, 'url' => [Yii::t('action', 'view'), 'id' => $model->page_id]];  
11 -$this->params['breadcrumbs'][] = Yii::t('action', 'update');  
12 -?>  
13 -<div class="page-update">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <?= $this->render('_form', [  
18 - 'model' => $model,  
19 - ]) ?>  
20 -  
21 -</div>  
backend/views/page/view.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -use yii\widgets\DetailView;  
5 -use yii\data\Pagination;  
6 -  
7 -/* @var $this yii\web\View */  
8 -/* @var $model common\models\Page */  
9 -  
10 -$this->title = $model->page_id;  
11 -$this->params['breadcrumbs'][] = ['label' => Yii::t('field', 'n, page', ['n' => 1]), 'url' => ['index']];  
12 -$this->params['breadcrumbs'][] = Yii::t('field', 'n, page', ['n' => 'few']);  
13 -?>  
14 -<div class="page-view">  
15 -  
16 - <h1><?= Html::encode($this->title) ?></h1>  
17 -  
18 - <p>  
19 - <?= Html::a('Update', ['update', 'id' => $model->page_id], ['class' => 'btn btn-primary']) ?>  
20 - <?= Html::a('Delete', ['delete', 'id' => $model->page_id], [  
21 - 'class' => 'btn btn-danger',  
22 - 'data' => [  
23 - 'confirm' => 'Are you sure you want to delete this item?',  
24 - 'method' => 'post',  
25 - ],  
26 - ]) ?>  
27 - </p>  
28 -  
29 - <?= DetailView::widget([  
30 - 'model' => $model,  
31 - 'attributes' => [  
32 - 'page_id',  
33 - 'date_add',  
34 - 'template_id',  
35 - 'image_id',  
36 - 'show',  
37 - ],  
38 - ]) ?>  
39 -  
40 -</div>  
backend/views/termin/_form.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -use yii\widgets\ActiveForm;  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\Termin */  
8 -/* @var $form yii\widgets\ActiveForm */  
9 -?>  
10 -  
11 -<div class="termin-form">  
12 -  
13 - <?php $form = ActiveForm::begin(); ?>  
14 -  
15 - <?= $form->field($model, 'termin_pid')->textInput() ?>  
16 -  
17 - <?= $form->field($model, 'lfr')->textInput() ?>  
18 -  
19 - <?= $form->field($model, 'rgt')->textInput() ?>  
20 -  
21 - <?= $form->field($model, 'termin_type_id')->textInput() ?>  
22 -  
23 - <?= $form->field($model, 'page_id')->textInput() ?>  
24 -  
25 - <div class="form-group">  
26 - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>  
27 - </div>  
28 -  
29 - <?php ActiveForm::end(); ?>  
30 -  
31 -</div>  
backend/views/termin/_search.php deleted
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\SearchTermin */  
8 -/* @var $form yii\widgets\ActiveForm */  
9 -?>  
10 -  
11 -<div class="termin-search">  
12 -  
13 - <?php $form = ActiveForm::begin([  
14 - 'action' => ['index'],  
15 - 'method' => 'get',  
16 - ]); ?>  
17 -  
18 - <?= $form->field($model, 'termin_id') ?>  
19 -  
20 - <?= $form->field($model, 'termin_pid') ?>  
21 -  
22 - <?= $form->field($model, 'lfr') ?>  
23 -  
24 - <?= $form->field($model, 'rgt') ?>  
25 -  
26 - <?= $form->field($model, 'termin_type_id') ?>  
27 -  
28 - <?php // echo $form->field($model, 'page_id') ?>  
29 -  
30 - <div class="form-group">  
31 - <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>  
32 - <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>  
33 - </div>  
34 -  
35 - <?php ActiveForm::end(); ?>  
36 -  
37 -</div>  
backend/views/termin/create.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\Termin */  
8 -  
9 -$this->title = 'Create Termin';  
10 -$this->params['breadcrumbs'][] = ['label' => 'Termins', 'url' => ['index']];  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="termin-create">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <?= $this->render('_form', [  
18 - 'model' => $model,  
19 - ]) ?>  
20 -  
21 -</div>  
backend/views/termin/index.php deleted
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\SearchTermin */  
8 -/* @var $dataProvider yii\data\ActiveDataProvider */  
9 -  
10 -$this->title = 'Termins';  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="termin-index">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 - <?php // echo $this->render('_search', ['model' => $searchModel]); ?>  
17 -  
18 - <p>  
19 - <?= Html::a('Create Termin', ['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 - 'termin_id',  
29 - 'termin_pid',  
30 - 'lfr',  
31 - 'rgt',  
32 - 'termin_type_id',  
33 - // 'page_id',  
34 -  
35 - ['class' => 'yii\grid\ActionColumn'],  
36 - ],  
37 - ]); ?>  
38 -  
39 -</div>  
backend/views/termin/update.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -  
5 -/* @var $this yii\web\View */  
6 -/* @var $model common\models\Termin */  
7 -  
8 -$this->title = 'Update Termin: ' . ' ' . $model->termin_id;  
9 -$this->params['breadcrumbs'][] = ['label' => 'Termins', 'url' => ['index']];  
10 -$this->params['breadcrumbs'][] = ['label' => $model->termin_id, 'url' => ['view', 'id' => $model->termin_id]];  
11 -$this->params['breadcrumbs'][] = 'Update';  
12 -?>  
13 -<div class="termin-update">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <?= $this->render('_form', [  
18 - 'model' => $model,  
19 - ]) ?>  
20 -  
21 -</div>  
backend/views/termin/view.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -use yii\widgets\DetailView;  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\Termin */  
8 -  
9 -$this->title = $model->termin_id;  
10 -$this->params['breadcrumbs'][] = ['label' => 'Termins', 'url' => ['index']];  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="termin-view">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <p>  
18 - <?= Html::a('Update', ['update', 'id' => $model->termin_id], ['class' => 'btn btn-primary']) ?>  
19 - <?= Html::a('Delete', ['delete', 'id' => $model->termin_id], [  
20 - 'class' => 'btn btn-danger',  
21 - 'data' => [  
22 - 'confirm' => 'Are you sure you want to delete this item?',  
23 - 'method' => 'post',  
24 - ],  
25 - ]) ?>  
26 - </p>  
27 -  
28 - <?= DetailView::widget([  
29 - 'model' => $model,  
30 - 'attributes' => [  
31 - 'termin_id',  
32 - 'termin_pid',  
33 - 'lfr',  
34 - 'rgt',  
35 - 'termin_type_id',  
36 - 'page_id',  
37 - ],  
38 - ]) ?>  
39 -  
40 -</div>  
backend/views/termin_lang/_form.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -use yii\widgets\ActiveForm;  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\TerminLang */  
8 -/* @var $form yii\widgets\ActiveForm */  
9 -?>  
10 -  
11 -<div class="termin-lang-form">  
12 -  
13 - <?php $form = ActiveForm::begin(); ?>  
14 -  
15 - <?= $form->field($termin_lang, 'termin_title')->textInput(['maxlength' => 256]) ?>  
16 -  
17 - <div class="form-group">  
18 - <?= Html::submitButton($termin_lang->isNewRecord ? 'Create' : 'Update', ['class' => $termin_lang->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>  
19 - </div>  
20 -  
21 - <?php ActiveForm::end(); ?>  
22 -  
23 -</div>  
backend/views/termin_lang/_search.php deleted
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\TerminLangSearch */  
8 -/* @var $form yii\widgets\ActiveForm */  
9 -?>  
10 -  
11 -<div class="termin-lang-search">  
12 -  
13 - <?php $form = ActiveForm::begin([  
14 - 'action' => ['index'],  
15 - 'method' => 'get',  
16 - ]); ?>  
17 -  
18 - <?= $form->field($model, 'termin_id') ?>  
19 -  
20 - <?= $form->field($model, 'termin_title') ?>  
21 -  
22 - <?= $form->field($model, 'lang_id') ?>  
23 -  
24 - <div class="form-group">  
25 - <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>  
26 - <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>  
27 - </div>  
28 -  
29 - <?php ActiveForm::end(); ?>  
30 -  
31 -</div>  
backend/views/termin_lang/create.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\TerminLang */  
8 -  
9 -$this->title = 'Добавить Термин';  
10 -$this->params['breadcrumbs'][] = ['label' => 'Termin Langs', 'url' => ['index']];  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="termin-lang-create">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <?= $this->render('_form', [  
18 - 'termin_lang' => $termin_lang,  
19 - 'termin' => $termin,  
20 - ]) ?>  
21 -  
22 -</div>  
backend/views/termin_lang/index.php deleted
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\TerminLangSearch */  
8 -/* @var $dataProvider yii\data\ActiveDataProvider */  
9 -  
10 -$this->title = 'Термин';  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="termin-lang-index">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 - <?php // echo $this->render('_search', ['model' => $searchModel]); ?>  
17 -  
18 - <p>  
19 - <?= Html::a('Create Termin 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 - 'termin_id',  
29 - 'termin_title',  
30 - 'lang_id',  
31 -  
32 - [  
33 - 'class' => 'yii\grid\ActionColumn',  
34 - 'template' => '{create} {view} {update} {delete} {create_parent}',  
35 - 'buttons' => [  
36 - 'create_parent' => function ($url, $model, $key) {  
37 - return Html::a('<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>', $url);  
38 - }  
39 - ],  
40 - ],  
41 - ],  
42 - ]); ?>  
43 -  
44 -</div>  
backend/views/termin_lang/update.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -  
5 -/* @var $this yii\web\View */  
6 -/* @var $model common\models\TerminLang */  
7 -  
8 -$this->title = 'Редактировать Термин: ' . ' ' . $model->termin_id;  
9 -$this->params['breadcrumbs'][] = ['label' => 'Termin Langs', 'url' => ['index']];  
10 -$this->params['breadcrumbs'][] = ['label' => $model->termin_id, 'url' => ['view', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id]];  
11 -$this->params['breadcrumbs'][] = 'Update';  
12 -?>  
13 -<div class="termin-lang-update">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <?= $this->render('_form', [  
18 - 'termin_lang' => $model,  
19 - ]) ?>  
20 -  
21 -</div>  
backend/views/termin_lang/view.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -use yii\widgets\DetailView;  
5 -  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\TerminLang */  
8 -  
9 -$this->title = 'Термин: '.$model->termin_title;  
10 -$this->params['breadcrumbs'][] = ['label' => 'Термин', 'url' => ['index']];  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -?>  
13 -<div class="termin-lang-view">  
14 -  
15 - <h1><?= Html::encode($this->title) ?></h1>  
16 -  
17 - <p>  
18 - <?= Html::a('Update', ['update', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id], ['class' => 'btn btn-primary']) ?>  
19 - <?= Html::a('Delete', ['delete', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id], [  
20 - 'class' => 'btn btn-danger',  
21 - 'data' => [  
22 - 'confirm' => 'Are you sure you want to delete this item?',  
23 - 'method' => 'post',  
24 - ],  
25 - ]) ?>  
26 - </p>  
27 -  
28 - <?= DetailView::widget([  
29 - 'model' => $model,  
30 - 'attributes' => [  
31 - 'termin_id',  
32 - 'termin_title',  
33 - 'lang_id',  
34 - ],  
35 - ]) ?>  
36 -  
37 -</div>  
common/models/Page.php deleted
1 -<?php  
2 -  
3 -namespace common\models;  
4 -  
5 -use Yii;  
6 -use common\models\PageLang;  
7 -  
8 -/**  
9 - * This is the model class for table "page".  
10 - *  
11 - * @property integer $page_id  
12 - * @property string $date_add  
13 - * @property integer $template_id  
14 - * @property integer $image_id  
15 - * @property integer $show  
16 - */  
17 -class Page extends \yii\db\ActiveRecord  
18 -{  
19 - var $data;  
20 -  
21 - //public $title;  
22 - /**  
23 - * @inheritdoc  
24 - */  
25 - public static function tableName()  
26 - {  
27 - return 'page';  
28 - }  
29 -  
30 - // ==== DATA PAGE LANG ====  
31 -  
32 - public function getData()  
33 - {  
34 - $this->data = PageLang::find()->where(['page_id' => $this->page_id, 'lang_id' => yii::$app->lang_id])->one();  
35 - }  
36 -  
37 - public function getDataByKey($key)  
38 - {  
39 - if (! $this->data)  
40 - {  
41 - $this->getData();  
42 - }  
43 -  
44 - return isset ($this->data[$key]) ? $this->data[$key] : '';  
45 - }  
46 -  
47 - // ==== DATA PAGE LANG FIELD ====  
48 -  
49 - public function getTitle()  
50 - {  
51 - return $this->getDataByKey('title');  
52 - }  
53 -  
54 - public function getMeta_title()  
55 - {  
56 - return $this->getDataByKey('meta_title');  
57 - }  
58 -  
59 - public function getMeta_description()  
60 - {  
61 - return $this->getDataByKey('meta_description');  
62 - }  
63 -  
64 - public function getText()  
65 - {  
66 - return $this->getDataByKey('text');  
67 - }  
68 -  
69 - public function getPage_alias()  
70 - {  
71 - return $this->getDataByKey('page_alias');  
72 - }  
73 -  
74 - // ==== PAGE LANG FILTER FIELD ====  
75 -  
76 - public function findPageLangField($post)  
77 - {  
78 - if (! $this->data)  
79 - {  
80 - $this->getData();  
81 - }  
82 -  
83 - if (empty ($this->data) || empty ($post))  
84 - {  
85 - return false;  
86 - }  
87 -  
88 - $result = array ();  
89 -  
90 - foreach ($post as $key1 => $row1)  
91 - {  
92 - foreach ($this->data as $key2 => $row2)  
93 - {  
94 - if ($key1 == $key2)  
95 - {  
96 - $result[$key1] = $row1;  
97 - }  
98 - }  
99 - }  
100 -  
101 - return $result;  
102 - }  
103 -  
104 - // ==== FRONT ====  
105 -  
106 - static function getPageByUrl ($url)  
107 - {  
108 - return yii::$app->db->createCommand('  
109 - SELECT  
110 - `termin`.termin_id, `termin`.page_id,  
111 - `page`.show,  
112 - `template`.template_file  
113 - FROM `termin`  
114 - INNER JOIN `termin_lang` ON `termin_lang`.termin_id = `termin`.termin_id  
115 - AND `termin_lang`.lang_id = '.yii::$app->lang_id.'  
116 - AND `termin_lang`.termin_alias = "'.$url.'"  
117 - INNER JOIN `page` ON `page`.page_id = `termin`.page_id  
118 - INNER JOIN `template` ON `template`.template_id = `termin_lang`.template_id  
119 - ')->queryOne();  
120 - }  
121 -  
122 - static function isShow ($page)  
123 - {  
124 - return $page['show'] == 1 ? true : false;  
125 - }  
126 -  
127 - static function getPageById ($page_id)  
128 - {  
129 - return yii::$app->db->createCommand('  
130 - SELECT *  
131 - FROM `termin`  
132 - INNER JOIN `termin_lang` ON `termin_lang`.termin_id = `termin`.termin_id  
133 - AND `termin_lang`.lang_id = '.yii::$app->lang_id.'  
134 - INNER JOIN `page` ON `page`.page_id = `termin`.page_id  
135 - INNER JOIN `page_lang` ON `page_lang`.page_id = `page`.page_id  
136 - AND `page_lang`.lang_id = '.yii::$app->lang_id.'  
137 - WHERE `termin`.termin_id = "'.(int)$page_id.'"  
138 - ')->queryOne();  
139 - }  
140 -  
141 - // ==== YII ====  
142 -  
143 - /**  
144 - * @inheritdoc  
145 - */  
146 - public function rules()  
147 - {  
148 - return [  
149 - [['date_add', 'template_id', 'image_id', 'show'], 'required'],  
150 - [['date_add'], 'safe'],  
151 - [['template_id', 'image_id', 'show'], 'integer']  
152 - ];  
153 - }  
154 -  
155 - /**  
156 - * @inheritdoc  
157 - */  
158 - public function attributeLabels()  
159 - {  
160 - return [  
161 - 'page_id' => Yii::t('field', 'page'),  
162 - 'date_add' => Yii::t('field', 'date_add'),  
163 - 'template_id' => Yii::t('field', 'template'),  
164 - 'image_id' => Yii::t('field', 'image'),  
165 - 'show' => Yii::t('field', 'show'),  
166 -  
167 - 'title' => Yii::t('field', 'title'),  
168 - 'meta_title' => Yii::t('field', 'meta_title'),  
169 - 'meta_description' => Yii::t('field', 'meta_description'),  
170 - 'text' => Yii::t('field', 'text'),  
171 - 'page_alias' => Yii::t('field', 'page_alias'),  
172 - 'lang_id' => Yii::t('field', 'lang_id'),  
173 - ];  
174 - }  
175 -  
176 -}  
common/models/PageLang.php deleted
1 -<?php  
2 -  
3 -namespace common\models;  
4 -  
5 -use Yii;  
6 -  
7 -/**  
8 - * This is the model class for table "page_lang".  
9 - *  
10 - * @property integer $page_id  
11 - * @property string $title  
12 - * @property string $meta_title  
13 - * @property string $meta_description  
14 - * @property string $text  
15 - * @property string $page_alias  
16 - * @property integer $lang_id  
17 - */  
18 -class PageLang extends \yii\db\ActiveRecord  
19 -{  
20 - /**  
21 - * @inheritdoc  
22 - */  
23 - public static function tableName()  
24 - {  
25 - return 'page_lang';  
26 - }  
27 -  
28 - /**  
29 - * @inheritdoc  
30 - */  
31 - public function rules()  
32 - {  
33 - return [  
34 - [['page_id', 'title', 'meta_title', 'meta_description', 'text', 'page_alias', 'lang_id'], 'safe'],  
35 - [['page_id', 'lang_id'], 'integer'],  
36 - [['text'], 'string'],  
37 - [['title', 'page_alias'], 'string', 'max' => 256],  
38 - [['meta_title', 'meta_description'], 'string', 'max' => 512]  
39 - ];  
40 - }  
41 -  
42 - /**  
43 - * @inheritdoc  
44 - */  
45 - public function attributeLabels()  
46 - {  
47 - return [  
48 - 'page_id' => Yii::t('field', 'page'),  
49 - 'title' => Yii::t('field', 'title'),  
50 - 'meta_title' => Yii::t('field', 'meta_title'),  
51 - 'meta_description' => Yii::t('field', 'meta_description'),  
52 - 'text' => Yii::t('field', 'text'),  
53 - 'page_alias' => Yii::t('field', 'page_alias'),  
54 - 'lang_id' => Yii::t('field', 'lang_id'),  
55 - ];  
56 - }  
57 -}  
common/models/ShopCategory.php deleted
1 -<?php  
2 -  
3 -namespace common\models;  
4 -  
5 -use Yii;  
6 -use yii\base\Model;  
7 -use yii\db\Query;  
8 -  
9 -/**  
10 - * Signup form  
11 - */  
12 -class ShopCategory extends Model  
13 -{  
14 - /**  
15 - * весь список терминов  
16 - */  
17 - static function get ()  
18 - {  
19 - return yii::$app->db->createCommand('  
20 - SELECT  
21 - `termin_relation`.termin_id,  
22 - `termin_relation`.termin_pid,  
23 - `termin_lang`.termin_title  
24 - FROM `termin_relation`  
25 - INNER JOIN `termin_lang` ON `termin_lang`.termin_id = `termin_relation`.termin_id  
26 - AND `termin_lang`.lang_id = '.yii::$app->lang_id.'  
27 - INNER JOIN `template` ON `template`.template_id = `termin_lang`.template_id  
28 - ORDER BY `termin_relation`.termin_id ASC, `termin_relation`.termin_pid ASC  
29 - ')->queryAll();  
30 - }  
31 -  
32 - // ===================  
33 - // ==== STRUCTURE ====  
34 - // ===================  
35 -  
36 - var $mass = array ();  
37 -  
38 - public function build ()  
39 - {  
40 - if ($this->mass = self::get ())  
41 - {  
42 - return $this->getRecrusive (8);  
43 - }  
44 - }  
45 -  
46 - public function findChild ($id)  
47 - {  
48 - $mass = array ();  
49 -  
50 - foreach ($this->mass as $row)  
51 - {  
52 - if ($row['termin_pid'] == $id)  
53 - {  
54 - $mass[] = $row;  
55 - }  
56 - }  
57 -  
58 - return $mass;  
59 - }  
60 -  
61 - public function getRecrusive ($menu_id)  
62 - {  
63 - $items = $this->findChild($menu_id);  
64 -  
65 - if (! empty ($items))  
66 - {  
67 - echo '<ul>';  
68 -  
69 - foreach ($items as $row)  
70 - {  
71 - echo '<li>'.$row['termin_title'].'</li>';  
72 -  
73 - if ($row['termin_pid'] != 0)  
74 - {  
75 - $this->getRecrusive($row['termin_id']);  
76 - }  
77 - }  
78 -  
79 - echo '</ul>';  
80 - }  
81 -  
82 - }  
83 -  
84 - // =====  
85 -  
86 -}  
common/models/TerminLang.php deleted
1 -<?php  
2 -  
3 -namespace common\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 string $termin_title  
12 - * @property integer $lang_id  
13 - */  
14 -class TerminLang extends \yii\db\ActiveRecord  
15 -{  
16 - /**  
17 - * @inheritdoc  
18 - */  
19 - public static function tableName()  
20 - {  
21 - return 'termin_lang';  
22 - }  
23 -  
24 - /**  
25 - * @inheritdoc  
26 - */  
27 - public function rules()  
28 - {  
29 - return [  
30 - //[['termin_id', 'lang_id'], 'required'],  
31 - //[['termin_id', 'lang_id'], 'integer'],  
32 - [['termin_title'], 'string']  
33 - ];  
34 - }  
35 -  
36 - /**  
37 - * @inheritdoc  
38 - */  
39 - public function attributeLabels()  
40 - {  
41 - return [  
42 - 'termin_id' => 'Термин ID',  
43 - 'termin_title' => 'Название',  
44 - 'lang_id' => 'ID языка',  
45 - ];  
46 - }  
47 -  
48 - public function getMenu()  
49 - {  
50 - return $this->hasMany(Menu::className(), ['termin_id' => 'termin_id']);  
51 - }  
52 -}  
common/models/TerminOption.php deleted
1 -<?php  
2 -  
3 -namespace common\models;  
4 -  
5 -use Yii;  
6 -  
7 -/**  
8 - * This is the model class for table "termin_option".  
9 - *  
10 - * @property integer $termin_id  
11 - * @property integer $termin_pid  
12 - * @property integer $sortorder  
13 - */  
14 -class TerminOption extends \yii\db\ActiveRecord  
15 -{  
16 - /**  
17 - * @inheritdoc  
18 - */  
19 - public static function tableName()  
20 - {  
21 - return 'termin_option';  
22 - }  
23 -  
24 - /**  
25 - * @inheritdoc  
26 - */  
27 - public function rules()  
28 - {  
29 - return [  
30 - //[['termin_id', 'termin_pid', 'sortorder'], 'required'],  
31 - [['termin_id', 'termin_pid', 'sortorder'], 'integer']  
32 - ];  
33 - }  
34 -  
35 - /**  
36 - * @inheritdoc  
37 - */  
38 - public function attributeLabels()  
39 - {  
40 - return [  
41 - 'termin_id' => 'Termin ID',  
42 - 'termin_pid' => 'Termin Pid',  
43 - 'sortorder' => 'Sortorder',  
44 - ];  
45 - }  
46 -}  
frontend/controllers/PageController.php deleted
1 -<?php  
2 -namespace frontend\controllers;  
3 -  
4 -use Yii;  
5 -use yii\web\Controller;  
6 -use common\models\Page;  
7 -  
8 -/**  
9 - * Site controller  
10 - */  
11 -class PageController extends Controller  
12 -{  
13 - /**  
14 - * Displays homepage.  
15 - *  
16 - * @return mixed  
17 - */  
18 - public function actionPage($controller_name, $page_id, $template_file)  
19 - {  
20 - // страница  
21 - if ($page = Page::getPageById ($page_id))  
22 - {  
23 - // meta_title  
24 - Yii::$app->view->title = $page['meta_title'];  
25 -  
26 - // meta_desc  
27 - Yii::$app->view->registerMetaTag([  
28 - 'name' => 'description',  
29 - 'content' => $page['meta_description'],  
30 - ]);  
31 - }  
32 - else  
33 - {  
34 - echo '404';  
35 - die;  
36 - }  
37 -  
38 - return $this->render($controller_name, $page);  
39 - }  
40 -  
41 -}  
42 \ No newline at end of file 0 \ No newline at end of file
frontend/views/page/home.php deleted
1 -home  
2 \ No newline at end of file 0 \ No newline at end of file
frontend/views/page/page.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -  
5 - // CSS  
6 - $this->registerCssFile('css-file.css');  
7 -  
8 - // JS  
9 - $this->registerJsFile('script.js');  
10 -  
11 - echo $text;  
12 -?>  
13 \ No newline at end of file 0 \ No newline at end of file