Commit 4253cbec26bd4a4f64cdcd4b4883f59f62d8e7c6

Authored by root
0 parents

first commit

Showing 1232 changed files with 85997 additions and 0 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 1232 files are displayed.

.bowerrc 0 → 100755
  1 +++ a/.bowerrc
  1 +{
  2 + "directory" : "vendor/bower"
  3 +}
... ...
.gitignore 0 → 100755
  1 +++ a/.gitignore
  1 +# yii console command
  2 +/yii
  3 +
  4 +# phpstorm project files
  5 +.idea
  6 +
  7 +# netbeans project files
  8 +nbproject
  9 +
  10 +# zend studio for eclipse project files
  11 +.buildpath
  12 +.project
  13 +.settings
  14 +
  15 +# windows thumbnail cache
  16 +Thumbs.db
  17 +
  18 +# composer vendor dir
  19 +/vendor
  20 +
  21 +# composer itself is not needed
  22 +composer.phar
  23 +
  24 +# Mac DS_Store Files
  25 +.DS_Store
  26 +
  27 +# phpunit itself is not needed
  28 +phpunit.phar
  29 +# local phpunit config
  30 +/phpunit.xml
  31 +
  32 +/storage
  33 +/common/config/main-local.php
  34 +/common/config/params-local.php
  35 +/backend/config/main-local.php
  36 +/backend/config/params-local.php
  37 +/backend/runtime/
  38 +/frontend/config/main-local.php
  39 +/frontend/config/params-local.php
  40 +/frontend/runtime/
  41 +/backend/web/assets/
  42 +/frontend/web/assets/
  43 +/frontend/web/upload/
  44 +/frontend/web/css/node_modules/
  45 +/frontend/web/images/
  46 +/frontend/views/вертска
  47 +composer.lock
  48 +
  49 +tests/_output/*
  50 +/common/modules/_comment/
  51 +Будет удалено common/modules/comment/
... ...
.htaccess 0 → 100755
  1 +++ a/.htaccess
  1 +AddDefaultCharset utf-8
  2 +<IfModule mod_rewrite.c>
  3 +
  4 +
  5 + Options +FollowSymlinks
  6 +
  7 + RewriteEngine On
  8 +
  9 +</IfModule>
  10 +
  11 +<IfModule mod_rewrite.c>
  12 +
  13 + RewriteBase /
  14 + # deal with admin first
  15 +
  16 +
  17 + Redirect 301 /Kak_vibrat_ryuksak /
  18 + Redirect 301 /products/ryukzaki /catalog/ryukzaki
  19 + Redirect 301 /products/koshel_ki /catalog/koshelki
  20 + Redirect 301 /products/nesessery​ /catalog/nesessery
  21 + Redirect 301 /products/sumki /catalog/sumki
  22 + Redirect 301 /products/germochehly /catalog/germocehly
  23 +
  24 + RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT]
  25 + RewriteRule ^generator/(.*)?$ /generator/$1 [L,PT]
  26 +
  27 + RewriteCond %{REQUEST_URI} ^/(admin)
  28 +
  29 +
  30 +
  31 + RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
  32 +
  33 + RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
  34 +
  35 + RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L]
  36 +
  37 + RewriteRule ^admin/images/(.*)$ backend/web/images/$1 [L]
  38 +
  39 + RewriteRule ^admin/fonts/(.*)$ backend/web/fonts/$1 [L]
  40 +
  41 +
  42 +
  43 +
  44 +
  45 + RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js|images|fonts)/
  46 +
  47 + RewriteCond %{REQUEST_URI} ^/(admin)
  48 +
  49 + RewriteRule ^.*$ backend/web/index.php [L]
  50 +
  51 +
  52 + RewriteCond %{REQUEST_URI} ^/(assets|css)
  53 +
  54 + RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
  55 +
  56 + RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
  57 +
  58 + RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
  59 +
  60 + RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
  61 +
  62 + RewriteRule ^libraries/(.*)$ frontend/web/libraries/$1 [L]
  63 +
  64 + RewriteRule ^img/(.*)$ frontend/web/img/$1 [L]
  65 +
  66 + RewriteRule ^files/(.*)$ frontend/web/files/$1 [L]
  67 +
  68 + RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L]
  69 +
  70 + RewriteRule robots.txt$ frontend/web/robots.txt [L]
  71 +
  72 + RewriteRule sitemap.xml$ frontend/web/sitemap.xml [L]
  73 +
  74 + RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|txt|js|images|fonts|img|files)/
  75 +
  76 + RewriteCond %{REQUEST_URI} !index.php
  77 +
  78 + RewriteCond %{REQUEST_FILENAME} !-f [OR]
  79 +
  80 + RewriteCond %{REQUEST_FILENAME} !-d
  81 +
  82 +
  83 + RewriteCond %{HTTP_HOST} ^www\.(.*)
  84 + RewriteRule ^(.*)$ frontend/web/index.php
  85 +
  86 +
  87 + RewriteCond %{HTTP_HOST} ^([^www].*)$
  88 + RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  89 +
  90 + RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s]
  91 + RewriteRule /$ /%1 [R,L]
  92 +
  93 +
  94 +
  95 +# RewriteCond %{HTTP_HOST} ^([^www].*)$
  96 +# RewriteRule ^(.*)$ http://www.%1/$1 [R=301]
  97 +
  98 +</IfModule>
  99 +
  100 +#для возможности загрузки файлов парсера
  101 +<IfModule mod_php5.c>
  102 + php_value upload_max_filesize 20M
  103 + php_value post_max_size 30M
  104 +</IfModule>
  105 +
  106 +
  107 +# кеширование в браузере на стороне пользователя
  108 +
  109 +<IfModule mod_expires.c>
  110 + ExpiresActive On
  111 + ExpiresDefault "access 7 days"
  112 + ExpiresByType application/javascript "access plus 1 year"
  113 + ExpiresByType text/javascript "access plus 1 year"
  114 + ExpiresByType text/css "access plus 1 year"
  115 + ExpiresByType text/html "access plus 7 day"
  116 + ExpiresByType text/x-javascript "access 1 year"
  117 + ExpiresByType image/gif "access plus 1 year"
  118 + ExpiresByType image/jpeg "access plus 1 year"
  119 + ExpiresByType image/png "access plus 1 year"
  120 + ExpiresByType image/jpg "access plus 1 year"
  121 + ExpiresByType image/x-icon "access 1 year"
  122 + ExpiresByType application/x-shockwave-flash "access 1 year"
  123 + </IfModule>
  124 +<IfModule mod_deflate.c>
  125 +AddOutputFilterByType DEFLATE text/plain
  126 +AddOutputFilterByType DEFLATE text/html
  127 +AddOutputFilterByType DEFLATE text/xml
  128 +AddOutputFilterByType DEFLATE text/css
  129 +AddOutputFilterByType DEFLATE application/xml
  130 +AddOutputFilterByType DEFLATE application/xhtml+xml
  131 +AddOutputFilterByType DEFLATE application/rss+xml
  132 +AddOutputFilterByType DEFLATE application/javascript
  133 +AddOutputFilterByType DEFLATE application/x-javascript
  134 +BrowserMatch ^Mozilla/4 gzip-only-text/html
  135 +BrowserMatch ^Mozilla/4\.0[678] no-gzip
  136 +BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  137 +Header append Vary User-Agent
  138 +RewriteEngine On
  139 +AddEncoding gzip .gz
  140 +RewriteCond %{HTTP:Accept-encoding} gzip
  141 +RewriteCond %{REQUEST_FILENAME}.gz -f
  142 +RewriteRule ^(.*)$ $1.gz [QSA,L]
  143 +</IfModule>
  144 +# Cache-Control
  145 +<ifModule mod_headers.c>
  146 +# 30 дней
  147 + <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
  148 + Header set Cache-Control "max-age=2592000, public"
  149 + </filesMatch>
  150 + # 30 дней
  151 + <filesMatch "\.(css|js)$">
  152 + Header set Cache-Control "max-age=2592000, public"
  153 + </filesMatch>
  154 + # 2 дня
  155 + <filesMatch "\.(xml|txt)$">
  156 + Header set Cache-Control "max-age=172800, public, must-revalidate"
  157 + </filesMatch>
  158 + # 1 день
  159 + <filesMatch "\.(html|htm|php)$">
  160 + Header set Cache-Control "max-age=172800, private, must-revalidate"
  161 + </filesMatch>
  162 +</ifModule>
  163 +
  164 +#Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE
  165 +<IfModule mod_setenvif.c>
  166 +BrowserMatch "MSIE" force-no-vary
  167 +BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary
  168 +</IfModule>
... ...
LICENSE.md 0 → 100755
  1 +++ a/LICENSE.md
  1 +The Yii framework is free software. It is released under the terms of
  2 +the following BSD License.
  3 +
  4 +Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
  5 +All rights reserved.
  6 +
  7 +Redistribution and use in source and binary forms, with or without
  8 +modification, are permitted provided that the following conditions
  9 +are met:
  10 +
  11 + * Redistributions of source code must retain the above copyright
  12 + notice, this list of conditions and the following disclaimer.
  13 + * Redistributions in binary form must reproduce the above copyright
  14 + notice, this list of conditions and the following disclaimer in
  15 + the documentation and/or other materials provided with the
  16 + distribution.
  17 + * Neither the name of Yii Software LLC nor the names of its
  18 + contributors may be used to endorse or promote products derived
  19 + from this software without specific prior written permission.
  20 +
  21 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24 +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25 +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26 +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27 +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28 +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30 +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31 +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32 +POSSIBILITY OF SUCH DAMAGE.
... ...
README.md 0 → 100755
  1 +++ a/README.md
  1 +Yii 2 Advanced Project Template
  2 +===============================
  3 +
  4 +Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
  5 +developing complex Web applications with multiple tiers.
  6 +
  7 +The template includes three tiers: front end, back end, and console, each of which
  8 +is a separate Yii application.
  9 +
  10 +The template is designed to work in a team development environment. It supports
  11 +deploying the application in different environments.
  12 +
  13 +Documentation is at [docs/guide/README.md](docs/guide/README.md).
  14 +
  15 +[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-advanced/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-advanced)
  16 +[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-advanced/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-advanced)
  17 +[![Build Status](https://travis-ci.org/yiisoft/yii2-app-advanced.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-advanced)
  18 +
  19 +DIRECTORY STRUCTURE
  20 +-------------------
  21 +
  22 +```
  23 +common
  24 + config/ contains shared configurations
  25 + mail/ contains view files for e-mails
  26 + models/ contains model classes used in both backend and frontend
  27 +console
  28 + config/ contains console configurations
  29 + controllers/ contains console controllers (commands)
  30 + migrations/ contains database migrations
  31 + models/ contains console-specific model classes
  32 + runtime/ contains files generated during runtime
  33 +backend
  34 + assets/ contains application assets such as JavaScript and CSS
  35 + config/ contains backend configurations
  36 + controllers/ contains Web controller classes
  37 + models/ contains backend-specific model classes
  38 + runtime/ contains files generated during runtime
  39 + views/ contains view files for the Web application
  40 + web/ contains the entry script and Web resources
  41 +frontend
  42 + assets/ contains application assets such as JavaScript and CSS
  43 + config/ contains frontend configurations
  44 + controllers/ contains Web controller classes
  45 + models/ contains frontend-specific model classes
  46 + runtime/ contains files generated during runtime
  47 + views/ contains view files for the Web application
  48 + web/ contains the entry script and Web resources
  49 + widgets/ contains frontend widgets
  50 +vendor/ contains dependent 3rd-party packages
  51 +environments/ contains environment-based overrides
  52 +tests contains various tests for the advanced application
  53 + codeception/ contains tests developed with Codeception PHP Testing Framework
  54 +```
... ...
backend/assets/AdminLteAsset.php 0 → 100755
  1 +++ a/backend/assets/AdminLteAsset.php
  1 +<?php
  2 +/**
  3 + * @link http://www.yiiframework.com/
  4 + * @copyright Copyright (c) 2008 Yii Software LLC
  5 + * @license http://www.yiiframework.com/license/
  6 + */
  7 +
  8 +namespace backend\assets;
  9 +
  10 +use yii\web\AssetBundle;
  11 +
  12 +/**
  13 + * @author Qiang Xue <qiang.xue@gmail.com>
  14 + * @since 2.0
  15 + */
  16 +class AdminLteAsset extends AssetBundle
  17 +{
  18 + public $sourcePath = '@bower/';
  19 + public $css = [
  20 + 'admin-lte/dist/css/AdminLTE.css',
  21 + 'admin-lte/dist/css/skins/_all-skins.css'
  22 + ];
  23 +
  24 + public $js = [
  25 + 'admin-lte/dist/js/app.js',
  26 +
  27 + ];
  28 + public $depends = [
  29 + 'yii\web\YiiAsset',
  30 + 'common\modules\file\FileUploadAsset',
  31 + 'yii\bootstrap\BootstrapPluginAsset',
  32 + 'backend\assets\FontAwesomeAsset',
  33 +
  34 + ];
  35 +}
0 36 \ No newline at end of file
... ...
backend/assets/AppAsset.php 0 → 100755
  1 +++ a/backend/assets/AppAsset.php
  1 +<?php
  2 +/**
  3 + * @link http://www.yiiframework.com/
  4 + * @copyright Copyright (c) 2008 Yii Software LLC
  5 + * @license http://www.yiiframework.com/license/
  6 + */
  7 +
  8 +namespace backend\assets;
  9 +
  10 +use yii\web\AssetBundle;
  11 +
  12 +/**
  13 + * @author Qiang Xue <qiang.xue@gmail.com>
  14 + * @since 2.0
  15 + */
  16 +class AppAsset extends AssetBundle
  17 +{
  18 + public $basePath = '@webroot';
  19 + public $baseUrl = '@web';
  20 + public $css = [
  21 + 'css/site.css',
  22 + ];
  23 + public $js = [
  24 + 'js/fieldWidget.js',
  25 + 'js/site.js',
  26 + ];
  27 + public $depends = [
  28 + 'yii\web\YiiAsset',
  29 + 'yii\bootstrap\BootstrapAsset',
  30 + ];
  31 +}
... ...
backend/assets/FontAwesomeAsset.php 0 → 100755
  1 +++ a/backend/assets/FontAwesomeAsset.php
  1 +<?php
  2 +namespace backend\assets;
  3 +
  4 +use yii\web\AssetBundle;
  5 +
  6 +class FontAwesomeAsset extends AssetBundle
  7 +{
  8 + // The files are not web directory accessible, therefore we need
  9 + // to specify the sourcePath property. Notice the @vendor alias used.
  10 + public $sourcePath = '@vendor/fortawesome/font-awesome';
  11 + public $css = [
  12 + 'css/font-awesome.css',
  13 + ];
  14 +}
0 15 \ No newline at end of file
... ...
backend/config/.gitignore 0 → 100755
  1 +++ a/backend/config/.gitignore
  1 +main-local.php
  2 +params-local.php
0 3 \ No newline at end of file
... ...
backend/config/bootstrap.php 0 → 100755
  1 +++ a/backend/config/bootstrap.php
  1 +<?php
  2 +Yii::setAlias('@uploadDir', dirname(dirname(__DIR__)) . '/storage/sync');
  3 +Yii::setAlias('@uploadFileProducts', 'products.csv');
  4 +Yii::setAlias('@uploadFilePrices', 'file_1.csv');
  5 +Yii::setAlias('@uploadFilePricesAway', 'price_product_away.csv');
  6 +Yii::setAlias('@uploadFilePricesDuplicate', 'price_duplicate.csv');
  7 +Yii::setAlias('@uploadFilePricesNoVariant', 'price_no_variant.csv');
  8 +
  9 +Yii::setAlias('@productsDir', '@storage/products');
0 10 \ No newline at end of file
... ...
backend/config/main.php 0 → 100755
  1 +++ a/backend/config/main.php
  1 +<?php
  2 +use common\behaviors\ArtBoxAccessBehavior;
  3 +$params = array_merge(
  4 + require(__DIR__ . '/../../common/config/params.php'),
  5 + require(__DIR__ . '/../../common/config/params-local.php'),
  6 + require(__DIR__ . '/params.php'),
  7 + require(__DIR__ . '/params-local.php')
  8 +);
  9 +
  10 +return [
  11 + 'id' => 'app-backend',
  12 + 'basePath' => dirname(__DIR__),
  13 + 'controllerMap' => [
  14 + 'elfinder' => [
  15 + 'class' => 'mihaildev\elfinder\Controller',
  16 + 'access' => ['@'], //глобальный доступ к фаил менеджеру @ - для авторизорованных , ? - для гостей , чтоб открыть всем ['@', '?']
  17 + 'disabledCommands' => ['netmount'], //отключение ненужных команд https://github.com/Studio-42/elFinder/wiki/Client-configuration-options#commands
  18 + 'roots' => [
  19 + [
  20 + 'class' => 'mihaildev\elfinder\volume\UserPath',
  21 + 'path' => '../../storage/user_{id}',
  22 + 'name' => 'My Documents'
  23 + ],
  24 + ],
  25 + 'watermark' => [
  26 + 'source' => __DIR__.'/logo.png', // Path to Water mark image
  27 + 'marginRight' => 5, // Margin right pixel
  28 + 'marginBottom' => 5, // Margin bottom pixel
  29 + 'quality' => 95, // JPEG image save quality
  30 + 'transparency' => 70, // Water mark image transparency ( other than PNG )
  31 + 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
  32 + 'targetMinPixel' => 200 // Target image minimum pixel size
  33 + ]
  34 + ],
  35 + 'artbox-comments' => [
  36 + 'class' => 'common\modules\comment\controllers\ManageController',
  37 + 'viewPath' => '@common/modules/comment/views/manage',
  38 + ],
  39 + ],
  40 + 'layout' => 'admin',
  41 + 'controllerNamespace' => 'backend\controllers',
  42 + 'bootstrap' => ['log'],
  43 + 'as AccessBehavior' => [
  44 + 'class' => ArtBoxAccessBehavior::className(),
  45 + 'rules' =>
  46 + [
  47 + 'permit/access' =>
  48 + [
  49 + [
  50 + 'actions' => ['role', 'permission','add-role', 'update-role','add-permission', 'update-permission' ],
  51 + 'allow' => true,
  52 + ]
  53 + ],
  54 + 'site' =>
  55 + [
  56 + [
  57 + 'actions' => ['login', 'error','logout',],
  58 + 'allow' => true,
  59 + ],
  60 + [
  61 + 'actions' => ['index'],
  62 + 'allow' => true,
  63 + 'roles' => ['@'],
  64 + ]
  65 +
  66 + ],
  67 + 'file/uploader' =>[
  68 + [
  69 + 'actions' => ['images-upload'],
  70 + 'allow' => true,
  71 + ]
  72 + ],
  73 + 'elfinder' => [
  74 + [
  75 + 'actions' => ['manager','connect'],
  76 + 'allow' => true,
  77 + ]
  78 + ]
  79 +
  80 +
  81 + ]
  82 + ],
  83 + 'modules' => [
  84 + 'permit' => [
  85 + 'class' => 'developeruz\db_rbac\Yii2DbRbac',
  86 + 'params' => [
  87 + 'userClass' => 'backend\models\User'
  88 + ]
  89 + ],
  90 +
  91 + 'rubrication' => [
  92 + 'class' => 'common\modules\rubrication\Module',
  93 + 'types' => [
  94 + 'string' => 'Strings',
  95 + 'float' => 'Floating number',
  96 + 'int' => 'Integer number',
  97 + 'link' => 'Web-link',
  98 + ]
  99 + ],
  100 + 'product' => [
  101 + 'class' => 'common\modules\product\Module'
  102 + ],
  103 + 'gridview' => [
  104 + 'class' => '\kartik\grid\Module'
  105 + ],
  106 + 'artbox-comment' => [
  107 + 'class' => 'common\modules\comment\Module',
  108 + 'userIdentityClass' => 'common\models\Customer',
  109 + ],
  110 + ],
  111 + 'components' => [
  112 + 'authManager' => [
  113 + 'class' => 'yii\rbac\DbManager',
  114 + ],
  115 + 'user' => [
  116 + 'identityClass' => 'common\models\User',
  117 + 'enableAutoLogin' => true,
  118 + ],
  119 + 'log' => [
  120 + 'traceLevel' => YII_DEBUG ? 3 : 0,
  121 + 'targets' => [
  122 + [
  123 + 'class' => 'yii\log\FileTarget',
  124 + 'levels' => ['error', 'warning'],
  125 + ],
  126 + ],
  127 + ],
  128 + 'imageCache' => [
  129 + 'class' => 'iutbay\yii2imagecache\ImageCache',
  130 + 'sourcePath' => '@storage',
  131 + 'sourceUrl' => '/storage',
  132 + 'thumbsPath' => '@storage/thumbs',
  133 + 'thumbsUrl' => '/storage/thumbs',
  134 +
  135 + 'sizes' => [
  136 + 'slider' => [720, 340],
  137 + ],
  138 + ],
  139 + 'errorHandler' => [
  140 + 'errorAction' => 'site/error',
  141 + ],
  142 + 'request'=>[
  143 + 'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i',
  144 + 'csrfParam' => '_backendCSRF',
  145 +
  146 + 'class' => 'common\components\Request',
  147 +
  148 + 'web'=> '/backend/web',
  149 +
  150 + 'adminUrl' => '/admin'
  151 +
  152 + ],
  153 + 'urlManager' => [
  154 + 'baseUrl' => '/admin',
  155 + 'enablePrettyUrl' => true,
  156 + 'showScriptName' => false,
  157 + 'rules' => [
  158 + 'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'slider-image/<action>',
  159 + 'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>' => 'slider-image/<action>',
  160 + 'rubrication/tax-group/<level:[0-9]+>' => 'rubrication/tax-group',
  161 + 'rubrication/tax-group/<action>/<level:[0-9]+>/<id:[A-Za-z0-9_-]+>' => 'rubrication/tax-group/<action>',
  162 + 'rubrication/tax-group/<action>/<level:[0-9]+>' => 'rubrication/tax-group/<action>',
  163 + 'product/manage/<action>' => 'product/manage/<action>',
  164 + 'product/<controller>/<action>/<product_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'product/<controller>/<action>',
  165 + 'product/<controller>/<action>/<product_id:[A-Za-z0-9_-]+>/' => 'product/<controller>/<action>',
  166 + 'product/<action>/<product_id:[A-Za-z0-9_-]+>' => 'product/<action>',
  167 + 'seo-dynamic/<action>/<seo_category_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'seo-dynamic/<action>',
  168 + 'seo-dynamic/<action>/<seo_category_id:[A-Za-z0-9_-]+>' => 'seo-dynamic/<action>',
  169 + ]
  170 + ]
  171 +
  172 + ],
  173 + 'params' => $params,
  174 +];
... ...
backend/config/params.php 0 → 100755
  1 +++ a/backend/config/params.php
  1 +<?php
  2 +return [
  3 + 'adminEmail' => 'admin@example.com',
  4 +];
... ...
backend/controllers/ArticlesController.php 0 → 100755
  1 +++ a/backend/controllers/ArticlesController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Articles;
  7 +use common\models\ArticlesSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +use yii\web\UploadedFile;
  13 +
  14 +/**
  15 + * ArticlesController implements the CRUD actions for Articles model.
  16 + */
  17 +class ArticlesController extends Controller
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function behaviors()
  23 + {
  24 + return [
  25 + 'access'=>[
  26 + 'class' => AccessBehavior::className(),
  27 + 'rules' =>
  28 + ['site' =>
  29 + [
  30 + [
  31 + 'actions' => ['login', 'error'],
  32 + 'allow' => true,
  33 + ]
  34 + ]
  35 + ]
  36 + ],
  37 + 'verbs' => [
  38 + 'class' => VerbFilter::className(),
  39 + 'actions' => [
  40 + 'delete' => ['POST'],
  41 + ],
  42 + ],
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * Lists all Articles models.
  48 + * @return mixed
  49 + */
  50 + public function actionIndex()
  51 + {
  52 + $searchModel = new ArticlesSearch();
  53 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  54 +
  55 + return $this->render('index', [
  56 + 'searchModel' => $searchModel,
  57 + 'dataProvider' => $dataProvider,
  58 + ]);
  59 + }
  60 +
  61 + /**
  62 + * Displays a single Articles model.
  63 + * @param integer $id
  64 + * @return mixed
  65 + */
  66 + public function actionView($id)
  67 + {
  68 + return $this->render('view', [
  69 + 'model' => $this->findModel($id),
  70 + ]);
  71 + }
  72 +
  73 + /**
  74 + * Creates a new Articles model.
  75 + * If creation is successful, the browser will be redirected to the 'view' page.
  76 + * @return mixed
  77 + */
  78 + public function actionCreate()
  79 + {
  80 + $model = new Articles();
  81 +
  82 + if ($model->load(Yii::$app->request->post())) {
  83 +
  84 + if ( ($image = UploadedFile::getInstance($model, 'image')) ) {
  85 + $model->image = $image->name;
  86 + }
  87 +
  88 + $imgDir = Yii::getAlias('@storage/articles/');
  89 +
  90 + if(!is_dir($imgDir)) {
  91 + mkdir($imgDir, 0755, true);
  92 + }
  93 + if ($model->save() && $image) {
  94 + $image->saveAs(Yii::getAlias('@storage/articles/' . $image->name));
  95 + }
  96 +
  97 + return $this->redirect(['view', 'id' => $model->id]);
  98 + } else {
  99 + return $this->render('create', [
  100 + 'model' => $model,
  101 + ]);
  102 + }
  103 + }
  104 +
  105 + /**
  106 + * Updates an existing Articles model.
  107 + * If update is successful, the browser will be redirected to the 'view' page.
  108 + * @param integer $id
  109 + * @return mixed
  110 + */
  111 + public function actionUpdate($id)
  112 + {
  113 + $model = $this->findModel($id);
  114 +
  115 + if ($model->load(Yii::$app->request->post())) {
  116 + if ( ($image = UploadedFile::getInstance($model, 'image')) ) {
  117 + $model->image = $image->name;
  118 + }
  119 +
  120 + $imgDir = Yii::getAlias('@storage/articles/');
  121 +
  122 + if(!is_dir($imgDir)) {
  123 + mkdir($imgDir, 0755, true);
  124 + }
  125 + if ($model->save() && $image) {
  126 + $image->saveAs(Yii::getAlias('@storage/articles/' . $image->name));
  127 + }
  128 +
  129 + return $this->redirect(['view', 'id' => $model->id]);
  130 + } else {
  131 + return $this->render('update', [
  132 + 'model' => $model,
  133 + ]);
  134 + }
  135 + }
  136 +
  137 + /**
  138 + * Deletes an existing Articles model.
  139 + * If deletion is successful, the browser will be redirected to the 'index' page.
  140 + * @param integer $id
  141 + * @return mixed
  142 + */
  143 + public function actionDelete($id)
  144 + {
  145 + $this->findModel($id)->delete();
  146 +
  147 + return $this->redirect(['index']);
  148 + }
  149 +
  150 + /**
  151 + * Finds the Articles model based on its primary key value.
  152 + * If the model is not found, a 404 HTTP exception will be thrown.
  153 + * @param integer $id
  154 + * @return Articles the loaded model
  155 + * @throws NotFoundHttpException if the model cannot be found
  156 + */
  157 + protected function findModel($id)
  158 + {
  159 + if (($model = Articles::findOne($id)) !== null) {
  160 + return $model;
  161 + } else {
  162 + throw new NotFoundHttpException('The requested page does not exist.');
  163 + }
  164 + }
  165 +}
... ...
backend/controllers/BannerController.php 0 → 100755
  1 +++ a/backend/controllers/BannerController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use common\modules\file\widgets\ImageUploader;
  6 +use Yii;
  7 +use common\models\Banner;
  8 +use common\models\BannerSearch;
  9 +use yii\web\Controller;
  10 +use yii\web\NotFoundHttpException;
  11 +use yii\filters\VerbFilter;
  12 +use developeruz\db_rbac\behaviors\AccessBehavior;
  13 +/**
  14 + * BannerController implements the CRUD actions for Banner model.
  15 + */
  16 +class BannerController extends Controller
  17 +{
  18 + /**
  19 + * @inheritdoc
  20 + */
  21 + public function behaviors()
  22 + {
  23 + return [
  24 + 'access'=>[
  25 + 'class' => AccessBehavior::className(),
  26 + 'rules' =>
  27 + ['site' =>
  28 + [
  29 + [
  30 + 'actions' => ['login', 'error'],
  31 + 'allow' => true,
  32 + ]
  33 + ]
  34 + ]
  35 + ],
  36 + 'verbs' => [
  37 + 'class' => VerbFilter::className(),
  38 + 'actions' => [
  39 + 'delete' => ['POST'],
  40 + ],
  41 + ],
  42 + ];
  43 + }
  44 +
  45 + /**
  46 + * Lists all Banner models.
  47 + * @return mixed
  48 + */
  49 + public function actionIndex()
  50 + {
  51 + $searchModel = new BannerSearch();
  52 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  53 +
  54 + return $this->render('index', [
  55 + 'searchModel' => $searchModel,
  56 + 'dataProvider' => $dataProvider,
  57 + ]);
  58 + }
  59 +
  60 + public function actionSaveImageSettings(){
  61 + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  62 + $width = Yii::$app->request->post('width');
  63 + $height = Yii::$app->request->post('height');
  64 +
  65 + $html = ImageUploader::widget([
  66 + 'model'=> new Banner(),
  67 + 'field'=>'image',
  68 + 'size' => [
  69 + [
  70 + 'width'=>$width,
  71 + 'height'=>$height,
  72 + ],
  73 + ],
  74 + 'name' => "Загрузить баннер"
  75 + ]);
  76 +
  77 + return ['html'=>$html];
  78 + }
  79 +
  80 + /**
  81 + * Displays a single Banner model.
  82 + * @param integer $id
  83 + * @return mixed
  84 + */
  85 + public function actionView($id)
  86 + {
  87 + return $this->render('view', [
  88 + 'model' => $this->findModel($id),
  89 + ]);
  90 + }
  91 +
  92 + /**
  93 + * Creates a new Banner model.
  94 + * If creation is successful, the browser will be redirected to the 'view' page.
  95 + * @return mixed
  96 + */
  97 + public function actionCreate()
  98 + {
  99 + $model = new Banner();
  100 +
  101 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  102 + return $this->redirect(['view', 'id' => $model->banner_id]);
  103 + } else {
  104 + return $this->render('create', [
  105 + 'model' => $model,
  106 + ]);
  107 + }
  108 + }
  109 +
  110 + /**
  111 + * Updates an existing Banner model.
  112 + * If update is successful, the browser will be redirected to the 'view' page.
  113 + * @param integer $id
  114 + * @return mixed
  115 + */
  116 + public function actionUpdate($id)
  117 + {
  118 + $model = $this->findModel($id);
  119 +
  120 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  121 + return $this->redirect(['view', 'id' => $model->banner_id]);
  122 + } else {
  123 + return $this->render('update', [
  124 + 'model' => $model,
  125 + ]);
  126 + }
  127 + }
  128 +
  129 + /**
  130 + * Deletes an existing Banner model.
  131 + * If deletion is successful, the browser will be redirected to the 'index' page.
  132 + * @param integer $id
  133 + * @return mixed
  134 + */
  135 + public function actionDelete($id)
  136 + {
  137 + $this->findModel($id)->delete();
  138 +
  139 + return $this->redirect(['index']);
  140 + }
  141 +
  142 + /**
  143 + * Finds the Banner model based on its primary key value.
  144 + * If the model is not found, a 404 HTTP exception will be thrown.
  145 + * @param integer $id
  146 + * @return Banner the loaded model
  147 + * @throws NotFoundHttpException if the model cannot be found
  148 + */
  149 + protected function findModel($id)
  150 + {
  151 + if (($model = Banner::findOne($id)) !== null) {
  152 + return $model;
  153 + } else {
  154 + throw new NotFoundHttpException('The requested page does not exist.');
  155 + }
  156 + }
  157 +}
... ...
backend/controllers/BgController.php 0 → 100755
  1 +++ a/backend/controllers/BgController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Bg;
  7 +use common\models\BgSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * BgController implements the CRUD actions for Bg model.
  14 + */
  15 +class BgController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 + 'actions' => [
  38 + 'delete' => ['POST'],
  39 + ],
  40 + ],
  41 + ];
  42 + }
  43 +
  44 + /**
  45 + * Lists all Bg models.
  46 + * @return mixed
  47 + */
  48 + public function actionIndex()
  49 + {
  50 + $searchModel = new BgSearch();
  51 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  52 +
  53 + return $this->render('index', [
  54 + 'searchModel' => $searchModel,
  55 + 'dataProvider' => $dataProvider,
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Displays a single Bg model.
  61 + * @param integer $id
  62 + * @return mixed
  63 + */
  64 + public function actionView($id)
  65 + {
  66 + return $this->render('view', [
  67 + 'model' => $this->findModel($id),
  68 + ]);
  69 + }
  70 +
  71 + /**
  72 + * Creates a new Bg model.
  73 + * If creation is successful, the browser will be redirected to the 'view' page.
  74 + * @return mixed
  75 + */
  76 + public function actionCreate()
  77 + {
  78 + $model = new Bg();
  79 +
  80 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  81 + return $this->redirect(['view', 'id' => $model->id]);
  82 + } else {
  83 + return $this->render('create', [
  84 + 'model' => $model,
  85 + ]);
  86 + }
  87 + }
  88 +
  89 + /**
  90 + * Updates an existing Bg model.
  91 + * If update is successful, the browser will be redirected to the 'view' page.
  92 + * @param integer $id
  93 + * @return mixed
  94 + */
  95 + public function actionUpdate($id)
  96 + {
  97 + $model = $this->findModel($id);
  98 +
  99 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  100 + return $this->redirect(['view', 'id' => $model->id]);
  101 + } else {
  102 + return $this->render('update', [
  103 + 'model' => $model,
  104 + ]);
  105 + }
  106 + }
  107 +
  108 + /**
  109 + * Deletes an existing Bg model.
  110 + * If deletion is successful, the browser will be redirected to the 'index' page.
  111 + * @param integer $id
  112 + * @return mixed
  113 + */
  114 + public function actionDelete($id)
  115 + {
  116 + $this->findModel($id)->delete();
  117 +
  118 + return $this->redirect(['index']);
  119 + }
  120 +
  121 + /**
  122 + * Finds the Bg model based on its primary key value.
  123 + * If the model is not found, a 404 HTTP exception will be thrown.
  124 + * @param integer $id
  125 + * @return Bg the loaded model
  126 + * @throws NotFoundHttpException if the model cannot be found
  127 + */
  128 + protected function findModel($id)
  129 + {
  130 + if (($model = Bg::findOne($id)) !== null) {
  131 + return $model;
  132 + } else {
  133 + throw new NotFoundHttpException('The requested page does not exist.');
  134 + }
  135 + }
  136 +}
... ...
backend/controllers/BlogController.php 0 → 100755
  1 +++ a/backend/controllers/BlogController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +use developeruz\db_rbac\behaviors\AccessBehavior;
  5 +use common\models\Fields;
  6 +use Yii;
  7 +use common\models\Blog;
  8 +use common\models\BlogSearch;
  9 +use yii\web\Controller;
  10 +use yii\web\NotFoundHttpException;
  11 +use yii\filters\VerbFilter;
  12 +use yii\filters\AccessControl;
  13 +/**
  14 + * BlogController implements the CRUD actions for Blog model.
  15 + */
  16 +class BlogController extends Controller
  17 +{
  18 +
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function behaviors()
  23 + {
  24 + return [
  25 + 'access'=>[
  26 + 'class' => AccessBehavior::className(),
  27 + 'rules' =>
  28 + ['site' =>
  29 + [
  30 + [
  31 + 'actions' => ['login', 'error'],
  32 + 'allow' => true,
  33 + ]
  34 + ]
  35 + ]
  36 + ],
  37 + 'verbs' => [
  38 + 'class' => VerbFilter::className(),
  39 + 'actions' => [
  40 + 'logout' => ['post'],
  41 + ],
  42 + ],
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * Lists all Blog models.
  48 + * @return mixed
  49 + */
  50 + public function actionIndex()
  51 + {
  52 + $searchModel = new BlogSearch();
  53 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  54 +
  55 + return $this->render('index', [
  56 + 'searchModel' => $searchModel,
  57 + 'dataProvider' => $dataProvider,
  58 + ]);
  59 + }
  60 +
  61 + /**
  62 + * Displays a single Blog model.
  63 + * @param integer $id
  64 + * @return mixed
  65 + */
  66 + public function actionView($id)
  67 + {
  68 + return $this->render('view', [
  69 + 'model' => $this->findModel($id),
  70 + ]);
  71 + }
  72 +
  73 + /**
  74 + * Creates a new Blog model.
  75 + * If creation is successful, the browser will be redirected to the 'view' page.
  76 + * @return mixed
  77 + */
  78 + public function actionCreate()
  79 + {
  80 + $model = new Blog();
  81 +
  82 + if ($model->load(Yii::$app->request->post())) {
  83 +
  84 + Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru');
  85 +
  86 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  87 + $model->cover = $image->name;
  88 + }
  89 +
  90 + if ($model->save() && $image) {
  91 + $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name));
  92 + }
  93 +
  94 + return $this->redirect(['view', 'id' => $model->blog_id]);
  95 + } else {
  96 + return $this->render('create', [
  97 + 'model' => $model,
  98 + ]);
  99 + }
  100 + }
  101 +
  102 + /**
  103 + * Updates an existing Blog model.
  104 + * If update is successful, the browser will be redirected to the 'view' page.
  105 + * @param integer $id
  106 + * @return mixed
  107 + */
  108 + public function actionUpdate($id)
  109 + {
  110 + $model = $this->findModel($id);
  111 +
  112 + if ($model->load(Yii::$app->request->post())) {
  113 +
  114 + Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru');
  115 +
  116 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  117 + $model->cover = $image->name;
  118 + }
  119 +
  120 + if ($model->save() && $image) {
  121 + $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name));
  122 + }
  123 +
  124 + return $this->redirect(['view', 'id' => $model->blog_id]);
  125 + } else {
  126 + return $this->render('update', [
  127 + 'model' => $model,
  128 + ]);
  129 + }
  130 + }
  131 +
  132 + /**
  133 + * Deletes an existing Blog model.
  134 + * If deletion is successful, the browser will be redirected to the 'index' page.
  135 + * @param integer $id
  136 + * @return mixed
  137 + */
  138 + public function actionDelete($id)
  139 + {
  140 + $this->findModel($id)->delete();
  141 +
  142 + return $this->redirect(['index']);
  143 + }
  144 +
  145 + /**
  146 + * Finds the Blog model based on its primary key value.
  147 + * If the model is not found, a 404 HTTP exception will be thrown.
  148 + * @param integer $id
  149 + * @return Blog the loaded model
  150 + * @throws NotFoundHttpException if the model cannot be found
  151 + */
  152 + protected function findModel($id)
  153 + {
  154 + if (($model = Blog::findOne($id)) !== null) {
  155 + return $model;
  156 + } else {
  157 + throw new NotFoundHttpException('The requested page does not exist.');
  158 + }
  159 + }
  160 +}
... ...
backend/controllers/BrandController.php 0 → 100755
  1 +++ a/backend/controllers/BrandController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\modules\product\models\Brand;
  7 +use common\modules\product\models\BrandSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use yii\filters\AccessControl;
  12 +use yii\web\UploadedFile;
  13 +
  14 +/**
  15 + * BrandController implements the CRUD actions for Brand model.
  16 + */
  17 +class BrandController extends Controller
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function behaviors()
  23 + {
  24 + return [
  25 + 'access' => [
  26 + 'class' => AccessControl::className(),
  27 + 'rules' => [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ],
  32 + [
  33 + 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete'],
  34 + 'allow' => true,
  35 + 'roles' => ['@'],
  36 + ],
  37 + ],
  38 + ],
  39 + 'verbs' => [
  40 + 'class' => VerbFilter::className(),
  41 + 'actions' => [
  42 + 'logout' => ['post'],
  43 + ],
  44 + ],
  45 + ];
  46 + }
  47 +
  48 + /**
  49 + * Lists all Brand models.
  50 + * @return mixed
  51 + */
  52 + public function actionIndex()
  53 + {
  54 + $searchModel = new BrandSearch();
  55 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  56 +
  57 + return $this->render('index', [
  58 + 'searchModel' => $searchModel,
  59 + 'dataProvider' => $dataProvider,
  60 + ]);
  61 + }
  62 +
  63 + /**
  64 + * Displays a single Brand model.
  65 + * @param integer $id
  66 + * @return mixed
  67 + */
  68 + public function actionView($id)
  69 + {
  70 + return $this->render('view', [
  71 + 'model' => $this->findModel($id),
  72 + ]);
  73 + }
  74 +
  75 + /**
  76 + * Creates a new Brand model.
  77 + * If creation is successful, the browser will be redirected to the 'view' page.
  78 + * @return mixed
  79 + */
  80 + public function actionCreate()
  81 + {
  82 + $model = new Brand();
  83 + if ($model->load(Yii::$app->request->post())) {
  84 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  85 + $model->image = $image->name;
  86 + }
  87 +
  88 + if ($model->save() && $image) {
  89 + $image->saveAs(Yii::getAlias('@imagesDir/brands/' . $image->name));
  90 + }
  91 +
  92 + return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect(['view', 'id' => $model->brand_id]) : $this->redirect(array_merge(['create'], Yii::$app->request->queryParams));
  93 + } else {
  94 + return $this->render('create', [
  95 + 'model' => $model,
  96 + ]);
  97 + }
  98 + }
  99 +
  100 + /**
  101 + * Updates an existing Brand model.
  102 + * If update is successful, the browser will be redirected to the 'view' page.
  103 + * @param integer $id
  104 + * @return mixed
  105 + */
  106 + public function actionUpdate($id)
  107 + {
  108 + $model = $this->findModel($id);
  109 +
  110 + if ($model->load(Yii::$app->request->post())) {
  111 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  112 + $model->image = $image->name;
  113 + }
  114 +
  115 + if ($model->save() && $image) {
  116 + $image->saveAs(Yii::getAlias('@imagesDir/brands/' . $image->name));
  117 + }
  118 +
  119 + return $this->redirect(['view', 'id' => $model->brand_id]);
  120 + } else {
  121 + return $this->render('update', [
  122 + 'model' => $model,
  123 + ]);
  124 + }
  125 + }
  126 +
  127 + /**
  128 + * Deletes an existing Brand model.
  129 + * If deletion is successful, the browser will be redirected to the 'index' page.
  130 + * @param integer $id
  131 + * @return mixed
  132 + */
  133 + public function actionDelete($id)
  134 + {
  135 + $this->findModel($id)->delete();
  136 +
  137 + return $this->redirect(['index']);
  138 + }
  139 +
  140 + /**
  141 + * Finds the Brand model based on its primary key value.
  142 + * If the model is not found, a 404 HTTP exception will be thrown.
  143 + * @param integer $id
  144 + * @return Brand the loaded model
  145 + * @throws NotFoundHttpException if the model cannot be found
  146 + */
  147 + protected function findModel($id)
  148 + {
  149 + if (($model = Brand::findOne($id)) !== null) {
  150 + return $model;
  151 + } else {
  152 + throw new NotFoundHttpException('The requested page does not exist.');
  153 + }
  154 + }
  155 +}
... ...
backend/controllers/CategoryController.php 0 → 100755
  1 +++ a/backend/controllers/CategoryController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +use developeruz\db_rbac\behaviors\AccessBehavior;
  5 +use common\components\artboxtree\ArtboxTreeHelper;
  6 +use Yii;
  7 +use common\modules\product\models\Category;
  8 +use common\modules\product\models\CategorySearch;
  9 +use yii\helpers\ArrayHelper;
  10 +use yii\web\Controller;
  11 +use yii\web\NotFoundHttpException;
  12 +use yii\filters\VerbFilter;
  13 +use yii\filters\AccessControl;
  14 +use yii\web\UploadedFile;
  15 +
  16 +/**
  17 + * CategoryController implements the CRUD actions for Category model.
  18 + */
  19 +class CategoryController extends Controller
  20 +{
  21 + /**
  22 + * @inheritdoc
  23 + */
  24 + public function behaviors()
  25 + {
  26 + return [
  27 + 'access'=>[
  28 + 'class' => AccessBehavior::className(),
  29 + 'rules' =>
  30 + ['site' =>
  31 + [
  32 + [
  33 + 'actions' => ['login', 'error'],
  34 + 'allow' => true,
  35 + ]
  36 + ]
  37 + ]
  38 + ],
  39 + 'verbs' => [
  40 + 'class' => VerbFilter::className(),
  41 + 'actions' => [
  42 + 'logout' => ['post'],
  43 + ],
  44 + ],
  45 + ];
  46 + }
  47 +
  48 + /**
  49 + * Lists all Category models.
  50 + * @return mixed
  51 + */
  52 + public function actionIndex()
  53 + {
  54 + $searchModel = new CategorySearch();
  55 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  56 +
  57 + return $this->render('index', [
  58 + 'searchModel' => $searchModel,
  59 + 'dataProvider' => $dataProvider,
  60 + ]);
  61 + }
  62 +
  63 + /**
  64 + * Displays a single Category model.
  65 + * @param integer $id
  66 + * @return mixed
  67 + */
  68 + public function actionView($id)
  69 + {
  70 + return $this->render('view', [
  71 + 'model' => $this->findModel($id),
  72 + ]);
  73 + }
  74 +
  75 + /**
  76 + * Creates a new Category model.
  77 + * If creation is successful, the browser will be redirected to the 'view' page.
  78 + * @return mixed
  79 + */
  80 + public function actionCreate()
  81 + {
  82 + $model = new Category();
  83 +
  84 + if ($model->load(Yii::$app->request->post())) {
  85 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  86 + $model->image = $image->name;
  87 + }
  88 +
  89 + if ($model->save() && $image) {
  90 + $image->saveAs(Yii::getAlias('@imagesDir/categories/' . $image->name));
  91 + }
  92 +
  93 + return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect(['view', 'id' => $model->category_id]) : $this->redirect(array_merge(['create'], Yii::$app->request->queryParams));
  94 + } else {
  95 + if (!empty(Yii::$app->request->queryParams['parent'])) {
  96 + $model->parent_id = Yii::$app->request->queryParams['parent'];
  97 + }
  98 + return $this->render('create', [
  99 + 'model' => $model,
  100 + 'categories' => ArtboxTreeHelper::treeMap(Category::find()->with('categoryName')->getTree(), 'category_id', 'categoryName.value', '.')
  101 + ]);
  102 + }
  103 + }
  104 +
  105 + /**
  106 + * Updates an existing Category model.
  107 + * If update is successful, the browser will be redirected to the 'view' page.
  108 + * @param integer $id
  109 + * @return mixed
  110 + */
  111 + public function actionUpdate($id)
  112 + {
  113 + $model = $this->findModel($id);
  114 +
  115 + if ($model->load(Yii::$app->request->post())) {
  116 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  117 + $model->image = $image->name;
  118 + }
  119 +
  120 + if ($model->save() && $image) {
  121 + $image->saveAs(Yii::getAlias('@imagesDir/categories/' . $image->name));
  122 + }
  123 +
  124 + return $this->redirect(['view', 'id' => $model->category_id]);
  125 + } else {
  126 + return $this->render('update', [
  127 + 'model' => $model,
  128 + 'categories' => ArtboxTreeHelper::treeMap(Category::find()->with('categoryName')->getTree(), 'category_id', 'categoryName.value', '.')
  129 + ]);
  130 + }
  131 + }
  132 +
  133 + /**
  134 + * Deletes an existing Category model.
  135 + * If deletion is successful, the browser will be redirected to the 'index' page.
  136 + * @param integer $id
  137 + * @return mixed
  138 + */
  139 + public function actionDelete($id)
  140 + {
  141 + $this->findModel($id)->delete();
  142 +
  143 + return $this->redirect(['index']);
  144 + }
  145 +
  146 + /**
  147 + * Finds the Category model based on its primary key value.
  148 + * If the model is not found, a 404 HTTP exception will be thrown.
  149 + * @param integer $id
  150 + * @return Category the loaded model
  151 + * @throws NotFoundHttpException if the model cannot be found
  152 + */
  153 + protected function findModel($id)
  154 + {
  155 + if (($model = Category::findOne($id)) !== null) {
  156 + return $model;
  157 + } else {
  158 + throw new NotFoundHttpException('The requested page does not exist.');
  159 + }
  160 + }
  161 +}
... ...
backend/controllers/CommentController.php 0 → 100755
  1 +++ a/backend/controllers/CommentController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use developeruz\db_rbac\behaviors\AccessBehavior;
  6 +use Yii;
  7 +use common\modules\comment\models\Comment;
  8 +use backend\models\CommentSearch;
  9 +use yii\web\Controller;
  10 +use yii\web\NotFoundHttpException;
  11 +use yii\filters\VerbFilter;
  12 +
  13 +/**
  14 + * CommentController implements the CRUD actions for Comment model.
  15 + */
  16 +class CommentController extends Controller
  17 +{
  18 + /**
  19 + * @inheritdoc
  20 + */
  21 + public function behaviors()
  22 + {
  23 + return [
  24 + 'access'=>[
  25 + 'class' => AccessBehavior::className(),
  26 + 'rules' =>
  27 + ['site' =>
  28 + [
  29 + [
  30 + 'actions' => ['login', 'error'],
  31 + 'allow' => true,
  32 + ]
  33 + ]
  34 + ]
  35 + ],
  36 + 'verbs' => [
  37 + 'class' => VerbFilter::className(),
  38 + 'actions' => [
  39 + 'delete' => ['POST'],
  40 + ],
  41 + ],
  42 + ];
  43 + }
  44 +
  45 + /**
  46 + * Lists all Comment models.
  47 + * @return mixed
  48 + */
  49 + public function actionIndex()
  50 + {
  51 + $searchModel = new CommentSearch();
  52 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  53 + $query = $dataProvider->query;
  54 + $query->with(['rating', 'user']);
  55 + $sort = $dataProvider->sort;
  56 + $sort->defaultOrder = [
  57 + 'status' => SORT_ASC,
  58 + ];
  59 +
  60 + return $this->render('index', [
  61 + 'searchModel' => $searchModel,
  62 + 'dataProvider' => $dataProvider,
  63 + ]);
  64 + }
  65 +
  66 + /**
  67 + * Displays a single Comment model.
  68 + * @param integer $id
  69 + * @return mixed
  70 + */
  71 +// public function actionView($id)
  72 +// {
  73 +// return $this->render('view', [
  74 +// 'model' => $this->findModel($id),
  75 +// ]);
  76 +// }
  77 +
  78 + /**
  79 + * Creates a new Comment model.
  80 + * If creation is successful, the browser will be redirected to the 'view' page.
  81 + * @return mixed
  82 + */
  83 +// public function actionCreate()
  84 +// {
  85 +// $model = new Comment();
  86 +//
  87 +// if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 +// return $this->redirect(['view', 'id' => $model->comment_id]);
  89 +// } else {
  90 +// return $this->render('create', [
  91 +// 'model' => $model,
  92 +// ]);
  93 +// }
  94 +// }
  95 +
  96 + /**
  97 + * Updates an existing Comment model.
  98 + * If update is successful, the browser will be redirected to the 'view' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionUpdate($id)
  103 + {
  104 + $model = $this->findModel($id);
  105 +
  106 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  107 + return $this->redirect(['view', 'id' => $model->comment_id]);
  108 + } else {
  109 + return $this->render('update', [
  110 + 'model' => $model,
  111 + ]);
  112 + }
  113 + }
  114 +
  115 + public function actionApprove($id) {
  116 + $model = $this->findModel($id);
  117 + $model->status = Comment::STATUS_ACTIVE;
  118 + $model->save(false);
  119 +
  120 + return $this->redirect(['index']);
  121 + }
  122 +
  123 + public function actionDisapprove($id) {
  124 + $model = $this->findModel($id);
  125 + $model->status = Comment::STATUS_HIDDEN;
  126 + $model->save(false);
  127 +
  128 + return $this->redirect(['index']);
  129 + }
  130 +
  131 + /**
  132 + * Deletes an existing Comment model.
  133 + * If deletion is successful, the browser will be redirected to the 'index' page.
  134 + * @param integer $id
  135 + * @return mixed
  136 + */
  137 + public function actionDelete($id)
  138 + {
  139 + $this->findModel($id)->delete();
  140 +
  141 + return $this->redirect(['index']);
  142 + }
  143 +
  144 + /**
  145 + * Finds the Comment model based on its primary key value.
  146 + * If the model is not found, a 404 HTTP exception will be thrown.
  147 + * @param integer $id
  148 + * @return Comment the loaded model
  149 + * @throws NotFoundHttpException if the model cannot be found
  150 + */
  151 + protected function findModel($id)
  152 + {
  153 + if (($model = Comment::findOne($id)) !== null) {
  154 + return $model;
  155 + } else {
  156 + throw new NotFoundHttpException('The requested page does not exist.');
  157 + }
  158 + }
  159 +}
... ...
backend/controllers/CustomerController.php 0 → 100755
  1 +++ a/backend/controllers/CustomerController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Customer;
  7 +use common\models\CustomerSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * CustomerController implements the CRUD actions for Customer model.
  14 + */
  15 +class CustomerController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 + 'actions' => [
  38 + 'delete' => ['POST'],
  39 + ],
  40 + ],
  41 + ];
  42 + }
  43 +
  44 + /**
  45 + * Lists all Customer models.
  46 + * @return mixed
  47 + */
  48 + public function actionIndex()
  49 + {
  50 + $searchModel = new CustomerSearch();
  51 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  52 +
  53 + return $this->render('index', [
  54 + 'searchModel' => $searchModel,
  55 + 'dataProvider' => $dataProvider,
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Displays a single Customer model.
  61 + * @param integer $id
  62 + * @return mixed
  63 + */
  64 + public function actionView($id)
  65 + {
  66 + return $this->render('view', [
  67 + 'model' => $this->findModel($id),
  68 + ]);
  69 + }
  70 +
  71 + /**
  72 + * Creates a new Customer model.
  73 + * If creation is successful, the browser will be redirected to the 'view' page.
  74 + * @return mixed
  75 + */
  76 + public function actionCreate()
  77 + {
  78 + $model = new Customer();
  79 +
  80 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  81 + return $this->redirect(['view', 'id' => $model->id]);
  82 + } else {
  83 + return $this->render('create', [
  84 + 'model' => $model,
  85 + ]);
  86 + }
  87 + }
  88 +
  89 + /**
  90 + * Updates an existing Customer model.
  91 + * If update is successful, the browser will be redirected to the 'view' page.
  92 + * @param integer $id
  93 + * @return mixed
  94 + */
  95 + public function actionUpdate($id)
  96 + {
  97 + $model = $this->findModel($id);
  98 +
  99 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  100 + return $this->redirect(['view', 'id' => $model->id]);
  101 + } else {
  102 + return $this->render('update', [
  103 + 'model' => $model,
  104 + ]);
  105 + }
  106 + }
  107 +
  108 + /**
  109 + * Deletes an existing Customer model.
  110 + * If deletion is successful, the browser will be redirected to the 'index' page.
  111 + * @param integer $id
  112 + * @return mixed
  113 + */
  114 + public function actionDelete($id)
  115 + {
  116 + $this->findModel($id)->delete();
  117 +
  118 + return $this->redirect(['index']);
  119 + }
  120 +
  121 + /**
  122 + * Finds the Customer model based on its primary key value.
  123 + * If the model is not found, a 404 HTTP exception will be thrown.
  124 + * @param integer $id
  125 + * @return Customer the loaded model
  126 + * @throws NotFoundHttpException if the model cannot be found
  127 + */
  128 + protected function findModel($id)
  129 + {
  130 + if (($model = Customer::findOne($id)) !== null) {
  131 + return $model;
  132 + } else {
  133 + throw new NotFoundHttpException('The requested page does not exist.');
  134 + }
  135 + }
  136 +}
... ...
backend/controllers/EventController.php 0 → 100755
  1 +++ a/backend/controllers/EventController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Event;
  7 +use common\models\EventSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +use yii\web\UploadedFile;
  13 +
  14 +/**
  15 + * EventController implements the CRUD actions for Event model.
  16 + */
  17 +class EventController extends Controller
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function behaviors()
  23 + {
  24 + return [
  25 + 'access'=>[
  26 + 'class' => AccessBehavior::className(),
  27 + 'rules' =>
  28 + ['site' =>
  29 + [
  30 + [
  31 + 'actions' => ['login', 'error'],
  32 + 'allow' => true,
  33 + ]
  34 + ]
  35 + ]
  36 + ],
  37 + 'verbs' => [
  38 + 'class' => VerbFilter::className(),
  39 + 'actions' => [
  40 + 'delete' => ['POST'],
  41 + ],
  42 + ],
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * Lists all Event models.
  48 + * @return mixed
  49 + */
  50 + public function actionIndex()
  51 + {
  52 + $searchModel = new EventSearch();
  53 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  54 +
  55 + return $this->render('index', [
  56 + 'searchModel' => $searchModel,
  57 + 'dataProvider' => $dataProvider,
  58 + ]);
  59 + }
  60 +
  61 + /**
  62 + * Displays a single Event model.
  63 + * @param integer $id
  64 + * @return mixed
  65 + */
  66 + public function actionView($id)
  67 + {
  68 + return $this->render('view', [
  69 + 'model' => $this->findModel($id),
  70 + ]);
  71 + }
  72 +
  73 + /**
  74 + * Creates a new Event model.
  75 + * If creation is successful, the browser will be redirected to the 'view' page.
  76 + * @return mixed
  77 + */
  78 + public function actionCreate()
  79 + {
  80 + $model = new Event();
  81 +
  82 + if ($model->load(Yii::$app->request->post())) {
  83 +
  84 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  85 + $model->image = $image->name;
  86 + }
  87 +
  88 + if ($model->save() && $image) {
  89 + $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name));
  90 + }
  91 +
  92 + return $this->redirect(['view', 'id' => $model->event_id]);
  93 + } else {
  94 + return $this->render('create', [
  95 + 'model' => $model,
  96 + ]);
  97 + }
  98 + }
  99 +
  100 + /**
  101 + * Updates an existing Event model.
  102 + * If update is successful, the browser will be redirected to the 'view' page.
  103 + * @param integer $id
  104 + * @return mixed
  105 + */
  106 + public function actionUpdate($id)
  107 + {
  108 + $model = $this->findModel($id);
  109 +
  110 + if ($model->load(Yii::$app->request->post())) {
  111 +
  112 + if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) {
  113 + $model->image = $image->name;
  114 + }
  115 +
  116 + if ($model->save() && $image) {
  117 + $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name));
  118 + }
  119 +
  120 + return $this->redirect(['view', 'id' => $model->event_id]);
  121 + } else {
  122 + return $this->render('update', [
  123 + 'model' => $model,
  124 + ]);
  125 + }
  126 + }
  127 +
  128 + /**
  129 + * Deletes an existing Event model.
  130 + * If deletion is successful, the browser will be redirected to the 'index' page.
  131 + * @param integer $id
  132 + * @return mixed
  133 + */
  134 + public function actionDelete($id)
  135 + {
  136 + $this->findModel($id)->delete();
  137 +
  138 + return $this->redirect(['index']);
  139 + }
  140 +
  141 + /**
  142 + * Finds the Event model based on its primary key value.
  143 + * If the model is not found, a 404 HTTP exception will be thrown.
  144 + * @param integer $id
  145 + * @return Event the loaded model
  146 + * @throws NotFoundHttpException if the model cannot be found
  147 + */
  148 + protected function findModel($id)
  149 + {
  150 + if (($model = Event::findOne($id)) !== null) {
  151 + return $model;
  152 + } else {
  153 + throw new NotFoundHttpException('The requested page does not exist.');
  154 + }
  155 + }
  156 +}
... ...
backend/controllers/OrdersController.php 0 → 100755
  1 +++ a/backend/controllers/OrdersController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use backend\models\OrdersSearch;
  6 +use Yii;
  7 +use yii\web\Controller;
  8 +use yii\filters\VerbFilter;
  9 +use yii\data\ActiveDataProvider;
  10 +use yii\web\HttpException;
  11 +use common\models\Orders;
  12 +use backend\models\OrdersProducts;
  13 +use common\modules\product\models\ProductVariant;
  14 +use yii\web\NotFoundHttpException;
  15 +use developeruz\db_rbac\behaviors\AccessBehavior;
  16 +
  17 +class OrdersController extends Controller
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function behaviors()
  23 + {
  24 + return [
  25 + 'access'=>[
  26 + 'class' => AccessBehavior::className(),
  27 + 'rules' =>
  28 + ['site' =>
  29 + [
  30 + [
  31 + 'actions' => ['login', 'error'],
  32 + 'allow' => true,
  33 + ]
  34 + ]
  35 + ]
  36 + ],
  37 + 'verbs' => [
  38 + 'class' => VerbFilter::className(),
  39 + 'actions' => [
  40 + 'delete' => ['POST'],
  41 + ],
  42 + ],
  43 + ];
  44 + }
  45 +
  46 + public function actionIndex()
  47 + {
  48 + $searchModel = new OrdersSearch();
  49 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  50 +
  51 + return $this->render('index', [
  52 + 'dataProvider'=>$dataProvider,
  53 + 'searchModel'=>$searchModel,
  54 + ]);
  55 + }
  56 +
  57 + public function actionShow($id)
  58 + {
  59 +
  60 + $model = $this->findModel((int)$id);
  61 + $dataProvider = new ActiveDataProvider([
  62 + 'query' => OrdersProducts::find()->where(['order_id'=>(int)$id]),
  63 + 'pagination' => [
  64 + 'pageSize' => 20,
  65 + ],
  66 + ]);
  67 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  68 + return $this->redirect(['index']);
  69 + } else {
  70 + $model_orderproducts = new OrdersProducts;
  71 +
  72 +
  73 + return $this->renderAjax('show', [
  74 + 'model' => $model,
  75 + 'model_orderproducts'=>$model_orderproducts,
  76 + 'dataProvider' => $dataProvider,
  77 + ]);
  78 + }
  79 + }
  80 +
  81 + public function actionLabelupdate(){
  82 + $model = Orders::findOne($_POST['order_id']);
  83 + $model->label = $_POST['label_id'];
  84 + $model->save();
  85 + }
  86 +
  87 + public function actionPayupdate(){
  88 + $model = Orders::findOne($_POST['order_id']);
  89 + $model->pay = $_POST['pay_id'];
  90 + $model->save();
  91 + }
  92 +
  93 + public function actionDelete(){
  94 + $model = Orders::findOne($_GET['id']);
  95 + $model->delete();
  96 + return Yii::$app->response->redirect(['/orders/index']);
  97 + }
  98 +
  99 +
  100 + public function actionAdd(){
  101 + $model = new OrdersProducts;
  102 + if ($model->load(Yii::$app->request->post())) {
  103 +
  104 + if(!$modelMod = ProductVariant::find()->with(['product'])->where(['sku'=>$model->sku])->one())
  105 + throw new HttpException(404, 'Данного артикля не существует!');
  106 + $model->product_name = $modelMod->product->name;
  107 + $model->name = $modelMod->name;
  108 + $model->sku = $modelMod->sku;
  109 + $model->price = $modelMod->price;
  110 + $model->sum_cost = $model->count*$modelMod->price;
  111 + $model->mod_id = $modelMod->id;
  112 + $model->save();
  113 + //return Yii::$app->response->redirect(['/admin/orders/show','id'=>$_GET['order_id']]);
  114 + }
  115 +
  116 + //return $this->render('add',['model'=>$model]);
  117 + }
  118 +
  119 + public function actionCreate(){
  120 + $model = new Orders();
  121 +
  122 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  123 + return $this->redirect(['index']);
  124 + } else {
  125 + return $this->render('create', [
  126 + 'model' => $model,
  127 + ]);
  128 + }
  129 + }
  130 +
  131 + public function actionDelete_product(){
  132 + $model = OrdersProducts::findOne($_GET['id']);
  133 + $model->delete();
  134 + return Yii::$app->response->redirect(['/admin/orders/show','id'=>$_GET['order_id']]);
  135 + }
  136 +
  137 + protected function findModel($id)
  138 + {
  139 + if (($model = Orders::findOne($id)) !== null) {
  140 + return $model;
  141 + } else {
  142 + throw new NotFoundHttpException('The requested page does not exist.');
  143 + }
  144 + }
  145 +}
... ...
backend/controllers/PageController.php 0 → 100755
  1 +++ a/backend/controllers/PageController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Page;
  7 +use common\models\PageSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * PageController implements the CRUD actions for Page model.
  14 + */
  15 +class PageController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 + 'actions' => [
  38 + 'delete' => ['POST'],
  39 + ],
  40 + ],
  41 + ];
  42 + }
  43 +
  44 + /**
  45 + * Lists all Page models.
  46 + * @return mixed
  47 + */
  48 + public function actionIndex()
  49 + {
  50 + $searchModel = new PageSearch();
  51 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  52 +
  53 + return $this->render('index', [
  54 + 'searchModel' => $searchModel,
  55 + 'dataProvider' => $dataProvider,
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Displays a single Page model.
  61 + * @param integer $id
  62 + * @return mixed
  63 + */
  64 + public function actionView($id)
  65 + {
  66 + return $this->render('view', [
  67 + 'model' => $this->findModel($id),
  68 + ]);
  69 + }
  70 +
  71 + /**
  72 + * Creates a new Page model.
  73 + * If creation is successful, the browser will be redirected to the 'view' page.
  74 + * @return mixed
  75 + */
  76 + public function actionCreate()
  77 + {
  78 + $model = new Page();
  79 +
  80 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  81 + return $this->redirect(['view', 'id' => $model->id]);
  82 + } else {
  83 + return $this->render('create', [
  84 + 'model' => $model,
  85 + ]);
  86 + }
  87 + }
  88 +
  89 + /**
  90 + * Updates an existing Page model.
  91 + * If update is successful, the browser will be redirected to the 'view' page.
  92 + * @param integer $id
  93 + * @return mixed
  94 + */
  95 + public function actionUpdate($id)
  96 + {
  97 + $model = $this->findModel($id);
  98 +
  99 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  100 + return $this->redirect(['view', 'id' => $model->id]);
  101 + } else {
  102 + return $this->render('update', [
  103 + 'model' => $model,
  104 + ]);
  105 + }
  106 + }
  107 +
  108 + /**
  109 + * Deletes an existing Page model.
  110 + * If deletion is successful, the browser will be redirected to the 'index' page.
  111 + * @param integer $id
  112 + * @return mixed
  113 + */
  114 + public function actionDelete($id)
  115 + {
  116 + $this->findModel($id)->delete();
  117 +
  118 + return $this->redirect(['index']);
  119 + }
  120 +
  121 + /**
  122 + * Finds the Page model based on its primary key value.
  123 + * If the model is not found, a 404 HTTP exception will be thrown.
  124 + * @param integer $id
  125 + * @return Page the loaded model
  126 + * @throws NotFoundHttpException if the model cannot be found
  127 + */
  128 + protected function findModel($id)
  129 + {
  130 + if (($model = Page::findOne($id)) !== null) {
  131 + return $model;
  132 + } else {
  133 + throw new NotFoundHttpException('The requested page does not exist.');
  134 + }
  135 + }
  136 +}
... ...
backend/controllers/SeoCategoryController.php 0 → 100755
  1 +++ a/backend/controllers/SeoCategoryController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\SeoCategory;
  7 +use common\models\SeoCategorySearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * SeoCategoryController implements the CRUD actions for SeoCategory model.
  14 + */
  15 +class SeoCategoryController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 +
  38 + ],
  39 + ];
  40 + }
  41 +
  42 + /**
  43 + * Lists all SeoCategory models.
  44 + * @return mixed
  45 + */
  46 + public function actionIndex()
  47 + {
  48 + $searchModel = new SeoCategorySearch();
  49 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  50 +
  51 + return $this->render('index', [
  52 + 'searchModel' => $searchModel,
  53 + 'dataProvider' => $dataProvider,
  54 + ]);
  55 + }
  56 +
  57 + /**
  58 + * Displays a single SeoCategory model.
  59 + * @param integer $id
  60 + * @return mixed
  61 + */
  62 + public function actionView($id)
  63 + {
  64 + return $this->render('view', [
  65 + 'model' => $this->findModel($id),
  66 + ]);
  67 + }
  68 +
  69 + /**
  70 + * Creates a new SeoCategory model.
  71 + * If creation is successful, the browser will be redirected to the 'view' page.
  72 + * @return mixed
  73 + */
  74 + public function actionCreate()
  75 + {
  76 + $model = new SeoCategory();
  77 +
  78 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  79 + return $this->redirect(['view', 'id' => $model->seo_category_id]);
  80 + } else {
  81 + return $this->render('create', [
  82 + 'model' => $model,
  83 + ]);
  84 + }
  85 + }
  86 +
  87 + /**
  88 + * Updates an existing SeoCategory model.
  89 + * If update is successful, the browser will be redirected to the 'view' page.
  90 + * @param integer $id
  91 + * @return mixed
  92 + */
  93 + public function actionUpdate($id)
  94 + {
  95 + $model = $this->findModel($id);
  96 +
  97 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  98 + return $this->redirect(['view', 'id' => $model->seo_category_id]);
  99 + } else {
  100 + return $this->render('update', [
  101 + 'model' => $model,
  102 + ]);
  103 + }
  104 + }
  105 +
  106 + /**
  107 + * Deletes an existing SeoCategory model.
  108 + * If deletion is successful, the browser will be redirected to the 'index' page.
  109 + * @param integer $id
  110 + * @return mixed
  111 + */
  112 + public function actionDelete($id)
  113 + {
  114 + $this->findModel($id)->delete();
  115 +
  116 + return $this->redirect(['index']);
  117 + }
  118 +
  119 + /**
  120 + * Finds the SeoCategory model based on its primary key value.
  121 + * If the model is not found, a 404 HTTP exception will be thrown.
  122 + * @param integer $id
  123 + * @return SeoCategory the loaded model
  124 + * @throws NotFoundHttpException if the model cannot be found
  125 + */
  126 + protected function findModel($id)
  127 + {
  128 + if (($model = SeoCategory::findOne($id)) !== null) {
  129 + return $model;
  130 + } else {
  131 + throw new NotFoundHttpException('The requested page does not exist.');
  132 + }
  133 + }
  134 +}
... ...
backend/controllers/SeoController.php 0 → 100755
  1 +++ a/backend/controllers/SeoController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Seo;
  7 +use common\models\SeoSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * SeoController implements the CRUD actions for Seo model.
  14 + */
  15 +class SeoController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 +
  38 + ],
  39 + ];
  40 + }
  41 +
  42 + /**
  43 + * Lists all Seo models.
  44 + * @return mixed
  45 + */
  46 + public function actionIndex()
  47 + {
  48 + $searchModel = new SeoSearch();
  49 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  50 +
  51 + return $this->render('index', [
  52 + 'searchModel' => $searchModel,
  53 + 'dataProvider' => $dataProvider,
  54 + ]);
  55 + }
  56 +
  57 + /**
  58 + * Displays a single Seo model.
  59 + * @param integer $id
  60 + * @return mixed
  61 + */
  62 + public function actionView($id)
  63 + {
  64 + return $this->render('view', [
  65 + 'model' => $this->findModel($id),
  66 + ]);
  67 + }
  68 +
  69 + /**
  70 + * Creates a new Seo model.
  71 + * If creation is successful, the browser will be redirected to the 'view' page.
  72 + * @return mixed
  73 + */
  74 + public function actionCreate()
  75 + {
  76 + $model = new Seo();
  77 +
  78 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  79 + return $this->redirect(['view', 'id' => $model->seo_id]);
  80 + } else {
  81 + return $this->render('create', [
  82 + 'model' => $model,
  83 + ]);
  84 + }
  85 + }
  86 +
  87 + /**
  88 + * Updates an existing Seo model.
  89 + * If update is successful, the browser will be redirected to the 'view' page.
  90 + * @param integer $id
  91 + * @return mixed
  92 + */
  93 + public function actionUpdate($id)
  94 + {
  95 + $model = $this->findModel($id);
  96 +
  97 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  98 + return $this->redirect(['view', 'id' => $model->seo_id]);
  99 + } else {
  100 + return $this->render('update', [
  101 + 'model' => $model,
  102 + ]);
  103 + }
  104 + }
  105 +
  106 + /**
  107 + * Deletes an existing Seo model.
  108 + * If deletion is successful, the browser will be redirected to the 'index' page.
  109 + * @param integer $id
  110 + * @return mixed
  111 + */
  112 + public function actionDelete($id)
  113 + {
  114 + $this->findModel($id)->delete();
  115 +
  116 + return $this->redirect(['index']);
  117 + }
  118 +
  119 + /**
  120 + * Finds the Seo model based on its primary key value.
  121 + * If the model is not found, a 404 HTTP exception will be thrown.
  122 + * @param integer $id
  123 + * @return Seo the loaded model
  124 + * @throws NotFoundHttpException if the model cannot be found
  125 + */
  126 + protected function findModel($id)
  127 + {
  128 + if (($model = Seo::findOne($id)) !== null) {
  129 + return $model;
  130 + } else {
  131 + throw new NotFoundHttpException('The requested page does not exist.');
  132 + }
  133 + }
  134 +}
... ...
backend/controllers/SeoDynamicController.php 0 → 100755
  1 +++ a/backend/controllers/SeoDynamicController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\SeoDynamic;
  7 +use common\models\SeoDynamicSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * SeoDynamicController implements the CRUD actions for SeoDynamic model.
  14 + */
  15 +class SeoDynamicController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 +
  38 + ],
  39 + ];
  40 + }
  41 +
  42 + /**
  43 + * Lists all SeoDynamic models.
  44 + * @return mixed
  45 + */
  46 + public function actionIndex($seo_category_id)
  47 + {
  48 + $searchModel = new SeoDynamicSearch();
  49 + $dataProvider = $searchModel->search($seo_category_id,Yii::$app->request->queryParams);
  50 +
  51 + return $this->render('index', [
  52 + 'searchModel' => $searchModel,
  53 + 'dataProvider' => $dataProvider,
  54 + 'seo_category_id' => $seo_category_id
  55 + ]);
  56 + }
  57 +
  58 + /**
  59 + * Displays a single SeoDynamic model.
  60 + * @param integer $id
  61 + * @return mixed
  62 + */
  63 + public function actionView($seo_category_id, $id)
  64 + {
  65 + return $this->render('view', [
  66 + 'model' => $this->findModel($id),
  67 + 'seo_category_id' => $seo_category_id
  68 + ]);
  69 + }
  70 +
  71 + /**
  72 + * Creates a new SeoDynamic model.
  73 + * If creation is successful, the browser will be redirected to the 'view' page.
  74 + * @return mixed
  75 + */
  76 + public function actionCreate($seo_category_id)
  77 + {
  78 + $model = new SeoDynamic();
  79 +
  80 + if ($model->load(Yii::$app->request->post())) {
  81 + $model->seo_category_id = $seo_category_id;
  82 + $model->save();
  83 + return $this->redirect(['index', 'seo_category_id' => $model->seo_category_id]);
  84 + } else {
  85 + return $this->render('create', [
  86 + 'model' => $model,
  87 + 'seo_category_id' => $seo_category_id
  88 + ]);
  89 + }
  90 + }
  91 +
  92 + /**
  93 + * Updates an existing SeoDynamic model.
  94 + * If update is successful, the browser will be redirected to the 'view' page.
  95 + * @param integer $id
  96 + * @return mixed
  97 + */
  98 + public function actionUpdate($seo_category_id,$id)
  99 + {
  100 + $model = $this->findModel($id);
  101 +
  102 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  103 + return $this->redirect(['index', 'seo_category_id' => $model->seo_category_id]);
  104 + } else {
  105 + return $this->render('update', [
  106 + 'model' => $model,
  107 + 'seo_category_id' => $seo_category_id
  108 + ]);
  109 + }
  110 + }
  111 +
  112 + /**
  113 + * Deletes an existing SeoDynamic model.
  114 + * If deletion is successful, the browser will be redirected to the 'index' page.
  115 + * @param integer $id
  116 + * @return mixed
  117 + */
  118 + public function actionDelete($seo_category_id,$id)
  119 + {
  120 + $this->findModel($id)->delete();
  121 +
  122 + return $this->redirect(['index','seo_category_id'=> $seo_category_id]);
  123 + }
  124 +
  125 + /**
  126 + * Finds the SeoDynamic model based on its primary key value.
  127 + * If the model is not found, a 404 HTTP exception will be thrown.
  128 + * @param integer $id
  129 + * @return SeoDynamic the loaded model
  130 + * @throws NotFoundHttpException if the model cannot be found
  131 + */
  132 + protected function findModel($id)
  133 + {
  134 + if (($model = SeoDynamic::findOne($id)) !== null) {
  135 + return $model;
  136 + } else {
  137 + throw new NotFoundHttpException('The requested page does not exist.');
  138 + }
  139 + }
  140 +}
... ...
backend/controllers/ServiceController.php 0 → 100755
  1 +++ a/backend/controllers/ServiceController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Service;
  7 +use common\models\ServiceSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * ServiceController implements the CRUD actions for Service model.
  14 + */
  15 +class ServiceController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 + 'actions' => [
  38 + 'delete' => ['POST'],
  39 + ],
  40 + ],
  41 + ];
  42 + }
  43 +
  44 + /**
  45 + * Lists all Service models.
  46 + * @return mixed
  47 + */
  48 + public function actionIndex()
  49 + {
  50 + $searchModel = new ServiceSearch();
  51 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  52 +
  53 + return $this->render('index', [
  54 + 'searchModel' => $searchModel,
  55 + 'dataProvider' => $dataProvider,
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Displays a single Service model.
  61 + * @param integer $id
  62 + * @return mixed
  63 + */
  64 + public function actionView($id)
  65 + {
  66 + return $this->render('view', [
  67 + 'model' => $this->findModel($id),
  68 + ]);
  69 + }
  70 +
  71 + /**
  72 + * Creates a new Service model.
  73 + * If creation is successful, the browser will be redirected to the 'view' page.
  74 + * @return mixed
  75 + */
  76 + public function actionCreate()
  77 + {
  78 + $model = new Service();
  79 +
  80 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  81 + return $this->redirect(['view', 'id' => $model->service_id]);
  82 + } else {
  83 + return $this->render('create', [
  84 + 'model' => $model,
  85 + ]);
  86 + }
  87 + }
  88 +
  89 + /**
  90 + * Updates an existing Service model.
  91 + * If update is successful, the browser will be redirected to the 'view' page.
  92 + * @param integer $id
  93 + * @return mixed
  94 + */
  95 + public function actionUpdate($id)
  96 + {
  97 + $model = $this->findModel($id);
  98 +
  99 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  100 + return $this->redirect(['view', 'id' => $model->service_id]);
  101 + } else {
  102 + return $this->render('update', [
  103 + 'model' => $model,
  104 + ]);
  105 + }
  106 + }
  107 +
  108 + /**
  109 + * Deletes an existing Service model.
  110 + * If deletion is successful, the browser will be redirected to the 'index' page.
  111 + * @param integer $id
  112 + * @return mixed
  113 + */
  114 + public function actionDelete($id)
  115 + {
  116 + $this->findModel($id)->delete();
  117 +
  118 + return $this->redirect(['index']);
  119 + }
  120 +
  121 + /**
  122 + * Finds the Service model based on its primary key value.
  123 + * If the model is not found, a 404 HTTP exception will be thrown.
  124 + * @param integer $id
  125 + * @return Service the loaded model
  126 + * @throws NotFoundHttpException if the model cannot be found
  127 + */
  128 + protected function findModel($id)
  129 + {
  130 + if (($model = Service::findOne($id)) !== null) {
  131 + return $model;
  132 + } else {
  133 + throw new NotFoundHttpException('The requested page does not exist.');
  134 + }
  135 + }
  136 +}
... ...
backend/controllers/SiteController.php 0 → 100755
  1 +++ a/backend/controllers/SiteController.php
  1 +<?php
  2 +namespace backend\controllers;
  3 +use developeruz\db_rbac\behaviors\AccessBehavior;
  4 +use common\modules\product\models\Brand;
  5 +use common\modules\product\models\BrandName;
  6 +use common\modules\product\models\Category;
  7 +use common\modules\product\models\CategoryName;
  8 +use common\modules\product\models\Product;
  9 +use common\modules\product\models\ProductVariant;
  10 +use common\modules\product\models\ProductVariantType;
  11 +use Yii;
  12 +use yii\filters\AccessControl;
  13 +use yii\helpers\Url;
  14 +use yii\web\Controller;
  15 +use backend\models\LoginForm;
  16 +use yii\filters\VerbFilter;
  17 +use common\models\Blog;
  18 +/**
  19 + * Site controller
  20 + */
  21 +class SiteController extends Controller
  22 +{
  23 +
  24 +
  25 + /**
  26 + * @inheritdoc
  27 + */
  28 + public function behaviors()
  29 + {
  30 + return [
  31 + 'verbs' => [
  32 + 'class' => VerbFilter::className(),
  33 + 'actions' => [
  34 + ],
  35 + ],
  36 + ];
  37 + }
  38 +
  39 + /**
  40 + * @inheritdoc
  41 + */
  42 + public function actions()
  43 + {
  44 + return [
  45 + 'error' => [
  46 + 'class' => 'yii\web\ErrorAction',
  47 + ],
  48 + ];
  49 + }
  50 +
  51 + public function actionIndex()
  52 + {
  53 + $blog = new Blog();
  54 + $post = \Yii::$app->request->post();
  55 + if($blog->load($post)) {
  56 + $blog->save();
  57 + }
  58 + return $this->render('index',[
  59 + 'blog' => $blog
  60 + ]);
  61 + }
  62 +
  63 + public function actionLogin()
  64 + {
  65 + $this->layout = '/none';
  66 +
  67 + if (!\Yii::$app->user->isGuest) {
  68 + return $this->goHome();
  69 + }
  70 +
  71 + $model = new LoginForm();
  72 + if ($model->load(Yii::$app->request->post()) && $model->login()) {
  73 + return $this->redirect(Url::to('/admin/site/index'));
  74 + } else {
  75 + return $this->render('login', [
  76 + 'model' => $model,
  77 + ]);
  78 + }
  79 + }
  80 +
  81 + public function actionLogout()
  82 + {
  83 + Yii::$app->user->logout();
  84 +
  85 + return $this->goHome();
  86 + }
  87 +
  88 + public function actionGo() {
  89 + $new_products = $linked_products = 0;
  90 +
  91 + // открываем файл и перебираем
  92 + $filename = Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFileProducts');
  93 + if (!is_file($filename)) {
  94 + var_dump("File $filename not found");
  95 + return Controller::EXIT_CODE_ERROR;
  96 + }
  97 + var_dump("File $filename loaded\n");
  98 +
  99 + $db = yii::$app->db;
  100 +
  101 + if (($handle = fopen ($filename, 'r')) !== FALSE)
  102 + {
  103 + $j = 0;
  104 +
  105 + while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE)
  106 + {
  107 + $j++;
  108 +
  109 + foreach ($data as &$value)
  110 + {
  111 + //$value = mb_convert_encoding ($value, "UTF-8", mb_detect_encoding ($value));
  112 + $value = iconv ('windows-1251', "UTF-8//TRANSLIT//IGNORE", $value);
  113 + $value = trim ($value);
  114 + }
  115 +
  116 + // будет всегда 19 элементов
  117 + for ($i = 0; $i <= 18; $i++)
  118 + {
  119 + if (! isset ($data[$i]))
  120 + {
  121 + $data[$i] = null;
  122 + }
  123 + }
  124 +
  125 + // 1 Группа (категория)
  126 + $catalog_name = $data[0];
  127 + if (empty ($catalog_name))
  128 + {
  129 + CONTINUE;
  130 + }
  131 +
  132 + // 2 Бренд
  133 + $brand_name = $data[1];
  134 + if (empty ($brand_name))
  135 + {
  136 + CONTINUE;
  137 + }
  138 +
  139 + // 3 Название товара
  140 + $product_name = $data[2];
  141 + if (empty ($product_name))
  142 + {
  143 + CONTINUE;
  144 + }
  145 +
  146 + // 4 Описание Укр
  147 + $product_body_uk = $data[3];
  148 +
  149 + // 5 Описание Рус
  150 + $product_body_ru = $data[4];
  151 +
  152 + // 6 Фильтр (через запятую)
  153 + $filters = explode (',', $data[5]);
  154 +
  155 + // 7 Доп фильтр через запятую
  156 + $filters_extra = explode (',', $data[6]);
  157 +
  158 + // 8 Пол череззапятую (мужской, женский, детский, унисекс)
  159 + $gender = explode (',', $data[7]);
  160 +
  161 + // 9 Год
  162 + $years = explode (',', $data[8]);
  163 +
  164 + // 10 Цена старая
  165 + $product_cost_old = $data[9];
  166 +
  167 + // 11 Цена
  168 + $produc_cost = $data[10];
  169 +
  170 + // 12 Акция
  171 + $product_akciya = (bool)$data[11];
  172 +
  173 + // 13 Сопуд. Тов.
  174 + $similar = explode (',', $data[12]);
  175 +
  176 + // 14 Новинки
  177 + $product_new = (bool)$data[13];
  178 +
  179 + // 15 Топ продаж
  180 + $product_top = (bool)$data[14];
  181 +
  182 + // 16 Сетка Характеристик
  183 + $feature = explode ('=', $data[15]);
  184 +
  185 + // 17 ВИДЕО КОД
  186 + $product_video = $data[16];
  187 +
  188 + // 18 Галлерея фото
  189 + $fotos = explode (',', $data[17]);
  190 +
  191 + // 19 Штрих код товара.
  192 + // расшифровал - это модификации товара!
  193 +
  194 + $product_image = explode ('=', $data[18]);
  195 + $product_image = @$product_image[3];
  196 +
  197 + if ( ($_product = Product::find()->filterWhere(['ilike', 'name', trim($product_name)])->one()) === null ) {
  198 + $_product = new Product();
  199 + }
  200 +
  201 + // ==== Set category ====
  202 + if ( ($category = CategoryName::find()->filterWhere(['ilike', 'value', trim($catalog_name)])->one()) !== null ) {
  203 + $_product->categories = [$category->category_id];
  204 + } else {
  205 + // Create category
  206 + $category = new Category();
  207 + $category->name = trim($catalog_name);
  208 + $category->save();
  209 + $_product->categories = [$category->category_id];
  210 + }
  211 +
  212 + // ===== Set brand ====
  213 + if ( $brand_name ) {
  214 + if ( ($brand = BrandName::find()->filterWhere(['ilike', 'value', trim($brand_name)])->one()) !== null ) {
  215 + $_product->brand_id = $brand->brand_id;
  216 + } else {
  217 + // Create brand
  218 + $brand = new Brand();
  219 + $brand->name = trim($brand_name);
  220 + $brand->save();
  221 + $_product->brand_id = $brand->brand_id;
  222 + }
  223 + }
  224 +
  225 + $_product->name = $product_name;
  226 + $_product->video = $product_video;
  227 + $_product->description = $product_body_ru;
  228 + $_product->top = $product_top;
  229 + $_product->akciya = $product_akciya;
  230 + $_product->new = $product_new;
  231 +
  232 +
  233 + $_product->save();
  234 +
  235 +
  236 + // @todo Set image
  237 + /*// картинки
  238 + if (is_file ($dir.'/mod/' . $product_image))
  239 + {
  240 + $resizeObj = new resize ($dir.'/mod/' . $product_image);
  241 + $resizeObj->resizeImage (135, 200, 'auto');
  242 + $resizeObj->saveImage ($dir.'/products/ico/' . $product_image, 100);
  243 + $resizeObj->resizeImage (370, 370, 'auto');
  244 + $resizeObj->saveImage ($dir.'/products/big/' . $product_image, 100);
  245 + }*/
  246 +
  247 + // ==== mods ====
  248 +
  249 + // (типа штрих код товара)
  250 +
  251 + // нужно для проставления характеристик относящихся к модификациям
  252 + $MOD_ARRAY = [];
  253 +
  254 + for ($i = 18; $i < count ($data); $i ++)
  255 + {
  256 + if (! empty ($data[$i]))
  257 + {
  258 + $mod_arr = explode ('=', $data[$i]);
  259 + $mod_art = $mod_arr[0];
  260 + $mod_size = $mod_arr[1];
  261 + $mod_color = $mod_arr[2];
  262 + $mod_image = $mod_arr[3];
  263 + $mod_cost = $produc_cost;
  264 + $mod_old_cost = $product_cost_old;
  265 +
  266 + // Check product variant
  267 + if ( ($_productVariant = ProductVariant::find()->andWhere(['ilike', 'sku', $mod_art])->andWhere(['product_id' => $_product->product_id])->one()) === null ) {
  268 + $_productVariant = new ProductVariant();
  269 + $_productVariant->product_id = $_product->product_id;
  270 + }
  271 +
  272 + $_productVariant->sku = $mod_art;
  273 + $_productVariant->price = $mod_cost;
  274 + $_productVariant->price_old = $mod_old_cost;
  275 +
  276 + $_productVariant->save();
  277 +
  278 + $MOD_ARRAY[] = $_productVariant->product_variant_id;
  279 +
  280 +
  281 + $dir = Yii::getAlias('@productsDir').'/';
  282 + if (is_file ($dir . $mod_image))
  283 + {
  284 + $resizeObj = new resize ($dir . $mod_image);
  285 + $resizeObj->resizeImage (40, 40, 'crop');
  286 + $resizeObj->saveImage ($dir.'ico/' . $mod_image, 100);
  287 + $resizeObj->resizeImage (370, 370, 'auto');
  288 + $resizeObj->saveImage ($dir.'/big/' . $mod_image, 100);
  289 + }
  290 +
  291 + $product_variant_type_name = '';
  292 + if (! empty ($mod_color))
  293 + $product_variant_type_name = 'Цвет';
  294 + elseif (! empty ($mod_size))
  295 + $product_variant_type_name = 'Размер';
  296 +
  297 + // ===== Set variant type ====
  298 + if ( $product_variant_type_name ) {
  299 + if ( ($product_variant_type = ProductVariantType::find()->filterWhere(['ilike', 'name', $product_variant_type_name])->one()) !== null ) {
  300 + $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
  301 + } else {
  302 + // Create brand
  303 + $product_variant_type = new ProductVariantType();
  304 + $product_variant_type->name = $product_variant_type_name;
  305 + $product_variant_type->save();
  306 + $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
  307 + }
  308 + }
  309 + }
  310 + }
  311 +
  312 + /*// ==== fotos ====
  313 +
  314 + foreach ($fotos as $foto)
  315 + {
  316 + $fields = [
  317 + 'product_id' => $product_id,
  318 + 'image' => $foto
  319 + ];
  320 +
  321 + $modelFotos = Fotos::find ()
  322 + ->where ('image=:image', [
  323 + ':image' => $foto
  324 + ])
  325 + ->one ();
  326 +
  327 + if (empty ($modelFotos->id))
  328 + {
  329 + $db->createCommand ()
  330 + ->insert ('products_fotos', $fields)
  331 + ->execute ();
  332 + }
  333 + else
  334 + {
  335 + $db->createCommand ()
  336 + ->update ('products_fotos', $fields, 'id = ' . $modelFotos->id)
  337 + ->execute ();
  338 + }
  339 +
  340 + if (is_file ($dir.'/fotos/' . $foto))
  341 + {
  342 + $resizeObj = new resize ($dir.'/fotos/' . $foto);
  343 + $resizeObj->resizeImage (100, 100, 'crop');
  344 + $resizeObj->saveImage ($dir.'/fotos/ico/' . $foto, 100);
  345 + $resizeObj->resizeImage (400, 400, 'crop');
  346 + $resizeObj->saveImage ($dir.'/fotos/big/' . $foto, 100);
  347 + }
  348 + }*/
  349 +
  350 + // ========================
  351 + // ==== ХАРАКТЕРИСТИКИ ====
  352 + // ========================
  353 +
  354 + // есть общие характеристики, которые относятся product_id, такие как brand, gender...
  355 + // есть характеристики, которые относятся mod_id, такие как цвет, размер...
  356 +
  357 + // ==== gender ====
  358 +
  359 + /*if (! empty ($gender))
  360 + {
  361 + $bookGender = Book::find ()
  362 + ->where ('book_alias=:book', [
  363 + ':book' => 'gender'
  364 + ])
  365 + ->one ();
  366 +
  367 + foreach ($gender as $filter)
  368 + {
  369 + if (! empty ($filter))
  370 + {
  371 + $bookGenderValue = BookValue::find ()
  372 + ->where ('
  373 + book_id=:book
  374 + AND book_value_title=:value
  375 + AND book_value_alias=:alias
  376 + ', [
  377 + ':book' => $bookGender->book_id,
  378 + ':value' => $filter,
  379 + ':alias' => Translite::rusencode ($filter),
  380 + ]
  381 + )
  382 + ->one();
  383 +
  384 + if (! isset ($bookGenderValue->book_value_id) || empty ($bookGenderValue->book_value_id))
  385 + {
  386 + $db->createCommand ()
  387 + ->insert (BookValue::tableName (), [
  388 + 'book_id' => $bookGender->book_id,
  389 + 'book_value_title' => $filter,
  390 + 'book_value_alias' => Translite::rusencode ($filter),
  391 + ])
  392 + ->execute ();
  393 +
  394 + $book_value_id = Yii::$app->db->lastInsertID;
  395 + }
  396 + else
  397 + {
  398 + $book_value_id = $bookGenderValue->book_value_id;
  399 + }
  400 +
  401 + // + products_value
  402 + $db->createCommand ('
  403 + INSERT IGNORE products_value
  404 + SET
  405 + product_id = '.(int)$product_id.',
  406 + book_value_id = '.(int)$book_value_id.'
  407 + ')
  408 + ->execute ();
  409 + }
  410 + }
  411 + }
  412 +
  413 + // есть характеристики, которые относятся mod_id, такие как цвет, размер...
  414 +
  415 + // ==== destination ====
  416 +
  417 + if (! empty ($filters))
  418 + {
  419 + $bookDestination = Book::find ()
  420 + ->where ('book_alias=:book', [
  421 + ':book' => 'destination'
  422 + ])
  423 + ->one ();
  424 +
  425 + foreach ($filters as $filter)
  426 + {
  427 + if (! empty ($filter))
  428 + {
  429 + $bookDestinationValue = BookValue::find ()
  430 + ->where ('
  431 + book_id=:book
  432 + AND book_value_title=:value
  433 + AND book_value_alias=:alias
  434 + ', [
  435 + ':book' => $bookDestination->book_id,
  436 + ':value' => $filter,
  437 + ':alias' => Translite::rusencode ($filter),
  438 + ]
  439 + )
  440 + ->one();
  441 +
  442 + if (! isset ($bookDestinationValue->book_value_id) || empty ($bookDestinationValue->book_value_id))
  443 + {
  444 + $db->createCommand ()
  445 + ->insert (BookValue::tableName (), [
  446 + 'book_id' => $bookDestination->book_id,
  447 + 'book_value_title' => $filter,
  448 + 'book_value_alias' => Translite::rusencode ($filter),
  449 + ])
  450 + ->execute ();
  451 +
  452 + $book_value_id = Yii::$app->db->lastInsertID;
  453 + }
  454 + else
  455 + {
  456 + $book_value_id = $bookDestinationValue->book_value_id;
  457 + }
  458 +
  459 + if (! empty ($MOD_ARRAY))
  460 + {
  461 + foreach ($MOD_ARRAY as $id)
  462 + {
  463 + // + products_value
  464 + $db->createCommand ('
  465 + INSERT IGNORE mod_value
  466 + SET
  467 + mod_id = '.(int)$id.',
  468 + book_value_id = '.(int)$book_value_id.'
  469 + ')
  470 + ->execute ();
  471 + }
  472 + }
  473 + }
  474 + }
  475 + }
  476 +
  477 + // ==== special ====
  478 +
  479 + if (! empty ($filters_extra))
  480 + {
  481 + $bookSpecial = Book::find ()
  482 + ->where ('book_alias=:book', [
  483 + ':book' => 'special'
  484 + ])
  485 + ->one ();
  486 +
  487 + foreach ($filters_extra as $filter)
  488 + {
  489 + if (! empty ($filter))
  490 + {
  491 + $bookSpecialValue = BookValue::find ()
  492 + ->where ('
  493 + book_id=:book
  494 + AND book_value_title=:value
  495 + AND book_value_alias=:alias
  496 + ', [
  497 + ':book' => $bookSpecial->book_id,
  498 + ':value' => $filter,
  499 + ':alias' => Translite::rusencode ($filter),
  500 + ]
  501 + )
  502 + ->one();
  503 +
  504 + if (! isset ($bookSpecialValue->book_value_id) || empty ($bookSpecialValue->book_value_id))
  505 + {
  506 + $db->createCommand ()
  507 + ->insert (BookValue::tableName (), [
  508 + 'book_id' => $bookSpecial->book_id,
  509 + 'book_value_title' => $filter,
  510 + 'book_value_alias' => Translite::rusencode ($filter),
  511 + ])
  512 + ->execute ();
  513 +
  514 + $book_value_id = Yii::$app->db->lastInsertID;
  515 + }
  516 + else
  517 + {
  518 + $book_value_id = $bookSpecialValue->book_value_id;
  519 + }
  520 +
  521 + if (! empty ($MOD_ARRAY))
  522 + {
  523 + foreach ($MOD_ARRAY as $id)
  524 + {
  525 + // + products_value
  526 + $db->createCommand ('
  527 + INSERT IGNORE mod_value
  528 + SET
  529 + mod_id = '.(int)$id.',
  530 + book_value_id = '.(int)$book_value_id.'
  531 + ')
  532 + ->execute ();
  533 + }
  534 + }
  535 + }
  536 + }
  537 + }
  538 +
  539 + // ==== year ====
  540 +
  541 + if (! empty ($years))
  542 + {
  543 + $bookYear = Book::find ()
  544 + ->where ('book_alias=:book', [
  545 + ':book' => 'year'
  546 + ])
  547 + ->one ();
  548 +
  549 + foreach ($years as $filter)
  550 + {
  551 + if (! empty ($filter))
  552 + {
  553 + $bookYearValue = BookValue::find ()
  554 + ->where ('
  555 + book_id=:book
  556 + AND book_value_title=:value
  557 + AND book_value_alias=:alias
  558 + ', [
  559 + ':book' => $bookYear->book_id,
  560 + ':value' => $filter,
  561 + ':alias' => Translite::rusencode ($filter),
  562 + ]
  563 + )
  564 + ->one();
  565 +
  566 + if (! isset ($bookYearValue->book_value_id) || empty ($bookYearValue->book_value_id))
  567 + {
  568 + $db->createCommand ()
  569 + ->insert (BookValue::tableName (), [
  570 + 'book_id' => $bookYear->book_id,
  571 + 'book_value_title' => $filter,
  572 + 'book_value_alias' => Translite::rusencode ($filter),
  573 + ])
  574 + ->execute ();
  575 +
  576 + $book_value_id = Yii::$app->db->lastInsertID;
  577 + }
  578 + else
  579 + {
  580 + $book_value_id = $bookYearValue->book_value_id;
  581 + }
  582 +
  583 + if (! empty ($MOD_ARRAY))
  584 + {
  585 + foreach ($MOD_ARRAY as $id)
  586 + {
  587 + // + products_value
  588 + $db->createCommand ('
  589 + INSERT IGNORE mod_value
  590 + SET
  591 + mod_id = '.(int)$id.',
  592 + book_value_id = '.(int)$book_value_id.'
  593 + ')
  594 + ->execute ();
  595 + }
  596 + }
  597 + }
  598 + }
  599 + }
  600 +
  601 + // ==== $feature ====
  602 +
  603 + if (! empty ($feature))
  604 + {
  605 + foreach ($feature as $string)
  606 + {
  607 + $string = str_replace([':', '.'], '', $string);
  608 +
  609 + if (! empty ($string))
  610 + {
  611 + list ($book_title, $value_title) = explode ('*', $string);
  612 +
  613 + $book_title = trim ($book_title);
  614 + $value_title = trim ($value_title);
  615 +
  616 + if (empty ($book_title) || empty ($value_title))
  617 + {
  618 + CONTINUE;
  619 + }
  620 +
  621 + $bookFeature = Book::find ()
  622 + ->where ('book_title=:book', [
  623 + ':book' => $book_title
  624 + ])
  625 + ->one ();
  626 +
  627 + if (! isset ($bookFeature->book_id) || empty ($bookFeature->book_id))
  628 + {
  629 + $db->createCommand ()
  630 + ->insert (Book::tableName (), [
  631 + 'book_title' => $book_title,
  632 + 'book_alias' => Translite::rusencode ($book_title),
  633 + ])
  634 + ->execute ();
  635 +
  636 + $book_id = Yii::$app->db->lastInsertID;
  637 + }
  638 + else
  639 + {
  640 + $book_id = $bookFeature->book_id;
  641 + }
  642 +
  643 + $bookFeatureValue = BookValue::find ()
  644 + ->where ('
  645 + book_id=:book
  646 + AND book_value_title=:value
  647 + AND book_value_alias=:alias
  648 + ', [
  649 + ':book' => $book_id,
  650 + ':value' => $value_title,
  651 + ':alias' => Translite::rusencode ($value_title),
  652 + ]
  653 + )
  654 + ->one();
  655 +
  656 + if (! isset ($bookFeatureValue->book_value_id) || empty ($bookFeatureValue->book_value_id))
  657 + {
  658 + $db->createCommand ()
  659 + ->insert (BookValue::tableName (), [
  660 + 'book_id' => $book_id,
  661 + 'book_value_title' => $value_title,
  662 + 'book_value_alias' => Translite::rusencode ($value_title),
  663 + ])
  664 + ->execute ();
  665 +
  666 + $book_value_id = Yii::$app->db->lastInsertID;
  667 + }
  668 + else
  669 + {
  670 + $book_value_id = $bookFeatureValue->book_value_id;
  671 + }
  672 +
  673 + if (! empty ($MOD_ARRAY))
  674 + {
  675 + foreach ($MOD_ARRAY as $id)
  676 + {
  677 + // + products_value
  678 + $db->createCommand ('
  679 + INSERT IGNORE mod_value
  680 + SET
  681 + mod_id = '.(int)$id.',
  682 + book_value_id = '.(int)$book_value_id.'
  683 + ')
  684 + ->execute ();
  685 + }
  686 + }
  687 + }
  688 + }
  689 + }*/
  690 +
  691 + // ==== IMPORTANT ====
  692 +
  693 + // записуем ID обработанной записи
  694 +
  695 + $_product->save();
  696 + var_dump("$j: Product {$_product->name} saved\n");
  697 + if ($j > 100) {
  698 + var_dump("Dev OK");
  699 + exit;
  700 + }
  701 + }
  702 +
  703 + fclose ($handle);
  704 + }
  705 + }
  706 +}
... ...
backend/controllers/SliderController.php 0 → 100755
  1 +++ a/backend/controllers/SliderController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use common\models\TemplateLocation;
  6 +use Yii;
  7 +use common\models\Slider;
  8 +use common\models\SliderSearch;
  9 +use yii\helpers\ArrayHelper;
  10 +use yii\web\Controller;
  11 +use yii\web\NotFoundHttpException;
  12 +use yii\filters\VerbFilter;
  13 +use developeruz\db_rbac\behaviors\AccessBehavior;
  14 +/**
  15 + * SliderController implements the CRUD actions for Slider model.
  16 + */
  17 +class SliderController extends Controller
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function behaviors()
  23 + {
  24 + return [
  25 + 'access'=>[
  26 + 'class' => AccessBehavior::className(),
  27 + 'rules' =>
  28 + ['site' =>
  29 + [
  30 + [
  31 + 'actions' => ['login', 'error'],
  32 + 'allow' => true,
  33 + ]
  34 + ]
  35 + ]
  36 + ],
  37 + 'verbs' => [
  38 + 'class' => VerbFilter::className(),
  39 + 'actions' => [
  40 + 'delete' => ['POST'],
  41 + ],
  42 + ],
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * Lists all Slider models.
  48 + * @return mixed
  49 + */
  50 + public function actionIndex()
  51 + {
  52 + $searchModel = new SliderSearch();
  53 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  54 +
  55 + return $this->render('index', [
  56 + 'searchModel' => $searchModel,
  57 + 'dataProvider' => $dataProvider,
  58 + ]);
  59 + }
  60 +
  61 + /**
  62 + * Displays a single Slider model.
  63 + * @param integer $id
  64 + * @return mixed
  65 + */
  66 + public function actionView($id)
  67 + {
  68 + return $this->render('view', [
  69 + 'model' => $this->findModel($id),
  70 + ]);
  71 + }
  72 +
  73 + /**
  74 + * Creates a new Slider model.
  75 + * If creation is successful, the browser will be redirected to the 'view' page.
  76 + * @return mixed
  77 + */
  78 + public function actionCreate()
  79 + {
  80 + $model = new Slider();
  81 +
  82 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  83 + return $this->redirect(['view', 'id' => $model->slider_id]);
  84 + } else {
  85 +
  86 +
  87 + return $this->render('create', [
  88 + 'model' => $model,
  89 + ]);
  90 + }
  91 + }
  92 +
  93 + /**
  94 + * Updates an existing Slider model.
  95 + * If update is successful, the browser will be redirected to the 'view' page.
  96 + * @param integer $id
  97 + * @return mixed
  98 + */
  99 + public function actionUpdate($id)
  100 + {
  101 + $model = $this->findModel($id);
  102 +
  103 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  104 + return $this->redirect(['view', 'id' => $model->slider_id]);
  105 + } else {
  106 + return $this->render('update', [
  107 + 'model' => $model,
  108 + ]);
  109 + }
  110 + }
  111 +
  112 + /**
  113 + * Deletes an existing Slider model.
  114 + * If deletion is successful, the browser will be redirected to the 'index' page.
  115 + * @param integer $id
  116 + * @return mixed
  117 + */
  118 + public function actionDelete($id)
  119 + {
  120 + $this->findModel($id)->delete();
  121 +
  122 + return $this->redirect(['index']);
  123 + }
  124 +
  125 + /**
  126 + * Finds the Slider model based on its primary key value.
  127 + * If the model is not found, a 404 HTTP exception will be thrown.
  128 + * @param integer $id
  129 + * @return Slider the loaded model
  130 + * @throws NotFoundHttpException if the model cannot be found
  131 + */
  132 + protected function findModel($id)
  133 + {
  134 + if (($model = Slider::findOne($id)) !== null) {
  135 + return $model;
  136 + } else {
  137 + throw new NotFoundHttpException('The requested page does not exist.');
  138 + }
  139 + }
  140 +}
... ...
backend/controllers/SliderImageController.php 0 → 100755
  1 +++ a/backend/controllers/SliderImageController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +use developeruz\db_rbac\behaviors\AccessBehavior;
  5 +use common\models\Slider;
  6 +use Yii;
  7 +use common\models\SliderImage;
  8 +use common\models\SliderImageSearch;
  9 +use yii\web\Controller;
  10 +use yii\web\NotFoundHttpException;
  11 +use yii\filters\VerbFilter;
  12 +use yii\web\UploadedFile;
  13 +/**
  14 + * SliderImageController implements the CRUD actions for SliderImage model.
  15 + */
  16 +class SliderImageController extends Controller
  17 +{
  18 + /**
  19 + * @inheritdoc
  20 + */
  21 + public function behaviors()
  22 + {
  23 + return [
  24 + 'access'=>[
  25 + 'class' => AccessBehavior::className(),
  26 + 'rules' =>
  27 + ['site' =>
  28 + [
  29 + [
  30 + 'actions' => ['login', 'error'],
  31 + 'allow' => true,
  32 + ]
  33 + ]
  34 + ]
  35 + ],
  36 + 'verbs' => [
  37 + 'class' => VerbFilter::className(),
  38 + 'actions' => [
  39 + 'delete' => ['POST'],
  40 + ],
  41 + ],
  42 + ];
  43 + }
  44 +
  45 + /**
  46 + * Lists all SliderImage models.
  47 + * @param $slider_id Slider id
  48 + * @return mixed
  49 + */
  50 + public function actionIndex($slider_id)
  51 + {
  52 + $searchModel = new SliderImageSearch();
  53 + $dataProvider = $searchModel->search($slider_id, Yii::$app->request->queryParams);
  54 +
  55 + return $this->render('index', [
  56 + 'slider_id' => $slider_id,
  57 + 'searchModel' => $searchModel,
  58 + 'dataProvider' => $dataProvider,
  59 + ]);
  60 + }
  61 +
  62 + /**
  63 + * Displays a single SliderImage model.
  64 + * @param integer $id
  65 + * @param $slider_id Slider id
  66 + * @return mixed
  67 + */
  68 + public function actionView($slider_id, $id)
  69 + {
  70 + return $this->render('view', [
  71 + 'slider_id' => $slider_id,
  72 + 'model' => $this->findModel($slider_id, $id),
  73 + ]);
  74 + }
  75 +
  76 + /**
  77 + * Creates a new SliderImage model.
  78 + * If creation is successful, the browser will be redirected to the 'view' page.
  79 + * @param $slider_id Slider id
  80 + * @return mixed
  81 + */
  82 + public function actionCreate($slider_id)
  83 + {
  84 + $model = new SliderImage();
  85 +
  86 + if ($model->load(Yii::$app->request->post())) {
  87 + $model->slider_id = $slider_id;
  88 + if ( ($image = UploadedFile::getInstance($model, 'image')) ) {
  89 + $model->image = $image->name;
  90 + }
  91 + if ($model->save() && $image) {
  92 +
  93 + $imgDir = Yii::getAlias('@storage/slider/');
  94 +
  95 + if(!is_dir($imgDir)) {
  96 + mkdir($imgDir, 0755, true);
  97 + }
  98 +
  99 + $image->saveAs(Yii::getAlias('@storage/slider/' . $image->name));
  100 + }
  101 + return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]);
  102 + } else {
  103 +
  104 + $slider = Slider::findOne($slider_id);
  105 +
  106 + return $this->render('create', [
  107 + 'slider_id' => $slider_id,
  108 + 'model' => $model,
  109 + 'slider' => $slider,
  110 + ]);
  111 + }
  112 + }
  113 +
  114 + /**
  115 + * Updates an existing SliderImage model.
  116 + * If update is successful, the browser will be redirected to the 'view' page.
  117 + * @param $slider_id Slider id
  118 + * @param integer $id
  119 + * @return mixed
  120 + */
  121 + public function actionUpdate($slider_id, $id)
  122 + {
  123 + $model = $this->findModel($slider_id, $id);
  124 +
  125 + if ($model->load(Yii::$app->request->post())) {
  126 +
  127 +
  128 +
  129 + if ( ($image = UploadedFile::getInstance($model, 'image')) ) {
  130 + $model->image = $image->name;
  131 + }
  132 +
  133 + if(!$model->image){
  134 + $model->image = $model->getOldAttribute('image');
  135 + }
  136 +
  137 + if ($model->save() && $image) {
  138 + $imgDir = Yii::getAlias('@storage/slider/');
  139 +
  140 + if(!is_dir($imgDir)) {
  141 + mkdir($imgDir, 0755, true);
  142 + }
  143 +
  144 + $image->saveAs(Yii::getAlias('@storage/slider/' . $image->name));
  145 + }
  146 + return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]);
  147 + } else {
  148 +
  149 + $slider = Slider::findOne($slider_id);
  150 + return $this->render('update', [
  151 + 'model' => $model,
  152 + 'slider_id' => $slider_id,
  153 + 'slider' => $slider,
  154 + ]);
  155 + }
  156 + }
  157 +
  158 + /**
  159 + * Deletes an existing SliderImage model.
  160 + * If deletion is successful, the browser will be redirected to the 'index' page.
  161 + * @param $slider_id Slider id
  162 + * @param integer $id
  163 + * @return mixed
  164 + */
  165 + public function actionDelete($slider_id, $id)
  166 + {
  167 + $this->findModel($slider_id, $id)->delete();
  168 +
  169 + return $this->redirect(['index','slider_id'=>$slider_id]);
  170 + }
  171 +
  172 + /**
  173 + * Finds the SliderImage model based on its primary key value.
  174 + * If the model is not found, a 404 HTTP exception will be thrown.
  175 + * @param $slider_id Slider id
  176 + * @param integer $id
  177 + * @return SliderImage the loaded model
  178 + * @throws NotFoundHttpException if the model cannot be found
  179 + */
  180 + protected function findModel($slider_id,$id)
  181 + {
  182 + if (($model = SliderImage::find()->where(['slider_image_id'=> $id, 'slider_id'=>$slider_id])->one()) !== null) {
  183 + return $model;
  184 + } else {
  185 + throw new NotFoundHttpException('The requested page does not exist.');
  186 + }
  187 + }
  188 +}
... ...
backend/controllers/SubscribeController.php 0 → 100755
  1 +++ a/backend/controllers/SubscribeController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Subscribe;
  7 +use common\models\SubscribeSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +use developeruz\db_rbac\behaviors\AccessBehavior;
  12 +/**
  13 + * SubscribeController implements the CRUD actions for Subscribe model.
  14 + */
  15 +class SubscribeController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'access'=>[
  24 + 'class' => AccessBehavior::className(),
  25 + 'rules' =>
  26 + ['site' =>
  27 + [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ]
  32 + ]
  33 + ]
  34 + ],
  35 + 'verbs' => [
  36 + 'class' => VerbFilter::className(),
  37 + 'actions' => [
  38 + 'delete' => ['POST'],
  39 + ],
  40 + ],
  41 + ];
  42 + }
  43 +
  44 + /**
  45 + * Lists all Subscribe models.
  46 + * @return mixed
  47 + */
  48 + public function actionIndex()
  49 + {
  50 + $searchModel = new SubscribeSearch();
  51 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  52 +
  53 + return $this->render('index', [
  54 + 'searchModel' => $searchModel,
  55 + 'dataProvider' => $dataProvider,
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Displays a single Subscribe model.
  61 + * @param integer $id
  62 + * @return mixed
  63 + */
  64 + public function actionView($id)
  65 + {
  66 + return $this->render('view', [
  67 + 'model' => $this->findModel($id),
  68 + ]);
  69 + }
  70 +
  71 + /**
  72 + * Creates a new Subscribe model.
  73 + * If creation is successful, the browser will be redirected to the 'view' page.
  74 + * @return mixed
  75 + */
  76 + public function actionCreate()
  77 + {
  78 + $model = new Subscribe();
  79 +
  80 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  81 + return $this->redirect(['view', 'id' => $model->id]);
  82 + } else {
  83 + return $this->render('create', [
  84 + 'model' => $model,
  85 + ]);
  86 + }
  87 + }
  88 +
  89 + /**
  90 + * Updates an existing Subscribe model.
  91 + * If update is successful, the browser will be redirected to the 'view' page.
  92 + * @param integer $id
  93 + * @return mixed
  94 + */
  95 + public function actionUpdate($id)
  96 + {
  97 + $model = $this->findModel($id);
  98 +
  99 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  100 + return $this->redirect(['view', 'id' => $model->id]);
  101 + } else {
  102 + return $this->render('update', [
  103 + 'model' => $model,
  104 + ]);
  105 + }
  106 + }
  107 +
  108 + /**
  109 + * Deletes an existing Subscribe model.
  110 + * If deletion is successful, the browser will be redirected to the 'index' page.
  111 + * @param integer $id
  112 + * @return mixed
  113 + */
  114 + public function actionDelete($id)
  115 + {
  116 + $this->findModel($id)->delete();
  117 +
  118 + return $this->redirect(['index']);
  119 + }
  120 +
  121 + /**
  122 + * Finds the Subscribe model based on its primary key value.
  123 + * If the model is not found, a 404 HTTP exception will be thrown.
  124 + * @param integer $id
  125 + * @return Subscribe the loaded model
  126 + * @throws NotFoundHttpException if the model cannot be found
  127 + */
  128 + protected function findModel($id)
  129 + {
  130 + if (($model = Subscribe::findOne($id)) !== null) {
  131 + return $model;
  132 + } else {
  133 + throw new NotFoundHttpException('The requested page does not exist.');
  134 + }
  135 + }
  136 +}
... ...
backend/controllers/UserController.php 0 → 100755
  1 +++ a/backend/controllers/UserController.php
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use backend\models\User;
  7 +use backend\models\UserSearch;
  8 +use yii\filters\AccessControl;
  9 +use yii\web\Controller;
  10 +use yii\web\NotFoundHttpException;
  11 +use yii\filters\VerbFilter;
  12 +use yii\web\Response;
  13 +use yii\widgets\ActiveForm;
  14 +
  15 +/**
  16 + * UserController implements the CRUD actions for User model.
  17 + */
  18 +class UserController extends Controller
  19 +{
  20 + /**
  21 + * @inheritdoc
  22 + */
  23 + public function behaviors()
  24 + {
  25 +
  26 +
  27 + return [
  28 + 'verbs' => [
  29 + 'class' => VerbFilter::className(),
  30 + 'actions' => [
  31 + 'delete' => ['POST'],
  32 + ],
  33 + ],
  34 + 'access' => [
  35 + 'class' => AccessControl::className(),
  36 + 'rules' => [
  37 + [
  38 + 'allow' => true,
  39 +// 'actions' => ['login', 'signup'],
  40 + 'roles' => ['admin'],
  41 + ],
  42 + [
  43 +// 'allow' => true,
  44 +// 'actions' => ['logout'],
  45 +// 'roles' => ['@'],
  46 + ],
  47 + ],
  48 + ],
  49 + ];
  50 + }
  51 +
  52 + /**
  53 + * Lists all User models.
  54 + * @return mixed
  55 + */
  56 + public function actionIndex()
  57 + {
  58 + $searchModel = new UserSearch();
  59 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  60 +
  61 + return $this->render('index', [
  62 + 'searchModel' => $searchModel,
  63 + 'dataProvider' => $dataProvider,
  64 + ]);
  65 + }
  66 +
  67 + /**
  68 + * Displays a single User model.
  69 + * @param integer $id
  70 + * @return mixed
  71 + */
  72 + public function actionView($id)
  73 + {
  74 + return $this->render('view', [
  75 + 'model' => $this->findModel($id),
  76 + ]);
  77 + }
  78 +
  79 + /**
  80 + * Creates a new User model.
  81 + * If creation is successful, the browser will be redirected to the 'view' page.
  82 + * @return mixed
  83 + */
  84 + public function actionCreate()
  85 + {
  86 + $model = new User();
  87 + if (Yii::$app->request->isAjax) {
  88 + Yii::$app->response->format = Response::FORMAT_JSON;
  89 + $model->load(Yii::$app->request->post());
  90 + return ActiveForm::validate($model);
  91 + }else if ($model->load(Yii::$app->request->post()) && $model->validate()) {
  92 + $model->save();
  93 +
  94 + foreach($model->role as $k => $role){
  95 + $auth = Yii::$app->authManager;
  96 + $authorRole = $auth->getRole($role);
  97 + $auth->assign($authorRole, $model->id);
  98 + }
  99 +
  100 + return $this->redirect(['view', 'id' => $model->id]);
  101 + } else {
  102 + return $this->render('create', [
  103 + 'model' => $model,
  104 + ]);
  105 + }
  106 + }
  107 +
  108 + /**
  109 + * Updates an existing User model.
  110 + * If update is successful, the browser will be redirected to the 'view' page.
  111 + * @param integer $id
  112 + * @return mixed
  113 + */
  114 + public function actionUpdate($id)
  115 + {
  116 + $model = $this->findModel($id);
  117 + if (Yii::$app->request->isAjax) {
  118 + Yii::$app->response->format = Response::FORMAT_JSON;
  119 + $model->load(Yii::$app->request->post());
  120 + return ActiveForm::validate($model);
  121 + }else if ($model->load(Yii::$app->request->post()) && $model->validate()) {
  122 +
  123 + $model->save();
  124 +
  125 + return $this->redirect(['view', 'id' => $model->id]);
  126 + } else {
  127 + return $this->render('create', [
  128 + 'model' => $model,
  129 + ]);
  130 + }
  131 + }
  132 +
  133 + /**
  134 + * Deletes an existing User model.
  135 + * If deletion is successful, the browser will be redirected to the 'index' page.
  136 + * @param integer $id
  137 + * @return mixed
  138 + */
  139 + public function actionDelete($id)
  140 + {
  141 + $this->findModel($id)->delete();
  142 +
  143 + return $this->redirect(['index']);
  144 + }
  145 +
  146 + /**
  147 + * Finds the User model based on its primary key value.
  148 + * If the model is not found, a 404 HTTP exception will be thrown.
  149 + * @param integer $id
  150 + * @return User the loaded model
  151 + * @throws NotFoundHttpException if the model cannot be found
  152 + */
  153 + protected function findModel($id)
  154 + {
  155 + if (($model = User::findOne($id)) !== null) {
  156 + return $model;
  157 + } else {
  158 + throw new NotFoundHttpException('The requested page does not exist.');
  159 + }
  160 + }
  161 +}
... ...
backend/models/.gitkeep 0 → 100755
  1 +++ a/backend/models/.gitkeep
  1 +*
... ...
backend/models/CommentSearch.php 0 → 100755
  1 +++ a/backend/models/CommentSearch.php
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\modules\comment\models\Comment;
  9 +
  10 +/**
  11 + * CommentSearch represents the model behind the search form about `common\modules\comment\models\Comment`.
  12 + */
  13 +class CommentSearch extends Comment
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['comment_id', 'user_id', 'comment_pid', 'status', 'model_id'], 'integer'],
  22 + [['text', 'user_name', 'user_email', 'date_add', 'date_update', 'date_delete', 'model'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = Comment::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'comment_id' => $this->comment_id,
  63 + 'user_id' => $this->user_id,
  64 + 'comment_pid' => $this->comment_pid,
  65 + 'status' => $this->status,
  66 + 'date_add' => $this->date_add,
  67 + 'date_update' => $this->date_update,
  68 + 'date_delete' => $this->date_delete,
  69 + 'model_id' => $this->model_id,
  70 + ]);
  71 +
  72 + $query->andFilterWhere(['like', 'text', $this->text])
  73 + ->andFilterWhere(['like', 'user_name', $this->user_name])
  74 + ->andFilterWhere(['like', 'user_email', $this->user_email])
  75 + ->andFilterWhere(['like', 'model', $this->model]);
  76 +
  77 + return $dataProvider;
  78 + }
  79 +}
... ...
backend/models/Label.php 0 → 100755
  1 +++ a/backend/models/Label.php
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +use Yii;
  5 +
  6 +
  7 +class Label extends \yii\db\ActiveRecord
  8 +{
  9 +
  10 + public static function tableName()
  11 + {
  12 + return 'orders_label';
  13 + }
  14 +
  15 +
  16 + public function getNl(){
  17 + return $this->name;
  18 + }
  19 +
  20 +
  21 +
  22 +
  23 +
  24 +
  25 +}
... ...
backend/models/LoginForm.php 0 → 100755
  1 +++ a/backend/models/LoginForm.php
  1 +<?php
  2 +namespace backend\models;
  3 +
  4 +use common\models\User;
  5 +use Yii;
  6 +use yii\base\Model;
  7 +
  8 +/**
  9 + * Login form
  10 + */
  11 +class LoginForm extends Model
  12 +{
  13 + public $username;
  14 + public $password;
  15 + public $rememberMe = true;
  16 +
  17 + private $_user;
  18 +
  19 +
  20 + /**
  21 + * @inheritdoc
  22 + */
  23 + public function rules()
  24 + {
  25 + return [
  26 + // username and password are both required
  27 + [['username', 'password'], 'required'],
  28 + // rememberMe must be a boolean value
  29 + ['rememberMe', 'boolean'],
  30 + // password is validated by validatePassword()
  31 + ['password', 'validatePassword'],
  32 + ];
  33 + }
  34 +
  35 + /**
  36 + * Validates the password.
  37 + * This method serves as the inline validation for password.
  38 + *
  39 + * @param string $attribute the attribute currently being validated
  40 + * @param array $params the additional name-value pairs given in the rule
  41 + */
  42 + public function validatePassword($attribute, $params)
  43 + {
  44 + if (!$this->hasErrors()) {
  45 + $user = $this->getUser();
  46 + if (!$user || !$user->validatePassword($this->password)) {
  47 + $this->addError($attribute, 'Incorrect username or password.');
  48 + }
  49 + }
  50 + }
  51 +
  52 + /**
  53 + * Logs in a user using the provided username and password.
  54 + *
  55 + * @return boolean whether the user is logged in successfully
  56 + */
  57 + public function login()
  58 + {
  59 + if ($this->validate()) {
  60 + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
  61 + } else {
  62 + return false;
  63 + }
  64 + }
  65 +
  66 + /**
  67 + * Finds user by [[username]]
  68 + *
  69 + * @return User|null
  70 + */
  71 + protected function getUser()
  72 + {
  73 + if ($this->_user === null) {
  74 + $this->_user = User::findByUsername($this->username);
  75 + }
  76 +
  77 + return $this->_user;
  78 + }
  79 +
  80 + /**
  81 + * @inheritdoc
  82 + */
  83 + public function attributeLabels()
  84 + {
  85 + return [
  86 +
  87 + 'username' => 'Имя пользователя',
  88 + 'password' => 'Пароль',
  89 + 'rememberMe' => 'Запомнить пароль',
  90 +
  91 + ];
  92 + }
  93 +}
... ...
backend/models/Orders.php 0 → 100755
  1 +++ a/backend/models/Orders.php
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +use common\models\Customer;
  5 +use Yii;
  6 +
  7 +class Orders extends \yii\db\ActiveRecord
  8 +{
  9 + public $labels;
  10 + public static function tableName()
  11 + {
  12 + return 'orders';
  13 + }
  14 +
  15 + public function rules()
  16 + {
  17 + return [
  18 + [['name'], 'required'],
  19 + [['user_id','adress','body','total','status','email',
  20 + 'comment','labels','pay','date_dedline','phone','phone2','numbercard','delivery',
  21 + 'declaration','stock','consignment','payment', 'insurance',
  22 + 'amount_imposed','shipping_by','city','date_time', 'id' ], 'safe'],
  23 + //[['image'], 'file', 'extensions'=>'jpg, gif, png', 'skipOnEmpty'=>true],
  24 + ];
  25 + }
  26 +
  27 + public function attributeLabels()
  28 + {
  29 + return [
  30 + 'id'=>'№ заказа',
  31 + 'name'=>'ФИО',
  32 + 'phone'=>'Телефон',
  33 + 'phone2'=>'Телефон 2',
  34 + 'adress'=>'Адрес',
  35 + 'body'=>'Сообщение',
  36 + 'reserve'=>'Резерв',
  37 + 'status'=>'Статус',
  38 + 'email'=>'E-mail',
  39 + 'total'=>'Сумма',
  40 + 'labels'=>'Метки',
  41 + 'label'=>'Метка',
  42 + 'comment'=>'Комментарий менеджера',
  43 + 'date_dedline'=>'Дедлайн',
  44 + 'numbercard'=>'№ карточки',
  45 + 'delivery'=>'Доставка',
  46 + 'declaration'=>'Декларация №',
  47 + 'stock'=>'№ склада',
  48 + 'consignment'=>'№ накладной',
  49 + 'payment'=>'Способ оплаты',
  50 + 'insurance'=>'Страховка',
  51 + 'amount_imposed'=>'Сумма наложенного',
  52 + 'shipping_by'=>'Отправка за счет',
  53 + 'city'=>'Город'
  54 + ];
  55 + }
  56 +
  57 + public function beforeSave($insert) {
  58 + return parent::beforeSave($insert);
  59 + }
  60 +
  61 + public function beforeDelete() {
  62 + return parent::beforeDelete();
  63 + }
  64 +
  65 + public function getUser()
  66 + {
  67 + return $this->hasOne(Customer::className(), ['id' => 'user_id']);
  68 + }
  69 +
  70 +
  71 +
  72 +}
0 73 \ No newline at end of file
... ...
backend/models/OrdersProducts.php 0 → 100755
  1 +++ a/backend/models/OrdersProducts.php
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +use common\modules\product\models\ProductVariant;
  5 +use Yii;
  6 +
  7 +class OrdersProducts extends \yii\db\ActiveRecord
  8 +{
  9 +
  10 + public static function tableName()
  11 + {
  12 + return 'orders_products';
  13 + }
  14 +
  15 + public function rules()
  16 + {
  17 + return [
  18 + [['sku','count','order_id'], 'required'],
  19 + ];
  20 + }
  21 +
  22 + public function attributeLabels()
  23 + {
  24 + return [
  25 + 'product_name'=>'Продукт',
  26 + 'name'=>'Вид',
  27 + 'art'=>'Артикул',
  28 + 'cost'=>'Цена за один',
  29 + 'count'=>'Кол.',
  30 + 'sum_cost'=>'Сумма',
  31 + ];
  32 + }
  33 +
  34 + public function getMod()
  35 + {
  36 + return $this->hasOne(ProductVariant::className(), ['product_variant_id' => 'mod_id']);
  37 + }
  38 +}
0 39 \ No newline at end of file
... ...
backend/models/OrdersSearch.php 0 → 100755
  1 +++ a/backend/models/OrdersSearch.php
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use backend\models\Orders;
  9 +
  10 +/**
  11 + * OrdersSearch represents the model behind the search form about `backend\models\Orders`.
  12 + */
  13 +class OrdersSearch extends Orders
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id', 'user_id', 'label', 'pay', 'numbercard'], 'integer'],
  22 + [['name', 'phone', 'phone2', 'email', 'adress', 'body', 'date_time', 'date_dedline', 'reserve', 'status', 'comment', 'delivery', 'declaration', 'stock', 'consignment', 'payment', 'insurance', 'shipping_by', 'city'], 'safe'],
  23 + [['total', 'amount_imposed'], 'number'],
  24 + ];
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function scenarios()
  31 + {
  32 + // bypass scenarios() implementation in the parent class
  33 + return Model::scenarios();
  34 + }
  35 +
  36 + /**
  37 + * Creates data provider instance with search query applied
  38 + *
  39 + * @param array $params
  40 + *
  41 + * @return ActiveDataProvider
  42 + */
  43 + public function search($params)
  44 + {
  45 + $query = Orders::find();
  46 +
  47 + // add conditions that should always apply here
  48 +
  49 + $dataProvider = new ActiveDataProvider([
  50 + 'query' => $query,
  51 + 'sort'=> ['defaultOrder' => ['id'=>SORT_DESC]],
  52 + 'pagination' => [
  53 + 'pageSize' => 20,
  54 + ]
  55 + ]);
  56 +
  57 + $this->load($params);
  58 +
  59 + if (!$this->validate()) {
  60 + // uncomment the following line if you do not want to return any records when validation fails
  61 + // $query->where('0=1');
  62 + return $dataProvider;
  63 + }
  64 +
  65 + // grid filtering conditions
  66 + $query->andFilterWhere([
  67 + 'id' => $this->id,
  68 + 'user_id' => $this->user_id,
  69 + 'total' => $this->total,
  70 + 'date_time' => $this->date_time,
  71 + 'date_dedline' => $this->date_dedline,
  72 + 'label' => $this->label,
  73 + 'pay' => $this->pay,
  74 + 'numbercard' => $this->numbercard,
  75 + 'amount_imposed' => $this->amount_imposed,
  76 + ]);
  77 +
  78 + $query->andFilterWhere(['like', 'name', $this->name])
  79 + ->andFilterWhere(['like', 'phone', $this->phone])
  80 + ->andFilterWhere(['like', 'phone2', $this->phone2])
  81 + ->andFilterWhere(['like', 'email', $this->email])
  82 + ->andFilterWhere(['like', 'adress', $this->adress])
  83 + ->andFilterWhere(['like', 'body', $this->body])
  84 + ->andFilterWhere(['like', 'reserve', $this->reserve])
  85 + ->andFilterWhere(['like', 'status', $this->status])
  86 + ->andFilterWhere(['like', 'comment', $this->comment])
  87 + ->andFilterWhere(['like', 'delivery', $this->delivery])
  88 + ->andFilterWhere(['like', 'declaration', $this->declaration])
  89 + ->andFilterWhere(['like', 'stock', $this->stock])
  90 + ->andFilterWhere(['like', 'consignment', $this->consignment])
  91 + ->andFilterWhere(['like', 'payment', $this->payment])
  92 + ->andFilterWhere(['like', 'insurance', $this->insurance])
  93 + ->andFilterWhere(['like', 'shipping_by', $this->shipping_by])
  94 + ->andFilterWhere(['like', 'city', $this->city]);
  95 +
  96 + return $dataProvider;
  97 + }
  98 +}
... ...
backend/models/User.php 0 → 100755
  1 +++ a/backend/models/User.php
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +
  5 +use developeruz\db_rbac\interfaces\UserRbacInterface;
  6 +use common\models\Share;
  7 +use common\modules\comment\models\Comment;
  8 +use common\modules\comment\models\Rating;
  9 +use yii\base\NotSupportedException;
  10 +use Yii;
  11 +use yii\behaviors\TimestampBehavior;
  12 +use yii\db\ActiveRecord;
  13 +use yii\web\IdentityInterface;
  14 +/**
  15 + * This is the model class for table "user".
  16 + *
  17 + * @property integer $id
  18 + * @property string $username
  19 + * @property string $auth_key
  20 + * @property string $password_hash
  21 + * @property string $password_reset_token
  22 + * @property string $email
  23 + * @property integer $status
  24 + * @property integer $created_at
  25 + * @property integer $updated_at
  26 + *
  27 + * @property Comment[] $comments
  28 + * @property Rating[] $ratings
  29 + * @property Share[] $shares
  30 + */
  31 +class User extends ActiveRecord implements UserRbacInterface, IdentityInterface
  32 +{
  33 +
  34 + const STATUS_DELETED = 0;
  35 + const STATUS_ACTIVE = 10;
  36 + public $password;
  37 +
  38 + /**
  39 + * @inheritdoc
  40 + */
  41 + public static function tableName()
  42 + {
  43 + return 'user';
  44 + }
  45 +
  46 + /**
  47 + * @inheritdoc
  48 + */
  49 + public function rules()
  50 + {
  51 + return [
  52 + [['username', 'password', 'email'], 'required'],
  53 + [['status', 'created_at', 'updated_at'], 'integer'],
  54 + [['username', 'password_hash', 'password_reset_token', 'email'], 'string', 'max' => 255],
  55 + [['auth_key'], 'string', 'max' => 32],
  56 + [['password_reset_token'], 'unique'],
  57 + ['email', 'unique', 'targetClass' => '\backend\models\User', 'message' => Yii::t('app','message',[
  58 + 'field' => 'Email'
  59 + ])],
  60 + ];
  61 + }
  62 +
  63 +
  64 + /**
  65 + * @inheritdoc
  66 + */
  67 + public function behaviors()
  68 + {
  69 + return [
  70 + TimestampBehavior::className(),
  71 + [
  72 + 'class' => 'common\behaviors\ShowImage',
  73 + ],
  74 + ];
  75 + }
  76 +
  77 +
  78 + public function beforeSave($insert)
  79 + {
  80 + $this->setPassword($this->password);
  81 + $this->generateAuthKey();
  82 + return parent::beforeSave($insert);
  83 + }
  84 +
  85 +
  86 +
  87 + /**
  88 + * @inheritdoc
  89 + */
  90 + public function attributeLabels()
  91 + {
  92 + return [
  93 + 'id' => 'ID',
  94 + 'username' => 'Username',
  95 + 'auth_key' => 'Auth Key',
  96 + 'password_hash' => 'Password Hash',
  97 + 'password_reset_token' => 'Password Reset Token',
  98 + 'email' => 'Email',
  99 + 'status' => 'Status',
  100 + 'created_at' => 'Created At',
  101 + 'updated_at' => 'Updated At',
  102 + ];
  103 + }
  104 +
  105 +
  106 + /**
  107 + * Generates "remember me" authentication key
  108 + */
  109 + public function generateAuthKey()
  110 + {
  111 + $this->auth_key = Yii::$app->security->generateRandomString();
  112 + }
  113 +
  114 + /**
  115 + * Generates password hash from password and sets it to the model
  116 + *
  117 + * @param string $password
  118 + */
  119 + public function setPassword($password)
  120 + {
  121 + $this->password_hash = Yii::$app->security->generatePasswordHash($password);
  122 + }
  123 +
  124 +
  125 +
  126 +
  127 +
  128 + public function getRole(){
  129 + return !empty($this->id) ? \Yii::$app->authManager->getRolesByUser($this->id) : "";
  130 + }
  131 +
  132 + /**
  133 + * @inheritdoc
  134 + */
  135 + public function getId()
  136 + {
  137 + return $this->getPrimaryKey();
  138 + }
  139 +
  140 + /**
  141 + * @inheritdoc
  142 + */
  143 + public function getAuthKey()
  144 + {
  145 + return $this->auth_key;
  146 + }
  147 +
  148 + /**
  149 + * @inheritdoc
  150 + */
  151 + public function validateAuthKey($authKey)
  152 + {
  153 + return $this->getAuthKey() === $authKey;
  154 + }
  155 +
  156 +
  157 + /**
  158 + * @inheritdoc
  159 + */
  160 + public static function findIdentityByAccessToken($token, $type = null)
  161 + {
  162 + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
  163 + }
  164 +
  165 + /**
  166 + * @inheritdoc
  167 + */
  168 + public static function findIdentity($id)
  169 + {
  170 + return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
  171 + }
  172 +
  173 + /**
  174 + * @return \yii\db\ActiveQuery
  175 + */
  176 + public function getComments()
  177 + {
  178 + return $this->hasMany(Comment::className(), ['user_id' => 'id']);
  179 + }
  180 +
  181 + /**
  182 + * @return \yii\db\ActiveQuery
  183 + */
  184 + public function getRatings()
  185 + {
  186 + return $this->hasMany(Rating::className(), ['user_id' => 'id']);
  187 + }
  188 +
  189 + /**
  190 + * @return \yii\db\ActiveQuery
  191 + */
  192 + public function getShares()
  193 + {
  194 + return $this->hasMany(Share::className(), ['user_id' => 'id']);
  195 + }
  196 +
  197 +
  198 + public function getUserName()
  199 + {
  200 + return $this->username;
  201 + }
  202 +
  203 +
  204 +}
... ...
backend/models/UserSearch.php 0 → 100755
  1 +++ a/backend/models/UserSearch.php
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use backend\models\User;
  9 +
  10 +/**
  11 + * UserSearch represents the model behind the search form about `backend\models\User`.
  12 + */
  13 +class UserSearch extends User
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id', 'status', 'created_at', 'updated_at'], 'integer'],
  22 + [['username', 'auth_key', 'password_hash', 'password_reset_token', 'email'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = User::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'id' => $this->id,
  63 + 'status' => $this->status,
  64 + 'created_at' => $this->created_at,
  65 + 'updated_at' => $this->updated_at,
  66 + ]);
  67 +
  68 + $query->andFilterWhere(['like', 'username', $this->username])
  69 + ->andFilterWhere(['like', 'auth_key', $this->auth_key])
  70 + ->andFilterWhere(['like', 'password_hash', $this->password_hash])
  71 + ->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])
  72 + ->andFilterWhere(['like', 'email', $this->email]);
  73 +
  74 + return $dataProvider;
  75 + }
  76 +}
... ...
backend/views/articles/_form.php 0 → 100755
  1 +++ a/backend/views/articles/_form.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +use common\modules\file\widgets\ImageUploader;
  6 +use mihaildev\ckeditor\CKEditor;
  7 +use mihaildev\elfinder\ElFinder;
  8 +use yii\jui\DatePicker;
  9 +/* @var $this yii\web\View */
  10 +/* @var $model common\models\Articles */
  11 +/* @var $form yii\widgets\ActiveForm */
  12 +?>
  13 +
  14 +<div class="articles-form">
  15 +
  16 + <?php $form = ActiveForm::begin([
  17 + 'enableClientValidation' => false,
  18 + 'options' => ['enctype' => 'multipart/form-data']
  19 + ]); ?>
  20 +
  21 +
  22 + <?= $form->field($model, 'date')
  23 + ->widget(DatePicker::className(), [
  24 + 'dateFormat' => 'yyyy-MM-dd',
  25 + 'clientOptions' => [ 'minDate' => 1 ],
  26 + ]) ?>
  27 + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  28 +
  29 + <?= $form->field($model, 'body')->widget(CKEditor::className(),
  30 + [
  31 + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
  32 + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  33 + 'inline' => false, //по умолчанию false]),
  34 + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
  35 + ]
  36 + )
  37 + ]) ?>
  38 +
  39 +
  40 + <?= $form->field($model, 'image')->widget(\kartik\file\FileInput::classname(), [
  41 + 'language' => 'ru',
  42 + 'options' => [
  43 + 'accept' => 'image/*',
  44 + 'multiple' => false,
  45 + ],
  46 + 'pluginOptions' => [
  47 + 'allowedFileExtensions' => ['jpg', 'gif', 'png'],
  48 + 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '',
  49 + 'overwriteInitial' => true,
  50 + 'showRemove' => false,
  51 + 'showUpload' => false,
  52 + 'previewFileType' => 'image',
  53 + ],
  54 + ]); ?>
  55 +
  56 + <?= $form->field($model, 'translit')->textInput(['maxlength' => true]) ?>
  57 +
  58 + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
  59 +
  60 + <?= $form->field($model, 'meta_keywords')->textInput(['maxlength' => true]) ?>
  61 +
  62 + <?= $form->field($model, 'meta_description')->textInput(['maxlength' => true]) ?>
  63 +
  64 + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
  65 +
  66 + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?>
  67 +
  68 + <div class="form-group">
  69 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  70 + </div>
  71 +
  72 + <?php ActiveForm::end(); ?>
  73 +
  74 +</div>
... ...
backend/views/articles/_search.php 0 → 100755
  1 +++ a/backend/views/articles/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\ArticlesSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="articles-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'date') ?>
  21 +
  22 + <?= $form->field($model, 'title') ?>
  23 +
  24 + <?= $form->field($model, 'body') ?>
  25 +
  26 + <?= $form->field($model, 'image') ?>
  27 +
  28 + <?php // echo $form->field($model, 'translit') ?>
  29 +
  30 + <?php // echo $form->field($model, 'meta_title') ?>
  31 +
  32 + <?php // echo $form->field($model, 'meta_keywords') ?>
  33 +
  34 + <?php // echo $form->field($model, 'meta_description') ?>
  35 +
  36 + <?php // echo $form->field($model, 'seo_text') ?>
  37 +
  38 + <?php // echo $form->field($model, 'h1') ?>
  39 +
  40 + <div class="form-group">
  41 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  42 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  43 + </div>
  44 +
  45 + <?php ActiveForm::end(); ?>
  46 +
  47 +</div>
... ...
backend/views/articles/create.php 0 → 100755
  1 +++ a/backend/views/articles/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Articles */
  8 +
  9 +$this->title = 'Create Articles';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Articles', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="articles-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/articles/index.php 0 → 100755
  1 +++ a/backend/views/articles/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\ArticlesSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Articles';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="articles-index" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
  14 +
  15 + <h1 itemprop="title"><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Articles', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'date',
  29 + 'title',
  30 + 'image',
  31 + // 'translit',
  32 + // 'meta_title',
  33 + // 'meta_keywords',
  34 + // 'meta_description',
  35 + // 'seo_text:ntext',
  36 + // 'h1',
  37 +
  38 + ['class' => 'yii\grid\ActionColumn'],
  39 + ],
  40 + ]); ?>
  41 +</div>
... ...
backend/views/articles/update.php 0 → 100755
  1 +++ a/backend/views/articles/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Articles */
  7 +
  8 +$this->title = 'Update Articles: ' . $model->title;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Articles', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="articles-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/articles/view.php 0 → 100755
  1 +++ a/backend/views/articles/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Articles */
  8 +
  9 +$this->title = $model->title;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Articles', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="articles-view" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
  14 +
  15 + <h1 itemprop="title"><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'date',
  33 + 'title',
  34 + 'translit',
  35 + 'meta_title',
  36 + 'meta_keywords',
  37 + 'meta_description',
  38 + 'h1',
  39 + ],
  40 + ]) ?>
  41 +
  42 +</div>
... ...
backend/views/banner/_form.php 0 → 100755
  1 +++ a/backend/views/banner/_form.php
  1 +<?php
  2 +
  3 +use common\modules\file\widgets\ImageUploader;
  4 +use kartik\select2\Select2;
  5 +use yii\helpers\Html;
  6 +use yii\widgets\ActiveForm;
  7 +
  8 +/* @var $this yii\web\View */
  9 +/* @var $model common\models\Banner */
  10 +/* @var $form yii\widgets\ActiveForm */
  11 +?>
  12 +
  13 +<div class="banner-form">
  14 +
  15 + <?php $form = ActiveForm::begin(); ?>
  16 +
  17 +
  18 + <?= $form->field($model, 'alt')->textInput(['maxlength' => true]) ?>
  19 +
  20 + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  21 +
  22 + <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
  23 +
  24 + <?= $form->field($model, 'status')->widget(Select2::className(),([
  25 + 'name' => 'status',
  26 + 'hideSearch' => true,
  27 + 'data' => [1 => 'Active', 2 => 'Inactive'],
  28 + 'options' => ['placeholder' => 'Select status...'],
  29 + 'pluginOptions' => [
  30 + 'allowClear' => true
  31 + ]
  32 + ])) ?>
  33 +
  34 + <?= $form->field($model, 'width')->textInput(['maxlength' => true]) ?>
  35 +
  36 + <?= $form->field($model, 'height')->textInput(['maxlength' => true]) ?>
  37 +
  38 + <p id="save_image_widget_settings" class = "btn btn-primary" >Применить настройки</p>
  39 +
  40 + <div id="image_widget_block">
  41 + <?php if(!empty($model->image)){
  42 + echo ImageUploader::widget([
  43 + 'model'=> $model,
  44 + 'field'=>'image',
  45 + 'size' => [
  46 + [
  47 + 'width'=>$model->width,
  48 + 'height'=>$model->height,
  49 + ],
  50 + ],
  51 + 'gallery' =>$model->image,
  52 + 'name' => "Загрузить баннер"
  53 + ]);
  54 + }?>
  55 + </div>
  56 +
  57 + <div class="form-group">
  58 + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  59 + </div>
  60 +
  61 + <?php ActiveForm::end(); ?>
  62 +
  63 +</div>
  64 +<script>
  65 + $('#save_image_widget_settings').click(function(){
  66 + var width = $('#banner-width').val();
  67 + var height = $('#banner-height').val();
  68 + save_image_widget_settings( width, height, function(data){
  69 + $('#image_widget_block').html = '';
  70 + $('#image_widget_block').html(data.html);
  71 + });
  72 + });
  73 + function save_image_widget_settings( width, height, callback )
  74 + {
  75 + $.ajax({
  76 + url: '/admin/banner/save-image-settings',
  77 + data :
  78 + {
  79 + 'width' : width,
  80 + 'height' : height
  81 + },
  82 + type : 'POST',
  83 + dataType: 'json',
  84 + success: function (data)
  85 + {
  86 + if(callback)
  87 + callback(data);
  88 + },
  89 + error: function()
  90 + {
  91 + console.info('error');
  92 + }
  93 + });
  94 + }
  95 +</script>
... ...
backend/views/banner/_search.php 0 → 100755
  1 +++ a/backend/views/banner/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\BannerSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="banner-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'banner_id') ?>
  19 +
  20 +
  21 + <?= $form->field($model, 'image') ?>
  22 +
  23 + <?= $form->field($model, 'alt') ?>
  24 +
  25 + <?= $form->field($model, 'title') ?>
  26 +
  27 + <?php // echo $form->field($model, 'url') ?>
  28 +
  29 + <?php // echo $form->field($model, 'status') ?>
  30 +
  31 + <div class="form-group">
  32 + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
  33 + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
  34 + </div>
  35 +
  36 + <?php ActiveForm::end(); ?>
  37 +
  38 +</div>
... ...
backend/views/banner/create.php 0 → 100755
  1 +++ a/backend/views/banner/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Banner */
  8 +
  9 +$this->title = Yii::t('app', 'Create Banner');
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="banner-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/banner/index.php 0 → 100755
  1 +++ a/backend/views/banner/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\BannerSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = Yii::t('app', 'Banners');
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="banner-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a(Yii::t('app', 'Create Banner'), ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'banner_id',
  28 + 'image',
  29 + 'alt',
  30 + 'title',
  31 + // 'url:url',
  32 + // 'status',
  33 +
  34 + ['class' => 'yii\grid\ActionColumn'],
  35 + ],
  36 + ]); ?>
  37 +</div>
... ...
backend/views/banner/update.php 0 → 100755
  1 +++ a/backend/views/banner/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Banner */
  7 +
  8 +$this->title = Yii::t('app', 'Update {modelClass}: ', [
  9 + 'modelClass' => 'Banner',
  10 +]) . $model->title;
  11 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']];
  12 +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->banner_id]];
  13 +$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
  14 +?>
  15 +<div class="banner-update">
  16 +
  17 + <h1><?= Html::encode($this->title) ?></h1>
  18 +
  19 + <?= $this->render('_form', [
  20 + 'model' => $model,
  21 + ]) ?>
  22 +
  23 +</div>
... ...
backend/views/banner/view.php 0 → 100755
  1 +++ a/backend/views/banner/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Banner */
  8 +
  9 +$this->title = $model->title;
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="banner-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->banner_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->banner_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'banner_id',
  32 + 'image',
  33 + 'alt',
  34 + 'title',
  35 + 'url:url',
  36 + 'status',
  37 + ],
  38 + ]) ?>
  39 +
  40 +</div>
... ...
backend/views/bg/_form.php 0 → 100755
  1 +++ a/backend/views/bg/_form.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Bg */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="bg-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  16 +
  17 + <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
  18 +
  19 + <?= $form->field($model, 'image')->textInput(['maxlength' => true]) ?>
  20 +
  21 + <div class="form-group">
  22 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  23 + </div>
  24 +
  25 + <?php ActiveForm::end(); ?>
  26 +
  27 +</div>
... ...
backend/views/bg/_search.php 0 → 100755
  1 +++ a/backend/views/bg/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\BgSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="bg-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'title') ?>
  21 +
  22 + <?= $form->field($model, 'url') ?>
  23 +
  24 + <?= $form->field($model, 'image') ?>
  25 +
  26 + <div class="form-group">
  27 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  28 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  29 + </div>
  30 +
  31 + <?php ActiveForm::end(); ?>
  32 +
  33 +</div>
... ...
backend/views/bg/create.php 0 → 100755
  1 +++ a/backend/views/bg/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Bg */
  8 +
  9 +$this->title = 'Create Bg';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Bgs', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bg-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/bg/index.php 0 → 100755
  1 +++ a/backend/views/bg/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\BgSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Bgs';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bg-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Bg', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'title',
  29 + 'url:url',
  30 + 'image',
  31 +
  32 + ['class' => 'yii\grid\ActionColumn'],
  33 + ],
  34 + ]); ?>
  35 +</div>
... ...
backend/views/bg/update.php 0 → 100755
  1 +++ a/backend/views/bg/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Bg */
  7 +
  8 +$this->title = 'Update Bg: ' . $model->title;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Bgs', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="bg-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/bg/view.php 0 → 100755
  1 +++ a/backend/views/bg/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Bg */
  8 +
  9 +$this->title = $model->title;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Bgs', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bg-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'title',
  33 + 'url:url',
  34 + 'image',
  35 + ],
  36 + ]) ?>
  37 +
  38 +</div>
... ...
backend/views/blog/_form.php 0 → 100755
  1 +++ a/backend/views/blog/_form.php
  1 +<?php
  2 +
  3 +use common\widgets\FieldEditor;
  4 +use yii\helpers\Html;
  5 +use yii\widgets\ActiveForm;
  6 +use common\modules\file\widgets\ImageUploader;
  7 +use mihaildev\ckeditor\CKEditor;
  8 +use mihaildev\elfinder\ElFinder;
  9 +use common\components\Request;
  10 +
  11 +/* @var $this yii\web\View */
  12 +/* @var $model common\models\Blog */
  13 +/* @var $form yii\widgets\ActiveForm */
  14 +?>
  15 +
  16 +<div class="blog-form">
  17 +
  18 + <?php $form = ActiveForm::begin([
  19 + 'enableClientValidation' => false,
  20 + 'options' => ['enctype' => 'multipart/form-data']
  21 + ]); ?>
  22 +
  23 + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
  24 +
  25 + <?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?>
  26 +
  27 + <?= $form->field($model, 'description')->widget(CKEditor::className(),
  28 + [
  29 + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
  30 + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  31 + 'inline' => false, //по умолчанию false]),
  32 + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
  33 + ]
  34 + )
  35 + ]) ?>
  36 +
  37 + <?= $form->field($model, 'imageUpload')->widget(\kartik\file\FileInput::classname(), [
  38 + 'language' => 'ru',
  39 + 'options' => [
  40 + 'accept' => 'image/*',
  41 + 'multiple' => false,
  42 + ],
  43 + 'pluginOptions' => [
  44 + 'allowedFileExtensions' => ['jpg', 'gif', 'png'],
  45 + 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '',
  46 + 'overwriteInitial' => true,
  47 + 'showRemove' => false,
  48 + 'showUpload' => false,
  49 + 'previewFileType' => 'image',
  50 + ],
  51 + ]); ?>
  52 +
  53 + <?= FieldEditor::widget([
  54 + 'template' => 'education',
  55 + 'item_id' => $model->blog_id,
  56 + 'model' => 'common\models\Blog',
  57 + 'language' => 'ru',
  58 + ]); ?>
  59 + <div class="form-group">
  60 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  61 + </div>
  62 +
  63 + <?php ActiveForm::end(); ?>
  64 +
  65 +</div>
... ...
backend/views/blog/_search.php 0 → 100755
  1 +++ a/backend/views/blog/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\BlogSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="blog-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'blog_id') ?>
  19 +
  20 + <?= $form->field($model, 'user_id') ?>
  21 +
  22 + <?= $form->field($model, 'name') ?>
  23 +
  24 + <?= $form->field($model, 'link') ?>
  25 +
  26 + <?= $form->field($model, 'date_add') ?>
  27 +
  28 + <?php // echo $form->field($model, 'user_add_id') ?>
  29 +
  30 + <?php // echo $form->field($model, 'view_count') ?>
  31 +
  32 + <?php // echo $form->field($model, 'description') ?>
  33 +
  34 + <?php // echo $form->field($model, 'cover') ?>
  35 +
  36 + <div class="form-group">
  37 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  38 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  39 + </div>
  40 +
  41 + <?php ActiveForm::end(); ?>
  42 +
  43 +</div>
... ...
backend/views/blog/create.php 0 → 100755
  1 +++ a/backend/views/blog/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Blog */
  8 +
  9 +$this->title = 'Create Blog';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="blog-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/blog/index.php 0 → 100755
  1 +++ a/backend/views/blog/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\BlogSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Blogs';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="blog-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Blog', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'blog_id',
  28 + 'user_id',
  29 + 'name',
  30 + 'link',
  31 + 'date_add',
  32 + // 'user_add_id',
  33 + // 'view_count',
  34 + // 'description:ntext',
  35 + // 'cover',
  36 +
  37 + ['class' => 'yii\grid\ActionColumn'],
  38 + ],
  39 + ]); ?>
  40 +</div>
... ...
backend/views/blog/update.php 0 → 100755
  1 +++ a/backend/views/blog/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Blog */
  7 +
  8 +$this->title = 'Update Blog: ' . ' ' . $model->name;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->blog_id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="blog-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/blog/view.php 0 → 100755
  1 +++ a/backend/views/blog/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Blog */
  8 +
  9 +$this->title = $model->name;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="blog-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->blog_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->blog_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'blog_id',
  32 + 'user_id',
  33 + 'name',
  34 + 'link',
  35 + 'date_add',
  36 + 'user_add_id',
  37 + 'view_count',
  38 + 'description:ntext',
  39 + 'cover',
  40 + ],
  41 + ]) ?>
  42 +
  43 +</div>
... ...
backend/views/brand/_form.php 0 → 100755
  1 +++ a/backend/views/brand/_form.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\product\models\Brand */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="brand-form">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'enableClientValidation' => false,
  15 + 'options' => ['enctype' => 'multipart/form-data']
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'name')->textInput() ?>
  19 +
  20 + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?>
  21 +
  22 + <?= $form->field($model, 'imageUpload')->widget(\kartik\file\FileInput::classname(), [
  23 + 'language' => 'ru',
  24 + 'options' => [
  25 + 'accept' => 'image/*',
  26 + 'multiple' => false,
  27 + ],
  28 + 'pluginOptions' => [
  29 + 'allowedFileExtensions' => ['jpg', 'gif', 'png'],
  30 + 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '',
  31 + 'overwriteInitial' => true,
  32 + 'showRemove' => false,
  33 + 'showUpload' => false,
  34 + 'previewFileType' => 'image',
  35 + ],
  36 + ]); ?>
  37 +
  38 + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
  39 +
  40 + <?= $form->field($model, 'meta_desc')->textarea(['rows' => 6]) ?>
  41 +
  42 + <?= $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?>
  43 +
  44 + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
  45 +
  46 + <div class="form-group">
  47 + <?= Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  48 + <?php if ($model->isNewRecord) :?>
  49 + <?= Html::submitButton(Yii::t('product', 'Create and continue'), ['name' => 'create_and_new', 'class' => 'btn btn-primary']) ?>
  50 + <?php endif?>
  51 + </div>
  52 +
  53 + <?php ActiveForm::end(); ?>
  54 +
  55 +</div>
... ...
backend/views/brand/_search.php 0 → 100755
  1 +++ a/backend/views/brand/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\product\models\BrandSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="brand-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'brand_id') ?>
  19 +
  20 + <?= $form->field($model, 'brand_name_id') ?>
  21 +
  22 + <?= $form->field($model, 'alias') ?>
  23 +
  24 + <?= $form->field($model, 'image') ?>
  25 +
  26 + <?= $form->field($model, 'meta_title') ?>
  27 +
  28 + <?php // echo $form->field($model, 'meta_desc') ?>
  29 +
  30 + <?php // echo $form->field($model, 'meta_robots') ?>
  31 +
  32 + <?php // echo $form->field($model, 'seo_text') ?>
  33 +
  34 + <div class="form-group">
  35 + <?= Html::submitButton(Yii::t('product', 'Search'), ['class' => 'btn btn-primary']) ?>
  36 + <?= Html::resetButton(Yii::t('product', 'Reset'), ['class' => 'btn btn-default']) ?>
  37 + </div>
  38 +
  39 + <?php ActiveForm::end(); ?>
  40 +
  41 +</div>
... ...
backend/views/brand/create.php 0 → 100755
  1 +++ a/backend/views/brand/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\product\models\Brand */
  8 +
  9 +$this->title = Yii::t('product', 'Create Brand');
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Brands'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="brand-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/brand/index.php 0 → 100755
  1 +++ a/backend/views/brand/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\modules\product\models\BrandSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = Yii::t('product', 'Brands');
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="brand-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a(Yii::t('product', 'Create Brand'), ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 +// 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'name',
  28 + 'alias',
  29 + [
  30 + 'attribute' => 'title',
  31 + 'format' => 'html',
  32 + 'value' => function($data) {
  33 + return Html::img($data->imageUrl, ['width'=>'100']);
  34 + },
  35 + ],
  36 +
  37 + ['class' => 'yii\grid\ActionColumn'],
  38 + ],
  39 + ]); ?>
  40 +</div>
... ...
backend/views/brand/update.php 0 → 100755
  1 +++ a/backend/views/brand/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\modules\product\models\Brand */
  7 +
  8 +$this->title = Yii::t('product', 'Update {modelClass}: ', [
  9 + 'modelClass' => 'Brand',
  10 +]) . ' ' . $model->brand_id;
  11 +$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Brands'), 'url' => ['index']];
  12 +$this->params['breadcrumbs'][] = ['label' => $model->brand_id, 'url' => ['view', 'id' => $model->brand_id]];
  13 +$this->params['breadcrumbs'][] = Yii::t('product', 'Update');
  14 +?>
  15 +<div class="brand-update">
  16 +
  17 + <h1><?= Html::encode($this->title) ?></h1>
  18 +
  19 + <?= $this->render('_form', [
  20 + 'model' => $model,
  21 + ]) ?>
  22 +
  23 +</div>
... ...
backend/views/brand/view.php 0 → 100755
  1 +++ a/backend/views/brand/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\product\models\Brand */
  8 +
  9 +$this->title = $model->brand_id;
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Brands'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="brand-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a(Yii::t('product', 'Update'), ['update', 'id' => $model->brand_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a(Yii::t('product', 'Delete'), ['delete', 'id' => $model->brand_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'brand_id',
  32 + 'brand_name_id',
  33 + 'alias',
  34 + 'imageUrl:image',
  35 + 'meta_title',
  36 + 'meta_desc:ntext',
  37 + 'meta_robots',
  38 + 'seo_text:ntext',
  39 + ],
  40 + ]) ?>
  41 +
  42 +</div>
... ...
backend/views/category/_form.php 0 → 100755
  1 +++ a/backend/views/category/_form.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +use mihaildev\ckeditor\CKEditor;
  6 +use mihaildev\elfinder\ElFinder;
  7 +use common\modules\file\widgets\ImageUploader;
  8 +use kartik\select2\Select2;
  9 +
  10 +/* @var $this yii\web\View */
  11 +/* @var $model common\modules\product\models\Category */
  12 +/* @var $form yii\widgets\ActiveForm */
  13 +?>
  14 +
  15 +<div class="category-form">
  16 +
  17 + <?php $form = ActiveForm::begin([
  18 + 'enableClientValidation' => false,
  19 + 'options' => ['enctype' => 'multipart/form-data']
  20 + ]); ?>
  21 +
  22 + <?= $form->field($model, 'name')->textInput() ?>
  23 +
  24 + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?>
  25 +
  26 + <?= $form->field($model, 'parent_id')->dropDownList($categories, [
  27 + 'prompt' => Yii::t('rubrication', 'Root category'),
  28 + 'options' => [
  29 + $model->category_id => ['disabled' => true]
  30 + ]
  31 + ])->label(Yii::t('product', 'Parent category')) ?>
  32 +
  33 + <?= $form->field($model, 'group_to_category')->widget(Select2::className(), [
  34 + 'data' => \yii\helpers\ArrayHelper::map(\common\modules\rubrication\models\TaxGroup::find()->all(), 'tax_group_id', 'name'),
  35 + 'language' => 'ru',
  36 + 'options' => [
  37 + 'placeholder' => 'Linked options',
  38 + 'multiple' => true,
  39 + ],
  40 + 'pluginOptions' => [
  41 + 'allowClear' => true
  42 + ],
  43 + ]
  44 + ) ?>
  45 +
  46 + <?= $form->field($model, 'imageUpload')->widget(\kartik\file\FileInput::classname(), [
  47 + 'language' => 'ru',
  48 + 'options' => [
  49 + 'accept' => 'image/*',
  50 + 'multiple' => false,
  51 + ],
  52 + 'pluginOptions' => [
  53 + 'allowedFileExtensions' => ['jpg', 'gif', 'png'],
  54 + 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '',
  55 + 'overwriteInitial' => true,
  56 + 'showRemove' => false,
  57 + 'showUpload' => false,
  58 + 'previewFileType' => 'image',
  59 + ],
  60 + ]); ?>
  61 +
  62 + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
  63 +
  64 + <?= $form->field($model, 'meta_desc')->textarea(['rows' => 6]) ?>
  65 +
  66 + <?= $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?>
  67 +
  68 + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?>
  69 +
  70 + <?= $form->field($model, 'seo_text')->widget(CKEditor::className(),
  71 + [
  72 + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
  73 + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  74 + 'inline' => false, //по умолчанию false]),
  75 + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
  76 + ]
  77 + )
  78 + ]) ?>
  79 +
  80 + <?php if (!empty($model) && $model->depth == 2) :?>
  81 + <?= $form->field($model, 'populary')->checkbox() ?>
  82 + <?php endif?>
  83 +
  84 + <div class="form-group">
  85 + <?= Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  86 + <?php if ($model->isNewRecord) :?>
  87 + <?= Html::submitButton(Yii::t('product', 'Create and continue'), ['name' => 'create_and_new', 'class' => 'btn btn-primary']) ?>
  88 + <?php endif?>
  89 + </div>
  90 +
  91 + <?php ActiveForm::end(); ?>
  92 +
  93 +</div>
... ...
backend/views/category/_search.php 0 → 100755
  1 +++ a/backend/views/category/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\product\models\CategorySearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="category-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'category_id') ?>
  19 +
  20 + <?= $form->field($model, 'parent_id') ?>
  21 +
  22 + <?= $form->field($model, 'path') ?>
  23 +
  24 + <?= $form->field($model, 'depth') ?>
  25 +
  26 + <?= $form->field($model, 'image') ?>
  27 +
  28 + <?php // echo $form->field($model, 'meta_title') ?>
  29 +
  30 + <?php // echo $form->field($model, 'meta_desc') ?>
  31 +
  32 + <?php // echo $form->field($model, 'meta_robots') ?>
  33 +
  34 + <?php // echo $form->field($model, 'seo_text') ?>
  35 +
  36 + <?php // echo $form->field($model, 'category_name_id') ?>
  37 +
  38 + <?php // echo $form->field($model, 'product_unit_id') ?>
  39 +
  40 + <?php // echo $form->field($model, 'alias') ?>
  41 +
  42 + <div class="form-group">
  43 + <?= Html::submitButton(Yii::t('product', 'Search'), ['class' => 'btn btn-primary']) ?>
  44 + <?= Html::resetButton(Yii::t('product', 'Reset'), ['class' => 'btn btn-default']) ?>
  45 + </div>
  46 +
  47 + <?php ActiveForm::end(); ?>
  48 +
  49 +</div>
... ...
backend/views/category/create.php 0 → 100755
  1 +++ a/backend/views/category/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\product\models\Category */
  8 +
  9 +$this->title = Yii::t('product', 'Create Category');
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Categories'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="category-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + 'categories' => $categories
  20 + ]) ?>
  21 +
  22 +</div>
... ...
backend/views/category/index.php 0 → 100755
  1 +++ a/backend/views/category/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use kartik\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\modules\product\models\CategorySearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = Yii::t('product', 'Categories');
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="category-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a(Yii::t('product', 'Create Category'), ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 +// 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 + [
  27 + 'label'=> Yii::t('product', 'Name'),
  28 + 'content'=>function($data){
  29 + $op = [];
  30 + foreach($data->getParents()->all() as $parent) {
  31 + $op[] = $parent->name;
  32 + }
  33 + $op[] = $data->name;
  34 + return implode('&nbsp;&rarr;&nbsp;', $op);
  35 +// return str_repeat('-', $data->depth) .'&nbsp;'. $data->name;
  36 + }
  37 + ],
  38 + [
  39 + 'class' => 'yii\grid\ActionColumn',
  40 + 'template' => '{view} {update} {delete} {populary}',
  41 + 'buttons' => [
  42 + 'populary' => function ($url, $model) {
  43 + if ($model->depth == 2) {
  44 + return Html::a('<span class="glyphicon glyphicon-star' . ($model->populary ? '' : '-empty') . '"></span>', $url, [
  45 + 'title' => Yii::t('product', ($model->populary ? 'Set not populary' : 'Set populary')),
  46 + ]);
  47 + }
  48 + },
  49 + ],
  50 + 'urlCreator' => function ($action, $model, $key, $index) {
  51 + switch ($action) {
  52 + case 'populary':
  53 + return \yii\helpers\Url::to(['category/populary', 'id' => $model->category_id]);
  54 + break;
  55 + case 'view':
  56 + return \yii\helpers\Url::to(['category/view', 'id' => $model->category_id]);
  57 + break;
  58 + case 'update':
  59 + return \yii\helpers\Url::to(['category/update', 'id' => $model->category_id]);
  60 + break;
  61 + case 'delete':
  62 + return \yii\helpers\Url::to(['category/delete', 'id' => $model->category_id]);
  63 + break;
  64 + }
  65 + }
  66 + ],
  67 + ],
  68 + 'panel' => [
  69 + 'type'=>'success',
  70 + ],
  71 + ]); ?>
  72 +</div>
... ...
backend/views/category/update.php 0 → 100755
  1 +++ a/backend/views/category/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\modules\product\models\Category */
  7 +
  8 +$this->title = Yii::t('product', 'Update {modelClass}: ', [
  9 + 'modelClass' => 'Category',
  10 +]) . ' ' . $model->name;
  11 +$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Categories'), 'url' => ['index']];
  12 +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->category_id]];
  13 +$this->params['breadcrumbs'][] = Yii::t('product', 'Update');
  14 +?>
  15 +<div class="category-update">
  16 +
  17 + <h1><?= Html::encode($this->title) ?></h1>
  18 +
  19 + <?= $this->render('_form', [
  20 + 'model' => $model,
  21 + 'categories' => $categories
  22 + ]) ?>
  23 +
  24 +</div>
... ...
backend/views/category/view.php 0 → 100755
  1 +++ a/backend/views/category/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\product\models\Category */
  8 +
  9 +$this->title = $model->name;
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Categories'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="category-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a(Yii::t('product', 'Update'), ['update', 'id' => $model->category_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a(Yii::t('product', 'Delete'), ['delete', 'id' => $model->category_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + <?= Html::a(Yii::t('product', 'Create Category'), ['category/create'], ['class' => 'btn btn-success']) ?>
  27 + <?php if (!empty($model->parent_id)) :?>
  28 + <?= Html::a(Yii::t('product', 'Create category By {name}', ['name' => $model->parent->name]), ['category/create?parent='. $model->parent->category_id], ['class' => 'btn btn-success']) ?>
  29 + <?php endif?>
  30 + </p>
  31 +
  32 + <?= DetailView::widget([
  33 + 'model' => $model,
  34 + 'attributes' => [
  35 + 'category_id',
  36 + 'parent_id',
  37 + 'path',
  38 + 'depth',
  39 + 'imageUrl:image',
  40 + 'meta_title',
  41 + 'meta_desc:ntext',
  42 + 'meta_robots',
  43 + 'h1',
  44 + 'seo_text:ntext',
  45 + 'category_name_id',
  46 + 'product_unit_id',
  47 + 'alias',
  48 +
  49 + ],
  50 + ]) ?>
  51 +
  52 +</div>
... ...
backend/views/comment/_form.php 0 → 100755
  1 +++ a/backend/views/comment/_form.php
  1 +<?php
  2 +
  3 + use common\modules\comment\models\Comment;
  4 + use yii\helpers\Html;
  5 + use yii\widgets\ActiveForm;
  6 +
  7 + /* @var $this yii\web\View */
  8 + /* @var $model Comment */
  9 + /* @var $form yii\widgets\ActiveForm */
  10 + $status_list = [
  11 + Comment::STATUS_ACTIVE => 'Активный',
  12 + Comment::STATUS_HIDDEN => 'Новый',
  13 + Comment::STATUS_DELETED => 'Удаленный',
  14 + ]
  15 +?>
  16 +
  17 +<div class="comment-form">
  18 +
  19 + <?php $form = ActiveForm::begin(); ?>
  20 +
  21 + <?= $form->field($model, 'text')
  22 + ->textarea([ 'rows' => 6 ]) ?>
  23 +
  24 + <?= $form->field($model, 'status')
  25 + ->dropDownList($status_list) ?>
  26 +
  27 + <div class="form-group">
  28 + <?= Html::submitButton('Обновить', [ 'class' => 'btn btn-primary' ]) ?>
  29 + </div>
  30 +
  31 + <?php ActiveForm::end(); ?>
  32 +
  33 +</div>
... ...
backend/views/comment/_search.php 0 → 100755
  1 +++ a/backend/views/comment/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model backend\models\CommentSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="comment-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'comment_id') ?>
  19 +
  20 + <?= $form->field($model, 'text') ?>
  21 +
  22 + <?= $form->field($model, 'user_id') ?>
  23 +
  24 + <?= $form->field($model, 'user_name') ?>
  25 +
  26 + <?= $form->field($model, 'user_email') ?>
  27 +
  28 + <?php // echo $form->field($model, 'comment_pid') ?>
  29 +
  30 + <?php // echo $form->field($model, 'status') ?>
  31 +
  32 + <?php // echo $form->field($model, 'date_add') ?>
  33 +
  34 + <?php // echo $form->field($model, 'date_update') ?>
  35 +
  36 + <?php // echo $form->field($model, 'date_delete') ?>
  37 +
  38 + <?php // echo $form->field($model, 'model') ?>
  39 +
  40 + <?php // echo $form->field($model, 'model_id') ?>
  41 +
  42 + <div class="form-group">
  43 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  44 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  45 + </div>
  46 +
  47 + <?php ActiveForm::end(); ?>
  48 +
  49 +</div>
... ...
backend/views/comment/index.php 0 → 100755
  1 +++ a/backend/views/comment/index.php
  1 +<?php
  2 +
  3 + use common\modules\comment\models\Comment;
  4 + use yii\helpers\Html;
  5 + use yii\grid\GridView;
  6 + use yii\helpers\Url;
  7 +
  8 + /* @var $this yii\web\View */
  9 + /* @var $dataProvider yii\data\ActiveDataProvider */
  10 +
  11 + $this->title = 'Комменты';
  12 + $this->params[ 'breadcrumbs' ][] = $this->title;
  13 +?>
  14 +<div class="comment-index">
  15 +
  16 + <h1><?= Html::encode($this->title) ?></h1>
  17 +
  18 + <?= GridView::widget([
  19 + 'dataProvider' => $dataProvider,
  20 + 'columns' => [
  21 + [
  22 + 'class' => 'yii\grid\ActionColumn',
  23 + 'template' => '{approve} {update} {delete}',
  24 + 'buttons' => [
  25 + 'approve' => function($url, $model, $key) {
  26 + /**
  27 + * @var Comment $model
  28 + */
  29 + $options = array_merge([
  30 + 'title' => "Подтвердить",
  31 + 'aria-label' => "Подтвердить",
  32 + 'data-confirm' => "Комментарий и оценка отобразится на публичной части сайта, подтвердить?",
  33 + 'data-method' => 'post',
  34 + 'data-pjax' => '0',
  35 + ]);
  36 + $glyphicon = 'glyphicon-ok';
  37 + if($model->status == $model::STATUS_ACTIVE) {
  38 + $url = Url::to(['comment/disapprove', 'id' => $model->comment_id]);
  39 + $glyphicon = 'glyphicon-remove';
  40 + }
  41 + return Html::a('<span class="glyphicon '.$glyphicon.'"></span>', $url, $options);
  42 + }
  43 + ]
  44 + ],
  45 + 'comment_id',
  46 + [
  47 + 'attribute' => 'rating.value',
  48 + 'label' => 'Оценка',
  49 + ],
  50 + 'text:ntext',
  51 + [
  52 + 'content' => function($model) {
  53 + /**
  54 + * @var Comment $model
  55 + */
  56 + if(!empty( $model->user )) {
  57 + return $model->user->username . " (ID: " . $model->user->id . ")";
  58 + } else {
  59 + return $model->user_name . " (Гость: " . $model->user_email . ")";
  60 + }
  61 + },
  62 + 'label' => 'Пользователь',
  63 + ],
  64 + [
  65 + 'attribute' => 'status',
  66 + 'value' => function($model) {
  67 + /**
  68 + * @var Comment $model
  69 + */
  70 + $status = '';
  71 + switch($model->status) {
  72 + case Comment::STATUS_ACTIVE:
  73 + $status = 'Активный';
  74 + break;
  75 + case Comment::STATUS_HIDDEN:
  76 + $status = 'Новый';
  77 + break;
  78 + case Comment::STATUS_DELETED:
  79 + $status = 'Удаленный';
  80 + break;
  81 + default:
  82 + $status = 'Неизвестно';
  83 + };
  84 + return $status;
  85 + },
  86 + ],
  87 + 'date_add',
  88 + [
  89 + 'attribute' => 'model',
  90 + 'value' => function($model) {
  91 + /**
  92 + * @var Comment $model
  93 + */
  94 + return $model->model . " (ID: " . $model->model_id . ")";
  95 + },
  96 + ],
  97 + ],
  98 + ]); ?>
  99 +</div>
... ...
backend/views/comment/update.php 0 → 100755
  1 +++ a/backend/views/comment/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\modules\comment\models\Comment */
  7 +
  8 +$this->title = 'Редактировать коммент: ' . $model->comment_id;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Комментарии', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->comment_id, 'url' => ['view', 'id' => $model->comment_id]];
  11 +$this->params['breadcrumbs'][] = 'Редактировать';
  12 +?>
  13 +<div class="comment-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/comment/view.php 0 → 100755
  1 +++ a/backend/views/comment/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\modules\comment\models\Comment */
  8 +
  9 +$this->title = $model->comment_id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Comments', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="comment-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->comment_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->comment_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'comment_id',
  32 + 'text:ntext',
  33 + 'user_id',
  34 + 'user_name',
  35 + 'user_email:email',
  36 + 'comment_pid',
  37 + 'status',
  38 + 'date_add',
  39 + 'date_update',
  40 + 'date_delete',
  41 + 'model',
  42 + 'model_id',
  43 + ],
  44 + ]) ?>
  45 +
  46 +</div>
... ...
backend/views/customer/_form.php 0 → 100755
  1 +++ a/backend/views/customer/_form.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Customer */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="customer-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'id')->textInput() ?>
  16 +
  17 + <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
  18 +
  19 + <?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>
  20 +
  21 + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
  22 +
  23 + <?= $form->field($model, 'surname')->textInput(['maxlength' => true]) ?>
  24 +
  25 + <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
  26 +
  27 + <?= $form->field($model, 'date_time')->textInput() ?>
  28 +
  29 + <?= $form->field($model, 'sex')->textInput(['maxlength' => true]) ?>
  30 +
  31 + <?= $form->field($model, 'birth_day')->textInput() ?>
  32 +
  33 + <?= $form->field($model, 'birth_month')->textInput() ?>
  34 +
  35 + <?= $form->field($model, 'birth_year')->textInput() ?>
  36 +
  37 + <?= $form->field($model, 'body')->textarea(['rows' => 6]) ?>
  38 +
  39 + <?= $form->field($model, 'group_id')->textInput() ?>
  40 +
  41 + <div class="form-group">
  42 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  43 + </div>
  44 +
  45 + <?php ActiveForm::end(); ?>
  46 +
  47 +</div>
... ...
backend/views/customer/_search.php 0 → 100755
  1 +++ a/backend/views/customer/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\CustomerSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="customer-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'username') ?>
  21 +
  22 + <?= $form->field($model, 'password') ?>
  23 +
  24 + <?= $form->field($model, 'name') ?>
  25 +
  26 + <?= $form->field($model, 'surname') ?>
  27 +
  28 + <?php // echo $form->field($model, 'phone') ?>
  29 +
  30 + <?php // echo $form->field($model, 'date_time') ?>
  31 +
  32 + <?php // echo $form->field($model, 'sex') ?>
  33 +
  34 + <?php // echo $form->field($model, 'birth_day') ?>
  35 +
  36 + <?php // echo $form->field($model, 'birth_month') ?>
  37 +
  38 + <?php // echo $form->field($model, 'birth_year') ?>
  39 +
  40 + <?php // echo $form->field($model, 'body') ?>
  41 +
  42 + <?php // echo $form->field($model, 'group_id') ?>
  43 +
  44 + <div class="form-group">
  45 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  46 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  47 + </div>
  48 +
  49 + <?php ActiveForm::end(); ?>
  50 +
  51 +</div>
... ...
backend/views/customer/create.php 0 → 100755
  1 +++ a/backend/views/customer/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Customer */
  8 +
  9 +$this->title = 'Create Customer';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="customer-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/customer/index.php 0 → 100755
  1 +++ a/backend/views/customer/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\CustomerSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Customers';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="customer-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Customer', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'username',
  29 + 'password',
  30 + 'name',
  31 + 'surname',
  32 + // 'phone',
  33 + // 'date_time',
  34 + // 'sex',
  35 + // 'birth_day',
  36 + // 'birth_month',
  37 + // 'birth_year',
  38 + // 'body:ntext',
  39 + // 'group_id',
  40 +
  41 + ['class' => 'yii\grid\ActionColumn'],
  42 + ],
  43 + ]); ?>
  44 +</div>
... ...
backend/views/customer/update.php 0 → 100755
  1 +++ a/backend/views/customer/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Customer */
  7 +
  8 +$this->title = 'Update Customer: ' . $model->name;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="customer-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/customer/view.php 0 → 100755
  1 +++ a/backend/views/customer/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Customer */
  8 +
  9 +$this->title = $model->name;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="customer-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'username',
  33 + 'password',
  34 + 'name',
  35 + 'surname',
  36 + 'phone',
  37 + 'date_time',
  38 + 'sex',
  39 + 'birth_day',
  40 + 'birth_month',
  41 + 'birth_year',
  42 + 'body:ntext',
  43 + 'group_id',
  44 + ],
  45 + ]) ?>
  46 +
  47 +</div>
... ...
backend/views/event/_form.php 0 → 100755
  1 +++ a/backend/views/event/_form.php
  1 +<?php
  2 +
  3 +use kartik\date\DatePicker;
  4 +use yii\helpers\Html;
  5 +use yii\widgets\ActiveForm;
  6 +use mihaildev\ckeditor\CKEditor;
  7 +use mihaildev\elfinder\ElFinder;
  8 +/* @var $this yii\web\View */
  9 +/* @var $model common\models\Event */
  10 +/* @var $form yii\widgets\ActiveForm */
  11 +?>
  12 +
  13 +<div class="event-form">
  14 +
  15 + <?php $form = ActiveForm::begin([
  16 + 'enableClientValidation' => false,
  17 + 'options' => ['enctype' => 'multipart/form-data']
  18 + ]); ?>
  19 +
  20 + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
  21 +
  22 + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?>
  23 +
  24 + <?= $form->field($model, 'body')->widget(CKEditor::className(),
  25 + [
  26 + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
  27 + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  28 + 'inline' => false, //по умолчанию false]),
  29 + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
  30 + ]
  31 + )
  32 + ]) ?>
  33 +
  34 +
  35 + <?= $form->field($model, 'end_at')
  36 + ->widget(DatePicker::className(), [
  37 + 'pluginOptions' => [
  38 + 'format' => 'dd-M-yyyy',
  39 + 'todayHighlight' => true
  40 + ]]) ?>
  41 +
  42 +
  43 + <?= $form->field($model, 'imageUpload')->widget(\kartik\file\FileInput::classname(), [
  44 + 'language' => 'ru',
  45 + 'options' => [
  46 + 'accept' => 'image/*',
  47 + 'multiple' => false,
  48 + ],
  49 + 'pluginOptions' => [
  50 + 'allowedFileExtensions' => ['jpg', 'gif', 'png'],
  51 + 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '',
  52 + 'overwriteInitial' => true,
  53 + 'showRemove' => false,
  54 + 'showUpload' => false,
  55 + 'previewFileType' => 'image',
  56 + ],
  57 + ]); ?>
  58 +
  59 + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
  60 +
  61 + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
  62 +
  63 + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?>
  64 +
  65 + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
  66 +
  67 +
  68 +
  69 + <div class="form-group">
  70 + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  71 + </div>
  72 +
  73 + <?php ActiveForm::end(); ?>
  74 +
  75 +</div>
... ...
backend/views/event/_search.php 0 → 100755
  1 +++ a/backend/views/event/_search.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\EventSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="event-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'event_id') ?>
  19 +
  20 + <?= $form->field($model, 'name') ?>
  21 +
  22 + <?= $form->field($model, 'alias') ?>
  23 +
  24 + <?= $form->field($model, 'body') ?>
  25 +
  26 + <?= $form->field($model, 'image') ?>
  27 +
  28 + <?php // echo $form->field($model, 'meta_title') ?>
  29 +
  30 + <?php // echo $form->field($model, 'description') ?>
  31 +
  32 + <?php // echo $form->field($model, 'h1') ?>
  33 +
  34 + <?php // echo $form->field($model, 'seo_text') ?>
  35 +
  36 + <?php // echo $form->field($model, 'created_at') ?>
  37 +
  38 + <?php // echo $form->field($model, 'updated_at') ?>
  39 +
  40 + <?php // echo $form->field($model, 'end_at') ?>
  41 +
  42 + <div class="form-group">
  43 + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
  44 + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
  45 + </div>
  46 +
  47 + <?php ActiveForm::end(); ?>
  48 +
  49 +</div>
... ...
backend/views/event/create.php 0 → 100755
  1 +++ a/backend/views/event/create.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Event */
  8 +
  9 +$this->title = Yii::t('app', 'Create Event');
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="event-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/event/index.php 0 → 100755
  1 +++ a/backend/views/event/index.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\EventSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = Yii::t('app', 'Events');
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="event-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a(Yii::t('app', 'Create Event'), ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'event_id',
  28 + 'name',
  29 + 'alias',
  30 + [
  31 + 'format' => 'image',
  32 + 'attribute'=>'image',
  33 + ],
  34 + // 'meta_title',
  35 + // 'description',
  36 + // 'h1',
  37 + // 'seo_text:ntext',
  38 + // 'created_at',
  39 + // 'updated_at',
  40 + // 'end_at',
  41 +
  42 + ['class' => 'yii\grid\ActionColumn'],
  43 + ],
  44 + ]); ?>
  45 +</div>
... ...
backend/views/event/update.php 0 → 100755
  1 +++ a/backend/views/event/update.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Event */
  7 +
  8 +$this->title = Yii::t('app', 'Update {modelClass}: ', [
  9 + 'modelClass' => 'Event',
  10 +]) . $model->name;
  11 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']];
  12 +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->event_id]];
  13 +$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
  14 +?>
  15 +<div class="event-update">
  16 +
  17 + <h1><?= Html::encode($this->title) ?></h1>
  18 +
  19 + <?= $this->render('_form', [
  20 + 'model' => $model,
  21 + ]) ?>
  22 +
  23 +</div>
... ...
backend/views/event/view.php 0 → 100755
  1 +++ a/backend/views/event/view.php
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Event */
  8 +
  9 +$this->title = $model->name;
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="event-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->event_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->event_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'event_id',
  32 + 'name',
  33 + 'alias',
  34 + 'meta_title',
  35 + 'description',
  36 + 'h1',
  37 + ],
  38 + ]) ?>
  39 +
  40 +</div>
... ...
backend/views/layouts/admin.php 0 → 100755
  1 +++ a/backend/views/layouts/admin.php
  1 +<?php
  2 +use yii\widgets\Breadcrumbs;
  3 +use common\widgets\Alert;
  4 +
  5 +/* @var $content string */
  6 +$this->beginContent('@app/views/layouts/main.php');
  7 +?>
  8 +
  9 + <?= $this->render('header') ?>
  10 + <!-- Left side column. contains the logo and sidebar -->
  11 + <?= $this->render('main-sidebar') ?>
  12 +
  13 + <!-- Content Wrapper. Contains page content -->
  14 + <div class="content-wrapper">
  15 + <section class="content">
  16 + <?= Breadcrumbs::widget([
  17 + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  18 + ]) ?>
  19 + <?= Alert::widget() ?>
  20 +
  21 + <?= $content; ?>
  22 + </section>
  23 + </div><!-- /.content-wrapper -->
  24 + <?= $this->render('footer') ?>
  25 +
  26 +
  27 +
  28 + <!-- Control Sidebar -->
  29 + <?= $this->render('control-sidebar') ?>
  30 + <!-- /.control-sidebar -->
  31 + <!-- Add the sidebar's background. This div must be placed
  32 + immediately after the control sidebar -->
  33 + <div class="control-sidebar-bg"></div>
  34 +<?php $this->endContent() ?>
0 35 \ No newline at end of file
... ...
backend/views/layouts/control-sidebar.php 0 → 100755
  1 +++ a/backend/views/layouts/control-sidebar.php
  1 +<aside class="control-sidebar control-sidebar-dark">
  2 + <!-- Create the tabs -->
  3 + <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
  4 + <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
  5 + <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
  6 + </ul>
  7 + <!-- Tab panes -->
  8 + <div class="tab-content">
  9 + <!-- Home tab content -->
  10 + <div class="tab-pane" id="control-sidebar-home-tab">
  11 + <h3 class="control-sidebar-heading">Recent Activity</h3>
  12 + <ul class="control-sidebar-menu">
  13 + <li>
  14 + <a href="javascript::;">
  15 + <i class="menu-icon fa fa-birthday-cake bg-red"></i>
  16 +
  17 + <div class="menu-info">
  18 + <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
  19 +
  20 + <p>Will be 23 on April 24th</p>
  21 + </div>
  22 + </a>
  23 + </li>
  24 + <li>
  25 + <a href="javascript::;">
  26 + <i class="menu-icon fa fa-user bg-yellow"></i>
  27 +
  28 + <div class="menu-info">
  29 + <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>
  30 +
  31 + <p>New phone +1(800)555-1234</p>
  32 + </div>
  33 + </a>
  34 + </li>
  35 + <li>
  36 + <a href="javascript::;">
  37 + <i class="menu-icon fa fa-envelope-o bg-light-blue"></i>
  38 +
  39 + <div class="menu-info">
  40 + <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>
  41 +
  42 + <p>nora@example.com</p>
  43 + </div>
  44 + </a>
  45 + </li>
  46 + <li>
  47 + <a href="javascript::;">
  48 + <i class="menu-icon fa fa-file-code-o bg-green"></i>
  49 +
  50 + <div class="menu-info">
  51 + <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>
  52 +
  53 + <p>Execution time 5 seconds</p>
  54 + </div>
  55 + </a>
  56 + </li>
  57 + </ul>
  58 + <!-- /.control-sidebar-menu -->
  59 +
  60 + <h3 class="control-sidebar-heading">Tasks Progress</h3>
  61 + <ul class="control-sidebar-menu">
  62 + <li>
  63 + <a href="javascript::;">
  64 + <h4 class="control-sidebar-subheading">
  65 + Custom Template Design
  66 + <span class="label label-danger pull-right">70%</span>
  67 + </h4>
  68 +
  69 + <div class="progress progress-xxs">
  70 + <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
  71 + </div>
  72 + </a>
  73 + </li>
  74 + <li>
  75 + <a href="javascript::;">
  76 + <h4 class="control-sidebar-subheading">
  77 + Update Resume
  78 + <span class="label label-success pull-right">95%</span>
  79 + </h4>
  80 +
  81 + <div class="progress progress-xxs">
  82 + <div class="progress-bar progress-bar-success" style="width: 95%"></div>
  83 + </div>
  84 + </a>
  85 + </li>
  86 + <li>
  87 + <a href="javascript::;">
  88 + <h4 class="control-sidebar-subheading">
  89 + Laravel Integration
  90 + <span class="label label-warning pull-right">50%</span>
  91 + </h4>
  92 +
  93 + <div class="progress progress-xxs">
  94 + <div class="progress-bar progress-bar-warning" style="width: 50%"></div>
  95 + </div>
  96 + </a>
  97 + </li>
  98 + <li>
  99 + <a href="javascript::;">
  100 + <h4 class="control-sidebar-subheading">
  101 + Back End Framework
  102 + <span class="label label-primary pull-right">68%</span>
  103 + </h4>
  104 +
  105 + <div class="progress progress-xxs">
  106 + <div class="progress-bar progress-bar-primary" style="width: 68%"></div>
  107 + </div>
  108 + </a>
  109 + </li>
  110 + </ul>
  111 + <!-- /.control-sidebar-menu -->
  112 +
  113 + </div>
  114 + <!-- /.tab-pane -->
  115 + <!-- Stats tab content -->
  116 + <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
  117 + <!-- /.tab-pane -->
  118 + <!-- Settings tab content -->
  119 + <div class="tab-pane" id="control-sidebar-settings-tab">
  120 + <form method="post">
  121 + <h3 class="control-sidebar-heading">General Settings</h3>
  122 +
  123 + <div class="form-group">
  124 + <label class="control-sidebar-subheading">
  125 + Report panel usage
  126 + <input type="checkbox" class="pull-right" checked>
  127 + </label>
  128 +
  129 + <p>
  130 + Some information about this general settings option
  131 + </p>
  132 + </div>
  133 + <!-- /.form-group -->
  134 +
  135 + <div class="form-group">
  136 + <label class="control-sidebar-subheading">
  137 + Allow mail redirect
  138 + <input type="checkbox" class="pull-right" checked>
  139 + </label>
  140 +
  141 + <p>
  142 + Other sets of options are available
  143 + </p>
  144 + </div>
  145 + <!-- /.form-group -->
  146 +
  147 + <div class="form-group">
  148 + <label class="control-sidebar-subheading">
  149 + Expose author name in posts
  150 + <input type="checkbox" class="pull-right" checked>
  151 + </label>
  152 +
  153 + <p>
  154 + Allow the user to show his name in blog posts
  155 + </p>
  156 + </div>
  157 + <!-- /.form-group -->
  158 +
  159 + <h3 class="control-sidebar-heading">Chat Settings</h3>
  160 +
  161 + <div class="form-group">
  162 + <label class="control-sidebar-subheading">
  163 + Show me as online
  164 + <input type="checkbox" class="pull-right" checked>
  165 + </label>
  166 + </div>
  167 + <!-- /.form-group -->
  168 +
  169 + <div class="form-group">
  170 + <label class="control-sidebar-subheading">
  171 + Turn off notifications
  172 + <input type="checkbox" class="pull-right">
  173 + </label>
  174 + </div>
  175 + <!-- /.form-group -->
  176 +
  177 + <div class="form-group">
  178 + <label class="control-sidebar-subheading">
  179 + Delete chat history
  180 + <a href="javascript::;" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
  181 + </label>
  182 + </div>
  183 + <!-- /.form-group -->
  184 + </form>
  185 + </div>
  186 + <!-- /.tab-pane -->
  187 + </div>
  188 +</aside>
0 189 \ No newline at end of file
... ...
backend/views/layouts/footer.php 0 → 100755
  1 +++ a/backend/views/layouts/footer.php
  1 +<footer class="main-footer">
  2 +
  3 +</footer>
0 4 \ No newline at end of file
... ...
backend/views/layouts/header.php 0 → 100755
  1 +++ a/backend/views/layouts/header.php
  1 +<?php
  2 +
  3 +/* @var $this \yii\web\View */
  4 +/* @var $content string */
  5 +
  6 +use yii\helpers\Html;
  7 +use yii\bootstrap\Nav;
  8 +use yii\bootstrap\NavBar;
  9 +use yii\helpers\Url;
  10 +use yii\widgets\Breadcrumbs;
  11 +use frontend\assets\AppAsset;
  12 +use common\widgets\Alert;
  13 +use yii\widgets\Menu;
  14 +
  15 +AppAsset::register($this);
  16 +?>
  17 +<header class="main-header">
  18 + <!-- Logo -->
  19 + <a href="/admin/" class="logo">
  20 + <!-- mini logo for sidebar mini 50x50 pixels -->
  21 + <span class="logo-mini"><b>A</b>BOX</span>
  22 + <!-- logo for regular state and mobile devices -->
  23 + <span class="logo-lg"><b>Art</b>BOX</span>
  24 + </a>
  25 + <!-- Header Navbar: style can be found in header.less -->
  26 + <nav class="navbar navbar-static-top" role="navigation">
  27 + <!-- Sidebar toggle button-->
  28 + <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
  29 + <span class="sr-only">Toggle navigation</span>
  30 + </a>
  31 +
  32 + <div class="navbar-custom-menu">
  33 + </div>
  34 + </nav>
  35 +</header>
0 36 \ No newline at end of file
... ...
backend/views/layouts/main-sidebar.php 0 → 100755
  1 +++ a/backend/views/layouts/main-sidebar.php
  1 +<?php
  2 +use yii\helpers\Url;
  3 +use yii\widgets\Menu;
  4 +?>
  5 +<aside class="main-sidebar">
  6 + <!-- sidebar: style can be found in sidebar.less -->
  7 + <section class="sidebar">
  8 + <?php
  9 +//print_r($this->context->id);
  10 +// die();
  11 +
  12 + $items = [
  13 + [
  14 + 'label' => 'Заказы',
  15 + 'url' => ['/orders/index'],
  16 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-shopping-cart"></i> <span>{label}</span></a>',
  17 + 'options' => ['class'=>\Yii::$app->user->can('orders') ? '' :'hide'],
  18 + ],
  19 + [
  20 + 'label' => 'eCommerce',
  21 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-barcode"></i> <span>{label}</span></a>',
  22 + 'url' => ['/product/manage'],
  23 + 'active' => preg_match('/^manage.*$/', $this->context->id) ||
  24 + preg_match('/^category.*$/', $this->context->id) ||
  25 + preg_match('/^brand.*$/', $this->context->id) ||
  26 + preg_match('/^product-unit.*$/', $this->context->id) ||
  27 + preg_match('/^import.*$/', $this->context->id) ||
  28 + preg_match('/^tax-group.*$/', $this->context->id) ||
  29 + preg_match('/^export.*$/', $this->context->id) ? true : false,
  30 + 'options' => ['class'=>\Yii::$app->user->can('product') || \Yii::$app->user->can('category') || \Yii::$app->user->can('brand') || \Yii::$app->user->can('rubrication') ? '' :'hide'],
  31 + 'items' => [
  32 + [
  33 + 'label' => 'Товары',
  34 + 'url' => ['/product/manage'],
  35 + 'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide']
  36 + ],
  37 +// [
  38 +// 'label' => 'Модификации',
  39 +// 'url' => ['/product/variant'],
  40 +// 'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide']
  41 +// ],
  42 + [
  43 + 'label' => 'Категории',
  44 + 'url' => ['/category'],
  45 + 'options' => ['class'=>\Yii::$app->user->can('category') ? '' :'hide'],
  46 +
  47 + ],
  48 + [
  49 + 'label' => 'Бренды',
  50 + 'url' => ['/brand'],
  51 + 'options' => ['class'=>\Yii::$app->user->can('brand') ? '' :'hide'],
  52 + ],
  53 + [
  54 + 'label' => 'Единицы измерения',
  55 + 'url' => ['/product/product-unit'],
  56 + 'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],
  57 + ],
  58 + [
  59 + 'label' => 'Импорт товаров',
  60 + 'url' => ['/product/manage/import'],
  61 + 'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],
  62 + ],
  63 + [
  64 + 'label' => 'Экспорт товаров',
  65 + 'url' => ['/product/manage/export'],
  66 + 'options' => ['class'=>\Yii::$app->user->can('product') ? '' :'hide'],
  67 + ],
  68 + [
  69 + 'label' => 'Характеристики Товаров',
  70 + 'url' => Url::toRoute(['/rubrication/tax-group', 'level'=> '0']),
  71 + 'options' => ['class'=>\Yii::$app->user->can('rubrication') ? '' :'hide'],
  72 + ],
  73 + [
  74 + 'label' => 'Характеристики Модификаций',
  75 + 'url' => Url::toRoute(['/rubrication/tax-group', 'level'=> '1']),
  76 + 'options' => ['class'=>\Yii::$app->user->can('rubrication') ? '' :'hide'],
  77 + ],
  78 + [
  79 + 'label' => 'Зависимости',
  80 + 'url' => ['/relation/manage'],
  81 + 'options' => ['class'=>\Yii::$app->user->can('relation') ? '' :'hide'],
  82 + ]
  83 + ]
  84 + ],
  85 + [
  86 + 'label' => 'Слайдер/Банеры',
  87 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-picture"></i> <span>{label}</span></a>',
  88 + 'options' => ['class'=>\Yii::$app->user->can('banner') || \Yii::$app->user->can('slider') ? '' :'hide'],
  89 + 'active' => preg_match('/^slider.*$/', $this->context->id) || preg_match('/^banner.*$/', $this->context->id) ? true : false,
  90 + 'items' => [
  91 + [
  92 + 'label' => 'Слайдер',
  93 + 'url' => ['/slider/index'],
  94 + 'options' => ['class'=>\Yii::$app->user->can('slider') ? '' :'hide'],
  95 + ],
  96 + [
  97 + 'label' => 'Банер',
  98 + 'url' => ['/banner/index'],
  99 + 'options' => ['class'=>\Yii::$app->user->can('banner') ? '' :'hide'],
  100 + ],
  101 + ]
  102 + ],
  103 + [
  104 + 'label' => 'Текстовые страницы',
  105 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-duplicate"></i> <span>{label}</span></a>',
  106 + 'url' => ['/page/index'],
  107 + 'options' => ['class'=>\Yii::$app->user->can('event') ? '' :'hide'],
  108 + ],
  109 + [
  110 + 'label' => 'Статьи',
  111 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-pencil"></i> <span>{label}</span></a>',
  112 + 'url' => ['/articles/index'],
  113 + 'options' => ['class'=>\Yii::$app->user->can('articles') ? '' :'hide'],
  114 + ],
  115 + [
  116 + 'label' => 'Акции',
  117 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-piggy-bank"></i> <span>{label}</span></a>',
  118 + 'url' => ['/event/index'],
  119 + 'options' => ['class'=>\Yii::$app->user->can('event') ? '' :'hide'],
  120 + ],
  121 + [
  122 + 'label' => 'SEO',
  123 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>',
  124 + 'active' => preg_match('/^seo.*$/', $this->context->id) || preg_match('/^seo-category.*$/', $this->context->id) ? true : false,
  125 + 'options' => ['class'=>\Yii::$app->user->can('seo') || \Yii::$app->user->can('seo-category') ? '' :'hide'],
  126 + 'items' => [
  127 + [
  128 + 'label' => 'URL',
  129 + 'url' => ['/seo/index'],
  130 + 'options' => ['class'=>\Yii::$app->user->can('seo') ? '' :'hide'],
  131 + ],
  132 + [
  133 + 'label' => 'Шаблоны',
  134 + 'url' => ['/seo-category/index'],
  135 + 'options' => ['class'=>\Yii::$app->user->can('seo-category') ? '' :'hide'],
  136 + ]
  137 + ]
  138 + ],
  139 +
  140 + [
  141 + 'label' => 'Фон',
  142 + 'url' => ['/bg/index'],
  143 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-picture"></i> <span>{label}</span></a>',
  144 + 'options' => ['class'=>\Yii::$app->user->can('bg')? '' :'hide']
  145 + ],
  146 + [
  147 + 'label' => 'Подписка',
  148 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-envelope"></i> <span>{label}</span></a>',
  149 + 'url' => ['/subscribe/index'],
  150 + 'options' => ['class'=>\Yii::$app->user->can('subscribe') ? '' :'hide'],
  151 + ],
  152 + [
  153 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-user"></i> <span>{label}</span></a>',
  154 + 'label' => 'Пользователи',
  155 + 'url' => ['/customer/index'],
  156 + 'options' => ['class'=>\Yii::$app->user->can('customer') ? '' :'hide'],
  157 + ],
  158 + [
  159 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-comment"></i> <span>{label}</span></a>',
  160 + 'label' => 'Комментарии',
  161 + 'url' => ['/artbox-comments'],
  162 + 'options' => ['class'=>\Yii::$app->user->can('artbox-comments') ? '' :'hide'],
  163 + ],
  164 + [
  165 + 'label' => 'Настройка ролей',
  166 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-cog"></i> <span>{label}</span></a>',
  167 + 'active' => preg_match('/^user.*$/', $this->context->id)
  168 + || preg_match('/^access.*$/', $this->context->id) ? true : false,
  169 + 'options' => ['class'=>\Yii::$app->user->can('user') || \Yii::$app->user->can('user') || \Yii::$app->user->can('permit') ? '' :'hide'],
  170 + 'items' => [
  171 + [
  172 + 'label' => 'Администраторы',
  173 + 'url' => ['/user/index'],
  174 + 'options' => ['class'=>\Yii::$app->user->can('user') ? '' :'hide'],
  175 + ],
  176 + [
  177 + 'label' => 'управление ролями',
  178 + 'url' => ['/permit/access/role'],
  179 + 'options' => ['class'=>\Yii::$app->user->can('permit') ? '' :'hide'],
  180 + ],
  181 + [
  182 + 'label' => 'управление правами доступа',
  183 + 'url' => ['/permit/access/permission'],
  184 + 'options' => ['class'=>\Yii::$app->user->can('permit') ? '' :'hide'],
  185 + ]
  186 + ]
  187 + ],
  188 +
  189 +
  190 +
  191 + ];
  192 +
  193 +
  194 + if (Yii::$app->user->isGuest) {
  195 + array_push($items,
  196 + ['label' => 'Signup', 'url' => ['/admin/site/signup']], ['label' => 'Login', 'url' => ['/admin/site/login']]
  197 + );
  198 + } else {
  199 + array_push($items,
  200 + [
  201 + 'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
  202 + 'url'=>'/admin/site/logout',
  203 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-log-out"></i> <span>{label}</span></a>',
  204 + ]
  205 + );
  206 + }
  207 + echo Menu::widget([
  208 + 'options' => ['class' => 'sidebar-menu'],
  209 + 'submenuTemplate' => "\n<ul class='treeview-menu'>\n{items}\n</ul>\n",
  210 +
  211 + 'items' =>$items,
  212 +
  213 + ]);
  214 + ?>
  215 + <!-- sidebar menu: : style can be found in sidebar.less -->
  216 +
  217 + </section>
  218 + <!-- /.sidebar -->
  219 +</aside>
0 220 \ No newline at end of file
... ...
backend/views/layouts/main.php 0 → 100755
  1 +++ a/backend/views/layouts/main.php
  1 +<?php
  2 +
  3 +/* @var $this \yii\web\View */
  4 +/* @var $content string */
  5 +
  6 +use backend\assets\AdminLteAsset;
  7 +use backend\assets\AppAsset;
  8 +use yii\helpers\Html;
  9 +
  10 +AppAsset::register($this);
  11 +AdminLteAsset::register($this);
  12 +?>
  13 +<?php $this->beginPage() ?>
  14 +<!DOCTYPE html>
  15 +<html lang="<?= Yii::$app->language ?>" >
  16 +<head>
  17 + <meta charset="<?= Yii::$app->charset ?>">
  18 + <meta name="viewport" content="width=device-width, initial-scale=1">
  19 + <?= Html::csrfMetaTags() ?>
  20 + <title><?= Html::encode($this->title) ?></title>
  21 + <?php $this->head() ?>
  22 +</head>
  23 +<body class="hold-transition skin-blue sidebar-mini">
  24 +<?php $this->beginBody() ?>
  25 +<div class="wrapper">
  26 +
  27 + <?= $content ?>
  28 +
  29 +</div>
  30 +<!-- ./wrapper -->
  31 +<?php $this->endBody() ?>
  32 +</body>
  33 +</html>
  34 +<?php $this->endPage() ?>
... ...