From 0012685b1ac85755e75165a80a70cdd0303486ab Mon Sep 17 00:00:00 2001 From: Yarik Date: Wed, 18 Nov 2015 12:09:41 +0200 Subject: [PATCH] Многоязычные опции --- backend/config/main.php | 2 +- common/config/main.php | 2 +- db-migration/artbox_option.sql | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/assets/AppAsset.php | 3 +++ frontend/controllers/OptionController.php | 249 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/OptionValuesController.php | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/OptionsController.php | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/SiteController.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/TranslateLangController.php | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/Language.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/LanguageLang.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/Option.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/OptionLang.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/OptionSearch.php | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/OptionValues.php | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/OptionValuesSearch.php | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/Options.php | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/models/OptionsSearch.php | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/option-values/_form.php | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/option-values/_search.php | 37 +++++++++++++++++++++++++++++++++++++ frontend/views/option-values/create.php | 21 +++++++++++++++++++++ frontend/views/option-values/index.php | 39 +++++++++++++++++++++++++++++++++++++++ frontend/views/option-values/update.php | 23 +++++++++++++++++++++++ frontend/views/option-values/view.php | 40 ++++++++++++++++++++++++++++++++++++++++ frontend/views/option/_form.php | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/option/_form_edit.php | 38 ++++++++++++++++++++++++++++++++++++++ frontend/views/option/_search.php | 37 +++++++++++++++++++++++++++++++++++++ frontend/views/option/create.php | 26 ++++++++++++++++++++++++++ frontend/views/option/index.php | 39 +++++++++++++++++++++++++++++++++++++++ frontend/views/option/update.php | 26 ++++++++++++++++++++++++++ frontend/views/option/view.php | 40 ++++++++++++++++++++++++++++++++++++++++ frontend/views/options/_form.php | 29 +++++++++++++++++++++++++++++ frontend/views/options/_search.php | 35 +++++++++++++++++++++++++++++++++++ frontend/views/options/create.php | 21 +++++++++++++++++++++ frontend/views/options/index.php | 38 ++++++++++++++++++++++++++++++++++++++ frontend/views/options/update.php | 23 +++++++++++++++++++++++ frontend/views/options/view.php | 39 +++++++++++++++++++++++++++++++++++++++ frontend/views/site/index.php | 1 + frontend/views/site/options.php | 24 ++++++++++++++++++++++++ 39 files changed, 2094 insertions(+), 2 deletions(-) create mode 100644 db-migration/artbox_option.sql create mode 100644 frontend/controllers/OptionController.php create mode 100644 frontend/controllers/OptionValuesController.php create mode 100644 frontend/controllers/OptionsController.php create mode 100644 frontend/controllers/TranslateLangController.php create mode 100644 frontend/models/Language.php create mode 100644 frontend/models/LanguageLang.php create mode 100644 frontend/models/Option.php create mode 100644 frontend/models/OptionLang.php create mode 100644 frontend/models/OptionSearch.php create mode 100644 frontend/models/OptionValues.php create mode 100644 frontend/models/OptionValuesSearch.php create mode 100644 frontend/models/Options.php create mode 100644 frontend/models/OptionsSearch.php create mode 100644 frontend/views/option-values/_form.php create mode 100644 frontend/views/option-values/_search.php create mode 100644 frontend/views/option-values/create.php create mode 100644 frontend/views/option-values/index.php create mode 100644 frontend/views/option-values/update.php create mode 100644 frontend/views/option-values/view.php create mode 100644 frontend/views/option/_form.php create mode 100644 frontend/views/option/_form_edit.php create mode 100644 frontend/views/option/_search.php create mode 100644 frontend/views/option/create.php create mode 100644 frontend/views/option/index.php create mode 100644 frontend/views/option/update.php create mode 100644 frontend/views/option/view.php create mode 100644 frontend/views/options/_form.php create mode 100644 frontend/views/options/_search.php create mode 100644 frontend/views/options/create.php create mode 100644 frontend/views/options/index.php create mode 100644 frontend/views/options/update.php create mode 100644 frontend/views/options/view.php create mode 100644 frontend/views/site/options.php diff --git a/backend/config/main.php b/backend/config/main.php index 8b43499..b2c4c06 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -25,7 +25,7 @@ return [ ], ], 'urlManager' => [ - 'enablePrettyUrl' => true, + 'enablePrettyUrl' => false, 'showScriptName' => false, ], 'log' => [ diff --git a/common/config/main.php b/common/config/main.php index 09ab897..3e1b289 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -6,7 +6,7 @@ return [ 'class' => 'yii\caching\FileCache', ], 'urlManager' => [ - 'enablePrettyUrl' => true, + 'enablePrettyUrl' => false, 'showScriptName' => false, 'class'=> 'common\components\LangUrlManager', 'rules'=>[ diff --git a/db-migration/artbox_option.sql b/db-migration/artbox_option.sql new file mode 100644 index 0000000..9128f42 --- /dev/null +++ b/db-migration/artbox_option.sql @@ -0,0 +1,71 @@ +-- -------------------------------------------------------- +-- Хост: 127.0.0.1 +-- Версия сервера: 5.6.26 - MySQL Community Server (GPL) +-- ОС Сервера: Win32 +-- HeidiSQL Версия: 9.3.0.4984 +-- -------------------------------------------------------- + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8mb4 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +-- Дамп структуры для таблица artbox_db.option +CREATE TABLE IF NOT EXISTS `option` ( + `option_id` int(11) NOT NULL AUTO_INCREMENT, + `model` varchar(200) NOT NULL, + `model_id` int(11) NOT NULL, + `name` varchar(200) NOT NULL, + `template` varchar(200) NOT NULL, + `parent_id` int(11) DEFAULT NULL, + PRIMARY KEY (`option_id`), + KEY `FK_option_option` (`parent_id`), + CONSTRAINT `FK_option_option` FOREIGN KEY (`parent_id`) REFERENCES `option` (`option_id`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; + +-- Дамп данных таблицы artbox_db.option: ~6 rows (приблизительно) +/*!40000 ALTER TABLE `option` DISABLE KEYS */; +INSERT INTO `option` (`option_id`, `model`, `model_id`, `name`, `template`, `parent_id`) VALUES + (20, 'user', 10, 'phone', 'input', NULL), + (21, 'user', 10, 'adres', 'input', 20), + (22, 'user', 10, 'phone', 'input', NULL), + (23, 'user', 10, 'adres', 'input', 22), + (24, 'user', 10, 'phone', 'input', NULL), + (25, 'user', 10, 'adres', 'input', 24); +/*!40000 ALTER TABLE `option` ENABLE KEYS */; + + +-- Дамп структуры для таблица artbox_db.option_lang +CREATE TABLE IF NOT EXISTS `option_lang` ( + `primary` int(11) NOT NULL AUTO_INCREMENT, + `id` int(11) NOT NULL, + `lang_id` int(11) NOT NULL, + `value` text NOT NULL, + PRIMARY KEY (`primary`), + KEY `Индекс 1` (`id`), + KEY `Индекс 2` (`lang_id`) +) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8; + +-- Дамп данных таблицы artbox_db.option_lang: ~16 rows (приблизительно) +/*!40000 ALTER TABLE `option_lang` DISABLE KEYS */; +INSERT INTO `option_lang` (`primary`, `id`, `lang_id`, `value`) VALUES + (20, 20, 0, 'phone'), + (21, 20, 1, 'phone111ukr'), + (22, 20, 2, 'phone111ru'), + (23, 21, 0, 'adres111'), + (24, 21, 1, 'adres111'), + (25, 21, 2, 'adres222'), + (26, 22, 0, 'phone222'), + (27, 22, 1, 'phone222uk'), + (28, 23, 0, 'adres111'), + (29, 23, 1, 'adres111'), + (30, 23, 2, 'adres111'), + (31, 24, 0, 'phone333'), + (32, 24, 2, 'phone333ru'), + (33, 25, 0, 'adres111'), + (34, 25, 1, 'adres111'), + (35, 25, 2, 'adres111'); +/*!40000 ALTER TABLE `option_lang` ENABLE KEYS */; +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 995e3dc..2017f6f 100644 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -26,4 +26,7 @@ class AppAsset extends AssetBundle 'yii\web\YiiAsset', 'yii\bootstrap\BootstrapAsset', ]; + public $jsOptions = array( + 'position' => \yii\web\View::POS_HEAD + ); } diff --git a/frontend/controllers/OptionController.php b/frontend/controllers/OptionController.php new file mode 100644 index 0000000..973405e --- /dev/null +++ b/frontend/controllers/OptionController.php @@ -0,0 +1,249 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all Option models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new OptionSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Option model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Option model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Option(); + $modellang = new OptionLang(); + $modeldb = 'user'; + $model_id = '10'; + $fields = [['name' => 'phone', 'template' => 'input'], ['name' => 'adres', 'template' => 'input']]; + $post = \Yii::$app->request->post(); + if(!empty($post['Option'])) { + $ok = 1; + $parentid = null; + $models = array(); + foreach($post['Option'] as $index => $option) { + if(in_array($index, array('model', 'model_id')) && $index !== 0) { continue; } + $first = 1; + foreach($option['value'] as $key => $value) { + $models[$index][$key] = new Option(); + $models[$index][$key]->model = $post['Option']['model']; + $models[$index][$key]->model_id = $post['Option']['model_id']; + $models[$index][$key]->template = $option['template']; + $models[$index][$key]->name = $key; + if(!$first) { + $models[$index][$key]->parent_id = $parentid; + } + $modelslang[$index][$key][0] = new OptionLang(); + if(!empty($value) && $models[$index][$key]->save()) { + if($first) { + $parentid = $models[$index][$key]->option_id; + } + $modelslang[$index][$key][0]->id = $models[$index][$key]->option_id; + $modelslang[$index][$key][0]->lang_id = 0; + $modelslang[$index][$key][0]->value = $value; + if($modelslang[$index][$key][0]->save()) { + if(!empty($option['lang'][$key])) { + foreach($option['lang'][$key] as $code => $lang) { + if(!empty($lang)) { + $modelslang[$index][$key][$code] = new OptionLang(); + $modelslang[$index][$key][$code]->id = $models[$index][$key]->option_id; + $modelslang[$index][$key][$code]->lang_id = $code; + $modelslang[$index][$key][$code]->value = $lang; + if(!$modelslang[$index][$key][$code]->save()) { + $ok = 0; + } + } + } + } + } + } else { + $models[$index][$key]->validate(); + $modelslang[$index][$key][0]->validate(); + $modelslang[$index][$key][0]; + if(!empty($option['lang'][$key])) { + foreach($option['lang'][$key] as $code => $lang) { + if(!empty($lang)) { + $modelslang[$index][$key][$code] = new OptionLang(); + $modelslang[$index][$key][$code]->id = $models[$index][$key]->option_id; + $modelslang[$index][$key][$code]->lang_id = $code; + $modelslang[$index][$key][$code]->value = $lang; + } + } + } + $ok = 0; + } + $first = 0; + } + } + if($ok) { + return $this->redirect(['view', 'id' => $parentid]); + } else { + return $this->render('create', [ + 'model' => $model, + 'models' => $models, + 'modellang' => $modelslang, + 'modeldb' => $modeldb, + 'model_id' => $model_id, + 'fields' => $fields + ]); + } + } + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->option_id]); + } else { + return $this->render('create', [ + 'model' => $model, + 'modeldb' => $modeldb, + 'model_id' => $model_id, + 'fields' => $fields + ]); + } + } + + /** + * Updates an existing Option model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + */ + public function actionUpdate($id) + { + $models[$id] = Option::findOne($id); + $modellang[$id] = array(); + $langs = OptionLang::findAll(['id' => $id]); + foreach($langs as $lang) { + $modellang[$id][$lang->lang_id] = $lang; + } + $children = (new Option())->find()->where(['parent_id' => $id])->all(); + foreach($children as $child) { + $models[$child->option_id] = $child; + $modellang[$child->option_id] = array(); + $langs = OptionLang::findAll(['id' =>$child->option_id]); + foreach($langs as $lang) { + $modellang[$child->option_id][$lang->lang_id] = $lang; + } + } + $modeldb = 'user'; + $model_id = '10'; + $fields = [['name' => 'phone', 'template' => 'input'], ['name' => 'adres', 'template' => 'input']]; + $post = \Yii::$app->request->post(); + $ok = 1; + if(!empty($post)) { + foreach($post['Option'] as $key => $option) { + if(in_array($key, array('model', 'model_id'))) { continue; } + $modellang[$key][0]->value = $option['value'][$models[$key]->name]; + if(!$modellang[$key][0]->save()) { + $ok = 0; + } + foreach($option['lang'] as $lang_id => $lang) { + if(empty($modellang[$key][$lang_id])) { + $modellang[$key][$lang_id] = new OptionLang(); + $modellang[$key][$lang_id]->id = $models[$key]->option_id; + $modellang[$key][$lang_id]->lang_id = $lang_id; + $modellang[$key][$lang_id]->value = $lang; + } else { + $modellang[$key][$lang_id]->value = $lang; + } + if(!$modellang[$key][$lang_id]->save()) { + $ok = 0; + } + } + } + if($ok) { + return $this->redirect(['view', 'id' => $id]); + } else { + return $this->render('update', [ + 'models' => $models, + 'modellang' => $modellang, + 'modeldb' => $modeldb, + 'model_id' => $model_id + ]); + } + } + return $this->render('update', [ + 'models' => $models, + 'modellang' => $modellang, + 'modeldb' => $modeldb, + 'model_id' => $model_id + ]); + } + + /** + * Deletes an existing Option 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 Option model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Option the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Option::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/controllers/OptionValuesController.php b/frontend/controllers/OptionValuesController.php new file mode 100644 index 0000000..e65492a --- /dev/null +++ b/frontend/controllers/OptionValuesController.php @@ -0,0 +1,147 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all OptionValues models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new OptionValuesSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single OptionValues model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new OptionValues model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $post = \Yii::$app->request->post(); + if(is_array($post['OptionValues']['option_value_text'])) { + $ok = 0; + $first = 0; + $id = 0; + $models = array(); + foreach($post['OptionValues']['option_value_text'] as $lang => $value) { + $models[$lang] = new OptionValues(); + $models[$lang]->load(Yii::$app->request->post()); + $models[$lang]->option_lang_id = $lang; + $models[$lang]->option_value_text = $value; + if($first && $id) { + $models[$lang]->option_value_parent = $id; + } + if($models[$lang]->save()) { + $ok = 1; + if(!$first) { + $first = 1; + $id = $models[$lang]->option_value_id; + } + } else { + unset($models[$lang]); + } + } + if($ok) { + return $this->redirect(['view', 'id' => $id]); + } + } + $model = new OptionValues(); + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->option_value_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing OptionValues 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->option_value_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing OptionValues 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 OptionValues model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return OptionValues the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = OptionValues::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/controllers/OptionsController.php b/frontend/controllers/OptionsController.php new file mode 100644 index 0000000..2abe3cd --- /dev/null +++ b/frontend/controllers/OptionsController.php @@ -0,0 +1,121 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all Options models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new OptionsSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Options model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Options model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Options(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->option_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Options 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->option_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Options 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 Options model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Options the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Options::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 25127d4..a1b6b09 100644 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -7,11 +7,15 @@ use frontend\models\PasswordResetRequestForm; use frontend\models\ResetPasswordForm; use frontend\models\SignupForm; use frontend\models\ContactForm; +use frontend\models\Options; +use frontend\models\OptionValues; use yii\base\InvalidParamException; use yii\web\BadRequestHttpException; use yii\web\Controller; use yii\filters\VerbFilter; use yii\filters\AccessControl; +use frontend\models\OptionsToValues; +use yii\validators\EmailValidator; use common\models\Page; @@ -240,4 +244,45 @@ class SiteController extends Controller 'model' => $model, ]); } + public function actionOptions() { + $option_model = new Options(); + $option_list = $option_model->find()->where(1)->all(); + $option_values = array(); + $post = \Yii::$app->request->post(); + if(!empty(\Yii::$app->request->post())) { + $options_to_values = array(); + $hasErrors = false; + foreach($post['options'] as $key => $val) { + $options_to_values[$key] = new OptionsToValues(); + $options_to_values[$key]['option_id'] = $val['option_id']; + $options_to_values[$key]->loadDefaultValues(); + if($options_to_values[$key]->save()) { + $option_values[$key] = new OptionValues(); + $option_values[$key]['option_value_id'] = $options_to_values[$key]->getAttribute('option_value_id'); + $option_values[$key]['option_value_text'] = $val['option_value']; + if($options_to_values[$key]->option->getAttribute('option_translatable') == 0 || empty($val['option_lang_id'])) { + $option_values[$key]['option_lang_id'] = 0; + } else { + $option_values[$key]['option_lang_id'] = $val['option_lang_id']; + } + if(!$option_values[$key]->save()) { + $options_to_values[$key]->delete(); + $hasErrors = true; + } + } + } + if(hasErrors) { + $data['option_values'] = $option_values; + return $this->render('options', ['options' => $data, 'post' => $post]); + } else { + var_dump($data); + } + } else { + foreach($option_list as $index => $option) { + $option_values[$option->getAttribute('option_id')] = new OptionValues(); + } + $data['option_values'] = $option_values; + return $this->render('options', ['options' => $data, 'post' => $post]); + } + } } diff --git a/frontend/controllers/TranslateLangController.php b/frontend/controllers/TranslateLangController.php new file mode 100644 index 0000000..241f085 --- /dev/null +++ b/frontend/controllers/TranslateLangController.php @@ -0,0 +1,121 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all TranslateLang models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new TranslateLangSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single TranslateLang model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new TranslateLang model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new TranslateLang(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->translate_value_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing TranslateLang 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->translate_value_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing TranslateLang 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 TranslateLang model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return TranslateLang the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = TranslateLang::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/models/Language.php b/frontend/models/Language.php new file mode 100644 index 0000000..ed98291 --- /dev/null +++ b/frontend/models/Language.php @@ -0,0 +1,66 @@ + 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'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguageLangs() + { + return $this->hasMany(LanguageLang::className(), ['language_id' => 'language_id']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOptionValues() + { + return $this->hasMany(OptionValues::className(), ['option_lang_id' => 'language_id']); + } +} diff --git a/frontend/models/LanguageLang.php b/frontend/models/LanguageLang.php new file mode 100644 index 0000000..2edf909 --- /dev/null +++ b/frontend/models/LanguageLang.php @@ -0,0 +1,57 @@ + 256] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'language_id' => Yii::t('app', 'Language ID'), + 'lang_title' => Yii::t('app', 'Lang Title'), + 'lang_id' => Yii::t('app', 'Lang ID'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), ['language_id' => 'language_id']); + } +} diff --git a/frontend/models/Option.php b/frontend/models/Option.php new file mode 100644 index 0000000..f615d15 --- /dev/null +++ b/frontend/models/Option.php @@ -0,0 +1,56 @@ + 200] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'option_id' => Yii::t('app', 'Option ID'), + 'model' => Yii::t('app', 'Model'), + 'model_id' => Yii::t('app', 'Model ID'), + 'name' => Yii::t('app', 'Name'), + 'template' => Yii::t('app', 'Template'), + 'parent_id' => Yii::t('app', 'Parent ID'), + ]; + } + public function getLangs() { + return (new Language())->find()->where(['>', 'language_id', 0])->asArray()->all(); + } +} diff --git a/frontend/models/OptionLang.php b/frontend/models/OptionLang.php new file mode 100644 index 0000000..f00435f --- /dev/null +++ b/frontend/models/OptionLang.php @@ -0,0 +1,47 @@ + Yii::t('app', 'ID'), + 'lang_id' => Yii::t('app', 'Lang ID'), + 'value' => Yii::t('app', 'Value'), + ]; + } +} diff --git a/frontend/models/OptionSearch.php b/frontend/models/OptionSearch.php new file mode 100644 index 0000000..b91b2c7 --- /dev/null +++ b/frontend/models/OptionSearch.php @@ -0,0 +1,70 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + $query->andFilterWhere([ + 'option_id' => $this->option_id, + 'model_id' => $this->model_id, + 'parent_id' => $this->parent_id, + ]); + + $query->andFilterWhere(['like', 'model', $this->model]) + ->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'template', $this->template]); + + return $dataProvider; + } +} diff --git a/frontend/models/OptionValues.php b/frontend/models/OptionValues.php new file mode 100644 index 0000000..0317cc1 --- /dev/null +++ b/frontend/models/OptionValues.php @@ -0,0 +1,97 @@ + 200] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'option_value_id' => Yii::t('app', 'Option Value ID'), + 'option_key' => Yii::t('app', 'Option Key'), + 'option_value_text' => Yii::t('app', 'Option Value Text'), + 'option_lang_id' => Yii::t('app', 'Option Lang ID'), + 'option_value_parent' => Yii::t('app', 'Option Value Parent'), + 'option_user' => Yii::t('app', 'Option User'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOptionLang() + { + return $this->hasOne(Language::className(), ['language_id' => 'option_lang_id']); + } + public function getLanguages() { + return (new LanguageLang())->find()->orderBy('language_id ASC')->asArray()->all(); + } + public function getLanguagesCodes() { + return (new Language())->find()->orderBy('language_id ASC')->asArray()->all(); + } + public function getDropDownArray() { + $langs = array(); + foreach($this->getLanguages() as $lang) { + $langs[$lang['language_id']] = $lang['lang_title']; + } + return $langs; + } + public function beforeSave($insert) { + if (parent::beforeSave($insert)) { + $this->option_user = \Yii::$app->user->getId(); + if($this->option_value_parent == 0) { + unset($this->option_value_parent); + } + return true; + } else { + return false; + } + } + public function getUserOptions() { + return (new OptionValues())->find()->where('option_user=:user')->addParams([':user' => \Yii::$app->user->getID()])->andWhere(['not', ['option_user' => null]])->asArray()->all(); + } + public function getUserOptionsArray() { + $options = array('0' => Yii::t('app', 'Default Parent')); + foreach($this->getUserOptions() as $option) { + $options[$option['option_value_id']] = $option['option_key'].' - '.$option['option_value_text']; + } + return $options; + } +} diff --git a/frontend/models/OptionValuesSearch.php b/frontend/models/OptionValuesSearch.php new file mode 100644 index 0000000..50bc0d9 --- /dev/null +++ b/frontend/models/OptionValuesSearch.php @@ -0,0 +1,70 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + $query->andFilterWhere([ + 'option_value_id' => $this->option_value_id, + 'option_lang_id' => $this->option_lang_id, + 'option_value_parent' => $this->option_value_parent, + 'option_user' => $this->option_user, + ]); + + $query->andFilterWhere(['like', 'option_key', $this->option_key]) + ->andFilterWhere(['like', 'option_value_text', $this->option_value_text]); + + return $dataProvider; + } +} diff --git a/frontend/models/Options.php b/frontend/models/Options.php new file mode 100644 index 0000000..5cff9d4 --- /dev/null +++ b/frontend/models/Options.php @@ -0,0 +1,79 @@ + 200] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'option_id' => Yii::t('app', 'Option ID'), + 'option_key' => Yii::t('app', 'Option Key'), + 'option_parent' => Yii::t('app', 'Option Parent'), + 'option_translatable' => Yii::t('app', 'Option Translatable'), + 'option_format' => Yii::t('app', 'Option Format'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOptionValues() + { + return $this->hasMany(OptionValues::className(), ['option_id' => 'option_id']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOptionParent() + { + return $this->hasOne(Options::className(), ['option_id' => 'option_parent']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOptions() + { + return $this->hasMany(Options::className(), ['option_parent' => 'option_id']); + } +} diff --git a/frontend/models/OptionsSearch.php b/frontend/models/OptionsSearch.php new file mode 100644 index 0000000..0fbac03 --- /dev/null +++ b/frontend/models/OptionsSearch.php @@ -0,0 +1,69 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + $query->andFilterWhere([ + 'option_id' => $this->option_id, + 'option_parent' => $this->option_parent, + 'option_translatable' => $this->option_translatable, + ]); + + $query->andFilterWhere(['like', 'option_key', $this->option_key]) + ->andFilterWhere(['like', 'option_format', $this->option_format]); + + return $dataProvider; + } +} diff --git a/frontend/views/option-values/_form.php b/frontend/views/option-values/_form.php new file mode 100644 index 0000000..f6f9e61 --- /dev/null +++ b/frontend/views/option-values/_form.php @@ -0,0 +1,60 @@ + + +
+ + + + field($model, 'option_key')->textInput(['maxlength' => true]) ?> + +
+ field($model, 'option_value_text', ['enableClientValidation' => false])->label($model->getAttributeLabel('option_key').' | ')->textInput() ?> + + field($model, 'option_lang_id')->dropDownList($model->getDropDownArray()) ?> +
+ + field($model, 'option_value_parent')->dropDownList($model->getUserOptionsArray()) ?> + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
+
+
+ + getLanguagesCodes() as $lang) { + ?> +
+
+ +
+
+
+ \ No newline at end of file diff --git a/frontend/views/option-values/_search.php b/frontend/views/option-values/_search.php new file mode 100644 index 0000000..8ac15cd --- /dev/null +++ b/frontend/views/option-values/_search.php @@ -0,0 +1,37 @@ + + + diff --git a/frontend/views/option-values/create.php b/frontend/views/option-values/create.php new file mode 100644 index 0000000..6bfcaad --- /dev/null +++ b/frontend/views/option-values/create.php @@ -0,0 +1,21 @@ +title = Yii::t('app', 'Create Option Values'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Option Values'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/option-values/index.php b/frontend/views/option-values/index.php new file mode 100644 index 0000000..79cd35c --- /dev/null +++ b/frontend/views/option-values/index.php @@ -0,0 +1,39 @@ +title = Yii::t('app', 'Option Values'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'option_value_id', + 'option_key', + 'option_value_text:ntext', + 'option_lang_id', + 'option_value_parent', + // 'option_user', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/frontend/views/option-values/update.php b/frontend/views/option-values/update.php new file mode 100644 index 0000000..b993f40 --- /dev/null +++ b/frontend/views/option-values/update.php @@ -0,0 +1,23 @@ +title = Yii::t('app', 'Update {modelClass}: ', [ + 'modelClass' => 'Option Values', +]) . ' ' . $model->option_value_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Option Values'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->option_value_id, 'url' => ['view', 'id' => $model->option_value_id]]; +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/option-values/view.php b/frontend/views/option-values/view.php new file mode 100644 index 0000000..a6504d1 --- /dev/null +++ b/frontend/views/option-values/view.php @@ -0,0 +1,40 @@ +title = $model->option_value_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Option Values'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->option_value_id], ['class' => 'btn btn-primary']) ?> + $model->option_value_id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'option_value_id', + 'option_key', + 'option_value_text:ntext', + 'option_lang_id', + 'option_value_parent', + 'option_user', + ], + ]) ?> + +
diff --git a/frontend/views/option/_form.php b/frontend/views/option/_form.php new file mode 100644 index 0000000..caacf87 --- /dev/null +++ b/frontend/views/option/_form.php @@ -0,0 +1,88 @@ + + +
+ + + +

+ +
+ + + + + getLangs() as $lang) { + ?> +
+
+
+
+ +
+ $row) { + foreach($row as $key => $value) { + if(!$modellang[$index][$key][0]->hasErrors('value')) { + continue; + } + if($first) { + ?> +
+ + + + +
getFirstError('value')?>
+ getLangs() as $lang) { + ?> +
+
+
+
+ +
+ + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/option/_form_edit.php b/frontend/views/option/_form_edit.php new file mode 100644 index 0000000..b6f950f --- /dev/null +++ b/frontend/views/option/_form_edit.php @@ -0,0 +1,38 @@ + + +
+ + + + $row) { + ?> + + + + + hasErrors()) { ?>
getFirstError('value');?>
+ getLangs() as $lang_id => $lang) { + ?> +
+
+
+
+ + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + +
diff --git a/frontend/views/option/_search.php b/frontend/views/option/_search.php new file mode 100644 index 0000000..5fe0200 --- /dev/null +++ b/frontend/views/option/_search.php @@ -0,0 +1,37 @@ + + + diff --git a/frontend/views/option/create.php b/frontend/views/option/create.php new file mode 100644 index 0000000..f8db730 --- /dev/null +++ b/frontend/views/option/create.php @@ -0,0 +1,26 @@ +title = Yii::t('app', 'Create Option'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'models' => $models, + 'modellang' => $modellang, + 'modeldb' => $modeldb, + 'model_id' => $model_id, + 'fields' => $fields + ]) ?> + +
diff --git a/frontend/views/option/index.php b/frontend/views/option/index.php new file mode 100644 index 0000000..9051bb3 --- /dev/null +++ b/frontend/views/option/index.php @@ -0,0 +1,39 @@ +title = Yii::t('app', 'Options'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'option_id', + 'model', + 'model_id', + 'name', + 'template', + // 'parent_id', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/frontend/views/option/update.php b/frontend/views/option/update.php new file mode 100644 index 0000000..35b6600 --- /dev/null +++ b/frontend/views/option/update.php @@ -0,0 +1,26 @@ +title = Yii::t('app', 'Update {modelClass}: ', [ + 'modelClass' => 'Option', +]) . ' ' . $models[\Yii::$app->request->get('id')]->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $models[\Yii::$app->request->get('id')]->name, 'url' => ['view', 'id' => $models[\Yii::$app->request->get('id')]->option_id]]; +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); +?> +
+ +

title) ?>

+ + render('_form_edit', [ + 'models' => $models, + 'modellang' => $modellang, + 'modeldb' => $modeldb, + 'model_id' => $model_id + ]) ?> + +
diff --git a/frontend/views/option/view.php b/frontend/views/option/view.php new file mode 100644 index 0000000..ba4d20b --- /dev/null +++ b/frontend/views/option/view.php @@ -0,0 +1,40 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->option_id], ['class' => 'btn btn-primary']) ?> + $model->option_id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'option_id', + 'model', + 'model_id', + 'name', + 'template', + 'parent_id', + ], + ]) ?> + +
diff --git a/frontend/views/options/_form.php b/frontend/views/options/_form.php new file mode 100644 index 0000000..0cfe921 --- /dev/null +++ b/frontend/views/options/_form.php @@ -0,0 +1,29 @@ + + +
+ + + + field($model, 'option_key')->textInput(['maxlength' => true]) ?> + + field($model, 'option_parent')->textInput() ?> + + field($model, 'option_translatable')->textInput() ?> + + field($model, 'option_format')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/options/_search.php b/frontend/views/options/_search.php new file mode 100644 index 0000000..eab038c --- /dev/null +++ b/frontend/views/options/_search.php @@ -0,0 +1,35 @@ + + + diff --git a/frontend/views/options/create.php b/frontend/views/options/create.php new file mode 100644 index 0000000..95f6f60 --- /dev/null +++ b/frontend/views/options/create.php @@ -0,0 +1,21 @@ +title = Yii::t('app', 'Create Options'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/options/index.php b/frontend/views/options/index.php new file mode 100644 index 0000000..255f2fd --- /dev/null +++ b/frontend/views/options/index.php @@ -0,0 +1,38 @@ +title = Yii::t('app', 'Options'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'option_id', + 'option_key', + 'option_parent', + 'option_translatable', + 'option_format', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/frontend/views/options/update.php b/frontend/views/options/update.php new file mode 100644 index 0000000..e3c092a --- /dev/null +++ b/frontend/views/options/update.php @@ -0,0 +1,23 @@ +title = Yii::t('app', 'Update {modelClass}: ', [ + 'modelClass' => 'Options', +]) . ' ' . $model->option_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->option_id, 'url' => ['view', 'id' => $model->option_id]]; +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/options/view.php b/frontend/views/options/view.php new file mode 100644 index 0000000..6368d9c --- /dev/null +++ b/frontend/views/options/view.php @@ -0,0 +1,39 @@ +title = $model->option_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->option_id], ['class' => 'btn btn-primary']) ?> + $model->option_id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'option_id', + 'option_key', + 'option_parent', + 'option_translatable', + 'option_format', + ], + ]) ?> + +
diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index f780610..0abef59 100644 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -51,3 +51,4 @@ $this->title = 'My Yii Application'; + diff --git a/frontend/views/site/options.php b/frontend/views/site/options.php new file mode 100644 index 0000000..80a8ce6 --- /dev/null +++ b/frontend/views/site/options.php @@ -0,0 +1,24 @@ +title = 'My Yii Application'; +?> +
+
+ + $val) { + ?> + + + + +
+
\ No newline at end of file -- libgit2 0.21.4