Commit f49be8784b9d624b1b3c7dcbe5fbf478640cc6f3

Authored by andryeyev
2 parents be130c6c 6d49b5d2

Merge remote-tracking branch 'origin/Yarik' into Yarik

# Conflicts:
#	frontend/controllers/OptionController.php
1 - AddDefaultCharset utf-8  
2 -  
3 - Options -Indexes +FollowSymlinks -MultiViews  
4 - DirectoryIndex index.php  
5 -  
6 - AddHandler server-parsed .html  
7 - AddOutputFilter INCLUDES .html 1 +<IfModule mod_rewrite.c>
8 2
9 - SetEnv TZ Europe/Kiev 3 + Options +FollowSymlinks
10 4
11 RewriteEngine On 5 RewriteEngine On
12 6
  7 +</IfModule>
  8 +
13 <IfModule mod_rewrite.c> 9 <IfModule mod_rewrite.c>
14 10
15 - RewriteEngine On 11 + RewriteBase /
  12 + # deal with admin first
  13 + RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT]
  14 +
  15 + RewriteCond %{REQUEST_URI} ^/(admin)
  16 +
  17 +
  18 +
  19 + RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
  20 +
  21 + RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
  22 +
  23 + RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L]
  24 +
  25 + RewriteRule ^admin/images/(.*)$ backend/web/images/$1 [L]
  26 +
  27 + RewriteRule ^admin/fonts/(.*)$ backend/web/fonts/$1 [L]
  28 +
  29 +
  30 +
  31 +
  32 +
  33 + RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js|images|fonts)/
  34 +
  35 + RewriteCond %{REQUEST_URI} ^/(admin)
  36 +
  37 + RewriteRule ^.*$ backend/web/index.php [L]
  38 +
  39 +
  40 +
  41 + RewriteCond %{REQUEST_URI} ^/(assets|css)
  42 +
  43 + RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
  44 +
  45 + RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
  46 +
  47 + RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
  48 +
  49 + RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
  50 +
  51 + RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L]
  52 +
  53 +
  54 + RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js|images|fonts)/
  55 +
  56 + RewriteCond %{REQUEST_URI} !index.php
  57 +
  58 + RewriteCond %{REQUEST_FILENAME} !-f [OR]
16 59
17 - # the main rewrite rule for the frontend application  
18 - RewriteCond %{REQUEST_URI} !^/(backend/web|admin)  
19 - RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L]  
20 -  
21 - RewriteCond %{REQUEST_URI} ^/frontend/web  
22 - RewriteCond %{REQUEST_FILENAME} !-f  
23 - RewriteCond %{REQUEST_FILENAME} !-d  
24 - RewriteRule . /frontend/web/index.php [L]  
25 -  
26 - RewriteCond %{REQUEST_URI} ^/backend/web  
27 - RewriteCond %{REQUEST_FILENAME} !-f  
28 RewriteCond %{REQUEST_FILENAME} !-d 60 RewriteCond %{REQUEST_FILENAME} !-d
29 - RewriteRule . /backend/web/index.php [L]  
30 61
31 - RewriteCond %{REQUEST_URI} \.(htaccess|htpasswd|svn|git)  
32 - RewriteRule \.(htaccess|htpasswd|svn|git) - [F]  
33 - 62 + RewriteRule ^.*$ frontend/web/index.php
  63 +
  64 +</IfModule>
  65 +
  66 +#для возможности загрузки файлов парсера
  67 +<IfModule mod_php5.c>
  68 + php_value upload_max_filesize 20M
  69 + php_value post_max_size 30M
34 </IfModule> 70 </IfModule>
35 \ No newline at end of file 71 \ No newline at end of file
backend/config/main.php
1 <?php 1 <?php
  2 +
2 $params = array_merge( 3 $params = array_merge(
3 require(__DIR__ . '/../../common/config/params.php'), 4 require(__DIR__ . '/../../common/config/params.php'),
4 require(__DIR__ . '/../../common/config/params-local.php'), 5 require(__DIR__ . '/../../common/config/params-local.php'),
@@ -6,6 +7,8 @@ $params = array_merge( @@ -6,6 +7,8 @@ $params = array_merge(
6 require(__DIR__ . '/params-local.php') 7 require(__DIR__ . '/params-local.php')
7 ); 8 );
8 9
  10 +define ('IS_FRONT', FALSE);
  11 +
9 return [ 12 return [
10 'id' => 'app-backend', 13 'id' => 'app-backend',
11 'basePath' => dirname(__DIR__), 14 'basePath' => dirname(__DIR__),
common/components/LangRequest.php
@@ -5,11 +5,18 @@ namespace common\components; @@ -5,11 +5,18 @@ namespace common\components;
5 use Yii; 5 use Yii;
6 use yii\web\Request; 6 use yii\web\Request;
7 use common\models\Language; 7 use common\models\Language;
  8 +use common\models\Page;
  9 +use yii\helpers\Url;
8 10
9 class LangRequest extends Request 11 class LangRequest extends Request
10 -{ 12 +{
11 private $_lang_url; 13 private $_lang_url;
12 14
  15 + public function getBaseUrl()
  16 + {
  17 + return str_replace ((IS_FRONT ? '/frontend/web' : '/backend/web'), '', parent::getBaseUrl()) . (IS_FRONT ? '' : '/admin');
  18 + }
  19 +
13 public function getLangUrl() 20 public function getLangUrl()
14 { 21 {
15 if ($this->_lang_url === null) 22 if ($this->_lang_url === null)
@@ -61,6 +68,7 @@ class LangRequest extends Request @@ -61,6 +68,7 @@ class LangRequest extends Request
61 } 68 }
62 69
63 $scriptUrl = $this->getScriptUrl(); 70 $scriptUrl = $this->getScriptUrl();
  71 +
64 $baseUrl = $this->getBaseUrl(); 72 $baseUrl = $this->getBaseUrl();
65 73
66 if (strpos($pathInfo, $scriptUrl) === 0) 74 if (strpos($pathInfo, $scriptUrl) === 0)
@@ -84,7 +92,7 @@ class LangRequest extends Request @@ -84,7 +92,7 @@ class LangRequest extends Request
84 { 92 {
85 $pathInfo = substr ($pathInfo, 1); 93 $pathInfo = substr ($pathInfo, 1);
86 } 94 }
87 - 95 +
88 return (string) $pathInfo; 96 return (string) $pathInfo;
89 } 97 }
90 } 98 }
91 \ No newline at end of file 99 \ No newline at end of file
common/components/Request.php 0 → 100755
  1 +<?php
  2 +namespace common\components;
  3 +
  4 +class Request extends \yii\web\Request
  5 +
  6 +{
  7 +
  8 + public $web;
  9 +
  10 + public $adminUrl;
  11 +
  12 +
  13 +
  14 + public function getBaseUrl()
  15 +
  16 + {
  17 +
  18 + return str_replace($this->web, "", parent::getBaseUrl()) . $this->adminUrl;
  19 +
  20 + }
  21 +
  22 +
  23 +
  24 + public function resolvePathInfo()
  25 +
  26 + {
  27 +
  28 + if ($this->getUrl() === $this->adminUrl) {
  29 +
  30 + return "";
  31 +
  32 + } else {
  33 +
  34 + return parent::resolvePathInfo();
  35 +
  36 + }
  37 +
  38 + }
  39 +
  40 +}
0 \ No newline at end of file 41 \ No newline at end of file
common/config/main.php
@@ -6,12 +6,10 @@ return [ @@ -6,12 +6,10 @@ return [
6 'class' => 'yii\caching\FileCache', 6 'class' => 'yii\caching\FileCache',
7 ], 7 ],
8 'urlManager' => [ 8 'urlManager' => [
9 - 'enablePrettyUrl' => false, 9 + 'enablePrettyUrl' => true,
10 'showScriptName' => false, 10 'showScriptName' => false,
11 'class'=> 'common\components\LangUrlManager', 11 'class'=> 'common\components\LangUrlManager',
12 'rules'=>[ 12 'rules'=>[
13 - '/' => 'site/index',  
14 - '<controller:\w+>/<action:\w+>/*'=>'<controller>/<action>',  
15 ] 13 ]
16 ], 14 ],
17 'request' => [ 15 'request' => [
common/models/ShopCategory.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\db\Query;
  8 +
  9 +/**
  10 + * Signup form
  11 + */
  12 +class ShopCategory extends Model
  13 +{
  14 + /**
  15 + * весь список терминов
  16 + */
  17 + static function get ()
  18 + {
  19 + return yii::$app->db->createCommand('
  20 + SELECT
  21 + `termin_relation`.termin_id_1,
  22 + `termin_relation`.termin_id_2,
  23 + `termin_lang`.termin_title
  24 + FROM `termin_relation`
  25 + INNER JOIN `termin_lang` ON `termin_lang`.termin_id = `termin_relation`.termin_id_1
  26 + AND `termin_lang`.lang_id = '.yii::$app->lang_id.'
  27 + INNER JOIN `template` ON `template`.template_id = `termin_lang`.template_id
  28 + ORDER BY `termin_relation`.termin_id_1 ASC, `termin_relation`.termin_id_2 ASC
  29 + ')->queryAll();
  30 + }
  31 +
  32 + // ===================
  33 + // ==== STRUCTURE ====
  34 + // ===================
  35 +
  36 + var $mass = array ();
  37 +
  38 + public function build ()
  39 + {
  40 + if ($this->mass = self::get ())
  41 + {
  42 + return $this->getRecrusive (8);
  43 + }
  44 + }
  45 +
  46 + public function findChild ($id)
  47 + {
  48 + $mass = array ();
  49 +
  50 + foreach ($this->mass as $row)
  51 + {
  52 + if ($row['termin_id_2'] == $id)
  53 + {
  54 + $mass[] = $row;
  55 + }
  56 + }
  57 +
  58 + return $mass;
  59 + }
  60 +
  61 + public function getRecrusive ($menu_id)
  62 + {
  63 + $items = $this->findChild($menu_id);
  64 +
  65 + if (! empty ($items))
  66 + {
  67 + echo '<ul>';
  68 +
  69 + foreach ($items as $row)
  70 + {
  71 + echo '<li>'.$row['termin_title'].'</li>';
  72 +
  73 + if ($row['termin_id_2'] != 0)
  74 + {
  75 + $this->getRecrusive($row['termin_id_1']);
  76 + }
  77 + }
  78 +
  79 + echo '</ul>';
  80 + }
  81 +
  82 + }
  83 +
  84 + // =====
  85 +
  86 +}
db-migration/artbox_db.sql
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 -- http://www.phpmyadmin.net 3 -- http://www.phpmyadmin.net
4 -- 4 --
5 -- Хост: 127.0.0.1:3306 5 -- Хост: 127.0.0.1:3306
6 --- Час створення: Лис 12 2015 р., 22:57 6 +-- Час створення: Лис 18 2015 р., 13:28
7 -- Версія сервера: 5.5.45 7 -- Версія сервера: 5.5.45
8 --- Версія PHP: 5.6.12 8 +-- Версія PHP: 5.3.29
9 9
10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11 SET time_zone = "+00:00"; 11 SET time_zone = "+00:00";
@@ -23,6 +23,120 @@ SET time_zone = &quot;+00:00&quot;; @@ -23,6 +23,120 @@ SET time_zone = &quot;+00:00&quot;;
23 -- -------------------------------------------------------- 23 -- --------------------------------------------------------
24 24
25 -- 25 --
  26 +-- Структура таблиці `attribute`
  27 +--
  28 +
  29 +CREATE TABLE IF NOT EXISTS `attribute` (
  30 + `attribute_id` int(6) unsigned NOT NULL AUTO_INCREMENT,
  31 + `attribute_group_id` int(6) unsigned NOT NULL,
  32 + `color` varchar(32) DEFAULT NULL,
  33 + `sortorder` int(6) unsigned NOT NULL,
  34 + PRIMARY KEY (`attribute_id`),
  35 + KEY `attribute_group` (`attribute_group_id`)
  36 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=60 ;
  37 +
  38 +-- --------------------------------------------------------
  39 +
  40 +--
  41 +-- Структура таблиці `attribute_group`
  42 +--
  43 +
  44 +CREATE TABLE IF NOT EXISTS `attribute_group` (
  45 + `attribute_group_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  46 + `is_color_group` tinyint(1) NOT NULL DEFAULT '0',
  47 + `group_type` enum('select','radio','color') NOT NULL DEFAULT 'select',
  48 + `sortorder` int(10) unsigned NOT NULL DEFAULT '0',
  49 + PRIMARY KEY (`attribute_group_id`)
  50 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=7 ;
  51 +
  52 +-- --------------------------------------------------------
  53 +
  54 +--
  55 +-- Структура таблиці `attribute_group_lang`
  56 +--
  57 +
  58 +CREATE TABLE IF NOT EXISTS `attribute_group_lang` (
  59 + `attribute_group_id` int(10) unsigned NOT NULL,
  60 + `lang_id` int(2) NOT NULL,
  61 + `attribute_group_title` varchar(128) NOT NULL,
  62 + `attribute_group_url` varchar(50) DEFAULT NULL,
  63 + PRIMARY KEY (`attribute_group_id`,`lang_id`)
  64 +) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  65 +
  66 +-- --------------------------------------------------------
  67 +
  68 +--
  69 +-- Структура таблиці `attribute_lang`
  70 +--
  71 +
  72 +CREATE TABLE IF NOT EXISTS `attribute_lang` (
  73 + `attribute_id` int(6) NOT NULL,
  74 + `lang_id` int(2) NOT NULL,
  75 + `attribute_title` varchar(128) NOT NULL,
  76 + `attribute_url` varchar(50) DEFAULT NULL,
  77 + PRIMARY KEY (`attribute_id`,`lang_id`),
  78 + KEY `id_lang` (`lang_id`,`attribute_title`)
  79 +) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  80 +
  81 +-- --------------------------------------------------------
  82 +
  83 +--
  84 +-- Структура таблиці `feature`
  85 +--
  86 +
  87 +CREATE TABLE IF NOT EXISTS `feature` (
  88 + `feature_id` int(6) NOT NULL AUTO_INCREMENT,
  89 + `feature_group_id` int(6) NOT NULL,
  90 + `custom` tinyint(3) DEFAULT NULL,
  91 + `extra` varchar(20) DEFAULT NULL,
  92 + PRIMARY KEY (`feature_id`),
  93 + KEY `feature` (`feature_group_id`)
  94 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=51 ;
  95 +
  96 +-- --------------------------------------------------------
  97 +
  98 +--
  99 +-- Структура таблиці `feature_group`
  100 +--
  101 +
  102 +CREATE TABLE IF NOT EXISTS `feature_group` (
  103 + `feature_group_id` int(6) NOT NULL AUTO_INCREMENT,
  104 + `sortorder` int(6) NOT NULL DEFAULT '0',
  105 + PRIMARY KEY (`feature_group_id`)
  106 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=12 ;
  107 +
  108 +-- --------------------------------------------------------
  109 +
  110 +--
  111 +-- Структура таблиці `feature_group_lang`
  112 +--
  113 +
  114 +CREATE TABLE IF NOT EXISTS `feature_group_lang` (
  115 + `feature_group_id` int(6) NOT NULL,
  116 + `lang_id` int(2) NOT NULL,
  117 + `feature_group_title` varchar(50) DEFAULT NULL,
  118 + `feature_group_url` varchar(50) DEFAULT NULL,
  119 + PRIMARY KEY (`feature_group_id`,`lang_id`)
  120 +) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  121 +
  122 +-- --------------------------------------------------------
  123 +
  124 +--
  125 +-- Структура таблиці `feature_lang`
  126 +--
  127 +
  128 +CREATE TABLE IF NOT EXISTS `feature_lang` (
  129 + `feature_id` int(6) NOT NULL,
  130 + `lang_id` int(2) NOT NULL,
  131 + `feature_title` varchar(255) DEFAULT NULL,
  132 + `feature_url` varchar(50) DEFAULT NULL,
  133 + `extra` varchar(20) DEFAULT NULL,
  134 + PRIMARY KEY (`feature_id`,`lang_id`)
  135 +) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  136 +
  137 +-- --------------------------------------------------------
  138 +
  139 +--
26 -- Структура таблиці `image` 140 -- Структура таблиці `image`
27 -- 141 --
28 142
@@ -262,6 +376,73 @@ INSERT INTO `module_lang` (`module_id`, `module_title`, `lang_id`) VALUES @@ -262,6 +376,73 @@ INSERT INTO `module_lang` (`module_id`, `module_title`, `lang_id`) VALUES
262 -- -------------------------------------------------------- 376 -- --------------------------------------------------------
263 377
264 -- 378 --
  379 +-- Структура таблиці `option`
  380 +--
  381 +
  382 +CREATE TABLE IF NOT EXISTS `option` (
  383 + `option_id` int(11) NOT NULL AUTO_INCREMENT,
  384 + `model` varchar(200) NOT NULL,
  385 + `model_id` int(11) NOT NULL,
  386 + `name` varchar(200) NOT NULL,
  387 + `template` varchar(200) NOT NULL,
  388 + `parent_id` int(11) DEFAULT NULL,
  389 + PRIMARY KEY (`option_id`),
  390 + KEY `FK_option_option` (`parent_id`)
  391 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=26 ;
  392 +
  393 +--
  394 +-- Дамп даних таблиці `option`
  395 +--
  396 +
  397 +INSERT INTO `option` (`option_id`, `model`, `model_id`, `name`, `template`, `parent_id`) VALUES
  398 +(20, 'user', 10, 'phone', 'input', NULL),
  399 +(21, 'user', 10, 'adres', 'input', 20),
  400 +(22, 'user', 10, 'phone', 'input', NULL),
  401 +(23, 'user', 10, 'adres', 'input', 22),
  402 +(24, 'user', 10, 'phone', 'input', NULL),
  403 +(25, 'user', 10, 'adres', 'input', 24);
  404 +
  405 +-- --------------------------------------------------------
  406 +
  407 +--
  408 +-- Структура таблиці `option_lang`
  409 +--
  410 +
  411 +CREATE TABLE IF NOT EXISTS `option_lang` (
  412 + `primary` int(11) NOT NULL AUTO_INCREMENT,
  413 + `id` int(11) NOT NULL,
  414 + `lang_id` int(11) NOT NULL,
  415 + `value` text NOT NULL,
  416 + PRIMARY KEY (`primary`),
  417 + KEY `Индекс 1` (`id`),
  418 + KEY `Индекс 2` (`lang_id`)
  419 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=36 ;
  420 +
  421 +--
  422 +-- Дамп даних таблиці `option_lang`
  423 +--
  424 +
  425 +INSERT INTO `option_lang` (`primary`, `id`, `lang_id`, `value`) VALUES
  426 +(20, 20, 0, 'phone'),
  427 +(21, 20, 1, 'phone111ukr'),
  428 +(22, 20, 2, 'phone111ru'),
  429 +(23, 21, 0, 'adres111'),
  430 +(24, 21, 1, 'adres111'),
  431 +(25, 21, 2, 'adres222'),
  432 +(26, 22, 0, 'phone222'),
  433 +(27, 22, 1, 'phone222uk'),
  434 +(28, 23, 0, 'adres111'),
  435 +(29, 23, 1, 'adres111'),
  436 +(30, 23, 2, 'adres111'),
  437 +(31, 24, 0, 'phone333'),
  438 +(32, 24, 2, 'phone333ru'),
  439 +(33, 25, 0, 'adres111'),
  440 +(34, 25, 1, 'adres111'),
  441 +(35, 25, 2, 'adres111');
  442 +
  443 +-- --------------------------------------------------------
  444 +
  445 +--
265 -- Структура таблиці `page` 446 -- Структура таблиці `page`
266 -- 447 --
267 448
@@ -328,6 +509,101 @@ INSERT INTO `page_lang` (`page_id`, `meta_title`, `meta_description`, `text`, `l @@ -328,6 +509,101 @@ INSERT INTO `page_lang` (`page_id`, `meta_title`, `meta_description`, `text`, `l
328 -- -------------------------------------------------------- 509 -- --------------------------------------------------------
329 510
330 -- 511 --
  512 +-- Структура таблиці `product`
  513 +--
  514 +
  515 +CREATE TABLE IF NOT EXISTS `product` (
  516 + `product_id` int(11) NOT NULL AUTO_INCREMENT,
  517 + `termin_id` int(11) NOT NULL,
  518 + `date_add` datetime NOT NULL,
  519 + `date_edit` datetime NOT NULL,
  520 + `article` varchar(20) NOT NULL,
  521 + `bar_code` varchar(40) DEFAULT NULL,
  522 + `price` decimal(20,2) NOT NULL,
  523 + `currency_id` int(2) NOT NULL,
  524 + `weight` int(6) NOT NULL,
  525 + `default_image_id` int(6) NOT NULL,
  526 + `show` tinyint(1) NOT NULL,
  527 + `sortorder` int(11) NOT NULL,
  528 + PRIMARY KEY (`product_id`),
  529 + KEY `sortorder` (`sortorder`),
  530 + KEY `show` (`show`)
  531 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  532 +
  533 +-- --------------------------------------------------------
  534 +
  535 +--
  536 +-- Структура таблиці `product_attribute`
  537 +--
  538 +
  539 +CREATE TABLE IF NOT EXISTS `product_attribute` (
  540 + `product_attribute_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  541 + `product_id` int(10) unsigned NOT NULL,
  542 + `reference` varchar(32) DEFAULT NULL,
  543 + `supplier_reference` varchar(32) DEFAULT NULL,
  544 + `location` varchar(64) DEFAULT NULL,
  545 + `ean13` varchar(13) DEFAULT NULL,
  546 + `upc` varchar(12) DEFAULT NULL,
  547 + `reduction` decimal(20,6) NOT NULL DEFAULT '0.000000',
  548 + `ecotax` decimal(17,6) NOT NULL DEFAULT '0.000000',
  549 + `quantity` int(10) NOT NULL DEFAULT '0',
  550 + `weight` int(6) NOT NULL,
  551 + `default_on` tinyint(1) unsigned NOT NULL DEFAULT '0',
  552 + `minimal_quantity` int(10) unsigned NOT NULL DEFAULT '1',
  553 + `date_available` date NOT NULL,
  554 + `sortorder` int(6) NOT NULL,
  555 + PRIMARY KEY (`product_attribute_id`),
  556 + KEY `product_attribute_product` (`product_id`),
  557 + KEY `reference` (`reference`),
  558 + KEY `supplier_reference` (`supplier_reference`),
  559 + KEY `product_default` (`product_id`,`default_on`),
  560 + KEY `id_product_id_product_attribute` (`product_attribute_id`,`product_id`)
  561 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1463 ;
  562 +
  563 +-- --------------------------------------------------------
  564 +
  565 +--
  566 +-- Структура таблиці `product_attribute_combination`
  567 +--
  568 +
  569 +CREATE TABLE IF NOT EXISTS `product_attribute_combination` (
  570 + `attribute_id` int(10) unsigned NOT NULL,
  571 + `product_attribute_id` int(10) unsigned NOT NULL,
  572 + PRIMARY KEY (`attribute_id`,`product_attribute_id`),
  573 + KEY `product_attribute_id` (`product_attribute_id`)
  574 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
  575 +
  576 +-- --------------------------------------------------------
  577 +
  578 +--
  579 +-- Структура таблиці `product_feature`
  580 +--
  581 +
  582 +CREATE TABLE IF NOT EXISTS `product_feature` (
  583 + `feature_group_id` int(6) NOT NULL,
  584 + `feature_id` int(6) NOT NULL,
  585 + `product_id` int(6) NOT NULL,
  586 + PRIMARY KEY (`feature_group_id`,`product_id`),
  587 + KEY `feature_id` (`feature_id`),
  588 + KEY `product_id` (`product_id`)
  589 +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
  590 +
  591 +-- --------------------------------------------------------
  592 +
  593 +--
  594 +-- Структура таблиці `product_image`
  595 +--
  596 +
  597 +CREATE TABLE IF NOT EXISTS `product_image` (
  598 + `image_id` int(11) NOT NULL,
  599 + `product_id` int(11) NOT NULL DEFAULT '0',
  600 + PRIMARY KEY (`product_id`,`image_id`),
  601 + KEY `product_id` (`product_id`)
  602 +) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  603 +
  604 +-- --------------------------------------------------------
  605 +
  606 +--
331 -- Структура таблиці `template` 607 -- Структура таблиці `template`
332 -- 608 --
333 609
@@ -382,35 +658,210 @@ INSERT INTO `template_lang` (`template_id`, `template_title`, `lang_id`) VALUES @@ -382,35 +658,210 @@ INSERT INTO `template_lang` (`template_id`, `template_title`, `lang_id`) VALUES
382 CREATE TABLE IF NOT EXISTS `termin` ( 658 CREATE TABLE IF NOT EXISTS `termin` (
383 `termin_id` int(6) NOT NULL AUTO_INCREMENT, 659 `termin_id` int(6) NOT NULL AUTO_INCREMENT,
384 `termin_pid` int(11) NOT NULL, 660 `termin_pid` int(11) NOT NULL,
  661 + `TYPE` enum('A','F','H','') NOT NULL DEFAULT 'H',
385 `is_default` int(1) NOT NULL, 662 `is_default` int(1) NOT NULL,
386 `page_id` int(6) NOT NULL, 663 `page_id` int(6) NOT NULL,
387 PRIMARY KEY (`termin_id`) 664 PRIMARY KEY (`termin_id`)
388 -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=20 ; 665 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=197 ;
389 666
390 -- 667 --
391 -- Дамп даних таблиці `termin` 668 -- Дамп даних таблиці `termin`
392 -- 669 --
393 670
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); 671 +INSERT INTO `termin` (`termin_id`, `termin_pid`, `TYPE`, `is_default`, `page_id`) VALUES
  672 +(1, 0, 'H', 1, 1),
  673 +(2, 0, 'H', 1, 2),
  674 +(3, 0, 'H', 1, 3),
  675 +(4, 0, 'H', 1, 4),
  676 +(5, 0, 'H', 1, 5),
  677 +(6, 0, 'H', 1, 6),
  678 +(7, 0, 'H', 1, 7),
  679 +(8, 0, 'H', 1, 8),
  680 +(9, 0, 'H', 1, 9),
  681 +(10, 0, 'H', 1, 10),
  682 +(11, 0, 'H', 1, 11),
  683 +(12, 0, 'H', 1, 12),
  684 +(13, 0, 'H', 1, 13),
  685 +(17, 0, 'H', 1, 0),
  686 +(18, 0, 'H', 1, 0),
  687 +(19, 0, 'H', 1, 0),
  688 +(20, 8, 'H', 1, 0),
  689 +(21, 8, 'H', 1, 0),
  690 +(22, 190, 'H', 1, 0),
  691 +(23, 190, 'H', 1, 0),
  692 +(24, 190, 'H', 1, 0),
  693 +(25, 23, 'H', 1, 0),
  694 +(26, 22, 'H', 1, 0),
  695 +(27, 22, 'H', 1, 0),
  696 +(28, 22, 'H', 1, 0),
  697 +(29, 22, 'H', 1, 0),
  698 +(30, 22, 'H', 1, 0),
  699 +(31, 22, 'H', 1, 0),
  700 +(32, 22, 'H', 1, 0),
  701 +(33, 22, 'H', 1, 0),
  702 +(34, 22, 'H', 1, 0),
  703 +(35, 22, 'H', 1, 0),
  704 +(36, 23, 'H', 1, 0),
  705 +(37, 22, 'H', 1, 0),
  706 +(38, 22, 'H', 1, 0),
  707 +(39, 23, 'H', 1, 0),
  708 +(40, 22, 'H', 1, 0),
  709 +(41, 22, 'H', 1, 0),
  710 +(42, 22, 'H', 1, 0),
  711 +(43, 22, 'H', 1, 0),
  712 +(44, 22, 'H', 1, 0),
  713 +(45, 22, 'H', 1, 0),
  714 +(46, 22, 'H', 1, 0),
  715 +(47, 22, 'H', 1, 0),
  716 +(48, 22, 'H', 1, 0),
  717 +(49, 23, 'H', 1, 0),
  718 +(50, 22, 'H', 1, 0),
  719 +(51, 22, 'H', 1, 0),
  720 +(52, 22, 'H', 1, 0),
  721 +(53, 22, 'H', 1, 0),
  722 +(54, 22, 'H', 1, 0),
  723 +(55, 22, 'H', 1, 0),
  724 +(56, 22, 'H', 1, 0),
  725 +(57, 22, 'H', 1, 0),
  726 +(58, 22, 'H', 1, 0),
  727 +(59, 22, 'H', 1, 0),
  728 +(60, 22, 'H', 1, 0),
  729 +(61, 22, 'H', 1, 0),
  730 +(62, 22, 'H', 1, 0),
  731 +(63, 22, 'H', 1, 0),
  732 +(64, 22, 'H', 1, 0),
  733 +(65, 22, 'H', 1, 0),
  734 +(66, 22, 'H', 1, 0),
  735 +(67, 22, 'H', 1, 0),
  736 +(68, 22, 'H', 1, 0),
  737 +(69, 23, 'H', 1, 0),
  738 +(70, 22, 'H', 1, 0),
  739 +(71, 22, 'H', 1, 0),
  740 +(72, 22, 'H', 1, 0),
  741 +(73, 22, 'H', 1, 0),
  742 +(74, 22, 'H', 1, 0),
  743 +(75, 24, 'H', 1, 0),
  744 +(76, 22, 'H', 1, 0),
  745 +(77, 22, 'H', 1, 0),
  746 +(78, 22, 'H', 1, 0),
  747 +(79, 22, 'H', 1, 0),
  748 +(80, 22, 'H', 1, 0),
  749 +(81, 24, 'H', 1, 0),
  750 +(82, 22, 'H', 1, 0),
  751 +(83, 22, 'H', 1, 0),
  752 +(84, 24, 'H', 1, 0),
  753 +(85, 22, 'H', 1, 0),
  754 +(86, 22, 'H', 1, 0),
  755 +(87, 24, 'H', 1, 0),
  756 +(88, 24, 'H', 1, 0),
  757 +(89, 22, 'H', 1, 0),
  758 +(90, 23, 'H', 1, 0),
  759 +(91, 22, 'H', 1, 0),
  760 +(92, 22, 'H', 1, 0),
  761 +(93, 22, 'H', 1, 0),
  762 +(94, 23, 'H', 1, 0),
  763 +(95, 24, 'H', 1, 0),
  764 +(96, 22, 'H', 1, 0),
  765 +(97, 22, 'H', 1, 0),
  766 +(98, 22, 'H', 1, 0),
  767 +(99, 22, 'H', 1, 0),
  768 +(100, 22, 'H', 1, 0),
  769 +(101, 22, 'H', 1, 0),
  770 +(102, 22, 'H', 1, 0),
  771 +(103, 22, 'H', 1, 0),
  772 +(104, 22, 'H', 1, 0),
  773 +(105, 22, 'H', 1, 0),
  774 +(106, 22, 'H', 1, 0),
  775 +(107, 22, 'H', 1, 0),
  776 +(108, 22, 'H', 1, 0),
  777 +(109, 22, 'H', 1, 0),
  778 +(110, 22, 'H', 1, 0),
  779 +(111, 22, 'H', 1, 0),
  780 +(112, 22, 'H', 1, 0),
  781 +(113, 22, 'H', 1, 0),
  782 +(114, 22, 'H', 1, 0),
  783 +(115, 22, 'H', 1, 0),
  784 +(116, 23, 'H', 1, 0),
  785 +(117, 22, 'H', 1, 0),
  786 +(118, 22, 'H', 1, 0),
  787 +(119, 22, 'H', 1, 0),
  788 +(120, 22, 'H', 1, 0),
  789 +(121, 22, 'H', 1, 0),
  790 +(122, 22, 'H', 1, 0),
  791 +(123, 22, 'H', 1, 0),
  792 +(124, 22, 'H', 1, 0),
  793 +(125, 22, 'H', 1, 0),
  794 +(126, 22, 'H', 1, 0),
  795 +(127, 22, 'H', 1, 0),
  796 +(128, 22, 'H', 1, 0),
  797 +(129, 23, 'H', 1, 0),
  798 +(130, 22, 'H', 1, 0),
  799 +(131, 22, 'H', 1, 0),
  800 +(132, 24, 'H', 1, 0),
  801 +(133, 23, 'H', 1, 0),
  802 +(134, 24, 'H', 1, 0),
  803 +(135, 23, 'H', 1, 0),
  804 +(136, 22, 'H', 1, 0),
  805 +(137, 22, 'H', 1, 0),
  806 +(138, 22, 'H', 1, 0),
  807 +(139, 23, 'H', 1, 0),
  808 +(140, 22, 'H', 1, 0),
  809 +(141, 22, 'H', 1, 0),
  810 +(142, 22, 'H', 1, 0),
  811 +(143, 22, 'H', 1, 0),
  812 +(144, 22, 'H', 1, 0),
  813 +(145, 22, 'H', 1, 0),
  814 +(146, 22, 'H', 1, 0),
  815 +(147, 22, 'H', 1, 0),
  816 +(148, 22, 'H', 1, 0),
  817 +(149, 22, 'H', 1, 0),
  818 +(150, 22, 'H', 1, 0),
  819 +(151, 22, 'H', 1, 0),
  820 +(152, 22, 'H', 1, 0),
  821 +(153, 22, 'H', 1, 0),
  822 +(154, 22, 'H', 1, 0),
  823 +(155, 22, 'H', 1, 0),
  824 +(156, 22, 'H', 1, 0),
  825 +(157, 22, 'H', 1, 0),
  826 +(158, 22, 'H', 1, 0),
  827 +(159, 22, 'H', 1, 0),
  828 +(160, 22, 'H', 1, 0),
  829 +(161, 22, 'H', 1, 0),
  830 +(162, 22, 'H', 1, 0),
  831 +(163, 24, 'H', 1, 0),
  832 +(164, 22, 'H', 1, 0),
  833 +(165, 22, 'H', 1, 0),
  834 +(166, 24, 'H', 1, 0),
  835 +(167, 22, 'H', 1, 0),
  836 +(168, 22, 'H', 1, 0),
  837 +(169, 22, 'H', 1, 0),
  838 +(170, 23, 'H', 1, 0),
  839 +(171, 24, 'H', 1, 0),
  840 +(172, 22, 'H', 1, 0),
  841 +(173, 22, 'H', 1, 0),
  842 +(174, 23, 'H', 1, 0),
  843 +(175, 22, 'H', 1, 0),
  844 +(176, 22, 'H', 1, 0),
  845 +(177, 22, 'H', 1, 0),
  846 +(178, 22, 'H', 1, 0),
  847 +(179, 23, 'H', 1, 0),
  848 +(180, 22, 'H', 1, 0),
  849 +(181, 22, 'H', 1, 0),
  850 +(182, 22, 'H', 1, 0),
  851 +(183, 22, 'H', 1, 0),
  852 +(184, 22, 'H', 1, 0),
  853 +(185, 22, 'H', 1, 0),
  854 +(186, 23, 'H', 1, 0),
  855 +(187, 22, 'H', 1, 0),
  856 +(188, 8, 'H', 1, 0),
  857 +(189, 8, 'H', 1, 0),
  858 +(190, 8, 'H', 1, 0),
  859 +(191, 21, 'H', 1, 0),
  860 +(192, 21, 'H', 1, 0),
  861 +(193, 21, 'H', 1, 0),
  862 +(194, 21, 'H', 1, 0),
  863 +(195, 21, 'H', 1, 0),
  864 +(196, 21, 'H', 1, 0);
414 865
415 -- -------------------------------------------------------- 866 -- --------------------------------------------------------
416 867
@@ -440,18 +891,192 @@ INSERT INTO `termin_lang` (`termin_id`, `template_id`, `termin_alias`, `termin_t @@ -440,18 +891,192 @@ INSERT INTO `termin_lang` (`termin_id`, `template_id`, `termin_alias`, `termin_t
440 (5, 1, 'contacts', 'Контакты', 2), 891 (5, 1, 'contacts', 'Контакты', 2),
441 (6, 1, 'shops', 'Магазины', 2), 892 (6, 1, 'shops', 'Магазины', 2),
442 (7, 1, 'vendors', 'Поставщики', 2), 893 (7, 1, 'vendors', 'Поставщики', 2),
443 -(8, 1, 'catalog', 'Каталог товаров', 2), 894 +(8, 3, 'catalog', 'Каталог товаров', 2),
444 (9, 1, 'payment', 'Оплата', 2), 895 (9, 1, 'payment', 'Оплата', 2),
445 (10, 1, 'delivery', 'Доставка', 2), 896 (10, 1, 'delivery', 'Доставка', 2),
446 (11, 1, 'warranty', 'Гарантия', 2), 897 (11, 1, 'warranty', 'Гарантия', 2),
447 (12, 1, 'promotion', 'Акции ', 2), 898 (12, 1, 'promotion', 'Акции ', 2),
448 (13, 1, 'news', 'Материалы/блог', 2), 899 (13, 1, 'news', 'Материалы/блог', 2),
449 -(14, 1, 'arbuz', 'Арбуз', 2),  
450 -(15, 1, 'artishok', 'Артишок', 2),  
451 -(16, 1, 'baklazhan', 'Баклажан', 2),  
452 (17, 1, 'login', 'Авторизация', 2), 900 (17, 1, 'login', 'Авторизация', 2),
453 (18, 1, 'logout', 'Выход', 2), 901 (18, 1, 'logout', 'Выход', 2),
454 -(19, 1, 'signup', 'Регистрация', 2); 902 +(19, 1, 'signup', 'Регистрация', 2),
  903 +(20, 1, 'semena', 'Семена', 2),
  904 +(21, 3, 'metseliy-gribov', 'Мицелий грибов', 2),
  905 +(22, 3, 'tsvetochnye', 'Цветочные\n', 2),
  906 +(23, 3, 'komnatnye', 'Комнатные', 2),
  907 +(24, 3, 'decorativnye', 'Декоративные', 2),
  908 +(25, 3, 'abutilon', 'Абутилон', 2),
  909 +(26, 3, 'ageratum', 'Агератум', 2),
  910 +(27, 3, 'agrostemma', 'Агростемма', 2),
  911 +(28, 3, 'adonis', 'Адонис', 2),
  912 +(29, 3, 'akvilegija', 'Аквилегия', 2),
  913 +(30, 3, 'alissum', 'Алиссум', 2),
  914 +(31, 3, 'alstromerija', 'Альстромерия', 2),
  915 +(32, 3, 'amarant', 'Амарант', 2),
  916 +(33, 3, 'ammobium', 'Аммобиум', 2),
  917 +(34, 3, 'anagallis', 'Анагаллис', 2),
  918 +(35, 3, 'arktotis', 'Арктотис', 2),
  919 +(36, 3, 'asparagus', 'Аспарагус', 2),
  920 +(37, 3, 'astra', 'Астра', 2),
  921 +(38, 3, 'balzamin', 'Бальзамин', 2),
  922 +(39, 3, 'banan', 'Банан', 2),
  923 +(40, 3, 'barvinok', 'Барвинок', 2),
  924 +(41, 3, 'bartonija', 'Бартония', 2),
  925 +(42, 3, 'barhatcy', 'Бархатцы', 2),
  926 +(43, 3, 'begonija', 'Бегония', 2),
  927 +(44, 3, 'brahikoma', 'Брахикома', 2),
  928 +(45, 3, 'brovalija', 'Бровалия', 2),
  929 +(46, 3, 'buddleja', 'Буддлея', 2),
  930 +(47, 3, 'vasilek', 'Василек', 2),
  931 +(48, 3, 'vatochnik', 'Ваточник', 2),
  932 +(49, 3, 'vashingtonija', 'Вашингтония', 2),
  933 +(50, 3, 'venidium', 'Венидиум', 2),
  934 +(51, 3, 'verbena', 'Вербена', 2),
  935 +(52, 3, 'veronika', 'Вероника', 2),
  936 +(53, 3, 'viola', 'Виола', 2),
  937 +(54, 3, 'vjunok', 'Вьюнок', 2),
  938 +(55, 3, 'vjazel', 'Вязель', 2),
  939 +(56, 3, 'gazanija', 'Газания', 2),
  940 +(57, 3, 'gajlardija', 'Гайлардия', 2),
  941 +(58, 3, 'gvozdika', 'Гвоздика', 2),
  942 +(59, 3, 'gelipterum', 'Гелиптерум', 2),
  943 +(60, 3, 'gelihrizum', 'Гелихризум', 2),
  944 +(61, 3, 'georgina', 'Георгина', 2),
  945 +(62, 3, 'giacintovye boby', 'Гиацинтовые бобы', 2),
  946 +(63, 3, 'gibiskus', 'Гибискус', 2),
  947 +(64, 3, 'gipsofila', 'Гипсофила', 2),
  948 +(65, 3, 'godecija', 'Годеция', 2),
  949 +(66, 3, 'gomfrena', 'Гомфрена', 2),
  950 +(67, 3, 'delfinium', 'Дельфиниум', 2),
  951 +(68, 3, 'dimorfoteka', 'Диморфотека', 2),
  952 +(69, 3, 'dracena', 'Драцена', 2),
  953 +(70, 3, 'durman', 'Дурман', 2),
  954 +(71, 3, 'dushistyj goroshek', 'Душистый горошек', 2),
  955 +(72, 3, 'dushistyj tabak', 'Душистый табак', 2),
  956 +(73, 3, 'djusheneja', 'Дюшенея', 2),
  957 +(74, 3, 'zajcehvostnik', 'Зайцехвостник', 2),
  958 +(75, 3, 'zemljanichnyj shpinat', 'Земляничный шпинат', 2),
  959 +(76, 3, 'iberis', 'Иберис', 2),
  960 +(77, 3, 'inkarvilleja', 'Инкарвиллея', 2),
  961 +(78, 3, 'ipomeja', 'Ипомея', 2),
  962 +(79, 3, 'kaktus', 'Кактус', 2),
  963 +(80, 3, 'kalendula', 'Календула', 2),
  964 +(81, 3, 'kapusta dekorativnaja', 'Капуста декоративная', 2),
  965 +(82, 3, 'kvamoklit', 'Квамоклит', 2),
  966 +(83, 3, 'klarkija', 'Кларкия', 2),
  967 +(84, 3, 'klever', 'Клевер', 2),
  968 +(85, 3, 'klematis', 'Клематис', 2),
  969 +(86, 3, 'kleoma', 'Клеома', 2),
  970 +(87, 3, 'kleshhevina', 'Клещевина', 2),
  971 +(88, 3, 'knifofija (tritoma)', 'Книфофия (Тритома)', 2),
  972 +(89, 3, 'kobeja', 'Кобея', 2),
  973 +(90, 3, 'koleus', 'Колеус', 2),
  974 +(91, 3, 'kolokolchik', 'Колокольчик', 2),
  975 +(92, 3, 'koreopsis', 'Кореопсис', 2),
  976 +(93, 3, 'kosmeja', 'Космея', 2),
  977 +(94, 3, 'kofejnoe derevo', 'Кофейное дерево', 2),
  978 +(95, 3, 'kohija', 'Кохия', 2),
  979 +(96, 3, 'lavatera', 'Лаватера', 2),
  980 +(97, 3, 'lagerstrjomija', 'Лагерстрёмия', 2),
  981 +(98, 3, 'lapchatka', 'Лапчатка', 2),
  982 +(99, 3, 'levkoj', 'Левкой', 2),
  983 +(100, 3, 'len', 'Лен', 2),
  984 +(101, 3, 'liatris', 'Лиатрис', 2),
  985 +(102, 3, 'lilejnik', 'Лилейник', 2),
  986 +(103, 3, 'limonium', 'Лимониум', 2),
  987 +(104, 3, 'lihnis', 'Лихнис', 2),
  988 +(105, 3, 'lobelija', 'Лобелия', 2),
  989 +(106, 3, 'lunnik', 'Лунник', 2),
  990 +(107, 3, 'lvinyj zev', 'Львиный зев', 2),
  991 +(108, 3, 'lnjanka', 'Льнянка', 2),
  992 +(109, 3, 'ljupin', 'Люпин', 2),
  993 +(110, 3, 'mak', 'Мак', 2),
  994 +(111, 3, 'malopa', 'Малопа', 2),
  995 +(112, 3, 'malva', 'Мальва', 2),
  996 +(113, 3, 'margaritka', 'Маргаритка', 2),
  997 +(114, 3, 'mattiola', 'Маттиола', 2),
  998 +(115, 3, 'mezembriantemum', 'Мезембриантемум', 2),
  999 +(116, 3, 'mimoza', 'Мимоза', 2),
  1000 +(117, 3, 'mimuljus', 'Мимулюс', 2),
  1001 +(118, 3, 'mirabilis', 'Мирабилис', 2),
  1002 +(119, 3, 'molochaj', 'Молочай', 2),
  1003 +(120, 3, 'moljucella', 'Молюцелла', 2),
  1004 +(121, 3, 'mylnjanka', 'Мыльнянка', 2),
  1005 +(122, 3, 'naperstjanka', 'Наперстянка', 2),
  1006 +(123, 3, 'nasturcija', 'Настурция', 2),
  1007 +(124, 3, 'nezabudka', 'Незабудка', 2),
  1008 +(125, 3, 'nemezija', 'Немезия', 2),
  1009 +(126, 3, 'nemofila', 'Немофила', 2),
  1010 +(127, 3, 'nigella', 'Нигелла', 2),
  1011 +(128, 3, 'nolana', 'Нолана', 2),
  1012 +(129, 3, 'nolina', 'Нолина', 2),
  1013 +(130, 3, 'nochnaja fialka', 'Ночная фиалка', 2),
  1014 +(131, 3, 'obrieta', 'Обриета', 2),
  1015 +(132, 3, 'ovsjanica', 'Овсяница', 2),
  1016 +(133, 3, 'palma', 'Пальма', 2),
  1017 +(134, 3, 'pampasnaja trava', 'Пампасная трава', 2),
  1018 +(135, 3, 'paslen', 'Паслен', 2),
  1019 +(136, 3, 'passiflora', 'Пассифлора', 2),
  1020 +(137, 3, 'pelargonija', 'Пеларгония', 2),
  1021 +(138, 3, 'penstemon', 'Пенстемон', 2),
  1022 +(139, 3, 'perec dekorativnyj', 'Перец декоративный', 2),
  1023 +(140, 3, 'petunija', 'Петуния', 2),
  1024 +(141, 3, 'piretrum', 'Пиретрум', 2),
  1025 +(142, 3, 'podsolnuh', 'Подсолнух', 2),
  1026 +(143, 3, 'portulak', 'Портулак', 2),
  1027 +(144, 3, 'primula', 'Примула', 2),
  1028 +(145, 3, 'ratibida', 'Ратибида', 2),
  1029 +(146, 3, 'rezeda', 'Резеда', 2),
  1030 +(147, 3, 'rezuha', 'Резуха', 2),
  1031 +(148, 3, 'romashka', 'Ромашка', 2),
  1032 +(149, 3, 'rudbekija', 'Рудбекия', 2),
  1033 +(150, 3, 'salvija', 'Сальвия', 2),
  1034 +(151, 3, 'salpiglossis', 'Сальпиглоссис', 2),
  1035 +(152, 3, 'simfiandra', 'Симфиандра', 2),
  1036 +(153, 3, 'skabioza', 'Скабиоза', 2),
  1037 +(154, 3, 'smes', 'Смесь', 2),
  1038 +(155, 3, 'smolevka', 'Смолевка', 2),
  1039 +(156, 3, 'smolka', 'Смолка', 2),
  1040 +(157, 3, 'solncecvet', 'Солнцецвет', 2),
  1041 +(158, 3, 'statica', 'Статица', 2),
  1042 +(159, 3, 'strelitcija', 'Стрелитция', 2),
  1043 +(160, 3, 'surfinija', 'Сурфиния', 2),
  1044 +(161, 3, 'suhocvetnik', 'Сухоцветник', 2),
  1045 +(162, 3, 'shizantus', 'Схизантус', 2),
  1046 +(163, 3, 'trava gazonnaja', 'Трава газонная', 2),
  1047 +(164, 3, 'trjasunka', 'Трясунка', 2),
  1048 +(165, 3, 'tunbergija', 'Тунбергия', 2),
  1049 +(166, 3, 'tykva dekorativnaja', 'Тыква декоративная', 2),
  1050 +(167, 3, 'tysjachelistnik', 'Тысячелистник', 2),
  1051 +(168, 3, 'floks', 'Флокс', 2),
  1052 +(169, 3, 'hejrantus', 'Хейрантус', 2),
  1053 +(170, 3, 'hlopchatnik', 'Хлопчатник', 2),
  1054 +(171, 3, 'hosta', 'Хоста', 2),
  1055 +(172, 3, 'hrizantema', 'Хризантема', 2),
  1056 +(173, 3, 'celozija', 'Целозия', 2),
  1057 +(174, 3, 'ciklamen', 'Цикламен', 2),
  1058 +(175, 3, 'cinerarija', 'Цинерария', 2),
  1059 +(176, 3, 'cinnija', 'Цинния', 2),
  1060 +(177, 3, 'chernogolovka', 'Черноголовка', 2),
  1061 +(178, 3, 'china', 'Чина', 2),
  1062 +(179, 3, 'shefflera', 'Шеффлера', 2),
  1063 +(180, 3, 'jedelvejs', 'Эдельвейс', 2),
  1064 +(181, 3, 'jenotera', 'Энотера', 2),
  1065 +(182, 3, 'jerigeron', 'Эригерон', 2),
  1066 +(183, 3, 'jehinaceja', 'Эхинацея', 2),
  1067 +(184, 3, 'jehium', 'Эхиум', 2),
  1068 +(185, 3, 'jeshsholcija', 'Эшшольция', 2),
  1069 +(186, 3, 'jukka', 'Юкка', 2),
  1070 +(187, 3, 'jaskolka', 'Ясколка', 2),
  1071 +(188, 3, 'sredstvo-zashchity-rasteniy', 'Средства защиты растений', 2),
  1072 +(189, 3, 'udobreniya', 'Удобрения', 2),
  1073 +(190, 3, 'lukavichnye', 'Лукавичные', 2),
  1074 +(191, 3, 'belyy', 'Белый', 2),
  1075 +(192, 3, 'vishenka', 'Вёшенка', 2),
  1076 +(193, 3, 'openok', 'Опёнок', 2),
  1077 +(194, 3, 'ezhovik', 'Ежовик', 2),
  1078 +(195, 3, 'trutovnik', 'Трутовик', 2),
  1079 +(196, 3, 'shitake', 'Шиитаке', 2);
455 1080
456 -- -------------------------------------------------------- 1081 -- --------------------------------------------------------
457 1082
@@ -483,9 +1108,202 @@ INSERT INTO `termin_relation` (`termin_id_1`, `termin_id_2`) VALUES @@ -483,9 +1108,202 @@ INSERT INTO `termin_relation` (`termin_id_1`, `termin_id_2`) VALUES
483 (11, 0), 1108 (11, 0),
484 (12, 0), 1109 (12, 0),
485 (13, 0), 1110 (13, 0),
486 -(14, 0),  
487 -(15, 0),  
488 -(16, 0); 1111 +(17, 0),
  1112 +(18, 0),
  1113 +(19, 0),
  1114 +(20, 8),
  1115 +(21, 8),
  1116 +(22, 190),
  1117 +(23, 190),
  1118 +(24, 190),
  1119 +(25, 22),
  1120 +(25, 23),
  1121 +(26, 22),
  1122 +(27, 22),
  1123 +(28, 22),
  1124 +(29, 22),
  1125 +(30, 22),
  1126 +(31, 22),
  1127 +(32, 22),
  1128 +(33, 22),
  1129 +(34, 22),
  1130 +(35, 22),
  1131 +(36, 23),
  1132 +(36, 24),
  1133 +(37, 22),
  1134 +(38, 22),
  1135 +(39, 23),
  1136 +(39, 24),
  1137 +(40, 22),
  1138 +(41, 22),
  1139 +(42, 22),
  1140 +(43, 22),
  1141 +(44, 22),
  1142 +(45, 22),
  1143 +(46, 22),
  1144 +(47, 22),
  1145 +(48, 22),
  1146 +(49, 23),
  1147 +(49, 24),
  1148 +(50, 22),
  1149 +(51, 22),
  1150 +(52, 22),
  1151 +(53, 22),
  1152 +(54, 22),
  1153 +(55, 22),
  1154 +(56, 22),
  1155 +(57, 22),
  1156 +(58, 22),
  1157 +(59, 22),
  1158 +(60, 22),
  1159 +(61, 22),
  1160 +(62, 22),
  1161 +(63, 22),
  1162 +(64, 22),
  1163 +(65, 22),
  1164 +(66, 22),
  1165 +(67, 22),
  1166 +(68, 22),
  1167 +(69, 23),
  1168 +(69, 24),
  1169 +(70, 22),
  1170 +(71, 22),
  1171 +(72, 22),
  1172 +(73, 22),
  1173 +(74, 22),
  1174 +(75, 24),
  1175 +(76, 22),
  1176 +(77, 22),
  1177 +(78, 22),
  1178 +(79, 22),
  1179 +(80, 22),
  1180 +(81, 24),
  1181 +(82, 22),
  1182 +(83, 22),
  1183 +(84, 24),
  1184 +(85, 22),
  1185 +(86, 22),
  1186 +(87, 24),
  1187 +(88, 24),
  1188 +(89, 22),
  1189 +(90, 23),
  1190 +(90, 24),
  1191 +(91, 22),
  1192 +(92, 22),
  1193 +(93, 22),
  1194 +(94, 23),
  1195 +(94, 24),
  1196 +(95, 24),
  1197 +(96, 22),
  1198 +(97, 22),
  1199 +(98, 22),
  1200 +(99, 22),
  1201 +(100, 22),
  1202 +(101, 22),
  1203 +(102, 22),
  1204 +(103, 22),
  1205 +(104, 22),
  1206 +(105, 22),
  1207 +(106, 22),
  1208 +(107, 22),
  1209 +(108, 22),
  1210 +(109, 22),
  1211 +(110, 22),
  1212 +(111, 22),
  1213 +(112, 22),
  1214 +(113, 22),
  1215 +(114, 22),
  1216 +(115, 22),
  1217 +(116, 22),
  1218 +(116, 23),
  1219 +(117, 22),
  1220 +(118, 22),
  1221 +(119, 22),
  1222 +(120, 22),
  1223 +(121, 22),
  1224 +(122, 22),
  1225 +(123, 22),
  1226 +(124, 22),
  1227 +(125, 22),
  1228 +(126, 22),
  1229 +(127, 22),
  1230 +(128, 22),
  1231 +(129, 23),
  1232 +(129, 24),
  1233 +(130, 22),
  1234 +(131, 22),
  1235 +(132, 24),
  1236 +(133, 23),
  1237 +(133, 24),
  1238 +(134, 24),
  1239 +(135, 23),
  1240 +(135, 24),
  1241 +(136, 22),
  1242 +(137, 22),
  1243 +(138, 22),
  1244 +(139, 23),
  1245 +(139, 24),
  1246 +(140, 22),
  1247 +(141, 22),
  1248 +(142, 22),
  1249 +(143, 22),
  1250 +(144, 22),
  1251 +(145, 22),
  1252 +(146, 22),
  1253 +(147, 22),
  1254 +(148, 22),
  1255 +(149, 22),
  1256 +(150, 22),
  1257 +(151, 22),
  1258 +(152, 22),
  1259 +(153, 22),
  1260 +(154, 22),
  1261 +(155, 22),
  1262 +(156, 22),
  1263 +(157, 22),
  1264 +(158, 22),
  1265 +(159, 22),
  1266 +(160, 22),
  1267 +(161, 22),
  1268 +(162, 22),
  1269 +(163, 24),
  1270 +(164, 22),
  1271 +(165, 22),
  1272 +(166, 24),
  1273 +(167, 22),
  1274 +(168, 22),
  1275 +(169, 22),
  1276 +(170, 22),
  1277 +(170, 23),
  1278 +(171, 24),
  1279 +(172, 22),
  1280 +(173, 22),
  1281 +(174, 22),
  1282 +(174, 23),
  1283 +(175, 22),
  1284 +(176, 22),
  1285 +(177, 22),
  1286 +(178, 22),
  1287 +(179, 23),
  1288 +(179, 24),
  1289 +(180, 22),
  1290 +(181, 22),
  1291 +(182, 22),
  1292 +(183, 22),
  1293 +(184, 22),
  1294 +(185, 22),
  1295 +(186, 23),
  1296 +(186, 24),
  1297 +(187, 22),
  1298 +(188, 8),
  1299 +(189, 8),
  1300 +(190, 8),
  1301 +(191, 21),
  1302 +(192, 21),
  1303 +(193, 21),
  1304 +(194, 21),
  1305 +(195, 21),
  1306 +(196, 21);
489 1307
490 -- -------------------------------------------------------- 1308 -- --------------------------------------------------------
491 1309
@@ -552,34 +1370,41 @@ CREATE TABLE IF NOT EXISTS `translation` ( @@ -552,34 +1370,41 @@ CREATE TABLE IF NOT EXISTS `translation` (
552 `is_translation` tinyint(1) NOT NULL DEFAULT '0', 1370 `is_translation` tinyint(1) NOT NULL DEFAULT '0',
553 PRIMARY KEY (`translation_id`), 1371 PRIMARY KEY (`translation_id`),
554 KEY `Индекс 2` (`translation_pid`) 1372 KEY `Индекс 2` (`translation_pid`)
555 -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;  
556 -  
557 --- -------------------------------------------------------- 1373 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
558 1374
559 -- 1375 --
560 --- Структура таблиці `translation_option` 1376 +-- Дамп даних таблиці `translation`
561 -- 1377 --
562 1378
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 ; 1379 +INSERT INTO `translation` (`translation_id`, `translation_pid`, `translation_key`, `is_translation`) VALUES
  1380 +(1, 0, 'telephone', 0),
  1381 +(2, 0, 'address', 1),
  1382 +(3, 2, 'address_location', 1);
569 1383
570 -- -------------------------------------------------------- 1384 -- --------------------------------------------------------
571 1385
572 -- 1386 --
573 --- Структура таблиці `translation_value` 1387 +-- Структура таблиці `translation_lang`
574 -- 1388 --
575 1389
576 -CREATE TABLE IF NOT EXISTS `translation_value` (  
577 - `translation_value_id` int(6) NOT NULL, 1390 +CREATE TABLE IF NOT EXISTS `translation_lang` (
  1391 + `translation_id` int(6) NOT NULL,
578 `translation_value` text NOT NULL, 1392 `translation_value` text NOT NULL,
579 `lang_id` int(2) NOT NULL DEFAULT '0', 1393 `lang_id` int(2) NOT NULL DEFAULT '0',
580 - PRIMARY KEY (`translation_value_id`,`lang_id`) 1394 + PRIMARY KEY (`translation_id`,`lang_id`)
581 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 1395 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
582 1396
  1397 +--
  1398 +-- Дамп даних таблиці `translation_lang`
  1399 +--
  1400 +
  1401 +INSERT INTO `translation_lang` (`translation_id`, `translation_value`, `lang_id`) VALUES
  1402 +(1, '(093) 603-27-32', 0),
  1403 +(2, 'Адреса', 1),
  1404 +(2, 'Адрес', 2),
  1405 +(3, 'вул. Срібнокільська 1а', 1),
  1406 +(3, 'ул. Срибнокильская 1а', 2);
  1407 +
583 -- -------------------------------------------------------- 1408 -- --------------------------------------------------------
584 1409
585 -- 1410 --
@@ -617,16 +1442,16 @@ INSERT INTO `user` (`id`, `username`, `lastname`, `firstname`, `middlename`, `au @@ -617,16 +1442,16 @@ INSERT INTO `user` (`id`, `username`, `lastname`, `firstname`, `middlename`, `au
617 -- 1442 --
618 1443
619 -- 1444 --
620 --- Обмеження зовнішнього ключа таблиці `translation_option` 1445 +-- Обмеження зовнішнього ключа таблиці `option`
621 -- 1446 --
622 -ALTER TABLE `translation_option`  
623 - ADD CONSTRAINT `translation_id` FOREIGN KEY (`translation_id`) REFERENCES `translation` (`translation_id`); 1447 +ALTER TABLE `option`
  1448 + ADD CONSTRAINT `FK_option_option` FOREIGN KEY (`parent_id`) REFERENCES `option` (`option_id`);
624 1449
625 -- 1450 --
626 --- Обмеження зовнішнього ключа таблиці `translation_value` 1451 +-- Обмеження зовнішнього ключа таблиці `translation_lang`
627 -- 1452 --
628 -ALTER TABLE `translation_value`  
629 - ADD CONSTRAINT `translation_value_id` FOREIGN KEY (`translation_value_id`) REFERENCES `translation_option` (`translation_value_id`); 1453 +ALTER TABLE `translation_lang`
  1454 + ADD CONSTRAINT `translation_id` FOREIGN KEY (`translation_id`) REFERENCES `translation` (`translation_id`);
630 1455
631 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 1456 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
632 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 1457 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
frontend/config/main.php
1 <?php 1 <?php
2 -use yii\web\UrlManager; 2 +
3 $params = array_merge( 3 $params = array_merge(
4 require(__DIR__ . '/../../common/config/params.php'), 4 require(__DIR__ . '/../../common/config/params.php'),
5 require(__DIR__ . '/../../common/config/params-local.php'), 5 require(__DIR__ . '/../../common/config/params-local.php'),
@@ -7,12 +7,18 @@ $params = array_merge( @@ -7,12 +7,18 @@ $params = array_merge(
7 require(__DIR__ . '/params-local.php') 7 require(__DIR__ . '/params-local.php')
8 ); 8 );
9 9
  10 +define ('IS_FRONT', TRUE);
  11 +
10 return [ 12 return [
11 'id' => 'app-frontend', 13 'id' => 'app-frontend',
12 'basePath' => dirname(__DIR__), 14 'basePath' => dirname(__DIR__),
  15 + //'bootstrap' => ['log', 'PageController'],
13 'bootstrap' => ['log'], 16 'bootstrap' => ['log'],
14 'controllerNamespace' => 'frontend\controllers', 17 'controllerNamespace' => 'frontend\controllers',
15 - 'components' => [ 18 + 'components' => [
  19 + //'PageController'=>[
  20 + // 'class' => 'frontend\controllers\PageController'
  21 + //],
16 'user' => [ 22 'user' => [
17 'identityClass' => 'common\models\User', 23 'identityClass' => 'common\models\User',
18 'enableAutoLogin' => true, 24 'enableAutoLogin' => true,
@@ -34,8 +40,7 @@ return [ @@ -34,8 +40,7 @@ return [
34 'enablePrettyUrl' => true, 40 'enablePrettyUrl' => true,
35 'showScriptName' => false, 41 'showScriptName' => false,
36 'rules' => [ 42 'rules' => [
37 - '' => 'site/index',  
38 - '<controller>/<action>' => '<controller>/<action>', 43 + //'contacts' => 'page/page'
39 ] 44 ]
40 ], 45 ],
41 ], 46 ],
frontend/controllers/OptionController.php
@@ -61,95 +61,6 @@ class OptionController extends Controller @@ -61,95 +61,6 @@ class OptionController extends Controller
61 */ 61 */
62 public function actionCreate() 62 public function actionCreate()
63 { 63 {
64 - $model = new Option();  
65 - $modellang = new OptionLang();  
66 - $modeldb = 'user';  
67 - $model_id = '10';  
68 - $fields = [['name' => 'phone', 'template' => 'input'], ['name' => 'adres', 'template' => 'input']];  
69 - $post = \Yii::$app->request->post();  
70 - if(!empty($post['Option'])) {  
71 - $ok = 1;  
72 - $parentid = null;  
73 - $models = array();  
74 - foreach($post['Option'] as $index => $option) {  
75 - if(in_array($index, array('model', 'model_id')) && $index !== 0) { continue; }  
76 - $first = 1;  
77 - foreach($option['value'] as $key => $value) {  
78 - $models[$index][$key] = new Option();  
79 - $models[$index][$key]->model = $post['Option']['model'];  
80 - $models[$index][$key]->model_id = $post['Option']['model_id'];  
81 - $models[$index][$key]->template = $option['template'];  
82 - $models[$index][$key]->name = $key;  
83 - if(!$first) {  
84 - $models[$index][$key]->parent_id = $parentid;  
85 - }  
86 - $modelslang[$index][$key][0] = new OptionLang();  
87 - if(!empty($value) && $models[$index][$key]->save()) {  
88 - if($first) {  
89 - $parentid = $models[$index][$key]->option_id;  
90 - }  
91 - $modelslang[$index][$key][0]->id = $models[$index][$key]->option_id;  
92 - $modelslang[$index][$key][0]->lang_id = 0;  
93 - $modelslang[$index][$key][0]->value = $value;  
94 - if($modelslang[$index][$key][0]->save()) {  
95 - if(!empty($option['lang'][$key])) {  
96 - foreach($option['lang'][$key] as $code => $lang) {  
97 - if(!empty($lang)) {  
98 - $modelslang[$index][$key][$code] = new OptionLang();  
99 - $modelslang[$index][$key][$code]->id = $models[$index][$key]->option_id;  
100 - $modelslang[$index][$key][$code]->lang_id = $code;  
101 - $modelslang[$index][$key][$code]->value = $lang;  
102 - if(!$modelslang[$index][$key][$code]->save()) {  
103 - $ok = 0;  
104 - }  
105 - }  
106 - }  
107 - }  
108 - }  
109 - } else {  
110 - $models[$index][$key]->validate();  
111 - $modelslang[$index][$key][0]->validate();  
112 - $modelslang[$index][$key][0];  
113 - if(!empty($option['lang'][$key])) {  
114 - foreach($option['lang'][$key] as $code => $lang) {  
115 - if(!empty($lang)) {  
116 - $modelslang[$index][$key][$code] = new OptionLang();  
117 - $modelslang[$index][$key][$code]->id = $models[$index][$key]->option_id;  
118 - $modelslang[$index][$key][$code]->lang_id = $code;  
119 - $modelslang[$index][$key][$code]->value = $lang;  
120 - }  
121 - }  
122 - }  
123 - $ok = 0;  
124 - }  
125 - $first = 0;  
126 - }  
127 - }  
128 - if($ok) {  
129 - return $this->redirect(['view', 'id' => $parentid]);  
130 - } else {  
131 - return $this->render('create', [  
132 - 'model' => $model,  
133 - 'models' => $models,  
134 - 'modellang' => $modelslang,  
135 - 'modeldb' => $modeldb,  
136 - 'model_id' => $model_id,  
137 - 'fields' => $fields  
138 - ]);  
139 - }  
140 - }  
141 - if ($model->load(Yii::$app->request->post()) && $model->save()) {  
142 - return $this->redirect(['view', 'id' => $model->option_id]);  
143 - } else {  
144 - return $this->render('create', [  
145 - 'model' => $model,  
146 - 'modeldb' => $modeldb,  
147 - 'model_id' => $model_id,  
148 - 'fields' => $fields  
149 - ]);  
150 - }  
151 - }  
152 - public function actionTest() {  
153 $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text'], ['name' => 'adres', 'template' => 'text']]); 64 $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text'], ['name' => 'adres', 'template' => 'text']]);
154 if($form[0]['success'] == false) { 65 if($form[0]['success'] == false) {
155 return $this->render('create', ['forms' => $form]); 66 return $this->render('create', ['forms' => $form]);
@@ -157,14 +68,7 @@ class OptionController extends Controller @@ -157,14 +68,7 @@ class OptionController extends Controller
157 return $this->redirect(['index']); 68 return $this->redirect(['index']);
158 } 69 }
159 } 70 }
160 - public function actionTest2($id) {  
161 - $form[0] = Option::change($id, \Yii::$app->request->post(), 'User', 10);  
162 - if($form[0]['success'] == false) {  
163 - return $this->render('update', ['forms' => $form]);  
164 - } else {  
165 - return $this->redirect(['view', 'id' => $id]);  
166 - }  
167 - } 71 +
168 /** 72 /**
169 * Updates an existing Option model. 73 * Updates an existing Option model.
170 * If update is successful, the browser will be redirected to the 'view' page. 74 * If update is successful, the browser will be redirected to the 'view' page.
@@ -173,64 +77,12 @@ class OptionController extends Controller @@ -173,64 +77,12 @@ class OptionController extends Controller
173 */ 77 */
174 public function actionUpdate($id) 78 public function actionUpdate($id)
175 { 79 {
176 - $models[$id] = Option::findOne($id);  
177 - $modellang[$id] = array();  
178 - $langs = OptionLang::findAll(['id' => $id]);  
179 - foreach($langs as $lang) {  
180 - $modellang[$id][$lang->lang_id] = $lang;  
181 - }  
182 - $children = (new Option())->find()->where(['parent_id' => $id])->all();  
183 - foreach($children as $child) {  
184 - $models[$child->option_id] = $child;  
185 - $modellang[$child->option_id] = array();  
186 - $langs = OptionLang::findAll(['id' =>$child->option_id]);  
187 - foreach($langs as $lang) {  
188 - $modellang[$child->option_id][$lang->lang_id] = $lang;  
189 - }  
190 - }  
191 - $modeldb = 'user';  
192 - $model_id = '10';  
193 - $fields = [['name' => 'phone', 'template' => 'input'], ['name' => 'adres', 'template' => 'input']];  
194 - $post = \Yii::$app->request->post();  
195 - $ok = 1;  
196 - if(!empty($post)) {  
197 - foreach($post['Option'] as $key => $option) {  
198 - if(in_array($key, array('model', 'model_id'))) { continue; }  
199 - $modellang[$key][0]->value = $option['value'][$models[$key]->name];  
200 - if(!$modellang[$key][0]->save()) {  
201 - $ok = 0;  
202 - }  
203 - foreach($option['lang'] as $lang_id => $lang) {  
204 - if(empty($modellang[$key][$lang_id])) {  
205 - $modellang[$key][$lang_id] = new OptionLang();  
206 - $modellang[$key][$lang_id]->id = $models[$key]->option_id;  
207 - $modellang[$key][$lang_id]->lang_id = $lang_id;  
208 - $modellang[$key][$lang_id]->value = $lang;  
209 - } else {  
210 - $modellang[$key][$lang_id]->value = $lang;  
211 - }  
212 - if(!$modellang[$key][$lang_id]->save()) {  
213 - $ok = 0;  
214 - }  
215 - }  
216 - }  
217 - if($ok) {  
218 - return $this->redirect(['view', 'id' => $id]);  
219 - } else {  
220 - return $this->render('update', [  
221 - 'models' => $models,  
222 - 'modellang' => $modellang,  
223 - 'modeldb' => $modeldb,  
224 - 'model_id' => $model_id  
225 - ]);  
226 - } 80 + $form[0] = Option::change($id, \Yii::$app->request->post(), 'User', 10);
  81 + if($form[0]['success'] == false) {
  82 + return $this->render('update', ['forms' => $form]);
  83 + } else {
  84 + return $this->redirect(['view', 'id' => $id]);
227 } 85 }
228 - return $this->render('update', [  
229 - 'models' => $models,  
230 - 'modellang' => $modellang,  
231 - 'modeldb' => $modeldb,  
232 - 'model_id' => $model_id  
233 - ]);  
234 } 86 }
235 87
236 /** 88 /**
@@ -241,7 +93,23 @@ class OptionController extends Controller @@ -241,7 +93,23 @@ class OptionController extends Controller
241 */ 93 */
242 public function actionDelete($id) 94 public function actionDelete($id)
243 { 95 {
244 - $this->findModel($id)->delete(); 96 + $model = $this->findModel($id);
  97 + $children = $model->hasMany(Option::className(), ['parent_id' => 'option_id'])->all();
  98 + $langs = array();
  99 + if(!empty($children)) {
  100 + foreach($children as $child) {
  101 + $langs = OptionLang::findAll(['id' => $child->option_id]);
  102 + foreach($langs as $lang) {
  103 + $lang->delete();
  104 + }
  105 + $child->delete();
  106 + }
  107 + }
  108 + $langs = OptionLang::findAll(['id' => $id]);
  109 + foreach($langs as $lang) {
  110 + $lang->delete();
  111 + }
  112 + $model->delete();
245 113
246 return $this->redirect(['index']); 114 return $this->redirect(['index']);
247 } 115 }
frontend/controllers/SiteController.php
@@ -78,38 +78,6 @@ class SiteController extends Controller @@ -78,38 +78,6 @@ class SiteController extends Controller
78 */ 78 */
79 public function actionIndex() 79 public function actionIndex()
80 { 80 {
81 - // парсим URL, находим контроллер и подключаем view-файл  
82 - if (($url = substr(yii::$app->request->url, 1)) == '')  
83 - {  
84 - $url = '/';  
85 - }  
86 -  
87 - // находим страницу  
88 - if ($page = Page::getPageByUrl ($url))  
89 - {  
90 - // проверяем или не закрыта и есть все файлы  
91 - if (Page::isShow ($page)  
92 - && $page['template_file'] != NULL  
93 - && is_file (yii::$app->viewPath.'/'.$page['template_file'].'.php'))  
94 - {  
95 - // загружаем роуты  
96 -/*  
97 - yii::$app->UrlManager->rules += [  
98 - 'maгаз' => 'shop/categoty',  
99 - ];  
100 -*/  
101 -  
102 - list ($controller) = explode ('/', $page['template_file']);  
103 -  
104 - // подключаем  
105 - return Yii::$app->runAction($page['template_file'], [  
106 - 'controller_name' => $controller,  
107 - 'page_id' => $page['page_id'],  
108 - 'template_file' => $page['template_file'],  
109 - ]);  
110 - }  
111 - }  
112 -  
113 return $this->render('index'); 81 return $this->render('index');
114 } 82 }
115 83