Commit 7c9d9ca1c55f8cd46c74a9f2ce9662a52d0e9fec

Authored by andryeyev
1 parent f9570cf9

Передел после совещания

common/models/Menu.php
... ... @@ -31,7 +31,7 @@ class Menu extends \yii\db\ActiveRecord
31 31 INNER JOIN `termin` ON `termin`.termin_id = `menu`.termin_id
32 32 INNER JOIN `termin_lang` ON `termin_lang`.termin_id = `menu`.termin_id
33 33 AND `termin_lang`.lang_id = '.yii::$app->lang_id.'
34   - INNER JOIN `template` ON `template`.template_id = `termin`.template_id
  34 + INNER JOIN `template` ON `template`.template_id = `termin_lang`.template_id
35 35 ORDER BY `menu`.level ASC, `menu`.sortorder ASC
36 36 ')->queryAll();
37 37 /*
... ...
common/models/Page.php
... ... @@ -107,15 +107,15 @@ class Page extends \yii\db\ActiveRecord
107 107 {
108 108 return yii::$app->db->createCommand('
109 109 SELECT
110   - `termin`.show, `termin`.termin_id, `termin`.page_id,
111   - `controller`.controller_name,
  110 + `termin`.termin_id, `termin`.page_id,
  111 + `page`.show,
112 112 `template`.template_file
113   - FROM `termin`
  113 + FROM `termin`
114 114 INNER JOIN `termin_lang` ON `termin_lang`.termin_id = `termin`.termin_id
115 115 AND `termin_lang`.lang_id = '.yii::$app->lang_id.'
116 116 AND `termin_lang`.termin_alias = "'.$url.'"
117   - INNER JOIN `template` ON `template`.template_id = `termin`.template_id
118   - INNER JOIN `controller` ON `controller`.controller_id = `template`.controller_id
  117 + INNER JOIN `page` ON `page`.page_id = `termin`.page_id
  118 + INNER JOIN `template` ON `template`.template_id = `termin_lang`.template_id
119 119 ')->queryOne();
120 120 }
121 121  
... ...
db-migration/artbox_db.sql
... ... @@ -3,7 +3,7 @@
3 3 -- http://www.phpmyadmin.net
4 4 --
5 5 -- Хост: 127.0.0.1:3306
6   --- Час створення: Лис 12 2015 р., 13:59
  6 +-- Час створення: Лис 12 2015 р., 22:57
7 7 -- Версія сервера: 5.5.45
8 8 -- Версія PHP: 5.6.12
9 9  
... ... @@ -23,54 +23,6 @@ SET time_zone = "+00:00";
23 23 -- --------------------------------------------------------
24 24  
25 25 --
26   --- Структура таблиці `controller`
27   ---
28   -
29   -CREATE TABLE IF NOT EXISTS `controller` (
30   - `controller_id` int(3) NOT NULL AUTO_INCREMENT,
31   - `controller_name` varchar(50) NOT NULL,
32   - PRIMARY KEY (`controller_id`)
33   -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
34   -
35   ---
36   --- Дамп даних таблиці `controller`
37   ---
38   -
39   -INSERT INTO `controller` (`controller_id`, `controller_name`) VALUES
40   -(1, 'Page'),
41   -(2, 'Home'),
42   -(3, 'Catlog'),
43   -(4, 'News'),
44   -(5, 'Filter');
45   -
46   --- --------------------------------------------------------
47   -
48   ---
49   --- Структура таблиці `feature`
50   ---
51   -
52   -CREATE TABLE IF NOT EXISTS `feature` (
53   - `feature_id` int(6) NOT NULL AUTO_INCREMENT,
54   - `feature_pid` int(6) NOT NULL DEFAULT '0',
55   - PRIMARY KEY (`feature_id`)
56   -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
57   -
58   --- --------------------------------------------------------
59   -
60   ---
61   --- Структура таблиці `feature_lang`
62   ---
63   -
64   -CREATE TABLE IF NOT EXISTS `feature_lang` (
65   - `feature_id` int(6) NOT NULL,
66   - `feature_title` varchar(256) DEFAULT NULL,
67   - `feature_lang` int(2) NOT NULL,
68   - PRIMARY KEY (`feature_id`,`feature_lang`)
69   -) ENGINE=InnoDB DEFAULT CHARSET=utf8;
70   -
71   --- --------------------------------------------------------
72   -
73   ---
74 26 -- Структура таблиці `image`
75 27 --
76 28  
... ... @@ -135,8 +87,11 @@ CREATE TABLE IF NOT EXISTS `menu` (
135 87 `level` int(6) NOT NULL,
136 88 `termin_id` int(6) NOT NULL,
137 89 `show` tinyint(1) NOT NULL,
  90 + `is_open` tinyint(1) NOT NULL,
138 91 `menu_location_id` int(6) NOT NULL,
139 92 `sortorder` int(6) NOT NULL,
  93 + `name` varchar(50) DEFAULT NULL,
  94 + `url` varchar(256) DEFAULT NULL,
140 95 PRIMARY KEY (`menu_id`),
141 96 KEY `show` (`show`),
142 97 KEY `sortorder` (`sortorder`),
... ... @@ -147,19 +102,19 @@ CREATE TABLE IF NOT EXISTS `menu` (
147 102 -- Дамп даних таблиці `menu`
148 103 --
149 104  
150   -INSERT INTO `menu` (`menu_id`, `menu_pid`, `level`, `termin_id`, `show`, `menu_location_id`, `sortorder`) VALUES
151   -(1, 0, 0, 2, 1, 1, 12),
152   -(2, 1, 1, 3, 1, 1, 1),
153   -(3, 1, 1, 4, 1, 1, 1),
154   -(4, 0, 0, 5, 1, 1, 1),
155   -(5, 1, 1, 6, 1, 1, 1),
156   -(6, 1, 1, 7, 1, 1, 1),
157   -(7, 0, 0, 8, 1, 1, 1),
158   -(8, 0, 0, 9, 1, 1, 1),
159   -(9, 0, 0, 10, 1, 1, 1),
160   -(10, 0, 0, 11, 1, 1, 1),
161   -(11, 0, 0, 12, 1, 1, 1),
162   -(12, 0, 0, 13, 1, 1, 1);
  105 +INSERT INTO `menu` (`menu_id`, `menu_pid`, `level`, `termin_id`, `show`, `is_open`, `menu_location_id`, `sortorder`, `name`, `url`) VALUES
  106 +(1, 0, 0, 2, 1, 0, 1, 12, NULL, NULL),
  107 +(2, 1, 1, 3, 1, 0, 1, 1, NULL, NULL),
  108 +(3, 1, 1, 4, 1, 0, 1, 1, NULL, NULL),
  109 +(4, 0, 0, 5, 1, 0, 1, 1, NULL, NULL),
  110 +(5, 1, 1, 6, 1, 0, 1, 1, NULL, NULL),
  111 +(6, 1, 1, 7, 1, 0, 1, 1, NULL, NULL),
  112 +(7, 0, 0, 8, 1, 0, 1, 1, NULL, NULL),
  113 +(8, 0, 0, 9, 1, 0, 1, 1, NULL, NULL),
  114 +(9, 0, 0, 10, 1, 0, 1, 1, NULL, NULL),
  115 +(10, 0, 0, 11, 1, 0, 1, 1, NULL, NULL),
  116 +(11, 0, 0, 12, 1, 0, 1, 1, NULL, NULL),
  117 +(12, 0, 0, 13, 1, 0, 1, 1, NULL, NULL);
163 118  
164 119 -- --------------------------------------------------------
165 120  
... ... @@ -228,6 +183,85 @@ INSERT INTO `migration` (`version`, `apply_time`) VALUES
228 183 -- --------------------------------------------------------
229 184  
230 185 --
  186 +-- Структура таблиці `module`
  187 +--
  188 +
  189 +CREATE TABLE IF NOT EXISTS `module` (
  190 + `module_id` int(6) NOT NULL AUTO_INCREMENT,
  191 + `module_name` varchar(50) DEFAULT NULL,
  192 + `module_version` varchar(10) DEFAULT NULL,
  193 + PRIMARY KEY (`module_id`)
  194 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
  195 +
  196 +--
  197 +-- Дамп даних таблиці `module`
  198 +--
  199 +
  200 +INSERT INTO `module` (`module_id`, `module_name`, `module_version`) VALUES
  201 +(1, 'Menu', '1.0');
  202 +
  203 +-- --------------------------------------------------------
  204 +
  205 +--
  206 +-- Структура таблиці `module_function`
  207 +--
  208 +
  209 +CREATE TABLE IF NOT EXISTS `module_function` (
  210 + `module_function_id` int(6) NOT NULL AUTO_INCREMENT,
  211 + `module_function_name` varchar(50) DEFAULT NULL,
  212 + PRIMARY KEY (`module_function_id`)
  213 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
  214 +
  215 +--
  216 +-- Дамп даних таблиці `module_function`
  217 +--
  218 +
  219 +INSERT INTO `module_function` (`module_function_id`, `module_function_name`) VALUES
  220 +(1, 'display');
  221 +
  222 +-- --------------------------------------------------------
  223 +
  224 +--
  225 +-- Структура таблиці `module_function_lang`
  226 +--
  227 +
  228 +CREATE TABLE IF NOT EXISTS `module_function_lang` (
  229 + `module_function_id` int(6) NOT NULL,
  230 + `module_function_title` varchar(50) NOT NULL,
  231 + `lang_id` int(2) NOT NULL,
  232 + PRIMARY KEY (`module_function_id`,`lang_id`)
  233 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  234 +
  235 +--
  236 +-- Дамп даних таблиці `module_function_lang`
  237 +--
  238 +
  239 +INSERT INTO `module_function_lang` (`module_function_id`, `module_function_title`, `lang_id`) VALUES
  240 +(1, 'Показать меню', 2);
  241 +
  242 +-- --------------------------------------------------------
  243 +
  244 +--
  245 +-- Структура таблиці `module_lang`
  246 +--
  247 +
  248 +CREATE TABLE IF NOT EXISTS `module_lang` (
  249 + `module_id` int(6) NOT NULL,
  250 + `module_title` varchar(50) NOT NULL,
  251 + `lang_id` int(1) NOT NULL,
  252 + PRIMARY KEY (`module_id`,`lang_id`)
  253 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  254 +
  255 +--
  256 +-- Дамп даних таблиці `module_lang`
  257 +--
  258 +
  259 +INSERT INTO `module_lang` (`module_id`, `module_title`, `lang_id`) VALUES
  260 +(1, 'Меню', 1);
  261 +
  262 +-- --------------------------------------------------------
  263 +
  264 +--
231 265 -- Структура таблиці `page`
232 266 --
233 267  
... ... @@ -294,52 +328,12 @@ INSERT INTO `page_lang` (`page_id`, `meta_title`, `meta_description`, `text`, `l
294 328 -- --------------------------------------------------------
295 329  
296 330 --
297   --- Структура таблиці `product`
298   ---
299   -
300   -CREATE TABLE IF NOT EXISTS `product` (
301   - `product_id` int(6) NOT NULL AUTO_INCREMENT,
302   - `termin_id` int(6) NOT NULL,
303   - `curency_id` int(6) NOT NULL,
304   - `price` decimal(10,3) NOT NULL,
305   - `show` tinyint(1) NOT NULL,
306   - PRIMARY KEY (`product_id`)
307   -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
308   -
309   --- --------------------------------------------------------
310   -
311   ---
312   --- Структура таблиці `product_category`
313   ---
314   -
315   -CREATE TABLE IF NOT EXISTS `product_category` (
316   - `product_id` int(6) NOT NULL,
317   - `termin_id` int(6) NOT NULL,
318   - PRIMARY KEY (`product_id`,`termin_id`)
319   -) ENGINE=InnoDB DEFAULT CHARSET=utf8;
320   -
321   --- --------------------------------------------------------
322   -
323   ---
324   --- Структура таблиці `product_tag`
325   ---
326   -
327   -CREATE TABLE IF NOT EXISTS `product_tag` (
328   - `product_id` int(6) NOT NULL,
329   - `temin_id` int(6) NOT NULL,
330   - PRIMARY KEY (`product_id`,`temin_id`)
331   -) ENGINE=InnoDB DEFAULT CHARSET=utf8;
332   -
333   --- --------------------------------------------------------
334   -
335   ---
336 331 -- Структура таблиці `template`
337 332 --
338 333  
339 334 CREATE TABLE IF NOT EXISTS `template` (
340 335 `template_id` int(3) NOT NULL AUTO_INCREMENT,
341   - `controller_id` int(3) NOT NULL,
342   - `template_name` varchar(50) NOT NULL,
  336 + `template_alias` varchar(50) NOT NULL,
343 337 `template_file` varchar(50) NOT NULL,
344 338 PRIMARY KEY (`template_id`)
345 339 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
... ... @@ -348,12 +342,12 @@ CREATE TABLE IF NOT EXISTS `template` (
348 342 -- Дамп даних таблиці `template`
349 343 --
350 344  
351   -INSERT INTO `template` (`template_id`, `controller_id`, `template_name`, `template_file`) VALUES
352   -(1, 1, 'page', 'page/page'),
353   -(2, 2, 'home', 'page/home'),
354   -(3, 3, 'catalog', 'shop/catalog'),
355   -(4, 5, 'filter', 'shop/filter'),
356   -(5, 4, 'news', 'news/all');
  345 +INSERT INTO `template` (`template_id`, `template_alias`, `template_file`) VALUES
  346 +(1, 'page', 'page/page'),
  347 +(2, 'home', 'page/home'),
  348 +(3, 'catalog', 'shop/catalog'),
  349 +(4, 'filter', 'shop/filter'),
  350 +(5, 'news', 'news/all');
357 351  
358 352 -- --------------------------------------------------------
359 353  
... ... @@ -387,33 +381,36 @@ INSERT INTO `template_lang` (`template_id`, `template_title`, `lang_id`) VALUES
387 381  
388 382 CREATE TABLE IF NOT EXISTS `termin` (
389 383 `termin_id` int(6) NOT NULL AUTO_INCREMENT,
390   - `template_id` int(6) NOT NULL,
  384 + `termin_pid` int(11) NOT NULL,
  385 + `is_default` int(1) NOT NULL,
391 386 `page_id` int(6) NOT NULL,
392   - `show` tinyint(1) NOT NULL,
393 387 PRIMARY KEY (`termin_id`)
394   -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ;
  388 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=20 ;
395 389  
396 390 --
397 391 -- Дамп даних таблиці `termin`
398 392 --
399 393  
400   -INSERT INTO `termin` (`termin_id`, `template_id`, `page_id`, `show`) VALUES
401   -(1, 2, 1, 1),
402   -(2, 1, 2, 1),
403   -(3, 1, 3, 1),
404   -(4, 1, 4, 1),
405   -(5, 1, 5, 1),
406   -(6, 1, 6, 1),
407   -(7, 1, 7, 1),
408   -(8, 1, 8, 1),
409   -(9, 1, 9, 1),
410   -(10, 1, 10, 1),
411   -(11, 1, 11, 1),
412   -(12, 1, 12, 1),
413   -(13, 1, 13, 1),
414   -(14, 1, 14, 1),
415   -(15, 1, 15, 1),
416   -(16, 1, 16, 1);
  394 +INSERT INTO `termin` (`termin_id`, `termin_pid`, `is_default`, `page_id`) VALUES
  395 +(1, 0, 0, 1),
  396 +(2, 0, 0, 2),
  397 +(3, 0, 0, 3),
  398 +(4, 0, 0, 4),
  399 +(5, 0, 0, 5),
  400 +(6, 0, 0, 6),
  401 +(7, 0, 0, 7),
  402 +(8, 0, 0, 8),
  403 +(9, 0, 0, 9),
  404 +(10, 0, 0, 10),
  405 +(11, 0, 0, 11),
  406 +(12, 0, 0, 12),
  407 +(13, 0, 0, 13),
  408 +(14, 0, 0, 14),
  409 +(15, 0, 0, 15),
  410 +(16, 0, 0, 16),
  411 +(17, 0, 0, 0),
  412 +(18, 0, 0, 0),
  413 +(19, 0, 0, 0);
417 414  
418 415 -- --------------------------------------------------------
419 416  
... ... @@ -423,33 +420,38 @@ INSERT INTO `termin` (`termin_id`, `template_id`, `page_id`, `show`) VALUES
423 420  
424 421 CREATE TABLE IF NOT EXISTS `termin_lang` (
425 422 `termin_id` int(6) NOT NULL,
  423 + `template_id` int(6) NOT NULL,
426 424 `termin_alias` varchar(50) NOT NULL,
427 425 `termin_title` varchar(256) DEFAULT NULL,
428 426 `lang_id` int(2) NOT NULL,
429   - PRIMARY KEY (`termin_id`,`lang_id`)
  427 + PRIMARY KEY (`termin_id`,`lang_id`),
  428 + UNIQUE KEY `termin_id` (`termin_id`)
430 429 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
431 430  
432 431 --
433 432 -- Дамп даних таблиці `termin_lang`
434 433 --
435 434  
436   -INSERT INTO `termin_lang` (`termin_id`, `termin_alias`, `termin_title`, `lang_id`) VALUES
437   -(1, '/', 'Главная страница', 2),
438   -(2, 'about', 'О компании', 2),
439   -(3, 'use', 'Условия использования', 2),
440   -(4, 'corporation', 'Условия сотрудничества', 2),
441   -(5, 'contacts', 'Контакты', 2),
442   -(6, 'shops', 'Магазины', 2),
443   -(7, 'vendors', 'Поставщики', 2),
444   -(8, 'catalog', 'Каталог товаров', 2),
445   -(9, 'payment', 'Оплата', 2),
446   -(10, 'delivery', 'Доставка', 2),
447   -(11, 'warranty', 'Гарантия', 2),
448   -(12, 'promotion', 'Акции ', 2),
449   -(13, 'news', 'Материалы/блог', 2),
450   -(14, 'arbuz', 'Арбуз', 2),
451   -(15, 'artishok', 'Артишок', 2),
452   -(16, 'baklazhan', 'Баклажан', 2);
  435 +INSERT INTO `termin_lang` (`termin_id`, `template_id`, `termin_alias`, `termin_title`, `lang_id`) VALUES
  436 +(1, 2, '/', 'Главная страница', 2),
  437 +(2, 1, 'about', 'О компании', 2),
  438 +(3, 1, 'use', 'Условия использования', 2),
  439 +(4, 1, 'corporation', 'Условия сотрудничества', 2),
  440 +(5, 1, 'contacts', 'Контакты', 2),
  441 +(6, 1, 'shops', 'Магазины', 2),
  442 +(7, 1, 'vendors', 'Поставщики', 2),
  443 +(8, 1, 'catalog', 'Каталог товаров', 2),
  444 +(9, 1, 'payment', 'Оплата', 2),
  445 +(10, 1, 'delivery', 'Доставка', 2),
  446 +(11, 1, 'warranty', 'Гарантия', 2),
  447 +(12, 1, 'promotion', 'Акции ', 2),
  448 +(13, 1, 'news', 'Материалы/блог', 2),
  449 +(14, 1, 'arbuz', 'Арбуз', 2),
  450 +(15, 1, 'artishok', 'Артишок', 2),
  451 +(16, 1, 'baklazhan', 'Баклажан', 2),
  452 +(17, 1, 'login', 'Авторизация', 2),
  453 +(18, 1, 'logout', 'Выход', 2),
  454 +(19, 1, 'signup', 'Регистрация', 2);
453 455  
454 456 -- --------------------------------------------------------
455 457  
... ... @@ -460,8 +462,6 @@ INSERT INTO `termin_lang` (`termin_id`, `termin_alias`, `termin_title`, `lang_id
460 462 CREATE TABLE IF NOT EXISTS `termin_relation` (
461 463 `termin_id_1` int(6) NOT NULL,
462 464 `termin_id_2` int(6) NOT NULL,
463   - `parent` int(6) NOT NULL,
464   - `is_default` tinyint(1) NOT NULL,
465 465 PRIMARY KEY (`termin_id_1`,`termin_id_2`)
466 466 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
467 467  
... ... @@ -469,23 +469,23 @@ CREATE TABLE IF NOT EXISTS `termin_relation` (
469 469 -- Дамп даних таблиці `termin_relation`
470 470 --
471 471  
472   -INSERT INTO `termin_relation` (`termin_id_1`, `termin_id_2`, `parent`, `is_default`) VALUES
473   -(1, 0, 0, 0),
474   -(2, 0, 0, 0),
475   -(3, 0, 0, 0),
476   -(4, 0, 0, 0),
477   -(5, 0, 0, 0),
478   -(6, 0, 0, 0),
479   -(7, 0, 0, 0),
480   -(8, 0, 0, 0),
481   -(9, 0, 0, 0),
482   -(10, 0, 0, 0),
483   -(11, 0, 0, 0),
484   -(12, 0, 0, 0),
485   -(13, 0, 0, 0),
486   -(14, 0, 0, 0),
487   -(15, 0, 0, 0),
488   -(16, 0, 0, 0);
  472 +INSERT INTO `termin_relation` (`termin_id_1`, `termin_id_2`) VALUES
  473 +(1, 0),
  474 +(2, 0),
  475 +(3, 0),
  476 +(4, 0),
  477 +(5, 0),
  478 +(6, 0),
  479 +(7, 0),
  480 +(8, 0),
  481 +(9, 0),
  482 +(10, 0),
  483 +(11, 0),
  484 +(12, 0),
  485 +(13, 0),
  486 +(14, 0),
  487 +(15, 0),
  488 +(16, 0);
489 489  
490 490 -- --------------------------------------------------------
491 491  
... ... @@ -542,27 +542,42 @@ INSERT INTO `termin_type_lang` (`termin_type_id`, `termin_type_title`, `lang_id`
542 542 -- --------------------------------------------------------
543 543  
544 544 --
545   --- Структура таблиці `translate`
  545 +-- Структура таблиці `translation`
546 546 --
547 547  
548   -CREATE TABLE IF NOT EXISTS `translate` (
549   - `translate_id` int(6) NOT NULL AUTO_INCREMENT,
550   - `translate_key` varchar(20) NOT NULL,
551   - PRIMARY KEY (`translate_id`),
552   - UNIQUE KEY `translate_key` (`translate_key`)
  548 +CREATE TABLE IF NOT EXISTS `translation` (
  549 + `translation_id` int(6) NOT NULL AUTO_INCREMENT,
  550 + `translation_pid` int(6) DEFAULT NULL,
  551 + `translation_key` varchar(200) NOT NULL,
  552 + `is_translation` tinyint(1) NOT NULL DEFAULT '0',
  553 + PRIMARY KEY (`translation_id`),
  554 + KEY `Индекс 2` (`translation_pid`)
553 555 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
554 556  
555 557 -- --------------------------------------------------------
556 558  
557 559 --
558   --- Структура таблиці `translate_lang`
  560 +-- Структура таблиці `translation_option`
559 561 --
560 562  
561   -CREATE TABLE IF NOT EXISTS `translate_lang` (
562   - `translate_id` int(6) NOT NULL,
563   - `translate_value` varchar(3000) NOT NULL,
564   - `lang_id` int(2) NOT NULL,
565   - PRIMARY KEY (`translate_id`,`lang_id`)
  563 +CREATE TABLE IF NOT EXISTS `translation_option` (
  564 + `translation_value_id` int(6) NOT NULL AUTO_INCREMENT,
  565 + `translation_id` int(6) NOT NULL,
  566 + PRIMARY KEY (`translation_value_id`),
  567 + KEY `Индекс 2` (`translation_id`)
  568 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  569 +
  570 +-- --------------------------------------------------------
  571 +
  572 +--
  573 +-- Структура таблиці `translation_value`
  574 +--
  575 +
  576 +CREATE TABLE IF NOT EXISTS `translation_value` (
  577 + `translation_value_id` int(6) NOT NULL,
  578 + `translation_value` text NOT NULL,
  579 + `lang_id` int(2) NOT NULL DEFAULT '0',
  580 + PRIMARY KEY (`translation_value_id`,`lang_id`)
566 581 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
567 582  
568 583 -- --------------------------------------------------------
... ... @@ -597,6 +612,22 @@ CREATE TABLE IF NOT EXISTS `user` (
597 612 INSERT INTO `user` (`id`, `username`, `lastname`, `firstname`, `middlename`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES
598 613 (1, 'zlodeyev', 'Андреев', 'Владимир', 'Сергійович', 'VgTs2skfY1Uf3YERn1OR3E2V_Hm0KZwF', '$2y$13$jOtOdIQUU2.ZyEkxN9TJjuhfS7Q3p2K/KqGWNyBab07OaQUsJ5nSi', NULL, 'volodymyr.andryeyev@gmail.com', 10, 1446046164, 1446538181);
599 614  
  615 +--
  616 +-- Обмеження зовнішнього ключа збережених таблиць
  617 +--
  618 +
  619 +--
  620 +-- Обмеження зовнішнього ключа таблиці `translation_option`
  621 +--
  622 +ALTER TABLE `translation_option`
  623 + ADD CONSTRAINT `translation_id` FOREIGN KEY (`translation_id`) REFERENCES `translation` (`translation_id`);
  624 +
  625 +--
  626 +-- Обмеження зовнішнього ключа таблиці `translation_value`
  627 +--
  628 +ALTER TABLE `translation_value`
  629 + ADD CONSTRAINT `translation_value_id` FOREIGN KEY (`translation_value_id`) REFERENCES `translation_option` (`translation_value_id`);
  630 +
600 631 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
601 632 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
602 633 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
... ...
frontend/controllers/PageController.php
... ... @@ -18,16 +18,22 @@ class PageController extends Controller
18 18 public function actionPage($controller_name, $page_id, $template_file)
19 19 {
20 20 // страница
21   - $page = Page::getPageById ($page_id);
22   -
23   - // meta_title
24   - Yii::$app->view->title = $page['meta_title'];
  21 + if ($page = Page::getPageById ($page_id))
  22 + {
  23 + // meta_title
  24 + Yii::$app->view->title = $page['meta_title'];
25 25  
26   - // meta_desc
27   - Yii::$app->view->registerMetaTag([
28   - 'name' => 'description',
29   - 'content' => $page['meta_description'],
30   - ]);
  26 + // meta_desc
  27 + Yii::$app->view->registerMetaTag([
  28 + 'name' => 'description',
  29 + 'content' => $page['meta_description'],
  30 + ]);
  31 + }
  32 + else
  33 + {
  34 + echo '404';
  35 + die;
  36 + }
31 37  
32 38 return $this->render($controller_name, $page);
33 39 }
... ...
frontend/controllers/SiteController.php
... ... @@ -94,9 +94,12 @@ class SiteController extends Controller
94 94 'maгаз' => 'shop/categoty',
95 95 ];
96 96 */
  97 +
  98 + list ($controller) = explode ('/', $page['template_file']);
  99 +
97 100 // подключаем
98 101 return Yii::$app->runAction($page['template_file'], [
99   - 'controller_name' => $page['controller_name'],
  102 + 'controller_name' => $controller,
100 103 'page_id' => $page['page_id'],
101 104 'template_file' => $page['template_file'],
102 105 ]);
... ... @@ -105,13 +108,18 @@ class SiteController extends Controller
105 108  
106 109 return $this->render('index');
107 110 }
  111 +
  112 + /**
  113 + * ===================
  114 + * ==== BASIC YII ====
  115 + * ===================
  116 + */
108 117  
109 118 /**
110 119 * Logs in a user.
111 120 *
112 121 * @return mixed
113 122 */
114   -/*
115 123 public function actionLogin()
116 124 {
117 125 if (!\Yii::$app->user->isGuest) {
... ... @@ -127,26 +135,24 @@ class SiteController extends Controller
127 135 ]);
128 136 }
129 137 }
130   -*/
  138 +
131 139 /**
132 140 * Logs out the current user.
133 141 *
134 142 * @return mixed
135 143 */
136   -/*
137 144 public function actionLogout()
138 145 {
139 146 Yii::$app->user->logout();
140 147  
141 148 return $this->goHome();
142 149 }
143   -*/
  150 +
144 151 /**
145 152 * Displays contact page.
146 153 *
147 154 * @return mixed
148 155 */
149   -/*
150 156 public function actionContact()
151 157 {
152 158 $model = new ContactForm();
... ... @@ -164,14 +170,12 @@ class SiteController extends Controller
164 170 ]);
165 171 }
166 172 }
167   -*/
168 173  
169 174 /**
170 175 * Signs user up.
171 176 *
172 177 * @return mixed
173 178 */
174   -/*
175 179 public function actionSignup()
176 180 {
177 181 $model = new SignupForm();
... ... @@ -187,14 +191,12 @@ class SiteController extends Controller
187 191 'model' => $model,
188 192 ]);
189 193 }
190   -*/
191 194  
192 195 /**
193 196 * Requests password reset.
194 197 *
195 198 * @return mixed
196   - */
197   -/*
  199 + */
198 200 public function actionRequestPasswordReset()
199 201 {
200 202 $model = new PasswordResetRequestForm();
... ... @@ -212,7 +214,6 @@ class SiteController extends Controller
212 214 'model' => $model,
213 215 ]);
214 216 }
215   -*/
216 217  
217 218 /**
218 219 * Resets password.
... ... @@ -221,7 +222,6 @@ class SiteController extends Controller
221 222 * @return mixed
222 223 * @throws BadRequestHttpException
223 224 */
224   -/*
225 225 public function actionResetPassword($token)
226 226 {
227 227 try {
... ... @@ -240,5 +240,4 @@ class SiteController extends Controller
240 240 'model' => $model,
241 241 ]);
242 242 }
243   -*/
244 243 }
... ...
frontend/views/site-del/error.php deleted
1   -<?php
2   -
3   -/* @var $this yii\web\View */
4   -/* @var $name string */
5   -/* @var $message string */
6   -/* @var $exception Exception */
7   -
8   -use yii\helpers\Html;
9   -
10   -$this->title = $name;
11   -?>
12   -<div class="site-error">
13   -
14   - <h1><?= Html::encode($this->title) ?></h1>
15   -
16   - <div class="alert alert-danger">
17   - <?= nl2br(Html::encode($message)) ?>
18   - </div>
19   -
20   - <p>
21   - The above error occurred while the Web server was processing your request.
22   - </p>
23   - <p>
24   - Please contact us if you think this is a server error. Thank you.
25   - </p>
26   -
27   -</div>
frontend/views/site-del/index.php deleted
1   -<?php
2   -
3   -/* @var $this yii\web\View */
4   -
5   -$this->title = 'My Yii Application';
6   -?>
7   -<div class="site-index">
8   -
9   - <div class="jumbotron">
10   - <h1>Congratulations!</h1>
11   -
12   - <p class="lead">You have successfully created your Yii-powered application.</p>
13   -
14   - <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
15   - </div>
16   -
17   - <div class="body-content">
18   -
19   - <div class="row">
20   - <div class="col-lg-4">
21   - <h2>Heading</h2>
22   -
23   - <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
24   - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
25   - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
26   - fugiat nulla pariatur.</p>
27   -
28   - <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation &raquo;</a></p>
29   - </div>
30   - <div class="col-lg-4">
31   - <h2>Heading</h2>
32   -
33   - <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
34   - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
35   - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
36   - fugiat nulla pariatur.</p>
37   -
38   - <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
39   - </div>
40   - <div class="col-lg-4">
41   - <h2>Heading</h2>
42   -
43   - <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
44   - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
45   - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
46   - fugiat nulla pariatur.</p>
47   -
48   - <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
49   - </div>
50   - </div>
51   -
52   - </div>
53   -</div>
frontend/views/site-del/about.php renamed to frontend/views/site/about.php
frontend/views/site-del/contact.php renamed to frontend/views/site/contact.php
frontend/views/site-del/login.php renamed to frontend/views/site/login.php
frontend/views/site-del/requestPasswordResetToken.php renamed to frontend/views/site/requestPasswordResetToken.php
frontend/views/site-del/resetPassword.php renamed to frontend/views/site/resetPassword.php
frontend/views/site-del/signup.php renamed to frontend/views/site/signup.php