Commit 3f2bc3d0cb3287f3988b91ec696fae450ce4785e
0 parents
first commit
Showing
833 changed files
with
54909 additions
and
0 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 833 files are displayed.
| 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 | +/frontend/config/main-local.php | |
| 38 | +/frontend/config/params-local.php | |
| 39 | + | |
| 40 | +/backend/web/assets/ | |
| 41 | +/frontend/web/assets/ | |
| 42 | +/frontend/web/css/node_modules/ | |
| 43 | +/frontend/views/вертска | |
| 44 | +composer.lock | |
| 45 | + | |
| 46 | +tests/_output/* | |
| 0 | 47 | \ No newline at end of file | ... | ... |
| 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 | + | |
| 18 | + RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] | |
| 19 | + | |
| 20 | + RewriteCond %{REQUEST_URI} ^/(admin) | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] | |
| 25 | + | |
| 26 | + RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] | |
| 27 | + | |
| 28 | + RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L] | |
| 29 | + | |
| 30 | + RewriteRule ^admin/images/(.*)$ backend/web/images/$1 [L] | |
| 31 | + | |
| 32 | + RewriteRule ^admin/fonts/(.*)$ backend/web/fonts/$1 [L] | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js|images|fonts)/ | |
| 39 | + | |
| 40 | + RewriteCond %{REQUEST_URI} ^/(admin) | |
| 41 | + | |
| 42 | + RewriteRule ^.*$ backend/web/index.php [L] | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + RewriteCond %{REQUEST_URI} ^/(assets|css) | |
| 47 | + | |
| 48 | + RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L] | |
| 49 | + | |
| 50 | + RewriteRule ^css/(.*)$ frontend/web/css/$1 [L] | |
| 51 | + | |
| 52 | + RewriteRule ^js/(.*)$ frontend/web/js/$1 [L] | |
| 53 | + | |
| 54 | + RewriteRule ^images/(.*)$ frontend/web/images/$1 [L] | |
| 55 | + | |
| 56 | + RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L] | |
| 57 | + | |
| 58 | + | |
| 59 | + RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js|images|fonts)/ | |
| 60 | + | |
| 61 | + RewriteCond %{REQUEST_URI} !index.php | |
| 62 | + | |
| 63 | + RewriteCond %{REQUEST_FILENAME} !-f [OR] | |
| 64 | + | |
| 65 | + RewriteCond %{REQUEST_FILENAME} !-d | |
| 66 | + | |
| 67 | + RewriteRule ^.*$ frontend/web/index.php [L] | |
| 68 | + | |
| 69 | +</IfModule> | |
| 70 | + | |
| 71 | +#для возможности загрузки файлов парсера | |
| 72 | +<IfModule mod_php5.c> | |
| 73 | + php_value upload_max_filesize 20M | |
| 74 | + php_value post_max_size 30M | |
| 75 | +</IfModule> | |
| 0 | 76 | \ No newline at end of file | ... | ... |
| 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. | ... | ... |
| 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 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | |
| 16 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | |
| 17 | +[](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 | +``` | ... | ... |
| 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 | + 'yii\bootstrap\BootstrapAsset', | |
| 31 | + 'yii\bootstrap\BootstrapPluginAsset', | |
| 32 | + 'backend\assets\FontAwesomeAsset', | |
| 33 | + 'common\modules\file\FileUploadAsset' | |
| 34 | + ]; | |
| 35 | +} | |
| 0 | 36 | \ No newline at end of file | ... | ... |
| 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 | + ]; | |
| 26 | + public $depends = [ | |
| 27 | + 'yii\web\YiiAsset', | |
| 28 | + 'yii\bootstrap\BootstrapAsset', | |
| 29 | + ]; | |
| 30 | +} | ... | ... |
| 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 | ... | ... |
| 1 | +++ a/backend/config/bootstrap.php | |
| 1 | +<?php | |
| 2 | +Yii::setAlias('@uploadDir', dirname(dirname(__DIR__)) . '/storage/sync'); | |
| 3 | +Yii::setAlias('@uploadFileProducts', 'products.csv'); | |
| 4 | + | |
| 5 | +Yii::setAlias('@productsDir', dirname(dirname(__DIR__)) . '/storage/products'); | |
| 0 | 6 | \ No newline at end of file | ... | ... |
| 1 | +++ a/backend/config/main.php | |
| 1 | +<?php | |
| 2 | +$params = array_merge( | |
| 3 | + require(__DIR__ . '/../../common/config/params.php'), | |
| 4 | + require(__DIR__ . '/../../common/config/params-local.php'), | |
| 5 | + require(__DIR__ . '/params.php'), | |
| 6 | + require(__DIR__ . '/params-local.php') | |
| 7 | +); | |
| 8 | + | |
| 9 | +return [ | |
| 10 | + 'id' => 'app-backend', | |
| 11 | + 'basePath' => dirname(__DIR__), | |
| 12 | + 'layout' => 'admin', | |
| 13 | + 'controllerNamespace' => 'backend\controllers', | |
| 14 | + 'bootstrap' => ['log'], | |
| 15 | + 'modules' => [ | |
| 16 | + 'rubrication' => [ | |
| 17 | + 'class' => 'common\modules\rubrication\Module', | |
| 18 | + 'types' => [ | |
| 19 | + 'string' => 'Strings', | |
| 20 | + 'float' => 'Floating number', | |
| 21 | + 'int' => 'Integer number', | |
| 22 | + 'link' => 'Web-link', | |
| 23 | + ] | |
| 24 | + ], | |
| 25 | + 'product' => [ | |
| 26 | + 'class' => 'common\modules\product\Module' | |
| 27 | + ], | |
| 28 | + 'gridview' => [ | |
| 29 | + 'class' => '\kartik\grid\Module' | |
| 30 | + ] | |
| 31 | + ], | |
| 32 | + 'components' => [ | |
| 33 | + 'user' => [ | |
| 34 | + 'identityClass' => 'common\models\User', | |
| 35 | + 'enableAutoLogin' => true, | |
| 36 | + ], | |
| 37 | + 'log' => [ | |
| 38 | + 'traceLevel' => YII_DEBUG ? 3 : 0, | |
| 39 | + 'targets' => [ | |
| 40 | + [ | |
| 41 | + 'class' => 'yii\log\FileTarget', | |
| 42 | + 'levels' => ['error', 'warning'], | |
| 43 | + ], | |
| 44 | + ], | |
| 45 | + ], | |
| 46 | + 'errorHandler' => [ | |
| 47 | + 'errorAction' => 'site/error', | |
| 48 | + ], | |
| 49 | + 'request'=>[ | |
| 50 | + 'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i', | |
| 51 | + 'csrfParam' => '_backendCSRF', | |
| 52 | + | |
| 53 | + 'class' => 'common\components\Request', | |
| 54 | + | |
| 55 | + 'web'=> '/backend/web', | |
| 56 | + | |
| 57 | + 'adminUrl' => '/admin' | |
| 58 | + | |
| 59 | + ], | |
| 60 | + 'urlManager' => [ | |
| 61 | + 'baseUrl' => '/admin', | |
| 62 | + 'enablePrettyUrl' => true, | |
| 63 | + 'showScriptName' => false, | |
| 64 | + 'rules' => [ | |
| 65 | + 'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'slider-image/<action>', | |
| 66 | + 'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>' => 'slider-image/<action>', | |
| 67 | + 'seo-dynamic/<action>/<seo_category_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'seo-dynamic/<action>', | |
| 68 | + 'seo-dynamic/<action>/<seo_category_id:[A-Za-z0-9_-]+>' => 'seo-dynamic/<action>', | |
| 69 | + | |
| 70 | + | |
| 71 | + ] | |
| 72 | + ] | |
| 73 | + | |
| 74 | + ], | |
| 75 | + 'params' => $params, | |
| 76 | +]; | ... | ... |
| 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 | + | |
| 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 | + 'verbs' => [ | |
| 25 | + 'class' => VerbFilter::className(), | |
| 26 | + 'actions' => [ | |
| 27 | + 'delete' => ['POST'], | |
| 28 | + ], | |
| 29 | + ], | |
| 30 | + ]; | |
| 31 | + } | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * Lists all Banner models. | |
| 35 | + * @return mixed | |
| 36 | + */ | |
| 37 | + public function actionIndex() | |
| 38 | + { | |
| 39 | + $searchModel = new BannerSearch(); | |
| 40 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 41 | + | |
| 42 | + return $this->render('index', [ | |
| 43 | + 'searchModel' => $searchModel, | |
| 44 | + 'dataProvider' => $dataProvider, | |
| 45 | + ]); | |
| 46 | + } | |
| 47 | + | |
| 48 | + public function actionSaveImageSettings(){ | |
| 49 | + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |
| 50 | + $width = Yii::$app->request->post('width'); | |
| 51 | + $height = Yii::$app->request->post('height'); | |
| 52 | + | |
| 53 | + $html = ImageUploader::widget([ | |
| 54 | + 'model'=> new Banner(), | |
| 55 | + 'field'=>'image', | |
| 56 | + 'size' => [ | |
| 57 | + [ | |
| 58 | + 'width'=>$width, | |
| 59 | + 'height'=>$height, | |
| 60 | + ], | |
| 61 | + ], | |
| 62 | + 'name' => "Загрузить баннер" | |
| 63 | + ]); | |
| 64 | + | |
| 65 | + return ['html'=>$html]; | |
| 66 | + } | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Displays a single Banner model. | |
| 70 | + * @param integer $id | |
| 71 | + * @return mixed | |
| 72 | + */ | |
| 73 | + public function actionView($id) | |
| 74 | + { | |
| 75 | + return $this->render('view', [ | |
| 76 | + 'model' => $this->findModel($id), | |
| 77 | + ]); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Creates a new Banner model. | |
| 82 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 83 | + * @return mixed | |
| 84 | + */ | |
| 85 | + public function actionCreate() | |
| 86 | + { | |
| 87 | + $model = new Banner(); | |
| 88 | + | |
| 89 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 90 | + return $this->redirect(['view', 'id' => $model->banner_id]); | |
| 91 | + } else { | |
| 92 | + return $this->render('create', [ | |
| 93 | + 'model' => $model, | |
| 94 | + ]); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * Updates an existing Banner model. | |
| 100 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 101 | + * @param integer $id | |
| 102 | + * @return mixed | |
| 103 | + */ | |
| 104 | + public function actionUpdate($id) | |
| 105 | + { | |
| 106 | + $model = $this->findModel($id); | |
| 107 | + | |
| 108 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 109 | + return $this->redirect(['view', 'id' => $model->banner_id]); | |
| 110 | + } else { | |
| 111 | + return $this->render('update', [ | |
| 112 | + 'model' => $model, | |
| 113 | + ]); | |
| 114 | + } | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * Deletes an existing Banner model. | |
| 119 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 120 | + * @param integer $id | |
| 121 | + * @return mixed | |
| 122 | + */ | |
| 123 | + public function actionDelete($id) | |
| 124 | + { | |
| 125 | + $this->findModel($id)->delete(); | |
| 126 | + | |
| 127 | + return $this->redirect(['index']); | |
| 128 | + } | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * Finds the Banner model based on its primary key value. | |
| 132 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 133 | + * @param integer $id | |
| 134 | + * @return Banner the loaded model | |
| 135 | + * @throws NotFoundHttpException if the model cannot be found | |
| 136 | + */ | |
| 137 | + protected function findModel($id) | |
| 138 | + { | |
| 139 | + if (($model = Banner::findOne($id)) !== null) { | |
| 140 | + return $model; | |
| 141 | + } else { | |
| 142 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 143 | + } | |
| 144 | + } | |
| 145 | +} | ... | ... |
| 1 | +++ a/backend/controllers/BlogController.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\controllers; | |
| 4 | + | |
| 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' => AccessControl::className(), | |
| 27 | + 'rules' => [ | |
| 28 | + [ | |
| 29 | + 'actions' => ['login', 'error'], | |
| 30 | + 'allow' => true, | |
| 31 | + ], | |
| 32 | + [ | |
| 33 | + 'actions' => ['logout', 'index'], | |
| 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 Blog models. | |
| 50 | + * @return mixed | |
| 51 | + */ | |
| 52 | + public function actionIndex() | |
| 53 | + { | |
| 54 | + $searchModel = new BlogSearch(); | |
| 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 Blog 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 Blog 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 Blog(); | |
| 83 | + | |
| 84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 85 | + | |
| 86 | + Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru'); | |
| 87 | + | |
| 88 | + return $this->redirect(['view', 'id' => $model->blog_id]); | |
| 89 | + } else { | |
| 90 | + return $this->render('create', [ | |
| 91 | + 'model' => $model, | |
| 92 | + ]); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Updates an existing Blog 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 | + Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru'); | |
| 108 | + return $this->redirect(['view', 'id' => $model->blog_id]); | |
| 109 | + } else { | |
| 110 | + return $this->render('update', [ | |
| 111 | + 'model' => $model, | |
| 112 | + ]); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * Deletes an existing Blog model. | |
| 118 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 119 | + * @param integer $id | |
| 120 | + * @return mixed | |
| 121 | + */ | |
| 122 | + public function actionDelete($id) | |
| 123 | + { | |
| 124 | + $this->findModel($id)->delete(); | |
| 125 | + | |
| 126 | + return $this->redirect(['index']); | |
| 127 | + } | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * Finds the Blog model based on its primary key value. | |
| 131 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 132 | + * @param integer $id | |
| 133 | + * @return Blog the loaded model | |
| 134 | + * @throws NotFoundHttpException if the model cannot be found | |
| 135 | + */ | |
| 136 | + protected function findModel($id) | |
| 137 | + { | |
| 138 | + if (($model = Blog::findOne($id)) !== null) { | |
| 139 | + return $model; | |
| 140 | + } else { | |
| 141 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 142 | + } | |
| 143 | + } | |
| 144 | +} | ... | ... |
| 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 | +/** | |
| 13 | + * BrandController implements the CRUD actions for Brand model. | |
| 14 | + */ | |
| 15 | +class BrandController extends Controller | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * @inheritdoc | |
| 19 | + */ | |
| 20 | + public function behaviors() | |
| 21 | + { | |
| 22 | + return [ | |
| 23 | + 'access' => [ | |
| 24 | + 'class' => AccessControl::className(), | |
| 25 | + 'rules' => [ | |
| 26 | + [ | |
| 27 | + 'actions' => ['login', 'error'], | |
| 28 | + 'allow' => true, | |
| 29 | + ], | |
| 30 | + [ | |
| 31 | + 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete'], | |
| 32 | + 'allow' => true, | |
| 33 | + 'roles' => ['@'], | |
| 34 | + ], | |
| 35 | + ], | |
| 36 | + ], | |
| 37 | + 'verbs' => [ | |
| 38 | + 'class' => VerbFilter::className(), | |
| 39 | + 'actions' => [ | |
| 40 | + 'logout' => ['post'], | |
| 41 | + ], | |
| 42 | + ], | |
| 43 | + ]; | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * Lists all Brand models. | |
| 48 | + * @return mixed | |
| 49 | + */ | |
| 50 | + public function actionIndex() | |
| 51 | + { | |
| 52 | + $searchModel = new BrandSearch(); | |
| 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 Brand 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 Brand 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 Brand(); | |
| 81 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 82 | + exit; | |
| 83 | + 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)); | |
| 84 | + } else { | |
| 85 | + return $this->render('create', [ | |
| 86 | + 'model' => $model, | |
| 87 | + ]); | |
| 88 | + } | |
| 89 | + } | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * Updates an existing Brand model. | |
| 93 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 94 | + * @param integer $id | |
| 95 | + * @return mixed | |
| 96 | + */ | |
| 97 | + public function actionUpdate($id) | |
| 98 | + { | |
| 99 | + $model = $this->findModel($id); | |
| 100 | + | |
| 101 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 102 | + return $this->redirect(['view', 'id' => $model->brand_id]); | |
| 103 | + } else { | |
| 104 | + return $this->render('update', [ | |
| 105 | + 'model' => $model, | |
| 106 | + ]); | |
| 107 | + } | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * Deletes an existing Brand model. | |
| 112 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 113 | + * @param integer $id | |
| 114 | + * @return mixed | |
| 115 | + */ | |
| 116 | + public function actionDelete($id) | |
| 117 | + { | |
| 118 | + $this->findModel($id)->delete(); | |
| 119 | + | |
| 120 | + return $this->redirect(['index']); | |
| 121 | + } | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * Finds the Brand model based on its primary key value. | |
| 125 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 126 | + * @param integer $id | |
| 127 | + * @return Brand the loaded model | |
| 128 | + * @throws NotFoundHttpException if the model cannot be found | |
| 129 | + */ | |
| 130 | + protected function findModel($id) | |
| 131 | + { | |
| 132 | + if (($model = Brand::findOne($id)) !== null) { | |
| 133 | + return $model; | |
| 134 | + } else { | |
| 135 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 136 | + } | |
| 137 | + } | |
| 138 | +} | ... | ... |
| 1 | +++ a/backend/controllers/CategoryController.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\controllers; | |
| 4 | + | |
| 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 | +/** | |
| 15 | + * CategoryController implements the CRUD actions for Category model. | |
| 16 | + */ | |
| 17 | +class CategoryController 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 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()) && $model->save()) { | |
| 85 | + 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)); | |
| 86 | + } else { | |
| 87 | + if (!empty(Yii::$app->request->queryParams['parent'])) { | |
| 88 | + $model->parent_id = Yii::$app->request->queryParams['parent']; | |
| 89 | + } | |
| 90 | + return $this->render('create', [ | |
| 91 | + 'model' => $model, | |
| 92 | + 'categories' => ArtboxTreeHelper::treeMap(Category::find()->with('categoryName')->getTree(), 'category_id', 'categoryName.value', '.') | |
| 93 | + ]); | |
| 94 | + } | |
| 95 | + } | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * Updates an existing Category model. | |
| 99 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 100 | + * @param integer $id | |
| 101 | + * @return mixed | |
| 102 | + */ | |
| 103 | + public function actionUpdate($id) | |
| 104 | + { | |
| 105 | + $model = $this->findModel($id); | |
| 106 | + | |
| 107 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 108 | + return $this->redirect(['view', 'id' => $model->category_id]); | |
| 109 | + } else { | |
| 110 | + return $this->render('update', [ | |
| 111 | + 'model' => $model, | |
| 112 | + 'categories' => ArtboxTreeHelper::treeMap(Category::find()->with('categoryName')->getTree(), 'category_id', 'categoryName.value', '.') | |
| 113 | + ]); | |
| 114 | + } | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * Deletes an existing Category model. | |
| 119 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 120 | + * @param integer $id | |
| 121 | + * @return mixed | |
| 122 | + */ | |
| 123 | + public function actionDelete($id) | |
| 124 | + { | |
| 125 | + $this->findModel($id)->delete(); | |
| 126 | + | |
| 127 | + return $this->redirect(['index']); | |
| 128 | + } | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * Finds the Category model based on its primary key value. | |
| 132 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 133 | + * @param integer $id | |
| 134 | + * @return Category the loaded model | |
| 135 | + * @throws NotFoundHttpException if the model cannot be found | |
| 136 | + */ | |
| 137 | + protected function findModel($id) | |
| 138 | + { | |
| 139 | + if (($model = Category::findOne($id)) !== null) { | |
| 140 | + return $model; | |
| 141 | + } else { | |
| 142 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 143 | + } | |
| 144 | + } | |
| 145 | +} | ... | ... |
| 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 | + | |
| 12 | +/** | |
| 13 | + * EventController implements the CRUD actions for Event model. | |
| 14 | + */ | |
| 15 | +class EventController extends Controller | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * @inheritdoc | |
| 19 | + */ | |
| 20 | + public function behaviors() | |
| 21 | + { | |
| 22 | + return [ | |
| 23 | + 'verbs' => [ | |
| 24 | + 'class' => VerbFilter::className(), | |
| 25 | + 'actions' => [ | |
| 26 | + 'delete' => ['POST'], | |
| 27 | + ], | |
| 28 | + ], | |
| 29 | + ]; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Lists all Event models. | |
| 34 | + * @return mixed | |
| 35 | + */ | |
| 36 | + public function actionIndex() | |
| 37 | + { | |
| 38 | + $searchModel = new EventSearch(); | |
| 39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 40 | + | |
| 41 | + return $this->render('index', [ | |
| 42 | + 'searchModel' => $searchModel, | |
| 43 | + 'dataProvider' => $dataProvider, | |
| 44 | + ]); | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Displays a single Event model. | |
| 49 | + * @param integer $id | |
| 50 | + * @return mixed | |
| 51 | + */ | |
| 52 | + public function actionView($id) | |
| 53 | + { | |
| 54 | + return $this->render('view', [ | |
| 55 | + 'model' => $this->findModel($id), | |
| 56 | + ]); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * Creates a new Event model. | |
| 61 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 62 | + * @return mixed | |
| 63 | + */ | |
| 64 | + public function actionCreate() | |
| 65 | + { | |
| 66 | + $model = new Event(); | |
| 67 | + | |
| 68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 69 | + return $this->redirect(['view', 'id' => $model->event_id]); | |
| 70 | + } else { | |
| 71 | + return $this->render('create', [ | |
| 72 | + 'model' => $model, | |
| 73 | + ]); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Updates an existing Event model. | |
| 79 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 80 | + * @param integer $id | |
| 81 | + * @return mixed | |
| 82 | + */ | |
| 83 | + public function actionUpdate($id) | |
| 84 | + { | |
| 85 | + $model = $this->findModel($id); | |
| 86 | + | |
| 87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 88 | + return $this->redirect(['view', 'id' => $model->event_id]); | |
| 89 | + } else { | |
| 90 | + return $this->render('update', [ | |
| 91 | + 'model' => $model, | |
| 92 | + ]); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Deletes an existing Event model. | |
| 98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 99 | + * @param integer $id | |
| 100 | + * @return mixed | |
| 101 | + */ | |
| 102 | + public function actionDelete($id) | |
| 103 | + { | |
| 104 | + $this->findModel($id)->delete(); | |
| 105 | + | |
| 106 | + return $this->redirect(['index']); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Finds the Event model based on its primary key value. | |
| 111 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 112 | + * @param integer $id | |
| 113 | + * @return Event the loaded model | |
| 114 | + * @throws NotFoundHttpException if the model cannot be found | |
| 115 | + */ | |
| 116 | + protected function findModel($id) | |
| 117 | + { | |
| 118 | + if (($model = Event::findOne($id)) !== null) { | |
| 119 | + return $model; | |
| 120 | + } else { | |
| 121 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 122 | + } | |
| 123 | + } | |
| 124 | +} | ... | ... |
| 1 | +++ a/backend/controllers/OrdersController.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\controllers; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use common\models\Orders; | |
| 7 | +use common\models\OrdersSearch; | |
| 8 | +use yii\web\Controller; | |
| 9 | +use yii\web\NotFoundHttpException; | |
| 10 | +use yii\filters\VerbFilter; | |
| 11 | +use yii\filters\AccessControl; | |
| 12 | +/** | |
| 13 | + * OrdersController implements the CRUD actions for Orders model. | |
| 14 | + */ | |
| 15 | +class OrdersController extends Controller | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * @inheritdoc | |
| 19 | + */ | |
| 20 | + public function behaviors() | |
| 21 | + { | |
| 22 | + return [ | |
| 23 | + 'access' => [ | |
| 24 | + 'class' => AccessControl::className(), | |
| 25 | + 'rules' => [ | |
| 26 | + [ | |
| 27 | + 'actions' => ['login', 'error','update','delete','create','view'], | |
| 28 | + 'allow' => true, | |
| 29 | + ], | |
| 30 | + [ | |
| 31 | + 'actions' => ['logout', 'index'], | |
| 32 | + 'allow' => true, | |
| 33 | + 'roles' => ['@'], | |
| 34 | + ], | |
| 35 | + ], | |
| 36 | + ], | |
| 37 | + 'verbs' => [ | |
| 38 | + 'class' => VerbFilter::className(), | |
| 39 | + 'actions' => [ | |
| 40 | + 'logout' => ['post'], | |
| 41 | + ], | |
| 42 | + ], | |
| 43 | + ]; | |
| 44 | + } | |
| 45 | + /** | |
| 46 | + * Lists all Orders models. | |
| 47 | + * @return mixed | |
| 48 | + */ | |
| 49 | + public function actionIndex() | |
| 50 | + { | |
| 51 | + $searchModel = new OrdersSearch(); | |
| 52 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 53 | + | |
| 54 | + return $this->render('index', [ | |
| 55 | + 'searchModel' => $searchModel, | |
| 56 | + 'dataProvider' => $dataProvider, | |
| 57 | + ]); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Displays a single Orders model. | |
| 62 | + * @param integer $id | |
| 63 | + * @return mixed | |
| 64 | + */ | |
| 65 | + public function actionView($id) | |
| 66 | + { | |
| 67 | + return $this->render('view', [ | |
| 68 | + 'model' => $this->findModel($id), | |
| 69 | + ]); | |
| 70 | + } | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * Creates a new Orders model. | |
| 74 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 75 | + * @return mixed | |
| 76 | + */ | |
| 77 | + public function actionCreate() | |
| 78 | + { | |
| 79 | + $model = new Orders(); | |
| 80 | + | |
| 81 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 82 | + return $this->redirect(['view', 'id' => $model->order_id]); | |
| 83 | + } else { | |
| 84 | + return $this->render('create', [ | |
| 85 | + 'model' => $model, | |
| 86 | + ]); | |
| 87 | + } | |
| 88 | + } | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * Updates an existing Orders model. | |
| 92 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 93 | + * @param integer $id | |
| 94 | + * @return mixed | |
| 95 | + */ | |
| 96 | + public function actionUpdate($id) | |
| 97 | + { | |
| 98 | + $model = $this->findModel($id); | |
| 99 | + | |
| 100 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 101 | + return $this->redirect(['view', 'id' => $model->order_id]); | |
| 102 | + } else { | |
| 103 | + return $this->render('update', [ | |
| 104 | + 'model' => $model, | |
| 105 | + ]); | |
| 106 | + } | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Deletes an existing Orders model. | |
| 111 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 112 | + * @param integer $id | |
| 113 | + * @return mixed | |
| 114 | + */ | |
| 115 | + public function actionDelete($id) | |
| 116 | + { | |
| 117 | + $this->findModel($id)->delete(); | |
| 118 | + | |
| 119 | + return $this->redirect(['index']); | |
| 120 | + } | |
| 121 | + | |
| 122 | + /** | |
| 123 | + * Finds the Orders model based on its primary key value. | |
| 124 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 125 | + * @param integer $id | |
| 126 | + * @return Orders the loaded model | |
| 127 | + * @throws NotFoundHttpException if the model cannot be found | |
| 128 | + */ | |
| 129 | + protected function findModel($id) | |
| 130 | + { | |
| 131 | + if (($model = Orders::findOne($id)) !== null) { | |
| 132 | + return $model; | |
| 133 | + } else { | |
| 134 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 135 | + } | |
| 136 | + } | |
| 137 | +} | ... | ... |
| 1 | +++ a/backend/controllers/PageController.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\controllers; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use yii\filters\AccessControl; | |
| 7 | +use common\models\Page; | |
| 8 | +use common\models\PageSearch; | |
| 9 | +use yii\web\Controller; | |
| 10 | +use yii\web\NotFoundHttpException; | |
| 11 | +use yii\filters\VerbFilter; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * PageController implements the CRUD actions for Page model. | |
| 15 | + */ | |
| 16 | +class PageController extends Controller | |
| 17 | +{ | |
| 18 | + public function behaviors() | |
| 19 | + { | |
| 20 | + return [ | |
| 21 | + 'access' => [ | |
| 22 | + 'class' => AccessControl::className(), | |
| 23 | + 'rules' => [ | |
| 24 | + [ | |
| 25 | + 'actions' => ['login', 'error'], | |
| 26 | + 'allow' => true, | |
| 27 | + ], | |
| 28 | + [ | |
| 29 | + 'actions' => ['logout', 'index','create','update','view','delete','test-img' ], | |
| 30 | + 'allow' => true, | |
| 31 | + 'roles' => ['@'], | |
| 32 | + ], | |
| 33 | + ], | |
| 34 | + ], | |
| 35 | + 'verbs' => [ | |
| 36 | + 'class' => VerbFilter::className(), | |
| 37 | + 'actions' => [ | |
| 38 | + 'logout' => ['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 | +} | ... | ... |
| 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 | + | |
| 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 | + 'verbs' => [ | |
| 24 | + 'class' => VerbFilter::className(), | |
| 25 | + 'actions' => [ | |
| 26 | + 'delete' => ['POST'], | |
| 27 | + ], | |
| 28 | + ], | |
| 29 | + ]; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Lists all SeoCategory models. | |
| 34 | + * @return mixed | |
| 35 | + */ | |
| 36 | + public function actionIndex() | |
| 37 | + { | |
| 38 | + $searchModel = new SeoCategorySearch(); | |
| 39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 40 | + | |
| 41 | + return $this->render('index', [ | |
| 42 | + 'searchModel' => $searchModel, | |
| 43 | + 'dataProvider' => $dataProvider, | |
| 44 | + ]); | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Displays a single SeoCategory model. | |
| 49 | + * @param integer $id | |
| 50 | + * @return mixed | |
| 51 | + */ | |
| 52 | + public function actionView($id) | |
| 53 | + { | |
| 54 | + return $this->render('view', [ | |
| 55 | + 'model' => $this->findModel($id), | |
| 56 | + ]); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * Creates a new SeoCategory model. | |
| 61 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 62 | + * @return mixed | |
| 63 | + */ | |
| 64 | + public function actionCreate() | |
| 65 | + { | |
| 66 | + $model = new SeoCategory(); | |
| 67 | + | |
| 68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 69 | + return $this->redirect(['view', 'id' => $model->seo_category_id]); | |
| 70 | + } else { | |
| 71 | + return $this->render('create', [ | |
| 72 | + 'model' => $model, | |
| 73 | + ]); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Updates an existing SeoCategory model. | |
| 79 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 80 | + * @param integer $id | |
| 81 | + * @return mixed | |
| 82 | + */ | |
| 83 | + public function actionUpdate($id) | |
| 84 | + { | |
| 85 | + $model = $this->findModel($id); | |
| 86 | + | |
| 87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 88 | + return $this->redirect(['view', 'id' => $model->seo_category_id]); | |
| 89 | + } else { | |
| 90 | + return $this->render('update', [ | |
| 91 | + 'model' => $model, | |
| 92 | + ]); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Deletes an existing SeoCategory model. | |
| 98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 99 | + * @param integer $id | |
| 100 | + * @return mixed | |
| 101 | + */ | |
| 102 | + public function actionDelete($id) | |
| 103 | + { | |
| 104 | + $this->findModel($id)->delete(); | |
| 105 | + | |
| 106 | + return $this->redirect(['index']); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Finds the SeoCategory model based on its primary key value. | |
| 111 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 112 | + * @param integer $id | |
| 113 | + * @return SeoCategory the loaded model | |
| 114 | + * @throws NotFoundHttpException if the model cannot be found | |
| 115 | + */ | |
| 116 | + protected function findModel($id) | |
| 117 | + { | |
| 118 | + if (($model = SeoCategory::findOne($id)) !== null) { | |
| 119 | + return $model; | |
| 120 | + } else { | |
| 121 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 122 | + } | |
| 123 | + } | |
| 124 | +} | ... | ... |
| 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 | + | |
| 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 | + 'verbs' => [ | |
| 24 | + 'class' => VerbFilter::className(), | |
| 25 | + 'actions' => [ | |
| 26 | + 'delete' => ['POST'], | |
| 27 | + ], | |
| 28 | + ], | |
| 29 | + ]; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Lists all Seo models. | |
| 34 | + * @return mixed | |
| 35 | + */ | |
| 36 | + public function actionIndex() | |
| 37 | + { | |
| 38 | + $searchModel = new SeoSearch(); | |
| 39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 40 | + | |
| 41 | + return $this->render('index', [ | |
| 42 | + 'searchModel' => $searchModel, | |
| 43 | + 'dataProvider' => $dataProvider, | |
| 44 | + ]); | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Displays a single Seo model. | |
| 49 | + * @param integer $id | |
| 50 | + * @return mixed | |
| 51 | + */ | |
| 52 | + public function actionView($id) | |
| 53 | + { | |
| 54 | + return $this->render('view', [ | |
| 55 | + 'model' => $this->findModel($id), | |
| 56 | + ]); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * Creates a new Seo model. | |
| 61 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 62 | + * @return mixed | |
| 63 | + */ | |
| 64 | + public function actionCreate() | |
| 65 | + { | |
| 66 | + $model = new Seo(); | |
| 67 | + | |
| 68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 69 | + return $this->redirect(['view', 'id' => $model->seo_id]); | |
| 70 | + } else { | |
| 71 | + return $this->render('create', [ | |
| 72 | + 'model' => $model, | |
| 73 | + ]); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Updates an existing Seo model. | |
| 79 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 80 | + * @param integer $id | |
| 81 | + * @return mixed | |
| 82 | + */ | |
| 83 | + public function actionUpdate($id) | |
| 84 | + { | |
| 85 | + $model = $this->findModel($id); | |
| 86 | + | |
| 87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 88 | + return $this->redirect(['view', 'id' => $model->seo_id]); | |
| 89 | + } else { | |
| 90 | + return $this->render('update', [ | |
| 91 | + 'model' => $model, | |
| 92 | + ]); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Deletes an existing Seo model. | |
| 98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 99 | + * @param integer $id | |
| 100 | + * @return mixed | |
| 101 | + */ | |
| 102 | + public function actionDelete($id) | |
| 103 | + { | |
| 104 | + $this->findModel($id)->delete(); | |
| 105 | + | |
| 106 | + return $this->redirect(['index']); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Finds the Seo model based on its primary key value. | |
| 111 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 112 | + * @param integer $id | |
| 113 | + * @return Seo the loaded model | |
| 114 | + * @throws NotFoundHttpException if the model cannot be found | |
| 115 | + */ | |
| 116 | + protected function findModel($id) | |
| 117 | + { | |
| 118 | + if (($model = Seo::findOne($id)) !== null) { | |
| 119 | + return $model; | |
| 120 | + } else { | |
| 121 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 122 | + } | |
| 123 | + } | |
| 124 | +} | ... | ... |
| 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 | + | |
| 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 | + 'verbs' => [ | |
| 24 | + 'class' => VerbFilter::className(), | |
| 25 | + 'actions' => [ | |
| 26 | + 'delete' => ['POST'], | |
| 27 | + ], | |
| 28 | + ], | |
| 29 | + ]; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Lists all SeoDynamic models. | |
| 34 | + * @return mixed | |
| 35 | + */ | |
| 36 | + public function actionIndex($seo_category_id) | |
| 37 | + { | |
| 38 | + $searchModel = new SeoDynamicSearch(); | |
| 39 | + $dataProvider = $searchModel->search($seo_category_id,Yii::$app->request->queryParams); | |
| 40 | + | |
| 41 | + return $this->render('index', [ | |
| 42 | + 'searchModel' => $searchModel, | |
| 43 | + 'dataProvider' => $dataProvider, | |
| 44 | + 'seo_category_id' => $seo_category_id | |
| 45 | + ]); | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * Displays a single SeoDynamic model. | |
| 50 | + * @param integer $id | |
| 51 | + * @return mixed | |
| 52 | + */ | |
| 53 | + public function actionView($seo_category_id, $id) | |
| 54 | + { | |
| 55 | + return $this->render('view', [ | |
| 56 | + 'model' => $this->findModel($id), | |
| 57 | + 'seo_category_id' => $seo_category_id | |
| 58 | + ]); | |
| 59 | + } | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * Creates a new SeoDynamic model. | |
| 63 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 64 | + * @return mixed | |
| 65 | + */ | |
| 66 | + public function actionCreate($seo_category_id) | |
| 67 | + { | |
| 68 | + $model = new SeoDynamic(); | |
| 69 | + | |
| 70 | + if ($model->load(Yii::$app->request->post())) { | |
| 71 | + $model->seo_category_id = $seo_category_id; | |
| 72 | + $model->save(); | |
| 73 | + return $this->redirect(['index', 'seo_category_id' => $model->seo_category_id]); | |
| 74 | + } else { | |
| 75 | + return $this->render('create', [ | |
| 76 | + 'model' => $model, | |
| 77 | + 'seo_category_id' => $seo_category_id | |
| 78 | + ]); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * Updates an existing SeoDynamic model. | |
| 84 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 85 | + * @param integer $id | |
| 86 | + * @return mixed | |
| 87 | + */ | |
| 88 | + public function actionUpdate($seo_category_id,$id) | |
| 89 | + { | |
| 90 | + $model = $this->findModel($id); | |
| 91 | + | |
| 92 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 93 | + return $this->redirect(['index', 'seo_category_id' => $model->seo_category_id]); | |
| 94 | + } else { | |
| 95 | + return $this->render('update', [ | |
| 96 | + 'model' => $model, | |
| 97 | + 'seo_category_id' => $seo_category_id | |
| 98 | + ]); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * Deletes an existing SeoDynamic model. | |
| 104 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 105 | + * @param integer $id | |
| 106 | + * @return mixed | |
| 107 | + */ | |
| 108 | + public function actionDelete($seo_category_id,$id) | |
| 109 | + { | |
| 110 | + $this->findModel($id)->delete(); | |
| 111 | + | |
| 112 | + return $this->redirect(['index','seo_category_id'=> $seo_category_id]); | |
| 113 | + } | |
| 114 | + | |
| 115 | + /** | |
| 116 | + * Finds the SeoDynamic model based on its primary key value. | |
| 117 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 118 | + * @param integer $id | |
| 119 | + * @return SeoDynamic the loaded model | |
| 120 | + * @throws NotFoundHttpException if the model cannot be found | |
| 121 | + */ | |
| 122 | + protected function findModel($id) | |
| 123 | + { | |
| 124 | + if (($model = SeoDynamic::findOne($id)) !== null) { | |
| 125 | + return $model; | |
| 126 | + } else { | |
| 127 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 128 | + } | |
| 129 | + } | |
| 130 | +} | ... | ... |
| 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 | + | |
| 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 | + 'verbs' => [ | |
| 24 | + 'class' => VerbFilter::className(), | |
| 25 | + 'actions' => [ | |
| 26 | + 'delete' => ['POST'], | |
| 27 | + ], | |
| 28 | + ], | |
| 29 | + ]; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Lists all Service models. | |
| 34 | + * @return mixed | |
| 35 | + */ | |
| 36 | + public function actionIndex() | |
| 37 | + { | |
| 38 | + $searchModel = new ServiceSearch(); | |
| 39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 40 | + | |
| 41 | + return $this->render('index', [ | |
| 42 | + 'searchModel' => $searchModel, | |
| 43 | + 'dataProvider' => $dataProvider, | |
| 44 | + ]); | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Displays a single Service model. | |
| 49 | + * @param integer $id | |
| 50 | + * @return mixed | |
| 51 | + */ | |
| 52 | + public function actionView($id) | |
| 53 | + { | |
| 54 | + return $this->render('view', [ | |
| 55 | + 'model' => $this->findModel($id), | |
| 56 | + ]); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * Creates a new Service model. | |
| 61 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 62 | + * @return mixed | |
| 63 | + */ | |
| 64 | + public function actionCreate() | |
| 65 | + { | |
| 66 | + $model = new Service(); | |
| 67 | + | |
| 68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 69 | + return $this->redirect(['view', 'id' => $model->service_id]); | |
| 70 | + } else { | |
| 71 | + return $this->render('create', [ | |
| 72 | + 'model' => $model, | |
| 73 | + ]); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Updates an existing Service model. | |
| 79 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 80 | + * @param integer $id | |
| 81 | + * @return mixed | |
| 82 | + */ | |
| 83 | + public function actionUpdate($id) | |
| 84 | + { | |
| 85 | + $model = $this->findModel($id); | |
| 86 | + | |
| 87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 88 | + return $this->redirect(['view', 'id' => $model->service_id]); | |
| 89 | + } else { | |
| 90 | + return $this->render('update', [ | |
| 91 | + 'model' => $model, | |
| 92 | + ]); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Deletes an existing Service model. | |
| 98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 99 | + * @param integer $id | |
| 100 | + * @return mixed | |
| 101 | + */ | |
| 102 | + public function actionDelete($id) | |
| 103 | + { | |
| 104 | + $this->findModel($id)->delete(); | |
| 105 | + | |
| 106 | + return $this->redirect(['index']); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Finds the Service model based on its primary key value. | |
| 111 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 112 | + * @param integer $id | |
| 113 | + * @return Service the loaded model | |
| 114 | + * @throws NotFoundHttpException if the model cannot be found | |
| 115 | + */ | |
| 116 | + protected function findModel($id) | |
| 117 | + { | |
| 118 | + if (($model = Service::findOne($id)) !== null) { | |
| 119 | + return $model; | |
| 120 | + } else { | |
| 121 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 122 | + } | |
| 123 | + } | |
| 124 | +} | ... | ... |
| 1 | +++ a/backend/controllers/SiteController.php | |
| 1 | +<?php | |
| 2 | +namespace backend\controllers; | |
| 3 | + | |
| 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\web\Controller; | |
| 14 | +use backend\models\LoginForm; | |
| 15 | +use yii\filters\VerbFilter; | |
| 16 | +use common\models\Blog; | |
| 17 | +/** | |
| 18 | + * Site controller | |
| 19 | + */ | |
| 20 | +class SiteController extends Controller | |
| 21 | +{ | |
| 22 | + | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * @inheritdoc | |
| 26 | + */ | |
| 27 | + public function behaviors() | |
| 28 | + { | |
| 29 | + return [ | |
| 30 | + 'access' => [ | |
| 31 | + 'class' => AccessControl::className(), | |
| 32 | + 'rules' => [ | |
| 33 | + [ | |
| 34 | + 'actions' => ['login', 'error', 'go'], | |
| 35 | + 'allow' => true, | |
| 36 | + ], | |
| 37 | + [ | |
| 38 | + 'actions' => ['logout', 'index'], | |
| 39 | + 'allow' => true, | |
| 40 | + 'roles' => ['@'], | |
| 41 | + ], | |
| 42 | + ], | |
| 43 | + ], | |
| 44 | + 'verbs' => [ | |
| 45 | + 'class' => VerbFilter::className(), | |
| 46 | + 'actions' => [ | |
| 47 | + 'logout' => ['post'], | |
| 48 | + ], | |
| 49 | + ], | |
| 50 | + ]; | |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * @inheritdoc | |
| 55 | + */ | |
| 56 | + public function actions() | |
| 57 | + { | |
| 58 | + return [ | |
| 59 | + 'error' => [ | |
| 60 | + 'class' => 'yii\web\ErrorAction', | |
| 61 | + ], | |
| 62 | + ]; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public function actionIndex() | |
| 66 | + { | |
| 67 | + $blog = new Blog(); | |
| 68 | + $post = \Yii::$app->request->post(); | |
| 69 | + if($blog->load($post)) { | |
| 70 | + $blog->save(); | |
| 71 | + } | |
| 72 | + return $this->render('index',[ | |
| 73 | + 'blog' => $blog | |
| 74 | + ]); | |
| 75 | + } | |
| 76 | + | |
| 77 | + public function actionLogin() | |
| 78 | + { | |
| 79 | + $this->layout = '/none'; | |
| 80 | + | |
| 81 | + if (!\Yii::$app->user->isGuest) { | |
| 82 | + return $this->goHome(); | |
| 83 | + } | |
| 84 | + | |
| 85 | + $model = new LoginForm(); | |
| 86 | + if ($model->load(Yii::$app->request->post()) && $model->login()) { | |
| 87 | + return $this->goBack(); | |
| 88 | + } else { | |
| 89 | + return $this->render('login', [ | |
| 90 | + 'model' => $model, | |
| 91 | + ]); | |
| 92 | + } | |
| 93 | + } | |
| 94 | + | |
| 95 | + public function actionLogout() | |
| 96 | + { | |
| 97 | + Yii::$app->user->logout(); | |
| 98 | + | |
| 99 | + return $this->goHome(); | |
| 100 | + } | |
| 101 | + | |
| 102 | + public function actionGo() { | |
| 103 | + $new_products = $linked_products = 0; | |
| 104 | + | |
| 105 | + // открываем файл и перебираем | |
| 106 | + $filename = Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFileProducts'); | |
| 107 | + if (!is_file($filename)) { | |
| 108 | + var_dump("File $filename not found"); | |
| 109 | + return Controller::EXIT_CODE_ERROR; | |
| 110 | + } | |
| 111 | + var_dump("File $filename loaded\n"); | |
| 112 | + | |
| 113 | + $db = yii::$app->db; | |
| 114 | + | |
| 115 | + if (($handle = fopen ($filename, 'r')) !== FALSE) | |
| 116 | + { | |
| 117 | + $j = 0; | |
| 118 | + | |
| 119 | + while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE) | |
| 120 | + { | |
| 121 | + $j++; | |
| 122 | + | |
| 123 | + foreach ($data as &$value) | |
| 124 | + { | |
| 125 | + //$value = mb_convert_encoding ($value, "UTF-8", mb_detect_encoding ($value)); | |
| 126 | + $value = iconv ('windows-1251', "UTF-8//TRANSLIT//IGNORE", $value); | |
| 127 | + $value = trim ($value); | |
| 128 | + } | |
| 129 | + | |
| 130 | + // будет всегда 19 элементов | |
| 131 | + for ($i = 0; $i <= 18; $i++) | |
| 132 | + { | |
| 133 | + if (! isset ($data[$i])) | |
| 134 | + { | |
| 135 | + $data[$i] = null; | |
| 136 | + } | |
| 137 | + } | |
| 138 | + | |
| 139 | + // 1 Группа (категория) | |
| 140 | + $catalog_name = $data[0]; | |
| 141 | + if (empty ($catalog_name)) | |
| 142 | + { | |
| 143 | + CONTINUE; | |
| 144 | + } | |
| 145 | + | |
| 146 | + // 2 Бренд | |
| 147 | + $brand_name = $data[1]; | |
| 148 | + if (empty ($brand_name)) | |
| 149 | + { | |
| 150 | + CONTINUE; | |
| 151 | + } | |
| 152 | + | |
| 153 | + // 3 Название товара | |
| 154 | + $product_name = $data[2]; | |
| 155 | + if (empty ($product_name)) | |
| 156 | + { | |
| 157 | + CONTINUE; | |
| 158 | + } | |
| 159 | + | |
| 160 | + // 4 Описание Укр | |
| 161 | + $product_body_uk = $data[3]; | |
| 162 | + | |
| 163 | + // 5 Описание Рус | |
| 164 | + $product_body_ru = $data[4]; | |
| 165 | + | |
| 166 | + // 6 Фильтр (через запятую) | |
| 167 | + $filters = explode (',', $data[5]); | |
| 168 | + | |
| 169 | + // 7 Доп фильтр через запятую | |
| 170 | + $filters_extra = explode (',', $data[6]); | |
| 171 | + | |
| 172 | + // 8 Пол череззапятую (мужской, женский, детский, унисекс) | |
| 173 | + $gender = explode (',', $data[7]); | |
| 174 | + | |
| 175 | + // 9 Год | |
| 176 | + $years = explode (',', $data[8]); | |
| 177 | + | |
| 178 | + // 10 Цена старая | |
| 179 | + $product_cost_old = $data[9]; | |
| 180 | + | |
| 181 | + // 11 Цена | |
| 182 | + $produc_cost = $data[10]; | |
| 183 | + | |
| 184 | + // 12 Акция | |
| 185 | + $product_akciya = (bool)$data[11]; | |
| 186 | + | |
| 187 | + // 13 Сопуд. Тов. | |
| 188 | + $similar = explode (',', $data[12]); | |
| 189 | + | |
| 190 | + // 14 Новинки | |
| 191 | + $product_new = (bool)$data[13]; | |
| 192 | + | |
| 193 | + // 15 Топ продаж | |
| 194 | + $product_top = (bool)$data[14]; | |
| 195 | + | |
| 196 | + // 16 Сетка Характеристик | |
| 197 | + $feature = explode ('=', $data[15]); | |
| 198 | + | |
| 199 | + // 17 ВИДЕО КОД | |
| 200 | + $product_video = $data[16]; | |
| 201 | + | |
| 202 | + // 18 Галлерея фото | |
| 203 | + $fotos = explode (',', $data[17]); | |
| 204 | + | |
| 205 | + // 19 Штрих код товара. | |
| 206 | + // расшифровал - это модификации товара! | |
| 207 | + | |
| 208 | + $product_image = explode ('=', $data[18]); | |
| 209 | + $product_image = @$product_image[3]; | |
| 210 | + | |
| 211 | + if ( ($_product = Product::find()->filterWhere(['ilike', 'name', trim($product_name)])->one()) === null ) { | |
| 212 | + $_product = new Product(); | |
| 213 | + } | |
| 214 | + | |
| 215 | + // ==== Set category ==== | |
| 216 | + if ( ($category = CategoryName::find()->filterWhere(['ilike', 'value', trim($catalog_name)])->one()) !== null ) { | |
| 217 | + $_product->categories = [$category->category_id]; | |
| 218 | + } else { | |
| 219 | + // Create category | |
| 220 | + $category = new Category(); | |
| 221 | + $category->name = trim($catalog_name); | |
| 222 | + $category->save(); | |
| 223 | + $_product->categories = [$category->category_id]; | |
| 224 | + } | |
| 225 | + | |
| 226 | + // ===== Set brand ==== | |
| 227 | + if ( $brand_name ) { | |
| 228 | + if ( ($brand = BrandName::find()->filterWhere(['ilike', 'value', trim($brand_name)])->one()) !== null ) { | |
| 229 | + $_product->brand_id = $brand->brand_id; | |
| 230 | + } else { | |
| 231 | + // Create brand | |
| 232 | + $brand = new Brand(); | |
| 233 | + $brand->name = trim($brand_name); | |
| 234 | + $brand->save(); | |
| 235 | + $_product->brand_id = $brand->brand_id; | |
| 236 | + } | |
| 237 | + } | |
| 238 | + | |
| 239 | + $_product->name = $product_name; | |
| 240 | + $_product->video = $product_video; | |
| 241 | + $_product->description = $product_body_ru; | |
| 242 | + $_product->top = $product_top; | |
| 243 | + $_product->akciya = $product_akciya; | |
| 244 | + $_product->new = $product_new; | |
| 245 | + | |
| 246 | + | |
| 247 | + $_product->save(); | |
| 248 | + | |
| 249 | + | |
| 250 | + // @todo Set image | |
| 251 | + /*// картинки | |
| 252 | + if (is_file ($dir.'/mod/' . $product_image)) | |
| 253 | + { | |
| 254 | + $resizeObj = new resize ($dir.'/mod/' . $product_image); | |
| 255 | + $resizeObj->resizeImage (135, 200, 'auto'); | |
| 256 | + $resizeObj->saveImage ($dir.'/products/ico/' . $product_image, 100); | |
| 257 | + $resizeObj->resizeImage (370, 370, 'auto'); | |
| 258 | + $resizeObj->saveImage ($dir.'/products/big/' . $product_image, 100); | |
| 259 | + }*/ | |
| 260 | + | |
| 261 | + // ==== mods ==== | |
| 262 | + | |
| 263 | + // (типа штрих код товара) | |
| 264 | + | |
| 265 | + // нужно для проставления характеристик относящихся к модификациям | |
| 266 | + $MOD_ARRAY = []; | |
| 267 | + | |
| 268 | + for ($i = 18; $i < count ($data); $i ++) | |
| 269 | + { | |
| 270 | + if (! empty ($data[$i])) | |
| 271 | + { | |
| 272 | + $mod_arr = explode ('=', $data[$i]); | |
| 273 | + $mod_art = $mod_arr[0]; | |
| 274 | + $mod_size = $mod_arr[1]; | |
| 275 | + $mod_color = $mod_arr[2]; | |
| 276 | + $mod_image = $mod_arr[3]; | |
| 277 | + $mod_cost = $produc_cost; | |
| 278 | + $mod_old_cost = $product_cost_old; | |
| 279 | + | |
| 280 | + // Check product variant | |
| 281 | + if ( ($_productVariant = ProductVariant::find()->andWhere(['ilike', 'sku', $mod_art])->andWhere(['product_id' => $_product->product_id])->one()) === null ) { | |
| 282 | + $_productVariant = new ProductVariant(); | |
| 283 | + $_productVariant->product_id = $_product->product_id; | |
| 284 | + } | |
| 285 | + | |
| 286 | + $_productVariant->sku = $mod_art; | |
| 287 | + $_productVariant->price = $mod_cost; | |
| 288 | + $_productVariant->price_old = $mod_old_cost; | |
| 289 | + | |
| 290 | + $_productVariant->save(); | |
| 291 | + | |
| 292 | + $MOD_ARRAY[] = $_productVariant->product_variant_id; | |
| 293 | + | |
| 294 | + | |
| 295 | + $dir = Yii::getAlias('@productsDir').'/'; | |
| 296 | + if (is_file ($dir . $mod_image)) | |
| 297 | + { | |
| 298 | + $resizeObj = new resize ($dir . $mod_image); | |
| 299 | + $resizeObj->resizeImage (40, 40, 'crop'); | |
| 300 | + $resizeObj->saveImage ($dir.'ico/' . $mod_image, 100); | |
| 301 | + $resizeObj->resizeImage (370, 370, 'auto'); | |
| 302 | + $resizeObj->saveImage ($dir.'/big/' . $mod_image, 100); | |
| 303 | + } | |
| 304 | + | |
| 305 | + $product_variant_type_name = ''; | |
| 306 | + if (! empty ($mod_color)) | |
| 307 | + $product_variant_type_name = 'Цвет'; | |
| 308 | + elseif (! empty ($mod_size)) | |
| 309 | + $product_variant_type_name = 'Размер'; | |
| 310 | + | |
| 311 | + // ===== Set variant type ==== | |
| 312 | + if ( $product_variant_type_name ) { | |
| 313 | + if ( ($product_variant_type = ProductVariantType::find()->filterWhere(['ilike', 'name', $product_variant_type_name])->one()) !== null ) { | |
| 314 | + $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id; | |
| 315 | + } else { | |
| 316 | + // Create brand | |
| 317 | + $product_variant_type = new ProductVariantType(); | |
| 318 | + $product_variant_type->name = $product_variant_type_name; | |
| 319 | + $product_variant_type->save(); | |
| 320 | + $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id; | |
| 321 | + } | |
| 322 | + } | |
| 323 | + } | |
| 324 | + } | |
| 325 | + | |
| 326 | + /*// ==== fotos ==== | |
| 327 | + | |
| 328 | + foreach ($fotos as $foto) | |
| 329 | + { | |
| 330 | + $fields = [ | |
| 331 | + 'product_id' => $product_id, | |
| 332 | + 'image' => $foto | |
| 333 | + ]; | |
| 334 | + | |
| 335 | + $modelFotos = Fotos::find () | |
| 336 | + ->where ('image=:image', [ | |
| 337 | + ':image' => $foto | |
| 338 | + ]) | |
| 339 | + ->one (); | |
| 340 | + | |
| 341 | + if (empty ($modelFotos->id)) | |
| 342 | + { | |
| 343 | + $db->createCommand () | |
| 344 | + ->insert ('products_fotos', $fields) | |
| 345 | + ->execute (); | |
| 346 | + } | |
| 347 | + else | |
| 348 | + { | |
| 349 | + $db->createCommand () | |
| 350 | + ->update ('products_fotos', $fields, 'id = ' . $modelFotos->id) | |
| 351 | + ->execute (); | |
| 352 | + } | |
| 353 | + | |
| 354 | + if (is_file ($dir.'/fotos/' . $foto)) | |
| 355 | + { | |
| 356 | + $resizeObj = new resize ($dir.'/fotos/' . $foto); | |
| 357 | + $resizeObj->resizeImage (100, 100, 'crop'); | |
| 358 | + $resizeObj->saveImage ($dir.'/fotos/ico/' . $foto, 100); | |
| 359 | + $resizeObj->resizeImage (400, 400, 'crop'); | |
| 360 | + $resizeObj->saveImage ($dir.'/fotos/big/' . $foto, 100); | |
| 361 | + } | |
| 362 | + }*/ | |
| 363 | + | |
| 364 | + // ======================== | |
| 365 | + // ==== ХАРАКТЕРИСТИКИ ==== | |
| 366 | + // ======================== | |
| 367 | + | |
| 368 | + // есть общие характеристики, которые относятся product_id, такие как brand, gender... | |
| 369 | + // есть характеристики, которые относятся mod_id, такие как цвет, размер... | |
| 370 | + | |
| 371 | + // ==== gender ==== | |
| 372 | + | |
| 373 | + /*if (! empty ($gender)) | |
| 374 | + { | |
| 375 | + $bookGender = Book::find () | |
| 376 | + ->where ('book_alias=:book', [ | |
| 377 | + ':book' => 'gender' | |
| 378 | + ]) | |
| 379 | + ->one (); | |
| 380 | + | |
| 381 | + foreach ($gender as $filter) | |
| 382 | + { | |
| 383 | + if (! empty ($filter)) | |
| 384 | + { | |
| 385 | + $bookGenderValue = BookValue::find () | |
| 386 | + ->where (' | |
| 387 | + book_id=:book | |
| 388 | + AND book_value_title=:value | |
| 389 | + AND book_value_alias=:alias | |
| 390 | + ', [ | |
| 391 | + ':book' => $bookGender->book_id, | |
| 392 | + ':value' => $filter, | |
| 393 | + ':alias' => Translite::rusencode ($filter), | |
| 394 | + ] | |
| 395 | + ) | |
| 396 | + ->one(); | |
| 397 | + | |
| 398 | + if (! isset ($bookGenderValue->book_value_id) || empty ($bookGenderValue->book_value_id)) | |
| 399 | + { | |
| 400 | + $db->createCommand () | |
| 401 | + ->insert (BookValue::tableName (), [ | |
| 402 | + 'book_id' => $bookGender->book_id, | |
| 403 | + 'book_value_title' => $filter, | |
| 404 | + 'book_value_alias' => Translite::rusencode ($filter), | |
| 405 | + ]) | |
| 406 | + ->execute (); | |
| 407 | + | |
| 408 | + $book_value_id = Yii::$app->db->lastInsertID; | |
| 409 | + } | |
| 410 | + else | |
| 411 | + { | |
| 412 | + $book_value_id = $bookGenderValue->book_value_id; | |
| 413 | + } | |
| 414 | + | |
| 415 | + // + products_value | |
| 416 | + $db->createCommand (' | |
| 417 | + INSERT IGNORE products_value | |
| 418 | + SET | |
| 419 | + product_id = '.(int)$product_id.', | |
| 420 | + book_value_id = '.(int)$book_value_id.' | |
| 421 | + ') | |
| 422 | + ->execute (); | |
| 423 | + } | |
| 424 | + } | |
| 425 | + } | |
| 426 | + | |
| 427 | + // есть характеристики, которые относятся mod_id, такие как цвет, размер... | |
| 428 | + | |
| 429 | + // ==== destination ==== | |
| 430 | + | |
| 431 | + if (! empty ($filters)) | |
| 432 | + { | |
| 433 | + $bookDestination = Book::find () | |
| 434 | + ->where ('book_alias=:book', [ | |
| 435 | + ':book' => 'destination' | |
| 436 | + ]) | |
| 437 | + ->one (); | |
| 438 | + | |
| 439 | + foreach ($filters as $filter) | |
| 440 | + { | |
| 441 | + if (! empty ($filter)) | |
| 442 | + { | |
| 443 | + $bookDestinationValue = BookValue::find () | |
| 444 | + ->where (' | |
| 445 | + book_id=:book | |
| 446 | + AND book_value_title=:value | |
| 447 | + AND book_value_alias=:alias | |
| 448 | + ', [ | |
| 449 | + ':book' => $bookDestination->book_id, | |
| 450 | + ':value' => $filter, | |
| 451 | + ':alias' => Translite::rusencode ($filter), | |
| 452 | + ] | |
| 453 | + ) | |
| 454 | + ->one(); | |
| 455 | + | |
| 456 | + if (! isset ($bookDestinationValue->book_value_id) || empty ($bookDestinationValue->book_value_id)) | |
| 457 | + { | |
| 458 | + $db->createCommand () | |
| 459 | + ->insert (BookValue::tableName (), [ | |
| 460 | + 'book_id' => $bookDestination->book_id, | |
| 461 | + 'book_value_title' => $filter, | |
| 462 | + 'book_value_alias' => Translite::rusencode ($filter), | |
| 463 | + ]) | |
| 464 | + ->execute (); | |
| 465 | + | |
| 466 | + $book_value_id = Yii::$app->db->lastInsertID; | |
| 467 | + } | |
| 468 | + else | |
| 469 | + { | |
| 470 | + $book_value_id = $bookDestinationValue->book_value_id; | |
| 471 | + } | |
| 472 | + | |
| 473 | + if (! empty ($MOD_ARRAY)) | |
| 474 | + { | |
| 475 | + foreach ($MOD_ARRAY as $id) | |
| 476 | + { | |
| 477 | + // + products_value | |
| 478 | + $db->createCommand (' | |
| 479 | + INSERT IGNORE mod_value | |
| 480 | + SET | |
| 481 | + mod_id = '.(int)$id.', | |
| 482 | + book_value_id = '.(int)$book_value_id.' | |
| 483 | + ') | |
| 484 | + ->execute (); | |
| 485 | + } | |
| 486 | + } | |
| 487 | + } | |
| 488 | + } | |
| 489 | + } | |
| 490 | + | |
| 491 | + // ==== special ==== | |
| 492 | + | |
| 493 | + if (! empty ($filters_extra)) | |
| 494 | + { | |
| 495 | + $bookSpecial = Book::find () | |
| 496 | + ->where ('book_alias=:book', [ | |
| 497 | + ':book' => 'special' | |
| 498 | + ]) | |
| 499 | + ->one (); | |
| 500 | + | |
| 501 | + foreach ($filters_extra as $filter) | |
| 502 | + { | |
| 503 | + if (! empty ($filter)) | |
| 504 | + { | |
| 505 | + $bookSpecialValue = BookValue::find () | |
| 506 | + ->where (' | |
| 507 | + book_id=:book | |
| 508 | + AND book_value_title=:value | |
| 509 | + AND book_value_alias=:alias | |
| 510 | + ', [ | |
| 511 | + ':book' => $bookSpecial->book_id, | |
| 512 | + ':value' => $filter, | |
| 513 | + ':alias' => Translite::rusencode ($filter), | |
| 514 | + ] | |
| 515 | + ) | |
| 516 | + ->one(); | |
| 517 | + | |
| 518 | + if (! isset ($bookSpecialValue->book_value_id) || empty ($bookSpecialValue->book_value_id)) | |
| 519 | + { | |
| 520 | + $db->createCommand () | |
| 521 | + ->insert (BookValue::tableName (), [ | |
| 522 | + 'book_id' => $bookSpecial->book_id, | |
| 523 | + 'book_value_title' => $filter, | |
| 524 | + 'book_value_alias' => Translite::rusencode ($filter), | |
| 525 | + ]) | |
| 526 | + ->execute (); | |
| 527 | + | |
| 528 | + $book_value_id = Yii::$app->db->lastInsertID; | |
| 529 | + } | |
| 530 | + else | |
| 531 | + { | |
| 532 | + $book_value_id = $bookSpecialValue->book_value_id; | |
| 533 | + } | |
| 534 | + | |
| 535 | + if (! empty ($MOD_ARRAY)) | |
| 536 | + { | |
| 537 | + foreach ($MOD_ARRAY as $id) | |
| 538 | + { | |
| 539 | + // + products_value | |
| 540 | + $db->createCommand (' | |
| 541 | + INSERT IGNORE mod_value | |
| 542 | + SET | |
| 543 | + mod_id = '.(int)$id.', | |
| 544 | + book_value_id = '.(int)$book_value_id.' | |
| 545 | + ') | |
| 546 | + ->execute (); | |
| 547 | + } | |
| 548 | + } | |
| 549 | + } | |
| 550 | + } | |
| 551 | + } | |
| 552 | + | |
| 553 | + // ==== year ==== | |
| 554 | + | |
| 555 | + if (! empty ($years)) | |
| 556 | + { | |
| 557 | + $bookYear = Book::find () | |
| 558 | + ->where ('book_alias=:book', [ | |
| 559 | + ':book' => 'year' | |
| 560 | + ]) | |
| 561 | + ->one (); | |
| 562 | + | |
| 563 | + foreach ($years as $filter) | |
| 564 | + { | |
| 565 | + if (! empty ($filter)) | |
| 566 | + { | |
| 567 | + $bookYearValue = BookValue::find () | |
| 568 | + ->where (' | |
| 569 | + book_id=:book | |
| 570 | + AND book_value_title=:value | |
| 571 | + AND book_value_alias=:alias | |
| 572 | + ', [ | |
| 573 | + ':book' => $bookYear->book_id, | |
| 574 | + ':value' => $filter, | |
| 575 | + ':alias' => Translite::rusencode ($filter), | |
| 576 | + ] | |
| 577 | + ) | |
| 578 | + ->one(); | |
| 579 | + | |
| 580 | + if (! isset ($bookYearValue->book_value_id) || empty ($bookYearValue->book_value_id)) | |
| 581 | + { | |
| 582 | + $db->createCommand () | |
| 583 | + ->insert (BookValue::tableName (), [ | |
| 584 | + 'book_id' => $bookYear->book_id, | |
| 585 | + 'book_value_title' => $filter, | |
| 586 | + 'book_value_alias' => Translite::rusencode ($filter), | |
| 587 | + ]) | |
| 588 | + ->execute (); | |
| 589 | + | |
| 590 | + $book_value_id = Yii::$app->db->lastInsertID; | |
| 591 | + } | |
| 592 | + else | |
| 593 | + { | |
| 594 | + $book_value_id = $bookYearValue->book_value_id; | |
| 595 | + } | |
| 596 | + | |
| 597 | + if (! empty ($MOD_ARRAY)) | |
| 598 | + { | |
| 599 | + foreach ($MOD_ARRAY as $id) | |
| 600 | + { | |
| 601 | + // + products_value | |
| 602 | + $db->createCommand (' | |
| 603 | + INSERT IGNORE mod_value | |
| 604 | + SET | |
| 605 | + mod_id = '.(int)$id.', | |
| 606 | + book_value_id = '.(int)$book_value_id.' | |
| 607 | + ') | |
| 608 | + ->execute (); | |
| 609 | + } | |
| 610 | + } | |
| 611 | + } | |
| 612 | + } | |
| 613 | + } | |
| 614 | + | |
| 615 | + // ==== $feature ==== | |
| 616 | + | |
| 617 | + if (! empty ($feature)) | |
| 618 | + { | |
| 619 | + foreach ($feature as $string) | |
| 620 | + { | |
| 621 | + $string = str_replace([':', '.'], '', $string); | |
| 622 | + | |
| 623 | + if (! empty ($string)) | |
| 624 | + { | |
| 625 | + list ($book_title, $value_title) = explode ('*', $string); | |
| 626 | + | |
| 627 | + $book_title = trim ($book_title); | |
| 628 | + $value_title = trim ($value_title); | |
| 629 | + | |
| 630 | + if (empty ($book_title) || empty ($value_title)) | |
| 631 | + { | |
| 632 | + CONTINUE; | |
| 633 | + } | |
| 634 | + | |
| 635 | + $bookFeature = Book::find () | |
| 636 | + ->where ('book_title=:book', [ | |
| 637 | + ':book' => $book_title | |
| 638 | + ]) | |
| 639 | + ->one (); | |
| 640 | + | |
| 641 | + if (! isset ($bookFeature->book_id) || empty ($bookFeature->book_id)) | |
| 642 | + { | |
| 643 | + $db->createCommand () | |
| 644 | + ->insert (Book::tableName (), [ | |
| 645 | + 'book_title' => $book_title, | |
| 646 | + 'book_alias' => Translite::rusencode ($book_title), | |
| 647 | + ]) | |
| 648 | + ->execute (); | |
| 649 | + | |
| 650 | + $book_id = Yii::$app->db->lastInsertID; | |
| 651 | + } | |
| 652 | + else | |
| 653 | + { | |
| 654 | + $book_id = $bookFeature->book_id; | |
| 655 | + } | |
| 656 | + | |
| 657 | + $bookFeatureValue = BookValue::find () | |
| 658 | + ->where (' | |
| 659 | + book_id=:book | |
| 660 | + AND book_value_title=:value | |
| 661 | + AND book_value_alias=:alias | |
| 662 | + ', [ | |
| 663 | + ':book' => $book_id, | |
| 664 | + ':value' => $value_title, | |
| 665 | + ':alias' => Translite::rusencode ($value_title), | |
| 666 | + ] | |
| 667 | + ) | |
| 668 | + ->one(); | |
| 669 | + | |
| 670 | + if (! isset ($bookFeatureValue->book_value_id) || empty ($bookFeatureValue->book_value_id)) | |
| 671 | + { | |
| 672 | + $db->createCommand () | |
| 673 | + ->insert (BookValue::tableName (), [ | |
| 674 | + 'book_id' => $book_id, | |
| 675 | + 'book_value_title' => $value_title, | |
| 676 | + 'book_value_alias' => Translite::rusencode ($value_title), | |
| 677 | + ]) | |
| 678 | + ->execute (); | |
| 679 | + | |
| 680 | + $book_value_id = Yii::$app->db->lastInsertID; | |
| 681 | + } | |
| 682 | + else | |
| 683 | + { | |
| 684 | + $book_value_id = $bookFeatureValue->book_value_id; | |
| 685 | + } | |
| 686 | + | |
| 687 | + if (! empty ($MOD_ARRAY)) | |
| 688 | + { | |
| 689 | + foreach ($MOD_ARRAY as $id) | |
| 690 | + { | |
| 691 | + // + products_value | |
| 692 | + $db->createCommand (' | |
| 693 | + INSERT IGNORE mod_value | |
| 694 | + SET | |
| 695 | + mod_id = '.(int)$id.', | |
| 696 | + book_value_id = '.(int)$book_value_id.' | |
| 697 | + ') | |
| 698 | + ->execute (); | |
| 699 | + } | |
| 700 | + } | |
| 701 | + } | |
| 702 | + } | |
| 703 | + }*/ | |
| 704 | + | |
| 705 | + // ==== IMPORTANT ==== | |
| 706 | + | |
| 707 | + // записуем ID обработанной записи | |
| 708 | + | |
| 709 | + $_product->save(); | |
| 710 | + var_dump("$j: Product {$_product->name} saved\n"); | |
| 711 | + if ($j > 100) { | |
| 712 | + var_dump("Dev OK"); | |
| 713 | + exit; | |
| 714 | + } | |
| 715 | + } | |
| 716 | + | |
| 717 | + fclose ($handle); | |
| 718 | + } | |
| 719 | + } | |
| 720 | +} | ... | ... |
| 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 | + | |
| 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 | + 'verbs' => [ | |
| 26 | + 'class' => VerbFilter::className(), | |
| 27 | + 'actions' => [ | |
| 28 | + 'delete' => ['POST'], | |
| 29 | + ], | |
| 30 | + ], | |
| 31 | + ]; | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Lists all Slider models. | |
| 36 | + * @return mixed | |
| 37 | + */ | |
| 38 | + public function actionIndex() | |
| 39 | + { | |
| 40 | + $searchModel = new SliderSearch(); | |
| 41 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 42 | + | |
| 43 | + return $this->render('index', [ | |
| 44 | + 'searchModel' => $searchModel, | |
| 45 | + 'dataProvider' => $dataProvider, | |
| 46 | + ]); | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * Displays a single Slider model. | |
| 51 | + * @param integer $id | |
| 52 | + * @return mixed | |
| 53 | + */ | |
| 54 | + public function actionView($id) | |
| 55 | + { | |
| 56 | + return $this->render('view', [ | |
| 57 | + 'model' => $this->findModel($id), | |
| 58 | + ]); | |
| 59 | + } | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * Creates a new Slider model. | |
| 63 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 64 | + * @return mixed | |
| 65 | + */ | |
| 66 | + public function actionCreate() | |
| 67 | + { | |
| 68 | + $model = new Slider(); | |
| 69 | + | |
| 70 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 71 | + return $this->redirect(['view', 'id' => $model->slider_id]); | |
| 72 | + } else { | |
| 73 | + | |
| 74 | + | |
| 75 | + return $this->render('create', [ | |
| 76 | + 'model' => $model, | |
| 77 | + ]); | |
| 78 | + } | |
| 79 | + } | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * Updates an existing Slider model. | |
| 83 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 84 | + * @param integer $id | |
| 85 | + * @return mixed | |
| 86 | + */ | |
| 87 | + public function actionUpdate($id) | |
| 88 | + { | |
| 89 | + $model = $this->findModel($id); | |
| 90 | + | |
| 91 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 92 | + return $this->redirect(['view', 'id' => $model->slider_id]); | |
| 93 | + } else { | |
| 94 | + return $this->render('update', [ | |
| 95 | + 'model' => $model, | |
| 96 | + ]); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * Deletes an existing Slider model. | |
| 102 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 103 | + * @param integer $id | |
| 104 | + * @return mixed | |
| 105 | + */ | |
| 106 | + public function actionDelete($id) | |
| 107 | + { | |
| 108 | + $this->findModel($id)->delete(); | |
| 109 | + | |
| 110 | + return $this->redirect(['index']); | |
| 111 | + } | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * Finds the Slider model based on its primary key value. | |
| 115 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 116 | + * @param integer $id | |
| 117 | + * @return Slider the loaded model | |
| 118 | + * @throws NotFoundHttpException if the model cannot be found | |
| 119 | + */ | |
| 120 | + protected function findModel($id) | |
| 121 | + { | |
| 122 | + if (($model = Slider::findOne($id)) !== null) { | |
| 123 | + return $model; | |
| 124 | + } else { | |
| 125 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 126 | + } | |
| 127 | + } | |
| 128 | +} | ... | ... |
| 1 | +++ a/backend/controllers/SliderImageController.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\controllers; | |
| 4 | + | |
| 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 | + | |
| 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 | + 'verbs' => [ | |
| 25 | + 'class' => VerbFilter::className(), | |
| 26 | + 'actions' => [ | |
| 27 | + 'delete' => ['POST'], | |
| 28 | + ], | |
| 29 | + ], | |
| 30 | + ]; | |
| 31 | + } | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * Lists all SliderImage models. | |
| 35 | + * @param $slider_id Slider id | |
| 36 | + * @return mixed | |
| 37 | + */ | |
| 38 | + public function actionIndex($slider_id) | |
| 39 | + { | |
| 40 | + $searchModel = new SliderImageSearch(); | |
| 41 | + $dataProvider = $searchModel->search($slider_id, Yii::$app->request->queryParams); | |
| 42 | + | |
| 43 | + return $this->render('index', [ | |
| 44 | + 'slider_id' => $slider_id, | |
| 45 | + 'searchModel' => $searchModel, | |
| 46 | + 'dataProvider' => $dataProvider, | |
| 47 | + ]); | |
| 48 | + } | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * Displays a single SliderImage model. | |
| 52 | + * @param integer $id | |
| 53 | + * @param $slider_id Slider id | |
| 54 | + * @return mixed | |
| 55 | + */ | |
| 56 | + public function actionView($slider_id, $id) | |
| 57 | + { | |
| 58 | + return $this->render('view', [ | |
| 59 | + 'slider_id' => $slider_id, | |
| 60 | + 'model' => $this->findModel($slider_id, $id), | |
| 61 | + ]); | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * Creates a new SliderImage model. | |
| 66 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 67 | + * @param $slider_id Slider id | |
| 68 | + * @return mixed | |
| 69 | + */ | |
| 70 | + public function actionCreate($slider_id) | |
| 71 | + { | |
| 72 | + $model = new SliderImage(); | |
| 73 | + | |
| 74 | + if ($model->load(Yii::$app->request->post())) { | |
| 75 | + $model->slider_id = $slider_id; | |
| 76 | + $model->save(); | |
| 77 | + return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]); | |
| 78 | + } else { | |
| 79 | + | |
| 80 | + $slider = Slider::findOne($slider_id); | |
| 81 | + | |
| 82 | + return $this->render('create', [ | |
| 83 | + 'slider_id' => $slider_id, | |
| 84 | + 'model' => $model, | |
| 85 | + 'slider' => $slider, | |
| 86 | + ]); | |
| 87 | + } | |
| 88 | + } | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * Updates an existing SliderImage model. | |
| 92 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 93 | + * @param $slider_id Slider id | |
| 94 | + * @param integer $id | |
| 95 | + * @return mixed | |
| 96 | + */ | |
| 97 | + public function actionUpdate($slider_id, $id) | |
| 98 | + { | |
| 99 | + $model = $this->findModel($slider_id, $id); | |
| 100 | + | |
| 101 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 102 | + return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]); | |
| 103 | + } else { | |
| 104 | + | |
| 105 | + $slider = Slider::findOne($slider_id); | |
| 106 | + return $this->render('update', [ | |
| 107 | + 'model' => $model, | |
| 108 | + 'slider_id' => $slider_id, | |
| 109 | + 'slider' => $slider, | |
| 110 | + ]); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * Deletes an existing SliderImage model. | |
| 116 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 117 | + * @param $slider_id Slider id | |
| 118 | + * @param integer $id | |
| 119 | + * @return mixed | |
| 120 | + */ | |
| 121 | + public function actionDelete($slider_id, $id) | |
| 122 | + { | |
| 123 | + $this->findModel($slider_id, $id)->delete(); | |
| 124 | + | |
| 125 | + return $this->redirect(['index','slider_id'=>$slider_id]); | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * Finds the SliderImage model based on its primary key value. | |
| 130 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 131 | + * @param $slider_id Slider id | |
| 132 | + * @param integer $id | |
| 133 | + * @return SliderImage the loaded model | |
| 134 | + * @throws NotFoundHttpException if the model cannot be found | |
| 135 | + */ | |
| 136 | + protected function findModel($slider_id,$id) | |
| 137 | + { | |
| 138 | + if (($model = SliderImage::find()->where(['slider_image_id'=> $id, 'slider_id'=>$slider_id])->one()) !== null) { | |
| 139 | + return $model; | |
| 140 | + } else { | |
| 141 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 142 | + } | |
| 143 | + } | |
| 144 | +} | ... | ... |
| 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 | +} | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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 | + | |
| 20 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'description')->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 | + <?= ImageUploader::widget([ | |
| 35 | + 'model'=> $model, | |
| 36 | + 'field'=>'cover', | |
| 37 | + 'size' => [ | |
| 38 | + [ | |
| 39 | + 'width'=>340, | |
| 40 | + 'height'=>260, | |
| 41 | + ] | |
| 42 | + ], | |
| 43 | + 'multi'=>true, | |
| 44 | + 'gallery' =>$model->cover, | |
| 45 | + 'name' => 'Загрузить миниатюру статьи' | |
| 46 | + ]); | |
| 47 | + ?> | |
| 48 | + | |
| 49 | + <?= FieldEditor::widget([ | |
| 50 | + 'template' => 'education', | |
| 51 | + 'item_id' => $model->blog_id, | |
| 52 | + 'model' => 'common\models\Blog', | |
| 53 | + 'language' => 'ru', | |
| 54 | + ]); ?> | |
| 55 | + <div class="form-group"> | |
| 56 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 57 | + </div> | |
| 58 | + | |
| 59 | + <?php ActiveForm::end(); ?> | |
| 60 | + | |
| 61 | +</div> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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 | + | |
| 15 | + <?= $form->field($model, 'name')->textInput() ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | |
| 18 | + | |
| 19 | + <?= \common\modules\file\widgets\ImageUploader::widget([ | |
| 20 | + 'model'=> $model, | |
| 21 | + 'field'=>'image', | |
| 22 | + 'size' => [ | |
| 23 | + [ | |
| 24 | + 'width'=>102, | |
| 25 | + 'height'=>57, | |
| 26 | + ] | |
| 27 | + ], | |
| 28 | + 'multi'=>false, | |
| 29 | + 'gallery' => $model->image, | |
| 30 | + 'name' => 'Загрузить изображение' | |
| 31 | + ]); | |
| 32 | + ?> | |
| 33 | + | |
| 34 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | |
| 35 | + | |
| 36 | + <?= $form->field($model, 'meta_desc')->textarea(['rows' => 6]) ?> | |
| 37 | + | |
| 38 | + <?= $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?> | |
| 39 | + | |
| 40 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
| 41 | + | |
| 42 | + <div class="form-group"> | |
| 43 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 44 | + <?php if ($model->isNewRecord) :?> | |
| 45 | + <?= Html::submitButton(Yii::t('product', 'Create and continue'), ['name' => 'create_and_new', 'class' => 'btn btn-primary']) ?> | |
| 46 | + <?php endif?> | |
| 47 | + </div> | |
| 48 | + | |
| 49 | + <?php ActiveForm::end(); ?> | |
| 50 | + | |
| 51 | +</div> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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 | + ['class' => 'yii\grid\ActionColumn'], | |
| 31 | + ], | |
| 32 | + ]); ?> | |
| 33 | +</div> | ... | ... |
| 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> | ... | ... |
| 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 | + 'image', | |
| 35 | + 'meta_title', | |
| 36 | + 'meta_desc:ntext', | |
| 37 | + 'meta_robots', | |
| 38 | + 'seo_text:ntext', | |
| 39 | + ], | |
| 40 | + ]) ?> | |
| 41 | + | |
| 42 | +</div> | ... | ... |
| 1 | +++ a/backend/views/category/_form.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | +use common\modules\file\widgets\ImageUploader; | |
| 6 | +use kartik\select2\Select2; | |
| 7 | + | |
| 8 | +/* @var $this yii\web\View */ | |
| 9 | +/* @var $model common\modules\product\models\Category */ | |
| 10 | +/* @var $form yii\widgets\ActiveForm */ | |
| 11 | +?> | |
| 12 | + | |
| 13 | +<div class="category-form"> | |
| 14 | + | |
| 15 | + <?php $form = ActiveForm::begin(); ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'name')->textInput() ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | |
| 20 | + | |
| 21 | + <?= $form->field($model, 'parent_id')->dropDownList($categories, [ | |
| 22 | + 'prompt' => Yii::t('rubrication', 'Root category'), | |
| 23 | + 'options' => [ | |
| 24 | + $model->category_id => ['disabled' => true] | |
| 25 | + ] | |
| 26 | + ])->label(Yii::t('product', 'Parent category')) ?> | |
| 27 | + | |
| 28 | + <?php /* | |
| 29 | + <?= $form->field($model, 'group_to_category')->dropDownList( | |
| 30 | + \yii\helpers\ArrayHelper::map(\common\modules\rubrication\models\TaxGroup::find()->all(), 'tax_group_id', 'name'), [ | |
| 31 | + 'multiple' => true | |
| 32 | + ])->label(Yii::t('product', 'Linked options')) ?> | |
| 33 | + */?> | |
| 34 | + | |
| 35 | + <?= $form->field($model, 'group_to_category')->widget(Select2::className(), [ | |
| 36 | + 'data' => \yii\helpers\ArrayHelper::map(\common\modules\rubrication\models\TaxGroup::find()->all(), 'tax_group_id', 'name'), | |
| 37 | + 'language' => 'ru', | |
| 38 | + 'options' => [ | |
| 39 | + 'placeholder' => 'Linked options', | |
| 40 | + 'multiple' => true, | |
| 41 | + ], | |
| 42 | + 'pluginOptions' => [ | |
| 43 | + 'allowClear' => true | |
| 44 | + ], | |
| 45 | + ] | |
| 46 | + ) ?> | |
| 47 | + | |
| 48 | + <?= ImageUploader::widget([ | |
| 49 | + 'model'=> $model, | |
| 50 | + 'field'=>'image', | |
| 51 | + 'size' => [ | |
| 52 | + [ | |
| 53 | + 'width'=>340, | |
| 54 | + 'height'=>260, | |
| 55 | + ] | |
| 56 | + ], | |
| 57 | + 'multi'=>false, | |
| 58 | + 'gallery' => $model->image, | |
| 59 | + 'name' => 'Загрузить изображение' | |
| 60 | + ]); | |
| 61 | + ?> | |
| 62 | + | |
| 63 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | |
| 64 | + | |
| 65 | + <?= $form->field($model, 'meta_desc')->textarea(['rows' => 6]) ?> | |
| 66 | + | |
| 67 | + <?= $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?> | |
| 68 | + | |
| 69 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
| 70 | + | |
| 71 | + <?= $form->field($model, 'remote_category')->widget(Select2::className(), [ | |
| 72 | + 'data' => \yii\helpers\ArrayHelper::map(\common\modules\product\models\RemoteCategories::find()->all(), 'ID', 'Name'), | |
| 73 | + 'language' => 'ru', | |
| 74 | + 'options' => [ | |
| 75 | + 'placeholder' => 'Select a remote category', | |
| 76 | + 'multiple' => true, | |
| 77 | + ], | |
| 78 | + 'pluginOptions' => [ | |
| 79 | + 'allowClear' => true | |
| 80 | + ], | |
| 81 | + ] | |
| 82 | + ) ?> | |
| 83 | + | |
| 84 | + <?php if (!empty($model) && $model->depth == 2) :?> | |
| 85 | + <?= $form->field($model, 'populary')->checkbox() ?> | |
| 86 | + <?php endif?> | |
| 87 | + | |
| 88 | + <div class="form-group"> | |
| 89 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 90 | + <?php if ($model->isNewRecord) :?> | |
| 91 | + <?= Html::submitButton(Yii::t('product', 'Create and continue'), ['name' => 'create_and_new', 'class' => 'btn btn-primary']) ?> | |
| 92 | + <?php endif?> | |
| 93 | + </div> | |
| 94 | + | |
| 95 | + <?php ActiveForm::end(); ?> | |
| 96 | + | |
| 97 | +</div> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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(' → ', $op); | |
| 35 | +// return str_repeat('-', $data->depth) .' '. $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> | ... | ... |
| 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> | ... | ... |
| 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 | + 'image', | |
| 40 | + 'meta_title', | |
| 41 | + 'meta_desc:ntext', | |
| 42 | + 'meta_robots', | |
| 43 | + 'seo_text:ntext', | |
| 44 | + 'category_name_id', | |
| 45 | + 'product_unit_id', | |
| 46 | + 'alias', | |
| 47 | + ], | |
| 48 | + ]) ?> | |
| 49 | + | |
| 50 | +</div> | ... | ... |
| 1 | +++ a/backend/views/event/_form.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\jui\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 | + | |
| 17 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | |
| 20 | + | |
| 21 | + <?= $form->field($model, 'body')->widget(CKEditor::className(), | |
| 22 | + [ | |
| 23 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | |
| 24 | + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать | |
| 25 | + 'inline' => false, //по умолчанию false]), | |
| 26 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | |
| 27 | + ] | |
| 28 | + ) | |
| 29 | + ]) ?> | |
| 30 | + | |
| 31 | + | |
| 32 | + <?= $form->field($model, 'end_at') | |
| 33 | + ->widget(DatePicker::className(), [ | |
| 34 | + 'dateFormat' => 'yyyy-MM-dd', | |
| 35 | + 'clientOptions' => [ 'minDate' => 1 ], | |
| 36 | + ]) ?> | |
| 37 | + | |
| 38 | + | |
| 39 | + <?= \common\modules\file\widgets\ImageUploader::widget([ | |
| 40 | + 'model'=> $model, | |
| 41 | + 'field'=>'image', | |
| 42 | + 'size' => [ | |
| 43 | + [ | |
| 44 | + 'width'=>200, | |
| 45 | + 'height'=>200, | |
| 46 | + ], | |
| 47 | + [ | |
| 48 | + 'width'=>940, | |
| 49 | + 'height'=>480, | |
| 50 | + ] | |
| 51 | + ], | |
| 52 | + 'multi'=>false, | |
| 53 | + 'gallery' => $model->image, | |
| 54 | + 'name' => 'Загрузить изображение' | |
| 55 | + ]); | |
| 56 | + ?> | |
| 57 | + | |
| 58 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | |
| 59 | + | |
| 60 | + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> | |
| 61 | + | |
| 62 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> | |
| 63 | + | |
| 64 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + <div class="form-group"> | |
| 69 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 70 | + </div> | |
| 71 | + | |
| 72 | + <?php ActiveForm::end(); ?> | |
| 73 | + | |
| 74 | +</div> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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> | ... | ... |
| 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 | + 'body:ntext', | |
| 35 | + [ | |
| 36 | + 'format' => 'image', | |
| 37 | + 'attribute'=>'image', | |
| 38 | + ], | |
| 39 | + 'meta_title', | |
| 40 | + 'description', | |
| 41 | + 'h1', | |
| 42 | + 'seo_text:ntext', | |
| 43 | + 'created_at', | |
| 44 | + 'updated_at', | |
| 45 | + 'end_at', | |
| 46 | + ], | |
| 47 | + ]) ?> | |
| 48 | + | |
| 49 | +</div> | ... | ... |
| 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 | ... | ... |
| 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 | ... | ... |
| 1 | +++ a/backend/views/layouts/header.php | |
| 1 | +<header class="main-header"> | |
| 2 | + <!-- Logo --> | |
| 3 | + <a href="index2.html" class="logo"> | |
| 4 | + <!-- mini logo for sidebar mini 50x50 pixels --> | |
| 5 | + <span class="logo-mini"><b>A</b>LT</span> | |
| 6 | + <!-- logo for regular state and mobile devices --> | |
| 7 | + <span class="logo-lg"><b>Admin</b>LTE</span> | |
| 8 | + </a> | |
| 9 | + <!-- Header Navbar: style can be found in header.less --> | |
| 10 | + <nav class="navbar navbar-static-top" role="navigation"> | |
| 11 | + <!-- Sidebar toggle button--> | |
| 12 | + <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> | |
| 13 | + <span class="sr-only">Toggle navigation</span> | |
| 14 | + </a> | |
| 15 | + | |
| 16 | + <div class="navbar-custom-menu"> | |
| 17 | + <ul class="nav navbar-nav"> | |
| 18 | + <!-- Messages: style can be found in dropdown.less--> | |
| 19 | + <li class="dropdown messages-menu"> | |
| 20 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 21 | + <i class="fa fa-envelope-o"></i> | |
| 22 | + <span class="label label-success">4</span> | |
| 23 | + </a> | |
| 24 | + <ul class="dropdown-menu"> | |
| 25 | + <li class="header">You have 4 messages</li> | |
| 26 | + <li> | |
| 27 | + <!-- inner menu: contains the actual data --> | |
| 28 | + <ul class="menu"> | |
| 29 | + <li><!-- start message --> | |
| 30 | + <a href="#"> | |
| 31 | + <div class="pull-left"> | |
| 32 | + <img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> | |
| 33 | + </div> | |
| 34 | + <h4> | |
| 35 | + Support Team | |
| 36 | + <small><i class="fa fa-clock-o"></i> 5 mins</small> | |
| 37 | + </h4> | |
| 38 | + <p>Why not buy a new awesome theme?</p> | |
| 39 | + </a> | |
| 40 | + </li> | |
| 41 | + <!-- end message --> | |
| 42 | + <li> | |
| 43 | + <a href="#"> | |
| 44 | + <div class="pull-left"> | |
| 45 | + <img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image"> | |
| 46 | + </div> | |
| 47 | + <h4> | |
| 48 | + AdminLTE Design Team | |
| 49 | + <small><i class="fa fa-clock-o"></i> 2 hours</small> | |
| 50 | + </h4> | |
| 51 | + <p>Why not buy a new awesome theme?</p> | |
| 52 | + </a> | |
| 53 | + </li> | |
| 54 | + <li> | |
| 55 | + <a href="#"> | |
| 56 | + <div class="pull-left"> | |
| 57 | + <img src="dist/img/user4-128x128.jpg" class="img-circle" alt="User Image"> | |
| 58 | + </div> | |
| 59 | + <h4> | |
| 60 | + Developers | |
| 61 | + <small><i class="fa fa-clock-o"></i> Today</small> | |
| 62 | + </h4> | |
| 63 | + <p>Why not buy a new awesome theme?</p> | |
| 64 | + </a> | |
| 65 | + </li> | |
| 66 | + <li> | |
| 67 | + <a href="#"> | |
| 68 | + <div class="pull-left"> | |
| 69 | + <img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image"> | |
| 70 | + </div> | |
| 71 | + <h4> | |
| 72 | + Sales Department | |
| 73 | + <small><i class="fa fa-clock-o"></i> Yesterday</small> | |
| 74 | + </h4> | |
| 75 | + <p>Why not buy a new awesome theme?</p> | |
| 76 | + </a> | |
| 77 | + </li> | |
| 78 | + <li> | |
| 79 | + <a href="#"> | |
| 80 | + <div class="pull-left"> | |
| 81 | + <img src="dist/img/user4-128x128.jpg" class="img-circle" alt="User Image"> | |
| 82 | + </div> | |
| 83 | + <h4> | |
| 84 | + Reviewers | |
| 85 | + <small><i class="fa fa-clock-o"></i> 2 days</small> | |
| 86 | + </h4> | |
| 87 | + <p>Why not buy a new awesome theme?</p> | |
| 88 | + </a> | |
| 89 | + </li> | |
| 90 | + </ul> | |
| 91 | + </li> | |
| 92 | + <li class="footer"><a href="#">See All Messages</a></li> | |
| 93 | + </ul> | |
| 94 | + </li> | |
| 95 | + <!-- Notifications: style can be found in dropdown.less --> | |
| 96 | + <li class="dropdown notifications-menu"> | |
| 97 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 98 | + <i class="fa fa-bell-o"></i> | |
| 99 | + <span class="label label-warning">10</span> | |
| 100 | + </a> | |
| 101 | + <ul class="dropdown-menu"> | |
| 102 | + <li class="header">You have 10 notifications</li> | |
| 103 | + <li> | |
| 104 | + <!-- inner menu: contains the actual data --> | |
| 105 | + <ul class="menu"> | |
| 106 | + <li> | |
| 107 | + <a href="#"> | |
| 108 | + <i class="fa fa-users text-aqua"></i> 5 new members joined today | |
| 109 | + </a> | |
| 110 | + </li> | |
| 111 | + <li> | |
| 112 | + <a href="#"> | |
| 113 | + <i class="fa fa-warning text-yellow"></i> Very long description here that may not fit into the | |
| 114 | + page and may cause design problems | |
| 115 | + </a> | |
| 116 | + </li> | |
| 117 | + <li> | |
| 118 | + <a href="#"> | |
| 119 | + <i class="fa fa-users text-red"></i> 5 new members joined | |
| 120 | + </a> | |
| 121 | + </li> | |
| 122 | + <li> | |
| 123 | + <a href="#"> | |
| 124 | + <i class="fa fa-shopping-cart text-green"></i> 25 sales made | |
| 125 | + </a> | |
| 126 | + </li> | |
| 127 | + <li> | |
| 128 | + <a href="#"> | |
| 129 | + <i class="fa fa-user text-red"></i> You changed your username | |
| 130 | + </a> | |
| 131 | + </li> | |
| 132 | + </ul> | |
| 133 | + </li> | |
| 134 | + <li class="footer"><a href="#">View all</a></li> | |
| 135 | + </ul> | |
| 136 | + </li> | |
| 137 | + <!-- Tasks: style can be found in dropdown.less --> | |
| 138 | + <li class="dropdown tasks-menu"> | |
| 139 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 140 | + <i class="fa fa-flag-o"></i> | |
| 141 | + <span class="label label-danger">9</span> | |
| 142 | + </a> | |
| 143 | + <ul class="dropdown-menu"> | |
| 144 | + <li class="header">You have 9 tasks</li> | |
| 145 | + <li> | |
| 146 | + <!-- inner menu: contains the actual data --> | |
| 147 | + <ul class="menu"> | |
| 148 | + <li><!-- Task item --> | |
| 149 | + <a href="#"> | |
| 150 | + <h3> | |
| 151 | + Design some buttons | |
| 152 | + <small class="pull-right">20%</small> | |
| 153 | + </h3> | |
| 154 | + <div class="progress xs"> | |
| 155 | + <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> | |
| 156 | + <span class="sr-only">20% Complete</span> | |
| 157 | + </div> | |
| 158 | + </div> | |
| 159 | + </a> | |
| 160 | + </li> | |
| 161 | + <!-- end task item --> | |
| 162 | + <li><!-- Task item --> | |
| 163 | + <a href="#"> | |
| 164 | + <h3> | |
| 165 | + Create a nice theme | |
| 166 | + <small class="pull-right">40%</small> | |
| 167 | + </h3> | |
| 168 | + <div class="progress xs"> | |
| 169 | + <div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> | |
| 170 | + <span class="sr-only">40% Complete</span> | |
| 171 | + </div> | |
| 172 | + </div> | |
| 173 | + </a> | |
| 174 | + </li> | |
| 175 | + <!-- end task item --> | |
| 176 | + <li><!-- Task item --> | |
| 177 | + <a href="#"> | |
| 178 | + <h3> | |
| 179 | + Some task I need to do | |
| 180 | + <small class="pull-right">60%</small> | |
| 181 | + </h3> | |
| 182 | + <div class="progress xs"> | |
| 183 | + <div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> | |
| 184 | + <span class="sr-only">60% Complete</span> | |
| 185 | + </div> | |
| 186 | + </div> | |
| 187 | + </a> | |
| 188 | + </li> | |
| 189 | + <!-- end task item --> | |
| 190 | + <li><!-- Task item --> | |
| 191 | + <a href="#"> | |
| 192 | + <h3> | |
| 193 | + Make beautiful transitions | |
| 194 | + <small class="pull-right">80%</small> | |
| 195 | + </h3> | |
| 196 | + <div class="progress xs"> | |
| 197 | + <div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> | |
| 198 | + <span class="sr-only">80% Complete</span> | |
| 199 | + </div> | |
| 200 | + </div> | |
| 201 | + </a> | |
| 202 | + </li> | |
| 203 | + <!-- end task item --> | |
| 204 | + </ul> | |
| 205 | + </li> | |
| 206 | + <li class="footer"> | |
| 207 | + <a href="#">View all tasks</a> | |
| 208 | + </li> | |
| 209 | + </ul> | |
| 210 | + </li> | |
| 211 | + <!-- User Account: style can be found in dropdown.less --> | |
| 212 | + <li class="dropdown user user-menu"> | |
| 213 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 214 | + <!--img src="dist/img/user2-160x160.jpg" class="user-image" alt="User Image"--> | |
| 215 | + <span class="hidden-xs">Alexander Pierce</span> | |
| 216 | + </a> | |
| 217 | + <ul class="dropdown-menu"> | |
| 218 | + <!-- User image --> | |
| 219 | + <li class="user-header"> | |
| 220 | + <img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> | |
| 221 | + | |
| 222 | + <p> | |
| 223 | + Alexander Pierce - Web Developer | |
| 224 | + <small>Member since Nov. 2012</small> | |
| 225 | + </p> | |
| 226 | + </li> | |
| 227 | + <!-- Menu Body --> | |
| 228 | + <li class="user-body"> | |
| 229 | + <div class="row"> | |
| 230 | + <div class="col-xs-4 text-center"> | |
| 231 | + <a href="#">Followers</a> | |
| 232 | + </div> | |
| 233 | + <div class="col-xs-4 text-center"> | |
| 234 | + <a href="#">Sales</a> | |
| 235 | + </div> | |
| 236 | + <div class="col-xs-4 text-center"> | |
| 237 | + <a href="#">Friends</a> | |
| 238 | + </div> | |
| 239 | + </div> | |
| 240 | + <!-- /.row --> | |
| 241 | + </li> | |
| 242 | + <!-- Menu Footer--> | |
| 243 | + <li class="user-footer"> | |
| 244 | + <div class="pull-left"> | |
| 245 | + <a href="#" class="btn btn-default btn-flat">Profile</a> | |
| 246 | + </div> | |
| 247 | + <div class="pull-right"> | |
| 248 | + <a href="#" class="btn btn-default btn-flat">Sign out</a> | |
| 249 | + </div> | |
| 250 | + </li> | |
| 251 | + </ul> | |
| 252 | + </li> | |
| 253 | + <!-- Control Sidebar Toggle Button --> | |
| 254 | + <li> | |
| 255 | + <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a> | |
| 256 | + </li> | |
| 257 | + </ul> | |
| 258 | + </div> | |
| 259 | + </nav> | |
| 260 | +</header> | |
| 0 | 261 | \ No newline at end of file | ... | ... |
| 1 | +++ a/backend/views/layouts/main-sidebar.php | |
| 1 | +<?php | |
| 2 | +use yii\widgets\Menu; | |
| 3 | +?> | |
| 4 | +<aside class="main-sidebar"> | |
| 5 | + <!-- sidebar: style can be found in sidebar.less --> | |
| 6 | + <section class="sidebar"> | |
| 7 | + <!-- Sidebar user panel --> | |
| 8 | + <!-- search form --> | |
| 9 | + <form action="#" method="get" class="sidebar-form"> | |
| 10 | + <div class="input-group"> | |
| 11 | + <input type="text" name="q" class="form-control" placeholder="Search..."> | |
| 12 | + <span class="input-group-btn"> | |
| 13 | + <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i> | |
| 14 | + </button> | |
| 15 | + </span> | |
| 16 | + </div> | |
| 17 | + </form> | |
| 18 | + <!-- /.search form --> | |
| 19 | + <?= | |
| 20 | + Menu::widget([ | |
| 21 | + 'options' => ['class' => 'sidebar-menu'], | |
| 22 | + 'submenuTemplate' => "\n<ul class='treeview-menu'>\n{items}\n</ul>\n", | |
| 23 | + | |
| 24 | + 'items' => [ | |
| 25 | + ['label' => 'MAIN NAVIGATION', 'options'=>['class'=>'header']], | |
| 26 | + ['label' => 'Заказы', 'url' => ['/orders/index'], 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-shopping-cart"></i> <span>{label}</span></a>'], | |
| 27 | + [ | |
| 28 | + 'label' => 'Products', | |
| 29 | + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-barcode"></i> <span>{label}</span></a>', | |
| 30 | + 'url' => ['/product/manage'], | |
| 31 | + 'items' => [ | |
| 32 | + ['label' => 'Товары', 'url' => ['/product/manage']], | |
| 33 | + ['label' => 'Импорт товаров', 'url' => ['/product/manage/import']], | |
| 34 | + ['label' => 'Категории', 'url' => ['/category']], | |
| 35 | + ['label' => 'Бренды', 'url' => ['/brand']], | |
| 36 | + ] | |
| 37 | + ], | |
| 38 | + [ | |
| 39 | + 'label' => 'Слайдер/Банеры', | |
| 40 | + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-barcode"></i> <span>{label}</span></a>', | |
| 41 | + 'items' => [ | |
| 42 | + ['label' => 'Слайдер', 'url' => ['/slider/index']], | |
| 43 | + ['label' => 'Банер', 'url' => ['/banner/index']], | |
| 44 | + ] | |
| 45 | + ], | |
| 46 | + [ | |
| 47 | + 'label' => 'Характеристики', | |
| 48 | + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>', | |
| 49 | + 'url' => ['/rubrication/tax-group'], | |
| 50 | + 'items' => [ | |
| 51 | + ['label' => 'Характеристики', 'url' => ['/rubrication/tax-group']], | |
| 52 | + ['label' => 'Зависимости', 'url' => ['/relation/manage']] | |
| 53 | + ] | |
| 54 | + ], | |
| 55 | + ['label' => 'Статические страницы', 'url' => ['/page/index']], | |
| 56 | + ['label' => 'Акции', 'url' => ['/event/index']], | |
| 57 | + ['label' => 'Услуги', 'url' => ['/service/index']], | |
| 58 | + [ | |
| 59 | + 'label' => 'SEO', | |
| 60 | + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>', | |
| 61 | + 'items' => [ | |
| 62 | + ['label' => 'URL', 'url' => ['/seo/index']], | |
| 63 | + ['label' => 'Шаблоны', 'url' => ['/seo-category/index']] | |
| 64 | + ] | |
| 65 | + ], | |
| 66 | +// ['label' => 'Rubrication', 'url' => ['/rubrication/tax-group']], | |
| 67 | +// ['label' => 'Relation', 'url' => ['/relation/manage']], | |
| 68 | + ], | |
| 69 | + | |
| 70 | + ]); | |
| 71 | + ?> | |
| 72 | + <!-- sidebar menu: : style can be found in sidebar.less --> | |
| 73 | + | |
| 74 | + </section> | |
| 75 | + <!-- /.sidebar --> | |
| 76 | +</aside> | |
| 0 | 77 | \ No newline at end of file | ... | ... |
| 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() ?> | ... | ... |
| 1 | +++ a/backend/views/orders/_form.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use common\models\OrderItems; | |
| 4 | +use yii\helpers\Html; | |
| 5 | +use yii\widgets\ActiveForm; | |
| 6 | +use kartik\date\DatePicker; | |
| 7 | +use unclead\widgets\MultipleInput; | |
| 8 | +use unclead\widgets\MultipleInputColumn; | |
| 9 | +/* @var $this yii\web\View */ | |
| 10 | +/* @var $model common\models\Orders */ | |
| 11 | +/* @var $form yii\widgets\ActiveForm */ | |
| 12 | +?> | |
| 13 | + | |
| 14 | +<div class="orders-form"> | |
| 15 | + | |
| 16 | + <?php $form = ActiveForm::begin(); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?> | |
| 23 | + | |
| 24 | + <?php | |
| 25 | + | |
| 26 | + | |
| 27 | + echo $form->field($model, 'delivery', [ | |
| 28 | + ])->radioList([ | |
| 29 | + '1' => 'Курьерска доставка по Киеву и области', | |
| 30 | + '2' => 'В любой регион Украины', | |
| 31 | + '3' => 'Самовывоз (бесплатно)', | |
| 32 | + ], [ | |
| 33 | + 'item' => function($index, $label, $name, $checked, $value) { | |
| 34 | + | |
| 35 | + $return = '<div><label class="modal-radio">'; | |
| 36 | + $return .= Html::radio($name, $checked, ['value' => $value]); | |
| 37 | + $return .= '<i></i>'; | |
| 38 | + $return .= '<span>' . ucwords($label) . '</span>'; | |
| 39 | + $return .= '</label></div>'; | |
| 40 | + | |
| 41 | + return $return; | |
| 42 | + }, | |
| 43 | + ]); | |
| 44 | + | |
| 45 | + | |
| 46 | + ?> | |
| 47 | + | |
| 48 | + <?php | |
| 49 | + | |
| 50 | + | |
| 51 | + echo $form->field($model, 'payment', [ | |
| 52 | + ])->radioList([ | |
| 53 | + '1' => 'Оплата наличными', | |
| 54 | + '2' => 'Оплата по безналичному расчету. Код ЕГРПОУ', | |
| 55 | + '3' => 'Приват 24', | |
| 56 | + '4' => 'Согласовать с менеджером', | |
| 57 | + ], [ | |
| 58 | + 'item' => function ($index, $label, $name, $checked, $value) use ($model) { | |
| 59 | + if($index != 1){ | |
| 60 | + | |
| 61 | + $return = '<div><label class="modal-radio">'; | |
| 62 | + $return .= Html::radio($name, $checked, ['value' => $value]); | |
| 63 | + $return .= '<i></i>'; | |
| 64 | + $return .= '<span>' . ucwords($label) . '</span>'; | |
| 65 | + $return .= '</label></div>'; | |
| 66 | + | |
| 67 | + return $return; | |
| 68 | + } else { | |
| 69 | + | |
| 70 | + $return = '<div><label class="modal-radio">'; | |
| 71 | + $return .= Html::radio($name, $checked, ['value' => $value]); | |
| 72 | + $return .= '<i></i>'; | |
| 73 | + $return .= '<span>' . ucwords($label) . '</span>'; | |
| 74 | + $return .= Html::activeTextInput($model,'code'); | |
| 75 | + $return .= '</label></div>'; | |
| 76 | + | |
| 77 | + return $return; | |
| 78 | + } | |
| 79 | + | |
| 80 | + }, | |
| 81 | + ]); | |
| 82 | + | |
| 83 | + | |
| 84 | + ?> | |
| 85 | + | |
| 86 | + <?= $form->field($model, 'status')->textInput() ?> | |
| 87 | + | |
| 88 | + <?= $form->field($model, 'created')->widget(DatePicker::classname(), [ | |
| 89 | + 'language' => 'ru', | |
| 90 | + 'pluginOptions' => [ | |
| 91 | + 'format'=> 'yyyy-mm-d' | |
| 92 | + | |
| 93 | + ], | |
| 94 | + | |
| 95 | + ]) ?> | |
| 96 | + <?= $form->field($model, 'updated')->widget(DatePicker::classname(), [ | |
| 97 | + 'language' => 'ru', | |
| 98 | + 'pluginOptions' => [ | |
| 99 | + 'format'=> 'yyyy-mm-d' | |
| 100 | + | |
| 101 | + ], | |
| 102 | + | |
| 103 | + ]) ?> | |
| 104 | + | |
| 105 | + <?= $form->field($model, 'orderItems')->widget(MultipleInput::className(), [ | |
| 106 | + 'columns' => [ | |
| 107 | + [ | |
| 108 | + 'name' => 'order_items_id', | |
| 109 | + 'type' => MultipleInputColumn::TYPE_HIDDEN_INPUT, | |
| 110 | + ], | |
| 111 | + [ | |
| 112 | + 'name' => 'item_id', | |
| 113 | + 'type' => MultipleInputColumn::TYPE_TEXT_INPUT, | |
| 114 | + 'title' => 'item id', | |
| 115 | + ], | |
| 116 | + [ | |
| 117 | + 'name' => 'item_name', | |
| 118 | + 'type' => MultipleInputColumn::TYPE_TEXT_INPUT, | |
| 119 | + 'title' => 'name', | |
| 120 | + 'value' => function($data){ | |
| 121 | + if($data instanceof OrderItems){ | |
| 122 | + return $data->item->product->name .' '. $data->item->name; | |
| 123 | + } | |
| 124 | + }, | |
| 125 | + ], | |
| 126 | + [ | |
| 127 | + 'name' => 'item_count', | |
| 128 | + 'type' => MultipleInputColumn::TYPE_TEXT_INPUT, | |
| 129 | + 'title' => 'item count', | |
| 130 | + ], | |
| 131 | + [ | |
| 132 | + 'name' => 'price', | |
| 133 | + 'type' => MultipleInputColumn::TYPE_TEXT_INPUT, | |
| 134 | + 'title' => 'Price', | |
| 135 | + ], | |
| 136 | + ], | |
| 137 | + ]); | |
| 138 | + ?> | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + <div class="form-group"> | |
| 143 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 144 | + </div> | |
| 145 | + | |
| 146 | + <?php ActiveForm::end(); ?> | |
| 147 | + | |
| 148 | +</div> | ... | ... |
| 1 | +++ a/backend/views/orders/_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\OrdersSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="orders-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'order_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'name') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'email') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'phone') ?> | |
| 25 | + | |
| 26 | + <?php // echo $form->field($model, 'delivery') ?> | |
| 27 | + | |
| 28 | + <?php // echo $form->field($model, 'payment') ?> | |
| 29 | + | |
| 30 | + <?php // echo $form->field($model, 'code') ?> | |
| 31 | + | |
| 32 | + <?php // echo $form->field($model, 'status') ?> | |
| 33 | + | |
| 34 | + <?php // echo $form->field($model, 'created_at') ?> | |
| 35 | + | |
| 36 | + <?php // echo $form->field($model, 'updated_at') ?> | |
| 37 | + | |
| 38 | + <div class="form-group"> | |
| 39 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 40 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 41 | + </div> | |
| 42 | + | |
| 43 | + <?php ActiveForm::end(); ?> | |
| 44 | + | |
| 45 | +</div> | ... | ... |
| 1 | +++ a/backend/views/orders/create.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\Orders */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create Orders'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="orders-create"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +++ a/backend/views/orders/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\OrdersSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + | |
| 10 | +$this->title = Yii::t('app', 'Orders'); | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="orders-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 Orders'), ['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 | + 'order_id', | |
| 28 | + 'name', | |
| 29 | + 'email:email', | |
| 30 | + 'phone', | |
| 31 | + // 'delivery', | |
| 32 | + // 'payment', | |
| 33 | + // 'code', | |
| 34 | + // 'status', | |
| 35 | + // 'created_at', | |
| 36 | + // 'updated_at', | |
| 37 | + | |
| 38 | + ['class' => 'yii\grid\ActionColumn'], | |
| 39 | + ], | |
| 40 | + ]); ?> | |
| 41 | +</div> | ... | ... |
| 1 | +++ a/backend/views/orders/update.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model common\models\Orders */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Orders', | |
| 10 | +]) . ' ' . $model->name; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->order_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 14 | +?> | |
| 15 | +<div class="orders-update"> | |
| 16 | + | |
| 17 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 18 | + | |
| 19 | + <?= $this->render('_form', [ | |
| 20 | + 'model' => $model, | |
| 21 | + ]) ?> | |
| 22 | + | |
| 23 | +</div> | ... | ... |
| 1 | +++ a/backend/views/orders/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\Orders */ | |
| 8 | + | |
| 9 | +$this->title = $model->name; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="orders-view"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->order_id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->order_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 | + 'order_id', | |
| 32 | + 'name', | |
| 33 | + 'email:email', | |
| 34 | + 'phone', | |
| 35 | + 'delivery', | |
| 36 | + 'payment', | |
| 37 | + 'code', | |
| 38 | + 'status', | |
| 39 | + 'created_at', | |
| 40 | + 'updated_at', | |
| 41 | + ], | |
| 42 | + ]) ?> | |
| 43 | + | |
| 44 | +</div> | ... | ... |
| 1 | +++ a/backend/views/page/_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 | +/* @var $this yii\web\View */ | |
| 8 | +/* @var $model backend\models\Page */ | |
| 9 | +/* @var $form yii\widgets\ActiveForm */ | |
| 10 | +?> | |
| 11 | + | |
| 12 | +<div class="page-form"> | |
| 13 | + | |
| 14 | + <?php $form = ActiveForm::begin(); ?> | |
| 15 | + | |
| 16 | + <?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => 250]) ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'title')->textInput(['maxlength' => 250]) ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'body')->widget(CKEditor::className(), | |
| 23 | + [ | |
| 24 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | |
| 25 | + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать | |
| 26 | + 'inline' => false, //по умолчанию false]), | |
| 27 | + 'allowedContent' => true, | |
| 28 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | |
| 29 | + ] | |
| 30 | + ) | |
| 31 | + ]) ?> | |
| 32 | + | |
| 33 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => 250]) ?> | |
| 34 | + | |
| 35 | + <?= $form->field($model, 'description')->textInput(['maxlength' => 250]) ?> | |
| 36 | + | |
| 37 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => 255]) ?> | |
| 38 | + | |
| 39 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
| 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> | ... | ... |
| 1 | +++ a/backend/views/page/_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\PageSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="page-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, 'name') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'alias') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'title') ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'body') ?> | |
| 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 | + <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> | ... | ... |
| 1 | +++ a/backend/views/page/create.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\Page */ | |
| 8 | + | |
| 9 | +$this->title = 'Create Page'; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="page-create"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +++ a/backend/views/page/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 backend\models\PageSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + | |
| 10 | +$this->title = 'Статические страницы'; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="page-index"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 17 | + | |
| 18 | + <p> | |
| 19 | + <?= Html::a('Создать', ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | + </p> | |
| 21 | + | |
| 22 | + <?= GridView::widget([ | |
| 23 | + 'dataProvider' => $dataProvider, | |
| 24 | + 'filterModel' => $searchModel, | |
| 25 | + 'columns' => [ | |
| 26 | + ['class' => 'yii\grid\SerialColumn'], | |
| 27 | + | |
| 28 | + 'id', | |
| 29 | + 'name', | |
| 30 | + 'alias', | |
| 31 | + 'title', | |
| 32 | + // 'meta_title', | |
| 33 | + // 'description', | |
| 34 | + // 'h1', | |
| 35 | + // 'seo_text:ntext', | |
| 36 | + | |
| 37 | + ['class' => 'yii\grid\ActionColumn'], | |
| 38 | + ], | |
| 39 | + ]); ?> | |
| 40 | + | |
| 41 | +</div> | ... | ... |
| 1 | +++ a/backend/views/page/update.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model backend\models\Page */ | |
| 7 | + | |
| 8 | +$this->title = 'Update Page: ' . ' ' . $model->name; | |
| 9 | +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; | |
| 11 | +$this->params['breadcrumbs'][] = 'Обновление'; | |
| 12 | +?> | |
| 13 | +<div class="page-update"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +++ a/backend/views/page/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 backend\models\Page */ | |
| 8 | + | |
| 9 | +$this->title = $model->name; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="page-view"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + <?= Html::a('Обновить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?=Html::a('Удалить', ['delete', 'id' => $model->id], [ | |
| 20 | + 'class' => 'btn btn-danger', | |
| 21 | + 'data' => [ | |
| 22 | + 'confirm' => 'Вы уверены что хотите удалить этот элемент?', | |
| 23 | + 'method' => 'post', | |
| 24 | + ], | |
| 25 | + ]) ?> | |
| 26 | + </p> | |
| 27 | + | |
| 28 | + <?= DetailView::widget([ | |
| 29 | + 'model' => $model, | |
| 30 | + 'attributes' => [ | |
| 31 | + 'id', | |
| 32 | + 'name', | |
| 33 | + 'alias', | |
| 34 | + 'title', | |
| 35 | + 'meta_title', | |
| 36 | + 'description', | |
| 37 | + 'h1', | |
| 38 | + 'seo_text:ntext', | |
| 39 | + ], | |
| 40 | + ]) ?> | |
| 41 | + | |
| 42 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-category/_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\SeoCategory */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="seo-category-form"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin(); ?> | |
| 14 | + | |
| 15 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'controller')->textInput(['maxlength' => true]) ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'status')->textInput() ?> | |
| 20 | + | |
| 21 | + <div class="form-group"> | |
| 22 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 23 | + </div> | |
| 24 | + | |
| 25 | + <?php ActiveForm::end(); ?> | |
| 26 | + | |
| 27 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-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\models\SeoCategorySearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="seo-category-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'seo_category_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'name') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'controller') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'status') ?> | |
| 25 | + | |
| 26 | + <div class="form-group"> | |
| 27 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 28 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 29 | + </div> | |
| 30 | + | |
| 31 | + <?php ActiveForm::end(); ?> | |
| 32 | + | |
| 33 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-category/create.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\SeoCategory */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create Seo Category'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Categories'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="seo-category-create"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-category/index.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\grid\GridView; | |
| 5 | +use yii\helpers\Url; | |
| 6 | + | |
| 7 | +/* @var $this yii\web\View */ | |
| 8 | +/* @var $searchModel common\models\SeoCategorySearch */ | |
| 9 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 10 | + | |
| 11 | +$this->title = Yii::t('app', 'Seo Categories'); | |
| 12 | +$this->params['breadcrumbs'][] = $this->title; | |
| 13 | +?> | |
| 14 | +<div class="seo-category-index"> | |
| 15 | + | |
| 16 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 18 | + | |
| 19 | + <p> | |
| 20 | + <?= Html::a(Yii::t('app', 'Create Seo Category'), ['create'], ['class' => 'btn btn-success']) ?> | |
| 21 | + </p> | |
| 22 | + <?= GridView::widget([ | |
| 23 | + 'dataProvider' => $dataProvider, | |
| 24 | + 'filterModel' => $searchModel, | |
| 25 | + 'columns' => [ | |
| 26 | + ['class' => 'yii\grid\SerialColumn'], | |
| 27 | + | |
| 28 | + 'seo_category_id', | |
| 29 | + 'name', | |
| 30 | + 'controller', | |
| 31 | + 'status', | |
| 32 | + | |
| 33 | + [ | |
| 34 | + 'class' => 'yii\grid\ActionColumn', | |
| 35 | + 'template' => '{update} {image} {delete}', | |
| 36 | + 'buttons' => [ | |
| 37 | + 'update' => function ($url, $model) | |
| 38 | + { | |
| 39 | + return Html::a ( | |
| 40 | + '<span class="glyphicon glyphicon-pencil"></span>', | |
| 41 | + Url::toRoute(['seo-category/update', 'id' => $model->seo_category_id]), | |
| 42 | + [ | |
| 43 | + 'title' => "Редактировать", | |
| 44 | + ] | |
| 45 | + ); | |
| 46 | + }, | |
| 47 | + 'image' => function ($url, $model) | |
| 48 | + { | |
| 49 | + return Html::a ( | |
| 50 | + '<span class="glyphicon glyphicon-picture"></span>', | |
| 51 | + Url::toRoute(['seo-dynamic/index', 'seo_category_id' => $model->seo_category_id]), | |
| 52 | + [ | |
| 53 | + 'title' => "слайды", | |
| 54 | + ] | |
| 55 | + ); | |
| 56 | + }, | |
| 57 | + 'delete' => function ($url, $model) | |
| 58 | + { | |
| 59 | + return Html::a ( | |
| 60 | + '<span class="glyphicon glyphicon-trash"></span>', | |
| 61 | + Url::toRoute(['seo-category/delete', 'id' => $model->seo_category_id]), | |
| 62 | + [ | |
| 63 | + 'title' => "Удалить", | |
| 64 | + ] | |
| 65 | + ); | |
| 66 | + }, | |
| 67 | + ], | |
| 68 | + 'contentOptions' => ['style' => 'width: 70px;'], | |
| 69 | + ], | |
| 70 | + ], | |
| 71 | + ]); ?> | |
| 72 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-category/update.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model common\models\SeoCategory */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Seo Category', | |
| 10 | +]) . $model->name; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Categories'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->seo_category_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 14 | +?> | |
| 15 | +<div class="seo-category-update"> | |
| 16 | + | |
| 17 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 18 | + | |
| 19 | + <?= $this->render('_form', [ | |
| 20 | + 'model' => $model, | |
| 21 | + ]) ?> | |
| 22 | + | |
| 23 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-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\models\SeoCategory */ | |
| 8 | + | |
| 9 | +$this->title = $model->name; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Categories'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="seo-category-view"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_category_id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_category_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 | + 'seo_category_id', | |
| 32 | + 'name', | |
| 33 | + 'controller', | |
| 34 | + 'status', | |
| 35 | + ], | |
| 36 | + ]) ?> | |
| 37 | + | |
| 38 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-dynamic/_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\SeoDynamic */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="seo-dynamic-form"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin(); ?> | |
| 14 | + | |
| 15 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'action')->textInput(['maxlength' => true]) ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'param')->textInput(['maxlength' => true]) ?> | |
| 20 | + | |
| 21 | + <?= $form->field($model, 'key')->textInput(['maxlength' => true]) ?> | |
| 22 | + | |
| 23 | + <?= $form->field($model, 'fields')->textInput(['maxlength' => true]) ?> | |
| 24 | + | |
| 25 | + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> | |
| 26 | + | |
| 27 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> | |
| 28 | + | |
| 29 | + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> | |
| 30 | + | |
| 31 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
| 32 | + | |
| 33 | + <?= $form->field($model, 'status')->textInput() ?> | |
| 34 | + | |
| 35 | + <div class="form-group"> | |
| 36 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 37 | + </div> | |
| 38 | + | |
| 39 | + <?php ActiveForm::end(); ?> | |
| 40 | + | |
| 41 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-dynamic/_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\SeoDynamicSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="seo-dynamic-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'seo_dynamic_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'seo_category_id') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'name') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'action') ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'fields') ?> | |
| 27 | + | |
| 28 | + <?php // echo $form->field($model, 'title') ?> | |
| 29 | + | |
| 30 | + <?php // echo $form->field($model, 'h1') ?> | |
| 31 | + | |
| 32 | + <?php // echo $form->field($model, 'description') ?> | |
| 33 | + | |
| 34 | + <?php // echo $form->field($model, 'seo_text') ?> | |
| 35 | + | |
| 36 | + <?php // echo $form->field($model, 'status') ?> | |
| 37 | + | |
| 38 | + <div class="form-group"> | |
| 39 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 40 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 41 | + </div> | |
| 42 | + | |
| 43 | + <?php ActiveForm::end(); ?> | |
| 44 | + | |
| 45 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-dynamic/create.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\helpers\Url; | |
| 5 | + | |
| 6 | + | |
| 7 | +/* @var $this yii\web\View */ | |
| 8 | +/* @var $model common\models\SeoDynamic */ | |
| 9 | + | |
| 10 | +$this->title = Yii::t('app', 'Create Seo Dynamic'); | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Dynamics'), 'url' => Url::toRoute(['index','seo_category_id'=>$seo_category_id])]; | |
| 12 | +$this->params['breadcrumbs'][] = $this->title; | |
| 13 | +?> | |
| 14 | +<div class="seo-dynamic-create"> | |
| 15 | + | |
| 16 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 17 | + | |
| 18 | + <?= $this->render('_form', [ | |
| 19 | + 'model' => $model, | |
| 20 | + ]) ?> | |
| 21 | + | |
| 22 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-dynamic/index.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\grid\GridView; | |
| 5 | +use yii\helpers\Url; | |
| 6 | + | |
| 7 | +/* @var $this yii\web\View */ | |
| 8 | +/* @var $searchModel common\models\SeoDynamicSearch */ | |
| 9 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 10 | + | |
| 11 | +$this->title = Yii::t('app', 'Seo Dynamics'); | |
| 12 | +$this->params['breadcrumbs'][] = $this->title; | |
| 13 | +?> | |
| 14 | +<div class="seo-dynamic-index"> | |
| 15 | + | |
| 16 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 18 | + | |
| 19 | + <p> | |
| 20 | + <?= Html::a(Yii::t('app', 'Create Seo Dynamic'), Url::toRoute(['create','seo_category_id'=>$seo_category_id]), ['class' => 'btn btn-success']) ?> | |
| 21 | + </p> | |
| 22 | + <?= GridView::widget([ | |
| 23 | + 'dataProvider' => $dataProvider, | |
| 24 | + 'filterModel' => $searchModel, | |
| 25 | + 'columns' => [ | |
| 26 | + ['class' => 'yii\grid\SerialColumn'], | |
| 27 | + | |
| 28 | + 'seo_dynamic_id', | |
| 29 | + 'seo_category_id', | |
| 30 | + 'name', | |
| 31 | + 'action', | |
| 32 | + 'fields', | |
| 33 | + // 'title', | |
| 34 | + // 'h1', | |
| 35 | + // 'description', | |
| 36 | + // 'seo_text:ntext', | |
| 37 | + // 'status', | |
| 38 | + | |
| 39 | + [ | |
| 40 | + 'class' => 'yii\grid\ActionColumn', | |
| 41 | + 'buttons' => [ | |
| 42 | + 'view' => function ($url, $model) | |
| 43 | + { | |
| 44 | + return Html::a ( | |
| 45 | + '<span class="glyphicon glyphicon-eye-open"></span>', | |
| 46 | + Url::toRoute(['view','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]), | |
| 47 | + [ | |
| 48 | + 'title' => "Просмотр", | |
| 49 | + ] | |
| 50 | + ); | |
| 51 | + }, | |
| 52 | + 'update' => function ($url, $model) | |
| 53 | + { | |
| 54 | + return Html::a ( | |
| 55 | + '<span class="glyphicon glyphicon-pencil"></span>', | |
| 56 | + Url::toRoute(['update','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]), | |
| 57 | + [ | |
| 58 | + 'title' => "Редактировать", | |
| 59 | + ] | |
| 60 | + ); | |
| 61 | + }, | |
| 62 | + 'delete' => function ($url, $model) | |
| 63 | + { | |
| 64 | + | |
| 65 | + return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::toRoute(['delete','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]), [ | |
| 66 | + 'title' => Yii::t('yii', 'Delete'), | |
| 67 | + 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), | |
| 68 | + 'data-method' => 'post', | |
| 69 | + ]); | |
| 70 | + | |
| 71 | + }, | |
| 72 | + ], | |
| 73 | + ], | |
| 74 | + ], | |
| 75 | + ]); ?> | |
| 76 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-dynamic/update.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\helpers\Url; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\SeoDynamic */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 10 | + 'modelClass' => 'Seo Dynamic', | |
| 11 | +]) . $model->name; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Dynamics'), 'url' => Url::toRoute(['index','seo_category_id'=>$seo_category_id])]; | |
| 13 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => Url::toRoute(['view', 'seo_category_id'=>$seo_category_id, 'id' => $model->seo_dynamic_id])]; | |
| 14 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 15 | +?> | |
| 16 | +<div class="seo-dynamic-update"> | |
| 17 | + | |
| 18 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 19 | + | |
| 20 | + <?= $this->render('_form', [ | |
| 21 | + 'model' => $model, | |
| 22 | + ]) ?> | |
| 23 | + | |
| 24 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo-dynamic/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\SeoDynamic */ | |
| 8 | + | |
| 9 | +$this->title = $model->name; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Dynamics'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="seo-dynamic-view"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_dynamic_id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_dynamic_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 | + 'seo_dynamic_id', | |
| 32 | + 'seo_category_id', | |
| 33 | + 'name', | |
| 34 | + 'action', | |
| 35 | + 'fields', | |
| 36 | + 'title', | |
| 37 | + 'h1', | |
| 38 | + 'description', | |
| 39 | + 'seo_text:ntext', | |
| 40 | + 'status', | |
| 41 | + ], | |
| 42 | + ]) ?> | |
| 43 | + | |
| 44 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo/_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\Seo */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="seo-form"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin(); ?> | |
| 14 | + | |
| 15 | + <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> | |
| 20 | + | |
| 21 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> | |
| 22 | + | |
| 23 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
| 24 | + | |
| 25 | + <div class="form-group"> | |
| 26 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 27 | + </div> | |
| 28 | + | |
| 29 | + <?php ActiveForm::end(); ?> | |
| 30 | + | |
| 31 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo/_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\SeoSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="seo-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'seo_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'url') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'title') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'description') ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'h1') ?> | |
| 27 | + | |
| 28 | + <?php // echo $form->field($model, 'seo_text') ?> | |
| 29 | + | |
| 30 | + <div class="form-group"> | |
| 31 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 32 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 33 | + </div> | |
| 34 | + | |
| 35 | + <?php ActiveForm::end(); ?> | |
| 36 | + | |
| 37 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo/create.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\Seo */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create Seo'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="seo-create"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo/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\SeoSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + | |
| 10 | +$this->title = Yii::t('app', 'Seo'); | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="seo-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 Seo'), ['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 | + 'seo_id', | |
| 28 | + 'url:url', | |
| 29 | + 'title', | |
| 30 | + 'description', | |
| 31 | + 'h1', | |
| 32 | + // 'seo_text:ntext', | |
| 33 | + | |
| 34 | + ['class' => 'yii\grid\ActionColumn'], | |
| 35 | + ], | |
| 36 | + ]); ?> | |
| 37 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo/update.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model common\models\Seo */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Seo', | |
| 10 | +]) . $model->title; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->seo_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 14 | +?> | |
| 15 | +<div class="seo-update"> | |
| 16 | + | |
| 17 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 18 | + | |
| 19 | + <?= $this->render('_form', [ | |
| 20 | + 'model' => $model, | |
| 21 | + ]) ?> | |
| 22 | + | |
| 23 | +</div> | ... | ... |
| 1 | +++ a/backend/views/seo/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\Seo */ | |
| 8 | + | |
| 9 | +$this->title = $model->title; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="seo-view"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_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 | + 'seo_id', | |
| 32 | + 'url:url', | |
| 33 | + 'title', | |
| 34 | + 'description', | |
| 35 | + 'h1', | |
| 36 | + 'seo_text:ntext', | |
| 37 | + ], | |
| 38 | + ]) ?> | |
| 39 | + | |
| 40 | +</div> | ... | ... |
| 1 | +++ a/backend/views/service/_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 yii\jui\DatePicker; | |
| 8 | +/* @var $this yii\web\View */ | |
| 9 | +/* @var $model common\models\Service */ | |
| 10 | +/* @var $form yii\widgets\ActiveForm */ | |
| 11 | +?> | |
| 12 | + | |
| 13 | +<div class="service-form"> | |
| 14 | + | |
| 15 | + <?php $form = ActiveForm::begin(); ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | |
| 20 | + | |
| 21 | + <?= $form->field($model, 'body')->widget(CKEditor::className(), | |
| 22 | + [ | |
| 23 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | |
| 24 | + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать | |
| 25 | + 'inline' => false, //по умолчанию false]), | |
| 26 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | |
| 27 | + ] | |
| 28 | + ) | |
| 29 | + ]) ?> | |
| 30 | + | |
| 31 | + | |
| 32 | + <?= \common\modules\file\widgets\ImageUploader::widget([ | |
| 33 | + 'model'=> $model, | |
| 34 | + 'field'=>'image', | |
| 35 | + 'size' => [ | |
| 36 | + [ | |
| 37 | + 'width'=>200, | |
| 38 | + 'height'=>200, | |
| 39 | + ], | |
| 40 | + [ | |
| 41 | + 'width'=>940, | |
| 42 | + 'height'=>480, | |
| 43 | + ] | |
| 44 | + ], | |
| 45 | + 'multi'=>false, | |
| 46 | + 'gallery' => $model->image, | |
| 47 | + 'name' => 'Загрузить изображение' | |
| 48 | + ]); | |
| 49 | + ?> | |
| 50 | + | |
| 51 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | |
| 52 | + | |
| 53 | + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> | |
| 54 | + | |
| 55 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> | |
| 56 | + | |
| 57 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
| 58 | + | |
| 59 | + | |
| 60 | + <div class="form-group"> | |
| 61 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 62 | + </div> | |
| 63 | + | |
| 64 | + <?php ActiveForm::end(); ?> | |
| 65 | + | |
| 66 | +</div> | ... | ... |
| 1 | +++ a/backend/views/service/_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\ServiceSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="service-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'service_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'name') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'alias') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'image') ?> | |
| 25 | + | |
| 26 | + <?php // echo $form->field($model, 'meta_title') ?> | |
| 27 | + | |
| 28 | + <?php // echo $form->field($model, 'description') ?> | |
| 29 | + | |
| 30 | + <?php // echo $form->field($model, 'h1') ?> | |
| 31 | + | |
| 32 | + <?php // echo $form->field($model, 'seo_text') ?> | |
| 33 | + | |
| 34 | + <?php // echo $form->field($model, 'created_at') ?> | |
| 35 | + | |
| 36 | + <?php // echo $form->field($model, 'updated_at') ?> | |
| 37 | + | |
| 38 | + <div class="form-group"> | |
| 39 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 40 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 41 | + </div> | |
| 42 | + | |
| 43 | + <?php ActiveForm::end(); ?> | |
| 44 | + | |
| 45 | +</div> | ... | ... |
| 1 | +++ a/backend/views/service/create.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\Service */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create Service'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="service-create"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +++ a/backend/views/service/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\ServiceSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + | |
| 10 | +$this->title = Yii::t('app', 'Services'); | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="service-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 Service'), ['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 | + 'service_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 | + | |
| 41 | + ['class' => 'yii\grid\ActionColumn'], | |
| 42 | + ], | |
| 43 | + ]); ?> | |
| 44 | +</div> | ... | ... |
| 1 | +++ a/backend/views/service/update.php | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model common\models\Service */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Service', | |
| 10 | +]) . $model->name; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->service_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 14 | +?> | |
| 15 | +<div class="service-update"> | |
| 16 | + | |
| 17 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 18 | + | |
| 19 | + <?= $this->render('_form', [ | |
| 20 | + 'model' => $model, | |
| 21 | + ]) ?> | |
| 22 | + | |
| 23 | +</div> | ... | ... |