diff --git a/backend/controllers/PageController.php b/backend/controllers/PageController.php deleted file mode 100644 index caacd9f..0000000 --- a/backend/controllers/PageController.php +++ /dev/null @@ -1,155 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['post'], - ], - ], - ]; - } - - - /** - * Lists all Page models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new SearchPage(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single Page model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Page model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Page(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) - { - // сохраняем в таблицу page_lang - $model2 = new PageLang(); - - // передаем переменные - $model2->attributes = $_POST['Page']; - $model2->page_id = $model->page_id; - $model2->lang_id = Yii::$app->lang_id; - - // сохраняем - $model2->save(); - - return $this->redirect(['view', 'id' => $model->page_id]); - } - else - { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - /** - * Updates an existing Page model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) - { - // сохраняем в таблицу page_lang - $model2 = new PageLang(); - - // передаем переменные - if ($array = $model->findPageLangField($_POST['Page'])) - { - // сохраняем - $model2->updateAll($array, ['page_id' => $id, 'lang_id' => Yii::$app->lang_id]); - } - - return $this->redirect(['view', 'id' => $model->page_id]); - } - else - { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing Page model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - // удаляем page - $this->findModel($id)->delete(); - - // удаляем page_lang - $model2 = new PageLang(); - $model2->deleteAll('page_id = '.(int)$id); - - return $this->redirect(['index']); - } - - /** - * Finds the Page model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Page the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Page::findOne(['page_id' => $id])) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/backend/controllers/TerminController.php b/backend/controllers/TerminController.php deleted file mode 100644 index 2611e03..0000000 --- a/backend/controllers/TerminController.php +++ /dev/null @@ -1,121 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['post'], - ], - ], - ]; - } - - /** - * Lists all Termin models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new SearchTermin(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single Termin model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Termin model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Termin(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->termin_id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - /** - * Updates an existing Termin model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->termin_id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing Termin model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Termin model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Termin the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Termin::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/backend/controllers/Termin_langController.php b/backend/controllers/Termin_langController.php deleted file mode 100644 index cd0e23a..0000000 --- a/backend/controllers/Termin_langController.php +++ /dev/null @@ -1,174 +0,0 @@ -castyl(); - - return [ - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['post'], - ], - ], - ]; - } - - public function castyl() - { - $this->lang_id = isset ($_GET['lang_id']) ? $_GET['lang_id'] : 1; - } - - /** - * Lists all TerminLang models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new TerminLangSearch(); - $searchModel->lang_id = $this->lang_id; - - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single TerminLang model. - * @param integer $termin_id - * @param integer $lang_id - * @return mixed - */ - public function actionView($termin_id) - { - return $this->render('view', [ - 'model' => $this->findModel($termin_id, $this->lang_id), - ]); - } - - /** - * Creates a new TerminLang model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $termin = new Termin(); - $termin_lang = new TerminLang(); - - if ($termin_lang->load(Yii::$app->request->post())) { - - $termin->termin_id = ''; - $termin->save(); - $termin_lang->termin_id = $termin->termin_id; - $termin_lang->save(); - - return $this->redirect(['index']); - } else { - return $this->render('create', [ - 'termin_lang' => $termin_lang, - 'termin' => $termin, - ]); - } - } - - public function actionCreate_parent($termin_id) - { - $termin = new Termin(); - $termin_lang = new TerminLang(); - $termin_option = new TerminOption(); - - if ($termin_lang->load(Yii::$app->request->post())) { - - $termin->termin_id = ''; - $termin->save(); - // var_dump($termin->termin_id);die(); - $termin_lang->termin_id = $termin->termin_id; - $termin_lang->save(); - - $termin_option->termin_id = $termin->termin_id; - $termin_option->termin_pid = $termin_id; - $termin_option->save(); - - - return $this->redirect(['index']); - } else { - return $this->render('create', [ - 'termin_lang' => $termin_lang, - 'termin' => $termin, - ]); - } - } - - /** - * Updates an existing TerminLang model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $termin_id - * @param integer $lang_id - * @return mixed - */ - public function actionUpdate($termin_id) - { - $model = $this->findModel($termin_id, $this->lang_id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing TerminLang model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $termin_id - * @param integer $lang_id - * @return mixed - */ - public function actionDelete($termin_id) - { - $this->findModel($termin_id, $this->lang_id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the TerminLang model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $termin_id - * @param integer $lang_id - * @return TerminLang the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($termin_id) - { - if (($model = TerminLang::findOne(['termin_id' => $termin_id, 'lang_id' => $this->lang_id])) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/backend/controllers/_LanguageController.php b/backend/controllers/_LanguageController.php deleted file mode 100644 index 1f7eb4c..0000000 --- a/backend/controllers/_LanguageController.php +++ /dev/null @@ -1,141 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['post'], - ], - ], - ]; - } - - /** - * Lists all Language models. - * @return mixed - */ - public function init() { - parent::init(); - $this->layoutdata = $this->layoutData(); - } - public function layoutData() { - $searchModel = new LanguageSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]; - } - public function actionIndex() - { - return $this->render('index', $this->layoutdata); - } - - /** - * Displays a single Language model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - 'layoutdata' => $this->layoutdata - ]); - } - - /** - * Creates a new Language model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model[0] = new Language(); - $model[1] = new LanguageLang(); - if ($model[0]->load(Yii::$app->request->post()) && $model[0]->save()) { - $model[1]->language_id = $model[0]->language_id; - if($model[1]->load(Yii::$app->request->post()) && $model[1]->save()) { - return $this->redirect(['view', 'id' => $model[0]->language_id]); - } else { - return $this->render('create', [ - 'model' => $model, - 'layoutdata' => $this->layoutdata - ]); - } - } else { - return $this->render('create', [ - 'model' => $model, - 'layoutdata' => $this->layoutdata - ]); - } - } - - /** - * Updates an existing Language model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model[0] = $this->findModel($id); - $model[1] = LanguageLang::findOne(['language_id' => $id]); - - if ($model[0]->load(Yii::$app->request->post()) && $model[1]->load(Yii::$app->request->post()) && $model[0]->save() && $model[1]->save()) { - return $this->redirect(['view', 'id' => $model[0]->language_id]); - } else { - return $this->render('update', [ - 'model' => $model, - 'layoutdata' => $this->layoutdata - ]); - } - } - - /** - * Deletes an existing Language model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Language model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Language the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Language::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/backend/models/_Language.php b/backend/models/_Language.php deleted file mode 100644 index da88d99..0000000 --- a/backend/models/_Language.php +++ /dev/null @@ -1,47 +0,0 @@ - 4] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'language_id' => Yii::t('app', 'Language ID'), - 'lang_code' => Yii::t('app', 'Lang Code'), - 'is_default' => Yii::t('app', 'Is Default'), - ]; - } -} diff --git a/backend/views/page/_form.php b/backend/views/page/_form.php deleted file mode 100644 index c85b816..0000000 --- a/backend/views/page/_form.php +++ /dev/null @@ -1,59 +0,0 @@ - - -
- = Html::a(Yii::t('action', 'add'), ['create'], ['class' => 'btn btn-success']) ?> -
- - = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'page_id', - 'date_add', - 'title', - 'template_id', - 'show', - - ['class' => 'yii\grid\ActionColumn'], - ], - ]); ?> - -- = Html::a('Update', ['update', 'id' => $model->page_id], ['class' => 'btn btn-primary']) ?> - = Html::a('Delete', ['delete', 'id' => $model->page_id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', - ], - ]) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'page_id', - 'date_add', - 'template_id', - 'image_id', - 'show', - ], - ]) ?> - -- = Html::a('Create Termin', ['create'], ['class' => 'btn btn-success']) ?> -
- - = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'termin_id', - 'termin_pid', - 'lfr', - 'rgt', - 'termin_type_id', - // 'page_id', - - ['class' => 'yii\grid\ActionColumn'], - ], - ]); ?> - -- = Html::a('Update', ['update', 'id' => $model->termin_id], ['class' => 'btn btn-primary']) ?> - = Html::a('Delete', ['delete', 'id' => $model->termin_id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', - ], - ]) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'termin_id', - 'termin_pid', - 'lfr', - 'rgt', - 'termin_type_id', - 'page_id', - ], - ]) ?> - -- = Html::a('Create Termin Lang', ['create'], ['class' => 'btn btn-success']) ?> -
- - = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'termin_id', - 'termin_title', - 'lang_id', - - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{create} {view} {update} {delete} {create_parent}', - 'buttons' => [ - 'create_parent' => function ($url, $model, $key) { - return Html::a('', $url); - } - ], - ], - ], - ]); ?> - -- = Html::a('Update', ['update', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id], ['class' => 'btn btn-primary']) ?> - = Html::a('Delete', ['delete', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', - ], - ]) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'termin_id', - 'termin_title', - 'lang_id', - ], - ]) ?> - -