From ab4d7cb1690d4d3bf2d808bb077444722f63c967 Mon Sep 17 00:00:00 2001 From: andryeyev Date: Fri, 6 Nov 2015 11:11:15 +0200 Subject: [PATCH] Page + Языковая версия --- artbox_db.sql | 433 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- backend/controllers/PageController-i18n.php | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/controllers/PageController.php | 47 +++++++++-------------------------------------- backend/controllers/Termin_langController.php | 27 +++++++++++++++++++-------- backend/models/SearchPage-i18n.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/models/SearchPage.php | 56 +++++++++++--------------------------------------------- backend/views/page-i18n/_form.php | 29 +++++++++++++++++++++++++++++ backend/views/page-i18n/_search.php | 35 +++++++++++++++++++++++++++++++++++ backend/views/page-i18n/create.php | 21 +++++++++++++++++++++ backend/views/page-i18n/index.php | 38 ++++++++++++++++++++++++++++++++++++++ backend/views/page-i18n/update.php | 23 +++++++++++++++++++++++ backend/views/page-i18n/view.php | 39 +++++++++++++++++++++++++++++++++++++++ backend/views/page/_form.php | 42 ++++++++++++++++++++++++------------------ backend/views/page/_search.php | 2 ++ backend/views/page/create.php | 1 - backend/views/page/index.php | 16 ++++++++-------- backend/views/page/update.php | 9 ++++----- backend/views/page/view.php | 8 +++++--- backend/views/termin_lang/_form.php | 2 +- backend/views/termin_lang/create.php | 2 +- backend/views/termin_lang/index.php | 2 +- backend/views/termin_lang/update.php | 4 ++-- backend/views/termin_lang/view.php | 4 ++-- common/components/LangRequest.php | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/components/LangUrlManager.php | 37 +++++++++++++++++++++++++++++++++++++ common/config/main.php | 24 ++++++++++++++++++++++++ common/messages/uk/action.php | 11 +++++++++++ common/messages/uk/field.php | 17 +++++++++++++++++ common/models/Language.php | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Page-i18n.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Page.php | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------- common/models/PageLang.php | 28 ++++++++++++---------------- common/models/TerminLang.php | 8 ++++---- db-migration/artbox_db.sql | 440 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/left.php | 7 +++---- vendor/yiisoft/yii2/base/Application.php | 6 ++++++ 36 files changed, 1311 insertions(+), 603 deletions(-) delete mode 100644 artbox_db.sql create mode 100644 backend/controllers/PageController-i18n.php create mode 100644 backend/models/SearchPage-i18n.php create mode 100644 backend/views/page-i18n/_form.php create mode 100644 backend/views/page-i18n/_search.php create mode 100644 backend/views/page-i18n/create.php create mode 100644 backend/views/page-i18n/index.php create mode 100644 backend/views/page-i18n/update.php create mode 100644 backend/views/page-i18n/view.php create mode 100644 common/components/LangRequest.php create mode 100644 common/components/LangUrlManager.php create mode 100644 common/messages/uk/action.php create mode 100644 common/messages/uk/field.php create mode 100644 common/models/Language.php create mode 100644 common/models/Page-i18n.php create mode 100644 db-migration/artbox_db.sql diff --git a/artbox_db.sql b/artbox_db.sql deleted file mode 100644 index 4ab6a18..0000000 --- a/artbox_db.sql +++ /dev/null @@ -1,433 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.0.10.10 --- http://www.phpmyadmin.net --- --- Хост: 127.0.0.1:3306 --- Час створення: Лис 04 2015 р., 15:24 --- Версія сервера: 5.5.45 --- Версія PHP: 5.6.12 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- База даних: `artbox_1` --- - --- -------------------------------------------------------- - --- --- Структура таблиці `feature` --- - -CREATE TABLE IF NOT EXISTS `feature` ( - `feature_id` int(6) NOT NULL AUTO_INCREMENT, - `feature_pid` int(6) NOT NULL DEFAULT '0', - PRIMARY KEY (`feature_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Структура таблиці `feature_lang` --- - -CREATE TABLE IF NOT EXISTS `feature_lang` ( - `feature_id` int(6) NOT NULL, - `feature_title` varchar(256) DEFAULT NULL, - `feature_lang` int(2) NOT NULL, - PRIMARY KEY (`feature_id`,`feature_lang`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Структура таблиці `image` --- - -CREATE TABLE IF NOT EXISTS `image` ( - `image_id` int(6) NOT NULL AUTO_INCREMENT, - `image_name` int(11) NOT NULL, - `image_md5` int(11) NOT NULL, - PRIMARY KEY (`image_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Структура таблиці `language` --- - -CREATE TABLE IF NOT EXISTS `language` ( - `language_id` int(2) NOT NULL AUTO_INCREMENT, - `lang_code` varchar(4) NOT NULL, - PRIMARY KEY (`language_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; - --- --- Дамп даних таблиці `language` --- - -INSERT INTO `language` (`language_id`, `lang_code`) VALUES -(1, 'uk'), -(2, 'ru'); - --- -------------------------------------------------------- - --- --- Структура таблиці `language_lang` --- - -CREATE TABLE IF NOT EXISTS `language_lang` ( - `language_id` int(2) NOT NULL, - `lang_title` varchar(256) NOT NULL, - `lang_id` int(2) NOT NULL, - UNIQUE KEY `language_id` (`language_id`,`lang_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Дамп даних таблиці `language_lang` --- - -INSERT INTO `language_lang` (`language_id`, `lang_title`, `lang_id`) VALUES -(1, 'Українська мова', 1), -(2, 'Русский язык', 2); - --- -------------------------------------------------------- - --- --- Структура таблиці `menu` --- - -CREATE TABLE IF NOT EXISTS `menu` ( - `menu_id` int(6) NOT NULL AUTO_INCREMENT, - `menu_pid` int(6) NOT NULL, - `menu_lft` int(6) NOT NULL, - `menu_rgt` int(6) NOT NULL, - `termin_id` int(6) NOT NULL, - `show` tinyint(1) NOT NULL, - `sortorder` int(6) NOT NULL, - PRIMARY KEY (`menu_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; - --- --- Дамп даних таблиці `menu` --- - -INSERT INTO `menu` (`menu_id`, `menu_pid`, `menu_lft`, `menu_rgt`, `termin_id`, `show`, `sortorder`) VALUES -(1, 0, 0, 0, 1, 1, 1); - --- -------------------------------------------------------- - --- --- Структура таблиці `migration` --- - -CREATE TABLE IF NOT EXISTS `migration` ( - `version` varchar(180) NOT NULL, - `apply_time` int(11) DEFAULT NULL, - PRIMARY KEY (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Дамп даних таблиці `migration` --- - -INSERT INTO `migration` (`version`, `apply_time`) VALUES -('m000000_000000_base', 1446045946), -('m130524_201442_init', 1446045953), -('m140506_102106_rbac_init', 1446131385); - --- -------------------------------------------------------- - --- --- Структура таблиці `page` --- - -CREATE TABLE IF NOT EXISTS `page` ( - `page_id` int(6) NOT NULL AUTO_INCREMENT, - `date_add` datetime NOT NULL, - `template_id` int(6) NOT NULL, - `image_id` int(6) NOT NULL, - `show` tinyint(1) NOT NULL, - PRIMARY KEY (`page_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; - --- --- Дамп даних таблиці `page` --- - -INSERT INTO `page` (`page_id`, `date_add`, `template_id`, `image_id`, `show`) VALUES -(1, '2015-11-03 00:00:00', 0, 0, 1), -(2, '2015-11-03 00:00:00', 0, 0, 1), -(3, '2015-11-03 00:00:00', 0, 0, 1); - --- -------------------------------------------------------- - --- --- Структура таблиці `page_lang` --- - -CREATE TABLE IF NOT EXISTS `page_lang` ( - `page_id` int(6) NOT NULL, - `title` varchar(256) NOT NULL, - `meta_title` varchar(512) NOT NULL, - `meta_description` varchar(512) NOT NULL, - `text` text NOT NULL, - `page_alias` varchar(256) NOT NULL, - `lang_id` int(2) NOT NULL, - PRIMARY KEY (`page_id`,`lang_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Дамп даних таблиці `page_lang` --- - -INSERT INTO `page_lang` (`page_id`, `title`, `meta_title`, `meta_description`, `text`, `page_alias`, `lang_id`) VALUES -(1, 'Головна сторінка', 'Головна сторінка', 'Головна сторінка - Artbox', '', '/', 1), -(1, 'Главная страница', 'Главная страница', 'Главная страница - Artbox', '', '/ru/', 2), -(2, 'Магазин Meta Title', 'Магазин Meta Title', 'Магазин Meta Description', 'Магазин Text', 'shop', 1), -(3, 'Контент', 'Контент', 'Контент', 'Контент', 'content', 1); - --- -------------------------------------------------------- - --- --- Структура таблиці `product` --- - -CREATE TABLE IF NOT EXISTS `product` ( - `product_id` int(6) NOT NULL AUTO_INCREMENT, - `termin_id` int(6) NOT NULL, - `curency_id` int(6) NOT NULL, - `price` decimal(10,3) NOT NULL, - `show` tinyint(1) NOT NULL, - PRIMARY KEY (`product_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Структура таблиці `product_category` --- - -CREATE TABLE IF NOT EXISTS `product_category` ( - `product_id` int(6) NOT NULL, - `termin_id` int(6) NOT NULL, - PRIMARY KEY (`product_id`,`termin_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Структура таблиці `product_tag` --- - -CREATE TABLE IF NOT EXISTS `product_tag` ( - `product_id` int(6) NOT NULL, - `temin_id` int(6) NOT NULL, - PRIMARY KEY (`product_id`,`temin_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Структура таблиці `termin` --- - -CREATE TABLE IF NOT EXISTS `termin` ( - `termin_id` int(6) NOT NULL AUTO_INCREMENT, - `termin_type_id` int(2) NOT NULL, - `page_id` int(6) NOT NULL DEFAULT '0', - PRIMARY KEY (`termin_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=18 ; - --- --- Дамп даних таблиці `termin` --- - -INSERT INTO `termin` (`termin_id`, `termin_type_id`, `page_id`) VALUES -(1, 5, 1), -(2, 0, 0), -(3, 0, 0), -(4, 0, 0), -(5, 0, 0), -(6, 0, 0), -(7, 0, 0), -(8, 0, 0), -(9, 0, 0), -(10, 0, 0), -(16, 0, 0), -(17, 0, 0); - --- -------------------------------------------------------- - --- --- Структура таблиці `termin_lang` --- - -CREATE TABLE IF NOT EXISTS `termin_lang` ( - `termin_id` int(6) NOT NULL, - `termin_title` varchar(256) DEFAULT NULL, - `lang_id` int(2) NOT NULL, - PRIMARY KEY (`termin_id`,`lang_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Дамп даних таблиці `termin_lang` --- - -INSERT INTO `termin_lang` (`termin_id`, `termin_title`, `lang_id`) VALUES -(1, 'Головна', 1), -(2, 'Завод', 1), -(3, 'BMW', 1), -(4, 'Mini', 1), -(5, 'Года (1996-2000)', 1), -(6, 'Кузов', 1), -(7, 'Модель', 1), -(8, 'Серия', 1), -(9, 'Мотор (тип)', 1), -(10, 'Мотор (обьем)', 1), -(16, '1996', 1), -(17, 'X5', 1); - --- -------------------------------------------------------- - --- --- Структура таблиці `termin_option` --- - -CREATE TABLE IF NOT EXISTS `termin_option` ( - `termin_id` int(6) NOT NULL, - `termin_pid` int(6) NOT NULL, - `sortorder` int(6) NOT NULL, - PRIMARY KEY (`termin_id`,`termin_pid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Дамп даних таблиці `termin_option` --- - -INSERT INTO `termin_option` (`termin_id`, `termin_pid`, `sortorder`) VALUES -(1, 0, 1), -(2, 0, 2), -(3, 2, 1), -(4, 2, 2), -(5, 0, 3), -(6, 3, 1), -(6, 4, 1), -(7, 3, 2), -(7, 4, 2), -(8, 3, 3), -(8, 4, 3), -(9, 3, 4), -(9, 4, 4), -(10, 3, 5), -(10, 4, 5), -(16, 5, 4), -(17, 7, 0), -(17, 16, 0); - --- -------------------------------------------------------- - --- --- Структура таблиці `termin_relation` --- - -CREATE TABLE IF NOT EXISTS `termin_relation` ( - `termin_id` int(6) NOT NULL, - `termin_relation_id` int(6) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Структура таблиці `termin_type` --- - -CREATE TABLE IF NOT EXISTS `termin_type` ( - `termin_type_id` int(2) NOT NULL AUTO_INCREMENT, - `termin_type_name` varchar(56) NOT NULL, - PRIMARY KEY (`termin_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ; - --- --- Дамп даних таблиці `termin_type` --- - -INSERT INTO `termin_type` (`termin_type_id`, `termin_type_name`) VALUES -(1, 'tag'), -(2, 'news'), -(3, 'article'), -(4, 'category'), -(5, 'page'); - --- -------------------------------------------------------- - --- --- Структура таблиці `termin_type_lang` --- - -CREATE TABLE IF NOT EXISTS `termin_type_lang` ( - `termin_type_id` int(2) NOT NULL, - `termin_type_title` varchar(56) NOT NULL, - `lang_id` int(2) NOT NULL, - PRIMARY KEY (`termin_type_id`,`lang_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Дамп даних таблиці `termin_type_lang` --- - -INSERT INTO `termin_type_lang` (`termin_type_id`, `termin_type_title`, `lang_id`) VALUES -(1, 'Тег', 1), -(1, 'Тег', 2), -(2, 'Новини', 1), -(2, 'Новости', 2), -(3, 'Статья', 1), -(3, 'Статья', 2), -(4, 'Категорія', 1), -(4, 'Категория', 2), -(5, 'Сторінка', 1), -(5, 'Страница', 2); - --- -------------------------------------------------------- - --- --- Структура таблиці `user` --- - -CREATE TABLE IF NOT EXISTS `user` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `lastname` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `firstname` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `middlename` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL, - `password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `status` smallint(6) NOT NULL DEFAULT '10', - `created_at` int(11) NOT NULL, - `updated_at` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `email` (`email`), - UNIQUE KEY `username` (`username`), - UNIQUE KEY `password_reset_token` (`password_reset_token`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; - --- --- Дамп даних таблиці `user` --- - -INSERT INTO `user` (`id`, `username`, `lastname`, `firstname`, `middlename`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES -(1, 'zlodeyev', 'Андреев', 'Владимир', 'Сергійович', 'VgTs2skfY1Uf3YERn1OR3E2V_Hm0KZwF', '$2y$13$jOtOdIQUU2.ZyEkxN9TJjuhfS7Q3p2K/KqGWNyBab07OaQUsJ5nSi', NULL, 'volodymyr.andryeyev@gmail.com', 10, 1446046164, 1446538181); - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/backend/controllers/PageController-i18n.php b/backend/controllers/PageController-i18n.php new file mode 100644 index 0000000..1862e04 --- /dev/null +++ b/backend/controllers/PageController-i18n.php @@ -0,0 +1,121 @@ + [ + '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()) { + 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()) { + 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) + { + $this->findModel($id)->delete(); + + 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($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/controllers/PageController.php b/backend/controllers/PageController.php index 4d690f7..8891e8a 100644 --- a/backend/controllers/PageController.php +++ b/backend/controllers/PageController.php @@ -8,8 +8,6 @@ use backend\models\SearchPage; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; -use common\models\PageLang; -use yii\data\SqlDataProvider; /** * PageController implements the CRUD actions for Page model. @@ -27,33 +25,20 @@ class PageController extends Controller ], ]; } + /** * Lists all Page models. * @return mixed */ public function actionIndex() - { - $searchModel = new SearchPage(); - - $_GET['lang_id'] = 1; - + { + $searchModel = new SearchPage(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + return $this->render('index', [ - 'dataProvider' => new SqlDataProvider([ - 'sql' => SearchPage::getList(Yii::$app->request->get()), - 'pagination' => [ - 'pagesize' => 30, - ], - 'sort' => [ - 'attributes' => [ - 'page_id', - 'date_add', - 'title', - 'show', - ] - ] - ]), 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, ]); } @@ -77,24 +62,12 @@ class PageController extends Controller public function actionCreate() { $model = new Page(); - $page_lang = new PageLang(); - - if ($model->validate() - && $page_lang->load(Yii::$app->request->post()) - && $model->load(Yii::$app->request->post())) - { - $model->save(); - $page_lang->page_id = $model->page_id; - $page_lang->lang_id = 1; - $page_lang->save(); - + + if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->page_id]); - } - else - { + } else { return $this->render('create', [ 'model' => $model, - 'page_lang' => $page_lang, ]); } } @@ -108,14 +81,12 @@ class PageController extends Controller public function actionUpdate($id) { $model = $this->findModel($id); - $page_lang = PageLang::find()->where(['page_id' => $id, 'lang_id' => 1])->one(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->page_id]); } else { return $this->render('update', [ 'model' => $model, - 'page_lang' => $page_lang, ]); } } diff --git a/backend/controllers/Termin_langController.php b/backend/controllers/Termin_langController.php index cb90553..cd0e23a 100644 --- a/backend/controllers/Termin_langController.php +++ b/backend/controllers/Termin_langController.php @@ -16,8 +16,12 @@ use common\models\TerminOption; */ class Termin_langController extends Controller { + var $lang_id = 1; + public function behaviors() { + $this->castyl(); + return [ 'verbs' => [ 'class' => VerbFilter::className(), @@ -27,14 +31,21 @@ class Termin_langController extends Controller ], ]; } + + 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', [ @@ -52,7 +63,7 @@ class Termin_langController extends Controller public function actionView($termin_id) { return $this->render('view', [ - 'model' => $this->findModel($termin_id, $lang_id), + 'model' => $this->findModel($termin_id, $this->lang_id), ]); } @@ -117,9 +128,9 @@ class Termin_langController extends Controller * @param integer $lang_id * @return mixed */ - public function actionUpdate($termin_id, $lang_id) + public function actionUpdate($termin_id) { - $model = $this->findModel($termin_id, $lang_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]); @@ -137,9 +148,9 @@ class Termin_langController extends Controller * @param integer $lang_id * @return mixed */ - public function actionDelete($termin_id, $lang_id) + public function actionDelete($termin_id) { - $this->findModel($termin_id, $lang_id)->delete(); + $this->findModel($termin_id, $this->lang_id)->delete(); return $this->redirect(['index']); } @@ -152,9 +163,9 @@ class Termin_langController extends Controller * @return TerminLang the loaded model * @throws NotFoundHttpException if the model cannot be found */ - protected function findModel($termin_id, $lang_id) + protected function findModel($termin_id) { - if (($model = TerminLang::findOne(['termin_id' => $termin_id, 'lang_id' => $lang_id])) !== null) { + 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/models/SearchPage-i18n.php b/backend/models/SearchPage-i18n.php new file mode 100644 index 0000000..945fcf7 --- /dev/null +++ b/backend/models/SearchPage-i18n.php @@ -0,0 +1,68 @@ +common/messages/1/field.php $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([ + 'page_id' => $this->page_id, + 'date_add' => $this->date_add, + 'template_id' => $this->template_id, + 'image_id' => $this->image_id, + 'show' => $this->show, + ]); + + return $dataProvider; + } +} diff --git a/backend/models/SearchPage.php b/backend/models/SearchPage.php index 7882439..b977ae9 100644 --- a/backend/models/SearchPage.php +++ b/backend/models/SearchPage.php @@ -2,11 +2,11 @@ namespace backend\models; -use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; use common\models\Page; + /** * SearchPage represents the model behind the search form about `common\models\Page`. */ @@ -18,7 +18,7 @@ class SearchPage extends Page public function rules() { return [ - [['page_id', 'image_id', 'show'], 'integer'], + [['page_id', 'template_id', 'image_id', 'show'], 'integer'], [['date_add'], 'safe'], ]; } @@ -32,6 +32,7 @@ class SearchPage extends Page return Model::scenarios(); } + /** * Creates data provider instance with search query applied * @@ -40,10 +41,9 @@ class SearchPage extends Page * @return ActiveDataProvider */ public function search($params) - { - $query = self::getAll(Yii::$app->request->get()); - //$query = Page::find(); - //->joinWith('pagelang'); + { + $query = Page::find(); + $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); @@ -57,47 +57,13 @@ class SearchPage extends Page } $query->andFilterWhere([ - $this->addCondition($query, 'title'), - + 'page_id' => $this->page_id, + 'date_add' => $this->date_add, + 'template_id' => $this->template_id, + 'image_id' => $this->image_id, + 'show' => $this->show, ]); return $dataProvider; } - - - static function getList (array $param = array ()) - { - $sql = ' - SELECT - `page`.date_add, `page`.`show`, - `page_lang`.* - FROM `page` - LEFT JOIN `page_lang` ON `page_lang`.page_id = `page`.page_id - AND `page_lang`.lang_id = '.(int)$param['lang_id']; - - $WHERE = array (); - - if (isset ($param['page_id'])) - { - $WHERE[] = '`page_lang`.page_id = '.(int)$param['page_id']; - } - - if (isset ($param['date_add'])) - { - $WHERE[] = '`page`.date_add = "'.(int)$param['page_id'].'"'; - } - - if (isset ($param['show'])) - { - $WHERE[] = '`page`.show = "'.(int)$param['show'].'"'; - } - - if (! empty ($WHERE)) - { - $sql .= ' WHERE '.implode (' AND ', $WHERE); - } - - return $sql; - } - } diff --git a/backend/views/page-i18n/_form.php b/backend/views/page-i18n/_form.php new file mode 100644 index 0000000..328f429 --- /dev/null +++ b/backend/views/page-i18n/_form.php @@ -0,0 +1,29 @@ + + +
+ + + + field($model, 'date_add')->textInput() ?> + + field($model, 'template_id')->textInput() ?> + + field($model, 'image_id')->textInput() ?> + + field($model, 'show')->textInput() ?> + +
+ isNewRecord ? Yii::t('field', 'Create') : Yii::t('field', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/page-i18n/_search.php b/backend/views/page-i18n/_search.php new file mode 100644 index 0000000..d0725bf --- /dev/null +++ b/backend/views/page-i18n/_search.php @@ -0,0 +1,35 @@ + + + diff --git a/backend/views/page-i18n/create.php b/backend/views/page-i18n/create.php new file mode 100644 index 0000000..cd472cb --- /dev/null +++ b/backend/views/page-i18n/create.php @@ -0,0 +1,21 @@ +title = Yii::t('field', 'Create Page'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('field', 'Pages'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/page-i18n/index.php b/backend/views/page-i18n/index.php new file mode 100644 index 0000000..6052290 --- /dev/null +++ b/backend/views/page-i18n/index.php @@ -0,0 +1,38 @@ +title = Yii::t('field', 'Pages'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

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

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

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'page_id', + 'date_add', + 'template_id', + 'image_id', + 'show', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/backend/views/page-i18n/update.php b/backend/views/page-i18n/update.php new file mode 100644 index 0000000..518e86d --- /dev/null +++ b/backend/views/page-i18n/update.php @@ -0,0 +1,23 @@ +title = Yii::t('field', 'Update {modelClass}: ', [ + 'modelClass' => 'Page', +]) . ' ' . $model->page_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('field', 'Pages'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->page_id, 'url' => ['view', 'id' => $model->page_id]]; +$this->params['breadcrumbs'][] = Yii::t('field', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/page-i18n/view.php b/backend/views/page-i18n/view.php new file mode 100644 index 0000000..2eefcd5 --- /dev/null +++ b/backend/views/page-i18n/view.php @@ -0,0 +1,39 @@ +title = $model->page_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('field', 'Pages'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ + $model, + 'attributes' => [ + 'page_id', + 'date_add', + 'template_id', + 'image_id', + 'show', + ], + ]) ?> + +
diff --git a/backend/views/page/_form.php b/backend/views/page/_form.php index 5beeeb3..43c3124 100644 --- a/backend/views/page/_form.php +++ b/backend/views/page/_form.php @@ -2,7 +2,6 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -use yii\jui\DatePicker; /* @var $this yii\web\View */ /* @var $model common\models\Page */ @@ -13,28 +12,35 @@ use yii\jui\DatePicker; -

Common

+

- field($model, 'date_add')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd']) ?> - - field($model, 'image_id')->textInput() ?> + field($model, 'date_add')->textInput() ?> - field($model, 'show')->dropDownList(['1' => 'Показать', '0' => 'Спрятать']) ?> - -

Lang

- - field($page_lang, 'title')->textInput() ?> - - field($page_lang, 'meta_title')->textarea(['rows' => 1]) ?> - - field($page_lang, 'meta_description')->textarea(['rows' => 1]) ?> - - field($page_lang, 'text')->textarea(['rows' => 6]) ?> + field($model, 'template_id')->textInput() ?> + + field($model, 'image_id')->textInput() ?> - field($page_lang, 'page_alias')->textInput() ?> + field($model, 'show')->textInput() ?> +

+ + field($model, 'title')->textInput() ?> + + field($model, 'meta_title')->textarea() ?> + + field($model, 'meta_description')->textarea() ?> + + field($model, 'text')->textarea(['row' => 4]) ?> + + field($model, 'page_alias')->textInput() ?> +
- isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> + isNewRecord ? + Yii::t('action', 'add') : + Yii::t('action', 'update'), + ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary'] + ) ?>
diff --git a/backend/views/page/_search.php b/backend/views/page/_search.php index d120b6c..ebda0db 100644 --- a/backend/views/page/_search.php +++ b/backend/views/page/_search.php @@ -19,6 +19,8 @@ use yii\widgets\ActiveForm; field($model, 'date_add') ?> + field($model, 'template_id') ?> + field($model, 'image_id') ?> field($model, 'show') ?> diff --git a/backend/views/page/create.php b/backend/views/page/create.php index 6775b83..d47a8ad 100644 --- a/backend/views/page/create.php +++ b/backend/views/page/create.php @@ -16,7 +16,6 @@ $this->params['breadcrumbs'][] = $this->title; render('_form', [ 'model' => $model, - 'page_lang' => $page_lang, ]) ?> diff --git a/backend/views/page/index.php b/backend/views/page/index.php index ee0b1aa..8c26719 100644 --- a/backend/views/page/index.php +++ b/backend/views/page/index.php @@ -12,24 +12,24 @@ $this->params['breadcrumbs'][] = $this->title; ?>
-

title) ?>

+

title) ?>

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

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

- + $dataProvider, 'filterModel' => $searchModel, - //'filterModel' => ['title' => 1], 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - 'page_id' , + 'page_id', 'date_add', - //'title', - 'show', + 'title', + 'template_id', + 'show', ['class' => 'yii\grid\ActionColumn'], ], diff --git a/backend/views/page/update.php b/backend/views/page/update.php index e980100..13329df 100644 --- a/backend/views/page/update.php +++ b/backend/views/page/update.php @@ -5,10 +5,10 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model common\models\Page */ -$this->title = 'Update Page: ' . ' ' . $model->page_id; -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->page_id, 'url' => ['view', 'id' => $model->page_id]]; -$this->params['breadcrumbs'][] = 'Update'; +$this->title = Yii::t('action', 'edit').': ' . ' ' . $model->title; +$this->params['breadcrumbs'][] = ['label' => Yii::t('field', 'page'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->page_id, 'url' => [Yii::t('action', 'view'), 'id' => $model->page_id]]; +$this->params['breadcrumbs'][] = Yii::t('action', 'update'); ?>
@@ -16,7 +16,6 @@ $this->params['breadcrumbs'][] = 'Update'; render('_form', [ 'model' => $model, - 'page_lang' =>$page_lang, ]) ?>
diff --git a/backend/views/page/view.php b/backend/views/page/view.php index b3f5490..9937c04 100644 --- a/backend/views/page/view.php +++ b/backend/views/page/view.php @@ -2,13 +2,14 @@ use yii\helpers\Html; use yii\widgets\DetailView; +use yii\data\Pagination; /* @var $this yii\web\View */ /* @var $model common\models\Page */ - + $this->title = $model->page_id; -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; +$this->params['breadcrumbs'][] = ['label' => Yii::t('field', 'n, page', ['n' => 1]), 'url' => ['index']]; +$this->params['breadcrumbs'][] = Yii::t('field', 'n, page', ['n' => 'few']); ?>
@@ -30,6 +31,7 @@ $this->params['breadcrumbs'][] = $this->title; 'attributes' => [ 'page_id', 'date_add', + 'template_id', 'image_id', 'show', ], diff --git a/backend/views/termin_lang/_form.php b/backend/views/termin_lang/_form.php index e3736aa..2fa07db 100644 --- a/backend/views/termin_lang/_form.php +++ b/backend/views/termin_lang/_form.php @@ -12,7 +12,7 @@ use yii\widgets\ActiveForm; - field($termin_lang, 'termin_title')->textInput(['maxlength' => true]) ?> + field($termin_lang, 'termin_title')->textInput(['maxlength' => 256]) ?>
isNewRecord ? 'Create' : 'Update', ['class' => $termin_lang->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/backend/views/termin_lang/create.php b/backend/views/termin_lang/create.php index 5929357..52bb7eb 100644 --- a/backend/views/termin_lang/create.php +++ b/backend/views/termin_lang/create.php @@ -6,7 +6,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model common\models\TerminLang */ -$this->title = 'Create Termin Lang'; +$this->title = 'Добавить Термин'; $this->params['breadcrumbs'][] = ['label' => 'Termin Langs', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> diff --git a/backend/views/termin_lang/index.php b/backend/views/termin_lang/index.php index e64c82e..31cc157 100644 --- a/backend/views/termin_lang/index.php +++ b/backend/views/termin_lang/index.php @@ -7,7 +7,7 @@ use yii\grid\GridView; /* @var $searchModel backend\models\TerminLangSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ -$this->title = 'Termin Langs'; +$this->title = 'Термин'; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/backend/views/termin_lang/update.php b/backend/views/termin_lang/update.php index c061a32..7832d9e 100644 --- a/backend/views/termin_lang/update.php +++ b/backend/views/termin_lang/update.php @@ -5,7 +5,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model common\models\TerminLang */ -$this->title = 'Update Termin Lang: ' . ' ' . $model->termin_id; +$this->title = 'Редактировать Термин: ' . ' ' . $model->termin_id; $this->params['breadcrumbs'][] = ['label' => 'Termin Langs', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->termin_id, 'url' => ['view', 'termin_id' => $model->termin_id, 'lang_id' => $model->lang_id]]; $this->params['breadcrumbs'][] = 'Update'; @@ -15,7 +15,7 @@ $this->params['breadcrumbs'][] = 'Update';

title) ?>

render('_form', [ - 'model' => $model, + 'termin_lang' => $model, ]) ?>
diff --git a/backend/views/termin_lang/view.php b/backend/views/termin_lang/view.php index 09bef92..7712564 100644 --- a/backend/views/termin_lang/view.php +++ b/backend/views/termin_lang/view.php @@ -6,8 +6,8 @@ use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model common\models\TerminLang */ -$this->title = $model->termin_id; -$this->params['breadcrumbs'][] = ['label' => 'Termin Langs', 'url' => ['index']]; +$this->title = 'Термин: '.$model->termin_title; +$this->params['breadcrumbs'][] = ['label' => 'Термин', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>
diff --git a/common/components/LangRequest.php b/common/components/LangRequest.php new file mode 100644 index 0000000..60949f9 --- /dev/null +++ b/common/components/LangRequest.php @@ -0,0 +1,90 @@ +_lang_url === null) + { + $this->_lang_url = $this->getUrl(); + + $url_list = explode ('/', $this->_lang_url); + + $lang_url = isset ($url_list[1]) ? $url_list[1] : null; + + Language::setCurrent($lang_url); + + if ($lang_url !== null && $lang_url === Language::getCurrent()->lang_code + && strpos($this->_lang_url, Language::getCurrent()->lang_code) === 1) + { + $this->_lang_url = substr ($this->_lang_url, strlen (Language::getCurrent()->lang_code) + 1); + } + } + + return $this->_lang_url; + } + + protected function resolvePathInfo() + { + $pathInfo = $this->getLangUrl(); + + if (($pos = strpos ($pathInfo, '?')) !== false) + { + $pathInfo = substr ($pathInfo, 0, $pos); + } + + $pathInfo = urldecode ($pathInfo); + + // try to encode in UTF8 if not so + // http://w3.org/International/questions/qa-forms-utf-8.html + if (! preg_match ('%^(?: + [\x09\x0A\x0D\x20-\x7E] # ASCII + | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte + | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs + | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte + | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates + | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 + | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 + | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 + )*$%xs', $pathInfo) + ) + { + $pathInfo = utf8_encode($pathInfo); + } + + $scriptUrl = $this->getScriptUrl(); + $baseUrl = $this->getBaseUrl(); + + if (strpos($pathInfo, $scriptUrl) === 0) + { + $pathInfo = substr($pathInfo, strlen($scriptUrl)); + } + else if ($baseUrl === '' || strpos($pathInfo, $baseUrl) === 0) + { + $pathInfo = substr($pathInfo, strlen($baseUrl)); + } + elseif (isset ($_SERVER['PHP_SELF']) && strpos ($_SERVER['PHP_SELF'], $scriptUrl) === 0) + { + $pathInfo = substr($_SERVER['PHP_SELF'], strlen($scriptUrl)); + } + else + { + throw new InvalidConfigException('Unable to determine the path info of the current request.'); + } + + if ($pathInfo[0] === '/') + { + $pathInfo = substr ($pathInfo, 1); + } + + return (string) $pathInfo; + } +} \ No newline at end of file diff --git a/common/components/LangUrlManager.php b/common/components/LangUrlManager.php new file mode 100644 index 0000000..f26dd22 --- /dev/null +++ b/common/components/LangUrlManager.php @@ -0,0 +1,37 @@ +is_default == 1 ? $url : '/'.$lang_code->lang_code.$url); + } +} \ No newline at end of file diff --git a/common/config/main.php b/common/config/main.php index c9071d1..f71b4f3 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -5,5 +5,29 @@ return [ 'cache' => [ 'class' => 'yii\caching\FileCache', ], + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'showScriptName' => false, + 'class'=> 'common\components\LangUrlManager', + 'rules'=>[ + '/' => 'site/index', + '//*'=>'/', + ] + ], + 'request' => [ + 'class' => 'common\components\LangRequest' + ], + 'i18n' => [ + 'translations' => [ + '*' => [ + 'class' => 'yii\i18n\PhpMessageSource', + 'basePath' => $_SERVER['DOCUMENT_ROOT'].'/common/messages', + 'fileMap' => [ + 'app' => 'app.php', + 'app/error' => 'error.php', + ], + ], + ], + ], ], ]; diff --git a/common/messages/uk/action.php b/common/messages/uk/action.php new file mode 100644 index 0000000..d676b76 --- /dev/null +++ b/common/messages/uk/action.php @@ -0,0 +1,11 @@ + 'Додати', + 'edit' => 'Змінити', + 'update' => 'Оновити', + 'del' => 'Видалити', + 'hide' => 'Сховати', + 'copy' => 'Копіювати', + 'view' => 'Переглянути', +]; diff --git a/common/messages/uk/field.php b/common/messages/uk/field.php new file mode 100644 index 0000000..69eee6f --- /dev/null +++ b/common/messages/uk/field.php @@ -0,0 +1,17 @@ + 'Сторінка', + 'date_add' => 'Дата додання', + 'template' => 'Шаблон', + 'image' => 'Картинка', + 'show' => 'Відображати', + 'title' => 'Заголовок', + 'meta_title' => 'Meta Title', + 'meta_description' => 'Meta Description', + 'text' => 'Текст', + 'page_alias' => 'alias', + 'lang_id' => 'ID мови', + 'common' => 'Загальне', + 'lang' => 'Мовні змінні', +]; diff --git a/common/models/Language.php b/common/models/Language.php new file mode 100644 index 0000000..14b0230 --- /dev/null +++ b/common/models/Language.php @@ -0,0 +1,89 @@ +language = self::$current->lang_code; + Yii::$app->lang_id = self::$current->language_id; + } + + //Получения объекта языка по умолчанию + static function getDefaultLang() + { + return Language::find()->where('`is_default` = :default', [':default' => 1])->one(); + } + + //Получения объекта языка по буквенному идентификатору + static function getLangByUrl ($lang_code = null) + { + if ($lang_code === null) + { + return null; + } + else + { + $language = Language::find()->where('lang_code = :what', [':what' => $lang_code])->one(); + return $language === null ? null : $language; + } + } + + /** + * @inheritdoc + */ + public static function tableName() + { + return 'language'; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [['lang_code'], 'required'], + [['lang_code'], 'string', 'max' => 4] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'language_id' => Yii::t('app/Lang', 'Language ID'), + 'lang_code' => Yii::t('app/Lang', 'Lang Code'), + ]; + } +} diff --git a/common/models/Page-i18n.php b/common/models/Page-i18n.php new file mode 100644 index 0000000..07aa923 --- /dev/null +++ b/common/models/Page-i18n.php @@ -0,0 +1,51 @@ + Yii::t('app/Lang', 'Page ID'), + 'date_add' => Yii::t('app/Lang', 'Date Add'), + 'template_id' => Yii::t('app/Lang', 'Template ID'), + 'image_id' => Yii::t('app/Lang', 'Image ID'), + 'show' => Yii::t('app/Lang', 'Show'), + ]; + } +} diff --git a/common/models/Page.php b/common/models/Page.php index 6b838d2..10f519f 100644 --- a/common/models/Page.php +++ b/common/models/Page.php @@ -3,17 +3,33 @@ namespace common\models; use Yii; +use common\models\PageLang; /** * This is the model class for table "page". * * @property integer $page_id * @property string $date_add + * @property integer $template_id * @property integer $image_id * @property integer $show */ class Page extends \yii\db\ActiveRecord { + private static $getAttributeLabelCache; + + public function getAttributeLabel($attribute) + { + $class = get_class($this); + + if (!isset(self::$getAttributeLabelCache[$class][$attribute])) { + self::$getAttributeLabelCache[$class][$attribute] = parent::getAttributeLabel($attribute); + } + + return self::$getAttributeLabelCache[$class][$attribute]; + } + + //public $title; /** * @inheritdoc */ @@ -21,6 +37,38 @@ class Page extends \yii\db\ActiveRecord { return 'page'; } + + // ==== EXTRA ==== + + public function getExtraField($key) + { + return PageLang::find()->where(['page_id' => $this->page_id, 'lang_id' => 1])->one()->$key; + } + + public function getTitle() + { + return $this->getExtraField('title'); + } + + public function getMeta_title() + { + return $this->getExtraField('meta_title'); + } + + public function getMeta_description() + { + return $this->getExtraField('meta_description'); + } + + public function getText() + { + return $this->getExtraField('text'); + } + + public function getPage_alias() + { + return $this->getExtraField('page_alias'); + } /** * @inheritdoc @@ -28,9 +76,9 @@ class Page extends \yii\db\ActiveRecord public function rules() { return [ - [['date_add', 'image_id', 'show'], 'safe'], + [['date_add', 'template_id', 'image_id', 'show'], 'required'], [['date_add'], 'safe'], - [['image_id', 'show'], 'integer'] + [['template_id', 'image_id', 'show'], 'integer'] ]; } @@ -40,15 +88,18 @@ class Page extends \yii\db\ActiveRecord public function attributeLabels() { return [ - 'page_id' => 'Page ID', - 'date_add' => 'Date Add', - 'image_id' => 'Image ID', - 'show' => 'Show', + 'page_id' => Yii::t('field', 'page'), + 'date_add' => Yii::t('field', 'date_add'), + 'template_id' => Yii::t('field', 'template'), + 'image_id' => Yii::t('field', 'image'), + 'show' => Yii::t('field', 'show'), + + 'title' => Yii::t('field', 'title'), + 'meta_title' => Yii::t('field', 'meta_title'), + 'meta_description' => Yii::t('field', 'meta_description'), + 'text' => Yii::t('field', 'text'), + 'page_alias' => Yii::t('field', 'page_alias'), + 'lang_id' => Yii::t('field', 'lang_id'), ]; - } - - public function getPagelang() - { - return $this->hasMany(PageLang::className(), ['page_id' => 'page_id']); - } -} \ No newline at end of file + } +} diff --git a/common/models/PageLang.php b/common/models/PageLang.php index 8de38ec..b73795a 100644 --- a/common/models/PageLang.php +++ b/common/models/PageLang.php @@ -8,6 +8,7 @@ use Yii; * This is the model class for table "page_lang". * * @property integer $page_id + * @property string $title * @property string $meta_title * @property string $meta_description * @property string $text @@ -30,11 +31,11 @@ class PageLang extends \yii\db\ActiveRecord public function rules() { return [ - [['page_id', 'title', 'meta_title', 'meta_description', 'text', 'page_alias', 'lang_id'], 'safe'], + [['page_id', 'title', 'meta_title', 'meta_description', 'text', 'page_alias', 'lang_id'], 'required'], [['page_id', 'lang_id'], 'integer'], [['text'], 'string'], - [['meta_title', 'meta_description'], 'string', 'max' => 512], - [['page_alias'], 'string', 'max' => 256] + [['title', 'page_alias'], 'string', 'max' => 256], + [['meta_title', 'meta_description'], 'string', 'max' => 512] ]; } @@ -44,18 +45,13 @@ class PageLang extends \yii\db\ActiveRecord public function attributeLabels() { return [ - 'page_id' => 'Page ID', - 'title' => 'title', - 'meta_title' => 'Meta Title', - 'meta_description' => 'Meta Description', - 'text' => 'Text', - 'page_alias' => 'Page Alias', - 'lang_id' => 'Lang ID', - ]; - } - - public function getPage() - { - return $this->hasMany(Page::className(), ['page_id' => 'page_id']); + 'page_id' => Yii::t('field', 'page'), + 'title' => Yii::t('field', 'title'), + 'meta_title' => Yii::t('field', 'meta_title'), + 'meta_description' => Yii::t('field', 'meta_description'), + 'text' => Yii::t('field', 'text'), + 'page_alias' => Yii::t('field', 'page_alias'), + 'lang_id' => Yii::t('field', 'lang_id'), + ]; } } diff --git a/common/models/TerminLang.php b/common/models/TerminLang.php index 720e96b..9184b1e 100644 --- a/common/models/TerminLang.php +++ b/common/models/TerminLang.php @@ -29,7 +29,7 @@ class TerminLang extends \yii\db\ActiveRecord return [ //[['termin_id', 'lang_id'], 'required'], //[['termin_id', 'lang_id'], 'integer'], - [['termin_title'], 'string', 'max' => 256] + [['termin_title'], 'string'] ]; } @@ -39,9 +39,9 @@ class TerminLang extends \yii\db\ActiveRecord public function attributeLabels() { return [ - 'termin_id' => 'Termin ID', - 'termin_title' => 'Termin Title', - 'lang_id' => 'Lang ID', + 'termin_id' => 'Термин ID', + 'termin_title' => 'Название', + 'lang_id' => 'ID языка', ]; } } diff --git a/db-migration/artbox_db.sql b/db-migration/artbox_db.sql new file mode 100644 index 0000000..9999d73 --- /dev/null +++ b/db-migration/artbox_db.sql @@ -0,0 +1,440 @@ +-- phpMyAdmin SQL Dump +-- version 4.0.10.10 +-- http://www.phpmyadmin.net +-- +-- Хост: 127.0.0.1:3306 +-- Час створення: Лис 06 2015 р., 12:08 +-- Версія сервера: 5.5.45 +-- Версія PHP: 5.6.12 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- База даних: `artbox_db` +-- + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `feature` +-- + +CREATE TABLE IF NOT EXISTS `feature` ( + `feature_id` int(6) NOT NULL AUTO_INCREMENT, + `feature_pid` int(6) NOT NULL DEFAULT '0', + PRIMARY KEY (`feature_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `feature_lang` +-- + +CREATE TABLE IF NOT EXISTS `feature_lang` ( + `feature_id` int(6) NOT NULL, + `feature_title` varchar(256) DEFAULT NULL, + `feature_lang` int(2) NOT NULL, + PRIMARY KEY (`feature_id`,`feature_lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `image` +-- + +CREATE TABLE IF NOT EXISTS `image` ( + `image_id` int(6) NOT NULL AUTO_INCREMENT, + `image_name` int(11) NOT NULL, + `image_md5` int(11) NOT NULL, + PRIMARY KEY (`image_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `language` +-- + +CREATE TABLE IF NOT EXISTS `language` ( + `language_id` int(2) NOT NULL AUTO_INCREMENT, + `lang_code` varchar(4) NOT NULL, + `is_default` tinyint(1) NOT NULL, + PRIMARY KEY (`language_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; + +-- +-- Дамп даних таблиці `language` +-- + +INSERT INTO `language` (`language_id`, `lang_code`, `is_default`) VALUES +(1, 'uk', 1), +(2, 'ru', 0); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `language_lang` +-- + +CREATE TABLE IF NOT EXISTS `language_lang` ( + `language_id` int(2) NOT NULL, + `lang_title` varchar(256) NOT NULL, + `lang_id` int(2) NOT NULL, + UNIQUE KEY `language_id` (`language_id`,`lang_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Дамп даних таблиці `language_lang` +-- + +INSERT INTO `language_lang` (`language_id`, `lang_title`, `lang_id`) VALUES +(1, 'Українська мова', 1), +(2, 'Русский язык', 2); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `menu` +-- + +CREATE TABLE IF NOT EXISTS `menu` ( + `menu_id` int(6) NOT NULL AUTO_INCREMENT, + `menu_pid` int(6) NOT NULL, + `menu_lft` int(6) NOT NULL, + `menu_rgt` int(6) NOT NULL, + `termin_id` int(6) NOT NULL, + `show` tinyint(1) NOT NULL, + `sortorder` int(6) NOT NULL, + PRIMARY KEY (`menu_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Дамп даних таблиці `menu` +-- + +INSERT INTO `menu` (`menu_id`, `menu_pid`, `menu_lft`, `menu_rgt`, `termin_id`, `show`, `sortorder`) VALUES +(1, 0, 0, 0, 1, 1, 1); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `migration` +-- + +CREATE TABLE IF NOT EXISTS `migration` ( + `version` varchar(180) NOT NULL, + `apply_time` int(11) DEFAULT NULL, + PRIMARY KEY (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Дамп даних таблиці `migration` +-- + +INSERT INTO `migration` (`version`, `apply_time`) VALUES +('m000000_000000_base', 1446045946), +('m130524_201442_init', 1446045953), +('m140506_102106_rbac_init', 1446131385); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `page` +-- + +CREATE TABLE IF NOT EXISTS `page` ( + `page_id` int(6) NOT NULL AUTO_INCREMENT, + `date_add` datetime NOT NULL, + `template_id` int(6) NOT NULL, + `image_id` int(6) NOT NULL, + `show` tinyint(1) NOT NULL, + PRIMARY KEY (`page_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; + +-- +-- Дамп даних таблиці `page` +-- + +INSERT INTO `page` (`page_id`, `date_add`, `template_id`, `image_id`, `show`) VALUES +(1, '2015-11-03 00:00:00', 0, 0, 1), +(2, '2015-11-03 00:00:00', 0, 0, 1), +(3, '2015-11-03 00:00:00', 0, 0, 1); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `page_lang` +-- + +CREATE TABLE IF NOT EXISTS `page_lang` ( + `page_id` int(6) NOT NULL, + `title` varchar(256) NOT NULL, + `meta_title` varchar(512) NOT NULL, + `meta_description` varchar(512) NOT NULL, + `text` text NOT NULL, + `page_alias` varchar(256) NOT NULL, + `lang_id` int(2) NOT NULL, + PRIMARY KEY (`page_id`,`lang_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Дамп даних таблиці `page_lang` +-- + +INSERT INTO `page_lang` (`page_id`, `title`, `meta_title`, `meta_description`, `text`, `page_alias`, `lang_id`) VALUES +(1, 'Головна сторінка', 'Головна сторінка', 'Головна сторінка - Artbox', '', '/', 1), +(1, 'Главная страница', 'Главная страница', 'Главная страница - Artbox', '', '/ru/', 2), +(2, 'Магазин Meta Title', 'Магазин Meta Title', 'Магазин Meta Description', 'Магазин Text', 'shop', 1), +(3, 'Контент', 'Контент', 'Контент', 'Контент', 'content', 1); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `product` +-- + +CREATE TABLE IF NOT EXISTS `product` ( + `product_id` int(6) NOT NULL AUTO_INCREMENT, + `termin_id` int(6) NOT NULL, + `curency_id` int(6) NOT NULL, + `price` decimal(10,3) NOT NULL, + `show` tinyint(1) NOT NULL, + PRIMARY KEY (`product_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `product_category` +-- + +CREATE TABLE IF NOT EXISTS `product_category` ( + `product_id` int(6) NOT NULL, + `termin_id` int(6) NOT NULL, + PRIMARY KEY (`product_id`,`termin_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `product_tag` +-- + +CREATE TABLE IF NOT EXISTS `product_tag` ( + `product_id` int(6) NOT NULL, + `temin_id` int(6) NOT NULL, + PRIMARY KEY (`product_id`,`temin_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `termin` +-- + +CREATE TABLE IF NOT EXISTS `termin` ( + `termin_id` int(6) NOT NULL AUTO_INCREMENT, + `termin_type_id` int(2) NOT NULL, + `page_id` int(6) NOT NULL DEFAULT '0', + PRIMARY KEY (`termin_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=19 ; + +-- +-- Дамп даних таблиці `termin` +-- + +INSERT INTO `termin` (`termin_id`, `termin_type_id`, `page_id`) VALUES +(1, 5, 1), +(2, 0, 0), +(3, 0, 0), +(4, 0, 0), +(5, 0, 0), +(6, 0, 0), +(7, 0, 0), +(8, 0, 0), +(9, 0, 0), +(10, 0, 0), +(16, 0, 0), +(17, 0, 0), +(18, 0, 0); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `termin_lang` +-- + +CREATE TABLE IF NOT EXISTS `termin_lang` ( + `termin_id` int(6) NOT NULL, + `termin_title` varchar(256) DEFAULT NULL, + `lang_id` int(2) NOT NULL, + PRIMARY KEY (`termin_id`,`lang_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Дамп даних таблиці `termin_lang` +-- + +INSERT INTO `termin_lang` (`termin_id`, `termin_title`, `lang_id`) VALUES +(1, 'Головна', 1), +(2, 'Завод', 1), +(3, 'BMW', 1), +(4, 'Mini', 1), +(5, 'Года (1996-2000)', 1), +(6, 'Кузов', 1), +(7, 'Модель', 1), +(8, 'Серия', 1), +(9, 'Мотор (тип)', 1), +(10, 'Мотор (обьем)', 1), +(16, '1996', 1), +(17, 'X5', 1), +(18, 'Новости', 0); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `termin_option` +-- + +CREATE TABLE IF NOT EXISTS `termin_option` ( + `termin_id` int(6) NOT NULL, + `termin_pid` int(6) NOT NULL, + `level` int(6) NOT NULL, + `lft` int(6) NOT NULL, + `rgt` int(6) NOT NULL, + `sortorder` int(6) NOT NULL, + PRIMARY KEY (`termin_id`,`termin_pid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Дамп даних таблиці `termin_option` +-- + +INSERT INTO `termin_option` (`termin_id`, `termin_pid`, `level`, `lft`, `rgt`, `sortorder`) VALUES +(1, 0, 0, 1, 2, 1), +(2, 0, 1, 3, 32, 2), +(3, 2, 2, 4, 17, 1), +(4, 2, 2, 18, 31, 2), +(5, 0, 1, 33, 38, 3), +(6, 3, 2, 19, 20, 1), +(6, 4, 2, 19, 20, 1), +(7, 3, 3, 21, 24, 2), +(7, 4, 3, 21, 24, 2), +(8, 3, 2, 25, 26, 3), +(8, 4, 2, 25, 26, 3), +(9, 3, 2, 27, 28, 4), +(9, 4, 2, 27, 28, 4), +(10, 3, 2, 29, 30, 5), +(10, 4, 2, 29, 30, 5), +(16, 5, 2, 34, 37, 4), +(17, 7, 2, 35, 36, 0), +(17, 16, 2, 35, 36, 0), +(18, 1, 0, 0, 0, 0); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `termin_relation` +-- + +CREATE TABLE IF NOT EXISTS `termin_relation` ( + `termin_id` int(6) NOT NULL, + `termin_relation_id` int(6) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `termin_type` +-- + +CREATE TABLE IF NOT EXISTS `termin_type` ( + `termin_type_id` int(2) NOT NULL AUTO_INCREMENT, + `termin_type_name` varchar(56) NOT NULL, + PRIMARY KEY (`termin_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ; + +-- +-- Дамп даних таблиці `termin_type` +-- + +INSERT INTO `termin_type` (`termin_type_id`, `termin_type_name`) VALUES +(1, 'tag'), +(2, 'news'), +(3, 'article'), +(4, 'category'), +(5, 'page'); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `termin_type_lang` +-- + +CREATE TABLE IF NOT EXISTS `termin_type_lang` ( + `termin_type_id` int(2) NOT NULL, + `termin_type_title` varchar(56) NOT NULL, + `lang_id` int(2) NOT NULL, + PRIMARY KEY (`termin_type_id`,`lang_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Дамп даних таблиці `termin_type_lang` +-- + +INSERT INTO `termin_type_lang` (`termin_type_id`, `termin_type_title`, `lang_id`) VALUES +(1, 'Тег', 1), +(1, 'Тег', 2), +(2, 'Новини', 1), +(2, 'Новости', 2), +(3, 'Статья', 1), +(3, 'Статья', 2), +(4, 'Категорія', 1), +(4, 'Категория', 2), +(5, 'Сторінка', 1), +(5, 'Страница', 2); + +-- -------------------------------------------------------- + +-- +-- Структура таблиці `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `lastname` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `firstname` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `middlename` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` smallint(6) NOT NULL DEFAULT '10', + `created_at` int(11) NOT NULL, + `updated_at` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`), + UNIQUE KEY `username` (`username`), + UNIQUE KEY `password_reset_token` (`password_reset_token`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Дамп даних таблиці `user` +-- + +INSERT INTO `user` (`id`, `username`, `lastname`, `firstname`, `middlename`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES +(1, 'zlodeyev', 'Андреев', 'Владимир', 'Сергійович', 'VgTs2skfY1Uf3YERn1OR3E2V_Hm0KZwF', '$2y$13$jOtOdIQUU2.ZyEkxN9TJjuhfS7Q3p2K/KqGWNyBab07OaQUsJ5nSi', NULL, 'volodymyr.andryeyev@gmail.com', 10, 1446046164, 1446538181); + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/left.php b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/left.php index 4a62a5d..2042818 100644 --- a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/left.php +++ b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/left.php @@ -30,10 +30,9 @@ [ 'options' => ['class' => 'sidebar-menu'], 'items' => [ - ['label' => 'Page', 'icon' => 'fa fa-file-code-o', 'url' => ['/page/']], - ['label' => 'Termin', 'icon' => 'fa fa-file-code-o', 'url' => ['/termin/']], - ['label' => 'Termin Lang', 'icon' => 'fa fa-file-code-o', 'url' => ['/termin_lang/']], - ['label' => 'Menu', 'icon' => 'fa fa-file-code-o', 'url' => ['/menu/']], + ['label' => 'Страница', 'icon' => 'fa fa-file-code-o', 'url' => ['/page/']], + ['label' => 'Термин', 'icon' => 'fa fa-file-code-o', 'url' => ['/termin_lang/']], + ['label' => 'Меню', 'icon' => 'fa fa-file-code-o', 'url' => ['/menu/']], ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']], ['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug']], ['label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest], diff --git a/vendor/yiisoft/yii2/base/Application.php b/vendor/yiisoft/yii2/base/Application.php index cdcb577..58dcd2e 100644 --- a/vendor/yiisoft/yii2/base/Application.php +++ b/vendor/yiisoft/yii2/base/Application.php @@ -109,6 +109,12 @@ abstract class Application extends Module * @see sourceLanguage */ public $language = 'en-US'; + + /** + * @var int - текущий язык + */ + public $lang_id = 1; + /** * @var string the language that the application is written in. This mainly refers to * the language that the messages and view files are written in. -- libgit2 0.21.4