diff --git a/.bowerrc b/.bowerrc
new file mode 100644
index 0000000..1669168
--- /dev/null
+++ b/.bowerrc
@@ -0,0 +1,3 @@
+{
+ "directory" : "vendor/bower"
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4be8feb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,46 @@
+# yii console command
+/yii
+
+# phpstorm project files
+.idea
+
+# netbeans project files
+nbproject
+
+# zend studio for eclipse project files
+.buildpath
+.project
+.settings
+
+# windows thumbnail cache
+Thumbs.db
+
+# composer vendor dir
+/vendor
+
+# composer itself is not needed
+composer.phar
+
+# Mac DS_Store Files
+.DS_Store
+
+# phpunit itself is not needed
+phpunit.phar
+# local phpunit config
+/phpunit.xml
+
+/storage
+/common/config/main-local.php
+/common/config/params-local.php
+/backend/config/main-local.php
+/backend/config/params-local.php
+/frontend/config/main-local.php
+/frontend/config/params-local.php
+
+/backend/web/assets/
+/frontend/web/assets/
+/frontend/web/css/node_modules/
+/frontend/views/вертска
+composer.lock
+
+tests/_output/*
\ No newline at end of file
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..17d3b8c
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,75 @@
+AddDefaultCharset utf-8
+
+
+
+ Options +FollowSymlinks
+
+ RewriteEngine On
+
+
+
+
+
+ RewriteBase /
+ # deal with admin first
+
+
+
+ RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT]
+
+ RewriteCond %{REQUEST_URI} ^/(admin)
+
+
+
+ RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
+
+ RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
+
+ RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L]
+
+ RewriteRule ^admin/images/(.*)$ backend/web/images/$1 [L]
+
+ RewriteRule ^admin/fonts/(.*)$ backend/web/fonts/$1 [L]
+
+
+
+
+
+ RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js|images|fonts)/
+
+ RewriteCond %{REQUEST_URI} ^/(admin)
+
+ RewriteRule ^.*$ backend/web/index.php [L]
+
+
+
+ RewriteCond %{REQUEST_URI} ^/(assets|css)
+
+ RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
+
+ RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
+
+ RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
+
+ RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
+
+ RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L]
+
+
+ RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js|images|fonts)/
+
+ RewriteCond %{REQUEST_URI} !index.php
+
+ RewriteCond %{REQUEST_FILENAME} !-f [OR]
+
+ RewriteCond %{REQUEST_FILENAME} !-d
+
+ RewriteRule ^.*$ frontend/web/index.php [L]
+
+
+
+#для возможности загрузки файлов парсера
+
+ php_value upload_max_filesize 20M
+ php_value post_max_size 30M
+
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..9d1f119
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,32 @@
+The Yii framework is free software. It is released under the terms of
+the following BSD License.
+
+Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Yii Software LLC nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6028cf0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,54 @@
+Yii 2 Advanced Project Template
+===============================
+
+Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
+developing complex Web applications with multiple tiers.
+
+The template includes three tiers: front end, back end, and console, each of which
+is a separate Yii application.
+
+The template is designed to work in a team development environment. It supports
+deploying the application in different environments.
+
+Documentation is at [docs/guide/README.md](docs/guide/README.md).
+
+[](https://packagist.org/packages/yiisoft/yii2-app-advanced)
+[](https://packagist.org/packages/yiisoft/yii2-app-advanced)
+[](https://travis-ci.org/yiisoft/yii2-app-advanced)
+
+DIRECTORY STRUCTURE
+-------------------
+
+```
+common
+ config/ contains shared configurations
+ mail/ contains view files for e-mails
+ models/ contains model classes used in both backend and frontend
+console
+ config/ contains console configurations
+ controllers/ contains console controllers (commands)
+ migrations/ contains database migrations
+ models/ contains console-specific model classes
+ runtime/ contains files generated during runtime
+backend
+ assets/ contains application assets such as JavaScript and CSS
+ config/ contains backend configurations
+ controllers/ contains Web controller classes
+ models/ contains backend-specific model classes
+ runtime/ contains files generated during runtime
+ views/ contains view files for the Web application
+ web/ contains the entry script and Web resources
+frontend
+ assets/ contains application assets such as JavaScript and CSS
+ config/ contains frontend configurations
+ controllers/ contains Web controller classes
+ models/ contains frontend-specific model classes
+ runtime/ contains files generated during runtime
+ views/ contains view files for the Web application
+ web/ contains the entry script and Web resources
+ widgets/ contains frontend widgets
+vendor/ contains dependent 3rd-party packages
+environments/ contains environment-based overrides
+tests contains various tests for the advanced application
+ codeception/ contains tests developed with Codeception PHP Testing Framework
+```
diff --git a/backend/assets/AdminLteAsset.php b/backend/assets/AdminLteAsset.php
new file mode 100644
index 0000000..342c11f
--- /dev/null
+++ b/backend/assets/AdminLteAsset.php
@@ -0,0 +1,35 @@
+
+ * @since 2.0
+ */
+class AdminLteAsset extends AssetBundle
+{
+ public $sourcePath = '@bower/';
+ public $css = [
+ 'admin-lte/dist/css/AdminLTE.css',
+ 'admin-lte/dist/css/skins/_all-skins.css'
+ ];
+
+ public $js = [
+ 'admin-lte/dist/js/app.js',
+
+ ];
+ public $depends = [
+ 'yii\web\YiiAsset',
+ 'yii\bootstrap\BootstrapAsset',
+ 'yii\bootstrap\BootstrapPluginAsset',
+ 'backend\assets\FontAwesomeAsset',
+ 'common\modules\file\FileUploadAsset'
+ ];
+}
\ No newline at end of file
diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php
new file mode 100644
index 0000000..0fe9ca8
--- /dev/null
+++ b/backend/assets/AppAsset.php
@@ -0,0 +1,30 @@
+
+ * @since 2.0
+ */
+class AppAsset extends AssetBundle
+{
+ public $basePath = '@webroot';
+ public $baseUrl = '@web';
+ public $css = [
+ 'css/site.css',
+ ];
+ public $js = [
+ 'js/fieldWidget.js',
+ ];
+ public $depends = [
+ 'yii\web\YiiAsset',
+ 'yii\bootstrap\BootstrapAsset',
+ ];
+}
diff --git a/backend/assets/FontAwesomeAsset.php b/backend/assets/FontAwesomeAsset.php
new file mode 100644
index 0000000..9a37a75
--- /dev/null
+++ b/backend/assets/FontAwesomeAsset.php
@@ -0,0 +1,14 @@
+ 'app-backend',
+ 'basePath' => dirname(__DIR__),
+ 'layout' => 'admin',
+ 'controllerNamespace' => 'backend\controllers',
+ 'bootstrap' => ['log'],
+ 'modules' => [
+ 'rubrication' => [
+ 'class' => 'common\modules\rubrication\Module',
+ 'types' => [
+ 'string' => 'Strings',
+ 'float' => 'Floating number',
+ 'int' => 'Integer number',
+ 'link' => 'Web-link',
+ ]
+ ],
+ 'product' => [
+ 'class' => 'common\modules\product\Module'
+ ],
+ 'gridview' => [
+ 'class' => '\kartik\grid\Module'
+ ]
+ ],
+ 'components' => [
+ 'user' => [
+ 'identityClass' => 'common\models\User',
+ 'enableAutoLogin' => true,
+ ],
+ 'log' => [
+ 'traceLevel' => YII_DEBUG ? 3 : 0,
+ 'targets' => [
+ [
+ 'class' => 'yii\log\FileTarget',
+ 'levels' => ['error', 'warning'],
+ ],
+ ],
+ ],
+ 'errorHandler' => [
+ 'errorAction' => 'site/error',
+ ],
+ 'request'=>[
+ 'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i',
+ 'csrfParam' => '_backendCSRF',
+
+ 'class' => 'common\components\Request',
+
+ 'web'=> '/backend/web',
+
+ 'adminUrl' => '/admin'
+
+ ],
+ 'urlManager' => [
+ 'baseUrl' => '/admin',
+ 'enablePrettyUrl' => true,
+ 'showScriptName' => false,
+ 'rules' => [
+ 'slider-image///' => 'slider-image/',
+ 'slider-image//' => 'slider-image/',
+ 'seo-dynamic///' => 'seo-dynamic/',
+ 'seo-dynamic//' => 'seo-dynamic/',
+
+
+ ]
+ ]
+
+ ],
+ 'params' => $params,
+];
diff --git a/backend/config/params.php b/backend/config/params.php
new file mode 100644
index 0000000..4ee7a49
--- /dev/null
+++ b/backend/config/params.php
@@ -0,0 +1,4 @@
+ 'admin@example.com',
+];
diff --git a/backend/controllers/BannerController.php b/backend/controllers/BannerController.php
new file mode 100644
index 0000000..e38f1a3
--- /dev/null
+++ b/backend/controllers/BannerController.php
@@ -0,0 +1,145 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Banner models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new BannerSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ public function actionSaveImageSettings(){
+ \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
+ $width = Yii::$app->request->post('width');
+ $height = Yii::$app->request->post('height');
+
+ $html = ImageUploader::widget([
+ 'model'=> new Banner(),
+ 'field'=>'image',
+ 'size' => [
+ [
+ 'width'=>$width,
+ 'height'=>$height,
+ ],
+ ],
+ 'name' => "Загрузить баннер"
+ ]);
+
+ return ['html'=>$html];
+ }
+
+ /**
+ * Displays a single Banner model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Banner model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Banner();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->banner_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Banner model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->banner_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Banner model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Banner model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Banner the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Banner::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/BlogController.php b/backend/controllers/BlogController.php
new file mode 100644
index 0000000..b2d74d4
--- /dev/null
+++ b/backend/controllers/BlogController.php
@@ -0,0 +1,144 @@
+ [
+ 'class' => AccessControl::className(),
+ 'rules' => [
+ [
+ 'actions' => ['login', 'error'],
+ 'allow' => true,
+ ],
+ [
+ 'actions' => ['logout', 'index'],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Blog models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new BlogSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Blog model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Blog model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Blog();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+
+ Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru');
+
+ return $this->redirect(['view', 'id' => $model->blog_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Blog model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru');
+ return $this->redirect(['view', 'id' => $model->blog_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Blog model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Blog model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Blog the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Blog::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/BrandController.php b/backend/controllers/BrandController.php
new file mode 100644
index 0000000..fd49a06
--- /dev/null
+++ b/backend/controllers/BrandController.php
@@ -0,0 +1,138 @@
+ [
+ 'class' => AccessControl::className(),
+ 'rules' => [
+ [
+ 'actions' => ['login', 'error'],
+ 'allow' => true,
+ ],
+ [
+ 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete'],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Brand models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new BrandSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Brand model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Brand model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Brand();
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ exit;
+ 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));
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Brand model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->brand_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Brand model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Brand model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Brand the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Brand::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/CategoryController.php b/backend/controllers/CategoryController.php
new file mode 100644
index 0000000..bda3e4e
--- /dev/null
+++ b/backend/controllers/CategoryController.php
@@ -0,0 +1,145 @@
+ [
+ 'class' => AccessControl::className(),
+ 'rules' => [
+ [
+ 'actions' => ['login', 'error'],
+ 'allow' => true,
+ ],
+ [
+ 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete'],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Category models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new CategorySearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Category model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Category model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Category();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ 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));
+ } else {
+ if (!empty(Yii::$app->request->queryParams['parent'])) {
+ $model->parent_id = Yii::$app->request->queryParams['parent'];
+ }
+ return $this->render('create', [
+ 'model' => $model,
+ 'categories' => ArtboxTreeHelper::treeMap(Category::find()->with('categoryName')->getTree(), 'category_id', 'categoryName.value', '.')
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Category model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->category_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ 'categories' => ArtboxTreeHelper::treeMap(Category::find()->with('categoryName')->getTree(), 'category_id', 'categoryName.value', '.')
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Category model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Category model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Category the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Category::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/EventController.php b/backend/controllers/EventController.php
new file mode 100644
index 0000000..748df40
--- /dev/null
+++ b/backend/controllers/EventController.php
@@ -0,0 +1,124 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Event models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new EventSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Event model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Event model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Event();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->event_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Event model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->event_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Event model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Event model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Event the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Event::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/OrdersController.php b/backend/controllers/OrdersController.php
new file mode 100644
index 0000000..53abb4c
--- /dev/null
+++ b/backend/controllers/OrdersController.php
@@ -0,0 +1,137 @@
+ [
+ 'class' => AccessControl::className(),
+ 'rules' => [
+ [
+ 'actions' => ['login', 'error','update','delete','create','view'],
+ 'allow' => true,
+ ],
+ [
+ 'actions' => ['logout', 'index'],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+ /**
+ * Lists all Orders models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new OrdersSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Orders model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Orders model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Orders();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->order_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Orders model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->order_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Orders model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Orders model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Orders the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Orders::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/PageController.php b/backend/controllers/PageController.php
new file mode 100644
index 0000000..35c46d2
--- /dev/null
+++ b/backend/controllers/PageController.php
@@ -0,0 +1,136 @@
+ [
+ 'class' => AccessControl::className(),
+ 'rules' => [
+ [
+ 'actions' => ['login', 'error'],
+ 'allow' => true,
+ ],
+ [
+ 'actions' => ['logout', 'index','create','update','view','delete','test-img' ],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Page models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new PageSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Page model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Page model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Page();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Page model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Page model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Page model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Page the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Page::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/SeoCategoryController.php b/backend/controllers/SeoCategoryController.php
new file mode 100644
index 0000000..433a3f5
--- /dev/null
+++ b/backend/controllers/SeoCategoryController.php
@@ -0,0 +1,124 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all SeoCategory models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new SeoCategorySearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single SeoCategory model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new SeoCategory model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new SeoCategory();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->seo_category_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing SeoCategory model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->seo_category_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing SeoCategory model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the SeoCategory model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return SeoCategory the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = SeoCategory::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/SeoController.php b/backend/controllers/SeoController.php
new file mode 100644
index 0000000..3ec6b7c
--- /dev/null
+++ b/backend/controllers/SeoController.php
@@ -0,0 +1,124 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Seo models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new SeoSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Seo model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Seo model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Seo();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->seo_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Seo model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->seo_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Seo model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Seo model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Seo the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Seo::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/SeoDynamicController.php b/backend/controllers/SeoDynamicController.php
new file mode 100644
index 0000000..ba243a9
--- /dev/null
+++ b/backend/controllers/SeoDynamicController.php
@@ -0,0 +1,130 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all SeoDynamic models.
+ * @return mixed
+ */
+ public function actionIndex($seo_category_id)
+ {
+ $searchModel = new SeoDynamicSearch();
+ $dataProvider = $searchModel->search($seo_category_id,Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ 'seo_category_id' => $seo_category_id
+ ]);
+ }
+
+ /**
+ * Displays a single SeoDynamic model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($seo_category_id, $id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ 'seo_category_id' => $seo_category_id
+ ]);
+ }
+
+ /**
+ * Creates a new SeoDynamic model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate($seo_category_id)
+ {
+ $model = new SeoDynamic();
+
+ if ($model->load(Yii::$app->request->post())) {
+ $model->seo_category_id = $seo_category_id;
+ $model->save();
+ return $this->redirect(['index', 'seo_category_id' => $model->seo_category_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ 'seo_category_id' => $seo_category_id
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing SeoDynamic model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($seo_category_id,$id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['index', 'seo_category_id' => $model->seo_category_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ 'seo_category_id' => $seo_category_id
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing SeoDynamic model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($seo_category_id,$id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index','seo_category_id'=> $seo_category_id]);
+ }
+
+ /**
+ * Finds the SeoDynamic model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return SeoDynamic the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = SeoDynamic::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/ServiceController.php b/backend/controllers/ServiceController.php
new file mode 100644
index 0000000..ef229bc
--- /dev/null
+++ b/backend/controllers/ServiceController.php
@@ -0,0 +1,124 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Service models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new ServiceSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Service model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Service model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Service();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->service_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Service model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->service_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Service model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Service model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Service the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Service::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php
new file mode 100644
index 0000000..3b88430
--- /dev/null
+++ b/backend/controllers/SiteController.php
@@ -0,0 +1,720 @@
+ [
+ 'class' => AccessControl::className(),
+ 'rules' => [
+ [
+ 'actions' => ['login', 'error', 'go'],
+ 'allow' => true,
+ ],
+ [
+ 'actions' => ['logout', 'index'],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function actions()
+ {
+ return [
+ 'error' => [
+ 'class' => 'yii\web\ErrorAction',
+ ],
+ ];
+ }
+
+ public function actionIndex()
+ {
+ $blog = new Blog();
+ $post = \Yii::$app->request->post();
+ if($blog->load($post)) {
+ $blog->save();
+ }
+ return $this->render('index',[
+ 'blog' => $blog
+ ]);
+ }
+
+ public function actionLogin()
+ {
+ $this->layout = '/none';
+
+ if (!\Yii::$app->user->isGuest) {
+ return $this->goHome();
+ }
+
+ $model = new LoginForm();
+ if ($model->load(Yii::$app->request->post()) && $model->login()) {
+ return $this->goBack();
+ } else {
+ return $this->render('login', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ public function actionLogout()
+ {
+ Yii::$app->user->logout();
+
+ return $this->goHome();
+ }
+
+ public function actionGo() {
+ $new_products = $linked_products = 0;
+
+ // открываем файл и перебираем
+ $filename = Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@uploadFileProducts');
+ if (!is_file($filename)) {
+ var_dump("File $filename not found");
+ return Controller::EXIT_CODE_ERROR;
+ }
+ var_dump("File $filename loaded\n");
+
+ $db = yii::$app->db;
+
+ if (($handle = fopen ($filename, 'r')) !== FALSE)
+ {
+ $j = 0;
+
+ while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE)
+ {
+ $j++;
+
+ foreach ($data as &$value)
+ {
+ //$value = mb_convert_encoding ($value, "UTF-8", mb_detect_encoding ($value));
+ $value = iconv ('windows-1251', "UTF-8//TRANSLIT//IGNORE", $value);
+ $value = trim ($value);
+ }
+
+ // будет всегда 19 элементов
+ for ($i = 0; $i <= 18; $i++)
+ {
+ if (! isset ($data[$i]))
+ {
+ $data[$i] = null;
+ }
+ }
+
+ // 1 Группа (категория)
+ $catalog_name = $data[0];
+ if (empty ($catalog_name))
+ {
+ CONTINUE;
+ }
+
+ // 2 Бренд
+ $brand_name = $data[1];
+ if (empty ($brand_name))
+ {
+ CONTINUE;
+ }
+
+ // 3 Название товара
+ $product_name = $data[2];
+ if (empty ($product_name))
+ {
+ CONTINUE;
+ }
+
+ // 4 Описание Укр
+ $product_body_uk = $data[3];
+
+ // 5 Описание Рус
+ $product_body_ru = $data[4];
+
+ // 6 Фильтр (через запятую)
+ $filters = explode (',', $data[5]);
+
+ // 7 Доп фильтр через запятую
+ $filters_extra = explode (',', $data[6]);
+
+ // 8 Пол череззапятую (мужской, женский, детский, унисекс)
+ $gender = explode (',', $data[7]);
+
+ // 9 Год
+ $years = explode (',', $data[8]);
+
+ // 10 Цена старая
+ $product_cost_old = $data[9];
+
+ // 11 Цена
+ $produc_cost = $data[10];
+
+ // 12 Акция
+ $product_akciya = (bool)$data[11];
+
+ // 13 Сопуд. Тов.
+ $similar = explode (',', $data[12]);
+
+ // 14 Новинки
+ $product_new = (bool)$data[13];
+
+ // 15 Топ продаж
+ $product_top = (bool)$data[14];
+
+ // 16 Сетка Характеристик
+ $feature = explode ('=', $data[15]);
+
+ // 17 ВИДЕО КОД
+ $product_video = $data[16];
+
+ // 18 Галлерея фото
+ $fotos = explode (',', $data[17]);
+
+ // 19 Штрих код товара.
+ // расшифровал - это модификации товара!
+
+ $product_image = explode ('=', $data[18]);
+ $product_image = @$product_image[3];
+
+ if ( ($_product = Product::find()->filterWhere(['ilike', 'name', trim($product_name)])->one()) === null ) {
+ $_product = new Product();
+ }
+
+ // ==== Set category ====
+ if ( ($category = CategoryName::find()->filterWhere(['ilike', 'value', trim($catalog_name)])->one()) !== null ) {
+ $_product->categories = [$category->category_id];
+ } else {
+ // Create category
+ $category = new Category();
+ $category->name = trim($catalog_name);
+ $category->save();
+ $_product->categories = [$category->category_id];
+ }
+
+ // ===== Set brand ====
+ if ( $brand_name ) {
+ if ( ($brand = BrandName::find()->filterWhere(['ilike', 'value', trim($brand_name)])->one()) !== null ) {
+ $_product->brand_id = $brand->brand_id;
+ } else {
+ // Create brand
+ $brand = new Brand();
+ $brand->name = trim($brand_name);
+ $brand->save();
+ $_product->brand_id = $brand->brand_id;
+ }
+ }
+
+ $_product->name = $product_name;
+ $_product->video = $product_video;
+ $_product->description = $product_body_ru;
+ $_product->top = $product_top;
+ $_product->akciya = $product_akciya;
+ $_product->new = $product_new;
+
+
+ $_product->save();
+
+
+ // @todo Set image
+ /*// картинки
+ if (is_file ($dir.'/mod/' . $product_image))
+ {
+ $resizeObj = new resize ($dir.'/mod/' . $product_image);
+ $resizeObj->resizeImage (135, 200, 'auto');
+ $resizeObj->saveImage ($dir.'/products/ico/' . $product_image, 100);
+ $resizeObj->resizeImage (370, 370, 'auto');
+ $resizeObj->saveImage ($dir.'/products/big/' . $product_image, 100);
+ }*/
+
+ // ==== mods ====
+
+ // (типа штрих код товара)
+
+ // нужно для проставления характеристик относящихся к модификациям
+ $MOD_ARRAY = [];
+
+ for ($i = 18; $i < count ($data); $i ++)
+ {
+ if (! empty ($data[$i]))
+ {
+ $mod_arr = explode ('=', $data[$i]);
+ $mod_art = $mod_arr[0];
+ $mod_size = $mod_arr[1];
+ $mod_color = $mod_arr[2];
+ $mod_image = $mod_arr[3];
+ $mod_cost = $produc_cost;
+ $mod_old_cost = $product_cost_old;
+
+ // Check product variant
+ if ( ($_productVariant = ProductVariant::find()->andWhere(['ilike', 'sku', $mod_art])->andWhere(['product_id' => $_product->product_id])->one()) === null ) {
+ $_productVariant = new ProductVariant();
+ $_productVariant->product_id = $_product->product_id;
+ }
+
+ $_productVariant->sku = $mod_art;
+ $_productVariant->price = $mod_cost;
+ $_productVariant->price_old = $mod_old_cost;
+
+ $_productVariant->save();
+
+ $MOD_ARRAY[] = $_productVariant->product_variant_id;
+
+
+ $dir = Yii::getAlias('@productsDir').'/';
+ if (is_file ($dir . $mod_image))
+ {
+ $resizeObj = new resize ($dir . $mod_image);
+ $resizeObj->resizeImage (40, 40, 'crop');
+ $resizeObj->saveImage ($dir.'ico/' . $mod_image, 100);
+ $resizeObj->resizeImage (370, 370, 'auto');
+ $resizeObj->saveImage ($dir.'/big/' . $mod_image, 100);
+ }
+
+ $product_variant_type_name = '';
+ if (! empty ($mod_color))
+ $product_variant_type_name = 'Цвет';
+ elseif (! empty ($mod_size))
+ $product_variant_type_name = 'Размер';
+
+ // ===== Set variant type ====
+ if ( $product_variant_type_name ) {
+ if ( ($product_variant_type = ProductVariantType::find()->filterWhere(['ilike', 'name', $product_variant_type_name])->one()) !== null ) {
+ $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
+ } else {
+ // Create brand
+ $product_variant_type = new ProductVariantType();
+ $product_variant_type->name = $product_variant_type_name;
+ $product_variant_type->save();
+ $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
+ }
+ }
+ }
+ }
+
+ /*// ==== fotos ====
+
+ foreach ($fotos as $foto)
+ {
+ $fields = [
+ 'product_id' => $product_id,
+ 'image' => $foto
+ ];
+
+ $modelFotos = Fotos::find ()
+ ->where ('image=:image', [
+ ':image' => $foto
+ ])
+ ->one ();
+
+ if (empty ($modelFotos->id))
+ {
+ $db->createCommand ()
+ ->insert ('products_fotos', $fields)
+ ->execute ();
+ }
+ else
+ {
+ $db->createCommand ()
+ ->update ('products_fotos', $fields, 'id = ' . $modelFotos->id)
+ ->execute ();
+ }
+
+ if (is_file ($dir.'/fotos/' . $foto))
+ {
+ $resizeObj = new resize ($dir.'/fotos/' . $foto);
+ $resizeObj->resizeImage (100, 100, 'crop');
+ $resizeObj->saveImage ($dir.'/fotos/ico/' . $foto, 100);
+ $resizeObj->resizeImage (400, 400, 'crop');
+ $resizeObj->saveImage ($dir.'/fotos/big/' . $foto, 100);
+ }
+ }*/
+
+ // ========================
+ // ==== ХАРАКТЕРИСТИКИ ====
+ // ========================
+
+ // есть общие характеристики, которые относятся product_id, такие как brand, gender...
+ // есть характеристики, которые относятся mod_id, такие как цвет, размер...
+
+ // ==== gender ====
+
+ /*if (! empty ($gender))
+ {
+ $bookGender = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'gender'
+ ])
+ ->one ();
+
+ foreach ($gender as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookGenderValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookGender->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookGenderValue->book_value_id) || empty ($bookGenderValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookGender->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookGenderValue->book_value_id;
+ }
+
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE products_value
+ SET
+ product_id = '.(int)$product_id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+
+ // есть характеристики, которые относятся mod_id, такие как цвет, размер...
+
+ // ==== destination ====
+
+ if (! empty ($filters))
+ {
+ $bookDestination = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'destination'
+ ])
+ ->one ();
+
+ foreach ($filters as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookDestinationValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookDestination->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookDestinationValue->book_value_id) || empty ($bookDestinationValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookDestination->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookDestinationValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }
+
+ // ==== special ====
+
+ if (! empty ($filters_extra))
+ {
+ $bookSpecial = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'special'
+ ])
+ ->one ();
+
+ foreach ($filters_extra as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookSpecialValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookSpecial->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookSpecialValue->book_value_id) || empty ($bookSpecialValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookSpecial->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookSpecialValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }
+
+ // ==== year ====
+
+ if (! empty ($years))
+ {
+ $bookYear = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'year'
+ ])
+ ->one ();
+
+ foreach ($years as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookYearValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookYear->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookYearValue->book_value_id) || empty ($bookYearValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookYear->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookYearValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }
+
+ // ==== $feature ====
+
+ if (! empty ($feature))
+ {
+ foreach ($feature as $string)
+ {
+ $string = str_replace([':', '.'], '', $string);
+
+ if (! empty ($string))
+ {
+ list ($book_title, $value_title) = explode ('*', $string);
+
+ $book_title = trim ($book_title);
+ $value_title = trim ($value_title);
+
+ if (empty ($book_title) || empty ($value_title))
+ {
+ CONTINUE;
+ }
+
+ $bookFeature = Book::find ()
+ ->where ('book_title=:book', [
+ ':book' => $book_title
+ ])
+ ->one ();
+
+ if (! isset ($bookFeature->book_id) || empty ($bookFeature->book_id))
+ {
+ $db->createCommand ()
+ ->insert (Book::tableName (), [
+ 'book_title' => $book_title,
+ 'book_alias' => Translite::rusencode ($book_title),
+ ])
+ ->execute ();
+
+ $book_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_id = $bookFeature->book_id;
+ }
+
+ $bookFeatureValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $book_id,
+ ':value' => $value_title,
+ ':alias' => Translite::rusencode ($value_title),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookFeatureValue->book_value_id) || empty ($bookFeatureValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $book_id,
+ 'book_value_title' => $value_title,
+ 'book_value_alias' => Translite::rusencode ($value_title),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookFeatureValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }*/
+
+ // ==== IMPORTANT ====
+
+ // записуем ID обработанной записи
+
+ $_product->save();
+ var_dump("$j: Product {$_product->name} saved\n");
+ if ($j > 100) {
+ var_dump("Dev OK");
+ exit;
+ }
+ }
+
+ fclose ($handle);
+ }
+ }
+}
diff --git a/backend/controllers/SliderController.php b/backend/controllers/SliderController.php
new file mode 100644
index 0000000..afd9155
--- /dev/null
+++ b/backend/controllers/SliderController.php
@@ -0,0 +1,128 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Slider models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new SliderSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Slider model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Slider model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Slider();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->slider_id]);
+ } else {
+
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Slider model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->slider_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Slider model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Slider model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Slider the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Slider::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/controllers/SliderImageController.php b/backend/controllers/SliderImageController.php
new file mode 100644
index 0000000..a7ab1c3
--- /dev/null
+++ b/backend/controllers/SliderImageController.php
@@ -0,0 +1,144 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all SliderImage models.
+ * @param $slider_id Slider id
+ * @return mixed
+ */
+ public function actionIndex($slider_id)
+ {
+ $searchModel = new SliderImageSearch();
+ $dataProvider = $searchModel->search($slider_id, Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'slider_id' => $slider_id,
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single SliderImage model.
+ * @param integer $id
+ * @param $slider_id Slider id
+ * @return mixed
+ */
+ public function actionView($slider_id, $id)
+ {
+ return $this->render('view', [
+ 'slider_id' => $slider_id,
+ 'model' => $this->findModel($slider_id, $id),
+ ]);
+ }
+
+ /**
+ * Creates a new SliderImage model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @param $slider_id Slider id
+ * @return mixed
+ */
+ public function actionCreate($slider_id)
+ {
+ $model = new SliderImage();
+
+ if ($model->load(Yii::$app->request->post())) {
+ $model->slider_id = $slider_id;
+ $model->save();
+ return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]);
+ } else {
+
+ $slider = Slider::findOne($slider_id);
+
+ return $this->render('create', [
+ 'slider_id' => $slider_id,
+ 'model' => $model,
+ 'slider' => $slider,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing SliderImage model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param $slider_id Slider id
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($slider_id, $id)
+ {
+ $model = $this->findModel($slider_id, $id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]);
+ } else {
+
+ $slider = Slider::findOne($slider_id);
+ return $this->render('update', [
+ 'model' => $model,
+ 'slider_id' => $slider_id,
+ 'slider' => $slider,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing SliderImage model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param $slider_id Slider id
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($slider_id, $id)
+ {
+ $this->findModel($slider_id, $id)->delete();
+
+ return $this->redirect(['index','slider_id'=>$slider_id]);
+ }
+
+ /**
+ * Finds the SliderImage model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param $slider_id Slider id
+ * @param integer $id
+ * @return SliderImage the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($slider_id,$id)
+ {
+ if (($model = SliderImage::find()->where(['slider_image_id'=> $id, 'slider_id'=>$slider_id])->one()) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/backend/models/.gitkeep b/backend/models/.gitkeep
new file mode 100644
index 0000000..5e4debc
--- /dev/null
+++ b/backend/models/.gitkeep
@@ -0,0 +1 @@
+*
diff --git a/backend/models/LoginForm.php b/backend/models/LoginForm.php
new file mode 100644
index 0000000..30506c2
--- /dev/null
+++ b/backend/models/LoginForm.php
@@ -0,0 +1,79 @@
+hasErrors()) {
+ $user = $this->getUser();
+ if (!$user || !$user->validatePassword($this->password)) {
+ $this->addError($attribute, 'Incorrect username or password.');
+ }
+ }
+ }
+
+ /**
+ * Logs in a user using the provided username and password.
+ *
+ * @return boolean whether the user is logged in successfully
+ */
+ public function login()
+ {
+ if ($this->validate()) {
+ return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Finds user by [[username]]
+ *
+ * @return User|null
+ */
+ protected function getUser()
+ {
+ if ($this->_user === null) {
+ $this->_user = User::findByUsername($this->username);
+ }
+
+ return $this->_user;
+ }
+}
diff --git a/backend/views/banner/_form.php b/backend/views/banner/_form.php
new file mode 100644
index 0000000..0c8868a
--- /dev/null
+++ b/backend/views/banner/_form.php
@@ -0,0 +1,95 @@
+
+
+
+
diff --git a/backend/views/banner/_search.php b/backend/views/banner/_search.php
new file mode 100644
index 0000000..4bc81e3
--- /dev/null
+++ b/backend/views/banner/_search.php
@@ -0,0 +1,38 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'banner_id') ?>
+
+
+ = $form->field($model, 'image') ?>
+
+ = $form->field($model, 'alt') ?>
+
+ = $form->field($model, 'title') ?>
+
+ field($model, 'url') ?>
+
+ field($model, 'status') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/banner/create.php b/backend/views/banner/create.php
new file mode 100644
index 0000000..8fbe344
--- /dev/null
+++ b/backend/views/banner/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Banner');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/banner/index.php b/backend/views/banner/index.php
new file mode 100644
index 0000000..a6ecfc8
--- /dev/null
+++ b/backend/views/banner/index.php
@@ -0,0 +1,37 @@
+title = Yii::t('app', 'Banners');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Banner'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'banner_id',
+ 'image',
+ 'alt',
+ 'title',
+ // 'url:url',
+ // 'status',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/banner/update.php b/backend/views/banner/update.php
new file mode 100644
index 0000000..44ddca7
--- /dev/null
+++ b/backend/views/banner/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Banner',
+]) . $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->banner_id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/banner/view.php b/backend/views/banner/view.php
new file mode 100644
index 0000000..9200c04
--- /dev/null
+++ b/backend/views/banner/view.php
@@ -0,0 +1,40 @@
+title = $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->banner_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->banner_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'banner_id',
+ 'image',
+ 'alt',
+ 'title',
+ 'url:url',
+ 'status',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/blog/_form.php b/backend/views/blog/_form.php
new file mode 100644
index 0000000..033b613
--- /dev/null
+++ b/backend/views/blog/_form.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ = $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'link')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'description')->widget(CKEditor::className(),
+ [
+ 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
+ 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
+ 'inline' => false, //по умолчанию false]),
+ 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
+ ]
+ )
+ ]) ?>
+
+ = ImageUploader::widget([
+ 'model'=> $model,
+ 'field'=>'cover',
+ 'size' => [
+ [
+ 'width'=>340,
+ 'height'=>260,
+ ]
+ ],
+ 'multi'=>true,
+ 'gallery' =>$model->cover,
+ 'name' => 'Загрузить миниатюру статьи'
+ ]);
+ ?>
+
+ = FieldEditor::widget([
+ 'template' => 'education',
+ 'item_id' => $model->blog_id,
+ 'model' => 'common\models\Blog',
+ 'language' => 'ru',
+ ]); ?>
+
+ = Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+
+
+
+
+
diff --git a/backend/views/blog/_search.php b/backend/views/blog/_search.php
new file mode 100644
index 0000000..c3ac459
--- /dev/null
+++ b/backend/views/blog/_search.php
@@ -0,0 +1,43 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'blog_id') ?>
+
+ = $form->field($model, 'user_id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'link') ?>
+
+ = $form->field($model, 'date_add') ?>
+
+ field($model, 'user_add_id') ?>
+
+ field($model, 'view_count') ?>
+
+ field($model, 'description') ?>
+
+ field($model, 'cover') ?>
+
+
+ = Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/blog/create.php b/backend/views/blog/create.php
new file mode 100644
index 0000000..54c74d2
--- /dev/null
+++ b/backend/views/blog/create.php
@@ -0,0 +1,21 @@
+title = 'Create Blog';
+$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/blog/index.php b/backend/views/blog/index.php
new file mode 100644
index 0000000..5a2716d
--- /dev/null
+++ b/backend/views/blog/index.php
@@ -0,0 +1,40 @@
+title = 'Blogs';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a('Create Blog', ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'blog_id',
+ 'user_id',
+ 'name',
+ 'link',
+ 'date_add',
+ // 'user_add_id',
+ // 'view_count',
+ // 'description:ntext',
+ // 'cover',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/blog/update.php b/backend/views/blog/update.php
new file mode 100644
index 0000000..05ecebd
--- /dev/null
+++ b/backend/views/blog/update.php
@@ -0,0 +1,21 @@
+title = 'Update Blog: ' . ' ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->blog_id]];
+$this->params['breadcrumbs'][] = 'Update';
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/blog/view.php b/backend/views/blog/view.php
new file mode 100644
index 0000000..08a4665
--- /dev/null
+++ b/backend/views/blog/view.php
@@ -0,0 +1,43 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a('Update', ['update', 'id' => $model->blog_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a('Delete', ['delete', 'id' => $model->blog_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => 'Are you sure you want to delete this item?',
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'blog_id',
+ 'user_id',
+ 'name',
+ 'link',
+ 'date_add',
+ 'user_add_id',
+ 'view_count',
+ 'description:ntext',
+ 'cover',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/brand/_form.php b/backend/views/brand/_form.php
new file mode 100644
index 0000000..939566d
--- /dev/null
+++ b/backend/views/brand/_form.php
@@ -0,0 +1,51 @@
+
+
+
diff --git a/backend/views/brand/_search.php b/backend/views/brand/_search.php
new file mode 100644
index 0000000..ed1902f
--- /dev/null
+++ b/backend/views/brand/_search.php
@@ -0,0 +1,41 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'brand_id') ?>
+
+ = $form->field($model, 'brand_name_id') ?>
+
+ = $form->field($model, 'alias') ?>
+
+ = $form->field($model, 'image') ?>
+
+ = $form->field($model, 'meta_title') ?>
+
+ field($model, 'meta_desc') ?>
+
+ field($model, 'meta_robots') ?>
+
+ field($model, 'seo_text') ?>
+
+
+ = Html::submitButton(Yii::t('product', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('product', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/brand/create.php b/backend/views/brand/create.php
new file mode 100644
index 0000000..7de8216
--- /dev/null
+++ b/backend/views/brand/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('product', 'Create Brand');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Brands'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/brand/index.php b/backend/views/brand/index.php
new file mode 100644
index 0000000..7c54d0f
--- /dev/null
+++ b/backend/views/brand/index.php
@@ -0,0 +1,33 @@
+title = Yii::t('product', 'Brands');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('product', 'Create Brand'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+// 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'name',
+ 'alias',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/brand/update.php b/backend/views/brand/update.php
new file mode 100644
index 0000000..26ae057
--- /dev/null
+++ b/backend/views/brand/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('product', 'Update {modelClass}: ', [
+ 'modelClass' => 'Brand',
+]) . ' ' . $model->brand_id;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Brands'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->brand_id, 'url' => ['view', 'id' => $model->brand_id]];
+$this->params['breadcrumbs'][] = Yii::t('product', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/brand/view.php b/backend/views/brand/view.php
new file mode 100644
index 0000000..be314ae
--- /dev/null
+++ b/backend/views/brand/view.php
@@ -0,0 +1,42 @@
+title = $model->brand_id;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Brands'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('product', 'Update'), ['update', 'id' => $model->brand_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('product', 'Delete'), ['delete', 'id' => $model->brand_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'brand_id',
+ 'brand_name_id',
+ 'alias',
+ 'image',
+ 'meta_title',
+ 'meta_desc:ntext',
+ 'meta_robots',
+ 'seo_text:ntext',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/category/_form.php b/backend/views/category/_form.php
new file mode 100644
index 0000000..55c750a
--- /dev/null
+++ b/backend/views/category/_form.php
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+ = $form->field($model, 'name')->textInput() ?>
+
+ = $form->field($model, 'alias')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'parent_id')->dropDownList($categories, [
+ 'prompt' => Yii::t('rubrication', 'Root category'),
+ 'options' => [
+ $model->category_id => ['disabled' => true]
+ ]
+ ])->label(Yii::t('product', 'Parent category')) ?>
+
+ field($model, 'group_to_category')->dropDownList(
+ \yii\helpers\ArrayHelper::map(\common\modules\rubrication\models\TaxGroup::find()->all(), 'tax_group_id', 'name'), [
+ 'multiple' => true
+ ])->label(Yii::t('product', 'Linked options')) ?>
+ */?>
+
+ = $form->field($model, 'group_to_category')->widget(Select2::className(), [
+ 'data' => \yii\helpers\ArrayHelper::map(\common\modules\rubrication\models\TaxGroup::find()->all(), 'tax_group_id', 'name'),
+ 'language' => 'ru',
+ 'options' => [
+ 'placeholder' => 'Linked options',
+ 'multiple' => true,
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true
+ ],
+ ]
+ ) ?>
+
+ = ImageUploader::widget([
+ 'model'=> $model,
+ 'field'=>'image',
+ 'size' => [
+ [
+ 'width'=>340,
+ 'height'=>260,
+ ]
+ ],
+ 'multi'=>false,
+ 'gallery' => $model->image,
+ 'name' => 'Загрузить изображение'
+ ]);
+ ?>
+
+ = $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'meta_desc')->textarea(['rows' => 6]) ?>
+
+ = $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
+
+ = $form->field($model, 'remote_category')->widget(Select2::className(), [
+ 'data' => \yii\helpers\ArrayHelper::map(\common\modules\product\models\RemoteCategories::find()->all(), 'ID', 'Name'),
+ 'language' => 'ru',
+ 'options' => [
+ 'placeholder' => 'Select a remote category',
+ 'multiple' => true,
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true
+ ],
+ ]
+ ) ?>
+
+ depth == 2) :?>
+ = $form->field($model, 'populary')->checkbox() ?>
+
+
+
+ = Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+ isNewRecord) :?>
+ = Html::submitButton(Yii::t('product', 'Create and continue'), ['name' => 'create_and_new', 'class' => 'btn btn-primary']) ?>
+
+
+
+
+
+
diff --git a/backend/views/category/_search.php b/backend/views/category/_search.php
new file mode 100644
index 0000000..2740e88
--- /dev/null
+++ b/backend/views/category/_search.php
@@ -0,0 +1,49 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'category_id') ?>
+
+ = $form->field($model, 'parent_id') ?>
+
+ = $form->field($model, 'path') ?>
+
+ = $form->field($model, 'depth') ?>
+
+ = $form->field($model, 'image') ?>
+
+ field($model, 'meta_title') ?>
+
+ field($model, 'meta_desc') ?>
+
+ field($model, 'meta_robots') ?>
+
+ field($model, 'seo_text') ?>
+
+ field($model, 'category_name_id') ?>
+
+ field($model, 'product_unit_id') ?>
+
+ field($model, 'alias') ?>
+
+
+ = Html::submitButton(Yii::t('product', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('product', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/category/create.php b/backend/views/category/create.php
new file mode 100644
index 0000000..99357a3
--- /dev/null
+++ b/backend/views/category/create.php
@@ -0,0 +1,22 @@
+title = Yii::t('product', 'Create Category');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'categories' => $categories
+ ]) ?>
+
+
diff --git a/backend/views/category/index.php b/backend/views/category/index.php
new file mode 100644
index 0000000..66211a4
--- /dev/null
+++ b/backend/views/category/index.php
@@ -0,0 +1,72 @@
+title = Yii::t('product', 'Categories');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('product', 'Create Category'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+// 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ [
+ 'label'=> Yii::t('product', 'Name'),
+ 'content'=>function($data){
+ $op = [];
+ foreach($data->getParents()->all() as $parent) {
+ $op[] = $parent->name;
+ }
+ $op[] = $data->name;
+ return implode(' → ', $op);
+// return str_repeat('-', $data->depth) .' '. $data->name;
+ }
+ ],
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{view} {update} {delete} {populary}',
+ 'buttons' => [
+ 'populary' => function ($url, $model) {
+ if ($model->depth == 2) {
+ return Html::a('
', $url, [
+ 'title' => Yii::t('product', ($model->populary ? 'Set not populary' : 'Set populary')),
+ ]);
+ }
+ },
+ ],
+ 'urlCreator' => function ($action, $model, $key, $index) {
+ switch ($action) {
+ case 'populary':
+ return \yii\helpers\Url::to(['category/populary', 'id' => $model->category_id]);
+ break;
+ case 'view':
+ return \yii\helpers\Url::to(['category/view', 'id' => $model->category_id]);
+ break;
+ case 'update':
+ return \yii\helpers\Url::to(['category/update', 'id' => $model->category_id]);
+ break;
+ case 'delete':
+ return \yii\helpers\Url::to(['category/delete', 'id' => $model->category_id]);
+ break;
+ }
+ }
+ ],
+ ],
+ 'panel' => [
+ 'type'=>'success',
+ ],
+ ]); ?>
+
diff --git a/backend/views/category/update.php b/backend/views/category/update.php
new file mode 100644
index 0000000..befb58c
--- /dev/null
+++ b/backend/views/category/update.php
@@ -0,0 +1,24 @@
+title = Yii::t('product', 'Update {modelClass}: ', [
+ 'modelClass' => 'Category',
+]) . ' ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->category_id]];
+$this->params['breadcrumbs'][] = Yii::t('product', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'categories' => $categories
+ ]) ?>
+
+
diff --git a/backend/views/category/view.php b/backend/views/category/view.php
new file mode 100644
index 0000000..987a3d4
--- /dev/null
+++ b/backend/views/category/view.php
@@ -0,0 +1,50 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('product', 'Update'), ['update', 'id' => $model->category_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('product', 'Delete'), ['delete', 'id' => $model->category_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+ = Html::a(Yii::t('product', 'Create Category'), ['category/create'], ['class' => 'btn btn-success']) ?>
+ parent_id)) :?>
+ = Html::a(Yii::t('product', 'Create category By {name}', ['name' => $model->parent->name]), ['category/create?parent='. $model->parent->category_id], ['class' => 'btn btn-success']) ?>
+
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'category_id',
+ 'parent_id',
+ 'path',
+ 'depth',
+ 'image',
+ 'meta_title',
+ 'meta_desc:ntext',
+ 'meta_robots',
+ 'seo_text:ntext',
+ 'category_name_id',
+ 'product_unit_id',
+ 'alias',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/event/_form.php b/backend/views/event/_form.php
new file mode 100644
index 0000000..12c30c5
--- /dev/null
+++ b/backend/views/event/_form.php
@@ -0,0 +1,74 @@
+
+
+
diff --git a/backend/views/event/_search.php b/backend/views/event/_search.php
new file mode 100644
index 0000000..c60ba39
--- /dev/null
+++ b/backend/views/event/_search.php
@@ -0,0 +1,49 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'event_id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'alias') ?>
+
+ = $form->field($model, 'body') ?>
+
+ = $form->field($model, 'image') ?>
+
+ field($model, 'meta_title') ?>
+
+ field($model, 'description') ?>
+
+ field($model, 'h1') ?>
+
+ field($model, 'seo_text') ?>
+
+ field($model, 'created_at') ?>
+
+ field($model, 'updated_at') ?>
+
+ field($model, 'end_at') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/event/create.php b/backend/views/event/create.php
new file mode 100644
index 0000000..7909eca
--- /dev/null
+++ b/backend/views/event/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Event');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/event/index.php b/backend/views/event/index.php
new file mode 100644
index 0000000..b87b7b9
--- /dev/null
+++ b/backend/views/event/index.php
@@ -0,0 +1,45 @@
+title = Yii::t('app', 'Events');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Event'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'event_id',
+ 'name',
+ 'alias',
+ [
+ 'format' => 'image',
+ 'attribute'=>'image',
+ ],
+ // 'meta_title',
+ // 'description',
+ // 'h1',
+ // 'seo_text:ntext',
+ // 'created_at',
+ // 'updated_at',
+ // 'end_at',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/event/update.php b/backend/views/event/update.php
new file mode 100644
index 0000000..9009f4d
--- /dev/null
+++ b/backend/views/event/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Event',
+]) . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->event_id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/event/view.php b/backend/views/event/view.php
new file mode 100644
index 0000000..5edd979
--- /dev/null
+++ b/backend/views/event/view.php
@@ -0,0 +1,49 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->event_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->event_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'event_id',
+ 'name',
+ 'alias',
+ 'body:ntext',
+ [
+ 'format' => 'image',
+ 'attribute'=>'image',
+ ],
+ 'meta_title',
+ 'description',
+ 'h1',
+ 'seo_text:ntext',
+ 'created_at',
+ 'updated_at',
+ 'end_at',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/layouts/admin.php b/backend/views/layouts/admin.php
new file mode 100644
index 0000000..98501f4
--- /dev/null
+++ b/backend/views/layouts/admin.php
@@ -0,0 +1,34 @@
+beginContent('@app/views/layouts/main.php');
+?>
+
+ = $this->render('header') ?>
+
+ = $this->render('main-sidebar') ?>
+
+
+
+
+ = Breadcrumbs::widget([
+ 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
+ ]) ?>
+ = Alert::widget() ?>
+
+ = $content; ?>
+
+
+ = $this->render('footer') ?>
+
+
+
+
+ = $this->render('control-sidebar') ?>
+
+
+
+endContent() ?>
\ No newline at end of file
diff --git a/backend/views/layouts/control-sidebar.php b/backend/views/layouts/control-sidebar.php
new file mode 100644
index 0000000..4eb13ba
--- /dev/null
+++ b/backend/views/layouts/control-sidebar.php
@@ -0,0 +1,188 @@
+
\ No newline at end of file
diff --git a/backend/views/layouts/footer.php b/backend/views/layouts/footer.php
new file mode 100644
index 0000000..e66222f
--- /dev/null
+++ b/backend/views/layouts/footer.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/backend/views/layouts/header.php b/backend/views/layouts/header.php
new file mode 100644
index 0000000..9587246
--- /dev/null
+++ b/backend/views/layouts/header.php
@@ -0,0 +1,260 @@
+
\ No newline at end of file
diff --git a/backend/views/layouts/main-sidebar.php b/backend/views/layouts/main-sidebar.php
new file mode 100644
index 0000000..1e6cc3a
--- /dev/null
+++ b/backend/views/layouts/main-sidebar.php
@@ -0,0 +1,76 @@
+
+
\ No newline at end of file
diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php
new file mode 100644
index 0000000..0ef86f0
--- /dev/null
+++ b/backend/views/layouts/main.php
@@ -0,0 +1,34 @@
+
+beginPage() ?>
+
+
+
+
+
+ = Html::csrfMetaTags() ?>
+ = Html::encode($this->title) ?>
+ head() ?>
+
+
+beginBody() ?>
+
+
+ = $content ?>
+
+
+
+endBody() ?>
+
+
+endPage() ?>
diff --git a/backend/views/layouts/none.php b/backend/views/layouts/none.php
new file mode 100644
index 0000000..de536ad
--- /dev/null
+++ b/backend/views/layouts/none.php
@@ -0,0 +1,9 @@
+beginContent('@app/views/layouts/main.php');
+?>
+
+ = $content; ?>
+
+endContent() ?>
\ No newline at end of file
diff --git a/backend/views/orders/_form.php b/backend/views/orders/_form.php
new file mode 100644
index 0000000..fab78b2
--- /dev/null
+++ b/backend/views/orders/_form.php
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+ = $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
+
+ field($model, 'delivery', [
+ ])->radioList([
+ '1' => 'Курьерска доставка по Киеву и области',
+ '2' => 'В любой регион Украины',
+ '3' => 'Самовывоз (бесплатно)',
+ ], [
+ 'item' => function($index, $label, $name, $checked, $value) {
+
+ $return = '
';
+ $return .= Html::radio($name, $checked, ['value' => $value]);
+ $return .= ' ';
+ $return .= '' . ucwords($label) . ' ';
+ $return .= '
';
+
+ return $return;
+ },
+ ]);
+
+
+ ?>
+
+ field($model, 'payment', [
+ ])->radioList([
+ '1' => 'Оплата наличными',
+ '2' => 'Оплата по безналичному расчету. Код ЕГРПОУ',
+ '3' => 'Приват 24',
+ '4' => 'Согласовать с менеджером',
+ ], [
+ 'item' => function ($index, $label, $name, $checked, $value) use ($model) {
+ if($index != 1){
+
+ $return = '
';
+ $return .= Html::radio($name, $checked, ['value' => $value]);
+ $return .= ' ';
+ $return .= '' . ucwords($label) . ' ';
+ $return .= '
';
+
+ return $return;
+ } else {
+
+ $return = '
';
+ $return .= Html::radio($name, $checked, ['value' => $value]);
+ $return .= ' ';
+ $return .= '' . ucwords($label) . ' ';
+ $return .= Html::activeTextInput($model,'code');
+ $return .= '
';
+
+ return $return;
+ }
+
+ },
+ ]);
+
+
+ ?>
+
+ = $form->field($model, 'status')->textInput() ?>
+
+ = $form->field($model, 'created')->widget(DatePicker::classname(), [
+ 'language' => 'ru',
+ 'pluginOptions' => [
+ 'format'=> 'yyyy-mm-d'
+
+ ],
+
+ ]) ?>
+ = $form->field($model, 'updated')->widget(DatePicker::classname(), [
+ 'language' => 'ru',
+ 'pluginOptions' => [
+ 'format'=> 'yyyy-mm-d'
+
+ ],
+
+ ]) ?>
+
+ = $form->field($model, 'orderItems')->widget(MultipleInput::className(), [
+ 'columns' => [
+ [
+ 'name' => 'order_items_id',
+ 'type' => MultipleInputColumn::TYPE_HIDDEN_INPUT,
+ ],
+ [
+ 'name' => 'item_id',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'item id',
+ ],
+ [
+ 'name' => 'item_name',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'name',
+ 'value' => function($data){
+ if($data instanceof OrderItems){
+ return $data->item->product->name .' '. $data->item->name;
+ }
+ },
+ ],
+ [
+ 'name' => 'item_count',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'item count',
+ ],
+ [
+ 'name' => 'price',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'Price',
+ ],
+ ],
+ ]);
+ ?>
+
+
+
+
+ = Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+
+
+
+
+
diff --git a/backend/views/orders/_search.php b/backend/views/orders/_search.php
new file mode 100644
index 0000000..389440f
--- /dev/null
+++ b/backend/views/orders/_search.php
@@ -0,0 +1,45 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'order_id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'email') ?>
+
+ = $form->field($model, 'phone') ?>
+
+ field($model, 'delivery') ?>
+
+ field($model, 'payment') ?>
+
+ field($model, 'code') ?>
+
+ field($model, 'status') ?>
+
+ field($model, 'created_at') ?>
+
+ field($model, 'updated_at') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/orders/create.php b/backend/views/orders/create.php
new file mode 100644
index 0000000..9f99b3e
--- /dev/null
+++ b/backend/views/orders/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Orders');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/orders/index.php b/backend/views/orders/index.php
new file mode 100644
index 0000000..45a82f3
--- /dev/null
+++ b/backend/views/orders/index.php
@@ -0,0 +1,41 @@
+title = Yii::t('app', 'Orders');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Orders'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'order_id',
+ 'name',
+ 'email:email',
+ 'phone',
+ // 'delivery',
+ // 'payment',
+ // 'code',
+ // 'status',
+ // 'created_at',
+ // 'updated_at',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/orders/update.php b/backend/views/orders/update.php
new file mode 100644
index 0000000..f938ee4
--- /dev/null
+++ b/backend/views/orders/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Orders',
+]) . ' ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->order_id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/orders/view.php b/backend/views/orders/view.php
new file mode 100644
index 0000000..3128633
--- /dev/null
+++ b/backend/views/orders/view.php
@@ -0,0 +1,44 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->order_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->order_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'order_id',
+ 'name',
+ 'email:email',
+ 'phone',
+ 'delivery',
+ 'payment',
+ 'code',
+ 'status',
+ 'created_at',
+ 'updated_at',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/page/_form.php b/backend/views/page/_form.php
new file mode 100644
index 0000000..077f1a5
--- /dev/null
+++ b/backend/views/page/_form.php
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+ = $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
+
+ = $form->field($model, 'alias')->textInput(['maxlength' => 250]) ?>
+
+ = $form->field($model, 'title')->textInput(['maxlength' => 250]) ?>
+
+ = $form->field($model, 'body')->widget(CKEditor::className(),
+ [
+ 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
+ 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
+ 'inline' => false, //по умолчанию false]),
+ 'allowedContent' => true,
+ 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
+ ]
+ )
+ ]) ?>
+
+ = $form->field($model, 'meta_title')->textInput(['maxlength' => 250]) ?>
+
+ = $form->field($model, 'description')->textInput(['maxlength' => 250]) ?>
+
+ = $form->field($model, 'h1')->textInput(['maxlength' => 255]) ?>
+
+ = $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
+
+
+ = Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+
+
+
+
+
diff --git a/backend/views/page/_search.php b/backend/views/page/_search.php
new file mode 100644
index 0000000..aa49636
--- /dev/null
+++ b/backend/views/page/_search.php
@@ -0,0 +1,43 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'alias') ?>
+
+ = $form->field($model, 'title') ?>
+
+ = $form->field($model, 'body') ?>
+
+ field($model, 'meta_title') ?>
+
+ field($model, 'description') ?>
+
+ field($model, 'h1') ?>
+
+ field($model, 'seo_text') ?>
+
+
+ = Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/page/create.php b/backend/views/page/create.php
new file mode 100644
index 0000000..f5798f7
--- /dev/null
+++ b/backend/views/page/create.php
@@ -0,0 +1,21 @@
+title = 'Create Page';
+$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/page/index.php b/backend/views/page/index.php
new file mode 100644
index 0000000..d7e5634
--- /dev/null
+++ b/backend/views/page/index.php
@@ -0,0 +1,41 @@
+title = 'Статические страницы';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a('Создать', ['create'], ['class' => 'btn btn-success']) ?>
+
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id',
+ 'name',
+ 'alias',
+ 'title',
+ // 'meta_title',
+ // 'description',
+ // 'h1',
+ // 'seo_text:ntext',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
+
diff --git a/backend/views/page/update.php b/backend/views/page/update.php
new file mode 100644
index 0000000..be6355d
--- /dev/null
+++ b/backend/views/page/update.php
@@ -0,0 +1,21 @@
+title = 'Update Page: ' . ' ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = 'Обновление';
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/page/view.php b/backend/views/page/view.php
new file mode 100644
index 0000000..dda89a5
--- /dev/null
+++ b/backend/views/page/view.php
@@ -0,0 +1,42 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a('Обновить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ =Html::a('Удалить', ['delete', 'id' => $model->id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => 'Вы уверены что хотите удалить этот элемент?',
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'name',
+ 'alias',
+ 'title',
+ 'meta_title',
+ 'description',
+ 'h1',
+ 'seo_text:ntext',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/seo-category/_form.php b/backend/views/seo-category/_form.php
new file mode 100644
index 0000000..ead4d86
--- /dev/null
+++ b/backend/views/seo-category/_form.php
@@ -0,0 +1,27 @@
+
+
+
diff --git a/backend/views/seo-category/_search.php b/backend/views/seo-category/_search.php
new file mode 100644
index 0000000..9f4264f
--- /dev/null
+++ b/backend/views/seo-category/_search.php
@@ -0,0 +1,33 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'seo_category_id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'controller') ?>
+
+ = $form->field($model, 'status') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/seo-category/create.php b/backend/views/seo-category/create.php
new file mode 100644
index 0000000..7729b68
--- /dev/null
+++ b/backend/views/seo-category/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Seo Category');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/seo-category/index.php b/backend/views/seo-category/index.php
new file mode 100644
index 0000000..9e6bda0
--- /dev/null
+++ b/backend/views/seo-category/index.php
@@ -0,0 +1,72 @@
+title = Yii::t('app', 'Seo Categories');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Seo Category'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'seo_category_id',
+ 'name',
+ 'controller',
+ 'status',
+
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{update} {image} {delete}',
+ 'buttons' => [
+ 'update' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['seo-category/update', 'id' => $model->seo_category_id]),
+ [
+ 'title' => "Редактировать",
+ ]
+ );
+ },
+ 'image' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['seo-dynamic/index', 'seo_category_id' => $model->seo_category_id]),
+ [
+ 'title' => "слайды",
+ ]
+ );
+ },
+ 'delete' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['seo-category/delete', 'id' => $model->seo_category_id]),
+ [
+ 'title' => "Удалить",
+ ]
+ );
+ },
+ ],
+ 'contentOptions' => ['style' => 'width: 70px;'],
+ ],
+ ],
+ ]); ?>
+
diff --git a/backend/views/seo-category/update.php b/backend/views/seo-category/update.php
new file mode 100644
index 0000000..34b49fb
--- /dev/null
+++ b/backend/views/seo-category/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Seo Category',
+]) . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->seo_category_id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/seo-category/view.php b/backend/views/seo-category/view.php
new file mode 100644
index 0000000..842e78b
--- /dev/null
+++ b/backend/views/seo-category/view.php
@@ -0,0 +1,38 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_category_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_category_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'seo_category_id',
+ 'name',
+ 'controller',
+ 'status',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/seo-dynamic/_form.php b/backend/views/seo-dynamic/_form.php
new file mode 100644
index 0000000..9f8d22e
--- /dev/null
+++ b/backend/views/seo-dynamic/_form.php
@@ -0,0 +1,41 @@
+
+
+
diff --git a/backend/views/seo-dynamic/_search.php b/backend/views/seo-dynamic/_search.php
new file mode 100644
index 0000000..745abcd
--- /dev/null
+++ b/backend/views/seo-dynamic/_search.php
@@ -0,0 +1,45 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'seo_dynamic_id') ?>
+
+ = $form->field($model, 'seo_category_id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'action') ?>
+
+ = $form->field($model, 'fields') ?>
+
+ field($model, 'title') ?>
+
+ field($model, 'h1') ?>
+
+ field($model, 'description') ?>
+
+ field($model, 'seo_text') ?>
+
+ field($model, 'status') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/seo-dynamic/create.php b/backend/views/seo-dynamic/create.php
new file mode 100644
index 0000000..d71114a
--- /dev/null
+++ b/backend/views/seo-dynamic/create.php
@@ -0,0 +1,22 @@
+title = Yii::t('app', 'Create Seo Dynamic');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Dynamics'), 'url' => Url::toRoute(['index','seo_category_id'=>$seo_category_id])];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/seo-dynamic/index.php b/backend/views/seo-dynamic/index.php
new file mode 100644
index 0000000..991d5eb
--- /dev/null
+++ b/backend/views/seo-dynamic/index.php
@@ -0,0 +1,76 @@
+title = Yii::t('app', 'Seo Dynamics');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Seo Dynamic'), Url::toRoute(['create','seo_category_id'=>$seo_category_id]), ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'seo_dynamic_id',
+ 'seo_category_id',
+ 'name',
+ 'action',
+ 'fields',
+ // 'title',
+ // 'h1',
+ // 'description',
+ // 'seo_text:ntext',
+ // 'status',
+
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'buttons' => [
+ 'view' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['view','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]),
+ [
+ 'title' => "Просмотр",
+ ]
+ );
+ },
+ 'update' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['update','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]),
+ [
+ 'title' => "Редактировать",
+ ]
+ );
+ },
+ 'delete' => function ($url, $model)
+ {
+
+ return Html::a('
', Url::toRoute(['delete','seo_category_id'=> $model->seo_category_id, 'id' => $model->seo_dynamic_id]), [
+ 'title' => Yii::t('yii', 'Delete'),
+ 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'),
+ 'data-method' => 'post',
+ ]);
+
+ },
+ ],
+ ],
+ ],
+ ]); ?>
+
diff --git a/backend/views/seo-dynamic/update.php b/backend/views/seo-dynamic/update.php
new file mode 100644
index 0000000..d43fdfc
--- /dev/null
+++ b/backend/views/seo-dynamic/update.php
@@ -0,0 +1,24 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Seo Dynamic',
+]) . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Dynamics'), 'url' => Url::toRoute(['index','seo_category_id'=>$seo_category_id])];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => Url::toRoute(['view', 'seo_category_id'=>$seo_category_id, 'id' => $model->seo_dynamic_id])];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/seo-dynamic/view.php b/backend/views/seo-dynamic/view.php
new file mode 100644
index 0000000..631b795
--- /dev/null
+++ b/backend/views/seo-dynamic/view.php
@@ -0,0 +1,44 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seo Dynamics'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_dynamic_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_dynamic_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'seo_dynamic_id',
+ 'seo_category_id',
+ 'name',
+ 'action',
+ 'fields',
+ 'title',
+ 'h1',
+ 'description',
+ 'seo_text:ntext',
+ 'status',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/seo/_form.php b/backend/views/seo/_form.php
new file mode 100644
index 0000000..58413b3
--- /dev/null
+++ b/backend/views/seo/_form.php
@@ -0,0 +1,31 @@
+
+
+
diff --git a/backend/views/seo/_search.php b/backend/views/seo/_search.php
new file mode 100644
index 0000000..d3b1fa4
--- /dev/null
+++ b/backend/views/seo/_search.php
@@ -0,0 +1,37 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'seo_id') ?>
+
+ = $form->field($model, 'url') ?>
+
+ = $form->field($model, 'title') ?>
+
+ = $form->field($model, 'description') ?>
+
+ = $form->field($model, 'h1') ?>
+
+ field($model, 'seo_text') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/seo/create.php b/backend/views/seo/create.php
new file mode 100644
index 0000000..fb2601c
--- /dev/null
+++ b/backend/views/seo/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Seo');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/seo/index.php b/backend/views/seo/index.php
new file mode 100644
index 0000000..2937565
--- /dev/null
+++ b/backend/views/seo/index.php
@@ -0,0 +1,37 @@
+title = Yii::t('app', 'Seo');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Seo'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'seo_id',
+ 'url:url',
+ 'title',
+ 'description',
+ 'h1',
+ // 'seo_text:ntext',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/seo/update.php b/backend/views/seo/update.php
new file mode 100644
index 0000000..0cdcc84
--- /dev/null
+++ b/backend/views/seo/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Seo',
+]) . $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->seo_id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/seo/view.php b/backend/views/seo/view.php
new file mode 100644
index 0000000..b98bcb4
--- /dev/null
+++ b/backend/views/seo/view.php
@@ -0,0 +1,40 @@
+title = $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'seo_id',
+ 'url:url',
+ 'title',
+ 'description',
+ 'h1',
+ 'seo_text:ntext',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/service/_form.php b/backend/views/service/_form.php
new file mode 100644
index 0000000..772d197
--- /dev/null
+++ b/backend/views/service/_form.php
@@ -0,0 +1,66 @@
+
+
+
diff --git a/backend/views/service/_search.php b/backend/views/service/_search.php
new file mode 100644
index 0000000..04ba9b1
--- /dev/null
+++ b/backend/views/service/_search.php
@@ -0,0 +1,45 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'service_id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'alias') ?>
+
+ = $form->field($model, 'image') ?>
+
+ field($model, 'meta_title') ?>
+
+ field($model, 'description') ?>
+
+ field($model, 'h1') ?>
+
+ field($model, 'seo_text') ?>
+
+ field($model, 'created_at') ?>
+
+ field($model, 'updated_at') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/service/create.php b/backend/views/service/create.php
new file mode 100644
index 0000000..b84b8fd
--- /dev/null
+++ b/backend/views/service/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Service');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/service/index.php b/backend/views/service/index.php
new file mode 100644
index 0000000..0a25584
--- /dev/null
+++ b/backend/views/service/index.php
@@ -0,0 +1,44 @@
+title = Yii::t('app', 'Services');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Service'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'service_id',
+ 'name',
+ 'alias',
+ [
+ 'format' => 'image',
+ 'attribute'=>'image',
+ ],
+ // 'meta_title',
+ // 'description',
+ // 'h1',
+ // 'seo_text:ntext',
+ // 'created_at',
+ // 'updated_at',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/service/update.php b/backend/views/service/update.php
new file mode 100644
index 0000000..6e0f6ce
--- /dev/null
+++ b/backend/views/service/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Service',
+]) . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->service_id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/service/view.php b/backend/views/service/view.php
new file mode 100644
index 0000000..17eaa9b
--- /dev/null
+++ b/backend/views/service/view.php
@@ -0,0 +1,47 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->service_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->service_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'service_id',
+ 'name',
+ 'alias',
+ [
+ 'format' => 'image',
+ 'attribute'=>'image',
+ ],
+ 'meta_title',
+ 'description',
+ 'h1',
+ 'seo_text:ntext',
+ 'created_at',
+ 'updated_at',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/site/error.php b/backend/views/site/error.php
new file mode 100644
index 0000000..f44c697
--- /dev/null
+++ b/backend/views/site/error.php
@@ -0,0 +1,27 @@
+title = $name;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = nl2br(Html::encode($message)) ?>
+
+
+
+ The above error occurred while the Web server was processing your request.
+
+
+ Please contact us if you think this is a server error. Thank you.
+
+
+
diff --git a/backend/views/site/index.php b/backend/views/site/index.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/backend/views/site/index.php
diff --git a/backend/views/site/login.php b/backend/views/site/login.php
new file mode 100644
index 0000000..2dc571c
--- /dev/null
+++ b/backend/views/site/login.php
@@ -0,0 +1,35 @@
+title = 'Login';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
= Html::encode($this->title) ?>
+
+
Please fill out the following fields to login:
+
+
+
+ 'login-form']); ?>
+
+ = $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'rememberMe')->checkbox() ?>
+
+
+ = Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
+
+
+
+
+
+
diff --git a/backend/views/slider-image/_form.php b/backend/views/slider-image/_form.php
new file mode 100644
index 0000000..399376d
--- /dev/null
+++ b/backend/views/slider-image/_form.php
@@ -0,0 +1,58 @@
+
+
+
diff --git a/backend/views/slider-image/_search.php b/backend/views/slider-image/_search.php
new file mode 100644
index 0000000..d9674e9
--- /dev/null
+++ b/backend/views/slider-image/_search.php
@@ -0,0 +1,41 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'slider_image_id') ?>
+
+ = $form->field($model, 'slider_id') ?>
+
+ = $form->field($model, 'image') ?>
+
+ = $form->field($model, 'alt') ?>
+
+ = $form->field($model, 'title') ?>
+
+ field($model, 'url') ?>
+
+ field($model, 'status') ?>
+
+ field($model, 'sort') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/slider-image/create.php b/backend/views/slider-image/create.php
new file mode 100644
index 0000000..1437321
--- /dev/null
+++ b/backend/views/slider-image/create.php
@@ -0,0 +1,25 @@
+title = Yii::t('app', 'Create Slider Image');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Slider Images'), 'url' => Url::toRoute(['index','slider_id'=>$slider_id])];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'slider' => $slider,
+ ]) ?>
+
+
diff --git a/backend/views/slider-image/index.php b/backend/views/slider-image/index.php
new file mode 100644
index 0000000..b70e57a
--- /dev/null
+++ b/backend/views/slider-image/index.php
@@ -0,0 +1,74 @@
+title = Yii::t('app', 'Slider Images');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Slider Image'), Url::toRoute(['create','slider_id'=>$slider_id]), ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'slider_image_id',
+ 'slider_id',
+ 'image',
+ 'alt',
+ 'title',
+ // 'url:url',
+ // 'status',
+ // 'sort',
+
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'buttons' => [
+ 'view' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['view','slider_id'=> $model->slider_id, 'id' => $model->slider_image_id]),
+ [
+ 'title' => "Просмотр",
+ ]
+ );
+ },
+ 'update' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['update','slider_id'=> $model->slider_id, 'id' => $model->slider_image_id]),
+ [
+ 'title' => "Редактировать",
+ ]
+ );
+ },
+ 'delete' => function ($url, $model)
+ {
+
+ return Html::a('
', Url::toRoute(['delete','slider_id'=> $model->slider_id, 'id' => $model->slider_image_id]), [
+ 'title' => Yii::t('yii', 'Delete'),
+ 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'),
+ 'data-method' => 'post',
+ ]);
+
+ },
+ ],
+ ],
+ ],
+ ]); ?>
+
diff --git a/backend/views/slider-image/update.php b/backend/views/slider-image/update.php
new file mode 100644
index 0000000..e7cf1af
--- /dev/null
+++ b/backend/views/slider-image/update.php
@@ -0,0 +1,27 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Slider Image',
+]) . $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Slider Images'), 'url' => Url::toRoute(['index','slider_id'=>$slider_id])];
+$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => Url::toRoute(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id])];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'slider' => $slider,
+ ]) ?>
+
+
diff --git a/backend/views/slider-image/view.php b/backend/views/slider-image/view.php
new file mode 100644
index 0000000..acb5d99
--- /dev/null
+++ b/backend/views/slider-image/view.php
@@ -0,0 +1,43 @@
+title = $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Slider Images'), 'url' => Url::toRoute(['index','slider_id'=>$slider_id])];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'slider_id'=>$slider_id , 'id' => $model->slider_image_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'slider_image_id',
+ 'slider_id',
+ 'image',
+ 'alt',
+ 'title',
+ 'url:url',
+ 'status',
+ 'sort',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/slider/_form.php b/backend/views/slider/_form.php
new file mode 100644
index 0000000..4ea7c7e
--- /dev/null
+++ b/backend/views/slider/_form.php
@@ -0,0 +1,44 @@
+
+
+
diff --git a/backend/views/slider/_search.php b/backend/views/slider/_search.php
new file mode 100644
index 0000000..7e5731b
--- /dev/null
+++ b/backend/views/slider/_search.php
@@ -0,0 +1,36 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'slider_id') ?>
+
+
+ = $form->field($model, 'speed') ?>
+
+ = $form->field($model, 'duration') ?>
+
+ = $form->field($model, 'title') ?>
+
+ field($model, 'status') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/slider/create.php b/backend/views/slider/create.php
new file mode 100644
index 0000000..852aea0
--- /dev/null
+++ b/backend/views/slider/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Slider');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Sliders'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/slider/index.php b/backend/views/slider/index.php
new file mode 100644
index 0000000..5d3e23e
--- /dev/null
+++ b/backend/views/slider/index.php
@@ -0,0 +1,82 @@
+title = Yii::t('app', 'Sliders');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Slider'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ [
+ 'attribute' => 'slider_id',
+ 'value' => 'slider_id',
+ 'contentOptions' => ['style' => 'width: 70px;'],
+ ],
+ [
+ 'attribute' => 'title',
+ 'value' => 'title',
+ ],
+
+ [
+ 'attribute' => 'status',
+ 'value' => function ($model)
+ {
+ return ($model->status == 0) ? 'Скрыто' : 'Показать';
+ },
+ ],
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{update} {image} {delete}',
+ 'buttons' => [
+ 'update' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['slider/update', 'id' => $model->slider_id]),
+ [
+ 'title' => "Редактировать",
+ ]
+ );
+ },
+ 'image' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['slider-image/index', 'slider_id' => $model->slider_id]),
+ [
+ 'title' => "слайды",
+ ]
+ );
+ },
+ 'delete' => function ($url, $model)
+ {
+ return Html::a (
+ '
',
+ Url::toRoute(['slider/delete', 'id' => $model->slider_id]),
+ [
+ 'title' => "Удалить",
+ ]
+ );
+ },
+ ],
+ 'contentOptions' => ['style' => 'width: 70px;'],
+ ],
+ ],
+ ]); ?>
+
diff --git a/backend/views/slider/update.php b/backend/views/slider/update.php
new file mode 100644
index 0000000..75eb629
--- /dev/null
+++ b/backend/views/slider/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Slider',
+]) . $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Sliders'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->slider_id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/slider/view.php b/backend/views/slider/view.php
new file mode 100644
index 0000000..1f8cb41
--- /dev/null
+++ b/backend/views/slider/view.php
@@ -0,0 +1,39 @@
+title = $model->title;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Sliders'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->slider_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->slider_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'slider_id',
+ 'speed',
+ 'duration',
+ 'title',
+ 'status',
+ ],
+ ]) ?>
+
+
diff --git a/backend/web/.gitignore b/backend/web/.gitignore
new file mode 100644
index 0000000..a6e95c8
--- /dev/null
+++ b/backend/web/.gitignore
@@ -0,0 +1,2 @@
+/index.php
+/index-test.php
diff --git a/backend/web/css/site.css b/backend/web/css/site.css
new file mode 100644
index 0000000..034d162
--- /dev/null
+++ b/backend/web/css/site.css
@@ -0,0 +1,105 @@
+html,
+body {
+ height: 100%;
+}
+
+.wrap {
+ min-height: 100%;
+ height: auto;
+ margin: 0 auto -60px;
+ padding: 0 0 60px;
+}
+
+.wrap > .container {
+ padding: 70px 15px 20px;
+}
+
+.footer {
+ height: 60px;
+ background-color: #f5f5f5;
+ border-top: 1px solid #ddd;
+ padding-top: 20px;
+}
+
+.jumbotron {
+ text-align: center;
+ background-color: transparent;
+}
+
+.jumbotron .btn {
+ font-size: 21px;
+ padding: 14px 24px;
+}
+
+.not-set {
+ color: #c55;
+ font-style: italic;
+}
+
+/* add sorting icons to gridview sort links */
+a.asc:after, a.desc:after {
+ position: relative;
+ top: 1px;
+ display: inline-block;
+ font-family: 'Glyphicons Halflings';
+ font-style: normal;
+ font-weight: normal;
+ line-height: 1;
+ padding-left: 5px;
+}
+
+a.asc:after {
+ content: /*"\e113"*/ "\e151";
+}
+
+a.desc:after {
+ content: /*"\e114"*/ "\e152";
+}
+
+.sort-numerical a.asc:after {
+ content: "\e153";
+}
+
+.sort-numerical a.desc:after {
+ content: "\e154";
+}
+
+.sort-ordinal a.asc:after {
+ content: "\e155";
+}
+
+.sort-ordinal a.desc:after {
+ content: "\e156";
+}
+
+.grid-view td {
+ white-space: nowrap;
+}
+
+.grid-view .filters input,
+.grid-view .filters select {
+ min-width: 50px;
+}
+
+.hint-block {
+ display: block;
+ margin-top: 5px;
+ color: #999;
+}
+
+.error-summary {
+ color: #a94442;
+ background: #fdf7f7;
+ border-left: 3px solid #eed3d7;
+ padding: 10px 20px;
+ margin: 0 0 15px 0;
+}
+
+/* align the logout "link" (button in form) of the navbar */
+.nav > li > form {
+ padding: 8px;
+}
+
+.nav > li > form > button:hover {
+ text-decoration: none;
+}
diff --git a/backend/web/favicon.ico b/backend/web/favicon.ico
new file mode 100644
index 0000000..580ed73
Binary files /dev/null and b/backend/web/favicon.ico differ
diff --git a/backend/web/js/fieldWidget.js b/backend/web/js/fieldWidget.js
new file mode 100644
index 0000000..575b7b5
--- /dev/null
+++ b/backend/web/js/fieldWidget.js
@@ -0,0 +1,24 @@
+$(function(){
+ $.each($('.delete-field-item'), function(index, value) {
+ var container = $(value).parents('.field_list').first();
+ var count = $(container).find('.form-group').length;
+ if(count <= 1) {
+ $(container).find('.delete-field-item').addClass('hidden');
+ }
+ });
+ $(document).on('click', '.delete-field-item', function(){
+ var container = $(this).parents('.field_list').first();
+ $(this).parent('.form-group').remove();
+ var count = $(container).find('.form-group').length;
+ if(count <= 1) {
+ $(container).find('.delete-field-item').addClass('hidden');
+ }
+ });
+ $(document).on('click', '[class*=add_field_w]', function() {
+ var container = $(this).siblings('.field_list').first();
+ var count = $(container).find('.form-group').length;
+ if(count > 1) {
+ $(container).find('.delete-field-item').removeClass('hidden');
+ }
+ });
+});
\ No newline at end of file
diff --git a/backend/web/robots.txt b/backend/web/robots.txt
new file mode 100644
index 0000000..70c2374
--- /dev/null
+++ b/backend/web/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /
diff --git a/codeception.yml b/codeception.yml
new file mode 100644
index 0000000..b2d8613
--- /dev/null
+++ b/codeception.yml
@@ -0,0 +1,21 @@
+actor: Tester
+paths:
+ tests: tests
+ log: tests/_output
+ data: tests/_data
+ support: tests/_support
+ envs: tests/_envs
+settings:
+ bootstrap: _bootstrap.php
+ colors: true
+ memory_limit: 1024M
+extensions:
+ enabled:
+ - Codeception\Extension\RunFailed
+modules:
+ config:
+ Db:
+ dsn: ''
+ user: ''
+ password: ''
+ dump: tests/_data/dump.sql
diff --git a/common/behaviors/RuSlug.php b/common/behaviors/RuSlug.php
new file mode 100644
index 0000000..2185a4d
--- /dev/null
+++ b/common/behaviors/RuSlug.php
@@ -0,0 +1,139 @@
+ 'getSlug'
+ ];
+ }
+
+ public function getSlug( $event )
+ {
+ if ( empty( $this->owner->{$this->out_attribute} ) ) {
+ $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} );
+ } else {
+ $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->out_attribute} );
+ }
+ }
+
+ private function generateSlug( $slug )
+ {
+ $slug = $this->translit( $slug );
+ if ( $this->checkUniqueSlug( $slug ) ) {
+ return $slug;
+ } else {
+ for ( $suffix = 2; !$this->checkUniqueSlug( $new_slug = $slug . '-' . $suffix ); $suffix++ ) {}
+ return $new_slug;
+ }
+ }
+
+ private function slugify( $slug )
+ {
+ if ( $this->translit ) {
+ return yii\helpers\Inflector::slug( TransliteratorHelper::process( $slug ), '-', true );
+ } else {
+ return $this->slug( $slug, '-', true );
+ }
+ }
+
+ private function slug( $string, $replacement = '-', $lowercase = true )
+ {
+ $string = preg_replace( '/[^\p{L}\p{Nd}]+/u', $replacement, $string );
+ $string = trim( $string, $replacement );
+ return $lowercase ? strtolower( $string ) : $string;
+ }
+
+ private function checkUniqueSlug( $slug )
+ {
+ $pk = $this->owner->primaryKey();
+ $pk = $pk[0];
+
+ $condition = $this->out_attribute . ' = :out_attribute';
+ $params = [ ':out_attribute' => $slug ];
+ if ( !$this->owner->isNewRecord ) {
+ $condition .= ' and ' . $pk . ' != :pk';
+ $params[':pk'] = $this->owner->{$pk};
+ }
+
+ return !$this->owner->find()
+ ->where( $condition, $params )
+ ->one();
+ }
+
+ static function translit ($string, $setting = 'all')
+ {
+ $letter = array (
+
+ 'а' => 'a', 'б' => 'b', 'в' => 'v',
+ 'г' => 'g', 'д' => 'd', 'е' => 'e',
+ 'ё' => 'e', 'ж' => 'zh', 'з' => 'z',
+ 'и' => 'i', 'й' => 'y', 'к' => 'k',
+ 'л' => 'l', 'м' => 'm', 'н' => 'n',
+ 'о' => 'o', 'п' => 'p', 'р' => 'r',
+ 'с' => 's', 'т' => 't', 'у' => 'u',
+ 'ф' => 'f', 'х' => 'h', 'ц' => 'c',
+ 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch',
+ 'ь' => "", 'ы' => 'y', 'ъ' => "",
+ 'э' => 'e', 'ю' => 'yu', 'я' => 'ya',
+ 'ї' => 'yi', 'є' => 'ye', 'і' => 'ee',
+
+ 'А' => 'A', 'Б' => 'B', 'В' => 'V',
+ 'Г' => 'G', 'Д' => 'D', 'Е' => 'E',
+ 'Ё' => 'E', 'Ж' => 'Zh', 'З' => 'Z',
+ 'И' => 'I', 'Й' => 'Y', 'К' => 'K',
+ 'Л' => 'L', 'М' => 'M', 'Н' => 'N',
+ 'О' => 'O', 'П' => 'P', 'Р' => 'R',
+ 'С' => 'S', 'Т' => 'T', 'У' => 'U',
+ 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C',
+ 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sch',
+ 'Ь' => "", 'Ы' => 'Y', 'Ъ' => "",
+ 'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya',
+ 'Ї' => 'Yi', 'Є' => 'Ye', 'І' => 'Ee'
+ );
+
+ $symbol = array (
+ ' ' => '-', "'" => '', '"' => '',
+ '!' => '', "@" => '', '#' => '',
+ '$' => '', "%" => '', '^' => '',
+ ';' => '', "*" => '', '(' => '',
+ ')' => '', "+" => '', '~' => '',
+ '.' => '', ',' => '-', '?' => '',
+ '…' => '', '№' => 'N', '°' => '',
+ '`' => '', '|' => '', '&' => '-and-',
+ '<' => '', '>' => ''
+ );
+
+ if ($setting == 'all')
+ {
+ $converter = $letter + $symbol;
+ }
+ else if ($setting == 'letter')
+ {
+ $converter = $letter;
+ }
+ else if ($setting == 'symbol')
+ {
+ $converter = $symbol;
+ }
+
+ $url = strtr ($string, $converter);
+
+ $url = str_replace ("---", '-', $url);
+ $url = str_replace ("--", '-', $url);
+
+ return $url;
+ }
+
+}
\ No newline at end of file
diff --git a/common/behaviors/ShowImage.php b/common/behaviors/ShowImage.php
new file mode 100644
index 0000000..dde9c28
--- /dev/null
+++ b/common/behaviors/ShowImage.php
@@ -0,0 +1,43 @@
+ 'getSlug',
+ ActiveRecord::EVENT_BEFORE_UPDATE=> 'getSlug'
+ ];
+ }
+
+ public function getSlug( $event )
+ {
+ if(!empty($this->owner->{$this->in_attribute})){
+ if ( empty( $this->owner->{$this->out_attribute} ) ) {
+ $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} );
+ } else {
+ $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->out_attribute} );
+ }
+ }
+
+ }
+
+ private function generateSlug( $slug )
+ {
+ $slug = $this->slugify( $slug );
+ if ( $this->checkUniqueSlug( $slug ) ) {
+ return $slug;
+ } else {
+ for ( $suffix = 2; !$this->checkUniqueSlug( $new_slug = $slug . '-' . $suffix ); $suffix++ ) {}
+ return $new_slug;
+ }
+ }
+
+ private function slugify( $slug )
+ {
+ if ( $this->translit ) {
+ return yii\helpers\Inflector::slug( TransliteratorHelper::process( $slug ), '-', true );
+ } else {
+ return $this->slug( $slug, '-', true );
+ }
+ }
+
+ private function slug( $string, $replacement = '-', $lowercase = true )
+ {
+ $string = preg_replace( '/[^\p{L}\p{Nd}]+/u', $replacement, $string );
+ $string = trim( $string, $replacement );
+ return $lowercase ? strtolower( $string ) : $string;
+ }
+
+ private function checkUniqueSlug( $slug )
+ {
+ $pk = $this->owner->primaryKey();
+ $pk = $pk[0];
+
+ $condition = $this->out_attribute . ' = :out_attribute';
+ $params = [ ':out_attribute' => $slug ];
+ if ( !$this->owner->isNewRecord ) {
+ $condition .= ' and ' . $pk . ' != :pk';
+ $params[':pk'] = $this->owner->{$pk};
+ }
+
+ return !$this->owner->find()
+ ->where( $condition, $params )
+ ->one();
+ }
+
+}
\ No newline at end of file
diff --git a/common/components/LangRequest.php b/common/components/LangRequest.php
new file mode 100644
index 0000000..c4682a4
--- /dev/null
+++ b/common/components/LangRequest.php
@@ -0,0 +1,99 @@
+_lang_url === null)
+ {
+ $this->_lang_url = $this->getUrl();
+
+ $url_list = explode ('/', $this->_lang_url);
+
+ $lang_url = isset ($url_list[1]) ? $url_list[1] : null;
+
+ Language::setCurrent($lang_url);
+
+ if ($lang_url !== null && $lang_url === Language::getCurrent()->language_code
+ && strpos($this->_lang_url, Language::getCurrent()->language_code) === 1)
+ {
+ $this->_lang_url = substr ($this->_lang_url, strlen (Language::getCurrent()->language_code) + 1);
+ }
+ }
+
+ return $this->_lang_url;
+ }
+
+ protected function resolvePathInfo()
+ {
+ $pathInfo = $this->getLangUrl();
+
+ if (($pos = strpos ($pathInfo, '?')) !== false)
+ {
+ $pathInfo = substr ($pathInfo, 0, $pos);
+ }
+
+ $pathInfo = urldecode ($pathInfo);
+
+ // try to encode in UTF8 if not so
+ // http://w3.org/International/questions/qa-forms-utf-8.html
+ if (! preg_match ('%^(?:
+ [\x09\x0A\x0D\x20-\x7E] # ASCII
+ | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
+ | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
+ | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
+ | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
+ | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
+ | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
+ | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
+ )*$%xs', $pathInfo)
+ )
+ {
+ $pathInfo = utf8_encode($pathInfo);
+ }
+
+ $scriptUrl = $this->getScriptUrl();
+
+ $baseUrl = $this->getBaseUrl();
+
+ if (strpos($pathInfo, $scriptUrl) === 0)
+ {
+ $pathInfo = substr($pathInfo, strlen($scriptUrl));
+ }
+ else if ($baseUrl === '' || strpos($pathInfo, $baseUrl) === 0)
+ {
+ $pathInfo = substr($pathInfo, strlen($baseUrl));
+ }
+ elseif (isset ($_SERVER['PHP_SELF']) && strpos ($_SERVER['PHP_SELF'], $scriptUrl) === 0)
+ {
+ $pathInfo = substr($_SERVER['PHP_SELF'], strlen($scriptUrl));
+ }
+ else
+ {
+ throw new InvalidConfigException('Unable to determine the path info of the current request.');
+ }
+
+ if ($pathInfo[0] === '/')
+ {
+ $pathInfo = substr ($pathInfo, 1);
+ }
+
+ return (string) $pathInfo;
+ }
+}
\ No newline at end of file
diff --git a/common/components/LangUrlManager.php b/common/components/LangUrlManager.php
new file mode 100644
index 0000000..cc6fd09
--- /dev/null
+++ b/common/components/LangUrlManager.php
@@ -0,0 +1,37 @@
+is_default == 1 ? $url : '/'.$lang_code->lang_code.$url);
+ }
+}
\ No newline at end of file
diff --git a/common/components/Mailer.php b/common/components/Mailer.php
new file mode 100644
index 0000000..d150fe0
--- /dev/null
+++ b/common/components/Mailer.php
@@ -0,0 +1,43 @@
+IsSMTP();
+
+ $mail->CharSet = 'UTF-8';
+ $mail->Username = "dockdep@gmail.com";
+ $mail->Password = "k0l0b04eg";
+ $mail->SetFrom('dockdep@gmail.com');
+ $mail->Subject = $this->subject;
+ $mail->MsgHTML($this->text);
+ $address = "dockdep@gmail.com";
+ $mail->AddAddress($address);
+ if(!$mail->send()) {
+ \Yii::$app->getSession()->setFlash('error', 'Mailer Error: ' . $mail->ErrorInfo);
+ return 'Mailer Error: ' . $mail->ErrorInfo;
+ } else {
+ \Yii::$app->getSession()->setFlash('success', 'Мастер-приемщик свяжется с вами в ближайшее время');
+ return 'Message has been sent';
+ }
+ }
+
+}
+
diff --git a/common/components/Request.php b/common/components/Request.php
new file mode 100644
index 0000000..c6c47a8
--- /dev/null
+++ b/common/components/Request.php
@@ -0,0 +1,40 @@
+web, "", parent::getBaseUrl()) . $this->adminUrl;
+
+ }
+
+
+
+ public function resolvePathInfo()
+
+ {
+
+ if ($this->getUrl() === $this->adminUrl) {
+
+ return "";
+
+ } else {
+
+ return parent::resolvePathInfo();
+
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/ArtboxTreeBehavior.php b/common/components/artboxtree/ArtboxTreeBehavior.php
new file mode 100644
index 0000000..8774aa1
--- /dev/null
+++ b/common/components/artboxtree/ArtboxTreeBehavior.php
@@ -0,0 +1,445 @@
+ $keyNameDepth;
+ public $primaryKeyMode = true;
+
+ /**
+ * @var string
+ */
+ public $delimiter = '|';
+
+ /**
+ * @var ActiveRecord|self|null
+ */
+ protected $entity;
+
+ /**
+ * @param ActiveRecord $owner
+ * @throws Exception
+ */
+ public function attach($owner)
+ {
+ parent::attach($owner);
+ if ($this->keyNameId === null) {
+ $primaryKey = $owner->primaryKey();
+ if (!isset($primaryKey[0])) {
+ throw new Exception('"' . $owner->className() . '" must have a primary key.');
+ }
+ $this->keyNameId = $primaryKey[0];
+ }
+ }
+
+ public function events()
+ {
+ return [
+ // @todo Use beforeSave for automatic set MP-params
+ ActiveRecord::EVENT_BEFORE_UPDATE => 'beforeUpdate',
+ ActiveRecord::EVENT_AFTER_INSERT => 'afterInsert',
+ ];
+ }
+
+ /*
+ * Main methods
+ */
+
+ /*
+ * get one parent
+ * use AL-method
+ */
+ public function getParent() {
+ return $this->getParentAL();
+ }
+
+ /*
+ * get all parents
+ * use MP-method
+ */
+ public function getParents() {
+ return $this->getParentsMP();
+ }
+
+ /*
+ * get one-level children items
+ * use AL-method
+ */
+ public function getChildren() {
+ return $this->getChildrenAL();
+ }
+
+ /*
+ * get all-level children items
+ * use MP-method
+ */
+ public function getAllChildren($depth = null, $where = [], $with = null) {
+ return $this->getAllChildrenMP($depth, $where, $with);
+ }
+
+ /*
+ * get all-level children items
+ * use MP-method
+ */
+ public function getAllChildrenTree($depth = null, $where = [], $with = null) {
+ $query = $this->getAllChildrenMP($depth, $where, $with);
+ return $this->buildTree($query->all(), $this->owner->getAttribute($this->keyNameId));
+ }
+
+ // @todo Check algorytm
+ public function buildTree(array $data, $parentId = 0) {
+ $result = [];
+ foreach ($data as $key => $element) {
+ if ($element->getAttribute($this->keyNameParentId) == $parentId) {
+ unset($data[$key]);
+ $children = $this->buildTree($data, $element->getAttribute($this->keyNameId));
+ $result[] = [
+ 'item' => $element,
+ 'children' => $children
+ ];
+ }
+ }
+ return $result;
+ }
+
+
+ /*
+ * ================================
+ * MP-methods
+ * ================================
+ */
+
+ /*
+ * Full-path (use MP-method)
+ */
+ public function getParentsMP($depth = null) {
+ $tableName = $this->owner->tableName();
+ $path = $this->owner->getAttribute($this->keyNamePath);
+ $query = $this->owner->find()
+ ->andWhere(['<@', "{$tableName}.[[{$this->keyNamePath}]]", $path]);
+ if ($depth > 0) {
+ $query->andWhere(['>=', "{$tableName}.[[{$this->keyNameDepth}]]", $this->owner->getAttribute($this->keyNameDepth) - $depth]);
+ }
+ $query->andWhere(['<', "{$tableName}.[[{$this->keyNameDepth}]]", $this->owner->getAttribute($this->keyNameDepth)]);
+
+ $orderBy = [];
+ $orderBy["{$tableName}.[[{$this->keyNameDepth}]]"] = SORT_ASC;
+ $orderBy["{$tableName}.[[{$this->keyNameId}]]"] = SORT_ASC;
+
+ $query
+ ->andWhere($this->groupWhere())
+ ->addOrderBy($orderBy);
+ $query->multiple = true;
+
+ return $query;
+ }
+ /*public function getParentsMP($depth = null) {
+ $path = $this->getParentPath();
+ if ($path !== null) {
+ $paths = explode(',', trim($path, '{}'));
+ if (!$this->primaryKeyMode) {
+ $path = null;
+ $paths = array_map(
+ function ($value) use (&$path) {
+ return $path = ($path !== null ? $path . ',' : '') . $value;
+ },
+ $paths
+ );
+ }
+ if ($depth !== null) {
+ $paths = array_slice($paths, -$depth);
+ }
+ } else {
+ $paths = [];
+ }
+
+ $tableName = $this->owner->tableName();
+ if ($this->primaryKeyMode) {
+ $condition[] = ["{$tableName}.[[{$this->keyNameId}]]" => $paths];
+ } else {
+ $condition[] = ["{$tableName}.[[{$this->keyNamePath}]]" => $paths];
+ }
+
+ $query = $this->owner->find()
+ ->andWhere($condition)
+ ->andWhere($this->groupWhere())
+ ->addOrderBy(["{$tableName}.[[{$this->keyNamePath}]]" => SORT_ASC]);
+ $query->multiple = true;
+
+ return $query;
+ }*/
+
+ /**
+ * @param bool $asArray = false
+ * @return null|string|array
+ */
+ public function getParentPath($asArray = false)
+ {
+ return static::getParentPathInternal($this->owner->getAttribute($this->keyNamePath), $asArray);
+ }
+ /**
+ * @return array
+ */
+ protected function groupWhere()
+ {
+ $tableName = $this->owner->tableName();
+ if ($this->keyNameGroup === null) {
+ return [];
+ } else {
+ return ["{$tableName}.[[{$this->keyNameGroup}]]" => $this->owner->getAttribute($this->keyNameGroup)];
+ }
+ }
+
+
+ public function getAllChildrenMP($depth = null, $where = [], $with = null)
+ {
+ $tableName = $this->owner->tableName();
+ $path = $this->owner->getAttribute($this->keyNamePath);
+ $query = $this->owner->find()
+ ->andWhere(['@>', "{$tableName}.[[{$this->keyNamePath}]]", $path]);
+
+ if ($depth > 0) {
+ $query->andWhere(['<=', "{$tableName}.[[{$this->keyNameDepth}]]", $this->owner->getAttribute($this->keyNameDepth) + $depth]);
+ }
+
+ $orderBy = [];
+ $orderBy["{$tableName}.[[{$this->keyNameDepth}]]"] = SORT_ASC;
+ $orderBy["{$tableName}.[[{$this->keyNameId}]]"] = SORT_ASC;
+
+ if ($where) {
+ $query->andWhere($where);
+ }
+ if ($with) {
+ $query->with($with);
+ }
+
+ $query
+ ->andWhere($this->groupWhere())
+ ->addOrderBy($orderBy);
+ $query->multiple = true;
+
+ return $query;
+ }
+
+ /*
+ * ================================
+ * AL methods
+ * ================================
+ */
+
+ /*
+ * Parent entity (use AL-method)
+ * @return \yii\db\ActiveRecord
+ */
+ public function getParentAL() {
+ $parent_id = $this->owner->getAttribute($this->keyNameParentId);
+ if (empty($parent_id))
+ return null;
+
+ $where = [$this->keyNameId => $parent_id];
+ if ($this->keyNameGroup) {
+ $where[$this->keyNameGroup] = $this->owner->getAttribute($this->keyNameGroup);
+ }
+
+ return $this->owner->find()->where($where)->one();
+ }
+
+ /*
+ * Get parents by AL-method
+ * @return array
+ */
+ public function getParentsAL() {
+ $parent_id = $this->owner->getAttribute($this->keyNameParentId);
+ if ($parent_id == 0) {
+ return [];
+ }
+
+ $parent = $this->owner;
+ $parents = [];
+ while(true) {
+ $parent = $parent->getParentAL();
+ if (is_null($parent))
+ break;
+ $parents[] = $parent;
+ }
+
+ return array_reverse($parents);
+ }
+
+ /*
+ * Children entities (one-step) (use AL-method)
+ * @return ActiveQuery
+ */
+ public function getChildrenAL() {
+ $where = [$this->keyNameParentId => $this->owner->getAttribute($this->keyNameId)];
+ if ($this->keyNameGroup) {
+ $where[$this->keyNameGroup] = $this->owner->getAttribute($this->keyNameGroup);
+ }
+ return $this->owner->find()->where($where);
+ }
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * @param array $changedAttributes
+ * @throws Exception
+ */
+ protected function _rebuildChildren($changedAttributes)
+ {
+ $path = isset($changedAttributes[$this->keyNamePath]) ? $changedAttributes[$this->keyNamePath] : $this->owner->getAttribute($this->keyNamePath);
+ $update = [];
+ $condition = [
+ 'and',
+ ['@>', "[[{$this->keyNamePath}]]", $path, false],
+ ];
+ if ($this->keyNameGroup !== null) {
+ $group = isset($changedAttributes[$this->keyNameGroup]) ? $changedAttributes[$this->keyNameGroup] : $this->owner->getAttribute($this->keyNameGroup);
+ $condition[] = [$this->keyNameGroup => $group];
+ }
+ $params = [];
+
+ if (isset($changedAttributes[$this->keyNamePath])) {
+ $substringExpr = $this->substringExpression(
+ "[[{$this->keyNamePath}]]",
+ 'array_length(:pathOld) + 1',
+ "array_length([[{$this->keyNamePath}]]) - array_length(:pathOld)"
+ );
+ $update[$this->keyNamePath] = new Expression($this->concatExpression([':pathNew', $substringExpr]));
+ $params[':pathOld'] = $path;
+ $params[':pathNew'] = $this->owner->getAttribute($this->keyNamePath);
+ }
+
+ if ($this->keyNameGroup !== null && isset($changedAttributes[$this->keyNameGroup])) {
+ $update[$this->keyNameGroup] = $this->owner->getAttribute($this->keyNameGroup);
+ }
+
+ if ($this->keyNameDepth !== null && isset($changedAttributes[$this->keyNameDepth])) {
+ $delta = $this->owner->getAttribute($this->keyNameDepth) - $changedAttributes[$this->keyNameDepth];
+ $update[$this->keyNameDepth] = new Expression("[[{$this->keyNameDepth}]]" . sprintf('%+d', $delta));
+ }
+ if (!empty($update)) {
+ $this->owner->updateAll($update, $condition, $params);
+ }
+ }
+
+ /**
+ * @param string $path
+ * @param string $delimiter
+ * @param bool $asArray = false
+ * @return null|string|array
+ */
+ protected static function getParentPathInternal($path, $asArray = false)
+ {
+ $path = explode(',', trim($path, '{}'));
+ array_pop($path);
+ if ($asArray) {
+ return $path;
+ }
+ return count($path) > 0 ? implode(',', $path) : null;
+ }
+
+ protected function toLike($path) {
+ return strtr($path . ',', ['%' => '\%', '_' => '\_', '\\' => '\\\\']) . '%';
+ }
+
+ protected function concatExpression($items)
+ {
+ if ($this->owner->getDb()->driverName === 'sqlite' || $this->owner->getDb()->driverName === 'pgsql') {
+ return implode(' || ', $items);
+ }
+ return 'CONCAT(' . implode(',', $items) . ')';
+ }
+
+ protected function substringExpression($string, $from, $length)
+ {
+ if ($this->owner->getDb()->driverName === 'sqlite') {
+ return "SUBSTR({$string}, {$from}, {$length})";
+ }
+ return "SUBSTRING({$string}, {$from}, {$length})";
+ }
+
+ // =======================================================
+ public function afterInsert() {
+ $this->withSave();
+ $this->owner->updateAttributes([$this->keyNamePath => $this->owner->getAttribute($this->keyNamePath), $this->keyNameDepth => $this->owner->getAttribute($this->keyNameDepth)]);
+ }
+
+ public function beforeUpdate()
+ {
+ if ($this->owner->getIsNewRecord()) {
+ throw new NotSupportedException('Method "' . $this->owner->className() . '::insert" is not supported for inserting new entitys.');
+ }
+ $this->withSave();
+ }
+
+ protected function withSave() {
+ $id = $this->owner->getAttribute($this->keyNameId);
+ $parent_id = $this->owner->getAttribute($this->keyNameParentId);
+
+ if (is_null($parent_id)) {
+ $parent_id = 0;
+ }
+
+ // check parent_id value is changed!
+ /*if ($this->owner->getOldAttribute($this->keyNameParentId) == $parent_id) {
+ return;
+ }*/
+
+ // rebuild parents entities
+ if ($parent_id == 0) {
+ $depth = 0;
+ $path = [intval($id)];
+ } else {
+ $parents = $this->getParentsAL();
+ $path = [];
+ $depth = 0;
+ foreach ($parents as $entity) {
+ $path[] = $entity->getAttribute($this->keyNameId);
+ $depth++;
+ }
+ $path[] = intval($id);
+ }
+
+ $path = '{'. implode(',', $path) .'}';
+
+ // rebuild children entities (recurcive)
+// $this->_rebuildChildren([
+// $this->keyNamePath => $path
+// ]);
+
+ $this->owner->setAttribute($this->keyNamePath, $path);
+// $this->owner->setAttribute($this->keyNamePath, $path);
+ $this->owner->setAttribute($this->keyNameDepth, $depth);
+ }
+
+ public function _recursiveRebuildChildren() {
+ $children = $this->getChildrenAL()->all();
+ $root_path = explode(',', $this->owner->getAttribute($this->keyNamePath));
+ $root_depth = $this->owner->getAttribute($this->keyNameDepth);
+
+ /** @var $child ActiveRecord */
+ foreach ($children as $child) {
+ $path = $root_path;
+ $path[] = $child->getAttribute($this->keyNameId);
+ $depth = $root_depth + 1;
+
+ $child->_recursiveRebuildChildren();
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/ArtboxTreeHelper.php b/common/components/artboxtree/ArtboxTreeHelper.php
new file mode 100644
index 0000000..26877e7
--- /dev/null
+++ b/common/components/artboxtree/ArtboxTreeHelper.php
@@ -0,0 +1,47 @@
+depth+1) . $value;
+ $result[$key] = $row;
+ if (!empty($item['children'])) {
+ self::_recursiveTreeMap($result, $item['children'], $from, $to, $symbol);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/ArtboxTreeQueryTrait.php b/common/components/artboxtree/ArtboxTreeQueryTrait.php
new file mode 100644
index 0000000..048c359
--- /dev/null
+++ b/common/components/artboxtree/ArtboxTreeQueryTrait.php
@@ -0,0 +1,96 @@
+modelClass;
+ self::$model = new $class;
+ }
+ return self::$model;
+ }
+
+ public function getTree($group = null, $with = null) {
+ $model = $this->getModel();
+ if ($group !== null) {
+ $this->andWhere([$model->keyNameGroup => $group]);
+ }
+ if ($with) {
+ $this->with($with);
+ }
+ $data = $this->all();
+ if (empty($data))
+ return [];
+
+ return $this->buildTree($data);
+ }
+
+ private function _recursiveRebuild($tree, $parentPath = null, $depth = 0) {
+ $model = $this->getModel();
+
+ foreach ($tree as $row) {
+ $path = (is_null($parentPath) ? '' : $parentPath . $model->delimiter) . $row['item']->getAttribute($model->keyNameId);
+ $row['item']->setAttribute($model->keyNamePath, $path);
+ $row['item']->setAttribute($model->keyNameDepth, $depth);
+ $row['item']->save();
+ if (!empty($row['children'])) {
+ $this->_recursiveRebuild($row['children'], $path, $depth+1);
+ }
+ }
+ }
+
+ /**
+ * @param int $group
+ */
+ public function rebuildMP($group, $with = null) {
+ $tree = $this->getTree($group, $with);
+
+ $this->_recursiveRebuild($tree);
+ }
+
+ protected function buildTree(array $data, $parentId = 0) {
+ $model = $this->getModel();
+
+ $result = [];
+ foreach ($data as $element) {
+ if ($element[$model->keyNameParentId] == $parentId) {
+ $children = $this->buildTree($data, $element[$model->keyNameId]);
+ $result[] = [
+ 'item' => $element,
+ 'children' => $children
+ ];
+ }
+ }
+ return $result;
+ }
+
+ public function normalizeTreeData(array $data, $parentId = null)
+ {
+ $model = $this->getModel();
+
+ $result = [];
+ foreach ($data as $element) {
+ if ($element[$model->keyNameParentId] == $parentId) {
+ $result[] = $element;
+ $children = $this->normalizeTreeData($data, $element[$model->keyNameId]);
+ if ($children) {
+ $result = array_merge($result, $children);
+ }
+ }
+ }
+ return $result;
+ }
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/ArtboxTreeWidget.php b/common/components/artboxtree/ArtboxTreeWidget.php
new file mode 100644
index 0000000..4e74c5e
--- /dev/null
+++ b/common/components/artboxtree/ArtboxTreeWidget.php
@@ -0,0 +1,138 @@
+dataProvider === null) {
+ throw new InvalidConfigException('The "dataProvider" property must be set.');
+ }
+ if ($this->keyNameId === null) {
+ throw new InvalidConfigException('The "keyNameId" property must be set.');
+ }
+ if ($this->formatter == null) {
+ $this->formatter = Yii::$app->getFormatter();
+ } elseif (is_array($this->formatter)) {
+ $this->formatter = Yii::createObject($this->formatter);
+ }
+ if (!$this->formatter instanceof Formatter) {
+ throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.');
+ }
+ }
+
+ /**
+ * Runs the widget.
+ */
+ public function run()
+ {
+ if (!empty($this->assetBundle) && class_exists($this->assetBundle)) {
+ $view = $this->getView();
+ $assetBundle = $this->assetBundle;
+ $assetBundle::register($view);
+ }
+ if ($this->dataProvider->getCount() == 0) {
+ return $this->renderEmptyResult();
+ }
+
+ parent::run();
+ }
+
+ protected function renderEmptyResult() {
+ return empty($this->emptyResult) ? Yii::t('artbox', 'TreeViewEmptyResult') : Yii::t('artbox', $this->emptyResult);
+ }
+
+ /**
+ * Normalize tree data
+ * @param array $data
+ * @param string $parentId
+ * @return array
+ */
+ protected function _normalizeTreeData(array $data, $parentId = null) {
+ $result = [];
+ foreach ($data as $element) {
+ if ($element[$this->keyNameParentId] == $parentId) {
+ $result[] = $element;
+ $children = $this->_normalizeTreeData($data, $element[$this->keyNameId]);
+ if ($children) {
+ $result = array_merge($result, $children);
+ }
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Hierarchy tree data
+ * @param array $data
+ * @param string $parentId
+ * @return array
+ */
+ protected function _hierarchyTreeData(array $data, $parentId = null) {
+ $result = [];
+ foreach ($data as $element) {
+ if ($element[$this->keyNameParentId] == $parentId) {
+ $children = $this->_hierarchyTreeData($data, $element[$this->keyNameId]);
+ $result[] = [
+ 'item' => $element,
+ 'children' => $children
+ ];
+ }
+ }
+ return $result;
+ }
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/treegrid/TreeGridColumn.php b/common/components/artboxtree/treegrid/TreeGridColumn.php
new file mode 100644
index 0000000..5474766
--- /dev/null
+++ b/common/components/artboxtree/treegrid/TreeGridColumn.php
@@ -0,0 +1,250 @@
+
+ */
+class TreeGridColumn extends Object {
+
+ /**
+ * @var TreeGrid the grid view object that owns this column.
+ */
+ public $grid;
+
+ /**
+ * @var string the header cell content. Note that it will not be HTML-encoded.
+ */
+ public $header;
+
+ /**
+ * @var string the footer cell content. Note that it will not be HTML-encoded.
+ */
+ public $footer;
+
+ /**
+ * @var callable This is a callable that will be used to generate the content of each cell.
+ * The signature of the function should be the following: `function ($model, $key, $index, $column)`.
+ * Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
+ * and `$column` is a reference to the [[TreeColumn]] object.
+ */
+ public $content;
+
+ /**
+ * @var boolean whether this column is visible. Defaults to true.
+ */
+ public $visible = true;
+
+ /**
+ * @var array the HTML attributes for the column group tag.
+ * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
+ */
+ public $options = [];
+
+ /**
+ * @var array the HTML attributes for the header cell tag.
+ * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
+ */
+ public $headerOptions = [];
+
+ /**
+ * @var array|\Closure the HTML attributes for the data cell tag. This can either be an array of
+ * attributes or an anonymous function ([[Closure]]) that returns such an array.
+ * The signature of the function should be the following: `function ($model, $key, $index, $column)`.
+ * Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
+ * and `$column` is a reference to the [[Column]] object.
+ * A function may be used to assign different attributes to different rows based on the data in that row.
+ *
+ * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
+ */
+ public $contentOptions = [];
+
+ /**
+ * @var array the HTML attributes for the footer cell tag.
+ * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
+ */
+ public $footerOptions = [];
+
+ /**
+ * @var string the attribute name associated with this column. When neither [[content]] nor [[value]]
+ * is specified, the value of the specified attribute will be retrieved from each data model and displayed.
+ *
+ * Also, if [[label]] is not specified, the label associated with the attribute will be displayed.
+ */
+ public $attribute;
+
+ /**
+ * @var string label to be displayed in the [[header|header cell]] and also to be used as the sorting
+ * link label when sorting is enabled for this column.
+ * If it is not set and the models provided by the GridViews data provider are instances
+ * of [[\yii\db\ActiveRecord]], the label will be determined using [[\yii\db\ActiveRecord::getAttributeLabel()]].
+ * Otherwise [[\yii\helpers\Inflector::camel2words()]] will be used to get a label.
+ */
+ public $label;
+
+ /**
+ * @var boolean whether the header label should be HTML-encoded.
+ * @see label
+ */
+ public $encodeLabel = true;
+
+ /**
+ * @var string|\Closure an anonymous function or a string that is used to determine the value to display in the current column.
+ *
+ * If this is an anonymous function, it will be called for each row and the return value will be used as the value to
+ * display for every data model. The signature of this function should be: `function ($model, $key, $index, $column)`.
+ * Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
+ * and `$column` is a reference to the [[DataColumn]] object.
+ *
+ * You may also set this property to a string representing the attribute name to be displayed in this column.
+ * This can be used when the attribute to be displayed is different from the [[attribute]] that is used for
+ * sorting and filtering.
+ *
+ * If this is not set, `$model[$attribute]` will be used to obtain the value, where `$attribute` is the value of [[attribute]].
+ */
+ public $value;
+
+ /**
+ * @var string|array in which format should the value of each data model be displayed as (e.g. `"raw"`, `"text"`, `"html"`,
+ * `['date', 'php:Y-m-d']`). Supported formats are determined by the [[GridView::formatter|formatter]] used by
+ * the [[GridView]]. Default format is "text" which will format the value as an HTML-encoded plain text when
+ * [[\yii\i18n\Formatter]] is used as the [[GridView::$formatter|formatter]] of the GridView.
+ */
+ public $format = 'text';
+
+ /**
+ * Renders the header cell.
+ */
+ public function renderHeaderCell()
+ {
+ return Html::tag('th', $this->renderHeaderCellContent(), $this->headerOptions);
+ }
+
+ /**
+ * Renders the footer cell.
+ */
+ public function renderFooterCell()
+ {
+ return Html::tag('td', $this->renderFooterCellContent(), $this->footerOptions);
+ }
+
+ /**
+ * Renders a data cell.
+ * @param mixed $model the data model being rendered
+ * @param mixed $key the key associated with the data model
+ * @param integer $index the zero-based index of the data item among the item array returned by [[GridView::dataProvider]].
+ * @return string the rendering result
+ */
+ public function renderDataCell($model, $key, $index, $is_first = false, $symbol = '–')
+ {
+ if ($this->contentOptions instanceof Closure) {
+ $options = call_user_func($this->contentOptions, $model, $key, $index, $this);
+ } else {
+ $options = $this->contentOptions;
+ }
+ return Html::tag('td', ($is_first ? str_repeat($symbol, $model->depth) : '') . $this->renderDataCellContent($model, $key, $index), $options);
+ }
+
+ /**
+ * Renders the header cell content.
+ * The default implementation simply renders [[header]].
+ * This method may be overridden to customize the rendering of the header cell.
+ * @return string the rendering result
+ */
+ protected function renderHeaderCellContent()
+ {
+ if ($this->header !== null || $this->label === null && $this->attribute === null) {
+ return trim($this->header) !== '' ? $this->header : $this->grid->emptyCell;
+ }
+
+ $provider = $this->grid->dataProvider;
+
+ if ($this->label === null) {
+ if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) {
+ /* @var $model Model */
+ $model = new $provider->query->modelClass;
+ $label = $model->getAttributeLabel($this->attribute);
+ } else {
+ $models = $provider->getModels();
+ if (($model = reset($models)) instanceof Model) {
+ /* @var $model Model */
+ $label = $model->getAttributeLabel($this->attribute);
+ } else {
+ $label = Inflector::camel2words($this->attribute);
+ }
+ }
+ } else {
+ $label = $this->label;
+ }
+
+ return $this->encodeLabel ? Html::encode($label) : $label;
+ }
+
+ /**
+ * Renders the footer cell content.
+ * The default implementation simply renders [[footer]].
+ * This method may be overridden to customize the rendering of the footer cell.
+ * @return string the rendering result
+ */
+ protected function renderFooterCellContent()
+ {
+ return trim($this->footer) !== '' ? $this->footer : $this->grid->emptyCell;
+ }
+
+ /**
+ * Renders the data cell content.
+ * @param mixed $model the data model
+ * @param mixed $key the key associated with the data model
+ * @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
+ * @return string the rendering result
+ */
+ protected function renderDataCellContent($model, $key, $index)
+ {
+ if ($this->content === null) {
+ return $this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format);
+ } else {
+ if ($this->content !== null) {
+ return call_user_func($this->content, $model, $key, $index, $this);
+ } else {
+ return $this->grid->emptyCell;
+ }
+ }
+
+
+ }
+
+ /**
+ * Returns the data cell value.
+ * @param mixed $model the data model
+ * @param mixed $key the key associated with the data model
+ * @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
+ * @return string the data cell value
+ */
+ public function getDataCellValue($model, $key, $index)
+ {
+ if ($this->value !== null) {
+ if (is_string($this->value)) {
+ return ArrayHelper::getValue($model, $this->value);
+ } else {
+ return call_user_func($this->value, $model, $key, $index, $this);
+ }
+ } elseif ($this->attribute !== null) {
+ return ArrayHelper::getValue($model, $this->attribute);
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/treegrid/TreeGridWidget.php b/common/components/artboxtree/treegrid/TreeGridWidget.php
new file mode 100644
index 0000000..9996437
--- /dev/null
+++ b/common/components/artboxtree/treegrid/TreeGridWidget.php
@@ -0,0 +1,277 @@
+ 'table table-striped table-bordered'];
+
+ /**
+ * @var array The plugin options
+ */
+ public $pluginOptions = [];
+
+ /**
+ * @var boolean whether to show the grid view if [[dataProvider]] returns no data.
+ */
+ public $showOnEmpty = true;
+
+ public $rowOptions = [];
+
+ /**
+ * @var Closure an anonymous function that is called once BEFORE rendering each data model.
+ * It should have the similar signature as [[rowOptions]]. The return result of the function
+ * will be rendered directly.
+ */
+ public $beforeRow;
+
+ /**
+ * @var Closure an anonymous function that is called once AFTER rendering each data model.
+ * It should have the similar signature as [[rowOptions]]. The return result of the function
+ * will be rendered directly.
+ */
+ public $afterRow;
+
+ /**
+ * @var boolean whether to show the header section of the grid table.
+ */
+ public $showHeader = true;
+
+ /**
+ * @var array the HTML attributes for the table header row.
+ * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
+ */
+ public $headerRowOptions = [];
+
+ /**
+ * @var boolean whether to show the footer section of the grid table.
+ */
+ public $showFooter = false;
+
+ /**
+ * @var string the HTML display when the content of a cell is empty
+ */
+ public $emptyCell = ' ';
+
+ public $levelSymbol = '–';
+
+ /**
+ * Init the widget object.
+ */
+ public function init() {
+ parent::init();
+
+ $this->initColumns();
+ }
+
+ /**
+ * Runs the widget.
+ */
+ public function run() {
+ $run = parent::run();
+ if (!is_null($run))
+ return $run;
+
+ if ($this->showOnEmpty || $this->dataProvider->getCount() > 0) {
+ $pagination = $this->dataProvider->getPagination();
+ $pagination->setPageSize($this->dataProvider->getTotalCount());
+
+ $header = $this->showHeader ? $this->renderTableHeader() : false;
+ $body = $this->renderItems();
+ $footer = $this->showFooter ? $this->renderTableFooter() : false;
+
+ $content = array_filter([
+ $header,
+ $body,
+ $footer
+ ]);
+
+ return Html::tag('table', implode("\n", $content), $this->options);
+ } else {
+ return $this->renderEmptyResult();
+ }
+ }
+
+ /**
+ * Renders the table header.
+ * @return string the rendering result.
+ */
+ public function renderTableHeader()
+ {
+ $cells = [];
+ foreach ($this->columns as $column) {
+ /* @var $column TreeGridColumn */
+ $cells[] = $column->renderHeaderCell();
+ }
+ $content = Html::tag('tr', implode('', $cells), $this->headerRowOptions);
+ return "\n" . $content . "\n ";
+ }
+
+ /**
+ * Renders the table footer.
+ * @return string the rendering result.
+ */
+ public function renderTableFooter()
+ {
+ $cells = [];
+ foreach ($this->columns as $column) {
+ /* @var $column TreeGridColumn */
+ $cells[] = $column->renderFooterCell();
+ }
+ $content = Html::tag('tr', implode('', $cells), $this->footerRowOptions);
+ return "\n" . $content . "\n ";
+ }
+
+ /**
+ * Renders the data models for the grid view.
+ */
+ public function renderItems()
+ {
+ $rows = [];
+ $models = array_values($this->dataProvider->getModels());
+ $keys = $this->dataProvider->getKeys();
+ $models = TaxOption::find()->normalizeTreeData($models, $this->rootParentId);
+ foreach ($models as $index => $model) {
+ $key = $keys[$index];
+ if ($this->beforeRow !== null) {
+ $row = call_user_func($this->beforeRow, $model, $key, $index, $this);
+ if (!empty($row)) {
+ $rows[] = $row;
+ }
+ }
+
+ $rows[] = $this->renderTableRow($model, $key, $index);
+
+ if ($this->afterRow !== null) {
+ $row = call_user_func($this->afterRow, $model, $key, $index, $this);
+ if (!empty($row)) {
+ $rows[] = $row;
+ }
+ }
+ }
+
+ if (empty($rows)) {
+ $colspan = count($this->columns);
+ return "" . $this->renderEmpty() . " ";
+ } else {
+ return implode("\n", $rows);
+ }
+ }
+
+ /**
+ * Renders a table row with the given data model and key.
+ * @param mixed $model the data model to be rendered
+ * @param mixed $key the key associated with the data model
+ * @param integer $index the zero-based index of the data model among the model array returned by [[dataProvider]].
+ * @return string the rendering result
+ */
+ public function renderTableRow($model, $key, $index)
+ {
+ $cells = [];
+ /* @var $column TreeGridColumn */
+ $i = 0;
+ foreach ($this->columns as $column) {
+ $cells[] = $column->renderDataCell($model, $key, $index, $i == 0, $this->levelSymbol);
+ $i++;
+ }
+ if ($this->rowOptions instanceof Closure) {
+ $options = call_user_func($this->rowOptions, $model, $key, $index, $this);
+ } else {
+ $options = $this->rowOptions;
+ }
+ $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key;
+
+ $id = ArrayHelper::getValue($model, $this->keyNameId);
+ Html::addCssClass($options, "treegrid-$id");
+
+ $parentId = ArrayHelper::getValue($model, $this->keyNameParentId);
+ if ($parentId) {
+ Html::addCssClass($options, "treegrid-parent-$parentId");
+ }
+
+ return Html::tag('tr', implode('', $cells), $options);
+ }
+
+ /**
+ * Creates column objects and initializes them.
+ */
+ protected function initColumns()
+ {
+ if (empty($this->columns)) {
+ $this->guessColumns();
+ }
+ foreach ($this->columns as $i => $column) {
+ if (is_string($column)) {
+ $column = $this->createDataColumn($column);
+ } else {
+ $column = Yii::createObject(array_merge([
+ 'class' => $this->dataColumnClass ? : TreeGridColumn::className(),
+ 'grid' => $this,
+ ], $column));
+ }
+ if (!$column->visible) {
+ unset($this->columns[$i]);
+ continue;
+ }
+ $this->columns[$i] = $column;
+ }
+ }
+
+ /**
+ * Creates a [[DataColumn]] object based on a string in the format of "attribute:format:label".
+ * @param string $text the column specification string
+ * @return DataColumn the column instance
+ * @throws InvalidConfigException if the column specification is invalid
+ */
+ protected function createDataColumn($text)
+ {
+ if (!preg_match('/^([^:]+)(:(\w*))?(:(.*))?$/', $text, $matches)) {
+ throw new InvalidConfigException('The column must be specified in the format of "attribute", "attribute:format" or "attribute:format:label"');
+ }
+
+ return Yii::createObject([
+ 'class' => $this->dataColumnClass ? : TreeGridColumn::className(),
+ 'grid' => $this,
+ 'attribute' => $matches[1],
+ 'format' => isset($matches[3]) ? $matches[3] : 'text',
+ 'label' => isset($matches[5]) ? $matches[5] : null,
+ ]);
+ }
+
+ /**
+ * This function tries to guess the columns to show from the given data
+ * if [[columns]] are not explicitly specified.
+ */
+ protected function guessColumns()
+ {
+ $models = $this->dataProvider->getModels();
+ $model = reset($models);
+ if (is_array($model) || is_object($model)) {
+ foreach ($model as $name => $value) {
+ $this->columns[] = $name;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/treelist/TreeListWidget.php b/common/components/artboxtree/treelist/TreeListWidget.php
new file mode 100644
index 0000000..a3e2165
--- /dev/null
+++ b/common/components/artboxtree/treelist/TreeListWidget.php
@@ -0,0 +1,62 @@
+_hierarchyTreeData(array_values($this->dataProvider->getModels()), $this->rootParentId);
+ return $this->renderTreelist($models);
+ }
+
+ protected function renderTreelist($models) {
+ foreach ($models as $index => $model) {
+ $row = $this->renderTreelistItem($model['item']);
+ $children = empty($model['children']) ? '' : $this->renderTreelist($model['children']);
+ $output[] = ''. $row . $children .' ';
+ }
+
+ if (!empty($output))
+ return ''. implode("\n", $output) .' ';
+ }
+
+ protected function renderTreelistItem($model)
+ {
+ $options = [];
+ $id = ArrayHelper::getValue($model, $this->keyNameId);
+ Html::addCssClass($options, "treelistitem-$id");
+
+ $parent_id = ArrayHelper::getValue($model, $this->keyNameParentId);
+ if ($parent_id) {
+ Html::addCssClass($options, "treelistitem-parent-$parent_id");
+ }
+
+// if (is_string($this->value)) {
+// return ArrayHelper::getValue($model, $this->value);
+// } else {
+// return call_user_func($this->value, $model, $key, $index, $this);
+// }
+
+ return Html::tag('span', ArrayHelper::getValue($model, $this->displayField), $options);
+ }
+}
\ No newline at end of file
diff --git a/common/components/artboxtree/treemenu/TreeMenuWidget.php b/common/components/artboxtree/treemenu/TreeMenuWidget.php
new file mode 100644
index 0000000..0b66cb8
--- /dev/null
+++ b/common/components/artboxtree/treemenu/TreeMenuWidget.php
@@ -0,0 +1,62 @@
+_hierarchyTreeData(array_values($this->dataProvider->getModels()), $this->rootParentId);
+ return $this->renderTreelist($models);
+ }
+
+ protected function renderTreelist($models) {
+ foreach ($models as $index => $model) {
+ $row = $this->renderTreelistItem($model['item']);
+ $children = empty($model['children']) ? '' : $this->renderTreelist($model['children']);
+ $output[] = ''. $row . $children .' ';
+ }
+
+ if (!empty($output))
+ return ''. implode("\n", $output) .' ';
+ }
+
+ protected function renderTreelistItem($model)
+ {
+ $options = [];
+ $id = ArrayHelper::getValue($model, $this->keyNameId);
+ Html::addCssClass($options, "treelistitem-$id");
+
+ $parent_id = ArrayHelper::getValue($model, $this->keyNameParentId);
+ if ($parent_id) {
+ Html::addCssClass($options, "treelistitem-parent-$parent_id");
+ }
+
+// if (is_string($this->value)) {
+// return ArrayHelper::getValue($model, $this->value);
+// } else {
+// return call_user_func($this->value, $model, $key, $index, $this);
+// }
+
+ return Html::tag('span', ArrayHelper::getValue($model, $this->displayField), $options);
+ }
+}
\ No newline at end of file
diff --git a/common/config/.gitignore b/common/config/.gitignore
new file mode 100644
index 0000000..bfabe93
--- /dev/null
+++ b/common/config/.gitignore
@@ -0,0 +1,2 @@
+main-local.php
+params-local.php
diff --git a/common/config/bootstrap.php b/common/config/bootstrap.php
new file mode 100644
index 0000000..2844bbf
--- /dev/null
+++ b/common/config/bootstrap.php
@@ -0,0 +1,6 @@
+ 'ru-RU',
+ 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
+ 'controllerMap' => [
+ 'elfinder' => [
+ 'class' => 'mihaildev\elfinder\Controller',
+ 'access' => ['@'], //глобальный доступ к фаил менеджеру @ - для авторизорованных , ? - для гостей , чтоб открыть всем ['@', '?']
+ 'disabledCommands' => ['netmount'], //отключение ненужных команд https://github.com/Studio-42/elFinder/wiki/Client-configuration-options#commands
+ 'roots' => [
+ [
+ 'class' => 'mihaildev\elfinder\UserPath',
+ 'path' => '../../storage/user_{id}',
+ 'name' => 'My Documents'
+ ],
+ ],
+ 'watermark' => [
+ 'source' => __DIR__.'/logo.png', // Path to Water mark image
+ 'marginRight' => 5, // Margin right pixel
+ 'marginBottom' => 5, // Margin bottom pixel
+ 'quality' => 95, // JPEG image save quality
+ 'transparency' => 70, // Water mark image transparency ( other than PNG )
+ 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
+ 'targetMinPixel' => 200 // Target image minimum pixel size
+ ]
+ ],
+ 'artbox-comment' => [
+ 'class' => \common\modules\comment\Controller::className(),
+ ],
+ ],
+ 'components' => [
+ 'assetManager' => [
+ 'bundles' => [
+ 'yii\web\JqueryAsset' =>[
+ 'jsOptions' => ['position' => \yii\web\View::POS_HEAD]
+ ]
+ ],
+ ],
+ 'authManager' => [
+ 'class' => 'yii\rbac\DbManager',
+ ],
+ 'cache' => [
+ 'class' => 'yii\caching\FileCache',
+ ],
+ 'urlManager' => [
+ 'enablePrettyUrl' => true,
+ 'showScriptName' => false,
+ 'rules' => [
+ 'module///' => '//',
+ ]
+ ],
+ 'i18n' => [
+ 'translations' => [
+ '*' => [
+ 'class' => 'yii\i18n\PhpMessageSource',
+ 'basePath' => '@common/translation',
+ 'fileMap' => [
+ 'app' => 'app.php',
+ 'app/error' => 'error.php',
+ ],
+ ],
+ 'app' => [
+ 'class' => 'yii\i18n\PhpMessageSource',
+ 'basePath' => '@common/translation',
+ 'fileMap' => [
+ 'app' => 'app.php',
+ 'app/error' => 'error.php',
+ ],
+ ],
+ ],
+ ],
+ ],
+
+ 'modules' => [
+ 'file' => [
+ 'class' => 'common\modules\file\Module',
+ ],
+ 'relation' => [
+ 'class' => 'common\modules\relation\Module',
+ 'relations' => [
+ 'product_categories' => [
+ 'name' => Yii::t('product', 'Categories'),
+ 'field' => 'categories',
+ 'entity1' => [
+ 'model' => '\common\modules\product\models\Product',
+ 'label' => 'Product',
+ 'listField' => 'name',
+ 'searchField' => 'name',
+ 'key' => 'product_id',
+ 'linked_key' => 'product_id',
+ ],
+ 'entity2' => [
+ 'model' => '\common\modules\product\models\Category',
+ 'label' => 'Category',
+ 'listField' => 'categoryName.value',
+ 'searchField' => 'category_name.value',
+ 'searchJoin' => 'categoryName',
+ 'key' => 'category_id',
+ 'linked_key' => 'category_id',
+ 'hierarchy' => [
+ 'key' => 'category_id',
+ 'parentKey' => 'parent_id',
+ ]
+ ],
+ 'via' => [
+ 'model' => '\common\modules\product\models\ProductCategory',
+ ]
+ ],
+ 'product_option' => [
+ 'name' => Yii::t('product', 'Properties'),
+ 'field' => 'options',
+ 'entity1' => [
+ 'model' => '\common\modules\product\models\Product',
+ 'label' => 'Product',
+ 'listField' => 'fullname',
+ 'key' => 'product_id',
+ 'linked_key' => 'product_id',
+ ],
+ 'entity2' => [
+ 'model' => '\common\modules\rubrication\models\TaxOption',
+ 'label' => 'Option',
+ 'listField' => 'ValueRenderFlash',
+ 'key' => 'tax_option_id',
+ 'linked_key' => 'option_id',
+ ],
+ 'via' => [
+ 'model' => 'common\modules\product\models\ProductOption',
+ ]
+ ],
+ 'tax_group_to_category' => [
+ 'name' => Yii::t('product', 'Характеристики по категориям'),
+ 'field' => 'group_to_category',
+ 'entity1' => [
+ 'model' => '\common\modules\rubrication\models\TaxGroup',
+ 'label' => 'Group',
+ 'listField' => 'name',
+ 'key' => 'tax_group_id',
+ 'linked_key' => 'entity1_id',
+ ],
+ 'entity2' => [
+ 'model' => '\common\modules\product\models\Category',
+ 'label' => 'Category',
+ 'listField' => 'name',
+ 'key' => 'category_id',
+ 'linked_key' => 'entity2_id',
+ 'hierarchy' => [
+ 'key' => 'category_id',
+ 'parentKey' => 'parent_id',
+ ]
+ ],
+ 'via' => [
+ 'model' => '\common\modules\relation\models\Relation',
+ 'alias' => 'alias',
+ ]
+ ],
+ /*
+ 'relation_categories' => [
+ 'name' => Yii::t('relation', 'Relation categories'),
+ 'field' => 'categories',
+ 'entity1' => [
+ 'model' => '\common\modules\product\models\Product',
+ 'label' => 'Product',
+ 'listField' => 'fullname',
+ 'key' => 'product_id',
+ 'linked_key' => 'product_id',
+ ],
+ 'entity2' => [
+ 'model' => '\common\modules\rubrication\models\TaxOption',
+ 'label' => 'Category',
+ 'listField' => 'ValueRenderFlash',
+ 'key' => 'tax_option_id',
+ 'linked_key' => 'category_id',
+ 'where' => [
+ 'tax_group_id' => 1
+ ]
+ ],
+ 'via' => [
+ 'model' => '\common\modules\relation\models\Relation',
+ 'alias' => 'alias',
+ ]
+ ],
+ 'tax_option_to_group' => [
+ 'name' => 'Options-Groups',
+ 'field' => 'tax_option_to_group',
+ 'linked_table' => 'tax_option_to_group',
+ 'entity1' => [
+ 'label' => 'Option',
+ 'listField' => 'ValueRenderFlash',
+ 'model' => '\common\modules\rubrication\models\TaxOption',
+ 'key' => 'tax_option_id',
+ 'linked_key' => 'tax_option_id',
+ ],
+ 'entity2' => [
+ 'label' => 'Group',
+ 'listField' => 'name',
+ 'model' => '\common\modules\rubrication\models\TaxGroup',
+ 'key' => 'tax_group_id',
+ 'linked_key' => 'tax_group_id',
+ ],
+ 'via' => [
+ 'model' => 'common\modules\rubrication\models\TaxOptionToGroup',
+ 'alias' => 'alias',
+ ]
+ ],
+ 'tax_option_to_option' => [
+ 'name' => 'Options-Options',
+ 'field' => 'tax_option_to_option',
+ 'entity1' => [
+ 'label' => 'Option',
+ 'listField' => 'ValueRenderFlash',
+ 'model' => '\common\modules\rubrication\models\TaxOption',
+ 'key' => 'tax_option_id',
+ 'linked_key' => 'tax_option1_id',
+ ],
+ 'entity2' => [
+ 'label' => 'Option',
+ 'listField' => 'ValueRenderFlash',
+ 'model' => '\common\modules\rubrication\models\TaxOption',
+ 'key' => 'tax_option_id',
+ 'linked_key' => 'tax_option2_id',
+ ],
+ 'via' => [
+ 'model' => 'common\modules\rubrication\models\TaxOptionRelation',
+ 'alias' => 'alias',
+ ]
+ ],
+ 'brand_cats' => [
+ 'name' => 'Категории производителей',
+ 'field' => 'tax_option_to_option',
+ 'entity1' => [
+ 'label' => 'Бренд',
+ 'listField' => 'ValueRenderFlash',
+ 'model' => '\common\modules\rubrication\models\TaxOption',
+ 'key' => 'tax_option_id',
+ 'linked_key' => 'tax_option1_id',
+ ],
+ 'entity2' => [
+ 'label' => 'Категория',
+ 'listField' => 'ValueRenderFlash',
+ 'model' => '\common\modules\rubrication\models\TaxOption',
+ 'key' => 'tax_option_id',
+ 'linked_key' => 'tax_option2_id',
+ ],
+ 'via' => [
+ 'model' => 'common\modules\rubrication\models\TaxOptionRelation',
+ 'alias' => 'alias',
+ ]
+ ]*/
+ ]
+ ],
+ 'comment' => [
+ 'class' => 'common\modules\comment\Module',
+ 'useRbac' => true,
+ 'rbac' => [
+ 'rules' => [
+ \common\modules\comment\rbac\ArtboxCommentCreateRule::className(),
+ \common\modules\comment\rbac\ArtboxCommentDeleteRule::className(),
+ \common\modules\comment\rbac\ArtboxCommentUpdateRule::className(),
+ \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule::className(),
+ \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule::className(),
+ ],
+ 'permissions' => [
+ [
+ 'name' => common\modules\comment\Permissions::CREATE,
+ 'description' => 'Can create comments',
+ 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentCreateRule())->name,
+ ],
+ [
+ 'name' => common\modules\comment\Permissions::UPDATE,
+ 'description' => 'Can update comments',
+ 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateRule())->name,
+ ],
+ [
+ 'name' => common\modules\comment\Permissions::DELETE,
+ 'description' => 'Can delete comments',
+ 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteRule())->name,
+ ],
+ [
+ 'name' => common\modules\comment\Permissions::UPDATE_OWN,
+ 'description' => 'Can update own comments',
+ 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule())->name,
+ ],
+ [
+ 'name' => common\modules\comment\Permissions::DELETE_OWN,
+ 'description' => 'Can delete own comments',
+ 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule())->name,
+ ],
+ ],
+ ],
+
+ ],
+ ],
+];
diff --git a/common/config/params.php b/common/config/params.php
new file mode 100644
index 0000000..446a650
--- /dev/null
+++ b/common/config/params.php
@@ -0,0 +1,6 @@
+ 'admin@example.com',
+ 'supportEmail' => 'support@example.com',
+ 'user.passwordResetTokenExpire' => 3600,
+];
diff --git a/common/mail/layouts/html.php b/common/mail/layouts/html.php
new file mode 100644
index 0000000..accc6cf
--- /dev/null
+++ b/common/mail/layouts/html.php
@@ -0,0 +1,22 @@
+
+beginPage() ?>
+
+
+
+
+ = Html::encode($this->title) ?>
+ head() ?>
+
+
+ beginBody() ?>
+ = $content ?>
+ endBody() ?>
+
+
+endPage() ?>
diff --git a/common/mail/layouts/text.php b/common/mail/layouts/text.php
new file mode 100644
index 0000000..968f894
--- /dev/null
+++ b/common/mail/layouts/text.php
@@ -0,0 +1,12 @@
+
+beginPage() ?>
+beginBody() ?>
+= $content ?>
+endBody() ?>
+endPage() ?>
diff --git a/common/mail/passwordResetToken-html.php b/common/mail/passwordResetToken-html.php
new file mode 100644
index 0000000..24e8de9
--- /dev/null
+++ b/common/mail/passwordResetToken-html.php
@@ -0,0 +1,15 @@
+urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);
+?>
+
+
Hello = Html::encode($user->username) ?>,
+
+
Follow the link below to reset your password:
+
+
= Html::a(Html::encode($resetLink), $resetLink) ?>
+
diff --git a/common/mail/passwordResetToken-text.php b/common/mail/passwordResetToken-text.php
new file mode 100644
index 0000000..0905f76
--- /dev/null
+++ b/common/mail/passwordResetToken-text.php
@@ -0,0 +1,12 @@
+urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);
+?>
+Hello = $user->username ?>,
+
+Follow the link below to reset your password:
+
+= $resetLink ?>
diff --git a/common/models/Banner.php b/common/models/Banner.php
new file mode 100644
index 0000000..a2c8067
--- /dev/null
+++ b/common/models/Banner.php
@@ -0,0 +1,60 @@
+ 255],
+ [['width', 'height'], 'required'],
+ ['title', 'unique', 'targetClass' => '\common\models\Slider', 'message' => Yii::t('app','message',[
+ 'field' => 'Title'
+ ])],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'banner_id' => Yii::t('app', 'status'),
+ 'image' => Yii::t('app', 'image'),
+ 'alt' => Yii::t('app', 'alt'),
+ 'title' => Yii::t('app', 'title'),
+ 'url' => Yii::t('app', 'url'),
+ 'status' => Yii::t('app', 'status'),
+ 'width' => Yii::t('app', 'width'),
+ 'height' => Yii::t('app', 'height'),
+ ];
+ }
+}
diff --git a/common/models/BannerSearch.php b/common/models/BannerSearch.php
new file mode 100644
index 0000000..32929ba
--- /dev/null
+++ b/common/models/BannerSearch.php
@@ -0,0 +1,73 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'banner_id' => $this->banner_id,
+ 'status' => $this->status,
+ ]);
+
+ $query->andFilterWhere(['like', 'image', $this->image])
+ ->andFilterWhere(['like', 'alt', $this->alt])
+ ->andFilterWhere(['like', 'title', $this->title])
+ ->andFilterWhere(['like', 'url', $this->url]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/Blog.php b/common/models/Blog.php
new file mode 100644
index 0000000..5375804
--- /dev/null
+++ b/common/models/Blog.php
@@ -0,0 +1,107 @@
+ BlameableBehavior::className(),
+ 'createdByAttribute' => 'user_id',
+ 'updatedByAttribute' => false,
+ ],
+ [
+ 'class' => TimestampBehavior::className(),
+ 'createdAtAttribute' => 'date_add',
+ 'updatedAtAttribute' => false,
+ 'value' => new Expression('NOW()'),
+ ],
+ 'slug' => [
+ 'class' => 'common\behaviors\Slug',
+ 'in_attribute' => 'name',
+ 'out_attribute' => 'link',
+ 'translit' => true
+ ]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [
+ [ 'name', 'description' ],
+ 'required',
+ ],
+ [
+ [ 'description' ],
+ 'string',
+ ],
+ [
+ [
+ 'name',
+ 'link',
+ 'cover',
+ ],
+ 'string',
+ 'max' => 255,
+ ],
+ ];
+ }
+
+ public function getDateCreate(){
+ return date('Y-m-d',strtotime($this->date_add));
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'blog_id' => Yii::t('app', 'blog_id'),
+ 'user_id' => Yii::t('app', 'user_id'),
+ 'name' => Yii::t('app', 'name'),
+ 'link' => Yii::t('app', 'link'),
+ 'date_add' => Yii::t('app', 'date_add'),
+ 'user_add_id' => Yii::t('app', 'user_add_id'),
+ 'view_count' => Yii::t('app', 'view_count'),
+ 'description' => Yii::t('app', 'description'),
+ 'cover' => Yii::t('app', 'cover'),
+ ];
+ }
+ }
diff --git a/common/models/BlogSearch.php b/common/models/BlogSearch.php
new file mode 100644
index 0000000..b82adb0
--- /dev/null
+++ b/common/models/BlogSearch.php
@@ -0,0 +1,135 @@
+ date('Y-m-d', 0),
+ ],
+ [
+ [
+ 'date_add_to',
+ ],
+ 'default',
+ 'value' => date('Y-m-d'),
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function scenarios()
+ {
+ // bypass scenarios() implementation in the parent class
+ return Model::scenarios();
+ }
+
+ /**
+ * Creates data provider instance with search query applied
+ *
+ * @param array $params
+ *
+ * @return ActiveDataProvider
+ */
+ public function search($params)
+ {
+ $query = Blog::find();
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params);
+
+ if(!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ $query->andWhere([ 'user_id' => \Yii::$app->user->getId() ]);
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'blog_id' => $this->blog_id,
+ 'date_add' => $this->date_add,
+ 'user_add_id' => $this->user_add_id,
+ 'view_count' => $this->view_count,
+ ]);
+
+ $query->andFilterWhere([
+ 'between',
+ 'date_add',
+ $this->date_add_from,
+ (new \DateTime($this->date_add_to))->modify('+1 day')->format('Y-m-d')
+ ]);
+
+ $query->andFilterWhere([
+ 'like',
+ 'name',
+ $this->name,
+ ])
+ ->andFilterWhere([
+ 'like',
+ 'description',
+ $this->description,
+ ])
+ ->andFilterWhere([
+ 'like',
+ 'cover',
+ $this->cover,
+ ]);
+
+ return $dataProvider;
+ }
+
+ }
diff --git a/common/models/Customers.php b/common/models/Customers.php
new file mode 100644
index 0000000..32c1176
--- /dev/null
+++ b/common/models/Customers.php
@@ -0,0 +1,94 @@
+ 255],
+ [['auth_key'], 'string', 'max' => 32],
+// [['email'], 'unique'],
+// [['password_reset_token'], 'unique'],
+// [['phone'], 'unique'],
+ ];
+ }
+
+
+ /**
+ * @inheritdoc
+ */
+ public function behaviors()
+ {
+ return [
+ TimestampBehavior::className(),
+ ];
+ }
+
+ /**
+ * Finds user by email
+ *
+ * @param string $email
+ * @return static|null
+ */
+ public static function findByEmail($email)
+ {
+ return static::findOne(['email' => $email, 'status' => self::STATUS_ACTIVE]);
+ }
+
+ public function getName(){
+ return $this->username. ' '.$this->surname;
+ }
+
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => Yii::t('app', 'ID'),
+ 'username' => Yii::t('app', 'username'),
+ 'surname' => Yii::t('app', 'surname'),
+ 'auth_key' => Yii::t('app', 'auth_key'),
+ 'password_hash' => Yii::t('app', 'password_hash'),
+ 'password_reset_token' => Yii::t('app', 'password_reset_token'),
+ 'email' => Yii::t('app', 'email'),
+ 'phone' => Yii::t('app', 'phone'),
+ 'status' => Yii::t('app', 'status'),
+ 'created_at' => Yii::t('app', 'created_at'),
+ 'updated_at' => Yii::t('app', 'updated_at'),
+ ];
+ }
+}
diff --git a/common/models/Event.php b/common/models/Event.php
new file mode 100644
index 0000000..d091c63
--- /dev/null
+++ b/common/models/Event.php
@@ -0,0 +1,102 @@
+ [
+ 'class' => 'common\behaviors\Slug',
+ 'in_attribute' => 'name',
+ 'out_attribute' => 'alias',
+ 'translit' => true
+ ],
+ [
+ 'class' => 'common\behaviors\ShowImage',
+ ],
+ ];
+ }
+
+
+ public function beforeSave($insert)
+ {
+ if (parent::beforeSave($insert)) {
+ $this->end_at = strtotime($this->end_at);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public function afterFind(){
+ $this->end_at = date("Y-m-d", $this->end_at);
+ }
+
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['body', 'seo_text'], 'string'],
+ [['created_at', 'updated_at' ], 'integer'],
+ [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at'], 'string', 'max' => 255],
+ [['name','body'], 'required'],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'event_id' => Yii::t('app', 'event_id'),
+ 'name' => Yii::t('app', 'name'),
+ 'alias' => Yii::t('app', 'alias'),
+ 'body' => Yii::t('app', 'body'),
+ 'image' => Yii::t('app', 'image'),
+ 'meta_title' => Yii::t('app', 'meta_title'),
+ 'description' => Yii::t('app', 'description'),
+ 'h1' => Yii::t('app', 'h1'),
+ 'seo_text' => Yii::t('app', 'seo_text'),
+ 'created_at' => Yii::t('app', 'created_at'),
+ 'updated_at' => Yii::t('app', 'updated_at'),
+ 'end_at' => Yii::t('app', 'end_at'),
+ ];
+ }
+}
diff --git a/common/models/EventSearch.php b/common/models/EventSearch.php
new file mode 100644
index 0000000..60c85b9
--- /dev/null
+++ b/common/models/EventSearch.php
@@ -0,0 +1,83 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'event_id' => $this->event_id,
+ 'created_at' => $this->created_at,
+ 'updated_at' => $this->updated_at,
+ 'end_at' => $this->end_at,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'alias', $this->alias])
+ ->andFilterWhere(['like', 'body', $this->body])
+ ->andFilterWhere(['like', 'image', $this->image])
+ ->andFilterWhere(['like', 'meta_title', $this->meta_title])
+ ->andFilterWhere(['like', 'description', $this->description])
+ ->andFilterWhere(['like', 'h1', $this->h1])
+ ->andFilterWhere(['like', 'seo_text', $this->seo_text]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/Fields.php b/common/models/Fields.php
new file mode 100644
index 0000000..3db277b
--- /dev/null
+++ b/common/models/Fields.php
@@ -0,0 +1,155 @@
+ 255]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID',
+ 'table_name' => 'Model Name',
+ 'table_id' => 'Model ID',
+ 'value' => 'Value',
+ 'field_name' => 'Field Name',
+ 'language' => 'Language',
+ ];
+ }
+
+ public static function getData($id, $model, $type){
+ $data = ArrayHelper::toArray(self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all());
+ $result = [];
+ for($i=0; $i < count($data); $i ++){
+ $result[$data[$i]['parent_key']][$data[$i]['field_name']] = $data[$i]['value'];
+ }
+
+ return $result;
+ }
+
+
+ /**
+ * @param $post - array with field data
+ * @param $table_id - row id in model table
+ * @param $table_name - madel table name
+ * @param $language - language id
+ */
+
+ public static function saveFieldData($post,$table_id,$table_name, $language){
+
+ self::deleteAll(['table_id'=>$table_id, 'table_name'=>$table_name, 'language' => $language, 'field_type' => array_keys($post)]);
+
+ if($post){
+
+
+ foreach($post as $k => $field){
+
+
+
+ foreach($field as $parent_key => $row){
+
+ foreach($row as $key => $value){
+
+ $field_model = new Fields();
+ $field_model->field_name = array_keys($value)[0];
+ $field_model->value = $value[array_keys($value)[0]];
+ $field_model->table_name = $table_name;
+ $field_model->table_id = $table_id;
+ $field_model->field_type = $k;
+ $field_model->language = 'ru';
+ $field_model->parent_key = $parent_key;
+ $field_model->key = $key;
+ $field_model->save();
+ }
+
+ }
+ }
+ }
+ }
+
+
+ /**
+ * @param $post - array with field data
+ * @param $table_id - row id in model table
+ * @param $table_name - madel table name
+ * @param $language - language id
+ */
+
+ public static function saveFieldVideoData($post,$table_id,$table_name, $language){
+
+ self::deleteAll(['table_id'=>$table_id, 'table_name'=>$table_name, 'language' => $language, 'field_type' => array_keys($post)]);
+
+ if($post){
+
+
+ foreach($post as $k => $field){
+
+
+
+ foreach($field as $parent_key => $row){
+
+ foreach($row as $key => $value){
+
+ preg_match('/src=\"(.[^"]*)\"/', $value[array_keys($value)[0]], $video_url);
+
+ if(isset($video_url[1]) && !empty($video_url[1])){
+
+ $field_model = new Fields();
+ $field_model->field_name = array_keys($value)[0];
+ $field_model->value = $video_url[1].'?showinfo=0&autoplay=0';
+ $field_model->table_name = $table_name;
+ $field_model->table_id = $table_id;
+ $field_model->field_type = $k;
+ $field_model->language = 'ru';
+ $field_model->parent_key = $parent_key;
+ $field_model->key = $key;
+ $field_model->save();
+
+ }
+
+
+ }
+
+ }
+ }
+ }
+ }
+}
diff --git a/common/models/LoginForm.php b/common/models/LoginForm.php
new file mode 100644
index 0000000..6922753
--- /dev/null
+++ b/common/models/LoginForm.php
@@ -0,0 +1,88 @@
+hasErrors()) {
+ $user = $this->getUser();
+ if (!$user || !$user->validatePassword($this->password)) {
+ $this->addError($attribute, 'Incorrect username or password.');
+ }
+ }
+ }
+
+ /**
+ * Logs in a user using the provided username and password.
+ *
+ * @return boolean whether the user is logged in successfully
+ */
+ public function login()
+ {
+ if ($this->validate()) {
+ return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Finds user by [[username]]
+ *
+ * @return User|null
+ */
+ protected function getUser()
+ {
+ if ($this->_user === null) {
+ $this->_user = Customers::findByEmail($this->email);
+ }
+
+ return $this->_user;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'rememberMe' => Yii::t('app', 'rememberMe'),
+ ];
+ }
+}
diff --git a/common/models/OrderItems.php b/common/models/OrderItems.php
new file mode 100644
index 0000000..852565f
--- /dev/null
+++ b/common/models/OrderItems.php
@@ -0,0 +1,72 @@
+ true, 'targetClass' => Orders::className(), 'targetAttribute' => ['order_id' => 'order_id']],
+ [['item_id'], 'exist', 'skipOnError' => true, 'targetClass' => ProductVariant::className(), 'targetAttribute' => ['item_id' => 'product_variant_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'order_items_id' => Yii::t('app', 'order_items_id'),
+ 'order_id' => Yii::t('app', 'order_id'),
+ 'item_id' => Yii::t('app', 'item_id'),
+ 'item_count' => Yii::t('app', 'item_count'),
+ 'price' => Yii::t('app', 'price'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getOrder()
+ {
+ return $this->hasOne(Orders::className(), ['order_id' => 'order_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getItem()
+ {
+ return $this->hasOne(ProductVariant::className(), ['product_variant_id' => 'item_id']);
+ }
+}
diff --git a/common/models/Orders.php b/common/models/Orders.php
new file mode 100644
index 0000000..47d8fa4
--- /dev/null
+++ b/common/models/Orders.php
@@ -0,0 +1,106 @@
+ 255],
+ [['phone'], 'string', 'max' => 32],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function behaviors()
+ {
+ return [
+ TimestampBehavior::className(),
+ ];
+ }
+
+
+ public function getCreated(){
+ if(!empty($this->created_at)){
+ return date("Y-m-d" , $this->created_at);
+ } else {
+ return '';
+ }
+ }
+
+
+ public function getUpdated(){
+ if(!empty($this->updated_at)){
+ return date("Y-m-d" , $this->updated_at);
+ } else {
+ return '';
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'order_id' => Yii::t('app', 'order_id'),
+ 'customer_id' => Yii::t('app', 'customer_id'),
+ 'name' => Yii::t('app', 'name'),
+ 'email' => Yii::t('app', 'email'),
+ 'phone' => Yii::t('app', 'phone'),
+ 'delivery' => Yii::t('app', 'delivery'),
+ 'payment' => Yii::t('app', 'payment'),
+ 'code' => Yii::t('app', 'code'),
+ 'status' => Yii::t('app', 'status'),
+ 'created_at' => Yii::t('app', 'created_at'),
+ 'updated_at' => Yii::t('app', 'updated_at'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getOrderItems()
+ {
+ return $this->hasMany(OrderItems::className(), ['order_id' => 'order_id']);
+ }
+}
diff --git a/common/models/OrdersSearch.php b/common/models/OrdersSearch.php
new file mode 100644
index 0000000..b5ce4dd
--- /dev/null
+++ b/common/models/OrdersSearch.php
@@ -0,0 +1,78 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'order_id' => $this->order_id,
+ 'customer_id' => $this->customer_id,
+ 'delivery' => $this->delivery,
+ 'payment' => $this->payment,
+ 'status' => $this->status,
+ 'created_at' => $this->created_at,
+ 'updated_at' => $this->updated_at,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'email', $this->email])
+ ->andFilterWhere(['like', 'phone', $this->phone])
+ ->andFilterWhere(['like', 'code', $this->code]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/Page.php b/common/models/Page.php
new file mode 100644
index 0000000..76d62c4
--- /dev/null
+++ b/common/models/Page.php
@@ -0,0 +1,79 @@
+ 255],
+ [['alias', 'title', 'meta_title', 'description'], 'string', 'max' => 250]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => Yii::t('app', 'id'),
+ 'name' => Yii::t('app', 'name'),
+ 'alias' => Yii::t('app', 'alias'),
+ 'title' => Yii::t('app', 'title'),
+ 'body' => Yii::t('app', 'body'),
+ 'meta_title' => Yii::t('app', 'meta_title'),
+ 'description' => Yii::t('app', 'description'),
+ 'h1' =>Yii::t('app', 'h1'),
+ 'seo_text' => Yii::t('app', 'seo_text'),
+ ];
+ }
+
+ public function behaviors()
+ {
+ return [
+ 'slug' => [
+ 'class' => 'common\behaviors\Slug',
+ 'in_attribute' => 'name',
+ 'out_attribute' => 'alias',
+ 'translit' => true
+ ]
+ ];
+ }
+
+ public function getPageTranslit($page){
+ return self::find()
+ ->where(['alias' => $page])
+ ->one();
+
+ }
+}
diff --git a/common/models/PageSearch.php b/common/models/PageSearch.php
new file mode 100644
index 0000000..a67633c
--- /dev/null
+++ b/common/models/PageSearch.php
@@ -0,0 +1,72 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ $query->andFilterWhere([
+ 'id' => $this->id,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'alias', $this->alias])
+ ->andFilterWhere(['like', 'title', $this->title])
+ ->andFilterWhere(['like', 'body', $this->body])
+ ->andFilterWhere(['like', 'meta_title', $this->meta_title])
+ ->andFilterWhere(['like', 'description', $this->description])
+ ->andFilterWhere(['like', 'h1', $this->h1])
+ ->andFilterWhere(['like', 'seo_text', $this->seo_text]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/Seo.php b/common/models/Seo.php
new file mode 100644
index 0000000..8fccb9a
--- /dev/null
+++ b/common/models/Seo.php
@@ -0,0 +1,53 @@
+ 255],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'seo_id' => Yii::t('app', 'seo_id'),
+ 'url' => Yii::t('app', 'url'),
+ 'title' => Yii::t('app', 'title'),
+ 'description' => Yii::t('app', 'description'),
+ 'h1' => Yii::t('app', 'h1'),
+ 'seo_text' => Yii::t('app', 'seo_text'),
+ ];
+ }
+}
diff --git a/common/models/SeoCategory.php b/common/models/SeoCategory.php
new file mode 100644
index 0000000..4cd7459
--- /dev/null
+++ b/common/models/SeoCategory.php
@@ -0,0 +1,59 @@
+ 255],
+ [['controller'], 'string', 'max' => 100],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'seo_category_id' => Yii::t('app', 'seo_category_id'),
+ 'name' => Yii::t('app', 'name'),
+ 'controller' => Yii::t('app', 'controller'),
+ 'status' => Yii::t('app', 'status'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getSeoDynamics()
+ {
+ return $this->hasMany(SeoDynamic::className(), ['seo_category_id' => 'seo_category_id']);
+ }
+}
diff --git a/common/models/SeoCategorySearch.php b/common/models/SeoCategorySearch.php
new file mode 100644
index 0000000..120800b
--- /dev/null
+++ b/common/models/SeoCategorySearch.php
@@ -0,0 +1,71 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'seo_category_id' => $this->seo_category_id,
+ 'status' => $this->status,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'controller', $this->controller]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/SeoDynamic.php b/common/models/SeoDynamic.php
new file mode 100644
index 0000000..7ec02cd
--- /dev/null
+++ b/common/models/SeoDynamic.php
@@ -0,0 +1,77 @@
+ 200],
+ [['fields', 'title', 'h1', 'description', 'param', 'key'], 'string', 'max' => 255],
+ [['seo_category_id'], 'exist', 'skipOnError' => true, 'targetClass' => SeoCategory::className(), 'targetAttribute' => ['seo_category_id' => 'seo_category_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'),
+ 'seo_category_id' => Yii::t('app', 'seo_category_id'),
+ 'name' => Yii::t('app', 'name'),
+ 'action' => Yii::t('app', 'action'),
+ 'fields' => Yii::t('app', 'fields'),
+ 'title' => Yii::t('app', 'title'),
+ 'h1' => Yii::t('app', 'h1'),
+ 'description' => Yii::t('app', 'description'),
+ 'seo_text' => Yii::t('app', 'seo_text'),
+ 'status' => Yii::t('app', 'status'),
+ 'param' => Yii::t('app', 'param'),
+ 'key' => Yii::t('app', 'key'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getSeoCategory()
+ {
+ return $this->hasOne(SeoCategory::className(), ['seo_category_id' => 'seo_category_id']);
+ }
+}
diff --git a/common/models/SeoDynamicSearch.php b/common/models/SeoDynamicSearch.php
new file mode 100644
index 0000000..ce0d978
--- /dev/null
+++ b/common/models/SeoDynamicSearch.php
@@ -0,0 +1,77 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'seo_dynamic_id' => $this->seo_dynamic_id,
+ 'seo_category_id' => $seo_category_id,
+ 'status' => $this->status,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'action', $this->action])
+ ->andFilterWhere(['like', 'fields', $this->fields])
+ ->andFilterWhere(['like', 'title', $this->title])
+ ->andFilterWhere(['like', 'h1', $this->h1])
+ ->andFilterWhere(['like', 'description', $this->description])
+ ->andFilterWhere(['like', 'seo_text', $this->seo_text]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/SeoSearch.php b/common/models/SeoSearch.php
new file mode 100644
index 0000000..14af48f
--- /dev/null
+++ b/common/models/SeoSearch.php
@@ -0,0 +1,73 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'seo_id' => $this->seo_id,
+ ]);
+
+ $query->andFilterWhere(['like', 'url', $this->url])
+ ->andFilterWhere(['like', 'title', $this->title])
+ ->andFilterWhere(['like', 'description', $this->description])
+ ->andFilterWhere(['like', 'h1', $this->h1])
+ ->andFilterWhere(['like', 'seo_text', $this->seo_text]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/Service.php b/common/models/Service.php
new file mode 100644
index 0000000..05ed8f8
--- /dev/null
+++ b/common/models/Service.php
@@ -0,0 +1,81 @@
+ 255],
+ ];
+ }
+ /**
+ * @inheritdoc
+ */
+ public function behaviors()
+ {
+ return [
+ TimestampBehavior::className(),
+ 'slug' => [
+ 'class' => 'common\behaviors\Slug',
+ 'in_attribute' => 'name',
+ 'out_attribute' => 'alias',
+ 'translit' => true
+ ],
+ [
+ 'class' => 'common\behaviors\ShowImage',
+ ],
+ ];
+ }
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'service_id' => Yii::t('app', 'service_id'),
+ 'name' => Yii::t('app', 'name'),
+ 'alias' => Yii::t('app', 'alias'),
+ 'body' => Yii::t('app', 'body'),
+ 'image' => Yii::t('app', 'image'),
+ 'meta_title' => Yii::t('app', 'meta_title'),
+ 'description' => Yii::t('app', 'description'),
+ 'h1' => Yii::t('app', 'h1'),
+ 'seo_text' => Yii::t('app', 'seo_text'),
+ 'created_at' => Yii::t('app', 'created_at'),
+ 'updated_at' => Yii::t('app', 'updated_at'),
+ ];
+ }
+}
diff --git a/common/models/ServiceSearch.php b/common/models/ServiceSearch.php
new file mode 100644
index 0000000..8b1edac
--- /dev/null
+++ b/common/models/ServiceSearch.php
@@ -0,0 +1,78 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'service_id' => $this->service_id,
+ 'created_at' => $this->created_at,
+ 'updated_at' => $this->updated_at,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'alias', $this->alias])
+ ->andFilterWhere(['like', 'body', $this->body])
+ ->andFilterWhere(['like', 'image', $this->image])
+ ->andFilterWhere(['like', 'meta_title', $this->meta_title])
+ ->andFilterWhere(['like', 'description', $this->description])
+ ->andFilterWhere(['like', 'h1', $this->h1])
+ ->andFilterWhere(['like', 'seo_text', $this->seo_text]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/Slider.php b/common/models/Slider.php
new file mode 100644
index 0000000..4ce0975
--- /dev/null
+++ b/common/models/Slider.php
@@ -0,0 +1,68 @@
+ 200],
+ [['width', 'height'], 'required'],
+ ['title', 'unique', 'targetClass' => '\common\models\Slider', 'message' => Yii::t('app','message',[
+ 'field' => 'Title'
+ ])],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'slider_id' => Yii::t('app', 'slider_id'),
+ 'speed' => Yii::t('app', 'speed'),
+ 'duration' => Yii::t('app', 'duration'),
+ 'title' => Yii::t('app', 'title'),
+ 'status' => Yii::t('app', 'status'),
+ 'width' => Yii::t('app', 'width'),
+ 'height' => Yii::t('app', 'height'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getSliderImage()
+ {
+ return $this->hasMany(SliderImage::className(), ['slider_id' => 'slider_id'])->where([SliderImage::tableName().'.status'=>1]);
+ }
+}
diff --git a/common/models/SliderImage.php b/common/models/SliderImage.php
new file mode 100644
index 0000000..a759c26
--- /dev/null
+++ b/common/models/SliderImage.php
@@ -0,0 +1,70 @@
+ 255],
+ [['slider_id'], 'exist', 'skipOnError' => true, 'targetClass' => Slider::className(), 'targetAttribute' => ['slider_id' => 'slider_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'slider_image_id' => Yii::t('app', 'slider_image_id'),
+ 'slider_id' => Yii::t('app', 'slider_id'),
+ 'image' => Yii::t('app', 'image'),
+ 'alt' => Yii::t('app', 'alt'),
+ 'title' => Yii::t('app', 'title'),
+ 'url' => Yii::t('app', 'url'),
+ 'status' => Yii::t('app', 'status'),
+ 'sort' => Yii::t('app', 'sort'),
+ 'price' => Yii::t('app', 'price'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getSlider()
+ {
+ return $this->hasOne(Slider::className(), ['slider_id' => 'slider_id']);
+ }
+}
diff --git a/common/models/SliderImageSearch.php b/common/models/SliderImageSearch.php
new file mode 100644
index 0000000..56368eb
--- /dev/null
+++ b/common/models/SliderImageSearch.php
@@ -0,0 +1,77 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'slider_image_id' => $this->slider_image_id,
+ 'slider_id' => $slider_id,
+ 'status' => $this->status,
+ 'sort' => $this->sort,
+ ]);
+
+ $query->andFilterWhere(['like', 'image', $this->image])
+ ->andFilterWhere(['like', 'alt', $this->alt])
+ ->andFilterWhere(['like', 'title', $this->title])
+ ->andFilterWhere(['like', 'url', $this->url]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/SliderSearch.php b/common/models/SliderSearch.php
new file mode 100644
index 0000000..f4fc994
--- /dev/null
+++ b/common/models/SliderSearch.php
@@ -0,0 +1,74 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'slider_id' => $this->slider_id,
+ 'speed' => $this->speed,
+ 'duration' => $this->duration,
+ 'status' => $this->status,
+
+ ]);
+
+ $query->andFilterWhere(['like', 'title', $this->title]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/Subscribe.php b/common/models/Subscribe.php
new file mode 100644
index 0000000..31ea2cc
--- /dev/null
+++ b/common/models/Subscribe.php
@@ -0,0 +1,28 @@
+where('email = :email', [':email' => $this->email])
+ ->exists())
+ $this->addError('email','Такой email уже есть.');
+ }
+
+}
\ No newline at end of file
diff --git a/common/models/TemplateLocation.php b/common/models/TemplateLocation.php
new file mode 100644
index 0000000..22fa840
--- /dev/null
+++ b/common/models/TemplateLocation.php
@@ -0,0 +1,76 @@
+ 255],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'template_location_id' => Yii::t('app', 'Template Location ID'),
+ 'template_location_name' => Yii::t('app', 'Template Location Name'),
+ 'template_location_title' => Yii::t('app', 'Template Location Title'),
+ 'width' => Yii::t('app', 'Width'),
+ 'height' => Yii::t('app', 'Height'),
+ 'sort' => Yii::t('app', 'Sort'),
+ 'is_slider' => Yii::t('app', 'Is Slider'),
+ 'is_banner' => Yii::t('app', 'Is Banner'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getBanners()
+ {
+ return $this->hasMany(Banner::className(), ['template_location_id' => 'template_location_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getSliders()
+ {
+ return $this->hasMany(Slider::className(), ['template_location_id' => 'template_location_id']);
+ }
+}
diff --git a/common/models/TemplateLocationSearch.php b/common/models/TemplateLocationSearch.php
new file mode 100644
index 0000000..dbbcd74
--- /dev/null
+++ b/common/models/TemplateLocationSearch.php
@@ -0,0 +1,75 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'template_location_id' => $this->template_location_id,
+ 'width' => $this->width,
+ 'height' => $this->height,
+ 'sort' => $this->sort,
+ 'is_slider' => $this->is_slider,
+ 'is_banner' => $this->is_banner,
+ ]);
+
+ $query->andFilterWhere(['like', 'template_location_name', $this->template_location_name])
+ ->andFilterWhere(['like', 'template_location_title', $this->template_location_title]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/models/User.php b/common/models/User.php
new file mode 100644
index 0000000..e43ab1a
--- /dev/null
+++ b/common/models/User.php
@@ -0,0 +1,188 @@
+ self::STATUS_ACTIVE],
+ ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function findIdentity($id)
+ {
+ return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function findIdentityByAccessToken($token, $type = null)
+ {
+ throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
+ }
+
+ /**
+ * Finds user by username
+ *
+ * @param string $username
+ * @return static|null
+ */
+ public static function findByUsername($username)
+ {
+ return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]);
+ }
+
+ /**
+ * Finds user by password reset token
+ *
+ * @param string $token password reset token
+ * @return static|null
+ */
+ public static function findByPasswordResetToken($token)
+ {
+ if (!static::isPasswordResetTokenValid($token)) {
+ return null;
+ }
+
+ return static::findOne([
+ 'password_reset_token' => $token,
+ 'status' => self::STATUS_ACTIVE,
+ ]);
+ }
+
+ /**
+ * Finds out if password reset token is valid
+ *
+ * @param string $token password reset token
+ * @return boolean
+ */
+ public static function isPasswordResetTokenValid($token)
+ {
+ if (empty($token)) {
+ return false;
+ }
+
+ $timestamp = (int) substr($token, strrpos($token, '_') + 1);
+ $expire = Yii::$app->params['user.passwordResetTokenExpire'];
+ return $timestamp + $expire >= time();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getId()
+ {
+ return $this->getPrimaryKey();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getAuthKey()
+ {
+ return $this->auth_key;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function validateAuthKey($authKey)
+ {
+ return $this->getAuthKey() === $authKey;
+ }
+
+ /**
+ * Validates password
+ *
+ * @param string $password password to validate
+ * @return boolean if password provided is valid for current user
+ */
+ public function validatePassword($password)
+ {
+ return Yii::$app->security->validatePassword($password, $this->password_hash);
+ }
+
+ /**
+ * Generates password hash from password and sets it to the model
+ *
+ * @param string $password
+ */
+ public function setPassword($password)
+ {
+ $this->password_hash = Yii::$app->security->generatePasswordHash($password);
+ }
+
+ /**
+ * Generates "remember me" authentication key
+ */
+ public function generateAuthKey()
+ {
+ $this->auth_key = Yii::$app->security->generateRandomString();
+ }
+
+ /**
+ * Generates new password reset token
+ */
+ public function generatePasswordResetToken()
+ {
+ $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
+ }
+
+ /**
+ * Removes password reset token
+ */
+ public function removePasswordResetToken()
+ {
+ $this->password_reset_token = null;
+ }
+}
diff --git a/common/modules/blog/Module.php b/common/modules/blog/Module.php
new file mode 100644
index 0000000..4b46c45
--- /dev/null
+++ b/common/modules/blog/Module.php
@@ -0,0 +1,15 @@
+ [[0 => property(свойство обьекта), ... дополнительные
+ * настройки]], ...[]]
+ *
+ */
+ public $attributes;
+
+ /**
+ * События
+ *
+ * События на которые должно срабатывать поведение. Задается ассоциативный массив, в котором ключ - событие
+ * связанного обьекта, а значение - метод, который вызывается при этом событии
+ *
+ * @return array [key(event) => val(method)]
+ *
+ */
+ public function events()
+ {
+ return [
+ ActiveRecord::EVENT_BEFORE_INSERT => 'autocomplete',
+ ActiveRecord::EVENT_BEFORE_UPDATE => 'autocomplete',
+ ];
+ }
+
+ /**
+ * События
+ *
+ * События на которые должно срабатывать поведение. Задается ассоциативный массив, в котором ключ - событие
+ * связанного обьекта, а значение - метод, который вызывается при этом событии
+ * Доступные автозаполнения:
+ * ['translit' => ['prop1', ... 'prop2']],
+ * где prop - свойство подлежащее транслитерации
+ * ['repeat' => [[string 'prop1', string 'target1', boolean 'skipFilled', int 'count', boolean 'truncate', string 'suffix'], ...[]],
+ * где prop - свойство для преобразования,
+ * target - свойство с которого взять данные,
+ * count - число для преобразования,
+ * skipFilled - пропустить непустые,
+ * truncate - true - обрезать по словам, false - по символам,
+ * suffix - суффикс, который добавить после обрезки
+ *
+ * @param mixed $event Yii обьект свойста https://github.com/yiisoft/yii2/blob/master/docs/guide-ru/concept-events.md
+ *
+ */
+ public function autocomplete($event)
+ {
+ if(!empty($this->attributes['translit'])) {
+ foreach($this->attributes['translit'] as $translit) {
+ if($this->owner->hasAttribute($translit)) {
+ $this->owner->$translit = Tools::translit($this->owner->$translit);
+ }
+ }
+ }
+ if(!empty($this->attributes['repeat'])) {
+ foreach($this->attributes['repeat'] as $repeat) {
+ if(is_array($repeat) && $this->owner->hasAttribute($repeat[0]) && $this->owner->hasAttribute($repeat[1]) && is_int($repeat[3]) && (empty($this->owner->$repeat[0]) || $repeat[2])) {
+ $suffix = $repeat[5]?:'';
+ $truncate = $repeat[4]?'truncateWords':'truncate';
+ $this->owner->$repeat[0] = StringHelper::$truncate($this->owner->$repeat[1], $repeat[3], $suffix);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/modules/blog/config.php b/common/modules/blog/config.php
new file mode 100644
index 0000000..8a7e162
--- /dev/null
+++ b/common/modules/blog/config.php
@@ -0,0 +1,9 @@
+ [
+
+ ],
+ 'params' => [
+ 'test' => 'Hello',
+ ],
+];
diff --git a/common/modules/blog/controllers/AjaxController.php b/common/modules/blog/controllers/AjaxController.php
new file mode 100644
index 0000000..6e6ebcd
--- /dev/null
+++ b/common/modules/blog/controllers/AjaxController.php
@@ -0,0 +1,133 @@
+request->getIsAjax()) {
+ //throw new ForbiddenHttpException('Permission denied');
+ }
+
+ if(!parent::beforeAction($action)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public function actionCategoryForm($language_id, $widget_id)
+ {
+ $model = Language::find()->where(['>=', 'language_id', 1])->andWhere(['status' => 1, 'language_id' => $language_id])->one();
+ if(!$model) {
+ throw new NotFoundHttpException('Language not found');
+ }
+ $category_lang = new ArticleCategoryLang();
+ return $this->renderAjax('_category_form', ['model' => $model, 'category_lang' => $category_lang, 'widget_id' => $widget_id]);
+ }
+
+ public function actionArticleForm($language_id, $widget_id)
+ {
+ $model = Language::find()->where(['>=', 'language_id', 1])->andWhere(['status' => 1, 'language_id' => $language_id])->one();
+ if(!$model) {
+ throw new NotFoundHttpException('Language not found');
+ }
+ $article_lang = new ArticleLang();
+ return $this->renderAjax('_article_form', ['model' => $model, 'article_lang' => $article_lang, 'widget_id' => $widget_id]);
+ }
+
+ public function actionArticleMediaForm($language_id, $widget_id, $type)
+ {
+ $model = Language::find()->where(['>=', 'language_id', 1])->andWhere(['status' => 1, 'language_id' => $language_id])->one();
+ if(!$model) {
+ throw new NotFoundHttpException('Language not found');
+ }
+ if(!in_array($type, ['full', 'preview'])) {
+ throw new InvalidParamException('Type must only be full/preview');
+ }
+ $article_lang = new ArticleMedia();
+ return $this->renderAjax('_article_media_form', ['model' => $model, 'article_lang' => $article_lang, 'widget_id' => $widget_id, 'type' => $type]);
+ }
+
+ public function actionArticleCategoryMediaForm($language_id, $widget_id, $type)
+ {
+ $model = Language::find()->where(['>=', 'language_id', 1])->andWhere(['status' => 1, 'language_id' => $language_id])->one();
+ if(!$model) {
+ throw new NotFoundHttpException('Language not found');
+ }
+ if(!in_array($type, ['full', 'preview'])) {
+ throw new InvalidParamException('Type must only be full/preview');
+ }
+ $article_lang = new ArticleCategoryMedia();
+ return $this->renderAjax('_article_media_form', ['model' => $model, 'article_lang' => $article_lang, 'widget_id' => $widget_id, 'type' => $type]);
+ }
+
+ public function actionRemoveImage()
+ {
+ $post = \Yii::$app->request->post();
+ if(!empty($post['article_media_id'])) {
+ $article_media = ArticleMedia::findOne($post['article_media_id']);
+ if($post['remove_media']) {
+ $media = $article_media->media->delete();
+ }
+ if(!empty($article_media)) {
+ $article_media->delete();
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public function actionRemoveCategoryImage()
+ {
+ $post = \Yii::$app->request->post();
+ if(!empty($post['category_media_id'])) {
+ $category_media = ArticleCategoryMedia::findOne($post['category_media_id']);
+ if($post['remove_media']) {
+ $media = $category_media->media->delete();
+ }
+ if(!empty($category_media)) {
+ $category_media->delete();
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public function actionRemoveImageCategory()
+ {
+ $post = \Yii::$app->request->post();
+ if(!empty($post['category_media_id'])) {
+ $category_media = ArticleCategoryMedia::findOne($post['category_media_id']);
+ if($post['remove_media']) {
+ $media = $category_media->media->delete();
+ }
+ if(!empty($category_media)) {
+ $category_media->delete();
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public function actionMultilangForm($model, $ajaxView, $widget_id, $language_id = NULL)
+ {
+ $model = new $model(['language_id' => $language_id]);
+ return $this->renderAjax($ajaxView, ['model' => $model, 'widget_id' => $widget_id]);
+ }
+
+}
diff --git a/common/modules/blog/controllers/ArticleController.php b/common/modules/blog/controllers/ArticleController.php
new file mode 100644
index 0000000..c5f18ab
--- /dev/null
+++ b/common/modules/blog/controllers/ArticleController.php
@@ -0,0 +1,228 @@
+ Article::find(),
+ 'pagination' => [
+ 'pageSize' => 1,
+ ],
+ ]);
+ return $this->render('index', ['dataProvider' => $dataProvider]);
+ }
+
+ public function actionCreate()
+ {
+ $article_langs = array();
+ $article = new Article();
+ $default_lang = Language::getDefaultLang();
+ $images = array();
+ $images[$default_lang->language_id]['full'] = new ArticleMedia(['scenario' => ArticleMedia::SCENARIO_FULL]);
+ $images[$default_lang->language_id]['preview'] = new ArticleMedia(['scenario' => ArticleMedia::SCENARIO_PREVIEW]);
+ $images[0]['additional'] = new ArticleMedia(['scenario' => ArticleMedia::SCENARIO_ADDITIONAL]);
+ $article->loadDefaultValues();
+ $langs = Language::getActiveLanguages();
+ $isValid = false;
+ if(!empty(\Yii::$app->request->post())) {
+ $isValid = true;
+ $article->load(\Yii::$app->request->post());
+ $article->user_id = \Yii::$app->user->getId();
+ $isValid = $article->validate();
+ foreach(\Yii::$app->request->post()['ArticleMedia'] as $lang => $value) {
+ foreach($value as $type => $fields) {
+ $images[$lang][$type] = new ArticleMedia(['scenario' => $type]);
+ $images[$lang][$type]->type = $type;
+ $images[$lang][$type]->language_id = $lang;
+ $images[$lang][$type]->imageFile = UploadedFile::getInstance($images[$lang][$type], "[{$lang}][{$type}]imageFile");
+ $isValid = $images[$lang][$type]->validate(['imageFile']) && $isValid;
+ }
+ }
+ $images[0]['additional']->language_id = 0;
+ $images[0]['additional']->type = 'additional';
+ $images[0]['additional']->imageFile = UploadedFile::getInstances($images[0]['additional'], "[0][additional]imageFile");
+ if(empty(\Yii::$app->request->post()['ArticleLang'])) {
+ $article_langs[$default_lang->language_id] = new ArticleLang();
+ $isValid = ArticleLang::validateMultiple($article_langs) && $isValid;
+ } else {
+ foreach(\Yii::$app->request->post()['ArticleLang'] as $index => $article_lang) {
+ $article_langs[$index] = new ArticleLang();
+ }
+ ArticleLang::loadMultiple($article_langs, \Yii::$app->request->post());
+ $isValid = ArticleLang::validateMultiple($article_langs) && $isValid;
+ }
+ } else {
+ $article_langs[$default_lang->language_id] = new ArticleLang();
+ }
+ if($isValid) {
+ $article->save(false);
+ $article_categories = \Yii::$app->request->post('Article')['articleCategoriesArray'];
+ if(!empty($article_categories)) {
+ foreach($article_categories as $article_category) {
+ $articletocategory[$article_category] = new ArticleToCategory();
+ $articletocategory[$article_category]->article_category_id = $article_category;
+ $articletocategory[$article_category]->link('article', $article);
+ }
+ }
+ $first = 1;
+ foreach($images as $lang => $value) {
+ foreach($value as $type => $fields) {
+ $images[$lang][$type]->upload($article->article_id);
+ if($first && $type != 'additional') {
+ $media_clone = clone $images[$lang][$type];
+ $media_clone->setIsNewRecord(true);
+ unset($media_clone->article_media_id);
+ $media_clone->language_id = 0;
+ $media_clone->upload($article->article_id);
+ unset($media_clone);
+ $first = 0;
+ }
+ }
+ }
+ $first = 1;
+ foreach($article_langs as $article_lang) {
+ if($first) {
+ $article_lang_clone = clone $article_lang;
+ $article_lang_clone->language_id = 0;
+ $article_lang_clone->link('article', $article);
+ unset($article_lang_clone);
+ }
+ $article_lang->link('article', $article);
+ $first = 0;
+ }
+ echo "ok";
+ //$this->redirect('index');
+ } else {
+ return $this->render('create', [
+ 'article_langs' => $article_langs,
+ 'article' => $article,
+ 'langs' => $langs,
+ 'images' => $images
+ ]);
+ }
+ }
+
+ public function actionUpdate($id)
+ {
+ $article = Article::findOne($id);
+ $imagestack = $article->getArticleMedia()->all();
+ $images = [];
+ $images[0]['additional'][0] = new ArticleMedia(['scenario' => ArticleMedia::SCENARIO_ADDITIONAL]);
+ $images[0]['additional'][0]->type = 'additional';
+ $images[0]['additional'][0]->language_id = 0;
+ foreach($imagestack as $image) {
+ if(in_array($image->type, ['full', 'preview'])) {
+ $images[$image->language_id][$image->type] = $image;
+ $images[$image->language_id][$image->type]->scenario = $image->type;
+ } else {
+ $images[$image->language_id][$image->type][$image->article_media_id] = $image;
+ $images[$image->language_id][$image->type][$image->article_media_id]->scenario = $image->type;
+ }
+ }
+ foreach($images as $lang => $value) {
+ $images[$lang]['additional'][0] = new ArticleMedia(['scenario' => ArticleMedia::SCENARIO_ADDITIONAL]);
+ }
+ $article_langs = $article->getArticleLangs()->where(['>=', 'language_id', '1'])->indexBy('language_id')->all();
+ $langs = Language::getActiveLanguages();
+ $default_lang = Language::getDefaultLang();
+ $isValid = false;
+ if(!empty(\Yii::$app->request->post())) {
+ $isValid = true;
+ $article->load(\Yii::$app->request->post());
+ ArticleToCategory::deleteAll(['article_id' => $article->article_id]);
+ $article_categories = \Yii::$app->request->post('Article')['articleCategoriesArray'];
+ if(!empty($article_categories)) {
+ foreach($article_categories as $article_category) {
+ $articletocategory[$article_category] = new ArticleToCategory();
+ $articletocategory[$article_category]->article_category_id = $article_category;
+ $articletocategory[$article_category]->link('article', $article);
+ }
+ }
+ $isValid = $article->validate();
+ $images[0]['additional'][0]->type = 'additional';
+ $images[0]['additional'][0]->language_id = 0;
+ $images[0]['additional'][0]->imageFile = UploadedFile::getInstances($images[0]['additional'][0], "[0][additional]imageFile");
+ $isValid = $images[0]['additional'][0]->validate(['imageFile']) && $isValid;
+ foreach(\Yii::$app->request->post()['ArticleMedia'] as $lang => $value) {
+ foreach($value as $type => $fields) {
+ if(!in_array($type, ['full', 'preview'])) continue;
+ $images[$lang][$type] = new ArticleMedia(['scenario' => $type]);
+ $images[$lang][$type]->language_id = $lang;
+ $images[$lang][$type]->type = $type;
+ $images[$lang][$type]->imageFile = UploadedFile::getInstance($images[$lang][$type], "[{$lang}][{$type}]imageFile");
+ $isValid = $images[$lang][$type]->validate(['imageFile']) && $isValid;
+ }
+ }
+ if(empty(\Yii::$app->request->post()['ArticleLang'])) {
+ $isValid = ArticleLang::validateMultiple($article_langs) && $isValid;
+ } else {
+ foreach(\Yii::$app->request->post()['ArticleLang'] as $index => $article_lang) {
+ if (!array_key_exists($index, $article_langs)) {
+ $article_langs[$index] = new ArticleLang();
+ $article_langs[$index]->article_id = $article->article_id;
+ }
+ }
+ ArticleLang::loadMultiple($article_langs, \Yii::$app->request->post());
+ $isValid = ArticleLang::validateMultiple($article_langs) && $isValid;
+ }
+ }
+ if($isValid) {
+ $article->save(false);
+ foreach($images as $lang => $value) {
+ foreach($value as $type => $fields) {
+ if($type == 'additional') {
+ $images[$lang][$type][0]->upload($article->id);
+ } else {
+ if(!empty($images[$lang][$type]->imageFile)) {
+ $images[$lang][$type]->replace($article->article_id);
+ }
+ }
+ }
+ }
+ foreach($article_langs as $article_lang) {
+ $article_lang->save(false);
+ }
+ echo "ok";
+ //$this->redirect('index');
+ } else {
+ return $this->render('update', [
+ 'article_langs' => $article_langs,
+ 'article' => $article,
+ 'langs' => $langs,
+ 'images' => $images
+ ]);
+ }
+ }
+
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+ return $this->redirect(['index']);
+ }
+
+ protected function findModel($id)
+ {
+ if (($model = Article::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/common/modules/blog/controllers/CategoryController.php b/common/modules/blog/controllers/CategoryController.php
new file mode 100644
index 0000000..505f5b8
--- /dev/null
+++ b/common/modules/blog/controllers/CategoryController.php
@@ -0,0 +1,219 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['post']
+ ]
+ ]
+ ];
+ }
+
+ public function actionIndex()
+ {
+ $dataProvider = new ActiveDataProvider([
+ 'query' => ArticleCategory::find(),
+ 'pagination' => [
+ 'pageSize' => 1,
+ ],
+ ]);
+ return $this->render('index', ['dataProvider' => $dataProvider]);
+ }
+
+ public function actionCreate()
+ {
+ $category_langs = array();
+ $category = new ArticleCategory();
+ $default_lang = Language::getDefaultLang();
+ $images = array();
+ $images[$default_lang->language_id]['full'] = new ArticleCategoryMedia(['scenario' => ArticleCategoryMedia::SCENARIO_FULL]);
+ $images[$default_lang->language_id]['preview'] = new ArticleCategoryMedia(['scenario' => ArticleCategoryMedia::SCENARIO_PREVIEW]);
+ $images[0]['additional'] = new ArticleCategoryMedia(['scenario' => ArticleCategoryMedia::SCENARIO_ADDITIONAL]);
+ $category->loadDefaultValues();
+ $langs = Language::getActiveLanguages();
+ $isValid = false;
+ if(!empty(\Yii::$app->request->post())) {
+ $isValid = true;
+ $category->load(\Yii::$app->request->post());
+ $isValid = $category->validate();
+ foreach(\Yii::$app->request->post()['ArticleCategoryMedia'] as $lang => $value) {
+ foreach($value as $type => $fields) {
+ $images[$lang][$type] = new ArticleCategoryMedia(['scenario' => $type]);
+ $images[$lang][$type]->type = $type;
+ $images[$lang][$type]->language_id = $lang;
+ $images[$lang][$type]->imageFile = UploadedFile::getInstance($images[$lang][$type], "[{$lang}][{$type}]imageFile");
+ $isValid = $images[$lang][$type]->validate(['imageFile']) && $isValid;
+ }
+ }
+ $images[0]['additional']->language_id = 0;
+ $images[0]['additional']->type = 'additional';
+ $images[0]['additional']->imageFile = UploadedFile::getInstances($images[0]['additional'], "[0][additional]imageFile");
+ if(empty(\Yii::$app->request->post()['ArticleCategoryLang'])) {
+ $category_langs[$default_lang->language_id] = new ArticleCategoryLang();
+ $isValid = ArticleCategoryLang::validateMultiple($category_langs) && $isValid;
+ } else {
+ foreach(\Yii::$app->request->post()['ArticleCategoryLang'] as $index => $category_lang) {
+ $category_langs[$index] = new ArticleCategoryLang();
+ }
+ ArticleCategoryLang::loadMultiple($category_langs, \Yii::$app->request->post());
+ $isValid = ArticleCategoryLang::validateMultiple($category_langs) && $isValid;
+ }
+ } else {
+ $category_langs[$default_lang->language_id] = new ArticleCategoryLang();
+ }
+ if($isValid) {
+ $category->save(false);
+ $first = 1;
+ foreach($images as $lang => $value) {
+ foreach($value as $type => $fields) {
+ $images[$lang][$type]->upload($category->article_category_id);
+ if($first && $type != 'additional') {
+ $media_clone = clone $images[$lang][$type];
+ $media_clone->setIsNewRecord(true);
+ unset($media_clone->article_category_media_id);
+ $media_clone->language_id = 0;
+ $media_clone->upload($category->article_category_id);
+ unset($media_clone);
+ $first = 0;
+ }
+ }
+ }
+ $first = 1;
+ foreach($category_langs as $category_lang) {
+ if($first) {
+ $category_lang_clone = clone $category_lang;
+ $category_lang_clone->language_id = 0;
+ $category_lang_clone->link('category', $category);
+ unset($category_lang_clone);
+ }
+ $category_lang->link('category', $category);
+ $first = 0;
+ }
+ echo "ok";
+ //$this->redirect('index');
+ } else {
+ return $this->render('create', [
+ 'category_langs' => $category_langs,
+ 'category' => $category,
+ 'langs' => $langs,
+ 'images' => $images
+ ]);
+ }
+ }
+
+ public function actionUpdate($id)
+ {
+ $category = ArticleCategory::findOne($id);
+ $imagestack = $category->getArticleCategoryMedia()->all();
+ $images = [];
+ $images[0]['additional'][0] = new ArticleCategoryMedia(['scenario' => ArticleCategoryMedia::SCENARIO_ADDITIONAL]);
+ $images[0]['additional'][0]->type = 'additional';
+ $images[0]['additional'][0]->language_id = 0;
+ foreach($imagestack as $image) {
+ if(in_array($image->type, ['full', 'preview'])) {
+ $images[$image->language_id][$image->type] = $image;
+ $images[$image->language_id][$image->type]->scenario = $image->type;
+ } else {
+ $images[$image->language_id][$image->type][$image->article_category_media_id] = $image;
+ $images[$image->language_id][$image->type][$image->article_category_media_id]->scenario = $image->type;
+ }
+ }
+ foreach($images as $lang => $value) {
+ $images[$lang]['additional'][0] = new ArticleCategoryMedia(['scenario' => ArticleCategoryMedia::SCENARIO_ADDITIONAL]);
+ }
+ $category_langs = $category->getArticleCategoryLangs()->where(['>=', 'language_id', '1'])->indexBy('language_id')->all();
+ $langs = Language::getActiveLanguages();
+ $default_lang = Language::getDefaultLang();
+ $isValid = false;
+ if(!empty(\Yii::$app->request->post())) {
+ $isValid = true;
+ $category->load(\Yii::$app->request->post());
+ $isValid = $category->validate();
+ $images[0]['additional'][0]->type = 'additional';
+ $images[0]['additional'][0]->language_id = 0;
+ $images[0]['additional'][0]->imageFile = UploadedFile::getInstances($images[0]['additional'][0], "[0][additional]imageFile");
+ $isValid = $images[0]['additional'][0]->validate(['imageFile']) && $isValid;
+ foreach(\Yii::$app->request->post()['ArticleCategoryMedia'] as $lang => $value) {
+ foreach($value as $type => $fields) {
+ if(!in_array($type, ['full', 'preview'])) continue;
+ $images[$lang][$type] = new ArticleCategoryMedia(['scenario' => $type]);
+ $images[$lang][$type]->language_id = $lang;
+ $images[$lang][$type]->type = $type;
+ $images[$lang][$type]->imageFile = UploadedFile::getInstance($images[$lang][$type], "[{$lang}][{$type}]imageFile");
+ $isValid = $images[$lang][$type]->validate(['imageFile']) && $isValid;
+ }
+ }
+ if(empty(\Yii::$app->request->post()['ArticleCategoryLang'])) {
+ $isValid = ArticleCategoryLang::validateMultiple($category_langs) && $isValid;
+ } else {
+ foreach(\Yii::$app->request->post()['ArticleCategoryLang'] as $index => $category_lang) {
+ if(!array_key_exists($index, $category_langs)) {
+ $category_langs[$index] = new ArticleCategoryLang();
+ $category_langs[$index]->article_category_id = $category->article_category_id;
+ }
+ }
+ ArticleCategoryLang::loadMultiple($category_langs, \Yii::$app->request->post());
+ $isValid = ArticleCategoryLang::validateMultiple($category_langs) && $isValid;
+ }
+ }
+ if($isValid) {
+ $category->save(false);
+ foreach($images as $lang => $value) {
+ foreach($value as $type => $fields) {
+ if($type == 'additional') {
+ $images[$lang][$type][0]->upload($category->article_category_id);
+ } else {
+ if(!empty($images[$lang][$type]->imageFile)) {
+ $images[$lang][$type]->replace($category->article_category_id);
+ }
+ }
+ }
+ }
+ foreach($category_langs as $category_lang) {
+ $category_lang->save(false);
+ }
+ echo "ok";
+ //$this->redirect('index');
+ } else {
+ return $this->render('update', [
+ 'category_langs' => $category_langs,
+ 'category' => $category,
+ 'langs' => $langs,
+ 'images' => $images
+ ]);
+ }
+ }
+
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+ return $this->redirect(['index']);
+ }
+
+ protected function findModel($id)
+ {
+ if (($model = ArticleCategory::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/common/modules/blog/controllers/DefaultController.php b/common/modules/blog/controllers/DefaultController.php
new file mode 100644
index 0000000..81604e5
--- /dev/null
+++ b/common/modules/blog/controllers/DefaultController.php
@@ -0,0 +1,12 @@
+render('index');
+ }
+}
diff --git a/common/modules/blog/controllers/MediaController.php b/common/modules/blog/controllers/MediaController.php
new file mode 100644
index 0000000..43e7920
--- /dev/null
+++ b/common/modules/blog/controllers/MediaController.php
@@ -0,0 +1,45 @@
+request->isPost) {
+ $model->imageFile = UploadedFile::getInstance($model, 'imageFile');
+ if($model->upload()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return $this->render('index', ['model' => $model]);
+ }
+
+ public function actionCreate()
+ {
+
+ }
+
+ public function actionUpdate($id)
+ {
+
+ }
+
+ public function actionDelete($id)
+ {
+ $model = Media::findOne($id);
+ return $model->delete();
+ }
+
+ protected function findModel($id)
+ {
+
+ }
+}
diff --git a/common/modules/blog/controllers/TestController.php b/common/modules/blog/controllers/TestController.php
new file mode 100644
index 0000000..3039a12
--- /dev/null
+++ b/common/modules/blog/controllers/TestController.php
@@ -0,0 +1,17 @@
+language_id] = new ArticleLang();
+ $model[3] = new ArticleLang();
+ return $this->render('index', ['model' => $model]);
+ }
+}
\ No newline at end of file
diff --git a/common/modules/blog/models/Article.php b/common/modules/blog/models/Article.php
new file mode 100644
index 0000000..75c636d
--- /dev/null
+++ b/common/modules/blog/models/Article.php
@@ -0,0 +1,163 @@
+ Autocomplete::className(),
+ 'attributes' => [
+ 'translit' => ['code'],
+ ]
+ ]
+ ];
+ }
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['sort', 'article_pid', 'status', 'comment', 'vote'], 'integer'],
+ [['date_add', 'date_update'], 'safe'],
+ [['code'], 'required'],
+ [['code', 'tag'], 'string']
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'article_id' => Yii::t('app', 'ID'),
+ 'sort' => Yii::t('app', 'Sort'),
+ 'date_add' => Yii::t('app', 'Create At'),
+ 'date_update' => Yii::t('app', 'Update At'),
+ 'code' => Yii::t('app', 'Code'),
+ 'user_id' => Yii::t('app', 'Author'),
+ 'tag' => Yii::t('app', 'Tags'),
+ 'article_pid' => Yii::t('app', 'Parent ID'),
+ 'status' => Yii::t('app', 'Active'),
+ 'comment' => Yii::t('app', 'Comments'),
+ 'vote' => Yii::t('app', 'Voting'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getParent()
+ {
+ return $this->hasOne(Article::className(), ['article_id' => 'article_pid']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticles()
+ {
+ return $this->hasMany(Article::className(), ['article_pid' => 'article_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getUser()
+ {
+ return $this->hasOne(User::className(), ['id' => 'user_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticleLangs()
+ {
+ return $this->hasMany(ArticleLang::className(), ['article_id' => 'article_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticleMedia()
+ {
+ return $this->hasMany(ArticleMedia::className(), ['article_id' => 'article_id']);
+ }
+
+ public function getMedia()
+ {
+ return $this->hasMany(Media::className(), ['article_id' => 'media_id'])->via('articleMedia');
+ }
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticleToCategories()
+ {
+ return $this->hasMany(ArticleToCategory::className(), ['article_id' => 'article_id']);
+ }
+
+ public function getArticleCategories()
+ {
+ return $this->hasMany(ArticleCategory::className(), ['article_category_id' => 'article_category_id'])->viaTable('article_to_category', ['article_id' => 'article_category_id']);
+ }
+
+ public static function findArticleDropdown($id)
+ {
+ $query = new Query();
+ return $query->select(['l.name', 'a.article_id'])
+ ->from(['article a'])
+ ->leftJoin(['article_lang l'], 'a.article_id = l.article_id')
+ ->where(['l.language_id' => 0, 'a.status' => 1])
+ ->andWhere(['not', ['a.article_id' => $id]])
+ ->indexBy('article_id')
+ ->column();
+ }
+
+ public function getArticleCategoriesArray()
+ {
+ return $this->getArticleToCategories()->select('article_category_id')->column();
+ }
+
+}
diff --git a/common/modules/blog/models/ArticleCategory.php b/common/modules/blog/models/ArticleCategory.php
new file mode 100644
index 0000000..411c61a
--- /dev/null
+++ b/common/modules/blog/models/ArticleCategory.php
@@ -0,0 +1,133 @@
+ Autocomplete::className(),
+ 'attributes' => [
+ 'translit' => ['code'],
+ ]
+ ]
+ ];
+ }
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['status', 'sort', 'article_category_pid'], 'integer'],
+ [['code'], 'required'],
+ [['code', 'tag'], 'string'],
+ [['date_add', 'date_update'], 'safe'],
+ [['status'], 'boolean'],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'article_category_id' => Yii::t('app', 'ID'),
+ 'status' => Yii::t('app', 'Active'),
+ 'sort' => Yii::t('app', 'Sort'),
+ 'code' => Yii::t('app', 'Code'),
+ 'date_add' => Yii::t('app', 'Created At'),
+ 'date_update' => Yii::t('app', 'Updated At'),
+ 'tag' => Yii::t('app', 'Tags'),
+ 'article_category_pid' => Yii::t('app', 'Parent ID'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticles()
+ {
+ return $this->hasMany(Article::className(), ['article_id' => 'article_id'])->viaTable('article_to_category', ['article_category_id' => 'article_category_id']) ;
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getParent()
+ {
+ return $this->hasOne(ArticleCategory::className(), ['article_category_id' => 'article_category_pid']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticleCategories()
+ {
+ return $this->hasMany(ArticleCategory::className(), ['article_category_pid' => 'article_category_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticleCategoryLangs()
+ {
+ return $this->hasMany(ArticleCategoryLang::className(), ['article_category_id' => 'article_category_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticleCategoryMedia()
+ {
+ return $this->hasMany(ArticleCategoryMedia::className(), ['article_category_id' => 'article_category_id']);
+ }
+
+ public static function findArticleCategoryDropdown($id)
+ {
+ $query = new Query();
+ return $query->select(['l.name', 'c.article_category_id'])
+ ->from(['article_category c'])
+ ->leftJoin(['article_category_lang l'], 'c.article_category_id = l.article_category_id')
+ ->where(['l.language_id' => 0, 'c.status' => 1])
+ ->andWhere(['not', ['c.article_category_id' => $id]])
+ ->indexBy('article_category_id')
+ ->column();
+ }
+
+}
diff --git a/common/modules/blog/models/ArticleCategoryLang.php b/common/modules/blog/models/ArticleCategoryLang.php
new file mode 100644
index 0000000..748f9c1
--- /dev/null
+++ b/common/modules/blog/models/ArticleCategoryLang.php
@@ -0,0 +1,102 @@
+ Autocomplete::className(),
+ 'attributes' => [
+ 'repeat' => [['preview', 'text', false, 5, true, '...']],
+ ]
+ ]
+ ];
+ }
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['language_id', 'article_category_id'], 'integer'],
+ [['text', 'name'], 'required'],
+ [['text', 'preview', 'seo_url', 'name', 'meta_title', 'meta_descr', 'meta_keyword', 'h1_tag', 'tag'], 'string'],
+ ['seo_url', function($attribute, $params) {
+ $pattern = "/^[a-zA-Z\d_-]+$/";
+ if(!preg_match($pattern, $this->$attribute)) {
+ $this->addError($attribute, Yii::t('app', "Pattern doesn't match."));
+ }
+ }]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'article_category_language_id' => Yii::t('app', 'ID'),
+ 'language_id' => Yii::t('app', 'Lang ID'),
+ 'article_category_id' => Yii::t('app', 'Category ID'),
+ 'text' => Yii::t('app', 'Text'),
+ 'preview' => Yii::t('app', 'Preview'),
+ 'seo_url' => Yii::t('app', 'Seo Url'),
+ 'name' => Yii::t('app', 'Name'),
+ 'meta_title' => Yii::t('app', 'Meta Title'),
+ 'meta_descr' => Yii::t('app', 'Meta Descr'),
+ 'meta_keyword' => Yii::t('app', 'Meta Keywords'),
+ 'h1_tag' => Yii::t('app', 'H1 Tag'),
+ 'tag' => Yii::t('app', 'Tags'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategory()
+ {
+ return $this->hasOne(ArticleCategory::className(), ['article_category_id' => 'article_category_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getLang()
+ {
+ return $this->hasOne(Language::className(), ['language_id' => 'language_id']);
+ }
+}
diff --git a/common/modules/blog/models/ArticleCategoryMedia.php b/common/modules/blog/models/ArticleCategoryMedia.php
new file mode 100644
index 0000000..a8c135c
--- /dev/null
+++ b/common/modules/blog/models/ArticleCategoryMedia.php
@@ -0,0 +1,162 @@
+ 10],
+ [['imageFile'], 'file', 'extensions' => 'png, gif, jpg, jpeg', 'skipOnEmpty' => true, 'on' => self::SCENARIO_FULL],
+ [['imageFile'], 'file', 'extensions' => 'png, gif, jpg, jpeg', 'skipOnEmpty' => true, 'on' => self::SCENARIO_PREVIEW],
+ [['imageFile'], 'file', 'extensions' => 'png, gif, jpg, jpeg', 'skipOnEmpty' => true, 'maxFiles' => 10, 'on' => self::SCENARIO_ADDITIONAL]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'article_category_media_id' => Yii::t('app', 'ID'),
+ 'article_category_id' => Yii::t('app', 'Category ID'),
+ 'media_id' => Yii::t('app', 'Media ID'),
+ 'media_alt' => Yii::t('app', 'Media Alt'),
+ 'media_title' => Yii::t('app', 'Media Title'),
+ 'media_caption' => Yii::t('app', 'Media Caption'),
+ 'type' => Yii::t('app', 'Type'),
+ 'imageFile' => Yii::t('app', 'Image File'),
+ 'language_id' => Yii::t('app', 'Language ID'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategory()
+ {
+ return $this->hasOne(ArticleCategory::className(), ['article_category_id' => 'article_category_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getMedia()
+ {
+ return $this->hasOne(Media::className(), ['media_id' => 'media_id']);
+ }
+
+ public function upload($category_id)
+ {
+ $this->article_category_id = $category_id;
+ if(is_array($this->imageFile)) {
+ $ok = true;
+ foreach($this->imageFile as $image) {
+ $media_category = clone $this;
+ $media = new Media();
+ $media->imageFile = $image;
+ $media->upload();
+ $media_category->media_id = $media->media_id;
+ $ok = $media_category->save() && $ok;
+ unset($media_category);
+ }
+ return $ok;
+ } elseif(!empty($this->imageFile)) {
+ $media = new Media();
+ $media->imageFile = $this->imageFile;
+ $media->upload();
+ $this->media_id = $media->media_id;
+ return $this->save();
+ }
+ }
+
+ public function replace($category_id, $removeMedia = false)
+ {
+ $this->article_category_id = $category_id;
+ if($removeMedia) {
+ $category_media = ArticleCategoryMedia::find()->select('media_id')->where(['article_category_id' => $this->article_category_id, 'type' => $this->type])->column();
+ $media = array();
+ foreach($category_media as $media_id) {
+ $media[] = Media::findOne(['media_id' => $media_id]);
+ }
+ $media = array_unique($media);
+ foreach($media as $one_media) {
+ if($one_media instanceof Media) {
+ $one_media->delete();
+ }
+ }
+ unset($media);
+ unset($category_media);
+ }
+ if(is_array($this->imageFile)) {
+ $ok = true;
+ foreach($this->imageFile as $image) {
+ $media_category = clone $this;
+ $media = new Media();
+ $media->imageFile = $image;
+ $media->upload();
+ $media_category->media_id = $media->media_id;
+ $ok = $media_category->save() && $ok;
+ unset($media_category);
+ }
+ return $ok;
+ } elseif(!empty($this->imageFile)) {
+ ArticleCategoryMedia::deleteAll(['category_id' => $this->article_category_id, 'type' => $this->type]);
+ $media = new Media();
+ $media->imageFile = $this->imageFile;
+ $media->upload();
+ $this->media_id = $media->media_id;
+ $this->setIsNewRecord(true);
+ return $this->save();
+ }
+ }
+
+}
diff --git a/common/modules/blog/models/ArticleLang.php b/common/modules/blog/models/ArticleLang.php
new file mode 100644
index 0000000..94bf761
--- /dev/null
+++ b/common/modules/blog/models/ArticleLang.php
@@ -0,0 +1,85 @@
+ Yii::t('app', 'ID'),
+ 'language_id' => Yii::t('app', 'Lang ID'),
+ 'article_id' => Yii::t('app', 'Article ID'),
+ 'text' => Yii::t('app', 'Text'),
+ 'seo_url' => Yii::t('app', 'Seo Url'),
+ 'name' => Yii::t('app', 'Name'),
+ 'preview' => Yii::t('app', 'Preview'),
+ 'meta_title' => Yii::t('app', 'Meta Title'),
+ 'meta_descr' => Yii::t('app', 'Meta Descr'),
+ 'meta_keyword' => Yii::t('app', 'Meta Keywords'),
+ 'h1_tag' => Yii::t('app', 'H1 Tag'),
+ 'tag' => Yii::t('app', 'Tags'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticle()
+ {
+ return $this->hasOne(Article::className(), ['article_id' => 'article_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getLang()
+ {
+ return $this->hasOne(Language::className(), ['language_id' => 'language_id']);
+ }
+}
diff --git a/common/modules/blog/models/ArticleMedia.php b/common/modules/blog/models/ArticleMedia.php
new file mode 100644
index 0000000..977f8a8
--- /dev/null
+++ b/common/modules/blog/models/ArticleMedia.php
@@ -0,0 +1,161 @@
+ 10],
+ [['imageFile'], 'file', 'extensions' => 'png, gif, jpg, jpeg', 'skipOnEmpty' => true, 'on' => self::SCENARIO_FULL],
+ [['imageFile'], 'file', 'extensions' => 'png, gif, jpg, jpeg', 'skipOnEmpty' => true, 'on' => self::SCENARIO_PREVIEW],
+ [['imageFile'], 'file', 'extensions' => 'png, gif, jpg, jpeg', 'skipOnEmpty' => true, 'maxFiles' => 10, 'on' => self::SCENARIO_ADDITIONAL]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'article_media_id' => Yii::t('app', 'ID'),
+ 'article_id' => Yii::t('app', 'Article ID'),
+ 'media_id' => Yii::t('app', 'Media ID'),
+ 'type' => Yii::t('app', 'Type'),
+ 'media_alt' => Yii::t('app', 'Media Alt'),
+ 'media_title' => Yii::t('app', 'Media Title'),
+ 'media_caption' => Yii::t('app', 'Media Caption'),
+ 'imageFile' => Yii::t('app', 'Image File'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticle()
+ {
+ return $this->hasOne(Article::className(), ['article_id' => 'article_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getMedia()
+ {
+ return $this->hasOne(Media::className(), ['media_id' => 'media_id']);
+ }
+
+ public function upload($article_id)
+ {
+ $this->article_id = $article_id;
+ if(is_array($this->imageFile)) {
+ $ok = true;
+ foreach($this->imageFile as $image) {
+ $media_article = clone $this;
+ $media = new Media();
+ $media->imageFile = $image;
+ $media->upload();
+ $media_article->media_id = $media->media_id;
+ $ok = $media_article->save() && $ok;
+ unset($media_article);
+ }
+ return $ok;
+ } elseif(!empty($this->imageFile)) {
+ $media = new Media();
+ $media->imageFile = $this->imageFile;
+ $media->upload();
+ $this->media_id = $media->media_id;
+ return $this->save();
+ }
+ }
+
+ public function replace($article_id, $removeMedia = false)
+ {
+ $this->article_id = $article_id;
+ if($removeMedia && !$this->getIsNewRecord()) {
+ $article_media = ArticleMedia::find()->select('media_id')->where(['article_id' => $this->article_id, 'type' => $this->type, 'language_id' => $this->language_id])->column();
+ $media = array();
+ foreach($article_media as $media_id) {
+ $media[] = Media::findOne(['media_id' => $media_id]);
+ }
+ $media = array_unique($media);
+ foreach($media as $one_media) {
+ if($one_media instanceof Media) {
+ $one_media->delete();
+ }
+ }
+ unset($media);
+ unset($article_media);
+ }
+ if(is_array($this->imageFile)) {
+ $ok = true;
+ foreach($this->imageFile as $image) {
+ $media_article = clone $this;
+ $media = new Media();
+ $media->imageFile = $image;
+ $media->upload();
+ $media_article->media_id = $media->media_id;
+ $ok = $media_article->save() && $ok;
+ unset($media_article);
+ }
+ return $ok;
+ } elseif(!empty($this->imageFile)) {
+ ArticleMedia::deleteAll(['article_id' => $this->article_id, 'type' => $this->type, 'language_id' => $this->language_id]);
+ $media = new Media();
+ $media->imageFile = $this->imageFile;
+ $media->upload();
+ $this->media_id = $media->media_id;
+ $this->setIsNewRecord(true);
+ return $this->save();
+ }
+ }
+
+}
diff --git a/common/modules/blog/models/ArticleToCategory.php b/common/modules/blog/models/ArticleToCategory.php
new file mode 100644
index 0000000..3032fde
--- /dev/null
+++ b/common/modules/blog/models/ArticleToCategory.php
@@ -0,0 +1,62 @@
+ Yii::t('app', 'Article ID'),
+ 'article_category_id' => Yii::t('app', 'Category ID'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getArticle()
+ {
+ return $this->hasOne(Article::className(), ['article_id' => 'article_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategory()
+ {
+ return $this->hasOne(ArticleCategory::className(), ['article_category_id' => 'article_category_id']);
+ }
+}
diff --git a/common/modules/blog/views/ajax/_article_form.php b/common/modules/blog/views/ajax/_article_form.php
new file mode 100644
index 0000000..22f8b05
--- /dev/null
+++ b/common/modules/blog/views/ajax/_article_form.php
@@ -0,0 +1,38 @@
+
+
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]language_id"]))->label(false)->hiddenInput(['value' => $model->language_id]) ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]text", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]preview", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]seo_url"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]name"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_title"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_descr"]))->textarea() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_keyword"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]h1_tag"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]tag"]))->textInput() ?>
+
+
+end();
+ }
+?>
diff --git a/common/modules/blog/views/ajax/_article_form_test.php b/common/modules/blog/views/ajax/_article_form_test.php
new file mode 100644
index 0000000..237311e
--- /dev/null
+++ b/common/modules/blog/views/ajax/_article_form_test.php
@@ -0,0 +1,38 @@
+
+
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]language_id"]))->label(false)->hiddenInput(['value' => $model->language_id]) ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]text", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]preview", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]seo_url"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]name"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_title"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_descr"]))->textarea() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]meta_keyword"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]h1_tag"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $model, 'attribute' => "[$model->language_id]tag"]))->textInput() ?>
+
+
+end();
+ }
+?>
diff --git a/common/modules/blog/views/ajax/_article_media_form.php b/common/modules/blog/views/ajax/_article_media_form.php
new file mode 100644
index 0000000..6058444
--- /dev/null
+++ b/common/modules/blog/views/ajax/_article_media_form.php
@@ -0,0 +1,17 @@
+
+
+
+ = (new ActiveField(['model' => $article_lang, 'attribute' => "[$model->language_id][$type]language_id"]))->label(false)->hiddenInput(['value' => $model->language_id]) ?>
+
+ = (new ActiveField(['model' => $article_lang, 'attribute' => "[$model->language_id][$type]imageFile"]))->fileInput(['class' => 'image_inputs_field']) ?>
+
+
+end();
+?>
diff --git a/common/modules/blog/views/ajax/_category_form.php b/common/modules/blog/views/ajax/_category_form.php
new file mode 100644
index 0000000..cff9b7e
--- /dev/null
+++ b/common/modules/blog/views/ajax/_category_form.php
@@ -0,0 +1,33 @@
+
+
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]language_id"]))->label(false)->hiddenInput(['value' => $model->language_id]) ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]text", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]preview", 'form' => $form]))->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ]]); ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]seo_url"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]name"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]meta_title"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]meta_descr"]))->textarea() ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]meta_keyword"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]h1_tag"]))->textInput() ?>
+
+ = (new ActiveField(['model' => $category_lang, 'attribute' => "[$model->language_id]tag"]))->textInput() ?>
+
+
+end();
+?>
diff --git a/common/modules/blog/views/article/_form.php b/common/modules/blog/views/article/_form.php
new file mode 100644
index 0000000..71d165e
--- /dev/null
+++ b/common/modules/blog/views/article/_form.php
@@ -0,0 +1,172 @@
+
+
+
+ ['enctype' => 'multipart/form-data']]); ?>
+
+ = $form->field($article, 'code')->hint(Yii::t('app', 'Insensitive latin non-space'))->textInput() ?>
+
+ = $form->field($article, 'tag')->hint(Yii::t('app', 'Comma-separated'))->textInput() ?>
+
+ = $form->field($article, 'sort')->input('number') ?>
+
+ = $form->field($article, 'article_pid')
+ ->dropDownList(Article::findArticleDropdown($article->article_id), ['prompt' => Yii::t('app', 'Select parent')]) ?>
+
+ = $form->field($article, 'articleCategoriesArray')
+ ->dropDownList(ArticleCategory::findArticleCategoryDropdown(NULL), ['multiple' => 'multiple'])->label(\Yii::t('app', 'Article Categories Array')); ?>
+
+ = $form->field($article, 'status')->checkbox() ?>
+
+
+
+
+ Url::to(['/blog/ajax/article-media-form?type=full']),
+ 'form' => $form,
+ 'data_langs' => $article->getIsNewRecord()?$images:ArticleMedia::find()->where(['article_id' => $article->article_id, 'type' => 'full'])->indexBy('language_id')->all()
+ ]);
+ $first = 1;
+ foreach($images as $lang => $value) {
+ if(!array_key_exists('full', $value)) continue;
+ ?>
+
+ field($images[$lang]['full'], "[{$lang}][full]language_id")->label(false)->hiddenInput(['value' => $lang]);
+ echo $form->field($images[$lang]['full'], "[{$lang}][full]imageFile")->fileInput(['class' => 'image_inputs_field']);
+ if(!empty($images[$lang]['full']->article_media_id)) {
+ echo "
media->hash}/original.{$images[$lang]['full']->media->extension}' width='100' class='image_inputs_prev'>";
+ }
+ ?>
+
+ end();
+ ?>
+
+
+ Url::to(['/blog/ajax/article-media-form?type=preview']),
+ 'form' => $form,
+ 'data_langs' => $article->getIsNewRecord()?$images:ArticleMedia::find()->where(['article_id' => $article->article_id, 'type' => 'preview'])->indexBy('language_id')->all()
+ ]);
+ $first = 1;
+ foreach($images as $lang => $value) {
+ if(!array_key_exists('preview', $value)) continue;
+ ?>
+
+ field($images[$lang]['preview'], "[{$lang}][preview]language_id")->label(false)->hiddenInput(['value' => $lang]);
+ echo $form->field($images[$lang]['preview'], "[{$lang}][preview]imageFile")->fileInput(['class' => 'image_inputs_field']);
+ if(!empty($images[$lang]['preview']->article_media_id)) {
+ echo "
media->hash}/original.{$images[$lang]['preview']->media->extension}' width='100' class='image_inputs_prev'>";
+ }
+ ?>
+
+ end();
+ ?>
+
+
+ field(is_array($images[0]['additional'])?$images[0]['additional'][0]:$images[0]['additional'], "[0][additional]imageFile[]")->fileInput(['multiple' => 'multiple', 'class' => 'image_inputs_field']);
+ if(is_array($images[0]['additional']) && count($images[0]['additional']) > 1) {
+ foreach($images[0]['additional'] as $onefield => $oneimage) {
+ if($onefield) {
+ ?>
+
+
+
+
+
+
+
+ $article_langs,
+ 'form' => $form,
+ 'ajaxView' => '@common/modules/blog/views/ajax/_article_form',
+ ]);
+ /*
+ $multilang = Multilang::begin(['ajaxpath' => Url::to(['/blog/ajax/article-form']), 'form' => $form, 'data_langs' => $article_langs]);
+ ?>
+ $article_lang) {
+ ?>
+
+
+ = $form->field($article_langs[$index], "[$index]language_id")->label(false)->hiddenInput(['value' => $index]) ?>
+
+ = $form->field($article_langs[$index], "[$index]text")->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ], ]); ?>
+
+ = $form->field($article_langs[$index], "[$index]preview")->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ], ]); ?>
+
+ = $form->field($article_langs[$index], "[$index]seo_url")->textInput() ?>
+
+ = $form->field($article_langs[$index], "[$index]name")->textInput() ?>
+
+ = $form->field($article_langs[$index], "[$index]meta_title")->textInput() ?>
+
+ = $form->field($article_langs[$index], "[$index]meta_descr")->textarea(); ?>
+
+ = $form->field($article_langs[$index], "[$index]meta_keywords")->textInput() ?>
+
+ = $form->field($article_langs[$index], "[$index]h1_tag")->textInput() ?>
+
+ = $form->field($article_langs[$index], "[$index]tags")->textInput() ?>
+
+
+
+ end();
+ */
+ ?>
+
+
+ = Html::submitButton($article->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $article->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/modules/blog/views/article/create.php b/common/modules/blog/views/article/create.php
new file mode 100644
index 0000000..1524640
--- /dev/null
+++ b/common/modules/blog/views/article/create.php
@@ -0,0 +1,19 @@
+title = Yii::t('app', 'Article create');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Articles'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'article_langs' => $article_langs,
+ 'article' => $article,
+ 'langs' => $langs,
+ 'images' => $images
+ ]) ?>
+
+
diff --git a/common/modules/blog/views/article/index.php b/common/modules/blog/views/article/index.php
new file mode 100644
index 0000000..8229525
--- /dev/null
+++ b/common/modules/blog/views/article/index.php
@@ -0,0 +1,32 @@
+ $dataProvider,
+ 'columns' => [
+ 'article_id',
+ 'code',
+ 'date_add',
+ [
+ 'value' => function($data) {
+ return $data->user->firstname.' '.$data->user->lastname;
+ },
+ 'header' => Yii::t('app', 'Author')
+ ],
+ [
+ 'class' => Column::className(),
+ 'header' => Yii::t('app', 'Name'),
+ 'content' => function($model, $key, $index, $column) {
+ return $model->getArticleLangs()->where(['language_id' => Language::getDefaultLang()->language_id])->one()->name;
+ }
+ ],
+ [
+ 'class' => ActionColumn::className(),
+ 'template' => '{update} {delete}'
+ ]
+ ]
+]);
\ No newline at end of file
diff --git a/common/modules/blog/views/article/update.php b/common/modules/blog/views/article/update.php
new file mode 100644
index 0000000..12f4704
--- /dev/null
+++ b/common/modules/blog/views/article/update.php
@@ -0,0 +1,18 @@
+title = Yii::t('app', 'Article update');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Articles'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ = $this->render('_form', [
+ 'article_langs' => $article_langs,
+ 'article' => $article,
+ 'langs' => $langs,
+ 'images' => $images
+ ]) ?>
+
+
diff --git a/common/modules/blog/views/category/_form.php b/common/modules/blog/views/category/_form.php
new file mode 100644
index 0000000..71c0d42
--- /dev/null
+++ b/common/modules/blog/views/category/_form.php
@@ -0,0 +1,158 @@
+
+
+
+ ['enctype' => 'multipart/form-data']]); ?>
+
+ = $form->field($category, 'code')->hint(Yii::t('app', 'Insensitive latin non-space'))->textInput() ?>
+
+ = $form->field($category, 'tag')->hint(Yii::t('app', 'Comma-separated'))->textInput() ?>
+
+ = $form->field($category, 'sort')->input('number') ?>
+
+ = $form->field($category, 'article_category_pid')
+ ->dropDownList(ArticleCategory::findArticleCategoryDropdown($category->article_category_id), ['prompt' => Yii::t('app', 'Select parent')]) ?>
+
+ = $form->field($category, 'status')->checkbox() ?>
+
+
+
+
+ Url::to(['/blog/ajax/article-category-media-form?type=full']),
+ 'form' => $form,
+ 'data_langs' => $category->getIsNewRecord()?$images:ArticleCategoryMedia::find()->where(['article_category_id' => $category->article_category_id, 'type' => 'full'])->indexBy('language_id')->all()
+ ]);
+ $first = 1;
+ foreach($images as $lang => $value) {
+ if(!array_key_exists('full', $value)) continue;
+ ?>
+
+ field($images[$lang]['full'], "[{$lang}][full]language_id")->label(false)->hiddenInput(['value' => $lang]);
+ echo $form->field($images[$lang]['full'], "[{$lang}][full]imageFile")->fileInput(['class' => 'image_inputs_field']);
+ if(!empty($images[$lang]['full']->article_category_media_id)) {
+ echo "
media->hash}/original.{$images[$lang]['full']->media->extension}' width='100' class='image_inputs_prev'>";
+ }
+ ?>
+
+ end();
+ ?>
+
+
+ Url::to(['/blog/ajax/article-category-media-form?type=preview']),
+ 'form' => $form,
+ 'data_langs' => $category->getIsNewRecord()?$images:ArticleCategoryMedia::find()->where(['article_category_id' => $category->article_category_id, 'type' => 'preview'])->indexBy('language_id')->all()
+ ]);
+ $first = 1;
+ foreach($images as $lang => $value) {
+ if(!array_key_exists('preview', $value)) continue;
+ ?>
+
+ field($images[$lang]['preview'], "[{$lang}][preview]language_id")->label(false)->hiddenInput(['value' => $lang]);
+ echo $form->field($images[$lang]['preview'], "[{$lang}][preview]imageFile")->fileInput(['class' => 'image_inputs_field']);
+ if(!empty($images[$lang]['preview']->article_category_media_id)) {
+ echo "
media->hash}/original.{$images[$lang]['preview']->media->extension}' width='100' class='image_inputs_prev'>";
+ }
+ ?>
+
+ end();
+ ?>
+
+
+ field(is_array($images[0]['additional'])?$images[0]['additional'][0]:$images[0]['additional'], "[0][additional]imageFile[]")->fileInput(['multiple' => 'multiple', 'class' => 'image_inputs_field']);
+ if(is_array($images[0]['additional']) && count($images[0]['additional']) > 1) {
+ foreach($images[0]['additional'] as $onefield => $oneimage) {
+ if($onefield) {
+ ?>
+
+
+
+
+
+
+
+ Url::to(['/blog/ajax/category-form']), 'form' => $form, 'data_langs' => $category_langs])
+ ?>
+ $category_lang) {
+ ?>
+
+ = $form->field($category_langs[$index], "[$index]language_id")->label(false)->hiddenInput(['value' => $index]) ?>
+
+ = $form->field($category_langs[$index], "[$index]text")->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ], ]); ?>
+
+ = $form->field($category_langs[$index], "[$index]preview")->widget(CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ], ]); ?>
+
+ = $form->field($category_langs[$index], "[$index]seo_url")->textInput() ?>
+
+ = $form->field($category_langs[$index], "[$index]name")->textInput() ?>
+
+ = $form->field($category_langs[$index], "[$index]meta_title")->textInput() ?>
+
+ = $form->field($category_langs[$index], "[$index]meta_descr")->textarea(); ?>
+
+ = $form->field($category_langs[$index], "[$index]meta_keyword")->textInput() ?>
+
+ = $form->field($category_langs[$index], "[$index]h1_tag")->textInput() ?>
+
+ = $form->field($category_langs[$index], "[$index]tag")->textInput() ?>
+
+
+
+ end();
+ ?>
+
+
+ = Html::submitButton($category->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $category->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/modules/blog/views/category/create.php b/common/modules/blog/views/category/create.php
new file mode 100644
index 0000000..dc19a6f
--- /dev/null
+++ b/common/modules/blog/views/category/create.php
@@ -0,0 +1,19 @@
+title = Yii::t('app', 'Category create');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'category_langs' => $category_langs,
+ 'category' => $category,
+ 'langs' => $langs,
+ 'images' => $images
+ ]) ?>
+
+
diff --git a/common/modules/blog/views/category/index.php b/common/modules/blog/views/category/index.php
new file mode 100644
index 0000000..dce7f03
--- /dev/null
+++ b/common/modules/blog/views/category/index.php
@@ -0,0 +1,26 @@
+ $dataProvider,
+ 'columns' => [
+ 'article_category_id',
+ 'code',
+ 'date_add',
+ 'date_update',
+ [
+ 'class' => Column::className(),
+ 'header' => Yii::t('app', 'Name'),
+ 'content' => function($model, $key, $index, $column) {
+ return $model->getArticleCategoryLangs()->orderBy(['language_id' => 'ASC'])->one()->name;
+ }
+ ],
+ [
+ 'class' => ActionColumn::className(),
+ 'template' => '{update} {delete}'
+ ]
+ ]
+]);
\ No newline at end of file
diff --git a/common/modules/blog/views/category/update.php b/common/modules/blog/views/category/update.php
new file mode 100644
index 0000000..57e81e3
--- /dev/null
+++ b/common/modules/blog/views/category/update.php
@@ -0,0 +1,18 @@
+title = Yii::t('app', 'Update category');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Categories'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ = $this->render('_form', [
+ 'category_langs' => $category_langs,
+ 'category' => $category,
+ 'langs' => $langs,
+ 'images' => $images
+ ]) ?>
+
+
diff --git a/common/modules/blog/views/default/index.php b/common/modules/blog/views/default/index.php
new file mode 100644
index 0000000..efb5c35
--- /dev/null
+++ b/common/modules/blog/views/default/index.php
@@ -0,0 +1,7 @@
+value);
\ No newline at end of file
diff --git a/common/modules/blog/views/media/index.php b/common/modules/blog/views/media/index.php
new file mode 100644
index 0000000..e536935
--- /dev/null
+++ b/common/modules/blog/views/media/index.php
@@ -0,0 +1,37 @@
+ ['enctype' => 'multipart/form-data']]);
+
+echo $form->field($model, 'imageFile')->fileInput(['multiple' => 'multiple']);
+
+?>
+
+
+ = Html::submitButton(Yii::t('app', 'Create'), ['class' => 'btn btn-success']) ?>
+
+
+
diff --git a/common/modules/blog/views/test/index.php b/common/modules/blog/views/test/index.php
new file mode 100644
index 0000000..f24ade0
--- /dev/null
+++ b/common/modules/blog/views/test/index.php
@@ -0,0 +1,11 @@
+ $model,
+ 'form' => $form,
+ 'ajaxView' => '@common/modules/blog/views/ajax/_article_form_test',
+]);
+$form->end();
\ No newline at end of file
diff --git a/common/modules/comment/Controller.php b/common/modules/comment/Controller.php
new file mode 100644
index 0000000..4d28192
--- /dev/null
+++ b/common/modules/comment/Controller.php
@@ -0,0 +1,97 @@
+ [
+ 'class' => \yii\filters\VerbFilter::className(),
+ 'actions' => [
+ '*' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ public function actionDelete()
+ {
+ \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
+ $post = \Yii::$app->request->post('Comment');
+ if(!empty($post['comment_id'])) {
+ if($model = \common\modules\comment\models\Comment::findOne($post['comment_id'])) {
+ /**
+ * @var \common\modules\comment\models\Comment $model
+ */
+ $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
+ if($model->deleteComment()) {
+ \Yii::$app->response->data = ['text' => 'Comment marked as deleted and will be check by administrators'];
+ } else {
+ \Yii::$app->response->data = ['error' => $model->hasErrors('comment_id')?$model->getFirstError('comment_id'):'Cannot delete message'];
+ }
+ }else {
+ \Yii::$app->response->data = ['error' => 'Comment not found'];
+ };
+ } else {
+ \Yii::$app->response->data = ['error' => 'Missing comment_id'];
+ }
+ \Yii::$app->response->send();
+ }
+
+ public function actionUpdate()
+ {
+ \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
+ $post = \Yii::$app->request->post();
+ if(!empty($post['Comment']['comment_id'])) {
+ if($model = \common\modules\comment\models\Comment::findOne($post['Comment']['comment_id'])) {
+ /**
+ * @var \common\modules\comment\models\Comment $model
+ */
+ $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
+ $model->load($post);
+ if(empty($post['Comment']['comment_pid'])) {
+ $model->comment_pid = null;
+ }
+ if($model->updateComment()) {
+ \Yii::$app->response->data = ['text' => 'Comment successfully updated'];
+ } else {
+ \Yii::$app->response->data = ['error' => $model->hasErrors()?$model->getFirstErrors():'Cannot update message'];
+ }
+ }else {
+ \Yii::$app->response->data = ['error' => 'Comment not found'];
+ };
+ } else {
+ \Yii::$app->response->data = ['error' => 'Missing comment_id'];
+ }
+ \Yii::$app->response->send();
+ }
+
+ public function actionForm()
+ {
+ $post = \Yii::$app->request->post('Comment');
+ if(!empty($post['comment_id'])) {
+ $model = \common\modules\comment\models\Comment::find()->where(['comment_id' => $post['comment_id']])->with('parent', 'author')->one();
+ if($model) {
+ /**
+ * @var \common\modules\comment\models\Comment $model
+ */
+ $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
+ if($model->checkUpdate()) {
+ return $this->renderAjax('@common/modules/comment/views/comment_form', [
+ 'model' => $model,
+ ]);
+ } else {
+ \Yii::$app->response->data = ['error' => 'You are not able to update this comment'];
+ }
+ }else {
+ \Yii::$app->response->data = ['error' => 'Comment not found'];
+ };
+ } else {
+ \Yii::$app->response->data = ['error' => 'Missing comment_id'];
+ }
+ \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
+ \Yii::$app->response->send();
+ }
+
+ }
\ No newline at end of file
diff --git a/common/modules/comment/Module.php b/common/modules/comment/Module.php
new file mode 100644
index 0000000..e69f500
--- /dev/null
+++ b/common/modules/comment/Module.php
@@ -0,0 +1,74 @@
+
+ * [
+ * 'rules' => [
+ * \full\namapaced\ClassName,
+ * \another\one\ClassName,
+ * ],
+ * 'permissions' => [
+ * [
+ * 'name' => stringName,
+ * 'description' => descriptionText,
+ * 'ruleName' => (new \full\namespaced\ClassName())->name (optional)
+ * ],
+ * [
+ * 'name' => stringName2,
+ * 'description' => descriptionText2,
+ * 'ruleName' => (new \another\one\ClassName())->name (optional)
+ * ],
+ * ]
+ * ]
+ *
+ *
+ * @var array
+ * @see \common\modules\comment\commands\RbacController
+ */
+ public $rbac = [];
+
+ /**
+ * @var \yii\db\Connection Connection to the db
+ */
+ public $db = null;
+
+ /**
+ * @inheritdoc
+ */
+ public function init()
+ {
+ parent::init();
+ if(\Yii::$app instanceof \yii\console\Application) {
+ $this->controllerNamespace = 'common\modules\comment\commands';
+ }
+ if($this->db === null) {
+ $this->db = \Yii::$app->db;
+ } elseif(!$this->db instanceof \yii\db\Connection) {
+ throw new \yii\base\InvalidConfigException('Конфиг db обязан наследоваться от'.\yii\db\Connection::className());
+ }
+ }
+ }
\ No newline at end of file
diff --git a/common/modules/comment/Permissions.php b/common/modules/comment/Permissions.php
new file mode 100644
index 0000000..5328127
--- /dev/null
+++ b/common/modules/comment/Permissions.php
@@ -0,0 +1,12 @@
+ \yii\web\View::POS_READY,
+ ];
+
+ }
\ No newline at end of file
diff --git a/common/modules/comment/commands/RbacController.php b/common/modules/comment/commands/RbacController.php
new file mode 100644
index 0000000..3ca8555
--- /dev/null
+++ b/common/modules/comment/commands/RbacController.php
@@ -0,0 +1,81 @@
+controller->module;
+ if(!$module->useRbac) {
+ throw new \yii\base\InvalidConfigException('Please set useRbac config to TRUE in your module configs');
+ }
+ $auth = \Yii::$app->getAuthManager();
+ if(!$auth instanceof \yii\rbac\ManagerInterface) {
+ throw new \yii\base\InvalidConfigException('ManagerInterface is not configured');
+ }
+ if(!empty($module->rbac['rules'])) {
+ foreach($module->rbac['rules'] as $rule) {
+ $rule_model = new $rule();
+ echo "Creating rule: ".$rule_model->name."\n";
+ if($auth->add($rule_model)) {
+ echo "Successful\n";
+ } else {
+ echo "Failed\n";
+ }
+ unset($rule_model);
+ }
+ }
+ if(!empty($module->rbac['permissions'])) {
+ foreach($module->rbac['permissions'] as $permission) {
+ echo "Creating permission: ".$permission['name']."\n";
+ if($auth->add(new \yii\rbac\Permission($permission))) {
+ echo "Successful\n";
+ } else {
+ echo "Failed\n";
+ }
+ }
+ }
+ }
+
+ public function actionUninstall()
+ {
+ /**
+ * @var \common\modules\comment\Module $module
+ */
+ $module = \Yii::$app->controller->module;
+ if(!$module->useRbac) {
+ throw new \yii\base\InvalidConfigException('Please set useRbac config to TRUE in your module configs');
+ }
+ $auth = \Yii::$app->getAuthManager();
+ if(!$auth instanceof \yii\rbac\ManagerInterface) {
+ throw new \yii\base\InvalidConfigException('ManagerInterface is not configured');
+ }
+ if(!empty($module->rbac['rules'])) {
+ foreach($module->rbac['rules'] as $rule) {
+ $rule_model = new $rule();
+ echo "Removing rule: ".$rule_model->name."\n";
+ if($auth->remove($rule_model)) {
+ echo "Successful\n";
+ } else {
+ echo "Failed\n";
+ }
+ unset($rule_model);
+ }
+ }
+ if(!empty($module->rbac['permissions'])) {
+ foreach($module->rbac['permissions'] as $permission) {
+ echo "Removing permission: ".$permission['name']."\n";
+ if($auth->remove(new \yii\rbac\Permission($permission))) {
+ echo "Successful\n";
+ } else {
+ echo "Failed\n";
+ }
+ }
+ }
+ }
+
+ }
\ No newline at end of file
diff --git a/common/modules/comment/interfaces/CommentInterface.php b/common/modules/comment/interfaces/CommentInterface.php
new file mode 100644
index 0000000..3fee3fa
--- /dev/null
+++ b/common/modules/comment/interfaces/CommentInterface.php
@@ -0,0 +1,11 @@
+ 1,
+ ],
+ [
+ [ 'comment_pid' ],
+ 'exist',
+ 'targetAttribute' => 'comment_id',
+ 'filter' => [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ],
+ ],
+ ];
+ }
+
+ public function scenarios()
+ {
+ return [
+ self::SCENARIO_GUEST => [
+ 'user_name',
+ 'user_email',
+ 'text',
+ 'comment_pid',
+ ],
+ self::SCENARIO_USER => [
+ 'text',
+ 'comment_pid',
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function behaviors()
+ {
+ return [
+ [
+ 'class' => \yii\behaviors\TimestampBehavior::className(),
+ 'createdAtAttribute' => 'date_add',
+ 'updatedAtAttribute' => 'date_update',
+ 'value' => new \yii\db\Expression('NOW()'),
+ ],
+ ];
+ }
+
+ public function afterSave($insert, $changedAttributes)
+ {
+ if($this->model == User::className()) {
+ if($user = User::findOne($this->model_id)) {
+ /**
+ * @var User $user
+ */
+ $user->updateRating();
+ }
+ }
+ parent::afterSave($insert, $changedAttributes);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tableName()
+ {
+ return '{{%comment}}';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'text' => \Yii::t('app', 'Комментарий'),
+ 'user_name' => \Yii::t('app', 'Имя'),
+ 'user_email' => \Yii::t('app', 'Email'),
+ ];
+ }
+
+ public function getGuestComment()
+ {
+ return $this->guestComment;
+ }
+
+ public function setGuestComment($value)
+ {
+ $this->guestComment = $value;
+ }
+
+ /**
+ * @param string $model
+ * @param integer $model_id
+ *
+ * @return ActiveQuery
+ */
+ public function getComments($model, $model_id)
+ {
+ return $this->find()
+ ->where([
+ 'comment.model' => $model,
+ 'comment.model_id' => $model_id,
+ 'comment.status' => 1,
+ ])->with('rating');
+ }
+
+ public function postComment()
+ {
+ if($this->checkCreate()) {
+ if($this->insert()) {
+ $this->clearSafe();
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ $this->addError('comment_id', 'You can`t post comment here');
+ return false;
+ }
+ }
+
+ public function updateComment()
+ {
+ if($this->checkUpdate()) {
+ if(empty( $this->comment_id )) {
+ $this->addError('comment_id', 'Comment ID not found');
+ return false;
+ } else {
+ if($this->update()) {
+ $this->clearSafe();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ $this->addError('comment_id', 'You can`t update this post');
+ return false;
+ }
+ }
+
+ public function deleteComment()
+ {
+ if($this->checkDelete()) {
+ if(empty( $this->comment_id )) {
+ $this->addError('comment_id', 'Comment ID not found');
+ return false;
+ } else {
+ if($this->status == self::STATUS_DELETED) {
+ return false;
+ }
+ $this->status = self::STATUS_DELETED;
+ if($this->update()) {
+ $this->clearSafe();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ $this->addError('comment_id', 'You can`t delete this post');
+ return false;
+ }
+ }
+
+ public function checkCreate()
+ {
+ if($this->getGuestComment()) {
+ return true;
+ } else {
+ return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]);
+ }
+ }
+
+ public function checkUpdate()
+ {
+ if($this->scenario == self::SCENARIO_GUEST) {
+ return false;
+ } else {
+ return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]);
+ }
+ }
+
+ public function checkDelete()
+ {
+ if($this->scenario == self::SCENARIO_GUEST) {
+ return false;
+ } else {
+ return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]);
+ }
+ }
+
+ protected function clearSafe($setNew = true)
+ {
+ $safe = $this->safeAttributes();
+ $count = count($safe);
+ $values = array_fill(0, $count, NULL);
+ $result = array_combine($safe, $values);
+ $this->setAttributes($result);
+ $this->setIsNewRecord($setNew);
+ }
+
+ public function getParent()
+ {
+ return $this->hasOne(self::className(), [ 'comment_id' => 'comment_pid' ]);
+ }
+
+ public function getAuthor()
+ {
+ // if($this->user_id != NULL) {
+ return $this->hasOne(\common\models\User::className(), [ 'id' => 'user_id' ]);
+ // } else {
+ // return ['firstname' => $this->user_name, 'email' => $this->user_email];
+ // }
+ }
+
+ public function checkRating()
+ {
+ $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [
+ 'model_id' => 'comment_id',
+ ])
+ ->andWhere([
+ 'model' => $this->className(),
+ ])
+ ->one();
+ if(!$rating instanceof \common\modules\comment\models\Rating && !empty($this->primaryKey)) {
+ $rating = new \common\modules\comment\models\Rating([
+ 'model' => $this->className(),
+ 'model_id' => $this->comment_id,
+ 'user_id' => $this->user_id,
+ ]);
+ $rating->save();
+ }
+ }
+
+ public function getRating()
+ {
+ $this->checkRating();
+ return $this->hasOne(\common\modules\comment\models\Rating::className(), [
+ 'model_id' => 'comment_id',
+ ])
+ ->andWhere([ 'model' => $this->className() ]);
+ }
+
+ public function hasRating($return = true)
+ {
+ $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [
+ 'model_id' => 'comment_id',
+ ])
+ ->andWhere([ 'model' => $this->className() ])
+ ->andWhere([
+ 'not',
+ [ 'value' => NULL ],
+ ])
+ ->one();
+ if($return) {
+ return $rating;
+ } else {
+ return $rating ? true : false;
+ }
+ }
+
+ public function getUser()
+ {
+ return $this->hasOne(User::className(), [ 'id' => 'user_id' ]);
+ }
+
+ }
diff --git a/common/modules/comment/models/CommentProject.php b/common/modules/comment/models/CommentProject.php
new file mode 100644
index 0000000..dd3a942
--- /dev/null
+++ b/common/modules/comment/models/CommentProject.php
@@ -0,0 +1,437 @@
+ 0,
+ ],
+ [
+ [
+ 'budget_currency',
+ ],
+ 'default',
+ 'value' => 3,
+ ],
+ [
+ [ 'budget_currency' ],
+ 'exist',
+ 'targetClass' => Currency::className(),
+ 'targetAttribute' => 'currency_id',
+ ],
+ [
+ [
+ 'files',
+ ],
+ 'string',
+ ],
+ [
+ [
+ 'file',
+ ],
+ 'safe',
+ ],
+ [
+ [ 'status' ],
+ 'default',
+ 'value' => 1,
+ ],
+ [
+ [ 'state' ],
+ 'integer',
+ 'max' => 4,
+ 'min' => 1,
+ 'on' => self::SCENARIO_STATE,
+ ],
+ [
+ [ 'state' ],
+ 'required',
+ 'on' => self::SCENARIO_STATE,
+ ],
+ [
+ [ 'state' ],
+ 'required',
+ 'on' => self::SCENARIO_OWNER,
+ ],
+ [
+ [ 'state' ],
+ 'in',
+ 'range' => [
+ 1,
+ 5,
+ ],
+ 'on' => self::SCENARIO_OWNER,
+ ],
+ ];
+ }
+
+ public function scenarios()
+ {
+ return [
+ self::SCENARIO_USER => [
+ 'text',
+ 'budget_from',
+ 'budget_to',
+ 'term_from',
+ 'term_to',
+ 'file',
+ ],
+ self::SCENARIO_GUEST => [
+
+ ],
+ self::SCENARIO_STATE => [
+ 'state',
+ ],
+ self::SCENARIO_OWNER => [
+ 'state',
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function behaviors()
+ {
+ return [
+ [
+ 'class' => \yii\behaviors\TimestampBehavior::className(),
+ 'createdAtAttribute' => 'date_add',
+ 'updatedAtAttribute' => 'date_update',
+ 'value' => new \yii\db\Expression('NOW()'),
+ ],
+ ];
+ }
+
+ public static function tableName()
+ {
+ return '{{%comment_project}}';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'text' => \Yii::t('app', 'Текст ответа'),
+ 'budget_from' => \Yii::t('app', 'от'),
+ 'budget_to' => \Yii::t('app', 'до'),
+ 'term_from' => \Yii::t('app', 'от'),
+ 'term_to' => \Yii::t('app', 'до'),
+ ];
+ }
+
+ public function getGuestComment()
+ {
+ return $this->guestComment;
+ }
+
+ // public function setGuestComment($value)
+ // {
+ // $this->guestComment = $value;
+ // }
+
+ /**
+ * @param string $model
+ * @param integer $model_id
+ *
+ * @return ActiveQuery
+ */
+ public function getComments($model, $model_id)
+ {
+ return $this->find()
+ ->where([
+ 'comment_project.model' => $model,
+ 'comment_project.model_id' => $model_id,
+ 'comment_project.status' => 1,
+ ])
+ ->with('currency', 'user', 'user.userInfo', 'user.companyInfo', 'user.comments');
+ }
+
+ public function postComment()
+ {
+ if($this->checkCreate()) {
+ if(!empty( \Yii::$app->request->post($this->formName())[ 'anonymous' ] )) {
+ $this->status = self::STATUS_ANONYMOUS;
+ }
+ $this->file = UploadedFile::getInstances($this, 'file');
+ if(!empty( $this->file )) {
+ $file_id = [ ];
+ if(is_array($this->file)) {
+ foreach($this->file as $file) {
+ if($file instanceof UploadedFile) {
+ $file_model = new File();
+ $file_id[] = $file_model->saveFile($file);
+ }
+ }
+ } else {
+ if($this->file instanceof UploadedFile) {
+ $file_model = new File();
+ $file_id[] = $file_model->saveFile($this->file);
+ }
+ }
+ $this->files = json_encode($file_id);
+ }
+ if($this->insert()) {
+ $this->clearSafe();
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ $this->addError('comment_id', 'You can`t post comment here');
+ return false;
+ }
+ }
+
+ public function updateComment()
+ {
+ if($this->checkUpdate()) {
+ if(empty( $this->comment_id )) {
+ $this->addError('comment_id', 'Comment ID not found');
+ return false;
+ } else {
+ if($this->update()) {
+ $this->clearSafe();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ $this->addError('comment_id', 'You can`t update this post');
+ return false;
+ }
+ }
+
+ public function deleteComment()
+ {
+ if($this->checkDelete()) {
+ if(empty( $this->comment_id )) {
+ $this->addError('comment_id', 'Comment ID not found');
+ return false;
+ } else {
+ if($this->status == self::STATUS_DELETED) {
+ return false;
+ }
+ $this->status = self::STATUS_DELETED;
+ if($this->update()) {
+ $this->clearSafe();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ $this->addError('comment_id', 'You can`t delete this post');
+ return false;
+ }
+ }
+
+ public function checkCreate()
+ {
+ if($this->getGuestComment()) {
+ return true;
+ } else {
+ return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]);
+ }
+ }
+
+ public function checkUpdate()
+ {
+ if($this->scenario == self::SCENARIO_GUEST) {
+ return false;
+ } else {
+ return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]);
+ }
+ }
+
+ public function checkDelete()
+ {
+ if($this->scenario == self::SCENARIO_GUEST) {
+ return false;
+ } else {
+ return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [
+ 'model' => $this->model,
+ 'model_id' => $this->model_id,
+ ]);
+ }
+ }
+
+ protected function clearSafe($setNew = true)
+ {
+ $safe = $this->safeAttributes();
+ $count = count($safe);
+ $values = array_fill(0, $count, NULL);
+ $result = array_combine($safe, $values);
+ $this->setAttributes($result);
+ $this->setIsNewRecord($setNew);
+ }
+
+ public function getAuthor()
+ {
+ // if($this->user_id != NULL) {
+ return $this->hasOne(\common\models\User::className(), [ 'id' => 'user_id' ]);
+ // } else {
+ // return ['firstname' => $this->user_name, 'email' => $this->user_email];
+ // }
+ }
+
+ /**
+ * @return ActiveQuery
+ */
+ public function getCurrency()
+ {
+ return $this->hasOne(Currency::className(), [ 'currency_id' => 'budget_currency' ]);
+ }
+
+ /**
+ * @return File[]
+ */
+ public function getFilesList()
+ {
+ $files = json_decode($this->files);
+ if(!empty( $files )) {
+ return File::findAll($files);
+ } else {
+ return [ ];
+ }
+ }
+
+ /**
+ * @return ActiveRecord
+ * @throws \TypeError
+ */
+ public function getOwner()
+ {
+ $model = new $this->model();
+ if($model instanceof ActiveRecord) {
+ return $model->findOne($this->model_id);
+ } else {
+ throw new \TypeError('Model must extends Active Record Class');
+ }
+ }
+
+ public function getProject()
+ {
+ return $this->hasOne(Project::className(), [ 'project_id' => 'model_id' ]);
+ }
+
+ /**
+ * @return User
+ */
+ public function getUser()
+ {
+ return $this->hasOne(User::className(), [ 'id' => 'user_id' ]);
+ }
+
+ public function changeState()
+ {
+ if($this->isAttributeChanged('state')) {
+ if($this->save()) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+
+ }
diff --git a/common/modules/comment/models/CommentProjectSearch.php b/common/modules/comment/models/CommentProjectSearch.php
new file mode 100644
index 0000000..0af9bb8
--- /dev/null
+++ b/common/modules/comment/models/CommentProjectSearch.php
@@ -0,0 +1,92 @@
+ 5,
+ 'min' => 1,
+ ],
+ [
+ [
+ 'state',
+ ],
+ 'default',
+ 'value' => self::STATE_NEW,
+ ],
+ ];
+ }
+
+ public function scenarios()
+ {
+ return array_merge(parent::scenarios(), [
+ self::SCENARIO_SEARCH => [
+ 'state',
+ ],
+ ]);
+ }
+
+ public function search($params)
+ {
+ $query = CommentProject::find()
+ ->with('project')
+ ->with('project.budgetCurrency')
+ ->with('project.comments')
+ ->where([ 'user_id' => \Yii::$app->user->getId() ]);
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params);
+
+ if(!$this->validate()) {
+ $query->andWhere('0=1');
+ return $dataProvider;
+ }
+
+ $query->andWhere([ 'state' => $this->state ]);
+
+ return $dataProvider;
+ }
+
+ }
diff --git a/common/modules/comment/models/Rating.php b/common/modules/comment/models/Rating.php
new file mode 100644
index 0000000..1cef31a
--- /dev/null
+++ b/common/modules/comment/models/Rating.php
@@ -0,0 +1,64 @@
+ Yii::t('app', 'Rating ID'),
+ 'date_add' => Yii::t('app', 'Date Add'),
+ 'date_update' => Yii::t('app', 'Date Update'),
+ 'user_id' => Yii::t('app', 'User ID'),
+ 'entity' => Yii::t('app', 'Entity'),
+ 'value' => Yii::t('app', 'Value'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getUser()
+ {
+ return $this->hasOne(\common\models\User::className(), ['id' => 'user_id']);
+ }
+}
diff --git a/common/modules/comment/rbac/ArtboxCommentCreateRule.php b/common/modules/comment/rbac/ArtboxCommentCreateRule.php
new file mode 100644
index 0000000..7a8d5b2
--- /dev/null
+++ b/common/modules/comment/rbac/ArtboxCommentCreateRule.php
@@ -0,0 +1,38 @@
+checkProject($user, $item, $params);
+ }
+ return true;
+ }
+
+ public function checkProject($user, $item, $params)
+ {
+ $project = \common\models\Project::findOne($params['model_id']);
+ if($project->user_id == $user) {
+ return false;
+ }
+ $comment = \common\modules\comment\models\CommentProject::find()
+ ->where([ 'model' => $params[ 'model' ],
+ 'model_id' => $params[ 'model_id' ],
+ 'user_id' => $user,
+ ])->one();
+ if(empty($comment)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ }
\ No newline at end of file
diff --git a/common/modules/comment/rbac/ArtboxCommentDeleteOwnRule.php b/common/modules/comment/rbac/ArtboxCommentDeleteOwnRule.php
new file mode 100644
index 0000000..d4ba3b8
--- /dev/null
+++ b/common/modules/comment/rbac/ArtboxCommentDeleteOwnRule.php
@@ -0,0 +1,17 @@
+'+data.text+' ');
+ $(container).remove();
+ } else {
+ $(container).prepend(''+data.error+'
')
+ }
+ }
+ );
+ }
+ });
+
+ $(document).on('click', '.artbox_comment_reply', function() {
+ var container = $(this).parents('.artbox_comment_container').first();
+ var comment_id = $(container).data('comment_id');
+ var form_name = $(container).data('form_name');
+ var author = $(container).find('.artbox_comment_author').first().text();
+ var comment_form = $('.artbox_comment_form').first();
+ var offset = $(comment_form).offset();
+ var reply_block = $(comment_form).find('.artbox_comment_reply_block').first();
+ $(reply_block).empty();
+ $(reply_block).append(' ');
+ $(reply_block).append('');
+ $('html, body').animate({
+ scrollTop: offset.top - 50,
+ });
+ });
+
+ $(document).on('click', '.artbox_comment_reply_author', function() {
+ $(this).parents('.artbox_comment_reply_block').first().empty();
+ });
+
+ $(document).on('click', '.artbox_comment_update', function() {
+ $(this).removeClass('artbox_comment_update');
+ $(this).text('Сохранить');
+ $(this).addClass('artbox_comment_update_submit');
+ var container = $(this).parents('.artbox_comment_container').first();
+ var comment_id = $(container).data('comment_id');
+ var form_name = $(container).data('form_name');
+ var text = $(container).find('.artbox_comment_text');
+ var object = {};
+ object[form_name] = {comment_id: comment_id};
+ $.post(
+ '/artbox-comment/form',
+ object,
+ function(data, textStatus, jqXHR) {
+ $(text).hide();
+ $(text).after(
+ ''
+ );
+ }
+ );
+ });
+
+ $(document).on('click', '.artbox_comment_update_reply', function() {
+ $(this).remove();
+ });
+
+ $(document).on('click', '.artbox_comment_update_submit', function(e) {
+ e.preventDefault();
+ var container = $(this).parents('.artbox_comment_container').first();
+ var edit = $(container).find('.artbox_comment_text_edit').first();
+ $.post(
+ '/artbox-comment/update',
+ $(edit).find('form').serialize(),
+ function(data) {
+ if(!data.error) {
+ location.reload(true);
+ }
+ }
+ )
+ });
+});
\ No newline at end of file
diff --git a/common/modules/comment/resources/delete-ico.png b/common/modules/comment/resources/delete-ico.png
new file mode 100644
index 0000000..52c3718
Binary files /dev/null and b/common/modules/comment/resources/delete-ico.png differ
diff --git a/common/modules/comment/views/comment_form.php b/common/modules/comment/views/comment_form.php
new file mode 100644
index 0000000..945abf6
--- /dev/null
+++ b/common/modules/comment/views/comment_form.php
@@ -0,0 +1,38 @@
+
+field($model, 'comment_id')
+ ->label(false)
+ ->hiddenInput();
+ if(!empty( $model->parent )) {
+ ?>
+
+ field($model, 'text')
+ ->label(false)
+ ->textarea();
+?>
+end();
+?>
\ No newline at end of file
diff --git a/common/modules/comment/widgets/CommentWidget.php b/common/modules/comment/widgets/CommentWidget.php
new file mode 100644
index 0000000..15c7b61
--- /dev/null
+++ b/common/modules/comment/widgets/CommentWidget.php
@@ -0,0 +1,236 @@
+ 'div',
+ 'view' => 'list-comment',
+ 'class' => 'test-class',
+ ];
+
+ /**
+ * @var array Options sent to success part
+ */
+ public $success_options = [
+ 'tag' => 'div',
+ 'content' => NULL,
+ 'class' => 'test-class-success',
+ ];
+
+ /**
+ * @var array Options sent to form part
+ */
+ public $form_options = [
+ 'tag' => 'div',
+ 'view' => 'form-comment',
+ 'class' => 'test-class-form',
+ ];
+
+ /**
+ * @var bool Indicates whether any successful action happened
+ */
+ protected $isSuccess = false;
+
+ public $success_text = 'Comment successfully added';
+
+ /**
+ * @var string $model Model, to which comments attached
+ */
+ public $model;
+
+ /**
+ * @var integer $model_id Model id, to which comments attached
+ */
+ public $model_id;
+
+ /**
+ * @var string Template of the widget. You may use {success}, {form}, {list}
+ * to render particular parts. You are also able to use common HTML here.
+ */
+ public $template = "{success}\n{form}\n{list}";
+
+ /**
+ * @var array Widget options
+ */
+ public $options = [ ];
+
+ /**
+ * @var \yii\data\DataProviderInterface Data provider of comments
+ */
+ public $dataProvider;
+
+ /**
+ * @inheritdoc
+ */
+ public function init()
+ {
+ parent::init();
+ \common\modules\comment\assets\CommentAsset::register($this->view);
+ if(is_string($this->comment_class)) {
+ $this->comment_class = new $this->comment_class($this->class_options);
+ } else {
+ throw new \yii\base\InvalidConfigException(__CLASS__ . '->comment_class must be defined as object full class name string.');
+ }
+ if(!empty( $this->rating_class ) && is_string($this->rating_class)) {
+ $this->rating_class = new $this->rating_class($this->rating_options);
+ } elseif(!empty( $this->rating_class )) {
+ throw new \yii\base\InvalidConfigException(__CLASS__ . '->rating_class must be defined as object full class name string.');
+ }
+ $this->comment_class->model = $this->model;
+ $this->comment_class->model_id = $this->model_id;
+ $this->createDataProvider();
+ $this->process();
+ ob_start();
+ }
+
+ /**
+ * @inheritdoc
+ * @return string
+ */
+ public function run()
+ {
+ $content = ob_get_clean();
+ $this->createParts();
+ return $this->renderWidget();
+ }
+
+ public function createParts()
+ {
+ if($this->display_comment_success && $this->isSuccess) {
+ $tag = ArrayHelper::remove($this->success_options, 'tag', 'div');
+ if(is_callable($this->success_options[ 'content' ])) {
+ $result = call_user_func(ArrayHelper::remove($this->success_options, 'content'), $this->success_text);
+ } elseif($this->success_options[ 'content' ] != NULL) {
+ $result = Html::encode(ArrayHelper::remove($this->success_options, 'content', $this->success_text));
+ } else {
+ $result = Html::encode($this->success_text);
+ }
+ $this->parts[ 'success' ] = Html::tag($tag, $result, $this->success_options);
+ unset( $tag, $result );
+ }
+
+ if($this->display_comment_list) {
+ $tag = ArrayHelper::remove($this->list_options, 'tag', 'div');
+ $view = ArrayHelper::remove($this->list_options, 'view');
+ $this->parts[ 'list' ] = Html::tag($tag, $this->renderItems($view), $this->list_options);
+ }
+
+ if($this->display_comment_form && $this->comment_class->checkCreate()) {
+ $tag = ArrayHelper::remove($this->form_options, 'tag', 'div');
+ $view = ArrayHelper::remove($this->form_options, 'view');
+ $this->parts[ 'form' ] = Html::tag($tag, $this->renderForm($view), $this->form_options);
+ }
+ }
+
+ public function createDataProvider()
+ {
+ $this->dataProvider = new \yii\data\ActiveDataProvider([
+ 'query' => $this->comment_class->getComments($this->model, $this->model_id),
+ 'pagination' => [
+ 'pageSize' => 10,
+ ],
+ ]);
+ }
+
+ public function renderItems($view)
+ {
+ if(empty( $view )) {
+ throw new \yii\base\InvalidConfigException("list_options[view] must be set");
+ }
+ return $this->render($view, [ 'dataProvider' => $this->dataProvider ]);
+ }
+
+ public function renderForm($view)
+ {
+ if(empty( $view )) {
+ throw new \yii\base\InvalidConfigException("form_options[view] must be set");
+ }
+ if($this->comment_class->guestComment || !empty(\Yii::$app->user->identity)) {
+ return $this->render($view, [
+ 'model' => $this->comment_class,
+ 'rating' => $this->rating_class,
+ 'user' => \Yii::$app->user->identity,
+ 'dataProvider' => $this->dataProvider,
+ ]);
+ } else {
+ return '';
+ }
+ }
+
+ public function renderWidget()
+ {
+ $template = $this->template;
+ $parts = $this->parts;
+ $options = $this->options;
+ $template = preg_replace('/{success}/', ArrayHelper::remove($parts, 'success', ''), $template);
+ $template = preg_replace('/{list}/', ArrayHelper::remove($parts, 'list', ''), $template);
+ $template = preg_replace('/{form}/', ArrayHelper::remove($parts, 'form', ''), $template);
+ $tag = ArrayHelper::remove($options, 'tag', 'div');
+ return Html::tag($tag, $template, $options);
+ }
+
+ public function process()
+ {
+ $data = \Yii::$app->request->post();
+ if($this->comment_class->load($data) && $this->comment_class->postComment()) {
+ if(is_object($this->rating_class)) {
+ $this->comment_class->checkRating();
+ if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) {
+ $this->isSuccess = true;
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/_project_comment_view.php b/common/modules/comment/widgets/views/_project_comment_view.php
new file mode 100644
index 0000000..7b49a60
--- /dev/null
+++ b/common/modules/comment/widgets/views/_project_comment_view.php
@@ -0,0 +1,143 @@
+user;
+?>
+
+
+
+
+ = $model->budget_from . '-' . $model->budget_to . ' ' . $model->currency->label ?>
+
+
+ = $model->term_from . '-' . $model->term_to ?> ДНЯ
+
+
+
+
= $user->name ?>
+
+
+
+
+ = Html::a(count($user->comments) . ' отзывов', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?>
+
+
+ = $model->text ?>
+
+
+ getFilesList() as $file) {
+ ?>
+
+
+ = Html::a($file->name, $file->dir, [ 'class' => 'download-link-file' ]) ?>
+ = Html::a('Скачать', $file->dir, [
+ 'class' => 'download-link',
+ 'download' => 'download',
+ ]) ?>
+
+
+
+
+
+ = Html::a('Портфолио', $user->getLink('portfolio'), [ 'class' => 'get-project-new' ]) ?>
+ = Html::a('Контакты', $user->link, [ 'class' => 'get-list-new' ]) ?>
+
+ user->getId() == $model->owner->user_id) {
+ ?>
+
+ Отметить как:
+ $model->owner->project_id,
+ 'data-comment-id' => $model->comment_id,
+ 'class' => 'artbox_project_make_new',
+ ]);
+ echo Html::a('кандидат', [ '#' ], [
+ 'data-project-id' => $model->owner->project_id,
+ 'data-comment-id' => $model->comment_id,
+ 'class' => 'artbox_project_make_candidate',
+ ]);
+ echo Html::a('исполнитель', [ '#' ], [
+ 'data-project-id' => $model->owner->project_id,
+ 'data-comment-id' => $model->comment_id,
+ 'class' => 'artbox_project_make_performer',
+ ]);
+ echo Html::a('отказать', [ '#' ], [
+ 'data-project-id' => $model->owner->project_id,
+ 'data-comment-id' => $model->comment_id,
+ 'class' => 'artbox_project_make_deny',
+ ]);
+ ?>
+
+
+
+
diff --git a/common/modules/comment/widgets/views/_review_comment_view.php b/common/modules/comment/widgets/views/_review_comment_view.php
new file mode 100644
index 0000000..e59efe1
--- /dev/null
+++ b/common/modules/comment/widgets/views/_review_comment_view.php
@@ -0,0 +1,51 @@
+user;
+?>
+
+
+
+
+
+rating )) {
+ ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/form-comment-review.php b/common/modules/comment/widgets/views/form-comment-review.php
new file mode 100644
index 0000000..d9b37e3
--- /dev/null
+++ b/common/modules/comment/widgets/views/form-comment-review.php
@@ -0,0 +1,66 @@
+
+
+
Мнения о пользователе: = $dataProvider->totalCount ?>
+
+ field($rating, 'value')
+ ->label(false)
+ ->radioList([
+ 1 => 1,
+ 2 => 2,
+ 3 => 3,
+ 4 => 4,
+ 5 => 5,
+ ]);
+ if($model->scenario == $model::SCENARIO_GUEST) {
+ echo $form->field($model, 'user_name', [
+ 'options' => [
+ 'class' => 'input-blocks-comm',
+ ],
+ 'inputOptions' => [
+ 'class' => 'custom-input-4',
+ ],
+ ])
+ ->textInput();
+ echo $form->field($model, 'user_email', [
+ 'options' => [
+ 'class' => 'input-blocks-comm',
+ ],
+ 'inputOptions' => [
+ 'class' => 'custom-input-4',
+ ],
+ ])
+ ->textInput();
+ }
+
+ ?>
+
+ field($model, 'text', [
+ 'options' => [
+ 'class' => 'input-blocks-comm area-comm',
+ ],
+ 'inputOptions' => [
+ 'class' => 'custom-area-4',
+ ],
+ ])
+ ->textarea();
+ ?>
+
+ = Html::submitButton('Добавить комментарий') ?>
+
+ end();
+ ?>
+
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/form-comment.php b/common/modules/comment/widgets/views/form-comment.php
new file mode 100644
index 0000000..9c0ba15
--- /dev/null
+++ b/common/modules/comment/widgets/views/form-comment.php
@@ -0,0 +1,70 @@
+
+Комментарии: = $dataProvider->totalCount ?>
+
+
+
+ field($rating, 'value')
+ ->label(false)
+ ->radioList([
+ 1 => 1,
+ 2 => 2,
+ 3 => 3,
+ 4 => 4,
+ 5 => 5,
+ ]);
+
+ if($model->scenario == $model::SCENARIO_GUEST) {
+ echo $form->field($model, 'user_name', [
+ 'options' => [
+ 'class' => 'input-blocks-comm',
+ ],
+ 'inputOptions' => [
+ 'class' => 'custom-input-4',
+ ],
+ ])
+ ->textInput();
+ echo $form->field($model, 'user_email', [
+ 'options' => [
+ 'class' => 'input-blocks-comm',
+ ],
+ 'inputOptions' => [
+ 'class' => 'custom-input-4',
+ ],
+ ])
+ ->textInput();
+ }
+
+ ?>
+
+ field($model, 'text', [
+ 'options' => [
+ 'class' => 'input-blocks-comm area-comm',
+ ],
+ 'inputOptions' => [
+ 'class' => 'custom-area-4',
+ ],
+ ])
+ ->textarea();
+ ?>
+
+ = Html::submitButton('Добавить комментарий') ?>
+
+ end();
+ ?>
+
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/form-project-comment.php b/common/modules/comment/widgets/views/form-project-comment.php
new file mode 100644
index 0000000..3f3f962
--- /dev/null
+++ b/common/modules/comment/widgets/views/form-project-comment.php
@@ -0,0 +1,101 @@
+
+
+
+
+
+
= Yii::t('app', 'add_answer') ?>
+
+
+
+
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/list-comment-review.php b/common/modules/comment/widgets/views/list-comment-review.php
new file mode 100644
index 0000000..7bbe3bb
--- /dev/null
+++ b/common/modules/comment/widgets/views/list-comment-review.php
@@ -0,0 +1,16 @@
+ $dataProvider,
+ 'itemView' => '_review_comment_view',
+ 'options' => [
+ 'tag' => 'ul',
+ 'class' => 'proektant-comments style'
+ ],
+ 'itemOptions' => [
+ 'tag' => 'li',
+ ],
+ 'layout' => "{items}\n{pager}",
+]);
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/list-comment.php b/common/modules/comment/widgets/views/list-comment.php
new file mode 100644
index 0000000..504d43a
--- /dev/null
+++ b/common/modules/comment/widgets/views/list-comment.php
@@ -0,0 +1,12 @@
+ $dataProvider,
+ 'itemView' => 'project_comment_view',
+ 'itemOptions' => [
+ 'tag' => false,
+ ],
+ 'summary' => '',
+]);
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/list-project-comment.php b/common/modules/comment/widgets/views/list-project-comment.php
new file mode 100644
index 0000000..8ecb5f4
--- /dev/null
+++ b/common/modules/comment/widgets/views/list-project-comment.php
@@ -0,0 +1,22 @@
+
+
+
+
Предложения проектантов (=$dataProvider->getTotalCount()?>)
+
+ $dataProvider,
+ 'itemView' => '_project_comment_view',
+ 'itemOptions' => [
+ 'class' => 'tender-offer-proj-blocks style',
+ ],
+ 'summary' => '',
+ ]);
+ ?>
+
+
+
\ No newline at end of file
diff --git a/common/modules/comment/widgets/views/project_comment_view.php b/common/modules/comment/widgets/views/project_comment_view.php
new file mode 100644
index 0000000..e035904
--- /dev/null
+++ b/common/modules/comment/widgets/views/project_comment_view.php
@@ -0,0 +1,84 @@
+user_id )) {
+ $user = User::find()
+ ->where([ 'id' => $model->user_id ])
+ ->with('userInfo')
+ ->one();
+ }
+?>
+
\ No newline at end of file
diff --git a/common/modules/file/FileUploadAsset.php b/common/modules/file/FileUploadAsset.php
new file mode 100644
index 0000000..1f15894
--- /dev/null
+++ b/common/modules/file/FileUploadAsset.php
@@ -0,0 +1,43 @@
+
+ * @since 2.0
+ */
+class FileUploadAsset extends AssetBundle
+{
+
+
+ /**
+ * @inheritdoc
+ */
+ public function init()
+ {
+ parent::init();
+ $this->sourcePath = __DIR__.'/assets';
+ }
+
+ public $css = [
+ 'css/jquery.fileupload.css',
+ 'css/fileupload/style.css'
+ ];
+
+ public $js = [
+ 'js/vendor/jquery.ui.widget.js',
+ 'js/jquery.iframe-transport.js',
+ 'js/jquery.fileupload.js'
+ ];
+}
diff --git a/common/modules/file/Module.php b/common/modules/file/Module.php
new file mode 100644
index 0000000..374e5f4
--- /dev/null
+++ b/common/modules/file/Module.php
@@ -0,0 +1,15 @@
+').prop('href', options.postMessage)[0],
+ target = loc.protocol + '//' + loc.host,
+ xhrUpload = options.xhr().upload;
+ return {
+ send: function (_, completeCallback) {
+ counter += 1;
+ var message = {
+ id: 'postmessage-transport-' + counter
+ },
+ eventName = 'message.' + message.id;
+ iframe = $(
+ ''
+ ).bind('load', function () {
+ $.each(names, function (i, name) {
+ message[name] = options[name];
+ });
+ message.dataType = message.dataType.replace('postmessage ', '');
+ $(window).bind(eventName, function (e) {
+ e = e.originalEvent;
+ var data = e.data,
+ ev;
+ if (e.origin === target && data.id === message.id) {
+ if (data.type === 'progress') {
+ ev = document.createEvent('Event');
+ ev.initEvent(data.type, false, true);
+ $.extend(ev, data);
+ xhrUpload.dispatchEvent(ev);
+ } else {
+ completeCallback(
+ data.status,
+ data.statusText,
+ {postmessage: data.result},
+ data.headers
+ );
+ iframe.remove();
+ $(window).unbind(eventName);
+ }
+ }
+ });
+ iframe[0].contentWindow.postMessage(
+ message,
+ target
+ );
+ }).appendTo(document.body);
+ },
+ abort: function () {
+ if (iframe) {
+ iframe.remove();
+ }
+ }
+ };
+ }
+ });
+
+}));
diff --git a/common/modules/file/assets/js/cors/jquery.xdr-transport.js b/common/modules/file/assets/js/cors/jquery.xdr-transport.js
new file mode 100644
index 0000000..d951827
--- /dev/null
+++ b/common/modules/file/assets/js/cors/jquery.xdr-transport.js
@@ -0,0 +1,89 @@
+/*
+ * jQuery XDomainRequest Transport Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2011, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ *
+ * Based on Julian Aubourg's ajaxHooks xdr.js:
+ * https://github.com/jaubourg/ajaxHooks/
+ */
+
+/* global define, require, window, XDomainRequest */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'));
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+}(function ($) {
+ 'use strict';
+ if (window.XDomainRequest && !$.support.cors) {
+ $.ajaxTransport(function (s) {
+ if (s.crossDomain && s.async) {
+ if (s.timeout) {
+ s.xdrTimeout = s.timeout;
+ delete s.timeout;
+ }
+ var xdr;
+ return {
+ send: function (headers, completeCallback) {
+ var addParamChar = /\?/.test(s.url) ? '&' : '?';
+ function callback(status, statusText, responses, responseHeaders) {
+ xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
+ xdr = null;
+ completeCallback(status, statusText, responses, responseHeaders);
+ }
+ xdr = new XDomainRequest();
+ // XDomainRequest only supports GET and POST:
+ if (s.type === 'DELETE') {
+ s.url = s.url + addParamChar + '_method=DELETE';
+ s.type = 'POST';
+ } else if (s.type === 'PUT') {
+ s.url = s.url + addParamChar + '_method=PUT';
+ s.type = 'POST';
+ } else if (s.type === 'PATCH') {
+ s.url = s.url + addParamChar + '_method=PATCH';
+ s.type = 'POST';
+ }
+ xdr.open(s.type, s.url);
+ xdr.onload = function () {
+ callback(
+ 200,
+ 'OK',
+ {text: xdr.responseText},
+ 'Content-Type: ' + xdr.contentType
+ );
+ };
+ xdr.onerror = function () {
+ callback(404, 'Not Found');
+ };
+ if (s.xdrTimeout) {
+ xdr.ontimeout = function () {
+ callback(0, 'timeout');
+ };
+ xdr.timeout = s.xdrTimeout;
+ }
+ xdr.send((s.hasContent && s.data) || null);
+ },
+ abort: function () {
+ if (xdr) {
+ xdr.onerror = $.noop();
+ xdr.abort();
+ }
+ }
+ };
+ }
+ });
+ }
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-angular.js b/common/modules/file/assets/js/jquery.fileupload-angular.js
new file mode 100644
index 0000000..08bb488
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-angular.js
@@ -0,0 +1,425 @@
+/*
+ * jQuery File Upload AngularJS Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, angular */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ 'angular',
+ './jquery.fileupload-image',
+ './jquery.fileupload-audio',
+ './jquery.fileupload-video',
+ './jquery.fileupload-validate'
+ ], factory);
+ } else {
+ factory();
+ }
+}(function () {
+ 'use strict';
+
+ angular.module('blueimp.fileupload', [])
+
+ // The fileUpload service provides configuration options
+ // for the fileUpload directive and default handlers for
+ // File Upload events:
+ .provider('fileUpload', function () {
+ var scopeEvalAsync = function (expression) {
+ var scope = angular.element(this)
+ .fileupload('option', 'scope');
+ // Schedule a new $digest cycle if not already inside of one
+ // and evaluate the given expression:
+ scope.$evalAsync(expression);
+ },
+ addFileMethods = function (scope, data) {
+ var files = data.files,
+ file = files[0];
+ angular.forEach(files, function (file, index) {
+ file._index = index;
+ file.$state = function () {
+ return data.state();
+ };
+ file.$processing = function () {
+ return data.processing();
+ };
+ file.$progress = function () {
+ return data.progress();
+ };
+ file.$response = function () {
+ return data.response();
+ };
+ });
+ file.$submit = function () {
+ if (!file.error) {
+ return data.submit();
+ }
+ };
+ file.$cancel = function () {
+ return data.abort();
+ };
+ },
+ $config;
+ $config = this.defaults = {
+ handleResponse: function (e, data) {
+ var files = data.result && data.result.files;
+ if (files) {
+ data.scope.replace(data.files, files);
+ } else if (data.errorThrown ||
+ data.textStatus === 'error') {
+ data.files[0].error = data.errorThrown ||
+ data.textStatus;
+ }
+ },
+ add: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var scope = data.scope,
+ filesCopy = [];
+ angular.forEach(data.files, function (file) {
+ filesCopy.push(file);
+ });
+ scope.$parent.$applyAsync(function () {
+ addFileMethods(scope, data);
+ var method = scope.option('prependFiles') ?
+ 'unshift' : 'push';
+ Array.prototype[method].apply(scope.queue, data.files);
+ });
+ data.process(function () {
+ return scope.process(data);
+ }).always(function () {
+ scope.$parent.$applyAsync(function () {
+ addFileMethods(scope, data);
+ scope.replace(filesCopy, data.files);
+ });
+ }).then(function () {
+ if ((scope.option('autoUpload') ||
+ data.autoUpload) &&
+ data.autoUpload !== false) {
+ data.submit();
+ }
+ });
+ },
+ done: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = this;
+ data.scope.$apply(function () {
+ data.handleResponse.call(that, e, data);
+ });
+ },
+ fail: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = this,
+ scope = data.scope;
+ if (data.errorThrown === 'abort') {
+ scope.clear(data.files);
+ return;
+ }
+ scope.$apply(function () {
+ data.handleResponse.call(that, e, data);
+ });
+ },
+ stop: scopeEvalAsync,
+ processstart: scopeEvalAsync,
+ processstop: scopeEvalAsync,
+ getNumberOfFiles: function () {
+ var scope = this.scope;
+ return scope.queue.length - scope.processing();
+ },
+ dataType: 'json',
+ autoUpload: false
+ };
+ this.$get = [
+ function () {
+ return {
+ defaults: $config
+ };
+ }
+ ];
+ })
+
+ // Format byte numbers to readable presentations:
+ .provider('formatFileSizeFilter', function () {
+ var $config = {
+ // Byte units following the IEC format
+ // http://en.wikipedia.org/wiki/Kilobyte
+ units: [
+ {size: 1000000000, suffix: ' GB'},
+ {size: 1000000, suffix: ' MB'},
+ {size: 1000, suffix: ' KB'}
+ ]
+ };
+ this.defaults = $config;
+ this.$get = function () {
+ return function (bytes) {
+ if (!angular.isNumber(bytes)) {
+ return '';
+ }
+ var unit = true,
+ i = 0,
+ prefix,
+ suffix;
+ while (unit) {
+ unit = $config.units[i];
+ prefix = unit.prefix || '';
+ suffix = unit.suffix || '';
+ if (i === $config.units.length - 1 || bytes >= unit.size) {
+ return prefix + (bytes / unit.size).toFixed(2) + suffix;
+ }
+ i += 1;
+ }
+ };
+ };
+ })
+
+ // The FileUploadController initializes the fileupload widget and
+ // provides scope methods to control the File Upload functionality:
+ .controller('FileUploadController', [
+ '$scope', '$element', '$attrs', '$window', 'fileUpload',
+ function ($scope, $element, $attrs, $window, fileUpload) {
+ var uploadMethods = {
+ progress: function () {
+ return $element.fileupload('progress');
+ },
+ active: function () {
+ return $element.fileupload('active');
+ },
+ option: function (option, data) {
+ if (arguments.length === 1) {
+ return $element.fileupload('option', option);
+ }
+ $element.fileupload('option', option, data);
+ },
+ add: function (data) {
+ return $element.fileupload('add', data);
+ },
+ send: function (data) {
+ return $element.fileupload('send', data);
+ },
+ process: function (data) {
+ return $element.fileupload('process', data);
+ },
+ processing: function (data) {
+ return $element.fileupload('processing', data);
+ }
+ };
+ $scope.disabled = !$window.jQuery.support.fileInput;
+ $scope.queue = $scope.queue || [];
+ $scope.clear = function (files) {
+ var queue = this.queue,
+ i = queue.length,
+ file = files,
+ length = 1;
+ if (angular.isArray(files)) {
+ file = files[0];
+ length = files.length;
+ }
+ while (i) {
+ i -= 1;
+ if (queue[i] === file) {
+ return queue.splice(i, length);
+ }
+ }
+ };
+ $scope.replace = function (oldFiles, newFiles) {
+ var queue = this.queue,
+ file = oldFiles[0],
+ i,
+ j;
+ for (i = 0; i < queue.length; i += 1) {
+ if (queue[i] === file) {
+ for (j = 0; j < newFiles.length; j += 1) {
+ queue[i + j] = newFiles[j];
+ }
+ return;
+ }
+ }
+ };
+ $scope.applyOnQueue = function (method) {
+ var list = this.queue.slice(0),
+ i,
+ file;
+ for (i = 0; i < list.length; i += 1) {
+ file = list[i];
+ if (file[method]) {
+ file[method]();
+ }
+ }
+ };
+ $scope.submit = function () {
+ this.applyOnQueue('$submit');
+ };
+ $scope.cancel = function () {
+ this.applyOnQueue('$cancel');
+ };
+ // Add upload methods to the scope:
+ angular.extend($scope, uploadMethods);
+ // The fileupload widget will initialize with
+ // the options provided via "data-"-parameters,
+ // as well as those given via options object:
+ $element.fileupload(angular.extend(
+ {scope: $scope},
+ fileUpload.defaults
+ )).on('fileuploadadd', function (e, data) {
+ data.scope = $scope;
+ }).on('fileuploadfail', function (e, data) {
+ if (data.errorThrown === 'abort') {
+ return;
+ }
+ if (data.dataType &&
+ data.dataType.indexOf('json') === data.dataType.length - 4) {
+ try {
+ data.result = angular.fromJson(data.jqXHR.responseText);
+ } catch (ignore) {}
+ }
+ }).on([
+ 'fileuploadadd',
+ 'fileuploadsubmit',
+ 'fileuploadsend',
+ 'fileuploaddone',
+ 'fileuploadfail',
+ 'fileuploadalways',
+ 'fileuploadprogress',
+ 'fileuploadprogressall',
+ 'fileuploadstart',
+ 'fileuploadstop',
+ 'fileuploadchange',
+ 'fileuploadpaste',
+ 'fileuploaddrop',
+ 'fileuploaddragover',
+ 'fileuploadchunksend',
+ 'fileuploadchunkdone',
+ 'fileuploadchunkfail',
+ 'fileuploadchunkalways',
+ 'fileuploadprocessstart',
+ 'fileuploadprocess',
+ 'fileuploadprocessdone',
+ 'fileuploadprocessfail',
+ 'fileuploadprocessalways',
+ 'fileuploadprocessstop'
+ ].join(' '), function (e, data) {
+ $scope.$parent.$applyAsync(function () {
+ if ($scope.$emit(e.type, data).defaultPrevented) {
+ e.preventDefault();
+ }
+ });
+ }).on('remove', function () {
+ // Remove upload methods from the scope,
+ // when the widget is removed:
+ var method;
+ for (method in uploadMethods) {
+ if (uploadMethods.hasOwnProperty(method)) {
+ delete $scope[method];
+ }
+ }
+ });
+ // Observe option changes:
+ $scope.$watch(
+ $attrs.fileUpload,
+ function (newOptions) {
+ if (newOptions) {
+ $element.fileupload('option', newOptions);
+ }
+ }
+ );
+ }
+ ])
+
+ // Provide File Upload progress feedback:
+ .controller('FileUploadProgressController', [
+ '$scope', '$attrs', '$parse',
+ function ($scope, $attrs, $parse) {
+ var fn = $parse($attrs.fileUploadProgress),
+ update = function () {
+ var progress = fn($scope);
+ if (!progress || !progress.total) {
+ return;
+ }
+ $scope.num = Math.floor(
+ progress.loaded / progress.total * 100
+ );
+ };
+ update();
+ $scope.$watch(
+ $attrs.fileUploadProgress + '.loaded',
+ function (newValue, oldValue) {
+ if (newValue !== oldValue) {
+ update();
+ }
+ }
+ );
+ }
+ ])
+
+ // Display File Upload previews:
+ .controller('FileUploadPreviewController', [
+ '$scope', '$element', '$attrs',
+ function ($scope, $element, $attrs) {
+ $scope.$watch(
+ $attrs.fileUploadPreview + '.preview',
+ function (preview) {
+ $element.empty();
+ if (preview) {
+ $element.append(preview);
+ }
+ }
+ );
+ }
+ ])
+
+ .directive('fileUpload', function () {
+ return {
+ controller: 'FileUploadController',
+ scope: true
+ };
+ })
+
+ .directive('fileUploadProgress', function () {
+ return {
+ controller: 'FileUploadProgressController',
+ scope: true
+ };
+ })
+
+ .directive('fileUploadPreview', function () {
+ return {
+ controller: 'FileUploadPreviewController'
+ };
+ })
+
+ // Enhance the HTML5 download attribute to
+ // allow drag&drop of files to the desktop:
+ .directive('download', function () {
+ return function (scope, elm) {
+ elm.on('dragstart', function (e) {
+ try {
+ e.originalEvent.dataTransfer.setData(
+ 'DownloadURL',
+ [
+ 'application/octet-stream',
+ elm.prop('download'),
+ elm.prop('href')
+ ].join(':')
+ );
+ } catch (ignore) {}
+ });
+ };
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-audio.js b/common/modules/file/assets/js/jquery.fileupload-audio.js
new file mode 100644
index 0000000..971658b
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-audio.js
@@ -0,0 +1,112 @@
+/*
+ * jQuery File Upload Audio Preview Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, require, window, document */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ 'load-image',
+ './jquery.fileupload-process'
+ ], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(
+ require('jquery'),
+ require('load-image')
+ );
+ } else {
+ // Browser globals:
+ factory(
+ window.jQuery,
+ window.loadImage
+ );
+ }
+}(function ($, loadImage) {
+ 'use strict';
+
+ // Prepend to the default processQueue:
+ $.blueimp.fileupload.prototype.options.processQueue.unshift(
+ {
+ action: 'loadAudio',
+ // Use the action as prefix for the "@" options:
+ prefix: true,
+ fileTypes: '@',
+ maxFileSize: '@',
+ disabled: '@disableAudioPreview'
+ },
+ {
+ action: 'setAudio',
+ name: '@audioPreviewName',
+ disabled: '@disableAudioPreview'
+ }
+ );
+
+ // The File Upload Audio Preview plugin extends the fileupload widget
+ // with audio preview functionality:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+
+ options: {
+ // The regular expression for the types of audio files to load,
+ // matched against the file type:
+ loadAudioFileTypes: /^audio\/.*$/
+ },
+
+ _audioElement: document.createElement('audio'),
+
+ processActions: {
+
+ // Loads the audio file given via data.files and data.index
+ // as audio element if the browser supports playing it.
+ // Accepts the options fileTypes (regular expression)
+ // and maxFileSize (integer) to limit the files to load:
+ loadAudio: function (data, options) {
+ if (options.disabled) {
+ return data;
+ }
+ var file = data.files[data.index],
+ url,
+ audio;
+ if (this._audioElement.canPlayType &&
+ this._audioElement.canPlayType(file.type) &&
+ ($.type(options.maxFileSize) !== 'number' ||
+ file.size <= options.maxFileSize) &&
+ (!options.fileTypes ||
+ options.fileTypes.test(file.type))) {
+ url = loadImage.createObjectURL(file);
+ if (url) {
+ audio = this._audioElement.cloneNode(false);
+ audio.src = url;
+ audio.controls = true;
+ data.audio = audio;
+ return data;
+ }
+ }
+ return data;
+ },
+
+ // Sets the audio element as a property of the file object:
+ setAudio: function (data, options) {
+ if (data.audio && !options.disabled) {
+ data.files[data.index][options.name || 'preview'] = data.audio;
+ }
+ return data;
+ }
+
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-image.js b/common/modules/file/assets/js/jquery.fileupload-image.js
new file mode 100644
index 0000000..d445120
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-image.js
@@ -0,0 +1,321 @@
+/*
+ * jQuery File Upload Image Preview & Resize Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, require, window, Blob */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ 'load-image',
+ 'load-image-meta',
+ 'load-image-exif',
+ 'load-image-ios',
+ 'canvas-to-blob',
+ './jquery.fileupload-process'
+ ], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(
+ require('jquery'),
+ require('load-image')
+ );
+ } else {
+ // Browser globals:
+ factory(
+ window.jQuery,
+ window.loadImage
+ );
+ }
+}(function ($, loadImage) {
+ 'use strict';
+
+ // Prepend to the default processQueue:
+ $.blueimp.fileupload.prototype.options.processQueue.unshift(
+ {
+ action: 'loadImageMetaData',
+ disableImageHead: '@',
+ disableExif: '@',
+ disableExifThumbnail: '@',
+ disableExifSub: '@',
+ disableExifGps: '@',
+ disabled: '@disableImageMetaDataLoad'
+ },
+ {
+ action: 'loadImage',
+ // Use the action as prefix for the "@" options:
+ prefix: true,
+ fileTypes: '@',
+ maxFileSize: '@',
+ noRevoke: '@',
+ disabled: '@disableImageLoad'
+ },
+ {
+ action: 'resizeImage',
+ // Use "image" as prefix for the "@" options:
+ prefix: 'image',
+ maxWidth: '@',
+ maxHeight: '@',
+ minWidth: '@',
+ minHeight: '@',
+ crop: '@',
+ orientation: '@',
+ forceResize: '@',
+ disabled: '@disableImageResize'
+ },
+ {
+ action: 'saveImage',
+ quality: '@imageQuality',
+ type: '@imageType',
+ disabled: '@disableImageResize'
+ },
+ {
+ action: 'saveImageMetaData',
+ disabled: '@disableImageMetaDataSave'
+ },
+ {
+ action: 'resizeImage',
+ // Use "preview" as prefix for the "@" options:
+ prefix: 'preview',
+ maxWidth: '@',
+ maxHeight: '@',
+ minWidth: '@',
+ minHeight: '@',
+ crop: '@',
+ orientation: '@',
+ thumbnail: '@',
+ canvas: '@',
+ disabled: '@disableImagePreview'
+ },
+ {
+ action: 'setImage',
+ name: '@imagePreviewName',
+ disabled: '@disableImagePreview'
+ },
+ {
+ action: 'deleteImageReferences',
+ disabled: '@disableImageReferencesDeletion'
+ }
+ );
+
+ // The File Upload Resize plugin extends the fileupload widget
+ // with image resize functionality:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+
+ options: {
+ // The regular expression for the types of images to load:
+ // matched against the file type:
+ loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/,
+ // The maximum file size of images to load:
+ loadImageMaxFileSize: 10000000, // 10MB
+ // The maximum width of resized images:
+ imageMaxWidth: 1920,
+ // The maximum height of resized images:
+ imageMaxHeight: 1080,
+ // Defines the image orientation (1-8) or takes the orientation
+ // value from Exif data if set to true:
+ imageOrientation: false,
+ // Define if resized images should be cropped or only scaled:
+ imageCrop: false,
+ // Disable the resize image functionality by default:
+ disableImageResize: true,
+ // The maximum width of the preview images:
+ previewMaxWidth: 80,
+ // The maximum height of the preview images:
+ previewMaxHeight: 80,
+ // Defines the preview orientation (1-8) or takes the orientation
+ // value from Exif data if set to true:
+ previewOrientation: true,
+ // Create the preview using the Exif data thumbnail:
+ previewThumbnail: true,
+ // Define if preview images should be cropped or only scaled:
+ previewCrop: false,
+ // Define if preview images should be resized as canvas elements:
+ previewCanvas: true
+ },
+
+ processActions: {
+
+ // Loads the image given via data.files and data.index
+ // as img element, if the browser supports the File API.
+ // Accepts the options fileTypes (regular expression)
+ // and maxFileSize (integer) to limit the files to load:
+ loadImage: function (data, options) {
+ if (options.disabled) {
+ return data;
+ }
+ var that = this,
+ file = data.files[data.index],
+ dfd = $.Deferred();
+ if (($.type(options.maxFileSize) === 'number' &&
+ file.size > options.maxFileSize) ||
+ (options.fileTypes &&
+ !options.fileTypes.test(file.type)) ||
+ !loadImage(
+ file,
+ function (img) {
+ if (img.src) {
+ data.img = img;
+ }
+ dfd.resolveWith(that, [data]);
+ },
+ options
+ )) {
+ return data;
+ }
+ return dfd.promise();
+ },
+
+ // Resizes the image given as data.canvas or data.img
+ // and updates data.canvas or data.img with the resized image.
+ // Also stores the resized image as preview property.
+ // Accepts the options maxWidth, maxHeight, minWidth,
+ // minHeight, canvas and crop:
+ resizeImage: function (data, options) {
+ if (options.disabled || !(data.canvas || data.img)) {
+ return data;
+ }
+ options = $.extend({canvas: true}, options);
+ var that = this,
+ dfd = $.Deferred(),
+ img = (options.canvas && data.canvas) || data.img,
+ resolve = function (newImg) {
+ if (newImg && (newImg.width !== img.width ||
+ newImg.height !== img.height ||
+ options.forceResize)) {
+ data[newImg.getContext ? 'canvas' : 'img'] = newImg;
+ }
+ data.preview = newImg;
+ dfd.resolveWith(that, [data]);
+ },
+ thumbnail;
+ if (data.exif) {
+ if (options.orientation === true) {
+ options.orientation = data.exif.get('Orientation');
+ }
+ if (options.thumbnail) {
+ thumbnail = data.exif.get('Thumbnail');
+ if (thumbnail) {
+ loadImage(thumbnail, resolve, options);
+ return dfd.promise();
+ }
+ }
+ // Prevent orienting the same image twice:
+ if (data.orientation) {
+ delete options.orientation;
+ } else {
+ data.orientation = options.orientation;
+ }
+ }
+ if (img) {
+ resolve(loadImage.scale(img, options));
+ return dfd.promise();
+ }
+ return data;
+ },
+
+ // Saves the processed image given as data.canvas
+ // inplace at data.index of data.files:
+ saveImage: function (data, options) {
+ if (!data.canvas || options.disabled) {
+ return data;
+ }
+ var that = this,
+ file = data.files[data.index],
+ dfd = $.Deferred();
+ if (data.canvas.toBlob) {
+ data.canvas.toBlob(
+ function (blob) {
+ if (!blob.name) {
+ if (file.type === blob.type) {
+ blob.name = file.name;
+ } else if (file.name) {
+ blob.name = file.name.replace(
+ /\.\w+$/,
+ '.' + blob.type.substr(6)
+ );
+ }
+ }
+ // Don't restore invalid meta data:
+ if (file.type !== blob.type) {
+ delete data.imageHead;
+ }
+ // Store the created blob at the position
+ // of the original file in the files list:
+ data.files[data.index] = blob;
+ dfd.resolveWith(that, [data]);
+ },
+ options.type || file.type,
+ options.quality
+ );
+ } else {
+ return data;
+ }
+ return dfd.promise();
+ },
+
+ loadImageMetaData: function (data, options) {
+ if (options.disabled) {
+ return data;
+ }
+ var that = this,
+ dfd = $.Deferred();
+ loadImage.parseMetaData(data.files[data.index], function (result) {
+ $.extend(data, result);
+ dfd.resolveWith(that, [data]);
+ }, options);
+ return dfd.promise();
+ },
+
+ saveImageMetaData: function (data, options) {
+ if (!(data.imageHead && data.canvas &&
+ data.canvas.toBlob && !options.disabled)) {
+ return data;
+ }
+ var file = data.files[data.index],
+ blob = new Blob([
+ data.imageHead,
+ // Resized images always have a head size of 20 bytes,
+ // including the JPEG marker and a minimal JFIF header:
+ this._blobSlice.call(file, 20)
+ ], {type: file.type});
+ blob.name = file.name;
+ data.files[data.index] = blob;
+ return data;
+ },
+
+ // Sets the resized version of the image as a property of the
+ // file object, must be called after "saveImage":
+ setImage: function (data, options) {
+ if (data.preview && !options.disabled) {
+ data.files[data.index][options.name || 'preview'] = data.preview;
+ }
+ return data;
+ },
+
+ deleteImageReferences: function (data, options) {
+ if (!options.disabled) {
+ delete data.img;
+ delete data.canvas;
+ delete data.preview;
+ delete data.imageHead;
+ }
+ return data;
+ }
+
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-jquery-ui.js b/common/modules/file/assets/js/jquery.fileupload-jquery-ui.js
new file mode 100644
index 0000000..a6b2804
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-jquery-ui.js
@@ -0,0 +1,155 @@
+/*
+ * jQuery File Upload jQuery UI Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, require, window */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery', './jquery.fileupload-ui'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'));
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+}(function ($) {
+ 'use strict';
+
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+
+ options: {
+ processdone: function (e, data) {
+ data.context.find('.start').button('enable');
+ },
+ progress: function (e, data) {
+ if (data.context) {
+ data.context.find('.progress').progressbar(
+ 'option',
+ 'value',
+ parseInt(data.loaded / data.total * 100, 10)
+ );
+ }
+ },
+ progressall: function (e, data) {
+ var $this = $(this);
+ $this.find('.fileupload-progress')
+ .find('.progress').progressbar(
+ 'option',
+ 'value',
+ parseInt(data.loaded / data.total * 100, 10)
+ ).end()
+ .find('.progress-extended').each(function () {
+ $(this).html(
+ ($this.data('blueimp-fileupload') ||
+ $this.data('fileupload'))
+ ._renderExtendedProgress(data)
+ );
+ });
+ }
+ },
+
+ _renderUpload: function (func, files) {
+ var node = this._super(func, files),
+ showIconText = $(window).width() > 480;
+ node.find('.progress').empty().progressbar();
+ node.find('.start').button({
+ icons: {primary: 'ui-icon-circle-arrow-e'},
+ text: showIconText
+ });
+ node.find('.cancel').button({
+ icons: {primary: 'ui-icon-cancel'},
+ text: showIconText
+ });
+ if (node.hasClass('fade')) {
+ node.hide();
+ }
+ return node;
+ },
+
+ _renderDownload: function (func, files) {
+ var node = this._super(func, files),
+ showIconText = $(window).width() > 480;
+ node.find('.delete').button({
+ icons: {primary: 'ui-icon-trash'},
+ text: showIconText
+ });
+ if (node.hasClass('fade')) {
+ node.hide();
+ }
+ return node;
+ },
+
+ _startHandler: function (e) {
+ $(e.currentTarget).button('disable');
+ this._super(e);
+ },
+
+ _transition: function (node) {
+ var deferred = $.Deferred();
+ if (node.hasClass('fade')) {
+ node.fadeToggle(
+ this.options.transitionDuration,
+ this.options.transitionEasing,
+ function () {
+ deferred.resolveWith(node);
+ }
+ );
+ } else {
+ deferred.resolveWith(node);
+ }
+ return deferred;
+ },
+
+ _create: function () {
+ this._super();
+ this.element
+ .find('.fileupload-buttonbar')
+ .find('.fileinput-button').each(function () {
+ var input = $(this).find('input:file').detach();
+ $(this)
+ .button({icons: {primary: 'ui-icon-plusthick'}})
+ .append(input);
+ })
+ .end().find('.start')
+ .button({icons: {primary: 'ui-icon-circle-arrow-e'}})
+ .end().find('.cancel')
+ .button({icons: {primary: 'ui-icon-cancel'}})
+ .end().find('.delete')
+ .button({icons: {primary: 'ui-icon-trash'}})
+ .end().find('.progress').progressbar();
+ },
+
+ _destroy: function () {
+ this.element
+ .find('.fileupload-buttonbar')
+ .find('.fileinput-button').each(function () {
+ var input = $(this).find('input:file').detach();
+ $(this)
+ .button('destroy')
+ .append(input);
+ })
+ .end().find('.start')
+ .button('destroy')
+ .end().find('.cancel')
+ .button('destroy')
+ .end().find('.delete')
+ .button('destroy')
+ .end().find('.progress').progressbar('destroy');
+ this._super();
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-process.js b/common/modules/file/assets/js/jquery.fileupload-process.js
new file mode 100644
index 0000000..aa7acec
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-process.js
@@ -0,0 +1,175 @@
+/*
+ * jQuery File Upload Processing Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2012, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, require, window */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ './jquery.fileupload'
+ ], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'));
+ } else {
+ // Browser globals:
+ factory(
+ window.jQuery
+ );
+ }
+}(function ($) {
+ 'use strict';
+
+ var originalAdd = $.blueimp.fileupload.prototype.options.add;
+
+ // The File Upload Processing plugin extends the fileupload widget
+ // with file processing functionality:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+
+ options: {
+ // The list of processing actions:
+ processQueue: [
+ /*
+ {
+ action: 'log',
+ type: 'debug'
+ }
+ */
+ ],
+ add: function (e, data) {
+ var $this = $(this);
+ data.process(function () {
+ return $this.fileupload('process', data);
+ });
+ originalAdd.call(this, e, data);
+ }
+ },
+
+ processActions: {
+ /*
+ log: function (data, options) {
+ console[options.type](
+ 'Processing "' + data.files[data.index].name + '"'
+ );
+ }
+ */
+ },
+
+ _processFile: function (data, originalData) {
+ var that = this,
+ dfd = $.Deferred().resolveWith(that, [data]),
+ chain = dfd.promise();
+ this._trigger('process', null, data);
+ $.each(data.processQueue, function (i, settings) {
+ var func = function (data) {
+ if (originalData.errorThrown) {
+ return $.Deferred()
+ .rejectWith(that, [originalData]).promise();
+ }
+ return that.processActions[settings.action].call(
+ that,
+ data,
+ settings
+ );
+ };
+ chain = chain.pipe(func, settings.always && func);
+ });
+ chain
+ .done(function () {
+ that._trigger('processdone', null, data);
+ that._trigger('processalways', null, data);
+ })
+ .fail(function () {
+ that._trigger('processfail', null, data);
+ that._trigger('processalways', null, data);
+ });
+ return chain;
+ },
+
+ // Replaces the settings of each processQueue item that
+ // are strings starting with an "@", using the remaining
+ // substring as key for the option map,
+ // e.g. "@autoUpload" is replaced with options.autoUpload:
+ _transformProcessQueue: function (options) {
+ var processQueue = [];
+ $.each(options.processQueue, function () {
+ var settings = {},
+ action = this.action,
+ prefix = this.prefix === true ? action : this.prefix;
+ $.each(this, function (key, value) {
+ if ($.type(value) === 'string' &&
+ value.charAt(0) === '@') {
+ settings[key] = options[
+ value.slice(1) || (prefix ? prefix +
+ key.charAt(0).toUpperCase() + key.slice(1) : key)
+ ];
+ } else {
+ settings[key] = value;
+ }
+
+ });
+ processQueue.push(settings);
+ });
+ options.processQueue = processQueue;
+ },
+
+ // Returns the number of files currently in the processsing queue:
+ processing: function () {
+ return this._processing;
+ },
+
+ // Processes the files given as files property of the data parameter,
+ // returns a Promise object that allows to bind callbacks:
+ process: function (data) {
+ var that = this,
+ options = $.extend({}, this.options, data);
+ if (options.processQueue && options.processQueue.length) {
+ this._transformProcessQueue(options);
+ if (this._processing === 0) {
+ this._trigger('processstart');
+ }
+ $.each(data.files, function (index) {
+ var opts = index ? $.extend({}, options) : options,
+ func = function () {
+ if (data.errorThrown) {
+ return $.Deferred()
+ .rejectWith(that, [data]).promise();
+ }
+ return that._processFile(opts, data);
+ };
+ opts.index = index;
+ that._processing += 1;
+ that._processingQueue = that._processingQueue.pipe(func, func)
+ .always(function () {
+ that._processing -= 1;
+ if (that._processing === 0) {
+ that._trigger('processstop');
+ }
+ });
+ });
+ }
+ return this._processingQueue;
+ },
+
+ _create: function () {
+ this._super();
+ this._processing = 0;
+ this._processingQueue = $.Deferred().resolveWith(this)
+ .promise();
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-ui.js b/common/modules/file/assets/js/jquery.fileupload-ui.js
new file mode 100644
index 0000000..26eacb3
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-ui.js
@@ -0,0 +1,710 @@
+/*
+ * jQuery File Upload User Interface Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2010, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, require, window */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ 'tmpl',
+ './jquery.fileupload-image',
+ './jquery.fileupload-audio',
+ './jquery.fileupload-video',
+ './jquery.fileupload-validate'
+ ], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(
+ require('jquery'),
+ require('tmpl')
+ );
+ } else {
+ // Browser globals:
+ factory(
+ window.jQuery,
+ window.tmpl
+ );
+ }
+}(function ($, tmpl) {
+ 'use strict';
+
+ $.blueimp.fileupload.prototype._specialOptions.push(
+ 'filesContainer',
+ 'uploadTemplateId',
+ 'downloadTemplateId'
+ );
+
+ // The UI version extends the file upload widget
+ // and adds complete user interface interaction:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+
+ options: {
+ // By default, files added to the widget are uploaded as soon
+ // as the user clicks on the start buttons. To enable automatic
+ // uploads, set the following option to true:
+ autoUpload: false,
+ // The ID of the upload template:
+ uploadTemplateId: 'template-upload',
+ // The ID of the download template:
+ downloadTemplateId: 'template-download',
+ // The container for the list of files. If undefined, it is set to
+ // an element with class "files" inside of the widget element:
+ filesContainer: undefined,
+ // By default, files are appended to the files container.
+ // Set the following option to true, to prepend files instead:
+ prependFiles: false,
+ // The expected data type of the upload response, sets the dataType
+ // option of the $.ajax upload requests:
+ dataType: 'json',
+
+ // Error and info messages:
+ messages: {
+ unknownError: 'Unknown error'
+ },
+
+ // Function returning the current number of files,
+ // used by the maxNumberOfFiles validation:
+ getNumberOfFiles: function () {
+ return this.filesContainer.children()
+ .not('.processing').length;
+ },
+
+ // Callback to retrieve the list of files from the server response:
+ getFilesFromResponse: function (data) {
+ if (data.result && $.isArray(data.result.files)) {
+ return data.result.files;
+ }
+ return [];
+ },
+
+ // The add callback is invoked as soon as files are added to the fileupload
+ // widget (via file input selection, drag & drop or add API call).
+ // See the basic file upload widget for more information:
+ add: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var $this = $(this),
+ that = $this.data('blueimp-fileupload') ||
+ $this.data('fileupload'),
+ options = that.options;
+ data.context = that._renderUpload(data.files)
+ .data('data', data)
+ .addClass('processing');
+ options.filesContainer[
+ options.prependFiles ? 'prepend' : 'append'
+ ](data.context);
+ that._forceReflow(data.context);
+ that._transition(data.context);
+ data.process(function () {
+ return $this.fileupload('process', data);
+ }).always(function () {
+ data.context.each(function (index) {
+ $(this).find('.size').text(
+ that._formatFileSize(data.files[index].size)
+ );
+ }).removeClass('processing');
+ that._renderPreviews(data);
+ }).done(function () {
+ data.context.find('.start').prop('disabled', false);
+ if ((that._trigger('added', e, data) !== false) &&
+ (options.autoUpload || data.autoUpload) &&
+ data.autoUpload !== false) {
+ data.submit();
+ }
+ }).fail(function () {
+ if (data.files.error) {
+ data.context.each(function (index) {
+ var error = data.files[index].error;
+ if (error) {
+ $(this).find('.error').text(error);
+ }
+ });
+ }
+ });
+ },
+ // Callback for the start of each file upload request:
+ send: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = $(this).data('blueimp-fileupload') ||
+ $(this).data('fileupload');
+ if (data.context && data.dataType &&
+ data.dataType.substr(0, 6) === 'iframe') {
+ // Iframe Transport does not support progress events.
+ // In lack of an indeterminate progress bar, we set
+ // the progress to 100%, showing the full animated bar:
+ data.context
+ .find('.progress').addClass(
+ !$.support.transition && 'progress-animated'
+ )
+ .attr('aria-valuenow', 100)
+ .children().first().css(
+ 'width',
+ '100%'
+ );
+ }
+ return that._trigger('sent', e, data);
+ },
+ // Callback for successful uploads:
+ done: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = $(this).data('blueimp-fileupload') ||
+ $(this).data('fileupload'),
+ getFilesFromResponse = data.getFilesFromResponse ||
+ that.options.getFilesFromResponse,
+ files = getFilesFromResponse(data),
+ template,
+ deferred;
+ if (data.context) {
+ data.context.each(function (index) {
+ var file = files[index] ||
+ {error: 'Empty file upload result'};
+ deferred = that._addFinishedDeferreds();
+ that._transition($(this)).done(
+ function () {
+ var node = $(this);
+ template = that._renderDownload([file])
+ .replaceAll(node);
+ that._forceReflow(template);
+ that._transition(template).done(
+ function () {
+ data.context = $(this);
+ that._trigger('completed', e, data);
+ that._trigger('finished', e, data);
+ deferred.resolve();
+ }
+ );
+ }
+ );
+ });
+ } else {
+ template = that._renderDownload(files)[
+ that.options.prependFiles ? 'prependTo' : 'appendTo'
+ ](that.options.filesContainer);
+ that._forceReflow(template);
+ deferred = that._addFinishedDeferreds();
+ that._transition(template).done(
+ function () {
+ data.context = $(this);
+ that._trigger('completed', e, data);
+ that._trigger('finished', e, data);
+ deferred.resolve();
+ }
+ );
+ }
+ },
+ // Callback for failed (abort or error) uploads:
+ fail: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = $(this).data('blueimp-fileupload') ||
+ $(this).data('fileupload'),
+ template,
+ deferred;
+ if (data.context) {
+ data.context.each(function (index) {
+ if (data.errorThrown !== 'abort') {
+ var file = data.files[index];
+ file.error = file.error || data.errorThrown ||
+ data.i18n('unknownError');
+ deferred = that._addFinishedDeferreds();
+ that._transition($(this)).done(
+ function () {
+ var node = $(this);
+ template = that._renderDownload([file])
+ .replaceAll(node);
+ that._forceReflow(template);
+ that._transition(template).done(
+ function () {
+ data.context = $(this);
+ that._trigger('failed', e, data);
+ that._trigger('finished', e, data);
+ deferred.resolve();
+ }
+ );
+ }
+ );
+ } else {
+ deferred = that._addFinishedDeferreds();
+ that._transition($(this)).done(
+ function () {
+ $(this).remove();
+ that._trigger('failed', e, data);
+ that._trigger('finished', e, data);
+ deferred.resolve();
+ }
+ );
+ }
+ });
+ } else if (data.errorThrown !== 'abort') {
+ data.context = that._renderUpload(data.files)[
+ that.options.prependFiles ? 'prependTo' : 'appendTo'
+ ](that.options.filesContainer)
+ .data('data', data);
+ that._forceReflow(data.context);
+ deferred = that._addFinishedDeferreds();
+ that._transition(data.context).done(
+ function () {
+ data.context = $(this);
+ that._trigger('failed', e, data);
+ that._trigger('finished', e, data);
+ deferred.resolve();
+ }
+ );
+ } else {
+ that._trigger('failed', e, data);
+ that._trigger('finished', e, data);
+ that._addFinishedDeferreds().resolve();
+ }
+ },
+ // Callback for upload progress events:
+ progress: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var progress = Math.floor(data.loaded / data.total * 100);
+ if (data.context) {
+ data.context.each(function () {
+ $(this).find('.progress')
+ .attr('aria-valuenow', progress)
+ .children().first().css(
+ 'width',
+ progress + '%'
+ );
+ });
+ }
+ },
+ // Callback for global upload progress events:
+ progressall: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var $this = $(this),
+ progress = Math.floor(data.loaded / data.total * 100),
+ globalProgressNode = $this.find('.fileupload-progress'),
+ extendedProgressNode = globalProgressNode
+ .find('.progress-extended');
+ if (extendedProgressNode.length) {
+ extendedProgressNode.html(
+ ($this.data('blueimp-fileupload') || $this.data('fileupload'))
+ ._renderExtendedProgress(data)
+ );
+ }
+ globalProgressNode
+ .find('.progress')
+ .attr('aria-valuenow', progress)
+ .children().first().css(
+ 'width',
+ progress + '%'
+ );
+ },
+ // Callback for uploads start, equivalent to the global ajaxStart event:
+ start: function (e) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = $(this).data('blueimp-fileupload') ||
+ $(this).data('fileupload');
+ that._resetFinishedDeferreds();
+ that._transition($(this).find('.fileupload-progress')).done(
+ function () {
+ that._trigger('started', e);
+ }
+ );
+ },
+ // Callback for uploads stop, equivalent to the global ajaxStop event:
+ stop: function (e) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = $(this).data('blueimp-fileupload') ||
+ $(this).data('fileupload'),
+ deferred = that._addFinishedDeferreds();
+ $.when.apply($, that._getFinishedDeferreds())
+ .done(function () {
+ that._trigger('stopped', e);
+ });
+ that._transition($(this).find('.fileupload-progress')).done(
+ function () {
+ $(this).find('.progress')
+ .attr('aria-valuenow', '0')
+ .children().first().css('width', '0%');
+ $(this).find('.progress-extended').html(' ');
+ deferred.resolve();
+ }
+ );
+ },
+ processstart: function (e) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ $(this).addClass('fileupload-processing');
+ },
+ processstop: function (e) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ $(this).removeClass('fileupload-processing');
+ },
+ // Callback for file deletion:
+ destroy: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ var that = $(this).data('blueimp-fileupload') ||
+ $(this).data('fileupload'),
+ removeNode = function () {
+ that._transition(data.context).done(
+ function () {
+ $(this).remove();
+ that._trigger('destroyed', e, data);
+ }
+ );
+ };
+ if (data.url) {
+ data.dataType = data.dataType || that.options.dataType;
+ $.ajax(data).done(removeNode).fail(function () {
+ that._trigger('destroyfailed', e, data);
+ });
+ } else {
+ removeNode();
+ }
+ }
+ },
+
+ _resetFinishedDeferreds: function () {
+ this._finishedUploads = [];
+ },
+
+ _addFinishedDeferreds: function (deferred) {
+ if (!deferred) {
+ deferred = $.Deferred();
+ }
+ this._finishedUploads.push(deferred);
+ return deferred;
+ },
+
+ _getFinishedDeferreds: function () {
+ return this._finishedUploads;
+ },
+
+ // Link handler, that allows to download files
+ // by drag & drop of the links to the desktop:
+ _enableDragToDesktop: function () {
+ var link = $(this),
+ url = link.prop('href'),
+ name = link.prop('download'),
+ type = 'application/octet-stream';
+ link.bind('dragstart', function (e) {
+ try {
+ e.originalEvent.dataTransfer.setData(
+ 'DownloadURL',
+ [type, name, url].join(':')
+ );
+ } catch (ignore) {}
+ });
+ },
+
+ _formatFileSize: function (bytes) {
+ if (typeof bytes !== 'number') {
+ return '';
+ }
+ if (bytes >= 1000000000) {
+ return (bytes / 1000000000).toFixed(2) + ' GB';
+ }
+ if (bytes >= 1000000) {
+ return (bytes / 1000000).toFixed(2) + ' MB';
+ }
+ return (bytes / 1000).toFixed(2) + ' KB';
+ },
+
+ _formatBitrate: function (bits) {
+ if (typeof bits !== 'number') {
+ return '';
+ }
+ if (bits >= 1000000000) {
+ return (bits / 1000000000).toFixed(2) + ' Gbit/s';
+ }
+ if (bits >= 1000000) {
+ return (bits / 1000000).toFixed(2) + ' Mbit/s';
+ }
+ if (bits >= 1000) {
+ return (bits / 1000).toFixed(2) + ' kbit/s';
+ }
+ return bits.toFixed(2) + ' bit/s';
+ },
+
+ _formatTime: function (seconds) {
+ var date = new Date(seconds * 1000),
+ days = Math.floor(seconds / 86400);
+ days = days ? days + 'd ' : '';
+ return days +
+ ('0' + date.getUTCHours()).slice(-2) + ':' +
+ ('0' + date.getUTCMinutes()).slice(-2) + ':' +
+ ('0' + date.getUTCSeconds()).slice(-2);
+ },
+
+ _formatPercentage: function (floatValue) {
+ return (floatValue * 100).toFixed(2) + ' %';
+ },
+
+ _renderExtendedProgress: function (data) {
+ return this._formatBitrate(data.bitrate) + ' | ' +
+ this._formatTime(
+ (data.total - data.loaded) * 8 / data.bitrate
+ ) + ' | ' +
+ this._formatPercentage(
+ data.loaded / data.total
+ ) + ' | ' +
+ this._formatFileSize(data.loaded) + ' / ' +
+ this._formatFileSize(data.total);
+ },
+
+ _renderTemplate: function (func, files) {
+ if (!func) {
+ return $();
+ }
+ var result = func({
+ files: files,
+ formatFileSize: this._formatFileSize,
+ options: this.options
+ });
+ if (result instanceof $) {
+ return result;
+ }
+ return $(this.options.templatesContainer).html(result).children();
+ },
+
+ _renderPreviews: function (data) {
+ data.context.find('.preview').each(function (index, elm) {
+ $(elm).append(data.files[index].preview);
+ });
+ },
+
+ _renderUpload: function (files) {
+ return this._renderTemplate(
+ this.options.uploadTemplate,
+ files
+ );
+ },
+
+ _renderDownload: function (files) {
+ return this._renderTemplate(
+ this.options.downloadTemplate,
+ files
+ ).find('a[download]').each(this._enableDragToDesktop).end();
+ },
+
+ _startHandler: function (e) {
+ e.preventDefault();
+ var button = $(e.currentTarget),
+ template = button.closest('.template-upload'),
+ data = template.data('data');
+ button.prop('disabled', true);
+ if (data && data.submit) {
+ data.submit();
+ }
+ },
+
+ _cancelHandler: function (e) {
+ e.preventDefault();
+ var template = $(e.currentTarget)
+ .closest('.template-upload,.template-download'),
+ data = template.data('data') || {};
+ data.context = data.context || template;
+ if (data.abort) {
+ data.abort();
+ } else {
+ data.errorThrown = 'abort';
+ this._trigger('fail', e, data);
+ }
+ },
+
+ _deleteHandler: function (e) {
+ e.preventDefault();
+ var button = $(e.currentTarget);
+ this._trigger('destroy', e, $.extend({
+ context: button.closest('.template-download'),
+ type: 'DELETE'
+ }, button.data()));
+ },
+
+ _forceReflow: function (node) {
+ return $.support.transition && node.length &&
+ node[0].offsetWidth;
+ },
+
+ _transition: function (node) {
+ var dfd = $.Deferred();
+ if ($.support.transition && node.hasClass('fade') && node.is(':visible')) {
+ node.bind(
+ $.support.transition.end,
+ function (e) {
+ // Make sure we don't respond to other transitions events
+ // in the container element, e.g. from button elements:
+ if (e.target === node[0]) {
+ node.unbind($.support.transition.end);
+ dfd.resolveWith(node);
+ }
+ }
+ ).toggleClass('in');
+ } else {
+ node.toggleClass('in');
+ dfd.resolveWith(node);
+ }
+ return dfd;
+ },
+
+ _initButtonBarEventHandlers: function () {
+ var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
+ filesList = this.options.filesContainer;
+ this._on(fileUploadButtonBar.find('.start'), {
+ click: function (e) {
+ e.preventDefault();
+ filesList.find('.start').click();
+ }
+ });
+ this._on(fileUploadButtonBar.find('.cancel'), {
+ click: function (e) {
+ e.preventDefault();
+ filesList.find('.cancel').click();
+ }
+ });
+ this._on(fileUploadButtonBar.find('.delete'), {
+ click: function (e) {
+ e.preventDefault();
+ filesList.find('.toggle:checked')
+ .closest('.template-download')
+ .find('.delete').click();
+ fileUploadButtonBar.find('.toggle')
+ .prop('checked', false);
+ }
+ });
+ this._on(fileUploadButtonBar.find('.toggle'), {
+ change: function (e) {
+ filesList.find('.toggle').prop(
+ 'checked',
+ $(e.currentTarget).is(':checked')
+ );
+ }
+ });
+ },
+
+ _destroyButtonBarEventHandlers: function () {
+ this._off(
+ this.element.find('.fileupload-buttonbar')
+ .find('.start, .cancel, .delete'),
+ 'click'
+ );
+ this._off(
+ this.element.find('.fileupload-buttonbar .toggle'),
+ 'change.'
+ );
+ },
+
+ _initEventHandlers: function () {
+ this._super();
+ this._on(this.options.filesContainer, {
+ 'click .start': this._startHandler,
+ 'click .cancel': this._cancelHandler,
+ 'click .delete': this._deleteHandler
+ });
+ this._initButtonBarEventHandlers();
+ },
+
+ _destroyEventHandlers: function () {
+ this._destroyButtonBarEventHandlers();
+ this._off(this.options.filesContainer, 'click');
+ this._super();
+ },
+
+ _enableFileInputButton: function () {
+ this.element.find('.fileinput-button input')
+ .prop('disabled', false)
+ .parent().removeClass('disabled');
+ },
+
+ _disableFileInputButton: function () {
+ this.element.find('.fileinput-button input')
+ .prop('disabled', true)
+ .parent().addClass('disabled');
+ },
+
+ _initTemplates: function () {
+ var options = this.options;
+ options.templatesContainer = this.document[0].createElement(
+ options.filesContainer.prop('nodeName')
+ );
+ if (tmpl) {
+ if (options.uploadTemplateId) {
+ options.uploadTemplate = tmpl(options.uploadTemplateId);
+ }
+ if (options.downloadTemplateId) {
+ options.downloadTemplate = tmpl(options.downloadTemplateId);
+ }
+ }
+ },
+
+ _initFilesContainer: function () {
+ var options = this.options;
+ if (options.filesContainer === undefined) {
+ options.filesContainer = this.element.find('.files');
+ } else if (!(options.filesContainer instanceof $)) {
+ options.filesContainer = $(options.filesContainer);
+ }
+ },
+
+ _initSpecialOptions: function () {
+ this._super();
+ this._initFilesContainer();
+ this._initTemplates();
+ },
+
+ _create: function () {
+ this._super();
+ this._resetFinishedDeferreds();
+ if (!$.support.fileInput) {
+ this._disableFileInputButton();
+ }
+ },
+
+ enable: function () {
+ var wasDisabled = false;
+ if (this.options.disabled) {
+ wasDisabled = true;
+ }
+ this._super();
+ if (wasDisabled) {
+ this.element.find('input, button').prop('disabled', false);
+ this._enableFileInputButton();
+ }
+ },
+
+ disable: function () {
+ if (!this.options.disabled) {
+ this.element.find('input, button').prop('disabled', true);
+ this._disableFileInputButton();
+ }
+ this._super();
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-validate.js b/common/modules/file/assets/js/jquery.fileupload-validate.js
new file mode 100644
index 0000000..b771386
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-validate.js
@@ -0,0 +1,122 @@
+/*
+ * jQuery File Upload Validation Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* global define, require, window */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ './jquery.fileupload-process'
+ ], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'));
+ } else {
+ // Browser globals:
+ factory(
+ window.jQuery
+ );
+ }
+}(function ($) {
+ 'use strict';
+
+ // Append to the default processQueue:
+ $.blueimp.fileupload.prototype.options.processQueue.push(
+ {
+ action: 'validate',
+ // Always trigger this action,
+ // even if the previous action was rejected:
+ always: true,
+ // Options taken from the global options map:
+ acceptFileTypes: '@',
+ maxFileSize: '@',
+ minFileSize: '@',
+ maxNumberOfFiles: '@',
+ disabled: '@disableValidation'
+ }
+ );
+
+ // The File Upload Validation plugin extends the fileupload widget
+ // with file validation functionality:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+
+ options: {
+ /*
+ // The regular expression for allowed file types, matches
+ // against either file type or file name:
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
+ // The maximum allowed file size in bytes:
+ maxFileSize: 10000000, // 10 MB
+ // The minimum allowed file size in bytes:
+ minFileSize: undefined, // No minimal file size
+ // The limit of files to be uploaded:
+ maxNumberOfFiles: 10,
+ */
+
+ // Function returning the current number of files,
+ // has to be overriden for maxNumberOfFiles validation:
+ getNumberOfFiles: $.noop,
+
+ // Error and info messages:
+ messages: {
+ maxNumberOfFiles: 'Maximum number of files exceeded',
+ acceptFileTypes: 'File type not allowed',
+ maxFileSize: 'File is too large',
+ minFileSize: 'File is too small'
+ }
+ },
+
+ processActions: {
+
+ validate: function (data, options) {
+ if (options.disabled) {
+ return data;
+ }
+ var dfd = $.Deferred(),
+ settings = this.options,
+ file = data.files[data.index],
+ fileSize;
+ if (options.minFileSize || options.maxFileSize) {
+ fileSize = file.size;
+ }
+ if ($.type(options.maxNumberOfFiles) === 'number' &&
+ (settings.getNumberOfFiles() || 0) + data.files.length >
+ options.maxNumberOfFiles) {
+ file.error = settings.i18n('maxNumberOfFiles');
+ } else if (options.acceptFileTypes &&
+ !(options.acceptFileTypes.test(file.type) ||
+ options.acceptFileTypes.test(file.name))) {
+ file.error = settings.i18n('acceptFileTypes');
+ } else if (fileSize > options.maxFileSize) {
+ file.error = settings.i18n('maxFileSize');
+ } else if ($.type(fileSize) === 'number' &&
+ fileSize < options.minFileSize) {
+ file.error = settings.i18n('minFileSize');
+ } else {
+ delete file.error;
+ }
+ if (file.error || data.files.error) {
+ data.files.error = true;
+ dfd.rejectWith(this, [data]);
+ } else {
+ dfd.resolveWith(this, [data]);
+ }
+ return dfd.promise();
+ }
+
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload-video.js b/common/modules/file/assets/js/jquery.fileupload-video.js
new file mode 100644
index 0000000..1416e26
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload-video.js
@@ -0,0 +1,112 @@
+/*
+ * jQuery File Upload Video Preview Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, require, window, document */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ 'load-image',
+ './jquery.fileupload-process'
+ ], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(
+ require('jquery'),
+ require('load-image')
+ );
+ } else {
+ // Browser globals:
+ factory(
+ window.jQuery,
+ window.loadImage
+ );
+ }
+}(function ($, loadImage) {
+ 'use strict';
+
+ // Prepend to the default processQueue:
+ $.blueimp.fileupload.prototype.options.processQueue.unshift(
+ {
+ action: 'loadVideo',
+ // Use the action as prefix for the "@" options:
+ prefix: true,
+ fileTypes: '@',
+ maxFileSize: '@',
+ disabled: '@disableVideoPreview'
+ },
+ {
+ action: 'setVideo',
+ name: '@videoPreviewName',
+ disabled: '@disableVideoPreview'
+ }
+ );
+
+ // The File Upload Video Preview plugin extends the fileupload widget
+ // with video preview functionality:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+
+ options: {
+ // The regular expression for the types of video files to load,
+ // matched against the file type:
+ loadVideoFileTypes: /^video\/.*$/
+ },
+
+ _videoElement: document.createElement('video'),
+
+ processActions: {
+
+ // Loads the video file given via data.files and data.index
+ // as video element if the browser supports playing it.
+ // Accepts the options fileTypes (regular expression)
+ // and maxFileSize (integer) to limit the files to load:
+ loadVideo: function (data, options) {
+ if (options.disabled) {
+ return data;
+ }
+ var file = data.files[data.index],
+ url,
+ video;
+ if (this._videoElement.canPlayType &&
+ this._videoElement.canPlayType(file.type) &&
+ ($.type(options.maxFileSize) !== 'number' ||
+ file.size <= options.maxFileSize) &&
+ (!options.fileTypes ||
+ options.fileTypes.test(file.type))) {
+ url = loadImage.createObjectURL(file);
+ if (url) {
+ video = this._videoElement.cloneNode(false);
+ video.src = url;
+ video.controls = true;
+ data.video = video;
+ return data;
+ }
+ }
+ return data;
+ },
+
+ // Sets the video element as a property of the file object:
+ setVideo: function (data, options) {
+ if (data.video && !options.disabled) {
+ data.files[data.index][options.name || 'preview'] = data.video;
+ }
+ return data;
+ }
+
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.fileupload.js b/common/modules/file/assets/js/jquery.fileupload.js
new file mode 100644
index 0000000..68d1c4a
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.fileupload.js
@@ -0,0 +1,1477 @@
+/*
+ * jQuery File Upload Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2010, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* jshint nomen:false */
+/* global define, require, window, document, location, Blob, FormData */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define([
+ 'jquery',
+ 'jquery.ui.widget'
+ ], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(
+ require('jquery'),
+ require('./vendor/jquery.ui.widget')
+ );
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+}(function ($) {
+ 'use strict';
+
+ // Detect file input support, based on
+ // http://viljamis.com/blog/2012/file-upload-support-on-mobile/
+ $.support.fileInput = !(new RegExp(
+ // Handle devices which give false positives for the feature detection:
+ '(Android (1\\.[0156]|2\\.[01]))' +
+ '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
+ '|(w(eb)?OSBrowser)|(webOS)' +
+ '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
+ ).test(window.navigator.userAgent) ||
+ // Feature detection for all other devices:
+ $(' ').prop('disabled'));
+
+ // The FileReader API is not actually used, but works as feature detection,
+ // as some Safari versions (5?) support XHR file uploads via the FormData API,
+ // but not non-multipart XHR file uploads.
+ // window.XMLHttpRequestUpload is not available on IE10, so we check for
+ // window.ProgressEvent instead to detect XHR2 file upload capability:
+ $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader);
+ $.support.xhrFormDataFileUpload = !!window.FormData;
+
+ // Detect support for Blob slicing (required for chunked uploads):
+ $.support.blobSlice = window.Blob && (Blob.prototype.slice ||
+ Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
+
+ // Helper function to create drag handlers for dragover/dragenter/dragleave:
+ function getDragHandler(type) {
+ var isDragOver = type === 'dragover';
+ return function (e) {
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
+ var dataTransfer = e.dataTransfer;
+ if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
+ this._trigger(
+ type,
+ $.Event(type, {delegatedEvent: e})
+ ) !== false) {
+ e.preventDefault();
+ if (isDragOver) {
+ dataTransfer.dropEffect = 'copy';
+ }
+ }
+ };
+ }
+
+ // The fileupload widget listens for change events on file input fields defined
+ // via fileInput setting and paste or drop events of the given dropZone.
+ // In addition to the default jQuery Widget methods, the fileupload widget
+ // exposes the "add" and "send" methods, to add or directly send files using
+ // the fileupload API.
+ // By default, files added via file input selection, paste, drag & drop or
+ // "add" method are uploaded immediately, but it is possible to override
+ // the "add" callback option to queue file uploads.
+ $.widget('blueimp.fileupload', {
+
+ options: {
+ // The drop target element(s), by the default the complete document.
+ // Set to null to disable drag & drop support:
+ dropZone: $(document),
+ // The paste target element(s), by the default undefined.
+ // Set to a DOM node or jQuery object to enable file pasting:
+ pasteZone: undefined,
+ // The file input field(s), that are listened to for change events.
+ // If undefined, it is set to the file input fields inside
+ // of the widget element on plugin initialization.
+ // Set to null to disable the change listener.
+ fileInput: undefined,
+ // By default, the file input field is replaced with a clone after
+ // each input field change event. This is required for iframe transport
+ // queues and allows change events to be fired for the same file
+ // selection, but can be disabled by setting the following option to false:
+ replaceFileInput: true,
+ // The parameter name for the file form data (the request argument name).
+ // If undefined or empty, the name property of the file input field is
+ // used, or "files[]" if the file input name property is also empty,
+ // can be a string or an array of strings:
+ paramName: undefined,
+ // By default, each file of a selection is uploaded using an individual
+ // request for XHR type uploads. Set to false to upload file
+ // selections in one request each:
+ singleFileUploads: true,
+ // To limit the number of files uploaded with one XHR request,
+ // set the following option to an integer greater than 0:
+ limitMultiFileUploads: undefined,
+ // The following option limits the number of files uploaded with one
+ // XHR request to keep the request size under or equal to the defined
+ // limit in bytes:
+ limitMultiFileUploadSize: undefined,
+ // Multipart file uploads add a number of bytes to each uploaded file,
+ // therefore the following option adds an overhead for each file used
+ // in the limitMultiFileUploadSize configuration:
+ limitMultiFileUploadSizeOverhead: 512,
+ // Set the following option to true to issue all file upload requests
+ // in a sequential order:
+ sequentialUploads: false,
+ // To limit the number of concurrent uploads,
+ // set the following option to an integer greater than 0:
+ limitConcurrentUploads: undefined,
+ // Set the following option to true to force iframe transport uploads:
+ forceIframeTransport: false,
+ // Set the following option to the location of a redirect url on the
+ // origin server, for cross-domain iframe transport uploads:
+ redirect: undefined,
+ // The parameter name for the redirect url, sent as part of the form
+ // data and set to 'redirect' if this option is empty:
+ redirectParamName: undefined,
+ // Set the following option to the location of a postMessage window,
+ // to enable postMessage transport uploads:
+ postMessage: undefined,
+ // By default, XHR file uploads are sent as multipart/form-data.
+ // The iframe transport is always using multipart/form-data.
+ // Set to false to enable non-multipart XHR uploads:
+ multipart: true,
+ // To upload large files in smaller chunks, set the following option
+ // to a preferred maximum chunk size. If set to 0, null or undefined,
+ // or the browser does not support the required Blob API, files will
+ // be uploaded as a whole.
+ maxChunkSize: undefined,
+ // When a non-multipart upload or a chunked multipart upload has been
+ // aborted, this option can be used to resume the upload by setting
+ // it to the size of the already uploaded bytes. This option is most
+ // useful when modifying the options object inside of the "add" or
+ // "send" callbacks, as the options are cloned for each file upload.
+ uploadedBytes: undefined,
+ // By default, failed (abort or error) file uploads are removed from the
+ // global progress calculation. Set the following option to false to
+ // prevent recalculating the global progress data:
+ recalculateProgress: true,
+ // Interval in milliseconds to calculate and trigger progress events:
+ progressInterval: 100,
+ // Interval in milliseconds to calculate progress bitrate:
+ bitrateInterval: 500,
+ // By default, uploads are started automatically when adding files:
+ autoUpload: true,
+
+ // Error and info messages:
+ messages: {
+ uploadedBytes: 'Uploaded bytes exceed file size'
+ },
+
+ // Translation function, gets the message key to be translated
+ // and an object with context specific data as arguments:
+ i18n: function (message, context) {
+ message = this.messages[message] || message.toString();
+ if (context) {
+ $.each(context, function (key, value) {
+ message = message.replace('{' + key + '}', value);
+ });
+ }
+ return message;
+ },
+
+ // Additional form data to be sent along with the file uploads can be set
+ // using this option, which accepts an array of objects with name and
+ // value properties, a function returning such an array, a FormData
+ // object (for XHR file uploads), or a simple object.
+ // The form of the first fileInput is given as parameter to the function:
+ formData: function (form) {
+ return form.serializeArray();
+ },
+
+ // The add callback is invoked as soon as files are added to the fileupload
+ // widget (via file input selection, drag & drop, paste or add API call).
+ // If the singleFileUploads option is enabled, this callback will be
+ // called once for each file in the selection for XHR file uploads, else
+ // once for each file selection.
+ //
+ // The upload starts when the submit method is invoked on the data parameter.
+ // The data object contains a files property holding the added files
+ // and allows you to override plugin options as well as define ajax settings.
+ //
+ // Listeners for this callback can also be bound the following way:
+ // .bind('fileuploadadd', func);
+ //
+ // data.submit() returns a Promise object and allows to attach additional
+ // handlers using jQuery's Deferred callbacks:
+ // data.submit().done(func).fail(func).always(func);
+ add: function (e, data) {
+ if (e.isDefaultPrevented()) {
+ return false;
+ }
+ if (data.autoUpload || (data.autoUpload !== false &&
+ $(this).fileupload('option', 'autoUpload'))) {
+ data.process().done(function () {
+ data.submit();
+ });
+ }
+ },
+
+ // Other callbacks:
+
+ // Callback for the submit event of each file upload:
+ // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
+
+ // Callback for the start of each file upload request:
+ // send: function (e, data) {}, // .bind('fileuploadsend', func);
+
+ // Callback for successful uploads:
+ // done: function (e, data) {}, // .bind('fileuploaddone', func);
+
+ // Callback for failed (abort or error) uploads:
+ // fail: function (e, data) {}, // .bind('fileuploadfail', func);
+
+ // Callback for completed (success, abort or error) requests:
+ // always: function (e, data) {}, // .bind('fileuploadalways', func);
+
+ // Callback for upload progress events:
+ // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
+
+ // Callback for global upload progress events:
+ // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
+
+ // Callback for uploads start, equivalent to the global ajaxStart event:
+ // start: function (e) {}, // .bind('fileuploadstart', func);
+
+ // Callback for uploads stop, equivalent to the global ajaxStop event:
+ // stop: function (e) {}, // .bind('fileuploadstop', func);
+
+ // Callback for change events of the fileInput(s):
+ // change: function (e, data) {}, // .bind('fileuploadchange', func);
+
+ // Callback for paste events to the pasteZone(s):
+ // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
+
+ // Callback for drop events of the dropZone(s):
+ // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
+
+ // Callback for dragover events of the dropZone(s):
+ // dragover: function (e) {}, // .bind('fileuploaddragover', func);
+
+ // Callback for the start of each chunk upload request:
+ // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
+
+ // Callback for successful chunk uploads:
+ // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
+
+ // Callback for failed (abort or error) chunk uploads:
+ // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
+
+ // Callback for completed (success, abort or error) chunk upload requests:
+ // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
+
+ // The plugin options are used as settings object for the ajax calls.
+ // The following are jQuery ajax settings required for the file uploads:
+ processData: false,
+ contentType: false,
+ cache: false,
+ timeout: 0
+ },
+
+ // A list of options that require reinitializing event listeners and/or
+ // special initialization code:
+ _specialOptions: [
+ 'fileInput',
+ 'dropZone',
+ 'pasteZone',
+ 'multipart',
+ 'forceIframeTransport'
+ ],
+
+ _blobSlice: $.support.blobSlice && function () {
+ var slice = this.slice || this.webkitSlice || this.mozSlice;
+ return slice.apply(this, arguments);
+ },
+
+ _BitrateTimer: function () {
+ this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
+ this.loaded = 0;
+ this.bitrate = 0;
+ this.getBitrate = function (now, loaded, interval) {
+ var timeDiff = now - this.timestamp;
+ if (!this.bitrate || !interval || timeDiff > interval) {
+ this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
+ this.loaded = loaded;
+ this.timestamp = now;
+ }
+ return this.bitrate;
+ };
+ },
+
+ _isXHRUpload: function (options) {
+ return !options.forceIframeTransport &&
+ ((!options.multipart && $.support.xhrFileUpload) ||
+ $.support.xhrFormDataFileUpload);
+ },
+
+ _getFormData: function (options) {
+ var formData;
+ if ($.type(options.formData) === 'function') {
+ return options.formData(options.form);
+ }
+ if ($.isArray(options.formData)) {
+ return options.formData;
+ }
+ if ($.type(options.formData) === 'object') {
+ formData = [];
+ $.each(options.formData, function (name, value) {
+ formData.push({name: name, value: value});
+ });
+ return formData;
+ }
+ return [];
+ },
+
+ _getTotal: function (files) {
+ var total = 0;
+ $.each(files, function (index, file) {
+ total += file.size || 1;
+ });
+ return total;
+ },
+
+ _initProgressObject: function (obj) {
+ var progress = {
+ loaded: 0,
+ total: 0,
+ bitrate: 0
+ };
+ if (obj._progress) {
+ $.extend(obj._progress, progress);
+ } else {
+ obj._progress = progress;
+ }
+ },
+
+ _initResponseObject: function (obj) {
+ var prop;
+ if (obj._response) {
+ for (prop in obj._response) {
+ if (obj._response.hasOwnProperty(prop)) {
+ delete obj._response[prop];
+ }
+ }
+ } else {
+ obj._response = {};
+ }
+ },
+
+ _onProgress: function (e, data) {
+ if (e.lengthComputable) {
+ var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
+ loaded;
+ if (data._time && data.progressInterval &&
+ (now - data._time < data.progressInterval) &&
+ e.loaded !== e.total) {
+ return;
+ }
+ data._time = now;
+ loaded = Math.floor(
+ e.loaded / e.total * (data.chunkSize || data._progress.total)
+ ) + (data.uploadedBytes || 0);
+ // Add the difference from the previously loaded state
+ // to the global loaded counter:
+ this._progress.loaded += (loaded - data._progress.loaded);
+ this._progress.bitrate = this._bitrateTimer.getBitrate(
+ now,
+ this._progress.loaded,
+ data.bitrateInterval
+ );
+ data._progress.loaded = data.loaded = loaded;
+ data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
+ now,
+ loaded,
+ data.bitrateInterval
+ );
+ // Trigger a custom progress event with a total data property set
+ // to the file size(s) of the current upload and a loaded data
+ // property calculated accordingly:
+ this._trigger(
+ 'progress',
+ $.Event('progress', {delegatedEvent: e}),
+ data
+ );
+ // Trigger a global progress event for all current file uploads,
+ // including ajax calls queued for sequential file uploads:
+ this._trigger(
+ 'progressall',
+ $.Event('progressall', {delegatedEvent: e}),
+ this._progress
+ );
+ }
+ },
+
+ _initProgressListener: function (options) {
+ var that = this,
+ xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
+ // Accesss to the native XHR object is required to add event listeners
+ // for the upload progress event:
+ if (xhr.upload) {
+ $(xhr.upload).bind('progress', function (e) {
+ var oe = e.originalEvent;
+ // Make sure the progress event properties get copied over:
+ e.lengthComputable = oe.lengthComputable;
+ e.loaded = oe.loaded;
+ e.total = oe.total;
+ that._onProgress(e, options);
+ });
+ options.xhr = function () {
+ return xhr;
+ };
+ }
+ },
+
+ _isInstanceOf: function (type, obj) {
+ // Cross-frame instanceof check
+ return Object.prototype.toString.call(obj) === '[object ' + type + ']';
+ },
+
+ _initXHRData: function (options) {
+ var that = this,
+ formData,
+ file = options.files[0],
+ // Ignore non-multipart setting if not supported:
+ multipart = options.multipart || !$.support.xhrFileUpload,
+ paramName = $.type(options.paramName) === 'array' ?
+ options.paramName[0] : options.paramName;
+ options.headers = $.extend({}, options.headers);
+ if (options.contentRange) {
+ options.headers['Content-Range'] = options.contentRange;
+ }
+ if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
+ options.headers['Content-Disposition'] = 'attachment; filename="' +
+ encodeURI(file.name) + '"';
+ }
+ if (!multipart) {
+ options.contentType = file.type || 'application/octet-stream';
+ options.data = options.blob || file;
+ } else if ($.support.xhrFormDataFileUpload) {
+ if (options.postMessage) {
+ // window.postMessage does not allow sending FormData
+ // objects, so we just add the File/Blob objects to
+ // the formData array and let the postMessage window
+ // create the FormData object out of this array:
+ formData = this._getFormData(options);
+ if (options.blob) {
+ formData.push({
+ name: paramName,
+ value: options.blob
+ });
+ } else {
+ $.each(options.files, function (index, file) {
+ formData.push({
+ name: ($.type(options.paramName) === 'array' &&
+ options.paramName[index]) || paramName,
+ value: file
+ });
+ });
+ }
+ } else {
+ if (that._isInstanceOf('FormData', options.formData)) {
+ formData = options.formData;
+ } else {
+ formData = new FormData();
+ $.each(this._getFormData(options), function (index, field) {
+ formData.append(field.name, field.value);
+ });
+ }
+ if (options.blob) {
+ formData.append(paramName, options.blob, file.name);
+ } else {
+ $.each(options.files, function (index, file) {
+ // This check allows the tests to run with
+ // dummy objects:
+ if (that._isInstanceOf('File', file) ||
+ that._isInstanceOf('Blob', file)) {
+ formData.append(
+ ($.type(options.paramName) === 'array' &&
+ options.paramName[index]) || paramName,
+ file,
+ file.uploadName || file.name
+ );
+ }
+ });
+ }
+ }
+ options.data = formData;
+ }
+ // Blob reference is not needed anymore, free memory:
+ options.blob = null;
+ },
+
+ _initIframeSettings: function (options) {
+ var targetHost = $(' ').prop('href', options.url).prop('host');
+ // Setting the dataType to iframe enables the iframe transport:
+ options.dataType = 'iframe ' + (options.dataType || '');
+ // The iframe transport accepts a serialized array as form data:
+ options.formData = this._getFormData(options);
+ // Add redirect url to form data on cross-domain uploads:
+ if (options.redirect && targetHost && targetHost !== location.host) {
+ options.formData.push({
+ name: options.redirectParamName || 'redirect',
+ value: options.redirect
+ });
+ }
+ },
+
+ _initDataSettings: function (options) {
+ if (this._isXHRUpload(options)) {
+ if (!this._chunkedUpload(options, true)) {
+ if (!options.data) {
+ this._initXHRData(options);
+ }
+ this._initProgressListener(options);
+ }
+ if (options.postMessage) {
+ // Setting the dataType to postmessage enables the
+ // postMessage transport:
+ options.dataType = 'postmessage ' + (options.dataType || '');
+ }
+ } else {
+ this._initIframeSettings(options);
+ }
+ },
+
+ _getParamName: function (options) {
+ var fileInput = $(options.fileInput),
+ paramName = options.paramName;
+ if (!paramName) {
+ paramName = [];
+ fileInput.each(function () {
+ var input = $(this),
+ name = input.prop('name') || 'files[]',
+ i = (input.prop('files') || [1]).length;
+ while (i) {
+ paramName.push(name);
+ i -= 1;
+ }
+ });
+ if (!paramName.length) {
+ paramName = [fileInput.prop('name') || 'files[]'];
+ }
+ } else if (!$.isArray(paramName)) {
+ paramName = [paramName];
+ }
+ return paramName;
+ },
+
+ _initFormSettings: function (options) {
+ // Retrieve missing options from the input field and the
+ // associated form, if available:
+ if (!options.form || !options.form.length) {
+ options.form = $(options.fileInput.prop('form'));
+ // If the given file input doesn't have an associated form,
+ // use the default widget file input's form:
+ if (!options.form.length) {
+ options.form = $(this.options.fileInput.prop('form'));
+ }
+ }
+ options.paramName = this._getParamName(options);
+ if (!options.url) {
+ options.url = options.form.prop('action') || location.href;
+ }
+ // The HTTP request method must be "POST" or "PUT":
+ options.type = (options.type ||
+ ($.type(options.form.prop('method')) === 'string' &&
+ options.form.prop('method')) || ''
+ ).toUpperCase();
+ if (options.type !== 'POST' && options.type !== 'PUT' &&
+ options.type !== 'PATCH') {
+ options.type = 'POST';
+ }
+ if (!options.formAcceptCharset) {
+ options.formAcceptCharset = options.form.attr('accept-charset');
+ }
+ },
+
+ _getAJAXSettings: function (data) {
+ var options = $.extend({}, this.options, data);
+ this._initFormSettings(options);
+ this._initDataSettings(options);
+ return options;
+ },
+
+ // jQuery 1.6 doesn't provide .state(),
+ // while jQuery 1.8+ removed .isRejected() and .isResolved():
+ _getDeferredState: function (deferred) {
+ if (deferred.state) {
+ return deferred.state();
+ }
+ if (deferred.isResolved()) {
+ return 'resolved';
+ }
+ if (deferred.isRejected()) {
+ return 'rejected';
+ }
+ return 'pending';
+ },
+
+ // Maps jqXHR callbacks to the equivalent
+ // methods of the given Promise object:
+ _enhancePromise: function (promise) {
+ promise.success = promise.done;
+ promise.error = promise.fail;
+ promise.complete = promise.always;
+ return promise;
+ },
+
+ // Creates and returns a Promise object enhanced with
+ // the jqXHR methods abort, success, error and complete:
+ _getXHRPromise: function (resolveOrReject, context, args) {
+ var dfd = $.Deferred(),
+ promise = dfd.promise();
+ context = context || this.options.context || promise;
+ if (resolveOrReject === true) {
+ dfd.resolveWith(context, args);
+ } else if (resolveOrReject === false) {
+ dfd.rejectWith(context, args);
+ }
+ promise.abort = dfd.promise;
+ return this._enhancePromise(promise);
+ },
+
+ // Adds convenience methods to the data callback argument:
+ _addConvenienceMethods: function (e, data) {
+ var that = this,
+ getPromise = function (args) {
+ return $.Deferred().resolveWith(that, args).promise();
+ };
+ data.process = function (resolveFunc, rejectFunc) {
+ if (resolveFunc || rejectFunc) {
+ data._processQueue = this._processQueue =
+ (this._processQueue || getPromise([this])).pipe(
+ function () {
+ if (data.errorThrown) {
+ return $.Deferred()
+ .rejectWith(that, [data]).promise();
+ }
+ return getPromise(arguments);
+ }
+ ).pipe(resolveFunc, rejectFunc);
+ }
+ return this._processQueue || getPromise([this]);
+ };
+ data.submit = function () {
+ if (this.state() !== 'pending') {
+ data.jqXHR = this.jqXHR =
+ (that._trigger(
+ 'submit',
+ $.Event('submit', {delegatedEvent: e}),
+ this
+ ) !== false) && that._onSend(e, this);
+ }
+ return this.jqXHR || that._getXHRPromise();
+ };
+ data.abort = function () {
+ if (this.jqXHR) {
+ return this.jqXHR.abort();
+ }
+ this.errorThrown = 'abort';
+ that._trigger('fail', null, this);
+ return that._getXHRPromise(false);
+ };
+ data.state = function () {
+ if (this.jqXHR) {
+ return that._getDeferredState(this.jqXHR);
+ }
+ if (this._processQueue) {
+ return that._getDeferredState(this._processQueue);
+ }
+ };
+ data.processing = function () {
+ return !this.jqXHR && this._processQueue && that
+ ._getDeferredState(this._processQueue) === 'pending';
+ };
+ data.progress = function () {
+ return this._progress;
+ };
+ data.response = function () {
+ return this._response;
+ };
+ },
+
+ // Parses the Range header from the server response
+ // and returns the uploaded bytes:
+ _getUploadedBytes: function (jqXHR) {
+ var range = jqXHR.getResponseHeader('Range'),
+ parts = range && range.split('-'),
+ upperBytesPos = parts && parts.length > 1 &&
+ parseInt(parts[1], 10);
+ return upperBytesPos && upperBytesPos + 1;
+ },
+
+ // Uploads a file in multiple, sequential requests
+ // by splitting the file up in multiple blob chunks.
+ // If the second parameter is true, only tests if the file
+ // should be uploaded in chunks, but does not invoke any
+ // upload requests:
+ _chunkedUpload: function (options, testOnly) {
+ options.uploadedBytes = options.uploadedBytes || 0;
+ var that = this,
+ file = options.files[0],
+ fs = file.size,
+ ub = options.uploadedBytes,
+ mcs = options.maxChunkSize || fs,
+ slice = this._blobSlice,
+ dfd = $.Deferred(),
+ promise = dfd.promise(),
+ jqXHR,
+ upload;
+ if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
+ options.data) {
+ return false;
+ }
+ if (testOnly) {
+ return true;
+ }
+ if (ub >= fs) {
+ file.error = options.i18n('uploadedBytes');
+ return this._getXHRPromise(
+ false,
+ options.context,
+ [null, 'error', file.error]
+ );
+ }
+ // The chunk upload method:
+ upload = function () {
+ // Clone the options object for each chunk upload:
+ var o = $.extend({}, options),
+ currentLoaded = o._progress.loaded;
+ o.blob = slice.call(
+ file,
+ ub,
+ ub + mcs,
+ file.type
+ );
+ // Store the current chunk size, as the blob itself
+ // will be dereferenced after data processing:
+ o.chunkSize = o.blob.size;
+ // Expose the chunk bytes position range:
+ o.contentRange = 'bytes ' + ub + '-' +
+ (ub + o.chunkSize - 1) + '/' + fs;
+ // Process the upload data (the blob and potential form data):
+ that._initXHRData(o);
+ // Add progress listeners for this chunk upload:
+ that._initProgressListener(o);
+ jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
+ that._getXHRPromise(false, o.context))
+ .done(function (result, textStatus, jqXHR) {
+ ub = that._getUploadedBytes(jqXHR) ||
+ (ub + o.chunkSize);
+ // Create a progress event if no final progress event
+ // with loaded equaling total has been triggered
+ // for this chunk:
+ if (currentLoaded + o.chunkSize - o._progress.loaded) {
+ that._onProgress($.Event('progress', {
+ lengthComputable: true,
+ loaded: ub - o.uploadedBytes,
+ total: ub - o.uploadedBytes
+ }), o);
+ }
+ options.uploadedBytes = o.uploadedBytes = ub;
+ o.result = result;
+ o.textStatus = textStatus;
+ o.jqXHR = jqXHR;
+ that._trigger('chunkdone', null, o);
+ that._trigger('chunkalways', null, o);
+ if (ub < fs) {
+ // File upload not yet complete,
+ // continue with the next chunk:
+ upload();
+ } else {
+ dfd.resolveWith(
+ o.context,
+ [result, textStatus, jqXHR]
+ );
+ }
+ })
+ .fail(function (jqXHR, textStatus, errorThrown) {
+ o.jqXHR = jqXHR;
+ o.textStatus = textStatus;
+ o.errorThrown = errorThrown;
+ that._trigger('chunkfail', null, o);
+ that._trigger('chunkalways', null, o);
+ dfd.rejectWith(
+ o.context,
+ [jqXHR, textStatus, errorThrown]
+ );
+ });
+ };
+ this._enhancePromise(promise);
+ promise.abort = function () {
+ return jqXHR.abort();
+ };
+ upload();
+ return promise;
+ },
+
+ _beforeSend: function (e, data) {
+ if (this._active === 0) {
+ // the start callback is triggered when an upload starts
+ // and no other uploads are currently running,
+ // equivalent to the global ajaxStart event:
+ this._trigger('start');
+ // Set timer for global bitrate progress calculation:
+ this._bitrateTimer = new this._BitrateTimer();
+ // Reset the global progress values:
+ this._progress.loaded = this._progress.total = 0;
+ this._progress.bitrate = 0;
+ }
+ // Make sure the container objects for the .response() and
+ // .progress() methods on the data object are available
+ // and reset to their initial state:
+ this._initResponseObject(data);
+ this._initProgressObject(data);
+ data._progress.loaded = data.loaded = data.uploadedBytes || 0;
+ data._progress.total = data.total = this._getTotal(data.files) || 1;
+ data._progress.bitrate = data.bitrate = 0;
+ this._active += 1;
+ // Initialize the global progress values:
+ this._progress.loaded += data.loaded;
+ this._progress.total += data.total;
+ },
+
+ _onDone: function (result, textStatus, jqXHR, options) {
+ var total = options._progress.total,
+ response = options._response;
+ if (options._progress.loaded < total) {
+ // Create a progress event if no final progress event
+ // with loaded equaling total has been triggered:
+ this._onProgress($.Event('progress', {
+ lengthComputable: true,
+ loaded: total,
+ total: total
+ }), options);
+ }
+ response.result = options.result = result;
+ response.textStatus = options.textStatus = textStatus;
+ response.jqXHR = options.jqXHR = jqXHR;
+ this._trigger('done', null, options);
+ },
+
+ _onFail: function (jqXHR, textStatus, errorThrown, options) {
+ var response = options._response;
+ if (options.recalculateProgress) {
+ // Remove the failed (error or abort) file upload from
+ // the global progress calculation:
+ this._progress.loaded -= options._progress.loaded;
+ this._progress.total -= options._progress.total;
+ }
+ response.jqXHR = options.jqXHR = jqXHR;
+ response.textStatus = options.textStatus = textStatus;
+ response.errorThrown = options.errorThrown = errorThrown;
+ this._trigger('fail', null, options);
+ },
+
+ _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
+ // jqXHRorResult, textStatus and jqXHRorError are added to the
+ // options object via done and fail callbacks
+ this._trigger('always', null, options);
+ },
+
+ _onSend: function (e, data) {
+ if (!data.submit) {
+ this._addConvenienceMethods(e, data);
+ }
+ var that = this,
+ jqXHR,
+ aborted,
+ slot,
+ pipe,
+ options = that._getAJAXSettings(data),
+ send = function () {
+ that._sending += 1;
+ // Set timer for bitrate progress calculation:
+ options._bitrateTimer = new that._BitrateTimer();
+ jqXHR = jqXHR || (
+ ((aborted || that._trigger(
+ 'send',
+ $.Event('send', {delegatedEvent: e}),
+ options
+ ) === false) &&
+ that._getXHRPromise(false, options.context, aborted)) ||
+ that._chunkedUpload(options) || $.ajax(options)
+ ).done(function (result, textStatus, jqXHR) {
+ that._onDone(result, textStatus, jqXHR, options);
+ }).fail(function (jqXHR, textStatus, errorThrown) {
+ that._onFail(jqXHR, textStatus, errorThrown, options);
+ }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
+ that._onAlways(
+ jqXHRorResult,
+ textStatus,
+ jqXHRorError,
+ options
+ );
+ that._sending -= 1;
+ that._active -= 1;
+ if (options.limitConcurrentUploads &&
+ options.limitConcurrentUploads > that._sending) {
+ // Start the next queued upload,
+ // that has not been aborted:
+ var nextSlot = that._slots.shift();
+ while (nextSlot) {
+ if (that._getDeferredState(nextSlot) === 'pending') {
+ nextSlot.resolve();
+ break;
+ }
+ nextSlot = that._slots.shift();
+ }
+ }
+ if (that._active === 0) {
+ // The stop callback is triggered when all uploads have
+ // been completed, equivalent to the global ajaxStop event:
+ that._trigger('stop');
+ }
+ });
+ return jqXHR;
+ };
+ this._beforeSend(e, options);
+ if (this.options.sequentialUploads ||
+ (this.options.limitConcurrentUploads &&
+ this.options.limitConcurrentUploads <= this._sending)) {
+ if (this.options.limitConcurrentUploads > 1) {
+ slot = $.Deferred();
+ this._slots.push(slot);
+ pipe = slot.pipe(send);
+ } else {
+ this._sequence = this._sequence.pipe(send, send);
+ pipe = this._sequence;
+ }
+ // Return the piped Promise object, enhanced with an abort method,
+ // which is delegated to the jqXHR object of the current upload,
+ // and jqXHR callbacks mapped to the equivalent Promise methods:
+ pipe.abort = function () {
+ aborted = [undefined, 'abort', 'abort'];
+ if (!jqXHR) {
+ if (slot) {
+ slot.rejectWith(options.context, aborted);
+ }
+ return send();
+ }
+ return jqXHR.abort();
+ };
+ return this._enhancePromise(pipe);
+ }
+ return send();
+ },
+
+ _onAdd: function (e, data) {
+ var that = this,
+ result = true,
+ options = $.extend({}, this.options, data),
+ files = data.files,
+ filesLength = files.length,
+ limit = options.limitMultiFileUploads,
+ limitSize = options.limitMultiFileUploadSize,
+ overhead = options.limitMultiFileUploadSizeOverhead,
+ batchSize = 0,
+ paramName = this._getParamName(options),
+ paramNameSet,
+ paramNameSlice,
+ fileSet,
+ i,
+ j = 0;
+ if (!filesLength) {
+ return false;
+ }
+ if (limitSize && files[0].size === undefined) {
+ limitSize = undefined;
+ }
+ if (!(options.singleFileUploads || limit || limitSize) ||
+ !this._isXHRUpload(options)) {
+ fileSet = [files];
+ paramNameSet = [paramName];
+ } else if (!(options.singleFileUploads || limitSize) && limit) {
+ fileSet = [];
+ paramNameSet = [];
+ for (i = 0; i < filesLength; i += limit) {
+ fileSet.push(files.slice(i, i + limit));
+ paramNameSlice = paramName.slice(i, i + limit);
+ if (!paramNameSlice.length) {
+ paramNameSlice = paramName;
+ }
+ paramNameSet.push(paramNameSlice);
+ }
+ } else if (!options.singleFileUploads && limitSize) {
+ fileSet = [];
+ paramNameSet = [];
+ for (i = 0; i < filesLength; i = i + 1) {
+ batchSize += files[i].size + overhead;
+ if (i + 1 === filesLength ||
+ ((batchSize + files[i + 1].size + overhead) > limitSize) ||
+ (limit && i + 1 - j >= limit)) {
+ fileSet.push(files.slice(j, i + 1));
+ paramNameSlice = paramName.slice(j, i + 1);
+ if (!paramNameSlice.length) {
+ paramNameSlice = paramName;
+ }
+ paramNameSet.push(paramNameSlice);
+ j = i + 1;
+ batchSize = 0;
+ }
+ }
+ } else {
+ paramNameSet = paramName;
+ }
+ data.originalFiles = files;
+ $.each(fileSet || files, function (index, element) {
+ var newData = $.extend({}, data);
+ newData.files = fileSet ? element : [element];
+ newData.paramName = paramNameSet[index];
+ that._initResponseObject(newData);
+ that._initProgressObject(newData);
+ that._addConvenienceMethods(e, newData);
+ result = that._trigger(
+ 'add',
+ $.Event('add', {delegatedEvent: e}),
+ newData
+ );
+ return result;
+ });
+ return result;
+ },
+
+ _replaceFileInput: function (data) {
+ var input = data.fileInput,
+ inputClone = input.clone(true),
+ restoreFocus = input.is(document.activeElement);
+ // Add a reference for the new cloned file input to the data argument:
+ data.fileInputClone = inputClone;
+ $('').append(inputClone)[0].reset();
+ // Detaching allows to insert the fileInput on another form
+ // without loosing the file input value:
+ input.after(inputClone).detach();
+ // If the fileInput had focus before it was detached,
+ // restore focus to the inputClone.
+ if (restoreFocus) {
+ inputClone.focus();
+ }
+ // Avoid memory leaks with the detached file input:
+ $.cleanData(input.unbind('remove'));
+ // Replace the original file input element in the fileInput
+ // elements set with the clone, which has been copied including
+ // event handlers:
+ this.options.fileInput = this.options.fileInput.map(function (i, el) {
+ if (el === input[0]) {
+ return inputClone[0];
+ }
+ return el;
+ });
+ // If the widget has been initialized on the file input itself,
+ // override this.element with the file input clone:
+ if (input[0] === this.element[0]) {
+ this.element = inputClone;
+ }
+ },
+
+ _handleFileTreeEntry: function (entry, path) {
+ var that = this,
+ dfd = $.Deferred(),
+ errorHandler = function (e) {
+ if (e && !e.entry) {
+ e.entry = entry;
+ }
+ // Since $.when returns immediately if one
+ // Deferred is rejected, we use resolve instead.
+ // This allows valid files and invalid items
+ // to be returned together in one set:
+ dfd.resolve([e]);
+ },
+ successHandler = function (entries) {
+ that._handleFileTreeEntries(
+ entries,
+ path + entry.name + '/'
+ ).done(function (files) {
+ dfd.resolve(files);
+ }).fail(errorHandler);
+ },
+ readEntries = function () {
+ dirReader.readEntries(function (results) {
+ if (!results.length) {
+ successHandler(entries);
+ } else {
+ entries = entries.concat(results);
+ readEntries();
+ }
+ }, errorHandler);
+ },
+ dirReader, entries = [];
+ path = path || '';
+ if (entry.isFile) {
+ if (entry._file) {
+ // Workaround for Chrome bug #149735
+ entry._file.relativePath = path;
+ dfd.resolve(entry._file);
+ } else {
+ entry.file(function (file) {
+ file.relativePath = path;
+ dfd.resolve(file);
+ }, errorHandler);
+ }
+ } else if (entry.isDirectory) {
+ dirReader = entry.createReader();
+ readEntries();
+ } else {
+ // Return an empy list for file system items
+ // other than files or directories:
+ dfd.resolve([]);
+ }
+ return dfd.promise();
+ },
+
+ _handleFileTreeEntries: function (entries, path) {
+ var that = this;
+ return $.when.apply(
+ $,
+ $.map(entries, function (entry) {
+ return that._handleFileTreeEntry(entry, path);
+ })
+ ).pipe(function () {
+ return Array.prototype.concat.apply(
+ [],
+ arguments
+ );
+ });
+ },
+
+ _getDroppedFiles: function (dataTransfer) {
+ dataTransfer = dataTransfer || {};
+ var items = dataTransfer.items;
+ if (items && items.length && (items[0].webkitGetAsEntry ||
+ items[0].getAsEntry)) {
+ return this._handleFileTreeEntries(
+ $.map(items, function (item) {
+ var entry;
+ if (item.webkitGetAsEntry) {
+ entry = item.webkitGetAsEntry();
+ if (entry) {
+ // Workaround for Chrome bug #149735:
+ entry._file = item.getAsFile();
+ }
+ return entry;
+ }
+ return item.getAsEntry();
+ })
+ );
+ }
+ return $.Deferred().resolve(
+ $.makeArray(dataTransfer.files)
+ ).promise();
+ },
+
+ _getSingleFileInputFiles: function (fileInput) {
+ fileInput = $(fileInput);
+ var entries = fileInput.prop('webkitEntries') ||
+ fileInput.prop('entries'),
+ files,
+ value;
+ if (entries && entries.length) {
+ return this._handleFileTreeEntries(entries);
+ }
+ files = $.makeArray(fileInput.prop('files'));
+ if (!files.length) {
+ value = fileInput.prop('value');
+ if (!value) {
+ return $.Deferred().resolve([]).promise();
+ }
+ // If the files property is not available, the browser does not
+ // support the File API and we add a pseudo File object with
+ // the input value as name with path information removed:
+ files = [{name: value.replace(/^.*\\/, '')}];
+ } else if (files[0].name === undefined && files[0].fileName) {
+ // File normalization for Safari 4 and Firefox 3:
+ $.each(files, function (index, file) {
+ file.name = file.fileName;
+ file.size = file.fileSize;
+ });
+ }
+ return $.Deferred().resolve(files).promise();
+ },
+
+ _getFileInputFiles: function (fileInput) {
+ if (!(fileInput instanceof $) || fileInput.length === 1) {
+ return this._getSingleFileInputFiles(fileInput);
+ }
+ return $.when.apply(
+ $,
+ $.map(fileInput, this._getSingleFileInputFiles)
+ ).pipe(function () {
+ return Array.prototype.concat.apply(
+ [],
+ arguments
+ );
+ });
+ },
+
+ _onChange: function (e) {
+ var that = this,
+ data = {
+ fileInput: $(e.target),
+ form: $(e.target.form)
+ };
+ this._getFileInputFiles(data.fileInput).always(function (files) {
+ data.files = files;
+ if (that.options.replaceFileInput) {
+ that._replaceFileInput(data);
+ }
+ if (that._trigger(
+ 'change',
+ $.Event('change', {delegatedEvent: e}),
+ data
+ ) !== false) {
+ that._onAdd(e, data);
+ }
+ });
+ },
+
+ _onPaste: function (e) {
+ var items = e.originalEvent && e.originalEvent.clipboardData &&
+ e.originalEvent.clipboardData.items,
+ data = {files: []};
+ if (items && items.length) {
+ $.each(items, function (index, item) {
+ var file = item.getAsFile && item.getAsFile();
+ if (file) {
+ data.files.push(file);
+ }
+ });
+ if (this._trigger(
+ 'paste',
+ $.Event('paste', {delegatedEvent: e}),
+ data
+ ) !== false) {
+ this._onAdd(e, data);
+ }
+ }
+ },
+
+ _onDrop: function (e) {
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
+ var that = this,
+ dataTransfer = e.dataTransfer,
+ data = {};
+ if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
+ e.preventDefault();
+ this._getDroppedFiles(dataTransfer).always(function (files) {
+ data.files = files;
+ if (that._trigger(
+ 'drop',
+ $.Event('drop', {delegatedEvent: e}),
+ data
+ ) !== false) {
+ that._onAdd(e, data);
+ }
+ });
+ }
+ },
+
+ _onDragOver: getDragHandler('dragover'),
+
+ _onDragEnter: getDragHandler('dragenter'),
+
+ _onDragLeave: getDragHandler('dragleave'),
+
+ _initEventHandlers: function () {
+ if (this._isXHRUpload(this.options)) {
+ this._on(this.options.dropZone, {
+ dragover: this._onDragOver,
+ drop: this._onDrop,
+ // event.preventDefault() on dragenter is required for IE10+:
+ dragenter: this._onDragEnter,
+ // dragleave is not required, but added for completeness:
+ dragleave: this._onDragLeave
+ });
+ this._on(this.options.pasteZone, {
+ paste: this._onPaste
+ });
+ }
+ if ($.support.fileInput) {
+ this._on(this.options.fileInput, {
+ change: this._onChange
+ });
+ }
+ },
+
+ _destroyEventHandlers: function () {
+ this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
+ this._off(this.options.pasteZone, 'paste');
+ this._off(this.options.fileInput, 'change');
+ },
+
+ _setOption: function (key, value) {
+ var reinit = $.inArray(key, this._specialOptions) !== -1;
+ if (reinit) {
+ this._destroyEventHandlers();
+ }
+ this._super(key, value);
+ if (reinit) {
+ this._initSpecialOptions();
+ this._initEventHandlers();
+ }
+ },
+
+ _initSpecialOptions: function () {
+ var options = this.options;
+ if (options.fileInput === undefined) {
+ options.fileInput = this.element.is('input[type="file"]') ?
+ this.element : this.element.find('input[type="file"]');
+ } else if (!(options.fileInput instanceof $)) {
+ options.fileInput = $(options.fileInput);
+ }
+ if (!(options.dropZone instanceof $)) {
+ options.dropZone = $(options.dropZone);
+ }
+ if (!(options.pasteZone instanceof $)) {
+ options.pasteZone = $(options.pasteZone);
+ }
+ },
+
+ _getRegExp: function (str) {
+ var parts = str.split('/'),
+ modifiers = parts.pop();
+ parts.shift();
+ return new RegExp(parts.join('/'), modifiers);
+ },
+
+ _isRegExpOption: function (key, value) {
+ return key !== 'url' && $.type(value) === 'string' &&
+ /^\/.*\/[igm]{0,3}$/.test(value);
+ },
+
+ _initDataAttributes: function () {
+ var that = this,
+ options = this.options,
+ data = this.element.data();
+ // Initialize options set via HTML5 data-attributes:
+ $.each(
+ this.element[0].attributes,
+ function (index, attr) {
+ var key = attr.name.toLowerCase(),
+ value;
+ if (/^data-/.test(key)) {
+ // Convert hyphen-ated key to camelCase:
+ key = key.slice(5).replace(/-[a-z]/g, function (str) {
+ return str.charAt(1).toUpperCase();
+ });
+ value = data[key];
+ if (that._isRegExpOption(key, value)) {
+ value = that._getRegExp(value);
+ }
+ options[key] = value;
+ }
+ }
+ );
+ },
+
+ _create: function () {
+ this._initDataAttributes();
+ this._initSpecialOptions();
+ this._slots = [];
+ this._sequence = this._getXHRPromise(true);
+ this._sending = this._active = 0;
+ this._initProgressObject(this);
+ this._initEventHandlers();
+ },
+
+ // This method is exposed to the widget API and allows to query
+ // the number of active uploads:
+ active: function () {
+ return this._active;
+ },
+
+ // This method is exposed to the widget API and allows to query
+ // the widget upload progress.
+ // It returns an object with loaded, total and bitrate properties
+ // for the running uploads:
+ progress: function () {
+ return this._progress;
+ },
+
+ // This method is exposed to the widget API and allows adding files
+ // using the fileupload API. The data parameter accepts an object which
+ // must have a files property and can contain additional options:
+ // .fileupload('add', {files: filesList});
+ add: function (data) {
+ var that = this;
+ if (!data || this.options.disabled) {
+ return;
+ }
+ if (data.fileInput && !data.files) {
+ this._getFileInputFiles(data.fileInput).always(function (files) {
+ data.files = files;
+ that._onAdd(null, data);
+ });
+ } else {
+ data.files = $.makeArray(data.files);
+ this._onAdd(null, data);
+ }
+ },
+
+ // This method is exposed to the widget API and allows sending files
+ // using the fileupload API. The data parameter accepts an object which
+ // must have a files or fileInput property and can contain additional options:
+ // .fileupload('send', {files: filesList});
+ // The method returns a Promise object for the file upload call.
+ send: function (data) {
+ if (data && !this.options.disabled) {
+ if (data.fileInput && !data.files) {
+ var that = this,
+ dfd = $.Deferred(),
+ promise = dfd.promise(),
+ jqXHR,
+ aborted;
+ promise.abort = function () {
+ aborted = true;
+ if (jqXHR) {
+ return jqXHR.abort();
+ }
+ dfd.reject(null, 'abort', 'abort');
+ return promise;
+ };
+ this._getFileInputFiles(data.fileInput).always(
+ function (files) {
+ if (aborted) {
+ return;
+ }
+ if (!files.length) {
+ dfd.reject();
+ return;
+ }
+ data.files = files;
+ jqXHR = that._onSend(null, data);
+ jqXHR.then(
+ function (result, textStatus, jqXHR) {
+ dfd.resolve(result, textStatus, jqXHR);
+ },
+ function (jqXHR, textStatus, errorThrown) {
+ dfd.reject(jqXHR, textStatus, errorThrown);
+ }
+ );
+ }
+ );
+ return this._enhancePromise(promise);
+ }
+ data.files = $.makeArray(data.files);
+ if (data.files.length) {
+ return this._onSend(null, data);
+ }
+ }
+ return this._getXHRPromise(false, data && data.context);
+ }
+
+ });
+
+}));
diff --git a/common/modules/file/assets/js/jquery.iframe-transport.js b/common/modules/file/assets/js/jquery.iframe-transport.js
new file mode 100644
index 0000000..b63a16f
--- /dev/null
+++ b/common/modules/file/assets/js/jquery.iframe-transport.js
@@ -0,0 +1,217 @@
+/*
+ * jQuery Iframe Transport Plugin
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2011, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* global define, require, window, document */
+
+(function (factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'));
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+}(function ($) {
+ 'use strict';
+
+ // Helper variable to create unique names for the transport iframes:
+ var counter = 0;
+
+ // The iframe transport accepts four additional options:
+ // options.fileInput: a jQuery collection of file input fields
+ // options.paramName: the parameter name for the file form data,
+ // overrides the name property of the file input field(s),
+ // can be a string or an array of strings.
+ // options.formData: an array of objects with name and value properties,
+ // equivalent to the return data of .serializeArray(), e.g.:
+ // [{name: 'a', value: 1}, {name: 'b', value: 2}]
+ // options.initialIframeSrc: the URL of the initial iframe src,
+ // by default set to "javascript:false;"
+ $.ajaxTransport('iframe', function (options) {
+ if (options.async) {
+ // javascript:false as initial iframe src
+ // prevents warning popups on HTTPS in IE6:
+ /*jshint scripturl: true */
+ var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
+ /*jshint scripturl: false */
+ form,
+ iframe,
+ addParamChar;
+ return {
+ send: function (_, completeCallback) {
+ form = $('');
+ form.attr('accept-charset', options.formAcceptCharset);
+ addParamChar = /\?/.test(options.url) ? '&' : '?';
+ // XDomainRequest only supports GET and POST:
+ if (options.type === 'DELETE') {
+ options.url = options.url + addParamChar + '_method=DELETE';
+ options.type = 'POST';
+ } else if (options.type === 'PUT') {
+ options.url = options.url + addParamChar + '_method=PUT';
+ options.type = 'POST';
+ } else if (options.type === 'PATCH') {
+ options.url = options.url + addParamChar + '_method=PATCH';
+ options.type = 'POST';
+ }
+ // IE versions below IE8 cannot set the name property of
+ // elements that have already been added to the DOM,
+ // so we set the name along with the iframe HTML markup:
+ counter += 1;
+ iframe = $(
+ ''
+ ).bind('load', function () {
+ var fileInputClones,
+ paramNames = $.isArray(options.paramName) ?
+ options.paramName : [options.paramName];
+ iframe
+ .unbind('load')
+ .bind('load', function () {
+ var response;
+ // Wrap in a try/catch block to catch exceptions thrown
+ // when trying to access cross-domain iframe contents:
+ try {
+ response = iframe.contents();
+ // Google Chrome and Firefox do not throw an
+ // exception when calling iframe.contents() on
+ // cross-domain requests, so we unify the response:
+ if (!response.length || !response[0].firstChild) {
+ throw new Error();
+ }
+ } catch (e) {
+ response = undefined;
+ }
+ // The complete callback returns the
+ // iframe content document as response object:
+ completeCallback(
+ 200,
+ 'success',
+ {'iframe': response}
+ );
+ // Fix for IE endless progress bar activity bug
+ // (happens on form submits to iframe targets):
+ $('')
+ .appendTo(form);
+ window.setTimeout(function () {
+ // Removing the form in a setTimeout call
+ // allows Chrome's developer tools to display
+ // the response result
+ form.remove();
+ }, 0);
+ });
+ form
+ .prop('target', iframe.prop('name'))
+ .prop('action', options.url)
+ .prop('method', options.type);
+ if (options.formData) {
+ $.each(options.formData, function (index, field) {
+ $(' ')
+ .prop('name', field.name)
+ .val(field.value)
+ .appendTo(form);
+ });
+ }
+ if (options.fileInput && options.fileInput.length &&
+ options.type === 'POST') {
+ fileInputClones = options.fileInput.clone();
+ // Insert a clone for each file input field:
+ options.fileInput.after(function (index) {
+ return fileInputClones[index];
+ });
+ if (options.paramName) {
+ options.fileInput.each(function (index) {
+ $(this).prop(
+ 'name',
+ paramNames[index] || options.paramName
+ );
+ });
+ }
+ // Appending the file input fields to the hidden form
+ // removes them from their original location:
+ form
+ .append(options.fileInput)
+ .prop('enctype', 'multipart/form-data')
+ // enctype must be set as encoding for IE:
+ .prop('encoding', 'multipart/form-data');
+ // Remove the HTML5 form attribute from the input(s):
+ options.fileInput.removeAttr('form');
+ }
+ form.submit();
+ // Insert the file input fields at their original location
+ // by replacing the clones with the originals:
+ if (fileInputClones && fileInputClones.length) {
+ options.fileInput.each(function (index, input) {
+ var clone = $(fileInputClones[index]);
+ // Restore the original name and form properties:
+ $(input)
+ .prop('name', clone.prop('name'))
+ .attr('form', clone.attr('form'));
+ clone.replaceWith(input);
+ });
+ }
+ });
+ form.append(iframe).appendTo(document.body);
+ },
+ abort: function () {
+ if (iframe) {
+ // javascript:false as iframe src aborts the request
+ // and prevents warning popups on HTTPS in IE6.
+ // concat is used to avoid the "Script URL" JSLint error:
+ iframe
+ .unbind('load')
+ .prop('src', initialIframeSrc);
+ }
+ if (form) {
+ form.remove();
+ }
+ }
+ };
+ }
+ });
+
+ // The iframe transport returns the iframe content document as response.
+ // The following adds converters from iframe to text, json, html, xml
+ // and script.
+ // Please note that the Content-Type for JSON responses has to be text/plain
+ // or text/html, if the browser doesn't include application/json in the
+ // Accept header, else IE will show a download dialog.
+ // The Content-Type for XML responses on the other hand has to be always
+ // application/xml or text/xml, so IE properly parses the XML response.
+ // See also
+ // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
+ $.ajaxSetup({
+ converters: {
+ 'iframe text': function (iframe) {
+ return iframe && $(iframe[0].body).text();
+ },
+ 'iframe json': function (iframe) {
+ return iframe && $.parseJSON($(iframe[0].body).text());
+ },
+ 'iframe html': function (iframe) {
+ return iframe && $(iframe[0].body).html();
+ },
+ 'iframe xml': function (iframe) {
+ var xmlDoc = iframe && iframe[0];
+ return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
+ $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
+ $(xmlDoc.body).html());
+ },
+ 'iframe script': function (iframe) {
+ return iframe && $.globalEval($(iframe[0].body).text());
+ }
+ }
+ });
+
+}));
diff --git a/common/modules/file/assets/js/vendor/jquery.ui.widget.js b/common/modules/file/assets/js/vendor/jquery.ui.widget.js
new file mode 100644
index 0000000..113c1f0
--- /dev/null
+++ b/common/modules/file/assets/js/vendor/jquery.ui.widget.js
@@ -0,0 +1,572 @@
+/*! jQuery UI - v1.11.4+CommonJS - 2015-08-28
+* http://jqueryui.com
+* Includes: widget.js
+* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
+
+(function( factory ) {
+ if ( typeof define === "function" && define.amd ) {
+
+ // AMD. Register as an anonymous module.
+ define([ "jquery" ], factory );
+
+ } else if ( typeof exports === "object" ) {
+
+ // Node/CommonJS
+ factory( require( "jquery" ) );
+
+ } else {
+
+ // Browser globals
+ factory( jQuery );
+ }
+}(function( $ ) {
+/*!
+ * jQuery UI Widget 1.11.4
+ * http://jqueryui.com
+ *
+ * Copyright jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/jQuery.widget/
+ */
+
+
+var widget_uuid = 0,
+ widget_slice = Array.prototype.slice;
+
+$.cleanData = (function( orig ) {
+ return function( elems ) {
+ var events, elem, i;
+ for ( i = 0; (elem = elems[i]) != null; i++ ) {
+ try {
+
+ // Only trigger remove when necessary to save time
+ events = $._data( elem, "events" );
+ if ( events && events.remove ) {
+ $( elem ).triggerHandler( "remove" );
+ }
+
+ // http://bugs.jquery.com/ticket/8235
+ } catch ( e ) {}
+ }
+ orig( elems );
+ };
+})( $.cleanData );
+
+$.widget = function( name, base, prototype ) {
+ var fullName, existingConstructor, constructor, basePrototype,
+ // proxiedPrototype allows the provided prototype to remain unmodified
+ // so that it can be used as a mixin for multiple widgets (#8876)
+ proxiedPrototype = {},
+ namespace = name.split( "." )[ 0 ];
+
+ name = name.split( "." )[ 1 ];
+ fullName = namespace + "-" + name;
+
+ if ( !prototype ) {
+ prototype = base;
+ base = $.Widget;
+ }
+
+ // create selector for plugin
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+ return !!$.data( elem, fullName );
+ };
+
+ $[ namespace ] = $[ namespace ] || {};
+ existingConstructor = $[ namespace ][ name ];
+ constructor = $[ namespace ][ name ] = function( options, element ) {
+ // allow instantiation without "new" keyword
+ if ( !this._createWidget ) {
+ return new constructor( options, element );
+ }
+
+ // allow instantiation without initializing for simple inheritance
+ // must use "new" keyword (the code above always passes args)
+ if ( arguments.length ) {
+ this._createWidget( options, element );
+ }
+ };
+ // extend with the existing constructor to carry over any static properties
+ $.extend( constructor, existingConstructor, {
+ version: prototype.version,
+ // copy the object used to create the prototype in case we need to
+ // redefine the widget later
+ _proto: $.extend( {}, prototype ),
+ // track widgets that inherit from this widget in case this widget is
+ // redefined after a widget inherits from it
+ _childConstructors: []
+ });
+
+ basePrototype = new base();
+ // we need to make the options hash a property directly on the new instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
+ $.each( prototype, function( prop, value ) {
+ if ( !$.isFunction( value ) ) {
+ proxiedPrototype[ prop ] = value;
+ return;
+ }
+ proxiedPrototype[ prop ] = (function() {
+ var _super = function() {
+ return base.prototype[ prop ].apply( this, arguments );
+ },
+ _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
+ };
+ return function() {
+ var __super = this._super,
+ __superApply = this._superApply,
+ returnValue;
+
+ this._super = _super;
+ this._superApply = _superApply;
+
+ returnValue = value.apply( this, arguments );
+
+ this._super = __super;
+ this._superApply = __superApply;
+
+ return returnValue;
+ };
+ })();
+ });
+ constructor.prototype = $.widget.extend( basePrototype, {
+ // TODO: remove support for widgetEventPrefix
+ // always use the name + a colon as the prefix, e.g., draggable:start
+ // don't prefix for widgets that aren't DOM-based
+ widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
+ }, proxiedPrototype, {
+ constructor: constructor,
+ namespace: namespace,
+ widgetName: name,
+ widgetFullName: fullName
+ });
+
+ // If this widget is being redefined then we need to find all widgets that
+ // are inheriting from it and redefine all of them so that they inherit from
+ // the new version of this widget. We're essentially trying to replace one
+ // level in the prototype chain.
+ if ( existingConstructor ) {
+ $.each( existingConstructor._childConstructors, function( i, child ) {
+ var childPrototype = child.prototype;
+
+ // redefine the child widget using the same prototype that was
+ // originally used, but inherit from the new version of the base
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+ });
+ // remove the list of existing child constructors from the old constructor
+ // so the old child constructors can be garbage collected
+ delete existingConstructor._childConstructors;
+ } else {
+ base._childConstructors.push( constructor );
+ }
+
+ $.widget.bridge( name, constructor );
+
+ return constructor;
+};
+
+$.widget.extend = function( target ) {
+ var input = widget_slice.call( arguments, 1 ),
+ inputIndex = 0,
+ inputLength = input.length,
+ key,
+ value;
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
+ for ( key in input[ inputIndex ] ) {
+ value = input[ inputIndex ][ key ];
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+ // Clone objects
+ if ( $.isPlainObject( value ) ) {
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
+ $.widget.extend( {}, target[ key ], value ) :
+ // Don't extend strings, arrays, etc. with objects
+ $.widget.extend( {}, value );
+ // Copy everything else by reference
+ } else {
+ target[ key ] = value;
+ }
+ }
+ }
+ }
+ return target;
+};
+
+$.widget.bridge = function( name, object ) {
+ var fullName = object.prototype.widgetFullName || name;
+ $.fn[ name ] = function( options ) {
+ var isMethodCall = typeof options === "string",
+ args = widget_slice.call( arguments, 1 ),
+ returnValue = this;
+
+ if ( isMethodCall ) {
+ this.each(function() {
+ var methodValue,
+ instance = $.data( this, fullName );
+ if ( options === "instance" ) {
+ returnValue = instance;
+ return false;
+ }
+ if ( !instance ) {
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
+ "attempted to call method '" + options + "'" );
+ }
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+ }
+ methodValue = instance[ options ].apply( instance, args );
+ if ( methodValue !== instance && methodValue !== undefined ) {
+ returnValue = methodValue && methodValue.jquery ?
+ returnValue.pushStack( methodValue.get() ) :
+ methodValue;
+ return false;
+ }
+ });
+ } else {
+
+ // Allow multiple hashes to be passed on init
+ if ( args.length ) {
+ options = $.widget.extend.apply( null, [ options ].concat(args) );
+ }
+
+ this.each(function() {
+ var instance = $.data( this, fullName );
+ if ( instance ) {
+ instance.option( options || {} );
+ if ( instance._init ) {
+ instance._init();
+ }
+ } else {
+ $.data( this, fullName, new object( options, this ) );
+ }
+ });
+ }
+
+ return returnValue;
+ };
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+ widgetName: "widget",
+ widgetEventPrefix: "",
+ defaultElement: "",
+ options: {
+ disabled: false,
+
+ // callbacks
+ create: null
+ },
+ _createWidget: function( options, element ) {
+ element = $( element || this.defaultElement || this )[ 0 ];
+ this.element = $( element );
+ this.uuid = widget_uuid++;
+ this.eventNamespace = "." + this.widgetName + this.uuid;
+
+ this.bindings = $();
+ this.hoverable = $();
+ this.focusable = $();
+
+ if ( element !== this ) {
+ $.data( element, this.widgetFullName, this );
+ this._on( true, this.element, {
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
+ this.document = $( element.style ?
+ // element within the document
+ element.ownerDocument :
+ // element is window or document
+ element.document || element );
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+ }
+
+ this.options = $.widget.extend( {},
+ this.options,
+ this._getCreateOptions(),
+ options );
+
+ this._create();
+ this._trigger( "create", null, this._getCreateEventData() );
+ this._init();
+ },
+ _getCreateOptions: $.noop,
+ _getCreateEventData: $.noop,
+ _create: $.noop,
+ _init: $.noop,
+
+ destroy: function() {
+ this._destroy();
+ // we can probably remove the unbind calls in 2.0
+ // all event bindings should go through this._on()
+ this.element
+ .unbind( this.eventNamespace )
+ .removeData( this.widgetFullName )
+ // support: jquery <1.6.3
+ // http://bugs.jquery.com/ticket/9413
+ .removeData( $.camelCase( this.widgetFullName ) );
+ this.widget()
+ .unbind( this.eventNamespace )
+ .removeAttr( "aria-disabled" )
+ .removeClass(
+ this.widgetFullName + "-disabled " +
+ "ui-state-disabled" );
+
+ // clean up events and states
+ this.bindings.unbind( this.eventNamespace );
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ },
+ _destroy: $.noop,
+
+ widget: function() {
+ return this.element;
+ },
+
+ option: function( key, value ) {
+ var options = key,
+ parts,
+ curOption,
+ i;
+
+ if ( arguments.length === 0 ) {
+ // don't return a reference to the internal hash
+ return $.widget.extend( {}, this.options );
+ }
+
+ if ( typeof key === "string" ) {
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+ options = {};
+ parts = key.split( "." );
+ key = parts.shift();
+ if ( parts.length ) {
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+ for ( i = 0; i < parts.length - 1; i++ ) {
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+ curOption = curOption[ parts[ i ] ];
+ }
+ key = parts.pop();
+ if ( arguments.length === 1 ) {
+ return curOption[ key ] === undefined ? null : curOption[ key ];
+ }
+ curOption[ key ] = value;
+ } else {
+ if ( arguments.length === 1 ) {
+ return this.options[ key ] === undefined ? null : this.options[ key ];
+ }
+ options[ key ] = value;
+ }
+ }
+
+ this._setOptions( options );
+
+ return this;
+ },
+ _setOptions: function( options ) {
+ var key;
+
+ for ( key in options ) {
+ this._setOption( key, options[ key ] );
+ }
+
+ return this;
+ },
+ _setOption: function( key, value ) {
+ this.options[ key ] = value;
+
+ if ( key === "disabled" ) {
+ this.widget()
+ .toggleClass( this.widgetFullName + "-disabled", !!value );
+
+ // If the widget is becoming disabled, then nothing is interactive
+ if ( value ) {
+ this.hoverable.removeClass( "ui-state-hover" );
+ this.focusable.removeClass( "ui-state-focus" );
+ }
+ }
+
+ return this;
+ },
+
+ enable: function() {
+ return this._setOptions({ disabled: false });
+ },
+ disable: function() {
+ return this._setOptions({ disabled: true });
+ },
+
+ _on: function( suppressDisabledCheck, element, handlers ) {
+ var delegateElement,
+ instance = this;
+
+ // no suppressDisabledCheck flag, shuffle arguments
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
+ handlers = element;
+ element = suppressDisabledCheck;
+ suppressDisabledCheck = false;
+ }
+
+ // no element argument, shuffle and use this.element
+ if ( !handlers ) {
+ handlers = element;
+ element = this.element;
+ delegateElement = this.widget();
+ } else {
+ element = delegateElement = $( element );
+ this.bindings = this.bindings.add( element );
+ }
+
+ $.each( handlers, function( event, handler ) {
+ function handlerProxy() {
+ // allow widgets to customize the disabled handling
+ // - disabled as an array instead of boolean
+ // - disabled class as method for disabling individual parts
+ if ( !suppressDisabledCheck &&
+ ( instance.options.disabled === true ||
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
+ return;
+ }
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+
+ // copy the guid so direct unbinding works
+ if ( typeof handler !== "string" ) {
+ handlerProxy.guid = handler.guid =
+ handler.guid || handlerProxy.guid || $.guid++;
+ }
+
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
+ eventName = match[1] + instance.eventNamespace,
+ selector = match[2];
+ if ( selector ) {
+ delegateElement.delegate( selector, eventName, handlerProxy );
+ } else {
+ element.bind( eventName, handlerProxy );
+ }
+ });
+ },
+
+ _off: function( element, eventName ) {
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
+ this.eventNamespace;
+ element.unbind( eventName ).undelegate( eventName );
+
+ // Clear the stack to avoid memory leaks (#10056)
+ this.bindings = $( this.bindings.not( element ).get() );
+ this.focusable = $( this.focusable.not( element ).get() );
+ this.hoverable = $( this.hoverable.not( element ).get() );
+ },
+
+ _delay: function( handler, delay ) {
+ function handlerProxy() {
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
+ .apply( instance, arguments );
+ }
+ var instance = this;
+ return setTimeout( handlerProxy, delay || 0 );
+ },
+
+ _hoverable: function( element ) {
+ this.hoverable = this.hoverable.add( element );
+ this._on( element, {
+ mouseenter: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-hover" );
+ },
+ mouseleave: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
+ }
+ });
+ },
+
+ _focusable: function( element ) {
+ this.focusable = this.focusable.add( element );
+ this._on( element, {
+ focusin: function( event ) {
+ $( event.currentTarget ).addClass( "ui-state-focus" );
+ },
+ focusout: function( event ) {
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
+ }
+ });
+ },
+
+ _trigger: function( type, event, data ) {
+ var prop, orig,
+ callback = this.options[ type ];
+
+ data = data || {};
+ event = $.Event( event );
+ event.type = ( type === this.widgetEventPrefix ?
+ type :
+ this.widgetEventPrefix + type ).toLowerCase();
+ // the original event may come from any element
+ // so we need to reset the target on the new event
+ event.target = this.element[ 0 ];
+
+ // copy original event properties over to the new event
+ orig = event.originalEvent;
+ if ( orig ) {
+ for ( prop in orig ) {
+ if ( !( prop in event ) ) {
+ event[ prop ] = orig[ prop ];
+ }
+ }
+ }
+
+ this.element.trigger( event, data );
+ return !( $.isFunction( callback ) &&
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+ event.isDefaultPrevented() );
+ }
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+ if ( typeof options === "string" ) {
+ options = { effect: options };
+ }
+ var hasOptions,
+ effectName = !options ?
+ method :
+ options === true || typeof options === "number" ?
+ defaultEffect :
+ options.effect || defaultEffect;
+ options = options || {};
+ if ( typeof options === "number" ) {
+ options = { duration: options };
+ }
+ hasOptions = !$.isEmptyObject( options );
+ options.complete = callback;
+ if ( options.delay ) {
+ element.delay( options.delay );
+ }
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
+ element[ method ]( options );
+ } else if ( effectName !== method && element[ effectName ] ) {
+ element[ effectName ]( options.duration, options.easing, callback );
+ } else {
+ element.queue(function( next ) {
+ $( this )[ method ]();
+ if ( callback ) {
+ callback.call( element[ 0 ] );
+ }
+ next();
+ });
+ }
+ };
+});
+
+var widget = $.widget;
+
+
+
+}));
diff --git a/common/modules/file/config.php b/common/modules/file/config.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/common/modules/file/config.php
@@ -0,0 +1,3 @@
+$w){
+ return true;
+ }else if($height >$h) {
+ return true;
+ }
+ return false;
+ }
+
+
+ private function getUserPath(){
+ if(isset(Yii::$app->user->id)){
+ return 'user_'.Yii::$app->user->id;
+ }else {
+ return 'guest';
+ }
+ }
+
+ private function resizeImg($w, $h, $imageAlias,$imageAliasSave){
+ $img = Image::getImagine()->open(Yii::getAlias($imageAlias));
+
+ $size = $img->getSize();
+
+ $width = $size->getWidth();
+ $height = $size->getHeight();
+
+ $e_width = $w/$h;
+ $e_height = $h/$w;
+
+ $e1_width = $width/$height;
+ $e1_height = $height/$width;
+
+
+
+ if($e_width<$e1_width){
+
+ $new_width = $width*($e_width/$e1_width);
+
+ $y = 0;
+ $x = $width/ 2-($new_width/2);
+ $width = $new_width;
+
+ }else {
+
+ $new_height = $height*($e_height/$e1_height);
+ $x = 0;
+ $y = $height/2-($new_height/2);
+ $height = $new_height;
+ }
+
+
+
+
+ Image::crop($imageAlias, $width, $height,[$x,$y])
+ ->save(Yii::getAlias($imageAliasSave), ['quality' =>
+ 100]);
+
+
+ $imagine = new Imagine();
+ $imagine->open($imageAliasSave)
+ ->resize(new Box($w, $h))
+ ->save($imageAliasSave, array('flatten' => false));
+
+
+
+ }
+
+ private function deleteImages($old_img){
+
+ if(!empty($old_img) && file_exists($_SERVER['DOCUMENT_ROOT'].$old_img)){
+
+ $rootDir = explode("/", $old_img);
+
+ $row = $_SERVER['DOCUMENT_ROOT'].'/'.$rootDir[1].'/'.$rootDir[2].'/'.$rootDir[3].'/';
+
+ $allFiles = scandir($row);
+
+ $allFiles = array_slice($allFiles, 2);
+
+ foreach($allFiles as $oldFile){
+
+ unlink($row.$oldFile);
+
+ }
+
+ }
+ }
+
+ public function actionDeleteImage(){
+
+ $this->enableCsrfValidation = false;
+
+ $request = Yii::$app->request->post();
+
+ if($request){
+ if ($request['old_img']) {
+ $this->deleteImages($request['old_img']);
+ }
+ if(isset($request['action']) && $request['action']=='save'){
+ $object = str_replace('-', '\\',$request['model']);
+ $model = new $object;
+ $model = $model->findOne($request['id']);
+ $model->$request['field'] = $request['new_url'];
+ $model->save();
+ }
+ }
+
+ }
+
+
+ public function actionDownloadPhoto()
+ {
+
+ $model = new ImageSizerForm();
+
+ $request = Yii::$app->request->post();
+
+ if ($request) {
+
+ $model->multi = isset($request['multi'])? 1 : 0;
+
+ $model->file = UploadedFile::getInstance($model, 'file');
+
+ $md5_file = md5_file($model->file->tempName).rand(1, 1000);
+
+ $imgDir = Yii::getAlias('@storage/'.$this->getUserPath().'/'.$md5_file.'/');
+
+ $imageOrigAlias = Yii::getAlias($imgDir.'original'.'.'.$model->file->extension);
+
+ if(!is_dir($imgDir)) {
+ mkdir($imgDir, 0755, true);
+ }
+
+ $model->file->saveAs($imageOrigAlias);
+
+
+ if(isset($request['size'] )){
+
+ $request['size'] = ArrayHelper::toArray(json_decode($request['size']));
+
+ foreach($request['size'] as $size){
+ if($size['width'] && $size['height']){
+
+ $imageAlias = Yii::getAlias($imgDir.$size['width'].'x'.$size['height'].'.'.$model->file->extension);
+
+ $imageLink = '/storage/'.$this->getUserPath().'/'.$md5_file.'/'.$size['width'].'x'.$size['height'].'.'.$model->file->extension;
+
+ $this->resizeImg($size['width'], $size['height'], $imageOrigAlias,$imageAlias);
+
+ }
+ }
+
+ } else {
+
+ $imageLink = '/storage/'.$this->getUserPath().'/'.$md5_file.'/'.'original'.'.'.$model->file->extension;
+
+ }
+
+
+ if($model->multi){
+ $view = $this->renderPartial('/_gallery_item', [
+ 'item' => ['image'=>$imageLink],
+ 'field'=>$request['field']
+ ]);
+ return json_encode(['link'=>$imageLink,
+ 'view' =>$view,
+
+ ]);
+
+
+ } else {
+ $view = $this->renderPartial('/_one_item', [
+ 'item' => ['image'=>$imageLink],
+ 'field'=>$request['field']
+ ]);
+ return json_encode(['link'=>$imageLink,
+ 'view' =>$view,
+ ]);
+ }
+
+
+ }
+ }
+
+
+ public function getex($filename) {
+ return end(explode(".", $filename));
+ }
+
+
+ public function actionImagesUpload(){
+
+ if($_FILES['upload'])
+ {
+ if (($_FILES['upload'] == "none") OR (empty($_FILES['upload']['name'])) )
+ {
+ $message = "Вы не выбрали файл";
+ }
+ else if ($_FILES['upload']["size"] == 0 OR $_FILES['upload']["size"] > 2050000)
+ {
+ $message = "Размер файла не соответствует нормам";
+ }
+ else if (($_FILES['upload']["type"] != "image/jpeg") AND ($_FILES['upload']["type"] != "image/jpeg") AND ($_FILES['upload']["type"] != "image/png") AND ($_FILES['upload']['type'] != 'image/gif'))
+ {
+ $message = "Допускается загрузка только картинок JPG и PNG.";
+ }
+ else if (!is_uploaded_file($_FILES['upload']["tmp_name"]))
+ {
+ $message = "Что-то пошло не так. Попытайтесь загрузить файл ещё раз.";
+ }
+ else{
+ $name =$_FILES['upload']['name'].'.'.$this->getex($_FILES['upload']['name']);
+
+ $path = "../../storage/".$this->getUserPath()."/images/";
+ if(!is_dir($path)) {
+ mkdir($path, 0755, true);
+ }
+
+
+
+ move_uploaded_file($_FILES['upload']['tmp_name'], $path.$name);
+
+ $full_path = '/storage/'.$this->getUserPath().'/images/'.$name;
+
+ $message = "Файл ".$_FILES['upload']['name']." загружен";
+
+
+ }
+ $callback = $_REQUEST['CKEditorFuncNum'];
+ echo '';
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/common/modules/file/models/ImageSizerForm.php b/common/modules/file/models/ImageSizerForm.php
new file mode 100644
index 0000000..b891ab0
--- /dev/null
+++ b/common/modules/file/models/ImageSizerForm.php
@@ -0,0 +1,38 @@
+ 255],
+ [['model', 'form',], 'string'],
+ [['file','img','price_list'], 'file'],
+ ];
+ }
+}
\ No newline at end of file
diff --git a/common/modules/file/views/_gallery_item.php b/common/modules/file/views/_gallery_item.php
new file mode 100644
index 0000000..9aea75e
--- /dev/null
+++ b/common/modules/file/views/_gallery_item.php
@@ -0,0 +1,9 @@
+
+
+
+ = Html::img($item['image'])?>
+
+
\ No newline at end of file
diff --git a/common/modules/file/views/_one_item.php b/common/modules/file/views/_one_item.php
new file mode 100644
index 0000000..fed9ba9
--- /dev/null
+++ b/common/modules/file/views/_one_item.php
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+ = Html::a( Html::img($item['image']),'#',['class'=>'thumbnail']) ?>
+
+
+
diff --git a/common/modules/file/widgets/ImageUploader.php b/common/modules/file/widgets/ImageUploader.php
new file mode 100644
index 0000000..ec7545b
--- /dev/null
+++ b/common/modules/file/widgets/ImageUploader.php
@@ -0,0 +1,63 @@
+render('image_sizer',
+ [
+ 'model'=>$this->model,
+ 'size' => $this->size,
+ 'field' => $this->field,
+ 'height' => $this->height,
+ 'width' => $this->width,
+ 'multi' => $this->multi,
+ 'name' => $this->name,
+ 'remover' => $this->remover
+ ]);
+
+ }
+
+ public function getGallery(){
+ if($this->gallery){
+ $array = explode(",", $this->gallery);
+ if(count($array) > 1){
+ array_pop($array);
+ }
+ return $array;
+ } else {
+ return array();
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/common/modules/file/widgets/views/image_sizer.php b/common/modules/file/widgets/views/image_sizer.php
new file mode 100644
index 0000000..eb63a87
--- /dev/null
+++ b/common/modules/file/widgets/views/image_sizer.php
@@ -0,0 +1,203 @@
+tableSchema->primaryKey[0];
+
+?>
+
+
+
+
+ = Html::activeHiddenInput( $model,$field,['id' => "{$field}_picture_link"]) ?>
+
+
+
+
+
+
+
+
+
+ $field): ?>
+
+
+
+ $field):?>
+ = Html::a(Html::img($model->$field),'#',['class'=>'thumbnail']) ?>
+
+
+
+
+
+
+
+
+ =$name?>
+
+ = Html::activeFileInput( new ImageSizerForm(),'file',['id'=>$field, 'data-url'=>Yii::$app->getUrlManager()->createUrl('file/uploader/download-photo')]);?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =$name?>
+
+ = Html::activeFileInput( new ImageSizerForm(),'file',['id'=>$field, 'data-url'=>Yii::$app->getUrlManager()->createUrl('file/uploader/download-photo'), 'multiple'=> 'multiple' ]);?>
+
+
+ = Html::activeHiddenInput( $model,$field,['id' => "{$field}_picture_link"]) ?>
+
+
+
+
+
+ context->getGallery() as $image){
+ echo $this->render('@common/modules/file/views/_gallery_item', [ 'item' => ['image'=>$image]]);
+ }
+ ?>
+
+
+
+
diff --git a/common/modules/product/CatalogUrlManager.php b/common/modules/product/CatalogUrlManager.php
new file mode 100644
index 0000000..9e26006
--- /dev/null
+++ b/common/modules/product/CatalogUrlManager.php
@@ -0,0 +1,166 @@
+getPathInfo();
+ $paths = explode('/', $pathInfo);
+
+ if (!array_key_exists($paths[0], $this->route_map)) {
+ return false;
+ }
+
+ $params = [];
+ if ($paths[0] == 'catalog') {
+ $route = 'catalog/category';
+ // Category
+ if (!empty($paths[1])) {
+ $category = CategorySearch::findByAlias($paths[1]);
+ if (empty($category)) {
+ http_redirect(Url::to(['/']));
+ }
+ $params['category'] = $category;
+ }
+ if (!empty($paths[2])) {
+ // Filter
+ if (strpos($paths[2], 'filter:') === 0) {
+ $params['filter'] = [];
+ $filter_str = substr($paths[2], 7);
+ $filter_options = explode(';', $filter_str);
+ foreach ($filter_options as $filter_option) {
+ if (empty($filter_option)) {
+ continue;
+ }
+ list($filter_key, $filter_option) = explode('=', $filter_option);
+ if($filter_key == 'prices') { // price-interval section
+ $prices = explode(':', $filter_option);
+ $params['filter'][$filter_key] = [
+ 'min' => floatval($prices[0]),
+ 'max' => floatval($prices[1]),
+ ];
+ } elseif (strpos($filter_key, $this->option_prefix) === 0) { // options section
+ $params['filter']['options'][substr($filter_key, 2)] = explode(',', $filter_option);
+ } else { // brands and other sections
+ $params['filter'][$filter_key] = explode(',', $filter_option);
+ }
+
+ }
+ } elseif (strpos($paths[2], 'word:') === 0) {
+ $params['word'] = substr($paths[2], 5);
+ }
+ }
+ } elseif ($paths[0] == 'product') {
+ $product = ProductSearch::findByAlias($paths[1]);
+ if (empty($product->product_id)) {
+ throw new HttpException(404 ,'Page not found');
+ }
+ $route = 'catalog/product';
+ $params = [
+ 'product' => $product,
+ ];
+ } elseif ($paths[0] == 'brand') {
+
+ }
+
+ return [$route, $params];
+ }
+ /**
+ * Creates a URL according to the given route and parameters.
+ * @param \yii\web\UrlManager $manager the URL manager
+ * @param string $route the route. It should not have slashes at the beginning or the end.
+ * @param array $params the parameters
+ * @return string|boolean the created URL, or false if this rule cannot be used for creating this URL.
+ */
+ public function createUrl($manager, $route, $params)
+ {
+ if (!in_array($route, $this->route_map)) {
+ return false;
+ }
+
+ switch($route) {
+ case 'catalog/category':
+ if (!empty($params['category'])) {
+ $category_alias = is_object($params['category']) ? $params['category']->alias : strtolower($params['category']);
+ $url = 'catalog/'. $category_alias .'/';
+ } else {
+ $url = 'catalog/';
+ }
+
+ if (!empty($params['word'])) {
+ if (!is_array($params['word'])) {
+ $params['word'] = [$params['word']];
+ }
+ $url .= 'word:'. implode(';', $params['word']);
+ }
+
+ $filter = [];
+ if (!empty($params['filter'])) {
+ foreach ($params['filter'] as $key => $values) {
+ switch($key) {
+ case 'prices':
+ $filter[] = $key .'='. implode(':', $values);
+ break;
+
+ case 'options':
+ foreach($values as $group => &$value_items) {
+ foreach($value_items as &$value_item) {
+ $value_item = $this->option_value_encode($value_item);
+ if (empty($value_item)) {
+ unset($value_item);
+ }
+ }
+ $filter[] = $this->option_prefix. $group .'='. implode(',', $value_items);
+ }
+ break;
+
+ default:
+ foreach($values as &$value) {
+ $value = $this->option_value_encode($value);
+ if (empty($value)) {
+ unset($value);
+ }
+ }
+ $filter[] = $key .'='. implode(',', $values);
+ break;
+ }
+ }
+ $url .= 'filter:'. implode(';', $filter);
+ }
+
+ return $url;
+ break;
+
+ case 'catalog/product':
+ if (!empty($params['product'])) {
+ $product_alias = is_object($params['product']) ? $params['product']->alias : strtolower($params['product']);
+ }
+ $url = 'product/'. $product_alias;
+ return $url;
+ break;
+ }
+ }
+
+ private function option_value_encode($value) {
+ return str_replace(array(',', '/'), array('~', '&s;'), $value);
+ }
+}
\ No newline at end of file
diff --git a/common/modules/product/Module.php b/common/modules/product/Module.php
new file mode 100644
index 0000000..f48c984
--- /dev/null
+++ b/common/modules/product/Module.php
@@ -0,0 +1,24 @@
+ [
+ 'category_group' => 1,
+ 'brand_group' => 2,
+ ],
+];
\ No newline at end of file
diff --git a/common/modules/product/controllers/DefaultController.php b/common/modules/product/controllers/DefaultController.php
new file mode 100644
index 0000000..b43058a
--- /dev/null
+++ b/common/modules/product/controllers/DefaultController.php
@@ -0,0 +1,20 @@
+render('index');
+ }
+}
diff --git a/common/modules/product/controllers/ManageController.php b/common/modules/product/controllers/ManageController.php
new file mode 100644
index 0000000..ad70fa5
--- /dev/null
+++ b/common/modules/product/controllers/ManageController.php
@@ -0,0 +1,191 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ public function actionTest() {
+ return;
+ foreach(Product::find()->all() as $product) {
+ if (!$product->variant) {
+ $product->save();
+ $variantModel = new ProductVariant();
+ $variantModel->product_id = $product->product_id;
+ $variantModel->name = 'test-'. uniqid();
+ $variantModel->sku = $variantModel->name;
+ $variantModel->price = rand(5, 200000);
+ $variantModel->price_old = rand(0, 5) > 3 ? $variantModel->price* (1+rand(0, 10) / 10) : $variantModel->price;
+ $variantModel->product_unit_id = rand(1, 5);
+ $variantModel->stock = rand(0, 50);
+ $variantModel->save();
+ }
+ }
+
+ return;
+
+ $categories = Category::find()->where(['depth' => 2])->all();
+ $cats_ids = [];
+ foreach($categories as $cat) {
+ $cats_ids[] = $cat->category_id;
+ }
+
+ $brands = ProductHelper::getBrands()->all();
+ $brands_ids = [];
+ foreach($brands as $brand) {
+ $brands_ids[] = $brand->brand_id;
+ }
+
+ for($i=1;$i<=1000;$i++) {
+ $uniqid = uniqid();
+ $model = new Product();
+ $model->name = 'Test '. $uniqid;
+ $model->brand_id = $brands_ids[array_rand($brands_ids, 1)];
+ $model->categories = [$cats_ids[array_rand($cats_ids, 1)]];
+ $model->save();
+
+ $variantModel = new ProductVariant();
+ $variantModel->product_id = $model->product_id;
+ $variantModel->name = 'test-'. $uniqid;
+ $variantModel->sku = $variantModel->name;
+ $variantModel->price = rand(5, 200000);
+ $variantModel->price_old = rand(0, 5) > 3 ? $variantModel->price* (1+rand(0, 10) / 10) : $variantModel->price;
+ $variantModel->product_unit_id = rand(1, 5);
+ $variantModel->save();
+ }
+ }
+
+ /**
+ * Lists all Product models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new ProductSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Product model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Product model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Product();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->product_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Product model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->product_id]);
+ } else {
+ $groups = $model->category->getTaxGroups();
+
+ return $this->render('update', [
+ 'model' => $model,
+ 'groups' => $groups,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Product model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ public function actionImport() {
+ $searchModel = new RemoteProductsSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('remote-products', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Finds the Product model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Product the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Product::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/common/modules/product/helpers/ProductHelper.php b/common/modules/product/helpers/ProductHelper.php
new file mode 100644
index 0000000..500cc09
--- /dev/null
+++ b/common/modules/product/helpers/ProductHelper.php
@@ -0,0 +1,76 @@
+with('categoryName')->getTree();
+ }
+
+ public static function getBrands() {
+ return Brand::find()->with('brandName');
+ }
+
+ /*
+ * Return custom filter-option link
+ * @var array $filter
+ * @var array $options
+ * @return array
+ */
+ public static function getFilterForOption($filter, $key, $value, $remove = false) {
+ $result = $filter;
+ if (is_array($value)) {
+ foreach($value as $value_key => $value_items) {
+ if (!is_array($value_items)) {
+ $value_items = [$value_items];
+ }
+ foreach($value_items as $value_item) {
+ if ($remove && isset($result[$key]) && ($i = array_search($value_item, $result[$key][$value_key])) !== FALSE) {
+ unset($result[$key][$value_key][$i]);
+ if (empty($result[$key][$value_key])) {
+ unset($result[$key][$value_key]);
+ }
+ } else {
+ if (!isset($result[$key][$value_key]) || array_search($value_item, $result[$key][$value_key]) === FALSE) {
+ $result[$key][$value_key][] = $value_item;
+ }
+ }
+ }
+ }
+ } else {
+ if ($remove && isset($result[$key]) && ($i = array_search($value, $result[$key])) !== FALSE) {
+ unset($result[$key][$i]);
+ if (empty($result[$key])) {
+ unset($result[$key]);
+ }
+ } else {
+ if (!isset($result[$key]) || array_search($value, $result[$key]) === FALSE) {
+ $result[$key][] = $value;
+ }
+ }
+ }
+ return $result;
+ }
+
+ public static function addLastProsucts($product_id) {
+ $last_products = self::getLastProducts();
+ if (!in_array($product_id, $last_products)) {
+ $last_products[] = $product_id;
+ Yii::$app->session->set('last_products', $last_products);
+ }
+ }
+
+ public static function getLastProducts($as_object = false) {
+ $last_products = Yii::$app->session->get('last_products', []);
+ if ($as_object) {
+ $last_products = Product::find()->where(['product_id' => $last_products])->all();
+ }
+ return $last_products;
+ }
+}
\ No newline at end of file
diff --git a/common/modules/product/models/Brand.php b/common/modules/product/models/Brand.php
new file mode 100644
index 0000000..79cb1e4
--- /dev/null
+++ b/common/modules/product/models/Brand.php
@@ -0,0 +1,116 @@
+ [
+ 'class' => ArtboxSynonymBehavior::className(),
+ 'keyNameValue' => 'brand_name_id',
+ 'valueModel' => BrandName::className(),
+ 'valueOptionId' => 'brand_id',
+ 'valueFields' => [ // postKey => DBFieldName
+ 'name' => 'value'
+ ],
+ 'slug' => [
+ 'valueKeyName' => 'value',
+ 'slugKeyName' => 'alias',
+ 'translit' => true
+ ]
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tableName()
+ {
+ return 'brand';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['name'], 'string'],
+ [['brand_name_id'], 'integer'],
+ [['meta_desc', 'seo_text'], 'string'],
+ [['alias', 'name'], 'string', 'max' => 250],
+ [['image', 'meta_title'], 'string', 'max' => 255],
+ [['meta_robots'], 'string', 'max' => 50],
+// [['brand_name_id'], 'exist', 'skipOnError' => true, 'targetClass' => BrandName::className(), 'targetAttribute' => ['brand_name_id' => 'brand_name_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'name' => Yii::t('product', 'Name of the brand'),
+ 'brand_id' => Yii::t('product', 'Brand ID'),
+ 'brand_name_id' => Yii::t('product', 'Brand Name ID'),
+ 'alias' => Yii::t('product', 'Alias'),
+ 'image' => Yii::t('product', 'Image'),
+ 'meta_title' => Yii::t('product', 'Meta Title'),
+ 'meta_desc' => Yii::t('product', 'Meta Desc'),
+ 'meta_robots' => Yii::t('product', 'Meta Robots'),
+ 'seo_text' => Yii::t('product', 'Seo Text'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getBrandName()
+ {
+ return $this->hasOne(BrandName::className(), ['brand_name_id' => 'brand_name_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getBrandNames()
+ {
+ return $this->hasMany(BrandName::className(), ['brand_id' => 'brand_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProducts()
+ {
+ return $this->hasMany(Product::className(), ['brand_id' => 'brand_id']);
+ }
+
+ public function getName() {
+ return empty($this->brand_name_id) ? null : $this->brandName->value;
+ }
+}
diff --git a/common/modules/product/models/BrandName.php b/common/modules/product/models/BrandName.php
new file mode 100644
index 0000000..a495c95
--- /dev/null
+++ b/common/modules/product/models/BrandName.php
@@ -0,0 +1,66 @@
+ 250],
+// [['brand_id'], 'exist', 'skipOnError' => true, 'targetClass' => Brand::className(), 'targetAttribute' => ['brand_id' => 'brand_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'brand_name_id' => Yii::t('product', 'Brand Name ID'),
+ 'brand_id' => Yii::t('product', 'Brand ID'),
+ 'value' => Yii::t('product', 'Value'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getBrands()
+ {
+ return $this->hasMany(Brand::className(), ['brand_name_id' => 'brand_name_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getBrand()
+ {
+ return $this->hasOne(Brand::className(), ['brand_id' => 'brand_id']);
+ }
+}
diff --git a/common/modules/product/models/BrandQuery.php b/common/modules/product/models/BrandQuery.php
new file mode 100644
index 0000000..2ea4e87
--- /dev/null
+++ b/common/modules/product/models/BrandQuery.php
@@ -0,0 +1,45 @@
+andWhere('[[status]]=1');
+ }*/
+
+ /**
+ * @inheritdoc
+ * @return Brand[]|array
+ */
+ public function all($db = null)
+ {
+ return parent::all($db);
+ }
+
+ /**
+ * @inheritdoc
+ * @return Brand|array|null
+ */
+ public function one($db = null)
+ {
+ return parent::one($db);
+ }
+
+ /**
+ * Select brand by alias
+ * @param $slug
+ * @return $this
+ */
+ public function byAlias($alias)
+ {
+ $this->andFilterWhere(['alias' => $alias]);
+ return $this;
+ }
+}
diff --git a/common/modules/product/models/BrandSearch.php b/common/modules/product/models/BrandSearch.php
new file mode 100644
index 0000000..31cbb24
--- /dev/null
+++ b/common/modules/product/models/BrandSearch.php
@@ -0,0 +1,113 @@
+with('brandName');
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params);
+
+ /*if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }*/
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'brand_id' => $this->brand_id,
+ 'brand_name_id' => $this->brand_name_id,
+ ]);
+
+ $query->andFilterWhere(['like', 'alias', $this->alias])
+ ->andFilterWhere(['like', 'image', $this->image])
+ ->andFilterWhere(['like', 'meta_title', $this->meta_title])
+ ->andFilterWhere(['like', 'meta_desc', $this->meta_desc])
+ ->andFilterWhere(['like', 'meta_robots', $this->meta_robots])
+ ->andFilterWhere(['like', 'seo_text', $this->seo_text]);
+
+ return $dataProvider;
+ }
+
+ public function getBrands($category = null, $params = []) {
+ $query = Brand::find()
+ ->select([
+ Brand::tableName() .'.*',
+ 'COUNT('. ProductCategory::tableName() .'.product_id) AS _items_count'
+ ])
+ ->innerJoin(Product::tableName(), Product::tableName() .'.brand_id='. Brand::tableName() .'.brand_id')
+ ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() .'.product_id='. Product::tableName() .'.product_id')
+
+ ->with('brandName');
+ if (!empty($category)) {
+ $query->where([
+ ProductCategory::tableName() .'.category_id' => $category->category_id
+ ]);
+ }
+ $query->groupBy(Brand::tableName() .'.brand_id');
+ if (isset($params['options'])) {
+ unset($params['options']);
+ }
+ if (!empty($params['prices'])) {
+ if ($params['prices']['min'] > 0 || $params['prices']['max'] > 0) {
+ $query->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id='. Product::tableName() .'.product_id');
+ }
+ if ($params['prices']['min'] > 0) {
+ $query->andWhere(['>=', ProductVariant::tableName() .'.price', $params['prices']['min']]);
+ }
+ if ($params['prices']['max'] > 0) {
+ $query->andWhere(['<=', ProductVariant::tableName() .'.price', $params['prices']['max']]);
+ }
+ }
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php
new file mode 100644
index 0000000..0cb4b3f
--- /dev/null
+++ b/common/modules/product/models/Category.php
@@ -0,0 +1,181 @@
+ [
+ 'class' => ArtboxTreeBehavior::className(),
+ 'keyNameGroup' => null,
+ 'keyNamePath' => 'path',
+ ],
+ 'artboxsynonym' => [
+ 'class' => ArtboxSynonymBehavior::className(),
+ 'keyNameValue' => 'category_name_id',
+ 'valueModel' => CategoryName::className(),
+ 'valueOptionId' => 'category_id',
+ 'valueFields' => [ // postKey => DBFieldName
+ 'name' => 'value'
+ ],
+ 'slug' => [
+ 'valueKeyName' => 'value',
+ 'slugKeyName' => 'alias',
+ 'translit' => true
+ ]
+ ],
+ [
+ 'class' => relationBehavior::className(),
+ 'relations' => [
+ 'product_categories' => 'entity2', // Products of category
+ 'tax_group_to_category' => 'entity2',
+ ]
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tableName()
+ {
+ return 'category';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['name'], 'string'],
+ [['parent_id', 'depth', 'category_name_id', 'product_unit_id'], 'integer'],
+ [['path', 'meta_desc', 'seo_text'], 'string'],
+ [['meta_title'], 'string', 'max' => 255],
+ [['meta_robots'], 'string', 'max' => 50],
+ [['alias', 'name'], 'string', 'max' => 250],
+ [['populary'], 'boolean'],
+ [['group_to_category', 'remote_category'], 'safe'],
+ [['category_name_id'], 'exist', 'skipOnError' => true, 'targetClass' => CategoryName::className(), 'targetAttribute' => ['category_name_id' => 'category_name_id']],
+ // [['image'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif'],
+// [['product_unit_id'], 'exist', 'skipOnError' => true, 'targetClass' => ProductUnit::className(), 'targetAttribute' => ['product_unit_id' => 'product_unit_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'category_id' => Yii::t('product', 'Category ID'),
+ 'parent_id' => Yii::t('product', 'Parent ID'),
+ 'path' => Yii::t('product', 'Path'),
+ 'depth' => Yii::t('product', 'Depth'),
+ 'image' => Yii::t('product', 'Image'),
+ 'meta_title' => Yii::t('product', 'Meta Title'),
+ 'meta_desc' => Yii::t('product', 'Meta Desc'),
+ 'meta_robots' => Yii::t('product', 'Meta Robots'),
+ 'seo_text' => Yii::t('product', 'Seo Text'),
+ 'product_unit_id' => Yii::t('product', 'Product Unit ID'),
+ 'alias' => Yii::t('product', 'Alias'),
+ 'populary' => Yii::t('product', 'Populary'),
+ 'name' => Yii::t('product', 'Name'),
+ 'remote_id' => Yii::t('product', 'Remote ID'),
+ ];
+ }
+
+ public static function find() {
+ return new CategoryQuery(get_called_class());
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProductUnit()
+ {
+ return $this->hasOne(ProductUnit::className(), ['product_unit_id' => 'product_unit_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategoryNames()
+ {
+ return $this->hasMany(CategoryName::className(), ['category_id' => 'category_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProductCategories()
+ {
+ return $this->hasMany(ProductCategory::className(), ['category_id' => 'category_id']);
+ }
+
+ public function getTaxGroups() {
+ return $this->getRelations('tax_group_to_category');
+ }
+
+ public function getRemote_category() {
+ return ArtboxTreeHelper::getArrayField($this->remote_id);
+ }
+
+ public function setRemote_category($value) {
+ if (!empty($value) && is_array($value)) {
+ $this->remote_id = ArtboxTreeHelper::setArrayField($value, false);
+ }
+ }
+
+ public function getCategoryName() {
+ return $this->hasOne(CategoryName::className(), ['category_name_id' => 'category_name_id']);
+ }
+
+ public function getName() {
+ return empty($this->categoryName) ? null : $this->categoryName->value;
+ }
+
+ public function beforeSave($insert)
+ {
+ if (parent::beforeSave($insert)) {
+
+ if (empty($this->parent_id))
+ $this->parent_id = 0;
+
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/common/modules/product/models/CategoryName.php b/common/modules/product/models/CategoryName.php
new file mode 100644
index 0000000..e55331e
--- /dev/null
+++ b/common/modules/product/models/CategoryName.php
@@ -0,0 +1,66 @@
+ 250],
+ [['category_id'], 'exist', 'skipOnError' => true, 'targetClass' => Category::className(), 'targetAttribute' => ['category_id' => 'category_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'category_name_id' => Yii::t('product', 'Category Name ID'),
+ 'category_id' => Yii::t('product', 'Category ID'),
+ 'value' => Yii::t('product', 'Value'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategories()
+ {
+ return $this->hasMany(Category::className(), ['category_name_id' => 'category_name_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategory()
+ {
+ return $this->hasOne(Category::className(), ['category_id' => 'category_id']);
+ }
+}
diff --git a/common/modules/product/models/CategoryQuery.php b/common/modules/product/models/CategoryQuery.php
new file mode 100644
index 0000000..8d92bef
--- /dev/null
+++ b/common/modules/product/models/CategoryQuery.php
@@ -0,0 +1,37 @@
+andWhere('[[status]]=1');
+ }*/
+
+ /**
+ * @inheritdoc
+ * @return Category[]|array
+ */
+ public function all($db = null)
+ {
+ return parent::all($db);
+ }
+
+ /**
+ * @inheritdoc
+ * @return Category|array|null
+ */
+ public function one($db = null)
+ {
+ return parent::one($db);
+ }
+}
diff --git a/common/modules/product/models/CategorySearch.php b/common/modules/product/models/CategorySearch.php
new file mode 100644
index 0000000..8a3f2dd
--- /dev/null
+++ b/common/modules/product/models/CategorySearch.php
@@ -0,0 +1,116 @@
+with('categoryName');
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params);
+
+ /*if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }*/
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'category_id' => $this->category_id,
+ 'parent_id' => $this->parent_id,
+ 'category_name_id' => $this->category_name_id,
+ 'product_unit_id' => $this->product_unit_id,
+ ]);
+
+ $query->andFilterWhere(['like', 'alias', $this->alias]);
+
+ $query->orderBy(['path' => SORT_ASC, 'depth' => SORT_ASC]);
+
+ return $dataProvider;
+ }
+
+ public static function findByAlias($alias) {
+ /** @var CategoryQuery $query */
+ $query = Category::find()
+ ->with('categoryName')
+ ->andFilterWhere(['alias' => $alias]);
+ if (($model = $query->one()) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+
+ public static function findByRemoteID($id) {
+ /** @var CategoryQuery $query */
+ $query = Category::find()
+ ->with('categoryName')
+ ->andFilterWhere(['@>', 'remote_id', ArtboxTreeHelper::setArrayField($id)]);
+ if (($model = $query->one()) !== null) {
+ return $model;
+ }
+ return null;
+ }
+
+// public static function findByProductsKeywords($keywords = [], $category = null) {
+//
+// }
+}
diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php
new file mode 100644
index 0000000..ba99ca2
--- /dev/null
+++ b/common/modules/product/models/Product.php
@@ -0,0 +1,217 @@
+ relationBehavior::className(),
+ 'relations' => [
+ 'product_categories' => 'entity1', // Product category
+ 'product_option' => 'entity1' // Product category
+ ]
+ ],
+ [
+ 'class' => Slug::className(),
+ 'in_attribute' => 'name',
+ 'out_attribute' => 'alias',
+ 'translit' => true
+ ]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tableName()
+ {
+ return '{{%product}}';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['brand_id'], 'integer'],
+ [['name'], 'string', 'max' => 150],
+ [['alias'], 'string', 'max' => 250],
+ [['categories', 'variants', 'options'], 'safe'],
+// [['imagesUpload'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif'],
+ [['description', 'video'], 'safe'],
+// [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_id' => Yii::t('product', 'ID'),
+ 'name' => Yii::t('product', 'Name'),
+ 'brand_id' => Yii::t('product', 'Brand'),
+ 'categories' => Yii::t('product', 'Categories'), // relation behavior field
+ 'category' => Yii::t('product', 'Category'), // relation behavior field
+ 'image' => Yii::t('product', 'Image'),
+ 'images' => Yii::t('product', 'Images'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getBrand()
+ {
+ return $this->hasOne(Brand::className(), ['brand_id' => 'brand_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getImage()
+ {
+ return $this->hasOne(ProductImage::className(), ['product_id' => 'product_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getImages()
+ {
+ return $this->hasMany(ProductImage::className(), ['product_id' => 'product_id']);
+ }
+
+ public function setImages($images) {
+ $this->_images = $images;
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getVariant()
+ {
+ return $this->hasOne(ProductVariant::className(), ['product_id' => 'product_id']);
+ }
+
+ public function getVariantPrice() {
+ return $this->variant->price;
+ }
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getVariants()
+ {
+ return $this->hasMany(ProductVariant::className(), ['product_id' => 'product_id']);
+ }
+
+ public function setVariants($variants) {
+ $this->_variants = $variants;
+ }
+
+ public function getFullName()
+ {
+ return empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name;
+ }
+
+ public function getCategories() {
+ return $this->getRelations('product_categories');
+ }
+
+ public function getCategoriesNames() {
+ $result = [];
+ foreach($this->categories as $category) {
+ $result[] = $category->name;
+ }
+ return $result;
+ }
+
+ public function getCategory() {
+ /** @var ActiveQuery $categories */
+ $categories = $this->getRelations('product_categories');
+ $count = $categories->count();
+ if ($count == 0)
+ return;
+ return $categories->one();
+ }
+
+ public function getOptions() {
+ return $this->getRelations('product_option');
+ }
+
+ /**
+ * @inheritdoc
+ * @return ProductQuery the active query used by this AR class.
+ */
+ public static function find()
+ {
+ return new ProductQuery(get_called_class());
+ }
+
+ public function afterSave($insert, $changedAttributes)
+ {
+ parent::afterSave($insert, $changedAttributes);
+
+// foreach($this->imagesUpload as $image) {
+// $image->saveAs('/images/items/' . $image->baseName .'_'. uniqid() . '.' . $image->extension);
+// }
+
+ $todel = [];
+ foreach ($this->variants ? : [] as $_variant) {
+ $todel[$_variant->product_variant_id] = $_variant->product_variant_id;
+ }
+ foreach ($this->_variants as $_variant) {
+ if (!is_array($_variant)) {
+ return;
+ }
+ if (!empty($_variant['product_variant_id'])) {
+ unset($todel[$_variant['product_variant_id']]);
+ $model = ProductVariant::findOne($_variant['product_variant_id']);
+ } else {
+ $model = new ProductVariant();
+ }
+ $_variant['product_id'] = $this->product_id;
+ $model->load(['ProductVariant' => $_variant]);
+ $model->save();
+ }
+ if (!empty($todel)) {
+ ProductVariant::deleteAll(['product_variant_id' => $todel]);
+ }
+ }
+}
diff --git a/common/modules/product/models/ProductCategory.php b/common/modules/product/models/ProductCategory.php
new file mode 100644
index 0000000..f4d9727
--- /dev/null
+++ b/common/modules/product/models/ProductCategory.php
@@ -0,0 +1,59 @@
+ true, 'targetClass' => Category::className(), 'targetAttribute' => ['category_id' => 'category_id']],
+ [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_id' => Yii::t('product', 'Product'),
+ 'category_id' => Yii::t('product', 'Category'),
+ ];
+ }
+
+ public function getProduct() {
+ return $this->getEntity1();
+ }
+
+ public function getCategory() {
+ return $this->getEntity2();
+ }
+}
diff --git a/common/modules/product/models/ProductImage.php b/common/modules/product/models/ProductImage.php
new file mode 100644
index 0000000..51eaf86
--- /dev/null
+++ b/common/modules/product/models/ProductImage.php
@@ -0,0 +1,148 @@
+ 255],
+ [['image'], 'safe'],
+ [['product_variant_id'], 'exist', 'skipOnError' => true, 'targetClass' => ProductVariant::className(), 'targetAttribute' => ['product_variant_id' => 'product_variant_id']],
+ [['image'], 'file', 'extensions'=>'jpg, gif, png'],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_image_id' => Yii::t('product', 'Product Image ID'),
+ 'product_variant_id' => Yii::t('product', 'Product Variant ID'),
+ 'image' => Yii::t('product', 'Image'),
+ 'alt' => Yii::t('product', 'Alt'),
+ 'title' => Yii::t('product', 'Title'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProductVariant()
+ {
+ return $this->hasOne(ProductVariant::className(), ['product_variant_id' => 'product_variant_id']);
+ }
+
+ /**
+ * @inheritdoc
+ * @return ProductImageQuery the active query used by this AR class.
+ */
+ public static function find()
+ {
+ return new ProductImageQuery(get_called_class());
+ }
+
+ /**
+ * fetch stored image file name with complete path
+ * @return string
+ */
+ public function getImageFile()
+ {
+ return isset($this->image) ? Yii::$app->params['uploadPath'] . $this->image : null;
+ }
+
+ /**
+ * fetch stored image url
+ * @return string
+ */
+ public function getImageUrl()
+ {
+ // return a default image placeholder if your source image is not found
+ $image = isset($this->image) ? $this->image : 'default.jpg';
+ return Yii::$app->params['uploadUrl'] . $image;
+ }
+
+ /**
+ * Process upload of image
+ *
+ * @return mixed the uploaded image instance
+ */
+ public function uploadImage() {
+ // get the uploaded file instance. for multiple file uploads
+ // the following data will return an array (you may need to use
+ // getInstances method)
+ $image = UploadedFile::getInstance($this, 'image');
+
+ // if no image was uploaded abort the upload
+ if (empty($image)) {
+ return false;
+ }
+
+ // store the source file name
+ $this->filename = $image->name;
+ $exploded = explode(".", $image->name);
+ $ext = end($exploded);
+
+ // generate a unique file name
+ $this->image = Yii::$app->security->generateRandomString().".{$ext}";
+
+ // the uploaded image instance
+ return $image;
+ }
+
+ /**
+ * Process deletion of image
+ *
+ * @return boolean the status of deletion
+ */
+ public function deleteImage() {
+ $file = $this->getImageFile();
+
+ // check if file exists on server
+ if (empty($file) || !file_exists($file)) {
+ return false;
+ }
+
+ // check if uploaded file can be deleted on server
+ if (!unlink($file)) {
+ return false;
+ }
+
+ // if deletion successful, reset your file attributes
+ $this->image = null;
+ $this->filename = null;
+
+ return true;
+ }
+}
diff --git a/common/modules/product/models/ProductImageQuery.php b/common/modules/product/models/ProductImageQuery.php
new file mode 100644
index 0000000..5f98a0b
--- /dev/null
+++ b/common/modules/product/models/ProductImageQuery.php
@@ -0,0 +1,34 @@
+andWhere('[[status]]=1');
+ }*/
+
+ /**
+ * @inheritdoc
+ * @return ProductImage[]|array
+ */
+ public function all($db = null)
+ {
+ return parent::all($db);
+ }
+
+ /**
+ * @inheritdoc
+ * @return ProductImage|array|null
+ */
+ public function one($db = null)
+ {
+ return parent::one($db);
+ }
+}
diff --git a/common/modules/product/models/ProductOption.php b/common/modules/product/models/ProductOption.php
new file mode 100644
index 0000000..de5d49f
--- /dev/null
+++ b/common/modules/product/models/ProductOption.php
@@ -0,0 +1,65 @@
+ true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']],
+ [['option_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['option_id' => 'tax_option_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_id' => Yii::t('product', 'Product ID'),
+ 'option_id' => Yii::t('product', 'Option ID'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProduct()
+ {
+ return $this->hasOne(Product::className(), ['product_id' => 'product_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getOption()
+ {
+ return $this->hasOne(TaxOption::className(), ['tax_option_id' => 'option_id']);
+ }
+}
diff --git a/common/modules/product/models/ProductQuery.php b/common/modules/product/models/ProductQuery.php
new file mode 100644
index 0000000..b5cf18c
--- /dev/null
+++ b/common/modules/product/models/ProductQuery.php
@@ -0,0 +1,45 @@
+andWhere('[[status]]=1');
+ }*/
+
+ /**
+ * @inheritdoc
+ * @return Product[]|array
+ */
+ public function all($db = null)
+ {
+ return parent::all($db);
+ }
+
+ /**
+ * @inheritdoc
+ * @return Product|array|null
+ */
+ public function one($db = null)
+ {
+ return parent::one($db);
+ }
+
+ /**
+ * Select category by alias
+ * @param $slug
+ * @return $this
+ */
+ public function byAlias($alias)
+ {
+ $this->andFilterWhere(['alias' => $alias]);
+ return $this;
+ }
+}
diff --git a/common/modules/product/models/ProductSearch.php b/common/modules/product/models/ProductSearch.php
new file mode 100644
index 0000000..921d059
--- /dev/null
+++ b/common/modules/product/models/ProductSearch.php
@@ -0,0 +1,92 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'tax_brand_id' => $this->tax_brand_id,
+ 'product_id' => $this->product_id,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name]);
+
+ return $dataProvider;
+ }
+
+ public static function findByAlias($alias) {
+ /** @var ProductQuery $query */
+ $query = Product::find();
+ $query->byAlias($alias);
+ if (($model = $query->one()) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested product does not exist.');
+ }
+ }
+
+ public static function findByRemoteID($id) {
+ /** @var CategoryQuery $query */
+ $query = Product::find()
+ ->andFilterWhere(['remote_id' => $id]);
+ if (($model = $query->one()) !== null) {
+ return $model;
+ }
+ return null;
+ }
+}
diff --git a/common/modules/product/models/ProductUnit.php b/common/modules/product/models/ProductUnit.php
new file mode 100644
index 0000000..f6dbe42
--- /dev/null
+++ b/common/modules/product/models/ProductUnit.php
@@ -0,0 +1,69 @@
+ 255],
+ [['code'], 'string', 'max' => 50],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_unit_id' => Yii::t('product', 'Product Unit ID'),
+ 'name' => Yii::t('product', 'Name'),
+ 'code' => Yii::t('product', 'Code'),
+ 'is_default' => Yii::t('product', 'Is Default'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategories()
+ {
+ return $this->hasMany(Category::className(), ['product_unit_id' => 'product_unit_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProductVariants()
+ {
+ return $this->hasMany(ProductVariant::className(), ['product_unit_id' => 'product_unit_id']);
+ }
+}
diff --git a/common/modules/product/models/ProductVariant.php b/common/modules/product/models/ProductVariant.php
new file mode 100644
index 0000000..f6836b8
--- /dev/null
+++ b/common/modules/product/models/ProductVariant.php
@@ -0,0 +1,112 @@
+ 255],
+ [['remote_id'], 'string', 'max' => 20],
+ [['product_unit_id'], 'exist', 'skipOnError' => true, 'targetClass' => ProductUnit::className(), 'targetAttribute' => ['product_unit_id' => 'product_unit_id']],
+ [['product_variant_type_id'], 'exist', 'skipOnError' => true, 'targetClass' => ProductVariantType::className(), 'targetAttribute' => ['product_variant_type_id' => 'product_variant_type_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_variant_id' => Yii::t('product', 'Product Variant ID'),
+ 'product_id' => Yii::t('product', 'Product ID'),
+ 'name' => Yii::t('product', 'Name'),
+ 'sku' => Yii::t('product', 'Sku'),
+ 'price' => Yii::t('product', 'Price'),
+ 'price_old' => Yii::t('product', 'Price Old'),
+ 'stock' => Yii::t('product', 'Stock'),
+ 'product_unit_id' => Yii::t('product', 'Unit'),
+ 'product_variant_type_id' => 'Type of the variant',
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProductUnit()
+ {
+ return $this->hasOne(ProductUnit::className(), ['product_unit_id' => 'product_unit_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProduct()
+ {
+ return $this->hasOne(Product::className(), ['product_id' => 'product_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getProductVariantType() {
+ return $this->hasOne(ProductVariantType::className(), ['product_variant_type_id' => 'product_variant_type_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getImages() {
+ return $this->hasMany(ProductImage::className(), ['product_variant_id' => 'product_variant_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getImage() {
+ return $this->hasOne(ProductImage::className(), ['product_variant_id' => 'product_variant_id']);
+ }
+
+ /**
+ * @inheritdoc
+ * @return ProductVariantQuery the active query used by this AR class.
+ */
+ public static function find()
+ {
+ return new ProductVariantQuery(get_called_class());
+ }
+}
diff --git a/common/modules/product/models/ProductVariantQuery.php b/common/modules/product/models/ProductVariantQuery.php
new file mode 100644
index 0000000..011164c
--- /dev/null
+++ b/common/modules/product/models/ProductVariantQuery.php
@@ -0,0 +1,34 @@
+andWhere('[[status]]=1');
+ }*/
+
+ /**
+ * @inheritdoc
+ * @return ProductVariant[]|array
+ */
+ public function all($db = null)
+ {
+ return parent::all($db);
+ }
+
+ /**
+ * @inheritdoc
+ * @return ProductVariant|array|null
+ */
+ public function one($db = null)
+ {
+ return parent::one($db);
+ }
+}
diff --git a/common/modules/product/models/ProductVariantSearch.php b/common/modules/product/models/ProductVariantSearch.php
new file mode 100644
index 0000000..98badc9
--- /dev/null
+++ b/common/modules/product/models/ProductVariantSearch.php
@@ -0,0 +1,91 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'product_variant_id' => $this->product_variant_id,
+ 'product_id' => $this->product_id,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'sku', $this->sku]);
+
+ return $dataProvider;
+ }
+
+ public static function findBySku($sku) {
+ /** @var ProductQuery $query */
+ $query = ProductVariant::find()
+ ->andFilterWhere(['sku' => $sku]);
+ if (($model = $query->one()) !== null) {
+ return $model;
+ }
+ return;
+ }
+
+ public static function findByRemoteID($id) {
+ /** @var CategoryQuery $query */
+ $query = ProductVariant::find()
+ ->andFilterWhere(['remote_id' => $id]);
+ if (($model = $query->one()) !== null) {
+ return $model;
+ }
+ return;
+ }
+}
diff --git a/common/modules/product/models/ProductVariantType.php b/common/modules/product/models/ProductVariantType.php
new file mode 100644
index 0000000..1dcb7d5
--- /dev/null
+++ b/common/modules/product/models/ProductVariantType.php
@@ -0,0 +1,43 @@
+ 50],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'product_variant_type_id' => 'Product Variant Type ID',
+ 'name' => 'Name',
+ ];
+ }
+}
diff --git a/common/modules/product/models/RemoteCategories.php b/common/modules/product/models/RemoteCategories.php
new file mode 100644
index 0000000..b9b6ae2
--- /dev/null
+++ b/common/modules/product/models/RemoteCategories.php
@@ -0,0 +1,63 @@
+ 100],
+ [['ID_chief', 'ID'], 'string', 'max' => 20],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'Name' => Yii::t('product', 'Name'),
+ 'ID_chief' => Yii::t('product', 'Id Chief'),
+ 'ID' => Yii::t('product', 'ID'),
+ ];
+ }
+
+ public function getCategory() {
+ if (empty($this->ID)) {
+ return null;
+ }
+ return CategorySearch::findByRemoteID($this->ID);
+ }
+
+ public static function findByID($id) {
+ /** @var CategoryQuery $query */
+ $query = RemoteCategories::find()
+ ->andFilterWhere(['ID' => $id]);
+ if (($model = $query->one()) !== null) {
+ return $model;
+ }
+ return null;
+ }
+}
diff --git a/common/modules/product/models/RemoteCategoriesSearch.php b/common/modules/product/models/RemoteCategoriesSearch.php
new file mode 100644
index 0000000..6cdc2b3
--- /dev/null
+++ b/common/modules/product/models/RemoteCategoriesSearch.php
@@ -0,0 +1,71 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'local_id' => $this->local_id,
+ ]);
+
+ $query->andFilterWhere(['like', 'Name', $this->Name])
+ ->andFilterWhere(['like', 'ID_chief', $this->ID_chief])
+ ->andFilterWhere(['like', 'ID', $this->ID]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/modules/product/models/RemoteProducts.php b/common/modules/product/models/RemoteProducts.php
new file mode 100644
index 0000000..981f933
--- /dev/null
+++ b/common/modules/product/models/RemoteProducts.php
@@ -0,0 +1,77 @@
+ 100],
+ [['ID_chief', 'Article', 'ID'], 'string', 'max' => 20],
+ [['Brand'], 'string', 'max' => 25],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'Name' => Yii::t('product', 'Name'),
+ 'Price' => Yii::t('product', 'Price'),
+ 'Price_old' => Yii::t('product', 'Price Old'),
+ 'ID_chief' => Yii::t('product', 'Id Chief'),
+ 'Article' => Yii::t('product', 'Article'),
+ 'Brand' => Yii::t('product', 'Brand'),
+ 'ID' => Yii::t('product', 'ID'),
+ 'Date_create' => Yii::t('product', 'Date Create'),
+ 'local_id' => Yii::t('product', 'Local ID'),
+ ];
+ }
+
+ public function getRemoteCategory() {
+ if (empty($this->ID_chief)) {
+ return null;
+ }
+ return RemoteCategories::findByID($this->ID_chief);
+ }
+
+ public function getProduct() {
+ if (empty($this->ID)) {
+ return null;
+ }
+ return ProductVariantSearch::findByRemoteID($this->ID);
+ }
+}
diff --git a/common/modules/product/models/RemoteProductsSearch.php b/common/modules/product/models/RemoteProductsSearch.php
new file mode 100644
index 0000000..7766eab
--- /dev/null
+++ b/common/modules/product/models/RemoteProductsSearch.php
@@ -0,0 +1,77 @@
+ $query,
+ ]);
+
+ $this->load($params);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'Price' => $this->Price,
+ 'Price_old' => $this->Price_old,
+ 'Date_create' => $this->Date_create,
+ 'local_id' => $this->local_id,
+ ]);
+
+ $query->andFilterWhere(['like', 'Name', $this->Name])
+ ->andFilterWhere(['like', 'ID_chief', $this->ID_chief])
+ ->andFilterWhere(['like', 'Article', $this->Article])
+ ->andFilterWhere(['like', 'Brand', $this->Brand])
+ ->andFilterWhere(['like', 'ID', $this->ID]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/modules/product/views/default/index.php b/common/modules/product/views/default/index.php
new file mode 100644
index 0000000..3913fe0
--- /dev/null
+++ b/common/modules/product/views/default/index.php
@@ -0,0 +1,12 @@
+
+
= $this->context->action->uniqueId ?>
+
+ This is the view content for action "= $this->context->action->id ?>".
+ The action belongs to the controller "= get_class($this->context) ?>"
+ in the "= $this->context->module->id ?>" module.
+
+
+ You may customize this page by editing the following file:
+ = __FILE__ ?>
+
+
diff --git a/common/modules/product/views/manage/_form.php b/common/modules/product/views/manage/_form.php
new file mode 100644
index 0000000..1baa2d3
--- /dev/null
+++ b/common/modules/product/views/manage/_form.php
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+ = $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'description')->widget(\mihaildev\ckeditor\CKEditor::className(),['editorOptions' => [ 'preset' => 'full', 'inline' => false, ], ]); ?>
+ = $form->field($model, 'video')->textarea()->label('Video embeded'); ?>
+
+ = $form->field($model, 'brand_id')->dropDownList(
+ ArrayHelper::map(ProductHelper::getBrands()->all(), 'brand_id', 'name'),
+ [
+ 'prompt' => Yii::t('product', 'Select brand')
+ ]
+ ) ?>
+
+ = $form->field($model, 'categories')->widget(Select2::className(), [
+ 'data' => ArtboxTreeHelper::treeMap(ProductHelper::getCategories(), 'category_id', 'name'),
+ 'language' => 'ru',
+ 'options' => [
+ 'placeholder' => 'Select a state ...',
+ 'multiple' => true,
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true
+ ],
+ ]
+ ) ?>
+
+
+
+ field($model, 'imagesUpload[]')->widget(FileInput::classname(), [
+ 'options' => [
+ 'accept' => 'image/*',
+ 'multiple' => true,
+ ],
+ ]);*/?>
+
+ = $form->field($model, 'variants')->widget(MultipleInput::className(), [
+ 'columns' => [
+ [
+ 'name' => 'product_variant_id',
+ 'type' => MultipleInputColumn::TYPE_HIDDEN_INPUT,
+ ],
+ [
+ 'name' => 'name',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'Name',
+ ],
+ [
+ 'name' => 'sku',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'SKU',
+ ],
+ [
+ 'name' => 'price',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'Price',
+ ],
+ [
+ 'name' => 'price_old',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'Old Price',
+ ],
+ [
+ 'name' => 'product_unit_id',
+ 'type' => MultipleInputColumn::TYPE_DROPDOWN,
+ 'title' => 'Unit',
+ 'items' => ArrayHelper::map(\common\modules\product\models\ProductUnit::find()->all(), 'product_unit_id', 'name'),
+ ],
+ [
+ 'name' => 'stock',
+ 'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
+ 'title' => 'Stock',
+ 'options' => [
+ 'placeholder' => '∞'
+ ],
+ ],
+ ],
+ ]);
+ ?>
+
+
+ all() as $group) :?>
+ = $form->field($model, 'options')->checkboxList(
+ ArrayHelper::map($group->options, 'tax_option_id', 'ValueRenderFlash'),
+ [
+ 'multiple' => true,
+ 'unselect' => null,
+ ]
+ )->label($group->name);?>
+
+
+
+
+ = Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+
+
+
+
+
diff --git a/common/modules/product/views/manage/_search.php b/common/modules/product/views/manage/_search.php
new file mode 100644
index 0000000..f021b65
--- /dev/null
+++ b/common/modules/product/views/manage/_search.php
@@ -0,0 +1,31 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'brand_id') ?>
+
+ = $form->field($model, 'product_id') ?>
+
+
+ = Html::submitButton(Yii::t('product', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('product', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/common/modules/product/views/manage/create.php b/common/modules/product/views/manage/create.php
new file mode 100644
index 0000000..36f73c2
--- /dev/null
+++ b/common/modules/product/views/manage/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('product', 'Create Product');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Products'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/common/modules/product/views/manage/index.php b/common/modules/product/views/manage/index.php
new file mode 100644
index 0000000..3b7b0f2
--- /dev/null
+++ b/common/modules/product/views/manage/index.php
@@ -0,0 +1,33 @@
+title = Yii::t('product', 'Products');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('product', 'Create Product'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ 'product_id',
+ 'name',
+ 'brand.name',
+ 'category.name',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/common/modules/product/views/manage/remote-products.php b/common/modules/product/views/manage/remote-products.php
new file mode 100644
index 0000000..0d94965
--- /dev/null
+++ b/common/modules/product/views/manage/remote-products.php
@@ -0,0 +1,42 @@
+title = Yii::t('product', 'Remote Products');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('product', 'Import selected'), ['import'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'Name',
+ 'ID_chief',
+ 'Article',
+ 'Price',
+ 'Price_old',
+ 'Brand',
+ 'ID',
+ 'Date_create',
+ 'remoteCategory.category.name',
+ 'remoteCategory.Name',
+ // 'local_id',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/common/modules/product/views/manage/update.php b/common/modules/product/views/manage/update.php
new file mode 100644
index 0000000..b4b80a5
--- /dev/null
+++ b/common/modules/product/views/manage/update.php
@@ -0,0 +1,24 @@
+title = Yii::t('product', 'Update {modelClass}: ', [
+ 'modelClass' => 'Product',
+]) . ' ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Products'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->product_id]];
+$this->params['breadcrumbs'][] = Yii::t('product', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'groups' => $groups,
+ ]) ?>
+
+
diff --git a/common/modules/product/views/manage/view.php b/common/modules/product/views/manage/view.php
new file mode 100644
index 0000000..858ff57
--- /dev/null
+++ b/common/modules/product/views/manage/view.php
@@ -0,0 +1,39 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('product', 'Products'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('product', 'Update'), ['update', 'id' => $model->product_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('product', 'Delete'), ['delete', 'id' => $model->product_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'product_id',
+ 'name',
+ 'fullname',
+ 'brand.name',
+ 'category.name',
+ ],
+ ]) ?>
+
+
diff --git a/common/modules/product/widgets/brandsCarouselWidget.php b/common/modules/product/widgets/brandsCarouselWidget.php
new file mode 100644
index 0000000..d907530
--- /dev/null
+++ b/common/modules/product/widgets/brandsCarouselWidget.php
@@ -0,0 +1,21 @@
+with('brandName')->all();
+ return $this->render('brandsCarousel', [
+ 'brands' => $brands,
+ ]);
+ }
+}
\ No newline at end of file
diff --git a/common/modules/product/widgets/catalogSubmenuWidget.php b/common/modules/product/widgets/catalogSubmenuWidget.php
new file mode 100644
index 0000000..ef9388f
--- /dev/null
+++ b/common/modules/product/widgets/catalogSubmenuWidget.php
@@ -0,0 +1,36 @@
+root_id);
+
+ $categories = $rootCategory->getAllChildren(2, [], 'categoryName')->all();
+ $populary = [];
+ foreach($categories as $category) {
+ if ($category->populary) {
+ $populary[] = $category;
+ }
+ }
+
+ return $this->render('submenu', [
+ 'rootCategory' => $rootCategory,
+ 'rootClass' => $this->rootClass,
+ 'populary' => $populary,
+ 'items' => $rootCategory->buildTree($categories, $rootCategory->category_id)
+ ]);
+ }
+}
\ No newline at end of file
diff --git a/common/modules/product/widgets/views/brandsCarousel.php b/common/modules/product/widgets/views/brandsCarousel.php
new file mode 100644
index 0000000..d2e97f4
--- /dev/null
+++ b/common/modules/product/widgets/views/brandsCarousel.php
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/modules/product/widgets/views/submenu.php b/common/modules/product/widgets/views/submenu.php
new file mode 100644
index 0000000..edee86a
--- /dev/null
+++ b/common/modules/product/widgets/views/submenu.php
@@ -0,0 +1,50 @@
+
diff --git a/common/modules/relation/Module.php b/common/modules/relation/Module.php
new file mode 100644
index 0000000..f7cac20
--- /dev/null
+++ b/common/modules/relation/Module.php
@@ -0,0 +1,40 @@
+render('index');
+ }
+}
diff --git a/common/modules/relation/controllers/ManageController.php b/common/modules/relation/controllers/ManageController.php
new file mode 100644
index 0000000..49242a1
--- /dev/null
+++ b/common/modules/relation/controllers/ManageController.php
@@ -0,0 +1,238 @@
+ [
+ 'class' => ContentNegotiator::className(),
+ 'only' => ['autocomplete'],
+ 'formats' => [ 'application/json' => Response::FORMAT_JSON],
+ 'languages' => [
+ 'ru',
+ ],
+ ],*/
+ ];
+ }
+
+ /**
+ * Renders the relations view
+ * @return string
+ */
+ public function actionIndex()
+ {
+ $relations = relationHelper::getRelations();
+ $list = [];
+ foreach ($relations as $key => $relation) {
+ $list[] = [
+ 'key' => $key,
+ 'name' => $relation['name'],
+ 'entity1_label' => $relation['entity1']['label'],
+ 'entity1_model' => $relation['entity1']['model'],
+ 'entity2_label' => $relation['entity2']['label'],
+ 'entity2_model' => $relation['entity2']['model'],
+ ];
+ }
+ return $this->render('relations', [
+ 'relations' => $list
+ ]);
+ }
+ /**
+ * Renders the pars view for
+ * @return string
+ */
+ public function actionPars($relation)
+ {
+ $relation_key = strtolower($relation);
+ $relation = relationHelper::getRelation($relation_key);
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $relation['via']['model']::find(),
+ ]);
+
+ return $this->render('pars', [
+ 'dataProvider' => $dataProvider,
+ 'relation_key' => $relation_key,
+ 'relation' => $relation,
+ ]);
+ }
+
+ public function actionCreate($relation) {
+ $relation_key = strtolower($relation);
+ $relation = relationHelper::getRelation($relation_key);
+
+ $model = new $relation['via']['model'];
+
+ if ($model->load(Yii::$app->request->post())) {
+ $model->save();
+ return $this->redirect(['pars', 'relation' => $relation_key]);
+// return $this->redirect(['update', 'id' => $model->{$relation['entity1']['linked_key']}. ':' .$model->{$relation['entity2']['linked_key']}]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+// 'items1' => $query1->limit(100)->all(),
+// 'items2' => $query2->asArray()->all(),
+ 'relation_key' => $relation_key,
+ 'relation' => $relation,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing TaxGroup model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($relation, $id) {
+ $relation_key = strtolower($relation);
+ $relation = relationHelper::getRelation($relation_key);
+
+ list($id1, $id2) = explode(':', $id);
+
+ $model = $this->findModel($relation_key, $id1, $id2);
+
+ if ($model->load(Yii::$app->request->post())) {
+ $connection = Yii::$app->getDb();
+ $transaction = $connection->beginTransaction();
+ try {
+ // Delete links from viaTable
+ $connection->createCommand()
+ ->update
+ (
+ $relation['linked_table'],
+ [
+ $relation['entity1']['linked_key'] => $model->getAttribute($relation['entity1']['linked_key']),
+ $relation['entity2']['linked_key'] => $model->getAttribute($relation['entity2']['linked_key'])
+ ],
+ $this->getWhere($relation_key, $id1, $id2)
+ )
+ ->execute();
+ $transaction->commit();
+ } catch (Exception $ex) {
+ $transaction->rollback();
+ throw $ex;
+ }
+
+ return $this->redirect(['pars', 'relation' => $relation_key]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ 'value1' => $model->entity1->getAttribute($relation['entity1']['listField']),
+ 'value2' => $model->entity2->getAttribute($relation['entity2']['listField']),
+ 'relation_key' => $relation_key,
+ 'relation' => $relation,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing TaxGroup model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($relation, $id)
+ {
+ $relation_key = strtolower($relation);
+ $relation = relationHelper::getRelation($relation_key);
+
+ list($id1, $id2) = explode(':', $id);
+
+ $connection = Yii::$app->getDb();
+ $transaction = $connection->beginTransaction();
+ try {
+ // Delete links from viaTable
+ $connection->createCommand()
+ ->delete
+ (
+ $relation['linked_table'],
+ $this->getWhere($relation_key, $id1, $id2)
+ )
+ ->execute();
+ $transaction->commit();
+ } catch (Exception $ex) {
+ $transaction->rollback();
+ throw $ex;
+ }
+
+ return $this->redirect(['pars', 'relation' => $relation_key]);
+ }
+
+ public function actionAutocomplete() {
+ $relation_key = Yii::$app->request->get('relation_key');
+ $entity = Yii::$app->request->get('entity');
+ $term = Yii::$app->request->get('term');
+ $relation_key = strtolower($relation_key);
+ $relation = relationHelper::getRelation($relation_key);
+
+ /** @var ActiveQuery $query */
+ $query = $relation[$entity]['model']::find();
+
+ if (!empty($relation[$entity]['searchJoin'])) {
+ $query->innerJoinWith($relation[$entity]['searchJoin']);
+ }
+ if (!empty($relation[$entity]['where'])) {
+ $query->where($relation[$entity]['where']);
+ }
+ $query->where(['ilike', $relation[$entity]['searchField'], $term]);
+
+ print json_encode(ArrayHelper::map($query->limit(50)->all(), $relation[$entity]['key'], $relation[$entity]['listField']));
+ exit;
+ }
+
+ /**
+ * Finds the based model for relation on its primaries keys value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param string $relation
+ * @param integer $id1
+ * @param integer $id2
+ * @return ActiveRecord the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($relation, $id1, $id2)
+ {
+ $relation_key = strtolower($relation);
+ $relation = relationHelper::getRelation($relation_key);
+ if (($model = $relation['via']['model']::findOne($this->getWhere($relation_key, $id1, $id2))) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+
+ protected function getWhere($relation_key, $id1, $id2) {
+ $relation = relationHelper::getRelation($relation_key);
+ // @todo Just think - if you need to search keys in the reverse order
+ $where = [
+ $relation['entity1']['linked_key'] => $id1,
+ $relation['entity2']['linked_key'] => $id2,
+ ];
+ if (!empty($relation['alias'])) {
+ $where[$relation['alias']] = $relation_key;
+ }
+ return $where;
+ }
+
+}
diff --git a/common/modules/relation/models/Relation.php b/common/modules/relation/models/Relation.php
new file mode 100644
index 0000000..a7fe4df
--- /dev/null
+++ b/common/modules/relation/models/Relation.php
@@ -0,0 +1,78 @@
+ 50]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'alias' => Yii::t('relation', 'Alias'),
+ 'entity1_id' => Yii::t('relation', 'Entity1 ID'),
+ 'entity2_id' => Yii::t('relation', 'Entity2 ID'),
+ 'entity1' => Yii::t('relation', 'Entity1 ID'),
+ 'entity2' => Yii::t('relation', 'Entity2 ID'),
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ * @return RelationQuery the active query used by this AR class.
+ */
+ public static function find()
+ {
+ return new RelationQuery(get_called_class());
+ }
+
+ public function getRelationSection() {
+ return relationHelper::getRelation($this->alias);
+ }
+
+ public function getEntity1() {
+ return $this->getEntity('entity1');
+ }
+
+ public function getEntity2() {
+ return $this->getEntity('entity2');
+ }
+
+ protected function getEntity($entity) {
+ $relation = $this->getRelationSection();
+ if (!$relation)
+ return;
+ return $this->hasOne($relation[$entity]['model']::className(), [$relation[$entity]['key'] => $relation[$entity]['linked_key']]);
+ }
+}
diff --git a/common/modules/relation/models/RelationQuery.php b/common/modules/relation/models/RelationQuery.php
new file mode 100644
index 0000000..7948f50
--- /dev/null
+++ b/common/modules/relation/models/RelationQuery.php
@@ -0,0 +1,35 @@
+andWhere('[[status]]=1');
+ return $this;
+ }*/
+
+ /**
+ * @inheritdoc
+ * @return Relation[]|array
+ */
+ public function all($db = null)
+ {
+ return parent::all($db);
+ }
+
+ /**
+ * @inheritdoc
+ * @return Relation|array|null
+ */
+ public function one($db = null)
+ {
+ return parent::one($db);
+ }
+}
\ No newline at end of file
diff --git a/common/modules/relation/relationBehavior.php b/common/modules/relation/relationBehavior.php
new file mode 100644
index 0000000..66df8e9
--- /dev/null
+++ b/common/modules/relation/relationBehavior.php
@@ -0,0 +1,239 @@
+relations as $relation_key => &$relation) {
+ if (is_string($relation)) {
+ // Get data from module's data
+ $relation_entity = $relation;
+ $relation = $this->_getRelationParams($relation_key);
+ $relation['inner'] = $relation[$relation_entity];
+ $relation['outer'] = $relation[$relation_entity == 'entity1' ? 'entity2' : 'entity1'];
+ $relation['linked_table'] = $relation['via']['model']::tableName();
+ if (!empty($relation['via']['alias'])) {
+ $relation['linked_alias'] = $relation['via']['alias'];
+ }
+ }
+ $this->fields[$relation['field']] = $relation_key;
+ }
+ }
+
+ /*
+ * Events for auto-drive relations data
+ */
+ public function events()
+ {
+ return [
+ ActiveRecord::EVENT_AFTER_INSERT => 'relationsAfterSave',
+ ActiveRecord::EVENT_AFTER_UPDATE => 'relationsAfterSave',
+ ActiveRecord::EVENT_BEFORE_DELETE => 'relationBeforeDelete',
+ ];
+ }
+
+ public function relationsAfterSave($insert) {
+ if (is_array($modelPrimaryKey = $this->owner->getPrimaryKey())) {
+ throw new ErrorException('This behavior does not support composite primary keys');
+ }
+
+ foreach ($this->relations as $relation_key => $relation) {
+ if (empty($relation['field']) || !is_array($this->{$relation['field']}))
+ continue;
+
+ $values = $this->{$relation['field']};
+
+ /** @var ActiveRecord $model */
+ $model = new $relation['inner']['model'];
+
+ $connection = $model::getDb();
+ $transaction = $connection->beginTransaction();
+
+ $delete_where = [$relation['inner']['linked_key'] => $this->owner->{$relation['inner']['key']}];
+ if (!empty($relation['linked_alias'])) {
+ $delete_where[$relation['linked_alias']] = $relation_key;
+ }
+
+ try {
+ // Delete all links from viaTable
+ $connection->createCommand()
+ ->delete
+ (
+ $relation['linked_table'],
+ $delete_where
+ )
+ ->execute();
+
+ if (!empty($values)) {
+ foreach($values as $value) {
+ $insertData = [
+ $relation['inner']['linked_key'] => $this->owner->{$relation['inner']['key']},
+ $relation['outer']['linked_key'] => $value
+ ];
+ if (!empty($relation['linked_alias'])) {
+ $insertData[$relation['linked_alias']] = $relation_key;
+ }
+
+
+ $connection->createCommand()
+ ->insert
+ (
+ $relation['linked_table'],
+ $insertData
+ )
+ ->execute();
+ }
+ }
+ $transaction->commit();
+
+// $model->link($relation_key, )
+ } catch (Exception $ex) {
+// var_dump($relation_key, $relation);exit;
+ $transaction->rollback();
+ throw $ex;
+ }
+ }
+ }
+
+ public function relationBeforeDelete() {
+ if (is_array($modelPrimaryKey = $this->owner->getPrimaryKey())) {
+ throw new ErrorException('This behavior does not support composite primary keys');
+ }
+ foreach ($this->relations as $relation_key => $relation) {
+ if (empty($relation['field']))
+ continue;
+ $values = $this->{$relation['field']};
+
+ /** @var ActiveRecord $model */
+ $model = new $relation['inner']['model'];
+
+ $connection = $model::getDb();
+ $transaction = $connection->beginTransaction();
+
+ // @todo Refix to ActiveRecord format
+ try {
+ // Delete all links from viaTable
+ $connection->createCommand()
+ ->delete
+ (
+ $relation['linked_table'],
+ [$relation['inner']['linked_key'] => $this->owner->{$relation['inner']['key']}]
+ )
+ ->execute();
+ $transaction->commit();
+ } catch (Exception $ex) {
+ $transaction->rollback();
+ throw $ex;
+ }
+ }
+ }
+
+ /**
+ * Get related data for $relation
+ * @params string $relation Relation key
+ */
+ public function getRelations($relation) {
+ $relation = $this->_getRelation($relation);
+ return
+ $this->owner
+ ->hasMany($relation['outer']['model'], [$relation['outer']['key'] => $relation['outer']['linked_key']])
+ ->viaTable($relation['linked_table'], [$relation['inner']['linked_key'] => $relation['inner']['key']]);
+ }
+
+ /*
+ * Get relation params for $relation
+ * @param string $relation Relation key
+ */
+ protected function _getRelation($relation) {
+ $relation = strtolower($relation);
+ return isset($this->relations[$relation]) ? $this->relations[$relation] : null;
+ }
+
+ /**
+ * Return relation data from main app config
+ * @params string $section Relations key
+ */
+ protected function _getRelationParams($section) {
+ $relation = relationHelper::getRelation($section);
+ if (!$relation)
+ throw new Exception('Relation "' . $section . '" not set on this application.');
+ return $relation;
+ }
+
+ protected function _getRelationNameByField($field) {
+ return isset($this->fields[$field]) ? $this->fields[$field] : null;
+ }
+
+ protected function _getRelationByField($field) {
+ return ( isset($this->fields[$field]) && isset($this->relations[$this->fields[$field]]) ) ? $this->relations[$this->fields[$field]] : null;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function canGetProperty($name, $checkVars = true)
+ {
+ return true;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function canSetProperty($name, $checkVars = true)
+ {
+ return array_key_exists($name, $this->fields) ?
+ true : parent::canSetProperty($name, $checkVars = true);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function __set($name, $value) {
+ if (isset($this->fields[$name])) {
+ $this->values[$name] = $value;
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function __get($name) {
+ if (isset($this->values[$name])) {
+ return $this->values[$name];
+ } else {
+ $relation_key = $this->_getRelationNameByField($name);
+ if (!$relation_key)
+ return;
+
+ return $this->getRelations($relation_key);
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/modules/relation/relationHelper.php b/common/modules/relation/relationHelper.php
new file mode 100644
index 0000000..f90cfab
--- /dev/null
+++ b/common/modules/relation/relationHelper.php
@@ -0,0 +1,60 @@
+getModule('relation');
+
+ if (!is_array($module->relations))
+ return [];
+
+ return $module->relations;
+ }
+
+ /**
+ * Return one relation for key $name
+ * @param string $name
+ * @return string (@todo refix to relationOject)
+ */
+ public static function getRelation($name) {
+ $name = strtolower($name);
+ if (isset(self::$relations[$name])) {
+ return self::$relations[$name];
+ }
+ $relations = self::getRelations();
+ if (isset($relations[$name])) {
+ self::$relations[$name] = self::prepareRelation($relations[$name]);
+ } else {
+ self::$relations[$name] = null;
+ }
+ return self::$relations[$name];
+ }
+
+
+ private static function prepareRelation($relation) {
+ if (!isset($relation['linked_table']) && isset($relation['via']['model'])) {
+ $relation['linked_table'] = $relation['via']['model']::tableName();
+ }
+ return $relation;
+ }
+
+ /**
+ * @param string $name
+ * @return bool
+ */
+ public static function issetRelation($name) {
+ $relations = self::getRelations();
+ return isset($relations[$name]);
+ }
+}
\ No newline at end of file
diff --git a/common/modules/relation/relationObject.php b/common/modules/relation/relationObject.php
new file mode 100644
index 0000000..ae04cb8
--- /dev/null
+++ b/common/modules/relation/relationObject.php
@@ -0,0 +1,29 @@
+_getRelationParams($relation_key);
+ $relation['inner'] = $relation[$relation_entity];
+ $relation['outer'] = $relation[$relation_entity == 'entity1' ? 'entity2' : 'entity1'];
+ $relation['linked_table'] = $relation['via']['model']::tableName();
+ }
+
+ $this->moduleRelations = relationHelper::getRelations();
+
+
+ }
+}
\ No newline at end of file
diff --git a/common/modules/relation/relationQueryTrait.php b/common/modules/relation/relationQueryTrait.php
new file mode 100644
index 0000000..27a0354
--- /dev/null
+++ b/common/modules/relation/relationQueryTrait.php
@@ -0,0 +1,33 @@
+modelClass;
+ self::$model = new $class;
+ }
+ return self::$model;
+ }
+
+ /*public function getRelations($relation) {
+ $model = $this->getModel();
+
+ $relation = $model->_getRelation($relation);
+ return
+ $model->owner
+ ->hasMany($relation['outer']['model'], [$relation['outer']['key'] => $relation['outer']['linked_key']])
+ ->viaTable($relation['linked_table'], [$relation['inner']['linked_key'] => $relation['inner']['key']]);
+ }*/
+}
\ No newline at end of file
diff --git a/common/modules/relation/views/default/index.php b/common/modules/relation/views/default/index.php
new file mode 100644
index 0000000..dc021a6
--- /dev/null
+++ b/common/modules/relation/views/default/index.php
@@ -0,0 +1,12 @@
+
+
= $this->context->action->uniqueId ?>
+
+ This is the view content for action "= $this->context->action->id ?>".
+ The action belongs to the controller "= get_class($this->context) ?>"
+ in the "= $this->context->module->id ?>" module.
+
+
+ You may customize this page by editing the following file:
+ = __FILE__ ?>
+
+
diff --git a/common/modules/relation/views/manage/_form.php b/common/modules/relation/views/manage/_form.php
new file mode 100644
index 0000000..ad32f7c
--- /dev/null
+++ b/common/modules/relation/views/manage/_form.php
@@ -0,0 +1,58 @@
+
+
+
diff --git a/common/modules/relation/views/manage/create.php b/common/modules/relation/views/manage/create.php
new file mode 100644
index 0000000..9728570
--- /dev/null
+++ b/common/modules/relation/views/manage/create.php
@@ -0,0 +1,22 @@
+title = Yii::t('relation', $relation['name']);
+$this->params['breadcrumbs'][] = ['label' => Yii::t('relation', 'Relations'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('relation', $relation['name']), 'url' => ['/relation/manage/pars', 'relation' => $relation_key]];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'relation_key' => $relation_key,
+ 'relation' => $relation,
+ ]) ?>
+
+
diff --git a/common/modules/relation/views/manage/pars.php b/common/modules/relation/views/manage/pars.php
new file mode 100644
index 0000000..7852d4c
--- /dev/null
+++ b/common/modules/relation/views/manage/pars.php
@@ -0,0 +1,54 @@
+title = Yii::t('relation', 'Relation items for {relation}', ['relation' => $relation['name']]);
+$this->params['breadcrumbs'][] = ['label' => Yii::t('relation', 'Relations'), 'url' => ['/relation/manage']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('relation', 'Create relation'), ['create?relation='. $relation_key], ['class' => 'btn btn-success']) ?>
+
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ 'alias',
+ 'entity1.'. $relation['entity1']['listField'],
+ 'entity2.'. $relation['entity2']['listField'],
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{update} {delete}',
+ 'buttons' => [
+ 'update' => function ($url, $model) {
+ return Html::a('
', $url, [
+ 'title' => Yii::t('relation', 'Edit par'),
+ ]);
+ },
+ 'delete' => function ($url, $model) {
+ return Html::a('
', $url, [
+ 'title' => Yii::t('relation', 'Delete par'),
+ ]);
+ },
+ ],
+ 'urlCreator' => function ($action, $model, $key, $index) use ($relation, $relation_key) {
+ if ($action === 'update') {
+ $url ='/admin/relation/manage/update?relation='. $relation_key .'&id='. $model->{$relation['entity1']['linked_key']} .':'. $model->{$relation['entity2']['linked_key']};
+ return $url;
+ }
+ if ($action === 'delete') {
+ $url ='/admin/relation/manage/delete?relation='. $relation_key .'&id='. $model->{$relation['entity1']['linked_key']} .':'. $model->{$relation['entity2']['linked_key']};
+ return $url;
+ }
+ }
+ ],
+ ],
+ ]); ?>
+
diff --git a/common/modules/relation/views/manage/relations.php b/common/modules/relation/views/manage/relations.php
new file mode 100644
index 0000000..790e0e3
--- /dev/null
+++ b/common/modules/relation/views/manage/relations.php
@@ -0,0 +1,53 @@
+title = Yii::t('relation', 'Relations');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ $relations,
+ 'sort' => [
+ 'attributes' => ['name', 'key', 'entity1_label', 'entity2_label'],
+ ],
+ 'pagination' => [
+ 'pageSize' => 10,
+ ],
+ ]);
+ ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ 'name',
+ 'key',
+ 'entity1_label',
+ 'entity2_label',
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{view}',
+ 'buttons' => [
+ 'view' => function ($url, $model) {
+ return Html::a(' ', $url, [
+ 'title' => Yii::t('relation', 'View pars'),
+ ]);
+ },
+ ],
+ 'urlCreator' => function ($action, $model) {
+ if ($action === 'view') {
+ $url ='/admin/relation/manage/pars?relation='. $model['key'];
+ return $url;
+ }
+ }
+ ],
+ ],
+ ]); ?>
+
diff --git a/common/modules/relation/views/manage/update.php b/common/modules/relation/views/manage/update.php
new file mode 100644
index 0000000..cacc640
--- /dev/null
+++ b/common/modules/relation/views/manage/update.php
@@ -0,0 +1,25 @@
+title = Yii::t('relation', $relation['name']);
+$this->params['breadcrumbs'][] = ['label' => Yii::t('relation', 'Relations'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('relation', $relation['name']), 'url' => ['/relation/manage/pars', 'relation' => $relation_key]];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'value1' => $value1,
+ 'value2' => $value2,
+ 'relation_key' => $relation_key,
+ 'relation' => $relation,
+ ]) ?>
+
+
diff --git a/common/modules/rubrication/Module.php b/common/modules/rubrication/Module.php
new file mode 100644
index 0000000..dd3159a
--- /dev/null
+++ b/common/modules/rubrication/Module.php
@@ -0,0 +1,26 @@
+keyNameId === null) {
+ $primaryKey = $owner->primaryKey();
+ if (!isset($primaryKey[0])) {
+ throw new Exception('"' . $owner->className() . '" must have a primary key.');
+ }
+ $this->keyNameId = $primaryKey[0];
+ }
+ }
+
+ /*
+ * Inicialize behavior (read and prepare params)
+ */
+ public function init() {
+ if (empty($this->valueModel)) {
+ $this->valueModel = TaxValueString::className();
+ }
+ if (empty($this->valuePKey)) {
+ $vm = $this->valueModel;
+ $primaryKey = $vm::primaryKey();
+ if (!isset($primaryKey[0])) {
+ throw new Exception('"' . $this->valueModel . '" must have a primary key.');
+ }
+ if (count($primaryKey) > 1) {
+ throw new Exception('"' . $this->valueModel . '" is contains multiple keys.');
+ }
+ $this->valuePKey = $primaryKey[0];
+ }
+ }
+
+ /*
+ * Events for auto-drive default value
+ */
+ public function events() {
+ return [
+ ActiveRecord::EVENT_AFTER_INSERT => 'afterInsert',
+ ActiveRecord::EVENT_AFTER_UPDATE => 'beforeUpdate',
+ ActiveRecord::EVENT_BEFORE_DELETE => 'beforeDelete',
+ ];
+ }
+
+ public function getAutoValue() {
+ return $this->owner->hasOne($this->valueModel, [$this->valuePKey => $this->keyNameValue]);
+ }
+
+ public function afterInsert() {
+ /** @var ActiveRecord $valueModel */
+ $valueModel = new $this->valueModel;
+ foreach ($this->valueFields as $key => $field) {
+ $valueModel->setAttribute($field, $this->$key);
+ }
+ $valueModel->setAttribute($this->valueOptionId, $this->owner->getAttribute($this->keyNameId));
+ $valueModel->save();
+ $this->owner->setAttribute($this->keyNameValue, $valueModel->getAttribute($this->valuePKey));
+ $this->owner->{$this->slug['slugKeyName']} = $this->slugify($valueModel->{$this->slug['valueKeyName']});
+ $this->owner->save(false);
+ }
+
+ public function beforeUpdate() {
+ if ($this->owner->getIsNewRecord()) {
+ throw new NotSupportedException('Method "' . $this->owner->className() . '::insert" is not supported for inserting new entitys.');
+ }
+
+ if (!$this->owner->getAttribute($this->keyNameValue)) {
+ return;
+ }
+
+ /** @var ActiveRecord $valueModel */
+ $valueModelName = $this->valueModel;
+ $valueModel = $valueModelName::findOne($this->owner->getAttribute($this->keyNameValue));
+
+ $isave = false;
+ foreach ($this->valueFields as $key => $field) {
+ if ($valueModel->getAttribute($field) == $this->$key) {
+ continue;
+ }
+ $isave = true;
+ $valueModel->setAttribute($field, $this->$key);
+ }
+ if ($isave) {
+ $valueModel->setAttribute($this->valueOptionId, $this->owner->{$this->keyNameId});
+ $valueModel->save();
+ if (!empty($this->slug) && empty($this->owner->{$this->slug['slugKeyName']})) {
+ $this->owner->{$this->slug['slugKeyName']} = $this->slugify($valueModel->{$this->slug['valueKeyName']});
+ }
+ }
+ }
+
+ public function beforeDelete() {
+ /** @var ActiveRecord $valueModel */
+ $valueModelName = $this->valueModel;
+ $valueModelName::deleteAll([
+ $this->valueOptionId => $this->owner->getAttribute($this->keyNameId)
+ ]);
+ }
+
+ private function slugify( $slug )
+ {
+ return Inflector::slug( TransliteratorHelper::process( $slug ), '-', true );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function canSetProperty($key, $checkVars = true)
+ {
+ return array_key_exists($key, $this->valueFields) ?
+ true : parent::canSetProperty($key, $checkVars = true);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function __set($key, $value) {
+ if (isset($this->valueFields[$key])) {
+ $this->values[$key] = $value;
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function __get($key) {
+ return $this->_getValue($key);
+ }
+
+ public function _getValue($key) {
+ if (isset($this->values[$key])) {
+ return $this->values[$key];
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/modules/rubrication/controllers/DefaultController.php b/common/modules/rubrication/controllers/DefaultController.php
new file mode 100644
index 0000000..cbc303c
--- /dev/null
+++ b/common/modules/rubrication/controllers/DefaultController.php
@@ -0,0 +1,20 @@
+render('index');
+ }
+}
diff --git a/common/modules/rubrication/controllers/TaxGroupController.php b/common/modules/rubrication/controllers/TaxGroupController.php
new file mode 100644
index 0000000..b8483a9
--- /dev/null
+++ b/common/modules/rubrication/controllers/TaxGroupController.php
@@ -0,0 +1,152 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all TaxGroup models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $dataProvider = new ActiveDataProvider([
+ 'query' => TaxGroup::find(),
+ ]);
+
+ return $this->render('index', [
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single TaxGroup model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new TaxGroup model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new TaxGroup();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->tax_group_id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing TaxGroup model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->tax_group_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing TaxGroup model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /*
+ * Group-relations
+ */
+ public function actionRelation($id, $relations = ['tax_option_to_group', 'tax_option_to_option']) {
+ $group = $this->findModel($id);
+ $items = [];
+
+ foreach($relations as $relation) {
+ $rows = $group->getRelations($relation)->all();
+ $items = array_merge($items, $rows);
+ }
+
+ return $this->render('relations', [
+ 'items' => $items,
+ 'group' => $group,
+ ]);
+ }
+
+ /*
+ * Rebuilp MP-params for group options
+ */
+ public function actionRebuild($id) {
+ TaxOption::find()->rebuildMP($id);
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the TaxGroup model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return TaxGroup the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = TaxGroup::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/common/modules/rubrication/controllers/TaxOptionController.php b/common/modules/rubrication/controllers/TaxOptionController.php
new file mode 100644
index 0000000..e136479
--- /dev/null
+++ b/common/modules/rubrication/controllers/TaxOptionController.php
@@ -0,0 +1,171 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all TaxOption models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new TaxOptionSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ $group = TaxGroup::findOne(Yii::$app->request->queryParams['group']);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ 'group' => $group,
+ ]);
+ }
+
+ /**
+ * Displays a single TaxOption model.
+ * @param string $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ $model = $this->findModel($id);
+ $group = TaxGroup::findOne($model->tax_group_id);
+ return $this->render('view', [
+ 'model' => $model,
+ 'group' => $group,
+ ]);
+ }
+
+ /**
+ * Creates a new TaxOption model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new TaxOption();
+ $group = TaxGroup::findOne(Yii::$app->request->queryParams['group']);
+ $valueModelName = $this->getValueModelName($group);
+ $valueModel = new $valueModelName;
+
+ if ($model->load(Yii::$app->request->post()) && $valueModel->load(Yii::$app->request->post())) {
+ $model->save();
+
+ $valueModel->tax_option_id = $model->tax_option_id;
+ $valueModel->save();
+
+ $model->default_value = $valueModel->tax_value_id;
+ $model->save();
+
+ return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect(['view', 'id' => $model->tax_option_id]) : $this->redirect(array_merge(['create'], Yii::$app->request->queryParams));
+ } else {
+ $model->tax_group_id = $group->tax_group_id;
+ if (!empty(Yii::$app->request->queryParams['parent'])) {
+ $model->parent_id = Yii::$app->request->queryParams['parent'];
+ }
+ return $this->render('create', [
+ 'model' => $model,
+ 'group' => $group,
+ 'valueModel' => $valueModel,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing TaxOption model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param string $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+ $group = TaxGroup::findOne($model->tax_group_id);
+ $valueModelName = $this->getValueModelName($group);
+ $valueModel = $valueModelName::findOne($model->default_value);
+
+ if ($model->load(Yii::$app->request->post()) && $valueModel->load(Yii::$app->request->post())) {
+ $model->save();
+ $valueModel->tax_option_id = $model->tax_option_id;
+ $valueModel->save();
+
+ $model->default_value = $valueModel->tax_value_id;
+ $model->save();
+
+ TaxOption::find()->rebuildMP($model->tax_group_id);
+
+ return $this->redirect(['view', 'id' => $model->tax_option_id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ 'group' => $group,
+ 'valueModel' => $valueModel,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing TaxOption model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param string $id
+ * @return mixed
+ */
+ public function actionDelete($id)
+ {
+ $model = $this->findModel($id);
+ $group_id = $model->tax_group_id;
+
+ $model->delete();
+
+ return $this->redirect(['index', 'group' => $group_id]);
+ }
+
+ /**
+ * Finds the TaxOption model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param string $id
+ * @return TaxOption the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = TaxOption::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+
+ protected function getValueModelName($group) {
+ $valueClass = '\common\modules\rubrication\models\TaxValue'. ucfirst($group->module);
+ return class_exists($valueClass) ? $valueClass : FALSE;
+ }
+}
diff --git a/common/modules/rubrication/helpers/RubricationHelper.php b/common/modules/rubrication/helpers/RubricationHelper.php
new file mode 100644
index 0000000..4044373
--- /dev/null
+++ b/common/modules/rubrication/helpers/RubricationHelper.php
@@ -0,0 +1,51 @@
+ Yii::t('order', 'Invisible'),
+ 1 => Yii::t('order', 'Active'),
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ * Returns sort-interval of appropriate options and others
+ * @return array.
+ */
+ static public function SortArray($low = 0, $high = 100) {
+ return range($low, $high);
+ }
+
+ static public function OptionTypes() {
+ if (!is_null(self::$types)) {
+ return self::$types;
+ }
+
+ $module = \Yii::$app->getModule('rubrication');
+
+ if (!is_array($module->types))
+ return [];
+
+ return $module->types;
+
+ }
+
+ public function checkboxList($items, $options = [])
+ {
+ $this->adjustLabelFor($options);
+ $this->parts['{input}'] = Html::activeCheckboxList($this->model, $this->attribute, $items, $options);
+
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/common/modules/rubrication/models/TaxGroup.php b/common/modules/rubrication/models/TaxGroup.php
new file mode 100644
index 0000000..2e647c1
--- /dev/null
+++ b/common/modules/rubrication/models/TaxGroup.php
@@ -0,0 +1,129 @@
+ relationBehavior::className(),
+ 'relations' => [
+ 'tax_group_to_category' => 'entity1',
+ ]
+ ],
+ 'slug' => [
+ 'class' => 'common\behaviors\Slug',
+ 'in_attribute' => 'name',
+ 'out_attribute' => 'alias',
+ 'translit' => true
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tableName()
+ {
+ return '{{%tax_group}}';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['name', 'module'], 'required'],
+ [['description', 'settings'], 'string'],
+ [['hierarchical', 'is_filter'], 'boolean'],
+ [['alias', 'module'], 'string', 'max' => 50],
+ [['name'], 'string', 'max' => 255],
+ [['group_to_category'], 'safe']
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_group_id' => 'Tax Group ID',
+ 'alias' => 'Alias',
+ 'name' => 'Name',
+ 'description' => 'Description',
+ 'module' => 'Module',
+ 'hierarchical' => 'Hierarchical',
+// 'settings' => 'Settings',
+ 'is_filter' => 'Use in filter',
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxGroupToGroups()
+ {
+ return $this->hasMany(TaxGroupToGroup::className(), ['tax_group1_id' => 'tax_group_id'])->inverseOf('taxGroup1');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxGroupToGroups0()
+ {
+ return $this->hasMany(TaxGroupToGroup::className(), ['tax_group2_id' => 'tax_group_id'])->inverseOf('taxGroup2');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getOptions() {
+ return $this->getTaxOptions();
+ }
+ public function getTaxOptions()
+ {
+ return $this->hasMany(TaxOption::className(), ['tax_group_id' => 'tax_group_id'])->inverseOf('taxGroup');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOptionToGroups()
+ {
+ return $this->hasMany(TaxOptionToGroup::className(), ['tax_group_id' => 'tax_group_id'])->inverseOf('taxGroup');
+ }
+
+ public function getValueModelName($full_path = true) {
+ $valueClass = 'TaxValue'. ucfirst($this->module);
+ $fullClass = '\common\modules\rubrication\models\\'. $valueClass;
+ return class_exists($fullClass) ? $full_path ? $fullClass : $valueClass : FALSE;
+ }
+}
diff --git a/common/modules/rubrication/models/TaxGroupToGroup.php b/common/modules/rubrication/models/TaxGroupToGroup.php
new file mode 100644
index 0000000..b621239
--- /dev/null
+++ b/common/modules/rubrication/models/TaxGroupToGroup.php
@@ -0,0 +1,69 @@
+ 50]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_group1_id' => Yii::t('app', 'Tax Group1 ID'),
+ 'tax_group2_id' => Yii::t('app', 'Tax Group2 ID'),
+ 'alias' => Yii::t('app', 'Alias'),
+ 'sort' => Yii::t('app', 'Sort'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxGroup1()
+ {
+ return $this->hasOne(TaxGroup::className(), ['tax_group_id' => 'tax_group1_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxGroup2()
+ {
+ return $this->hasOne(TaxGroup::className(), ['tax_group_id' => 'tax_group2_id']);
+ }
+}
diff --git a/common/modules/rubrication/models/TaxOption.php b/common/modules/rubrication/models/TaxOption.php
new file mode 100644
index 0000000..256a04d
--- /dev/null
+++ b/common/modules/rubrication/models/TaxOption.php
@@ -0,0 +1,226 @@
+ [
+ 'class' => ArtboxTreeBehavior::className(),
+ 'keyNameGroup' => 'tax_group_id',
+ ],
+ 'slug' => [
+ 'class' => 'common\behaviors\Slug',
+ 'in_attribute' => 'ValueRenderFlash',
+ 'out_attribute' => 'alias',
+ 'translit' => true
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public static function tableName()
+ {
+ return '{{%tax_option}}';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [['tax_group_id'], 'required'],
+ [['tax_group_id', 'parent_id', 'sort', 'default_value'], 'integer'],
+ [['alias'], 'string', 'max' => 50],
+ [['tax_group_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxGroup::className(), 'targetAttribute' => ['tax_group_id' => 'tax_group_id']],
+// [['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['parent_id' => 'tax_option_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_option_id' => Yii::t('app', 'Tax Option ID'),
+ 'tax_group_id' => Yii::t('app', 'Tax Group ID'),
+ 'parent_id' => Yii::t('app', 'Parent ID'),
+ 'alias' => Yii::t('app', 'Alias'),
+ 'sort' => Yii::t('app', 'Sort'),
+ 'default_value' => Yii::t('app', 'Default Value'),
+ ];
+ }
+
+ public static function find() {
+ return new TaxOptionQuery(get_called_class());
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxEntityRelations()
+ {
+ return $this->hasMany(TaxEntityRelation::className(), ['tax_option_id' => 'tax_option_id'])->inverseOf('taxOption');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getGroup()
+ {
+ return $this->getTaxGroup();
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxGroup()
+ {
+ return $this->hasOne(TaxGroup::className(), ['tax_group_id' => 'tax_group_id'])->inverseOf('taxOptions');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOptions()
+ {
+ return $this->hasMany(TaxOption::className(), ['parent_id' => 'tax_option_id'])->inverseOf('parent');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOptionToGroups()
+ {
+ return $this->hasMany(TaxOptionToGroup::className(), ['tax_option_id' => 'tax_option_id'])->inverseOf('taxOption');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOptionToOptions()
+ {
+ return $this->hasMany(TaxOptionToOption::className(), ['tax_option1_id' => 'tax_option_id'])->inverseOf('taxOption1');
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOptionToOptions0()
+ {
+ return $this->hasMany(TaxOptionToOption::className(), ['tax_option2_id' => 'tax_option_id'])->inverseOf('taxOption2');
+ }
+
+ /**
+ */
+ public function getValue()
+ {
+ $valueClass = $this->getValueModelName();
+ if ($valueClass) {
+ return $this->hasOne($valueClass, ['tax_value_id' => 'default_value', 'tax_option_id' => 'tax_option_id'])->inverseOf('taxOption');
+ }
+ }
+
+ /**
+ */
+ public function getValueRenderFlash()
+ {
+ $valueClass = $this->getValueModelName();
+ $value = $this->value;
+ if ($valueClass && method_exists($valueClass, 'getValueRenderFlash')) {
+ return $valueClass::getValueRenderFlash($value);
+ } elseif(!empty($value)) {
+ return $value->value;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ */
+ public function getValueRenderHTML()
+ {
+ $valueClass = $this->getValueModelName();
+ $value = $this->value;
+ if ($valueClass && method_exists($valueClass, 'getValueRenderHTML')) {
+ return $valueClass::getValueRenderHTML($value);
+ } else {
+ return $value->value;
+ }
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getValues()
+ {
+ if ($valueClass = $this->getValueModelName())
+ return $this->hasMany($valueClass, ['tax_option_id' => 'tax_option_id'])->inverseOf('taxOption')->cascadeOnDelete();
+ }
+
+ public function beforeSave($insert)
+ {
+ if (parent::beforeSave($insert)) {
+
+ if (empty($this->parent_id))
+ $this->parent_id = 0;
+
+
+
+ return true;
+ }
+ return false;
+ }
+
+// public function beforeDelete() {
+// if ( ($model = $this->getValueModelName()) !== FALSE ) {
+//
+// }
+// }
+
+ private function getValueModelName() {
+ $group = $this->taxGroup;
+ $valueClass = '\common\modules\rubrication\models\TaxValue'. ucfirst($group->module);
+ return class_exists($valueClass) ? $valueClass : FALSE;
+ }
+}
diff --git a/common/modules/rubrication/models/TaxOptionQuery.php b/common/modules/rubrication/models/TaxOptionQuery.php
new file mode 100644
index 0000000..e46ce6b
--- /dev/null
+++ b/common/modules/rubrication/models/TaxOptionQuery.php
@@ -0,0 +1,37 @@
+andWhere('[[status]]=1');
+ }*/
+
+ /**
+ * @inheritdoc
+ * @return TaxOption[]|array
+ */
+ public function all($db = null)
+ {
+ return parent::all($db);
+ }
+
+ /**
+ * @inheritdoc
+ * @return TaxOption|array|null
+ */
+ public function one($db = null)
+ {
+ return parent::one($db);
+ }
+}
diff --git a/common/modules/rubrication/models/TaxOptionRelation.php b/common/modules/rubrication/models/TaxOptionRelation.php
new file mode 100644
index 0000000..c5390be
--- /dev/null
+++ b/common/modules/rubrication/models/TaxOptionRelation.php
@@ -0,0 +1,50 @@
+ 50]
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_option1_id' => Yii::t('product', 'Tax Option1 ID'),
+ 'tax_option2_id' => Yii::t('product', 'Tax Option2 ID'),
+ 'alias' => Yii::t('product', 'Alias'),
+ 'sort' => Yii::t('product', 'Sort'),
+ ];
+ }
+}
diff --git a/common/modules/rubrication/models/TaxOptionSearch.php b/common/modules/rubrication/models/TaxOptionSearch.php
new file mode 100644
index 0000000..9cdddb4
--- /dev/null
+++ b/common/modules/rubrication/models/TaxOptionSearch.php
@@ -0,0 +1,76 @@
+tax_group_id = intval($params['group']);
+ unset($params['group']);
+ }
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params);
+
+// if (!$this->validate()) {
+// return $dataProvider;
+// }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'tax_option_id' => $this->tax_option_id,
+ 'tax_group_id' => $this->tax_group_id,
+ 'parent_id' => $this->parent_id,
+ 'sort' => $this->sort,
+ ]);
+
+ $query->andFilterWhere(['like', 'alias', $this->alias]);
+ $query->andFilterWhere(['like', 'tax_value_string.value', $this->default_value]);
+
+ $query->orderBy(['path_int' => SORT_ASC, 'depth' => SORT_ASC, 'sort' => SORT_ASC]);
+
+ return $dataProvider;
+ }
+}
diff --git a/common/modules/rubrication/models/TaxValueFloat.php b/common/modules/rubrication/models/TaxValueFloat.php
new file mode 100644
index 0000000..a8d76e6
--- /dev/null
+++ b/common/modules/rubrication/models/TaxValueFloat.php
@@ -0,0 +1,58 @@
+ true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['tax_option_id' => 'tax_option_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_value_id' => Yii::t('app', 'Tax Value ID'),
+ 'tax_option_id' => Yii::t('app', 'Tax Option ID'),
+ 'value' => Yii::t('app', 'Value'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOption()
+ {
+ return $this->hasOne(TaxOption::className(), ['tax_option_id' => 'tax_option_id'])->inverseOf('taxValues');
+ }
+}
diff --git a/common/modules/rubrication/models/TaxValueInt.php b/common/modules/rubrication/models/TaxValueInt.php
new file mode 100644
index 0000000..89406f2
--- /dev/null
+++ b/common/modules/rubrication/models/TaxValueInt.php
@@ -0,0 +1,57 @@
+ true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['tax_option_id' => 'tax_option_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_value_id' => Yii::t('app', 'Tax Value ID'),
+ 'tax_option_id' => Yii::t('app', 'Tax Option ID'),
+ 'value' => Yii::t('app', 'Value'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOption()
+ {
+ return $this->hasOne(TaxOption::className(), ['tax_option_id' => 'tax_option_id'])->inverseOf('taxValues');
+ }
+}
diff --git a/common/modules/rubrication/models/TaxValueLink.php b/common/modules/rubrication/models/TaxValueLink.php
new file mode 100644
index 0000000..c6c3d90
--- /dev/null
+++ b/common/modules/rubrication/models/TaxValueLink.php
@@ -0,0 +1,69 @@
+ 150],
+ [['link'], 'string', 'max' => 255],
+ [['tax_option_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['tax_option_id' => 'tax_option_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_value_id' => Yii::t('app', 'Tax Value ID'),
+ 'tax_option_id' => Yii::t('app', 'Tax Option ID'),
+ 'name' => Yii::t('app', 'Name'),
+ 'link' => Yii::t('app', 'Link'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOption()
+ {
+ return $this->hasOne(TaxOption::className(), ['tax_option_id' => 'tax_option_id'])->inverseOf('taxValueLinks');
+ }
+
+ public static function getValueRenderFlash($value) {
+ return $value->name;
+ }
+
+ public static function getValueRenderHTML($value) {
+ return Html::a($value->name, $value->link);
+ }
+}
diff --git a/common/modules/rubrication/models/TaxValueString.php b/common/modules/rubrication/models/TaxValueString.php
new file mode 100644
index 0000000..29a8f7c
--- /dev/null
+++ b/common/modules/rubrication/models/TaxValueString.php
@@ -0,0 +1,58 @@
+ 255],
+ [['tax_option_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['tax_option_id' => 'tax_option_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_value_id' => Yii::t('rubrication', 'Tax Value ID'),
+ 'tax_option_id' => Yii::t('rubrication', 'Tax Option ID'),
+ 'value' => Yii::t('rubrication', 'Value'),
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxOption()
+ {
+ return $this->hasOne(TaxOption::className(), ['tax_option_id' => 'tax_option_id'])->inverseOf('taxValueStrings');
+ }
+}
diff --git a/common/modules/rubrication/views/default/index.php b/common/modules/rubrication/views/default/index.php
new file mode 100644
index 0000000..d9e8d45
--- /dev/null
+++ b/common/modules/rubrication/views/default/index.php
@@ -0,0 +1,12 @@
+
+
= $this->context->action->uniqueId ?>
+
+ This is the view content for action "= $this->context->action->id ?>".
+ The action belongs to the controller "= get_class($this->context) ?>"
+ in the "= $this->context->module->id ?>" module.
+
+
+ You may customize this page by editing the following file:
+ = __FILE__ ?>
+
+
diff --git a/common/modules/rubrication/views/tax-group/_form.php b/common/modules/rubrication/views/tax-group/_form.php
new file mode 100644
index 0000000..f53e292
--- /dev/null
+++ b/common/modules/rubrication/views/tax-group/_form.php
@@ -0,0 +1,45 @@
+
+
+
diff --git a/common/modules/rubrication/views/tax-group/create.php b/common/modules/rubrication/views/tax-group/create.php
new file mode 100644
index 0000000..ddcc890
--- /dev/null
+++ b/common/modules/rubrication/views/tax-group/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('rubrication', 'Create Tax Group');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Tax Groups'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/common/modules/rubrication/views/tax-group/index.php b/common/modules/rubrication/views/tax-group/index.php
new file mode 100644
index 0000000..57bc84d
--- /dev/null
+++ b/common/modules/rubrication/views/tax-group/index.php
@@ -0,0 +1,72 @@
+title = Yii::t('rubrication', 'Groups');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
+
= Html::encode($this->title) ?>
+
+ = Html::a(Yii::t('rubrication', 'Create Group'), ['create'], ['class' => 'btn btn-success']) ?>
+
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'name',
+ 'alias',
+ 'description:ntext',
+ 'module',
+ 'hierarchical:boolean',
+ // 'settings:ntext',
+
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{update} {options} {relations} {delete} {rebuild}',
+ 'buttons' => [
+ 'options' => function ($url, $model) {
+ return Html::a('
', $url, [
+ 'title' => Yii::t('rubrication', 'Options'),
+ ]);
+ },
+ 'relations' => function ($url, $model) {
+ return Html::a('', $url, [
+ 'title' => Yii::t('rubrication', 'Relations'),
+ ]);
+ },
+ 'rebuild' => function ($url, $model) {
+ return Html::a('', $url, [
+ 'title' => Yii::t('rubrication', 'Rebuild cache'),
+ ]);
+ }
+ ],
+ 'urlCreator' => function ($action, $model, $key, $index) {
+ if ($action === 'options') {
+ $url ='/admin/rubrication/tax-option?group='.$model->tax_group_id;
+ return $url;
+ } elseif ($action === 'relations') {
+ $url ='/admin/rubrication/tax-group/relation&id='.$model->tax_group_id;
+ return $url;
+ } elseif ($action === 'update') {
+ $url ='/admin/rubrication/tax-group/update?id='.$model->tax_group_id;
+ return $url;
+ } elseif ($action === 'delete') {
+ $url ='/admin/rubrication/tax-group/delete?id='.$model->tax_group_id;
+ return $url;
+ } elseif ($action === 'rebuild') {
+ $url ='/admin/rubrication/tax-group/rebuild?id='.$model->tax_group_id;
+ return $url;
+ }
+ }
+ ],
+ ],
+ ]); ?>
+
+
diff --git a/common/modules/rubrication/views/tax-group/relations.php b/common/modules/rubrication/views/tax-group/relations.php
new file mode 100644
index 0000000..c65a58d
--- /dev/null
+++ b/common/modules/rubrication/views/tax-group/relations.php
@@ -0,0 +1,58 @@
+title = Yii::t('relation', 'Relation for Group "{group}"', ['group' => $group->name]);
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Tax Groups'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+//= Html::a(Yii::t('relation', 'Create relation'), ['create?relation='. $relation_key], ['class' => 'btn btn-success']) ?>
+
+
+ $items,
+ 'sort' => [
+ 'attributes' => ['name', 'alias', 'entity1_label', 'entity2_label'],
+ ],
+ 'pagination' => [
+ 'pageSize' => 10,
+ ],
+ ]);
+ ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ 'name',
+ 'alias',
+ 'entity1_label',
+ 'entity2_label',
+ /*[
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{view}',
+ 'buttons' => [
+ 'view' => function ($url, $model) {
+ return Html::a(' ', $url, [
+ 'title' => Yii::t('relation', 'View pars'),
+ ]);
+ },
+ ],
+ 'urlCreator' => function ($action, $model, $key, $index) {
+ if ($action === 'view') {
+ $url ='/admin/relation/manage/pars?relation='. $model['key'];
+ return $url;
+ }
+ }
+ ],*/
+ ],
+ ]); ?>
+
diff --git a/common/modules/rubrication/views/tax-group/update.php b/common/modules/rubrication/views/tax-group/update.php
new file mode 100644
index 0000000..8414ea0
--- /dev/null
+++ b/common/modules/rubrication/views/tax-group/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('rubrication', 'Update {modelClass}: ', [
+ 'modelClass' => 'Tax Group',
+]) . ' ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Groups'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->tax_group_id]];
+$this->params['breadcrumbs'][] = Yii::t('rubrication', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/common/modules/rubrication/views/tax-group/view.php b/common/modules/rubrication/views/tax-group/view.php
new file mode 100644
index 0000000..b0c4d87
--- /dev/null
+++ b/common/modules/rubrication/views/tax-group/view.php
@@ -0,0 +1,42 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Tax Groups'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('rubrication', 'Update'), ['update', 'id' => $model->tax_group_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('rubrication', 'Delete'), ['delete', 'id' => $model->tax_group_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('rubrication', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+ = Html::a(Yii::t('rubrication', 'Create Option'), ['tax-option/create?group='. $model->tax_group_id], ['class' => 'btn btn-success']) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'tax_group_id',
+ 'alias',
+ 'name',
+ 'description:ntext',
+ 'module',
+ 'hierarchical:boolean',
+ 'settings:ntext',
+ ],
+ ]) ?>
+
+
diff --git a/common/modules/rubrication/views/tax-option/_form.php b/common/modules/rubrication/views/tax-option/_form.php
new file mode 100644
index 0000000..f11bad2
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/_form.php
@@ -0,0 +1,62 @@
+
+
+
diff --git a/common/modules/rubrication/views/tax-option/_search.php b/common/modules/rubrication/views/tax-option/_search.php
new file mode 100644
index 0000000..8414c97
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/_search.php
@@ -0,0 +1,37 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'tax_option_id') ?>
+
+ = $form->field($model, 'tax_group_id') ?>
+
+ = $form->field($model, 'parent_id') ?>
+
+ = $form->field($model, 'alias') ?>
+
+ = $form->field($model, 'sort') ?>
+
+ field($model, 'default_value') ?>
+
+
+ = Html::submitButton(Yii::t('rubrication', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('rubrication', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/common/modules/rubrication/views/tax-option/create.php b/common/modules/rubrication/views/tax-option/create.php
new file mode 100644
index 0000000..55ddf4a
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/create.php
@@ -0,0 +1,25 @@
+title = Yii::t('rubrication', 'Create Tax Option');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Groups'), 'url' => ['tax-group/index']];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', $group->name), 'url' => ['index', 'group' => $group->tax_group_id]];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', Yii::t('rubrication', 'Options of {name}', ['name' => $group->name])), 'url' => ['index', 'group' => $group->tax_group_id]];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'group' => $group,
+ 'valueModel' => $valueModel,
+ ]) ?>
+
+
diff --git a/common/modules/rubrication/views/tax-option/index.php b/common/modules/rubrication/views/tax-option/index.php
new file mode 100644
index 0000000..dbd2389
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/index.php
@@ -0,0 +1,100 @@
+title = Yii::t('rubrication', 'Options for group "{group}"', ['group' => $group->name]);
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Groups'), 'url' => ['tax-group/index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('rubrication', 'Create Option'), ['create?group='. $group->tax_group_id], ['class' => 'btn btn-success']) ?>
+
+
+hierarchical) :?>
+ $dataProvider,
+// 'filterModel' => $searchModel,
+ 'columns' => [
+ [
+ 'label'=> Yii::t('rubrication', 'Value'),
+ 'content'=>function($data){
+ return str_repeat('-', $data->depth) .' '. $data->ValueRenderFlash;
+ }
+ ],
+ 'alias',
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{view} {update} {delete} {synonim}',
+ 'buttons' => [
+ 'synonim' => function ($url, $model) {
+ return Html::a('
', $url, [
+ 'title' => Yii::t('rubrication', 'Synonims'),
+ ]);
+ },
+ ],
+ 'urlCreator' => function ($action, $model, $key, $index) {
+ if ($action === 'view') {
+ $url = '/admin/rubrication/tax-option/view?id=' . $model->tax_option_id;
+ return $url;
+ } elseif ($action === 'update') {
+ $url ='/admin/rubrication/tax-option/update?id='.$model->tax_option_id;
+ return $url;
+ } elseif ($action === 'delete') {
+ $url ='/admin/rubrication/tax-option/delete?id='.$model->tax_option_id;
+ return $url;
+ } elseif ($action === 'synonim') {
+ $url ='/admin/rubrication/tax-synonim/delete?id='.$model->tax_option_id;
+ return $url;
+ }
+ }
+ ],
+ ],
+ ]);?>
+
+ $dataProvider,
+// 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ 'valueRenderHTML',
+ 'alias',
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{update} {delete} {synonim}',
+ 'buttons' => [
+ 'synonim' => function ($url, $model) {
+ return Html::a('
', $url, [
+ 'title' => Yii::t('rubrication', 'Synonims'),
+ ]);
+ },
+ ],
+ 'urlCreator' => function ($action, $model, $key, $index) {
+ if ($action === 'update') {
+ $url ='/admin/rubrication/tax-option/update?id='.$model->tax_option_id;
+ return $url;
+ } elseif ($action === 'delete') {
+ $url ='/admin/rubrication/tax-option/delete?id='.$model->tax_option_id;
+ return $url;
+ } elseif ($action === 'synonim') {
+ $url ='/admin/rubrication/tax-synonim/delete?id='.$model->tax_option_id;
+ return $url;
+ }
+ }
+ ],
+ ],
+ ]);?>
+
+
diff --git a/common/modules/rubrication/views/tax-option/update.php b/common/modules/rubrication/views/tax-option/update.php
new file mode 100644
index 0000000..a0dbb1c
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/update.php
@@ -0,0 +1,26 @@
+title = Yii::t('rubrication', 'Update {modelClass}: ', [
+ 'modelClass' => 'Tax Option',
+]) . ' ' . $model->tax_option_id;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Groups'), 'url' => ['tax-group/index']];
+$this->params['breadcrumbs'][] = ['label' => $group->name, 'url' => ['view', 'id' => $group->tax_group_id]];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', Yii::t('rubrication', 'Options of {name}', ['name' => $group->name])), 'url' => ['index', 'group' => $group->tax_group_id]];
+$this->params['breadcrumbs'][] = Yii::t('rubrication', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'group' => $group,
+ 'valueModel' => $valueModel,
+ ]) ?>
+
+
diff --git a/common/modules/rubrication/views/tax-option/value/_fields_float.php b/common/modules/rubrication/views/tax-option/value/_fields_float.php
new file mode 100644
index 0000000..6a35b2f
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/value/_fields_float.php
@@ -0,0 +1 @@
+= $form->field($valueModel, 'value')->textInput() ?>
\ No newline at end of file
diff --git a/common/modules/rubrication/views/tax-option/value/_fields_int.php b/common/modules/rubrication/views/tax-option/value/_fields_int.php
new file mode 100644
index 0000000..6a35b2f
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/value/_fields_int.php
@@ -0,0 +1 @@
+= $form->field($valueModel, 'value')->textInput() ?>
\ No newline at end of file
diff --git a/common/modules/rubrication/views/tax-option/value/_fields_link.php b/common/modules/rubrication/views/tax-option/value/_fields_link.php
new file mode 100644
index 0000000..5aeb45e
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/value/_fields_link.php
@@ -0,0 +1,2 @@
+= $form->field($valueModel, 'name')->textInput(['maxlength' => true]) ?>
+= $form->field($valueModel, 'link')->textInput(['maxlength' => true]) ?>
\ No newline at end of file
diff --git a/common/modules/rubrication/views/tax-option/value/_fields_string.php b/common/modules/rubrication/views/tax-option/value/_fields_string.php
new file mode 100644
index 0000000..6a35b2f
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/value/_fields_string.php
@@ -0,0 +1 @@
+= $form->field($valueModel, 'value')->textInput() ?>
\ No newline at end of file
diff --git a/common/modules/rubrication/views/tax-option/view.php b/common/modules/rubrication/views/tax-option/view.php
new file mode 100644
index 0000000..8858d75
--- /dev/null
+++ b/common/modules/rubrication/views/tax-option/view.php
@@ -0,0 +1,46 @@
+title = $model->valueRenderFlash;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Groups'), 'url' => ['tax-group/index']];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', $group->name), 'url' => ['index', 'group' => $group->tax_group_id]];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', Yii::t('rubrication', 'Options of {name}', ['name' => $group->name])), 'url' => ['index', 'group' => $group->tax_group_id]];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('rubrication', 'Update'), ['update', 'id' => $model->tax_option_id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('rubrication', 'Delete'), ['delete', 'id' => $model->tax_option_id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('rubrication', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+ = Html::a(Yii::t('rubrication', 'Create Option'), ['tax-option/create?group='. $model->tax_group_id], ['class' => 'btn btn-success']) ?>
+ parent_id)) :?>
+ = Html::a(Yii::t('rubrication', 'Create Option By {name}', ['name' => $model->parent->ValueRenderFlash]), ['tax-option/create?group='. $model->tax_group_id .'&parent='. $model->parent->tax_option_id], ['class' => 'btn btn-success']) ?>
+
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'tax_option_id',
+ 'ValueRenderFlash',
+ 'alias',
+ 'parent.ValueRenderFlash',
+ 'group.name',
+ 'sort',
+ ],
+ ]) ?>
+
+
diff --git a/common/translation/ru/app.php b/common/translation/ru/app.php
new file mode 100644
index 0000000..e1eea62
--- /dev/null
+++ b/common/translation/ru/app.php
@@ -0,0 +1,81 @@
+ 'ID',
+ 'username' => 'Имя',
+ 'surname' => 'Фамилия',
+ 'auth_key' => 'Auth Key',
+ 'password_hash' => 'Password Hash',
+ 'password_reset_token' => 'Password Reset Token',
+ 'email' => 'Логин (e-mail)',
+ 'phone' => 'Телефон',
+ 'status' => 'Статус',
+ 'created_at' => 'Created At',
+ 'updated_at' => 'Updated At',
+ 'verifyCode' => 'Код проверки',
+ 'password' => 'Пароль',
+ 'password_repeat' => 'Повторить пароль',
+ 'registration' => 'Регистрация',
+ 'message' => 'Этот {field} уже занят',
+ 'message_match_password' => 'Пароли не совпадают',
+ 'exit' => 'Выход',
+ 'enter' => 'Войти',
+ 'your_personal_area' => 'Вход в личный кабинет',
+ 'forgot_password' => 'Забыли пароль?',
+ 'rememberMe' => 'Запомнить меня',
+ 'articles' => 'Всего товаров',
+ 'code' => 'Код: {0}',
+ 'checkout' => 'оформить заказ',
+ 'sum' => 'Сумма',
+ 'continue_shopping' => 'продолжить покупки',
+ 'edit_personal_data' => 'Редактировать личные данные',
+ 'personal_data' => 'Личные данные',
+ 'my_orders' => 'Мои заказы',
+ 'bookmarks' => 'Закладки',
+ 'basket' => 'Корзина',
+ 'banner_id' => 'Banner ID',
+ 'image' => 'Изображение',
+ 'alt' => 'Описание',
+ 'title' => 'Заголовок',
+ 'url' => 'Ссылка',
+ 'width' => 'Ширина',
+ 'height' => 'Высота',
+ 'blog_id' => 'Blog ID',
+ 'user_id' => 'User ID',
+ 'name' => 'Название',
+ 'link' => 'Ссылка',
+ 'date_add' => 'Дата добавления',
+ 'user_add_id' => 'User Add ID',
+ 'view_count' => 'Количество просмотров',
+ 'description' => 'Описание',
+ 'cover' => 'Фото главное',
+ 'event_id' => 'Event ID',
+ 'alias' => 'Ссылка',
+ 'body' => 'Тело',
+ 'meta_title' => 'Мета заголовок',
+ 'h1' => 'H1',
+ 'seo_text' => 'Сео Текст',
+ 'end_at' => 'Срок действия по',
+ 'order_items_id' => 'Order Items ID',
+ 'order_id' => 'Order ID',
+ 'item_id' => 'Item ID',
+ 'item_count' => 'Количество',
+ 'price' => 'Цена',
+ 'customer_id' => 'Customer ID',
+ 'delivery' => 'Доставка',
+ 'payment' => 'Оплата',
+ 'seo_id' => 'Seo ID',
+ 'controller' => 'Controller',
+ 'seo_category_id' => 'Seo Category ID',
+ 'seo_dynamic_id' => 'Seo Dynamic ID',
+ 'action' => 'Action',
+ 'fields' => 'Поля',
+ 'param' => 'Параметры',
+ 'key' => 'Ключ',
+ 'service_id' => 'Service ID',
+ 'slider_id' => 'Slider ID',
+ 'speed' => 'Скорость',
+ 'duration' => 'Продолжительность',
+ 'slider_image_id' => 'Slider Image ID',
+ 'sort' => 'Сортировка',
+
+];
\ No newline at end of file
diff --git a/common/translation/ru/product.php b/common/translation/ru/product.php
new file mode 100644
index 0000000..8b11466
--- /dev/null
+++ b/common/translation/ru/product.php
@@ -0,0 +1,11 @@
+` 'Категории',
+ 'Create Category' => 'Создать Категорию',
+ 'Name' => 'Наименование',
+ 'Set populary' => 'Сделать популярной',
+ 'Set not populary' => 'Сделать не популярной',
+ 'Remote ID' => 'ID в 1С',
+ 'Search for "{keywords}"' => 'Поиск по "{keywords}"',
+ 'Search for "{keywords}" in category "{category}"' => 'Поиск по "{keywords}" в категории "{category}"',
+];
\ No newline at end of file
diff --git a/common/widgets/Alert.php b/common/widgets/Alert.php
new file mode 100644
index 0000000..5b5bbb2
--- /dev/null
+++ b/common/widgets/Alert.php
@@ -0,0 +1,79 @@
+session->setFlash('error', 'This is the message');
+ * \Yii::$app->session->setFlash('success', 'This is the message');
+ * \Yii::$app->session->setFlash('info', 'This is the message');
+ * ```
+ *
+ * Multiple messages could be set as follows:
+ *
+ * ```php
+ * \Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']);
+ * ```
+ *
+ * @author Kartik Visweswaran
+ * @author Alexander Makarov
+ */
+class Alert extends \yii\bootstrap\Widget
+{
+ /**
+ * @var array the alert types configuration for the flash messages.
+ * This array is setup as $key => $value, where:
+ * - $key is the name of the session flash variable
+ * - $value is the bootstrap alert type (i.e. danger, success, info, warning)
+ */
+ public $alertTypes = [
+ 'error' => 'alert-danger',
+ 'danger' => 'alert-danger',
+ 'success' => 'alert-success',
+ 'info' => 'alert-info',
+ 'warning' => 'alert-warning'
+ ];
+
+ /**
+ * @var array the options for rendering the close button tag.
+ */
+ public $closeButton = [];
+
+ public function init()
+ {
+ parent::init();
+
+ $session = \Yii::$app->session;
+ $flashes = $session->getAllFlashes();
+ $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : '';
+
+ foreach ($flashes as $type => $data) {
+ if (isset($this->alertTypes[$type])) {
+ $data = (array) $data;
+ foreach ($data as $i => $message) {
+ /* initialize css class for each alert box */
+ $this->options['class'] = $this->alertTypes[$type] . $appendCss;
+
+ /* assign unique id to each alert box */
+ $this->options['id'] = $this->getId() . '-' . $type . '-' . $i;
+
+ echo \yii\bootstrap\Alert::widget([
+ 'body' => $message,
+ 'closeButton' => $this->closeButton,
+ 'options' => $this->options,
+ ]);
+ }
+
+ $session->removeFlash($type);
+ }
+ }
+ }
+}
diff --git a/common/widgets/BasketHead.php b/common/widgets/BasketHead.php
new file mode 100644
index 0000000..79535cd
--- /dev/null
+++ b/common/widgets/BasketHead.php
@@ -0,0 +1,50 @@
+session->get('order');
+ unset($sessionData['order_id']);
+ $count = count($sessionData);
+ $price = 0;
+ if(is_array($sessionData) && !empty($sessionData)){
+
+ $variant = ProductVariant::find()->where(['product_variant_id'=>array_keys($sessionData)])->indexBy('product_variant_id')->all();
+
+
+ foreach ($sessionData as $k => $item) {
+ $sessionData[$k]['item'] = $variant[$k];
+ $price += $variant[$k]->price * $sessionData[$k]['num'];
+ }
+
+
+ return $this->render('basket_head',[
+ 'items'=>$sessionData,
+ 'count' => $count,
+ 'price' => $price
+ ]);
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/common/widgets/BasketModal.php b/common/widgets/BasketModal.php
new file mode 100644
index 0000000..8a30fa7
--- /dev/null
+++ b/common/widgets/BasketModal.php
@@ -0,0 +1,44 @@
+session->get('order');
+ unset($sessionData['order_id']);
+ $count = count($sessionData);
+ $price = 0;
+ if(is_array($sessionData) && !empty($sessionData)){
+
+ $variant = ProductVariant::find()->where(['product_variant_id'=>array_keys($sessionData)])->indexBy('product_variant_id')->all();
+
+
+ foreach ($sessionData as $k => $item) {
+ $sessionData[$k]['item'] = $variant[$k];
+ $price += $variant[$k]->price * $sessionData[$k]['num'];
+ }
+
+
+ return $this->render('basket_modal',[
+ 'items'=>$sessionData,
+ 'count' => $count,
+ 'price' => $price
+ ]);
+
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/common/widgets/FieldEditor.php b/common/widgets/FieldEditor.php
new file mode 100644
index 0000000..fcb7d04
--- /dev/null
+++ b/common/widgets/FieldEditor.php
@@ -0,0 +1,48 @@
+item_id && $this->model){
+ $widgetData = $this->findModel();
+ } else {
+ $widgetData= [new Fields()];
+ }
+
+ return $this->render($this->template.'_field',['model'=>ArrayHelper::toArray($widgetData)]);
+ }
+
+ protected function findModel()
+ {
+
+ if (($model = Fields::find()->where([
+ 'table_id'=>$this->item_id,
+ 'table_name'=>$this->model,
+ 'field_type'=>$this->template,
+ 'language'=>$this->language,
+ ])->all())) {
+
+ return $model;
+
+ } else {
+ return [new Fields()];
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/widgets/views/basket_head.php b/common/widgets/views/basket_head.php
new file mode 100644
index 0000000..6b6b021
--- /dev/null
+++ b/common/widgets/views/basket_head.php
@@ -0,0 +1,10 @@
+
+
+
+
+
= Yii::t('app','basket');?> = $count? Html::tag('span',$count,['class'=>'head_basket_count']) :'' ?>
+
+
+
diff --git a/common/widgets/views/basket_modal.php b/common/widgets/views/basket_modal.php
new file mode 100644
index 0000000..96265f0
--- /dev/null
+++ b/common/widgets/views/basket_modal.php
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+ product->image)) :?>
+
+
+
+
+
+
+ =$item['item']->product->name.' '.$item['item']->name?>
+ = Yii::t('app', 'code', '45885-01016049')?>
+
+
+
+
= $item['item']->price * $item['num'] ?> грн.
+
+
+
+
+
+
+
+
+
= Yii::t('app','articles')?>: = $count ?>
+
= Yii::t('app','sum')?>: = $price ?> грн.
+
+
+ = Html::a(Yii::t('app','continue_shopping'),'#', ['class'=> 'close']) ?>
+ = Html::a(Yii::t('app','checkout'), ['orders/first'], ['class'=> 'button']);?>
+
+
diff --git a/common/widgets/views/education_field.php b/common/widgets/views/education_field.php
new file mode 100644
index 0000000..b24e544
--- /dev/null
+++ b/common/widgets/views/education_field.php
@@ -0,0 +1,83 @@
+
+
+
+Образование
+
+
+ добавить еще
+
+
+
+
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..298acb2
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,58 @@
+{
+ "name": "yiisoft/yii2-app-advanced",
+ "description": "Yii 2 Advanced Project Template",
+ "keywords": ["yii2", "framework", "advanced", "project template"],
+ "homepage": "http://www.yiiframework.com/",
+ "type": "project",
+ "license": "BSD-3-Clause",
+ "platform": {
+ "php": "5.5.0"
+ },
+ "support": {
+ "issues": "https://github.com/yiisoft/yii2/issues?state=open",
+ "forum": "http://www.yiiframework.com/forum/",
+ "wiki": "http://www.yiiframework.com/wiki/",
+ "irc": "irc://irc.freenode.net/yii",
+ "source": "https://github.com/yiisoft/yii2"
+ },
+ "minimum-stability": "dev",
+ "require": {
+ "php": ">=5.4.0",
+ "yiisoft/yii2": ">=2.0.6",
+ "yiisoft/yii2-bootstrap": "*",
+ "yiisoft/yii2-swiftmailer": "*",
+ "dmstr/yii2-adminlte-asset": "2.*",
+ "yiisoft/yii2-jui": "^2.0",
+ "kartik-v/yii2-widget-select2": "@dev",
+ "mihaildev/yii2-ckeditor": "*",
+ "developeruz/yii2-db-rbac": "*",
+ "nodge/yii2-eauth": "*",
+ "yiisoft/yii2-imagine": "^2.0",
+ "mihaildev/yii2-elfinder": "^1.1",
+ "kartik-v/yii2-widget-colorinput": "*",
+ "2amigos/yii2-transliterator-helper": "*",
+ "rmrevin/yii2-comments": "1.4.*",
+ "bower-asset/admin-lte": "*",
+ "FortAwesome/Font-Awesome": "*",
+ "kartik-v/yii2-widget-datepicker": "*",
+ "unclead/yii2-multiple-input": "~1.0",
+ "codeception/codeception":"*",
+ "phpmailer/phpmailer": "^5.2",
+ "league/oauth2-client": "^1.3"
+ },
+ "require-dev": {
+ "yiisoft/yii2-codeception": "*",
+ "yiisoft/yii2-debug": "*",
+ "yiisoft/yii2-gii": "*",
+ "yiisoft/yii2-faker": "*"
+ },
+ "config": {
+ "process-timeout": 1800
+ },
+ "extra": {
+ "asset-installer-paths": {
+ "npm-asset-library": "vendor/npm",
+ "bower-asset-library": "vendor/bower"
+ }
+ }
+}
diff --git a/console/config/.gitignore b/console/config/.gitignore
new file mode 100644
index 0000000..8ded784
--- /dev/null
+++ b/console/config/.gitignore
@@ -0,0 +1,2 @@
+main-local.php
+params-local.php
\ No newline at end of file
diff --git a/console/config/bootstrap.php b/console/config/bootstrap.php
new file mode 100644
index 0000000..bef3d5c
--- /dev/null
+++ b/console/config/bootstrap.php
@@ -0,0 +1,5 @@
+ 'app-console',
+ 'basePath' => dirname(__DIR__),
+ 'bootstrap' => ['log'],
+ 'controllerNamespace' => 'console\controllers',
+ 'components' => [
+ 'log' => [
+ 'targets' => [
+ [
+ 'class' => 'yii\log\FileTarget',
+ 'levels' => ['error', 'warning'],
+ ],
+ ],
+ ],
+ ],
+ 'params' => $params,
+];
diff --git a/console/config/params.php b/console/config/params.php
new file mode 100644
index 0000000..4ee7a49
--- /dev/null
+++ b/console/config/params.php
@@ -0,0 +1,4 @@
+ 'admin@example.com',
+];
diff --git a/console/controllers/.gitkeep b/console/controllers/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/console/controllers/.gitkeep
diff --git a/console/controllers/ImportController.php b/console/controllers/ImportController.php
new file mode 100644
index 0000000..1d08d30
--- /dev/null
+++ b/console/controllers/ImportController.php
@@ -0,0 +1,644 @@
+stderr("File $filename not found");
+ return FALSE;
+ }
+ return fopen ($filename, 'r');
+ }
+
+ public function actionIndex() {
+ $new_products = $linked_products = 0;
+
+ $db = yii::$app->db;
+
+ if ( !($handle = $this->getProductsFile()) ) {
+ return Controller::EXIT_CODE_ERROR;
+ }
+
+ $j = 0;
+
+ while (($data = fgetcsv ($handle, 10000, ";")) !== FALSE)
+ {
+ $j++;
+
+ foreach ($data as &$value)
+ {
+ //$value = mb_convert_encoding ($value, "UTF-8", mb_detect_encoding ($value));
+ $value = iconv ('windows-1251', "UTF-8//TRANSLIT//IGNORE", $value);
+ $value = trim ($value);
+ }
+
+ // будет всегда 19 элементов
+ for ($i = 0; $i <= 18; $i++)
+ {
+ if (! isset ($data[$i]))
+ {
+ $data[$i] = null;
+ }
+ }
+
+ // 1 Группа (категория)
+ $catalog_name = $data[0];
+ if (empty ($catalog_name))
+ {
+ CONTINUE;
+ }
+
+ // 2 Бренд
+ $brand_name = $data[1];
+ if (empty ($brand_name))
+ {
+ CONTINUE;
+ }
+
+ // 3 Название товара
+ $product_name = $data[2];
+ if (empty ($product_name))
+ {
+ CONTINUE;
+ }
+
+ // 4 Описание Укр
+ $product_body_uk = $data[3];
+
+ // 5 Описание Рус
+ $product_body_ru = $data[4];
+
+ // 6 Фильтр (через запятую)
+ $filters = explode (',', $data[5]);
+
+ // 7 Доп фильтр через запятую
+ $filters_extra = explode (',', $data[6]);
+
+ // 8 Пол череззапятую (мужской, женский, детский, унисекс)
+ $gender = explode (',', $data[7]);
+
+ // 9 Год
+ $years = explode (',', $data[8]);
+
+ // 10 Цена старая
+ $product_cost_old = $data[9];
+
+ // 11 Цена
+ $produc_cost = $data[10];
+
+ // 12 Акция
+ $product_akciya = (bool)$data[11];
+
+ // 13 Сопуд. Тов.
+ $similar = explode (',', $data[12]);
+
+ // 14 Новинки
+ $product_new = (bool)$data[13];
+
+ // 15 Топ продаж
+ $product_top = (bool)$data[14];
+
+ // 16 Сетка Характеристик
+ $feature = explode ('=', $data[15]);
+
+ // 17 ВИДЕО КОД
+ $product_video = $data[16];
+
+ // 18 Галлерея фото
+ $fotos = explode (',', $data[17]);
+
+ // 19 Штрих код товара.
+ // расшифровал - это модификации товара!
+
+ $product_image = explode ('=', $data[18]);
+ $product_image = @$product_image[3];
+
+ if ( ($_product = Product::find()->filterWhere(['ilike', 'name', trim($product_name)])->one()) === null ) {
+ $_product = new Product();
+ }
+
+ // ==== Set category ====
+ if ( ($category = CategoryName::find()->filterWhere(['ilike', 'value', trim($catalog_name)])->one()) !== null ) {
+ $_product->categories = [$category->category_id];
+ } else {
+ // Create category
+ $category = new Category();
+ $category->name = trim($catalog_name);
+ $category->save();
+ $_product->categories = [$category->category_id];
+ }
+
+ // ===== Set brand ====
+ if ( $brand_name ) {
+ if ( ($brand = BrandName::find()->filterWhere(['ilike', 'value', trim($brand_name)])->one()) !== null ) {
+ $_product->brand_id = $brand->brand_id;
+ } else {
+ // Create brand
+ $brand = new Brand();
+ $brand->name = trim($brand_name);
+ $brand->save();
+ $_product->brand_id = $brand->brand_id;
+ }
+ }
+
+ $_product->name = $product_name;
+ $_product->video = $product_video;
+ $_product->description = $product_body_ru;
+ $_product->top = $product_top;
+ $_product->akciya = $product_akciya;
+ $_product->new = $product_new;
+
+
+ $_product->save();
+
+
+ // @todo Set image
+ /*// картинки
+ if (is_file ($dir.'/mod/' . $product_image))
+ {
+ $resizeObj = new resize ($dir.'/mod/' . $product_image);
+ $resizeObj->resizeImage (135, 200, 'auto');
+ $resizeObj->saveImage ($dir.'/products/ico/' . $product_image, 100);
+ $resizeObj->resizeImage (370, 370, 'auto');
+ $resizeObj->saveImage ($dir.'/products/big/' . $product_image, 100);
+ }*/
+
+ // ==== mods ====
+
+ // (типа штрих код товара)
+
+ // нужно для проставления характеристик относящихся к модификациям
+ $MOD_ARRAY = [];
+
+ for ($i = 18; $i < count ($data); $i ++)
+ {
+ if (! empty ($data[$i]))
+ {
+ $mod_arr = explode ('=', $data[$i]);
+ $mod_art = $mod_arr[0];
+ $mod_size = $mod_arr[1];
+ $mod_color = $mod_arr[2];
+ $mod_image = $mod_arr[3];
+ $mod_cost = $produc_cost;
+ $mod_old_cost = $product_cost_old;
+
+ // Check product variant
+ if ( ($_productVariant = ProductVariant::find()->andWhere(['ilike', 'sku', $mod_art])->andWhere(['product_id' => $_product->product_id])->one()) === null ) {
+ $_productVariant = new ProductVariant();
+ $_productVariant->product_id = $_product->product_id;
+ }
+
+ $_productVariant->sku = $mod_art;
+ $_productVariant->price = $mod_cost;
+ $_productVariant->price_old = $mod_old_cost;
+
+ $_productVariant->save();
+
+ $MOD_ARRAY[] = $_productVariant->product_variant_id;
+
+
+ $dir = Yii::getAlias('@productsDir').'/';
+ if (is_file ($dir . $mod_image))
+ {
+ $resizeObj = new resize ($dir . $mod_image);
+ $resizeObj->resizeImage (40, 40, 'crop');
+ $resizeObj->saveImage ($dir.'ico/' . $mod_image, 100);
+ $resizeObj->resizeImage (370, 370, 'auto');
+ $resizeObj->saveImage ($dir.'/big/' . $mod_image, 100);
+ }
+
+ $product_variant_type_name = '';
+ if (! empty ($mod_color))
+ $product_variant_type_name = 'Цвет';
+ elseif (! empty ($mod_size))
+ $product_variant_type_name = 'Размер';
+
+ // ===== Set variant type ====
+ if ( $product_variant_type_name ) {
+ if ( ($product_variant_type = ProductVariantType::find()->filterWhere(['ilike', 'name', $product_variant_type_name])->one()) !== null ) {
+ $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
+ } else {
+ // Create brand
+ $product_variant_type = new ProductVariantType();
+ $product_variant_type->name = $product_variant_type_name;
+ $product_variant_type->save();
+ $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
+ }
+ }
+ }
+ }
+
+ /*// ==== fotos ====
+
+ foreach ($fotos as $foto)
+ {
+ $fields = [
+ 'product_id' => $product_id,
+ 'image' => $foto
+ ];
+
+ $modelFotos = Fotos::find ()
+ ->where ('image=:image', [
+ ':image' => $foto
+ ])
+ ->one ();
+
+ if (empty ($modelFotos->id))
+ {
+ $db->createCommand ()
+ ->insert ('products_fotos', $fields)
+ ->execute ();
+ }
+ else
+ {
+ $db->createCommand ()
+ ->update ('products_fotos', $fields, 'id = ' . $modelFotos->id)
+ ->execute ();
+ }
+
+ if (is_file ($dir.'/fotos/' . $foto))
+ {
+ $resizeObj = new resize ($dir.'/fotos/' . $foto);
+ $resizeObj->resizeImage (100, 100, 'crop');
+ $resizeObj->saveImage ($dir.'/fotos/ico/' . $foto, 100);
+ $resizeObj->resizeImage (400, 400, 'crop');
+ $resizeObj->saveImage ($dir.'/fotos/big/' . $foto, 100);
+ }
+ }*/
+
+ // ========================
+ // ==== ХАРАКТЕРИСТИКИ ====
+ // ========================
+
+ // есть общие характеристики, которые относятся product_id, такие как brand, gender...
+ // есть характеристики, которые относятся mod_id, такие как цвет, размер...
+
+ // ==== gender ====
+
+ /*if (! empty ($gender))
+ {
+ $bookGender = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'gender'
+ ])
+ ->one ();
+
+ foreach ($gender as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookGenderValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookGender->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookGenderValue->book_value_id) || empty ($bookGenderValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookGender->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookGenderValue->book_value_id;
+ }
+
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE products_value
+ SET
+ product_id = '.(int)$product_id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+
+ // есть характеристики, которые относятся mod_id, такие как цвет, размер...
+
+ // ==== destination ====
+
+ if (! empty ($filters))
+ {
+ $bookDestination = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'destination'
+ ])
+ ->one ();
+
+ foreach ($filters as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookDestinationValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookDestination->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookDestinationValue->book_value_id) || empty ($bookDestinationValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookDestination->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookDestinationValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }
+
+ // ==== special ====
+
+ if (! empty ($filters_extra))
+ {
+ $bookSpecial = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'special'
+ ])
+ ->one ();
+
+ foreach ($filters_extra as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookSpecialValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookSpecial->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookSpecialValue->book_value_id) || empty ($bookSpecialValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookSpecial->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookSpecialValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }
+
+ // ==== year ====
+
+ if (! empty ($years))
+ {
+ $bookYear = Book::find ()
+ ->where ('book_alias=:book', [
+ ':book' => 'year'
+ ])
+ ->one ();
+
+ foreach ($years as $filter)
+ {
+ if (! empty ($filter))
+ {
+ $bookYearValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $bookYear->book_id,
+ ':value' => $filter,
+ ':alias' => Translite::rusencode ($filter),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookYearValue->book_value_id) || empty ($bookYearValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $bookYear->book_id,
+ 'book_value_title' => $filter,
+ 'book_value_alias' => Translite::rusencode ($filter),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookYearValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }
+
+ // ==== $feature ====
+
+ if (! empty ($feature))
+ {
+ foreach ($feature as $string)
+ {
+ $string = str_replace([':', '.'], '', $string);
+
+ if (! empty ($string))
+ {
+ list ($book_title, $value_title) = explode ('*', $string);
+
+ $book_title = trim ($book_title);
+ $value_title = trim ($value_title);
+
+ if (empty ($book_title) || empty ($value_title))
+ {
+ CONTINUE;
+ }
+
+ $bookFeature = Book::find ()
+ ->where ('book_title=:book', [
+ ':book' => $book_title
+ ])
+ ->one ();
+
+ if (! isset ($bookFeature->book_id) || empty ($bookFeature->book_id))
+ {
+ $db->createCommand ()
+ ->insert (Book::tableName (), [
+ 'book_title' => $book_title,
+ 'book_alias' => Translite::rusencode ($book_title),
+ ])
+ ->execute ();
+
+ $book_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_id = $bookFeature->book_id;
+ }
+
+ $bookFeatureValue = BookValue::find ()
+ ->where ('
+ book_id=:book
+ AND book_value_title=:value
+ AND book_value_alias=:alias
+ ', [
+ ':book' => $book_id,
+ ':value' => $value_title,
+ ':alias' => Translite::rusencode ($value_title),
+ ]
+ )
+ ->one();
+
+ if (! isset ($bookFeatureValue->book_value_id) || empty ($bookFeatureValue->book_value_id))
+ {
+ $db->createCommand ()
+ ->insert (BookValue::tableName (), [
+ 'book_id' => $book_id,
+ 'book_value_title' => $value_title,
+ 'book_value_alias' => Translite::rusencode ($value_title),
+ ])
+ ->execute ();
+
+ $book_value_id = Yii::$app->db->lastInsertID;
+ }
+ else
+ {
+ $book_value_id = $bookFeatureValue->book_value_id;
+ }
+
+ if (! empty ($MOD_ARRAY))
+ {
+ foreach ($MOD_ARRAY as $id)
+ {
+ // + products_value
+ $db->createCommand ('
+ INSERT IGNORE mod_value
+ SET
+ mod_id = '.(int)$id.',
+ book_value_id = '.(int)$book_value_id.'
+ ')
+ ->execute ();
+ }
+ }
+ }
+ }
+ }*/
+
+ // ==== IMPORTANT ====
+
+ // записуем ID обработанной записи
+
+ $_product->save();
+ $this->stdout("$j: Product {$_product->name} saved\n");
+ /*if ($j > 100) {
+ $this->stdout("Dev OK");
+ exit;
+ }*/
+ }
+
+ fclose ($handle);
+
+ return Controller::EXIT_CODE_NORMAL;
+ }
+
+ public function goProducts() {
+
+ }
+}
\ No newline at end of file
diff --git a/console/migrations/m130524_201442_init.php b/console/migrations/m130524_201442_init.php
new file mode 100644
index 0000000..bb7e48a
--- /dev/null
+++ b/console/migrations/m130524_201442_init.php
@@ -0,0 +1,33 @@
+db->driverName === 'mysql') {
+ // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+ }
+
+ $this->createTable('{{%user}}', [
+ 'id' => $this->primaryKey(),
+ 'username' => $this->string()->notNull()->unique(),
+ 'auth_key' => $this->string(32)->notNull(),
+ 'password_hash' => $this->string()->notNull(),
+ 'password_reset_token' => $this->string()->unique(),
+ 'email' => $this->string()->notNull()->unique(),
+
+ 'status' => $this->smallInteger()->notNull()->defaultValue(10),
+ 'created_at' => $this->integer()->notNull(),
+ 'updated_at' => $this->integer()->notNull(),
+ ], $tableOptions);
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%user}}');
+ }
+}
diff --git a/console/migrations/m160126_071717_rubrication.php b/console/migrations/m160126_071717_rubrication.php
new file mode 100644
index 0000000..d88eb02
--- /dev/null
+++ b/console/migrations/m160126_071717_rubrication.php
@@ -0,0 +1,135 @@
+db->driverName === 'mysql') {
+ // Only for MySQL
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+
+ // @todo https://habrahabr.ru/post/138947/
+ } elseif ($this->db->driverName === 'pgsql') {
+ // Only for PostgreSQL
+ // @todo use intarray field for tax_options
+ }
+ $this->createTable('{{%tax_group}}', [
+ 'tax_group_id' => $this->primaryKey(),
+ 'alias' => $this->string(50)->notNull(),
+ 'name' => $this->string(255)->notNull(),
+ 'description' => $this->text(),
+ 'module' => $this->string(50)->notNull(),
+ 'hierarchical' => $this->boolean()->notNull()->defaultValue(false),
+ 'settings' => $this->text()
+ ], $tableOptions);
+
+ $this->createTable('{{%tax_option}}', [
+ 'tax_option_id' => $this->bigPrimaryKey(),
+ 'tax_group_id' => $this->integer()->notNull(),
+ 'parent_id' => $this->integer()->notNull()->defaultValue(0),
+ 'path' => $this->string(),
+ 'depth' => $this->integer(),
+ 'sort' => $this->integer()->notNull()->defaultValue(0),
+ 'default_value' => $this->integer(),
+ 'alias' => $this->string(50)->notNull()->defaultValue(''),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_option_tax_group_id', 'tax_option', 'tax_group_id', 'tax_group', 'tax_group_id', 'CASCADE', 'CASCADE');
+
+ $this->createTable('{{%tax_group_to_group}}', [
+ 'tax_group1_id' => $this->integer()->notNull(),
+ 'tax_group2_id' => $this->integer()->notNull(),
+ 'alias' => $this->string(50)->notNull(),
+ 'sort' => $this->integer(),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_group_to_group1', 'tax_group_to_group', 'tax_group1_id', 'tax_group', 'tax_group_id', 'CASCADE', 'CASCADE');
+ $this->addForeignKey('fki_tax_group_to_group2', 'tax_group_to_group', 'tax_group2_id', 'tax_group', 'tax_group_id', 'CASCADE', 'CASCADE');
+ $this->addPrimaryKey('pki_tax_group_to_group', 'tax_group_to_group', ['tax_group1_id', 'tax_group2_id', 'alias']);
+
+ $this->createTable('{{%tax_option_to_group}}', [
+ 'tax_option_id' => $this->integer()->notNull(),
+ 'tax_group_id' => $this->integer()->notNull(),
+ 'alias' => $this->string(50)->notNull(),
+ 'sort' => $this->integer(),
+ ], $tableOptions);
+ $this->addForeignKey('tax_option_to_group_option_id', 'tax_option_to_group', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+ $this->addForeignKey('tax_option_to_group_group_id', 'tax_option_to_group', 'tax_group_id', 'tax_group', 'tax_group_id', 'CASCADE', 'CASCADE');
+ $this->addPrimaryKey('pki_tax_option_to_group', 'tax_option_to_group', ['tax_option_id', 'tax_group_id', 'alias']);
+
+ $this->createTable('{{%tax_option_to_option}}', [
+ 'tax_option1_id' => $this->integer()->notNull(),
+ 'tax_option2_id' => $this->integer()->notNull(),
+ 'alias' => $this->string(50)->notNull(),
+ 'sort' => $this->integer(),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_option_to_option1', 'tax_option_to_option', 'tax_option1_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+ $this->addForeignKey('fki_tax_option_to_option2', 'tax_option_to_option', 'tax_option2_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+ $this->addPrimaryKey('pki_tax_option_to_option', 'tax_option_to_option', ['tax_option1_id', 'tax_option2_id', 'alias']);
+
+ /*$this->createTable('{{%tax_entity_relation}}', [
+ 'tax_option_id' => $this->integer()->notNull(),
+ 'entity_id' => $this->integer()->notNull(),
+ 'entity_table_name' => $this->string(50)->notNull(),
+ 'entity_key_name' => $this->string(50)->notNull(),
+ 'alias' => $this->string(50)->notNull(),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_entity_relation_option_id', 'tax_entity_relation', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+ $this->addPrimaryKey('pki_tax_entity_relation', 'tax_entity_relation', ['tax_option_id', 'entity_id', 'entity_table_name', 'entity_key_name', 'alias']);*/
+
+ $this->createTable('{{%tax_value_int}}', [
+ 'tax_value_id' => $this->primaryKey(),
+ 'tax_option_id' => $this->integer()->notNull(),
+ 'value' => $this->integer(),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_value_int_option_id', 'tax_value_int', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+
+ $this->createTable('{{%tax_value_string}}', [
+ 'tax_value_id' => $this->primaryKey(),
+ 'tax_option_id' => $this->integer()->notNull(),
+ 'value' => $this->string(),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_value_string_option_id', 'tax_value_string', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+
+ $this->createTable('{{%tax_value_text}}', [
+ 'tax_value_id' => $this->primaryKey(),
+ 'tax_option_id' => $this->integer()->notNull(),
+ 'value' => $this->text(),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_value_text_option_id', 'tax_value_text', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+
+ $this->createTable('{{%tax_value_float}}', [
+ 'tax_value_id' => $this->bigPrimaryKey(),
+ 'tax_option_id' => $this->integer()->notNull(),
+ 'value' => $this->float(),
+ ], $tableOptions);
+ $this->addForeignKey('fki_tax_value_float_option_id', 'tax_value_float', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
+ }
+
+ public function safeDown()
+ {
+ $this->dropTable('{{%tax_value_int}}');
+ $this->dropTable('{{%tax_value_string}}');
+ $this->dropTable('{{%tax_value_text}}');
+ $this->dropTable('{{%tax_value_float}}');
+// $this->dropTable('{{%tax_entity_relation}}');
+ $this->dropTable('{{%tax_group_to_group}}');
+ $this->dropTable('{{%tax_option_to_group}}');
+ $this->dropTable('{{%tax_option_to_option}}');
+ $this->dropTable('{{%tax_option}}');
+ $this->dropTable('{{%tax_group}}');
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160128_101543_fields.php b/console/migrations/m160128_101543_fields.php
new file mode 100644
index 0000000..0c6b960
--- /dev/null
+++ b/console/migrations/m160128_101543_fields.php
@@ -0,0 +1,29 @@
+createTable('{{%fields}}', [
+ 'id' => $this->primaryKey(),
+ 'table_name' => $this->string(255)->notNull(),
+ 'table_id' => $this->integer(),
+ 'value' => $this->string(255),
+ 'field_name' => $this->string(),
+ 'field_type' => $this->string(32)->notNull(),
+ 'language' => $this->string(3),
+ 'key' => $this->integer(),
+ 'parent_key' => $this->integer()
+ ], $tableOptions);
+
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%fields}}');
+ }
+}
diff --git a/console/migrations/m160208_111900_blog.php b/console/migrations/m160208_111900_blog.php
new file mode 100644
index 0000000..12bcf1d
--- /dev/null
+++ b/console/migrations/m160208_111900_blog.php
@@ -0,0 +1,30 @@
+createTable('{{%blog}}', [
+ 'blog_id' => $this->primaryKey(),
+ 'user_id' => $this->integer()->notNull(),
+ 'name' => $this->string(255)->notNull(),
+ 'link' => $this->string(255),
+ 'date_add' => $this->timestamp()->notNull(),
+ 'user_add_id' => $this->integer(),
+ 'view_count' => $this->integer()->defaultValue(0),
+ 'description' => $this->text(),
+ 'cover' => $this->string(255),
+ ], $tableOptions);
+
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%blog}}');
+ }
+
+}
diff --git a/console/migrations/m160304_054017_realtion.php b/console/migrations/m160304_054017_realtion.php
new file mode 100644
index 0000000..f1fe66b
--- /dev/null
+++ b/console/migrations/m160304_054017_realtion.php
@@ -0,0 +1,44 @@
+db->driverName === 'mysql') {
+ // Only for MySQL
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+
+ // @todo https://habrahabr.ru/post/138947/
+ } elseif ($this->db->driverName === 'pgsql') {
+ // Only for PostgreSQL
+ // @todo use intarray field for tax_options
+ }
+ $this->createTable('{{%relation}}', [
+ 'alias' => $this->string(50)->notNull(),
+ 'entity1_id' => $this->integer()->notNull(),
+ 'entity2_id' => $this->integer()->notNull(),
+ ], $tableOptions);
+ $this->addPrimaryKey('relation_ukey', 'relation', ['alias', 'entity1_id', 'entity2_id']);
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%relation}}');
+
+ return false;
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160304_065108_product.php b/console/migrations/m160304_065108_product.php
new file mode 100644
index 0000000..41a175c
--- /dev/null
+++ b/console/migrations/m160304_065108_product.php
@@ -0,0 +1,135 @@
+db->driverName === 'mysql') {
+ // Only for MySQL
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+
+ // @todo https://habrahabr.ru/post/138947/
+ } elseif ($this->db->driverName === 'pgsql') {
+ // Only for PostgreSQL
+ // @todo use intarray field for tax_options
+ }
+
+ $this->createTable('{{%category_name}}', [
+ 'category_name_id' => $this->primaryKey(),
+ 'category_id' => $this->integer()->notNull(),
+ 'value' => $this->string(250),
+ ], $tableOptions);
+
+ $this->createTable('{{%category}}', [
+ 'category_id' => $this->primaryKey(),
+ 'parent_id' => $this->integer()->notNull()->defaultValue(0),
+ 'path' => 'INT[]',
+ 'depth' => $this->integer()->notNull()->defaultValue(0),
+ 'alias' => $this->string(250),
+ 'image' => $this->string(255),
+ 'meta_title' => $this->string(255),
+ 'meta_desc' => $this->text(),
+ 'meta_robots' => $this->string(50),
+ 'seo_text' => $this->text(),
+ 'category_name_id' => $this->integer(),
+ 'product_unit_id' => $this->integer()
+ ], $tableOptions);
+
+ $this->addForeignKey('category_name_fkey', 'category', 'category_name_id', 'category_name', 'category_name_id', 'CASCADE', 'CASCADE');
+ $this->addForeignKey('category_name_category_fkey', 'category_name', 'category_id', 'category', 'category_id', 'NO ACTION', 'NO ACTION');
+
+ $this->createTable('{{%product_category}}', [
+ 'product_id' => $this->integer()->notNull(),
+ 'category_id' => $this->integer()->notNull(),
+ ], $tableOptions);
+
+ $this->createTable('{{%brand_name}}', [
+ 'brand_name_id' => $this->primaryKey(),
+ 'brand_id' => $this->integer()->notNull(),
+ 'value' => $this->string(250),
+ ], $tableOptions);
+
+ $this->createTable('{{%brand}}', [
+ 'brand_id' => $this->primaryKey(),
+ 'brand_name_id' => $this->integer(),
+ 'alias' => $this->string(250),
+ 'image' => $this->string(255),
+ 'meta_title' => $this->string(255),
+ 'meta_desc' => $this->text(),
+ 'meta_robots' => $this->string(50),
+ 'seo_text' => $this->text(),
+ ], $tableOptions);
+
+ $this->addForeignKey('brand_name_fkey', 'brand', 'brand_name_id', 'brand_name', 'brand_name_id', 'CASCADE', 'CASCADE');
+ $this->addForeignKey('brand_name_brand_fkey', 'brand_name', 'brand_id', 'brand', 'brand_id', 'NO ACTION', 'NO ACTION');
+
+ $this->createTable('{{%product}}', [
+ 'product_id' => $this->primaryKey(),
+ 'name' => $this->string(255)->notNull(),
+ 'alias' => $this->string(255),
+ 'brand_id' => $this->integer(),
+ 'description' => $this->text(),
+ 'video' => $this->text(),
+ ], $tableOptions);
+
+ $this->addForeignKey('fki_product_id', 'product_category', 'product_id', 'product', 'product_id', 'NO ACTION', 'NO ACTION');
+ $this->addForeignKey('fki_category_id', 'product_category', 'category_id', 'category', 'category_id', 'NO ACTION', 'NO ACTION');
+ $this->addForeignKey('fki_brand_id', 'product', 'brand_id', 'brand', 'brand_id', 'NO ACTION', 'CASCADE');
+
+ $this->createTable('{{%product_variant}}', [
+ 'product_variant_id' => $this->primaryKey(),
+ 'product_id' => $this->integer()->notNull(),
+ 'name' => $this->string(255)->notNull(),
+ 'sku' => $this->string(255)->notNull(),
+ 'price' => $this->float(),
+ 'price_old' => $this->float(),
+ 'stock' => $this->float(),
+ 'product_unit_id' => $this->integer()->notNull(),
+ ], $tableOptions);
+
+ $this->createTable('{{%product_unit}}', [
+ 'product_unit_id' => $this->primaryKey(),
+ 'name' => $this->string(255)->notNull(),
+ 'code' => $this->string(50)->notNull(),
+ 'is_default' => $this->boolean()
+ ], $tableOptions);
+//
+ $this->addForeignKey('product_variant_product_unit_fkey', 'product_variant', 'product_unit_id', 'product_unit', 'product_unit_id', 'CASCADE', 'NO ACTION');
+ $this->addForeignKey('category_product_unit_fkey', 'category', 'product_unit_id', 'product_unit', 'product_unit_id', 'NO ACTION', 'NO ACTION');
+ }
+
+ public function down()
+ {
+ $this->dropForeignKey('category_name_fkey', 'category');
+ $this->dropForeignKey('category_name_category_fkey', 'category_name');
+ $this->dropForeignKey('brand_name_fkey', 'brand');
+ $this->dropForeignKey('brand_name_brand_fkey', 'brand_name');
+ $this->dropForeignKey('fki_product_id', 'product_category');
+ $this->dropForeignKey('fki_category_id', 'product_category');
+ $this->dropForeignKey('fki_brand_id', 'product');
+ $this->dropForeignKey('product_variant_product_unit_fkey', 'product_variant');
+ $this->dropForeignKey('category_product_unit_fkey', 'category');
+ $this->dropTable('{{%category}}');
+ $this->dropTable('{{%category_name}}');
+ $this->dropTable('{{%product_category}}');
+ $this->dropTable('{{%product}}');
+ $this->dropTable('{{%product_variant}}');
+ $this->dropTable('{{%product_unit}}');
+ $this->dropTable('{{%brand_name}}');
+ $this->dropTable('{{%brand}}');
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160320_174258_customer.php b/console/migrations/m160320_174258_customer.php
new file mode 100644
index 0000000..172287b
--- /dev/null
+++ b/console/migrations/m160320_174258_customer.php
@@ -0,0 +1,35 @@
+db->driverName === 'mysql') {
+ // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+ }
+
+ $this->createTable('{{%customers}}', [
+ 'id' => $this->primaryKey(),
+ 'username' => $this->string()->notNull(),
+ 'surname' => $this->string(),
+ 'auth_key' => $this->string(32)->notNull(),
+ 'password_hash' => $this->string()->notNull(),
+ 'password_reset_token' => $this->string()->unique(),
+ 'email' => $this->string()->notNull()->unique(),
+ 'phone' => $this->string()->notNull()->unique(),
+ 'status' => $this->smallInteger()->notNull()->defaultValue(10),
+ 'created_at' => $this->integer()->notNull(),
+ 'updated_at' => $this->integer()->notNull(),
+ ], $tableOptions);
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%customers}}');
+ }
+
+}
diff --git a/console/migrations/m160321_232402_orders.php b/console/migrations/m160321_232402_orders.php
new file mode 100644
index 0000000..13e6251
--- /dev/null
+++ b/console/migrations/m160321_232402_orders.php
@@ -0,0 +1,49 @@
+db->driverName === 'mysql') {
+ // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+ }
+
+ $this->createTable('{{%orders}}', [
+ 'order_id' => $this->primaryKey(),
+ 'customer_id' => $this->integer(),
+ 'name' => $this->string()->notNull(),
+ 'email' => $this->string()->notNull(),
+ 'phone' => $this->string(32)->notNull(),
+ 'delivery' => $this->integer(),
+ 'payment' => $this->integer(),
+ 'code' => $this->string(),
+ 'status' => $this->smallInteger(),
+ 'created_at' => $this->integer()->notNull(),
+ 'updated_at' => $this->integer()->notNull(),
+ ], $tableOptions);
+
+ $this->createTable('{{%order_items}}', [
+ 'order_items_id' => $this->primaryKey(),
+ 'order_id' => $this->integer(),
+ 'item_id' => $this->integer(),
+ 'item_count' => $this->integer(),
+ 'price' => $this->float(),
+ ], $tableOptions);
+
+ $this->addForeignKey('orders_items_fk', '{{%order_items}}', 'order_id', '{{%orders}}', 'order_id', 'CASCADE', 'CASCADE');
+ $this->addForeignKey('orders_items_items_fk', '{{%order_items}}', 'item_id', '{{%product}}', 'product_id', 'RESTRICT', 'RESTRICT');
+ }
+
+ public function down()
+ {
+ $this->dropForeignKey('orders_items_fk', '{{%order_items}}');
+ $this->dropForeignKey('orders_items_items_fk', '{{%order_items}}');
+ $this->dropTable('{{%orders}}');
+ $this->dropTable('{{%order_items}}');
+ }
+
+}
diff --git a/console/migrations/m160323_234304_product_image.php b/console/migrations/m160323_234304_product_image.php
new file mode 100644
index 0000000..9b5a4f0
--- /dev/null
+++ b/console/migrations/m160323_234304_product_image.php
@@ -0,0 +1,45 @@
+db->driverName === 'mysql') {
+ // Only for MySQL
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+
+ // @todo https://habrahabr.ru/post/138947/
+ } elseif ($this->db->driverName === 'pgsql') {
+ // Only for PostgreSQL
+ // @todo use intarray field for tax_options
+ }
+
+ $this->createTable('{{%product_image}}', [
+ 'product_image_id' => $this->integer()->notNull(),
+ 'product_id' => $this->integer()->notNull(),
+ 'image' => $this->string(255),
+ 'alt' => $this->string(255),
+ 'title' => $this->string(255),
+ ], $tableOptions);
+ $this->addForeignKey('product_image_product_fkey', 'product_image', 'product_id', 'product', 'product_id', 'CASCADE', 'CASCADE');
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%product_image}}');
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160324_075409_product_option.php b/console/migrations/m160324_075409_product_option.php
new file mode 100644
index 0000000..54f0373
--- /dev/null
+++ b/console/migrations/m160324_075409_product_option.php
@@ -0,0 +1,44 @@
+db->driverName === 'mysql') {
+ // Only for MySQL
+ $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
+
+ // @todo https://habrahabr.ru/post/138947/
+ } elseif ($this->db->driverName === 'pgsql') {
+ // Only for PostgreSQL
+ // @todo use intarray field for tax_options
+ }
+
+ $this->createTable('{{%product_option}}', [
+ 'product_id' => $this->integer()->notNull(),
+ 'option_id' => $this->integer()->notNull(),
+ ], $tableOptions);
+ $this->addPrimaryKey('product_option_pkey', 'product_option', ['product_id', 'option_id']);
+ $this->addForeignKey('product_option_product_fkey', 'product_option', 'product_id', 'product', 'product_id', 'NO ACTION', 'NO ACTION');
+ $this->addForeignKey('product_option_option_fkey', 'product_option', 'option_id', 'tax_option', 'tax_option_id', 'NO ACTION', 'NO ACTION');
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%product_option}}');
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/console/migrations/m160324_114404_orders_items_items_fk.php b/console/migrations/m160324_114404_orders_items_items_fk.php
new file mode 100644
index 0000000..997b0ae
--- /dev/null
+++ b/console/migrations/m160324_114404_orders_items_items_fk.php
@@ -0,0 +1,21 @@
+dropForeignKey('orders_items_items_fk', '{{%order_items}}');
+ $this->addForeignKey('orders_items_items_fk', '{{%order_items}}', 'item_id', '{{%product_variant}}', 'product_variant_id', 'RESTRICT', 'RESTRICT');
+ }
+
+ public function down()
+ {
+ $this->dropForeignKey('orders_items_items_fk', '{{%order_items}}');
+ $this->addForeignKey('orders_items_items_fk', '{{%order_items}}', 'item_id', '{{%product}}', 'product_id', 'RESTRICT', 'RESTRICT');
+
+ }
+
+}
diff --git a/console/migrations/m160331_132149_slider.php b/console/migrations/m160331_132149_slider.php
new file mode 100644
index 0000000..8113dec
--- /dev/null
+++ b/console/migrations/m160331_132149_slider.php
@@ -0,0 +1,26 @@
+createTable('{{%slider}}', [
+ 'slider_id' => $this->primaryKey(),
+ 'speed' => $this->integer(4),
+ 'duration' => $this->integer(4),
+ 'title' => $this->string(200),
+ 'status' => $this->smallInteger(1),
+ 'width' => $this->integer(4),
+ 'height' => $this->integer(4),
+ ]);
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%slider}}');
+ }
+
+
+}
diff --git a/console/migrations/m160404_081649_banner.php b/console/migrations/m160404_081649_banner.php
new file mode 100644
index 0000000..29a67a8
--- /dev/null
+++ b/console/migrations/m160404_081649_banner.php
@@ -0,0 +1,26 @@
+createTable('{{%banner}}', [
+ 'banner_id' => $this->primaryKey(),
+ 'image' => $this->string(255),
+ 'alt' => $this->string(255),
+ 'title' => $this->string(255),
+ 'url' => $this->string(255),
+ 'status' => $this->smallInteger(1),
+ 'width' => $this->integer(4),
+ 'height' => $this->integer(4),
+ ]);
+ }
+
+ public function down()
+ {
+ $this->dropTable('{{%banner}}');
+ }
+
+}
diff --git a/console/migrations/m160405_101056_create_slider_images.php b/console/migrations/m160405_101056_create_slider_images.php
new file mode 100644
index 0000000..6259c3b
--- /dev/null
+++ b/console/migrations/m160405_101056_create_slider_images.php
@@ -0,0 +1,37 @@
+createTable('slider_image', [
+ 'slider_image_id' => $this->primaryKey(),
+ 'slider_id' => $this->integer(),
+ 'image' => $this->string(255),
+ 'alt' => $this->string(255),
+ 'title' => $this->string(255),
+ 'url' => $this->string(255),
+ 'status' => $this->smallInteger(1),
+ 'sort' => $this->integer(6),
+ 'price' => $this->float(),
+ ]);
+ $this->addForeignKey('slider_slider_image_fk', 'slider_image', 'slider_id', 'slider', 'slider_id', 'CASCADE', 'CASCADE');
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropForeignKey('slider_slider_image_fk', '{{%slider_image}}');
+ $this->dropTable('slider_image');
+ }
+}
diff --git a/console/migrations/m160406_221846_create_page.php b/console/migrations/m160406_221846_create_page.php
new file mode 100644
index 0000000..230ba43
--- /dev/null
+++ b/console/migrations/m160406_221846_create_page.php
@@ -0,0 +1,48 @@
+createTable('page', [
+ 'id' => $this->primaryKey(),
+ 'name'=> $this->string(),
+ 'alias'=> $this->string(),
+ 'title' => $this->string(),
+ 'body'=> $this->text(),
+ 'meta_title'=> $this->string(),
+ 'description' => $this->string(),
+ 'h1'=> $this->string(),
+ 'seo_text'=> $this->text(),
+
+ ]);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropTable('page');
+ }
+}
diff --git a/console/migrations/m160407_185510_create_event.php b/console/migrations/m160407_185510_create_event.php
new file mode 100644
index 0000000..9d0973f
--- /dev/null
+++ b/console/migrations/m160407_185510_create_event.php
@@ -0,0 +1,38 @@
+createTable('event', [
+ 'event_id' => $this->primaryKey(),
+ 'name'=> $this->string(),
+ 'alias'=> $this->string(),
+ 'body'=> $this->text(),
+ 'image' => $this->string(),
+ 'meta_title'=> $this->string(),
+ 'description' => $this->string(),
+ 'h1'=> $this->string(),
+ 'seo_text'=> $this->text(),
+ 'created_at' => $this->integer(),
+ 'updated_at' => $this->integer(),
+ 'end_at' => $this->integer(),
+ ]);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropTable('event');
+ }
+}
diff --git a/console/migrations/m160411_211053_create_service.php b/console/migrations/m160411_211053_create_service.php
new file mode 100644
index 0000000..4097776
--- /dev/null
+++ b/console/migrations/m160411_211053_create_service.php
@@ -0,0 +1,37 @@
+createTable('service', [
+ 'service_id' => $this->primaryKey(),
+ 'name'=> $this->string()->notNull(),
+ 'alias'=> $this->string(),
+ 'body'=> $this->text()->notNull(),
+ 'image' => $this->string(),
+ 'meta_title'=> $this->string(),
+ 'description' => $this->string(),
+ 'h1'=> $this->string(),
+ 'seo_text'=> $this->text(),
+ 'created_at' => $this->integer(),
+ 'updated_at' => $this->integer(),
+ ]);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropTable('service');
+ }
+}
diff --git a/console/migrations/m160411_215739_create_seo.php b/console/migrations/m160411_215739_create_seo.php
new file mode 100644
index 0000000..713653f
--- /dev/null
+++ b/console/migrations/m160411_215739_create_seo.php
@@ -0,0 +1,33 @@
+createTable('seo', [
+ 'seo_id' => $this->primaryKey(),
+ 'url'=> $this->string()->notNull(),
+ 'title'=> $this->string(),
+ 'description' => $this->string(),
+ 'h1'=> $this->string(),
+ 'seo_text'=> $this->text(),
+
+ ]);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropTable('seo');
+ }
+}
diff --git a/console/migrations/m160412_133944_create_seo_category.php b/console/migrations/m160412_133944_create_seo_category.php
new file mode 100644
index 0000000..3145f2a
--- /dev/null
+++ b/console/migrations/m160412_133944_create_seo_category.php
@@ -0,0 +1,30 @@
+createTable('seo_category', [
+ 'seo_category_id' => $this->primaryKey(),
+ 'name' => $this->string(),
+ 'controller' => $this->string(100),
+ 'status' => $this->smallInteger(1),
+ ]);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropTable('seo_category');
+ }
+}
diff --git a/console/migrations/m160413_112158_create_seo_dynamic.php b/console/migrations/m160413_112158_create_seo_dynamic.php
new file mode 100644
index 0000000..41ce24e
--- /dev/null
+++ b/console/migrations/m160413_112158_create_seo_dynamic.php
@@ -0,0 +1,39 @@
+createTable('seo_dynamic', [
+ 'seo_dynamic_id' => $this->primaryKey(),
+ 'seo_category_id' => $this->integer(),
+ 'name' => $this->string(200),
+ 'action' => $this->string(200),
+ 'fields' => $this->string(),
+ 'title' => $this->string(),
+ 'h1' => $this->string(),
+ 'description' => $this->string(),
+ 'seo_text' => $this->text(),
+ 'status' => $this->smallInteger()
+ ]);
+
+ $this->addForeignKey('seo_category_seo_dynamic_fk', 'seo_dynamic', 'seo_category_id', 'seo_category', 'seo_category_id', 'CASCADE', 'CASCADE');
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropForeignKey('seo_category_seo_dynamic_fk', '{{%seo_dynamic}}');
+ $this->dropTable('seo_dynamic');
+ }
+}
diff --git a/console/migrations/m160414_101644_add_param_to_seo_dynamic.php b/console/migrations/m160414_101644_add_param_to_seo_dynamic.php
new file mode 100644
index 0000000..59d896f
--- /dev/null
+++ b/console/migrations/m160414_101644_add_param_to_seo_dynamic.php
@@ -0,0 +1,26 @@
+addColumn('seo_dynamic', 'param', $this->string());
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropColumn('seo_dynamic', 'param');
+ }
+}
diff --git a/console/migrations/m160414_214745_add_key_to_seo_dynamic.php b/console/migrations/m160414_214745_add_key_to_seo_dynamic.php
new file mode 100644
index 0000000..14780b1
--- /dev/null
+++ b/console/migrations/m160414_214745_add_key_to_seo_dynamic.php
@@ -0,0 +1,26 @@
+addColumn('seo_dynamic', 'key', $this->string());
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+ $this->dropColumn('seo_dynamic', 'key');
+ }
+}
diff --git a/console/models/.gitkeep b/console/models/.gitkeep
new file mode 100644
index 0000000..5e4debc
--- /dev/null
+++ b/console/models/.gitkeep
@@ -0,0 +1 @@
+*
diff --git a/console/runtime/.gitignore b/console/runtime/.gitignore
new file mode 100644
index 0000000..a3a0c8b
--- /dev/null
+++ b/console/runtime/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/environments/dev/backend/config/main-local.php b/environments/dev/backend/config/main-local.php
new file mode 100644
index 0000000..b909cc5
--- /dev/null
+++ b/environments/dev/backend/config/main-local.php
@@ -0,0 +1,25 @@
+ [
+ 'request' => [
+ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
+ 'cookieValidationKey' => '',
+ ],
+ ],
+];
+
+if (!YII_ENV_TEST) {
+ // configuration adjustments for 'dev' environment
+ $config['bootstrap'][] = 'debug';
+ $config['modules']['debug'] = [
+ 'class' => 'yii\debug\Module',
+ ];
+
+ $config['bootstrap'][] = 'gii';
+ $config['modules']['gii'] = [
+ 'class' => 'yii\gii\Module',
+ ];
+}
+
+return $config;
diff --git a/environments/dev/backend/config/params-local.php b/environments/dev/backend/config/params-local.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/environments/dev/backend/config/params-local.php
@@ -0,0 +1,3 @@
+run();
diff --git a/environments/dev/backend/web/index.php b/environments/dev/backend/web/index.php
new file mode 100644
index 0000000..37d8378
--- /dev/null
+++ b/environments/dev/backend/web/index.php
@@ -0,0 +1,18 @@
+run();
diff --git a/environments/dev/common/config/main-local.php b/environments/dev/common/config/main-local.php
new file mode 100644
index 0000000..45d5ebb
--- /dev/null
+++ b/environments/dev/common/config/main-local.php
@@ -0,0 +1,20 @@
+ [
+ 'db' => [
+ 'class' => 'yii\db\Connection',
+ 'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
+ 'username' => 'root',
+ 'password' => '',
+ 'charset' => 'utf8',
+ ],
+ 'mailer' => [
+ 'class' => 'yii\swiftmailer\Mailer',
+ 'viewPath' => '@common/mail',
+ // send all mails to a file by default. You have to set
+ // 'useFileTransport' to false and configure a transport
+ // for the mailer to send real emails.
+ 'useFileTransport' => true,
+ ],
+ ],
+];
diff --git a/environments/dev/common/config/params-local.php b/environments/dev/common/config/params-local.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/environments/dev/common/config/params-local.php
@@ -0,0 +1,3 @@
+ ['gii'],
+ 'modules' => [
+ 'gii' => 'yii\gii\Module',
+ ],
+];
diff --git a/environments/dev/console/config/params-local.php b/environments/dev/console/config/params-local.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/environments/dev/console/config/params-local.php
@@ -0,0 +1,3 @@
+ [
+ 'request' => [
+ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
+ 'cookieValidationKey' => '',
+ ],
+ ],
+];
+
+if (!YII_ENV_TEST) {
+ // configuration adjustments for 'dev' environment
+ $config['bootstrap'][] = 'debug';
+ $config['modules']['debug'] = [
+ 'class' => 'yii\debug\Module',
+ ];
+ $config['bootstrap'][] = 'gii';
+ $config['modules']['gii'] = [
+ 'class' => 'yii\gii\Module',
+ ];
+}
+
+return $config;
diff --git a/environments/dev/frontend/config/params-local.php b/environments/dev/frontend/config/params-local.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/environments/dev/frontend/config/params-local.php
@@ -0,0 +1,3 @@
+run();
diff --git a/environments/dev/frontend/web/index.php b/environments/dev/frontend/web/index.php
new file mode 100644
index 0000000..37d8378
--- /dev/null
+++ b/environments/dev/frontend/web/index.php
@@ -0,0 +1,18 @@
+run();
diff --git a/environments/dev/yii b/environments/dev/yii
new file mode 100644
index 0000000..f3b4c13
--- /dev/null
+++ b/environments/dev/yii
@@ -0,0 +1,28 @@
+#!/usr/bin/env php
+run();
+exit($exitCode);
diff --git a/environments/index.php b/environments/index.php
new file mode 100644
index 0000000..286620b
--- /dev/null
+++ b/environments/index.php
@@ -0,0 +1,65 @@
+ [
+ * 'path' => 'directory storing the local files',
+ * 'skipFiles' => [
+ * // list of files that should only copied once and skipped if they already exist
+ * ],
+ * 'setWritable' => [
+ * // list of directories that should be set writable
+ * ],
+ * 'setExecutable' => [
+ * // list of files that should be set executable
+ * ],
+ * 'setCookieValidationKey' => [
+ * // list of config files that need to be inserted with automatically generated cookie validation keys
+ * ],
+ * 'createSymlink' => [
+ * // list of symlinks to be created. Keys are symlinks, and values are the targets.
+ * ],
+ * ],
+ * ];
+ * ```
+ */
+return [
+ 'Development' => [
+ 'path' => 'dev',
+ 'setWritable' => [
+ 'backend/runtime',
+ 'backend/web/assets',
+ 'frontend/runtime',
+ 'frontend/web/assets',
+ ],
+ 'setExecutable' => [
+ 'yii',
+ 'tests/codeception/bin/yii',
+ ],
+ 'setCookieValidationKey' => [
+ 'backend/config/main-local.php',
+ 'frontend/config/main-local.php',
+ ],
+ ],
+ 'Production' => [
+ 'path' => 'prod',
+ 'setWritable' => [
+ 'backend/runtime',
+ 'backend/web/assets',
+ 'frontend/runtime',
+ 'frontend/web/assets',
+ ],
+ 'setExecutable' => [
+ 'yii',
+ ],
+ 'setCookieValidationKey' => [
+ 'backend/config/main-local.php',
+ 'frontend/config/main-local.php',
+ ],
+ ],
+];
diff --git a/environments/prod/backend/config/main-local.php b/environments/prod/backend/config/main-local.php
new file mode 100644
index 0000000..d1c8993
--- /dev/null
+++ b/environments/prod/backend/config/main-local.php
@@ -0,0 +1,9 @@
+ [
+ 'request' => [
+ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
+ 'cookieValidationKey' => '',
+ ],
+ ],
+];
diff --git a/environments/prod/backend/config/params-local.php b/environments/prod/backend/config/params-local.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/environments/prod/backend/config/params-local.php
@@ -0,0 +1,3 @@
+run();
diff --git a/environments/prod/common/config/main-local.php b/environments/prod/common/config/main-local.php
new file mode 100644
index 0000000..ea8ef35
--- /dev/null
+++ b/environments/prod/common/config/main-local.php
@@ -0,0 +1,16 @@
+ [
+ 'db' => [
+ 'class' => 'yii\db\Connection',
+ 'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
+ 'username' => 'root',
+ 'password' => '',
+ 'charset' => 'utf8',
+ ],
+ 'mailer' => [
+ 'class' => 'yii\swiftmailer\Mailer',
+ 'viewPath' => '@common/mail',
+ ],
+ ],
+];
diff --git a/environments/prod/common/config/params-local.php b/environments/prod/common/config/params-local.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/environments/prod/common/config/params-local.php
@@ -0,0 +1,3 @@
+ [
+ 'request' => [
+ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
+ 'cookieValidationKey' => '',
+ ],
+ ],
+];
diff --git a/environments/prod/frontend/config/params-local.php b/environments/prod/frontend/config/params-local.php
new file mode 100644
index 0000000..c1d2298
--- /dev/null
+++ b/environments/prod/frontend/config/params-local.php
@@ -0,0 +1,3 @@
+run();
diff --git a/environments/prod/yii b/environments/prod/yii
new file mode 100644
index 0000000..65c41d0
--- /dev/null
+++ b/environments/prod/yii
@@ -0,0 +1,28 @@
+#!/usr/bin/env php
+run();
+exit($exitCode);
diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php
new file mode 100644
index 0000000..14ca57f
--- /dev/null
+++ b/frontend/assets/AppAsset.php
@@ -0,0 +1,53 @@
+
+ * @since 2.0
+ */
+class AppAsset extends AssetBundle
+{
+ public $basePath = '@webroot';
+ public $baseUrl = '@web';
+ public $css = [
+ 'css/style.css',
+ 'css/node_modules/font-awesome/css/font-awesome.css',
+ 'css/owl.carousel.css',
+ 'css/node_modules/animate.css/animate.css',
+ 'css/fonts.css',
+ 'css/node_modules/ion-rangeslider/css/normalize.css',
+ 'css/node_modules/ion-rangeslider/css/ion.rangeSlider.css',
+ 'css/node_modules/ion-checkradio/css/ion.checkRadio.css',
+ 'css/node_modules/ion-checkradio/css/ion.checkRadio.green.css',
+ 'css/node_modules/ion-rangeslider/css/ion.rangeSlider.skinHTML5.css',
+ 'css/node_modules/ion-tabs/css/ion.tabs.css',
+ 'css/node_modules/ion-tabs/css/ion.tabs.skinFlat.css',
+ 'css/concat_all.css',
+ '//fonts.googleapis.com/css?family=Ubuntu:400,300italic,300,400italic,500,500italic,700italic,700',
+
+ ];
+ public $js = [
+ 'css/node_modules/ion-rangeslider/js/ion.rangeSlider.min.js',
+ 'css/node_modules/ion-checkradio/js/ion.checkRadio.min.js',
+ 'css/node_modules/ion-tabs/js/ion-tabs/ion.tabs.js',
+ 'js/jquery.jcarousellite-1.0.1.js',
+ 'js/owl.carousel.js',
+ 'js/script.js',
+ 'js/my_scripts.js',
+ 'js/basket.js',
+
+ ];
+ public $depends = [
+ 'yii\web\YiiAsset',
+ 'frontend\assets\IeAsset',
+// 'yii\bootstrap\BootstrapPluginAsset'
+ ];
+}
diff --git a/frontend/assets/IeAsset.php b/frontend/assets/IeAsset.php
new file mode 100644
index 0000000..7ae917e
--- /dev/null
+++ b/frontend/assets/IeAsset.php
@@ -0,0 +1,26 @@
+
+ * @since 2.0
+ */
+class IeAsset extends AssetBundle
+{
+ public $basePath = '@webroot';
+ public $baseUrl = '@web';
+ public $cssOptions = ['condition' => 'lte IE9'];
+ public $css = [
+ 'css/ie.css'
+ ];
+
+
+}
diff --git a/frontend/config/.gitignore b/frontend/config/.gitignore
new file mode 100644
index 0000000..8ded784
--- /dev/null
+++ b/frontend/config/.gitignore
@@ -0,0 +1,2 @@
+main-local.php
+params-local.php
\ No newline at end of file
diff --git a/frontend/config/bootstrap.php b/frontend/config/bootstrap.php
new file mode 100644
index 0000000..6fd199e
--- /dev/null
+++ b/frontend/config/bootstrap.php
@@ -0,0 +1 @@
+ 'app-frontend',
+ 'basePath' => dirname(__DIR__),
+ 'layout' => 'site_content',
+ 'bootstrap' => ['log'],
+ 'controllerNamespace' => 'frontend\controllers',
+ 'components' => [
+ 'user' => [
+ 'identityClass' => 'common\models\Customers',
+ 'enableAutoLogin' => true,
+ 'identityCookie' => [
+ 'name' => '_frontendUser', // unique for frontend
+ ]
+ ],
+ 'request'=>[
+ 'cookieValidationKey' => 'ndahjhjjidasuidrqeswuiuirqw89',
+ 'csrfParam' => '_frontendCSRF',
+ 'class' => 'common\components\Request',
+
+ 'web'=> '/frontend/web'
+
+ ],
+
+ 'log' => [
+ 'traceLevel' => YII_DEBUG ? 3 : 0,
+ 'targets' => [
+ [
+ 'class' => 'yii\log\FileTarget',
+ 'levels' => ['error', 'warning'],
+ ],
+ ],
+ ],
+ 'errorHandler' => [
+ 'errorAction' => 'site/error',
+ ],
+
+ 'urlManager' => [
+ 'baseUrl' => '/',
+ 'enablePrettyUrl' => true,
+ 'showScriptName' => false,
+ 'rules' => [
+ [
+ 'class' => '\common\modules\product\CatalogUrlManager',
+ 'route_map' => [
+ 'catalog' => 'catalog/category',
+ 'product' => 'catalog/product',
+ 'brand' => 'catalog/brand',
+ ]
+ ],
+ 'page/'=>'page/show',
+ 'event/view/'=>'event/view',
+ 'service/view/'=>'service/view',
+//// 'catalog' => 'catalog/category',
+// 'catalog/' => 'catalog/category',
+// 'catalog//' => 'catalog/category',
+// 'product/' => 'catalog/product',
+// 'brand' => 'catalog/brands',
+// 'brand/' => 'catalog/brand',
+ ]
+ ]
+
+ ],
+ 'params' => $params,
+];
diff --git a/frontend/config/params.php b/frontend/config/params.php
new file mode 100644
index 0000000..4ee7a49
--- /dev/null
+++ b/frontend/config/params.php
@@ -0,0 +1,4 @@
+ 'admin@example.com',
+];
diff --git a/frontend/controllers/CabinetController.php b/frontend/controllers/CabinetController.php
new file mode 100644
index 0000000..56be783
--- /dev/null
+++ b/frontend/controllers/CabinetController.php
@@ -0,0 +1,100 @@
+ [
+ 'class' => AccessControl::className(),
+ 'rules' => [
+ [
+ 'actions' => ['login', 'error'],
+ 'allow' => true,
+ ],
+ [
+ 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete','my-orders','bookmarks'],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ public function actionIndex(){
+ return $this->render('index');
+ }
+
+ public function actionUpdate(){
+
+
+
+ $model = Yii::$app->user->identity;
+
+
+ if(Yii::$app->request->post()){
+
+ $model->load(Yii::$app->request->post());
+ $model->validate();
+
+ if($model->validate()){
+ $model->save();
+
+ }
+
+ }
+
+
+ return $this->render('update',[
+ 'model' =>$model
+ ]);
+ }
+
+
+ public function actionBookmarks(){
+ return $this->render('bookmarks',[
+
+ ]);
+ }
+
+ public function actionMyOrders(){
+ return $this->render('my-orders',[
+
+ ]);
+ }
+
+}
\ No newline at end of file
diff --git a/frontend/controllers/CatalogController.old.php b/frontend/controllers/CatalogController.old.php
new file mode 100644
index 0000000..517f7ef
--- /dev/null
+++ b/frontend/controllers/CatalogController.old.php
@@ -0,0 +1,231 @@
+category_id)) {
+ throw new HttpException(404 ,'Page not found');
+ }
+ if ($category->depth < 2) {
+ return $this->render(
+ 'categories',
+ [
+ 'category' => $category
+ ]
+ );
+ } else {
+ $per_page = 24;
+
+ $sort = new Sort([
+ 'attributes' => [
+ 'name' => [
+ 'asc' => ['name' => SORT_ASC],
+ 'desc' => ['name' => SORT_DESC],
+ 'default' => SORT_DESC,
+ 'label' => 'имени',
+ ],
+ 'price' => [
+ 'asc' => [ProductVariant::tableName() .'.price' => SORT_ASC],
+ 'desc' => [ProductVariant::tableName() .'.price' => SORT_DESC],
+ 'default' => SORT_DESC,
+ 'label' => 'цене',
+ ],
+ ],
+ ]);
+ /** @var ActiveQuery $query */
+ $query = $category->getRelations('product_categories')
+ ->joinWith([
+ 'variants'
+ ]);
+ $all_count = $query->count();
+
+ $brandsQuery = Brand::find()
+ ->innerJoinWith('brandName')
+ ->innerJoinWith('products')
+ ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() .'.product_id='. Product::tableName() .'.product_id')
+ ->where([
+ ProductCategory::tableName() .'.category_id' => $category->category_id
+ ])
+ ->groupBy(Brand::tableName() .'.brand_id');
+ $brands = $brandsQuery->all();
+ $brands_count = count($brands); // $brandsQuery->count();
+
+ $optionsQuery = TaxOption::find()
+ ->select([
+ TaxOption::tableName() .'.*',
+ 'COUNT('. ProductOption::tableName() .'.product_id) AS _items_count'
+ ])
+ ->innerJoin(ProductOption::tableName(), ProductOption::tableName() .'.option_id='. TaxOption::tableName() .'.tax_option_id')
+ ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() .'.product_id='. ProductOption::tableName() .'.product_id')
+ ->innerJoinWith('group')
+ ->where([
+ ProductCategory::tableName() .'.category_id' => $category->category_id
+ ])
+ ->groupBy(TaxOption::tableName() .'.tax_option_id');
+ $all_options = [];
+ foreach($optionsQuery->all() as $_option) {
+ $all_options[] = $_option;
+ }
+
+ $priceQuery = clone $query;
+ $priceMin = $priceMinCurr = $priceQuery->min(ProductVariant::tableName() .'.price');
+ $priceMax = $priceMaxCurr = $priceQuery->max(ProductVariant::tableName() .'.price');
+
+ // Prices
+ if (($price_interval = \Yii::$app->request->get('price_interval')) != false) {
+ $price_interval = explode(';', $price_interval);
+ $price_interval = [
+ floatval($price_interval[0]),
+ floatval($price_interval[1]),
+ ];
+ if ($price_interval[0] > 0) {
+ $query->andWhere(['>=', ProductVariant::tableName() .'.price', $price_interval[0]]);
+ $priceMinCurr = $price_interval[0];
+ }
+ if ($price_interval[1] > 0) {
+ $query->andWhere(['<=', ProductVariant::tableName() .'.price', $price_interval[1]]);
+ $priceMaxCurr = $price_interval[1];
+ }
+ }
+
+ $groups = [];
+ foreach($category->getTaxGroups()->all() as $_group) {
+ $groups[$_group->tax_group_id] = $_group;
+ }
+ foreach ($all_options as $option) {
+ $groups[$option->tax_group_id]->_options[] = $option;
+ }
+ foreach($groups as $i => $group) {
+ if (empty($group->_options))
+ unset($groups[$i]);
+ }
+
+ // Options
+ if (($options = \Yii::$app->request->get('option')) != false) {
+// $query->innerJoin(ProductOption::tableName(), ProductOption::tableName() .'.product_id='. Product::tableName() .'.product_id');
+// $query->innerJoin(TaxOption::tableName(), TaxOption::tableName() .'.tax_option_id='. ProductOption::tableName() .'.option_id');
+ foreach($options as $group_alias => $options_alias) {
+ if (!is_array($options_alias)) {
+ $options_alias = [$options_alias];
+ }
+ foreach($options_alias as &$option_alias) {
+ $option_alias = "'". $option_alias ."'";
+ }
+ /*$group = TaxGroup::find()->where(['like', 'alias', $group_alias])->one();
+ if (!$group) {
+ continue;
+ }*/
+ }
+ $query->andWhere(
+ Product::tableName() .'.product_id IN (SELECT product_id AS products FROM product_option INNER JOIN tax_option ON tax_option.tax_option_id = product_option.option_id WHERE tax_option.alias IN ('. implode(',', $options_alias) .'))'
+ );
+ }
+
+ if (($_brands = \Yii::$app->request->get('brand')) != false && is_array($_brands) && count($_brands) > 0) {
+ $_brands = Brand::find()->where(['in', 'alias', $_brands])->all();
+ $bids = [];
+ foreach ($_brands as $brand) {
+ $bids[] = $brand->brand_id;
+ }
+ if (count($bids)) {
+ $query->andWhere([Product::tableName() .'.brand_id' => $bids]);
+ }
+ }
+
+ $query->with('variant');
+ $query->with('brand');
+ $query->with('categories');
+ $query->with('image');
+
+ $count = $query->count();
+ $pages = new Pagination(['totalCount' => $count, 'pageSize' => $per_page]);
+ $query->offset($pages->offset)
+ ->orderBy($sort->orders)
+ ->limit($pages->limit);
+
+ $products = $query->all();
+
+ return $this->render(
+ 'products',
+ [
+ 'category' => $category,
+ 'products' => $products,
+ 'all_count' => $all_count,
+ 'product_count' => $count,
+ 'sort' => $sort,
+ 'pages' => $pages,
+ 'per_page' => $per_page,
+ 'priceMin' => $priceMin,
+ 'priceMax' => $priceMax,
+ 'priceMinCurr' => $priceMinCurr,
+ 'priceMaxCurr' => $priceMaxCurr,
+ '_brands' => $_brands,
+ 'brands' => $brands,
+ 'brands_count' => $brands_count,
+ 'groups' => $groups,
+ 'options' => $options,
+ ]
+ );
+ }
+ }
+
+ public function actionProduct($alias)
+ {
+ $product = ProductSearch::findByAlias($alias);
+ if (empty($product->product_id)) {
+ throw new HttpException(404 ,'Page not found');
+ }
+ $groups = [];
+ foreach($product->category->getTaxGroups()->all() as $_group) {
+ $groups[$_group->tax_group_id] = $_group;
+ }
+ foreach ($product->options as $option) {
+ $groups[$option->tax_group_id]->_options[] = $option;
+ }
+ foreach($groups as $i => $group) {
+ if (empty($group->_options))
+ unset($groups[$i]);
+ }
+
+ return $this->render('product', [
+ 'product' => $product,
+ 'properties' => $groups,
+ ]);
+ }
+
+ public function actionBrands()
+ {
+ return 'actionBrands';
+ }
+
+ public function actionBrand($alias)
+ {
+ return 'actionBrand:'. $alias;
+ }
+
+}
diff --git a/frontend/controllers/CatalogController.php b/frontend/controllers/CatalogController.php
new file mode 100644
index 0000000..b14e86b
--- /dev/null
+++ b/frontend/controllers/CatalogController.php
@@ -0,0 +1,198 @@
+request->get('category');
+ $filter = Yii::$app->request->get('filter', []);
+ $word = trim(Yii::$app->request->get('word', ''));
+
+ if (empty($category->category_id) && empty($word)) {
+ throw new HttpException(404 ,'Page not found');
+ }
+
+ $last_products = ProductHelper::getLastProducts(true);
+
+ if (!empty($word)) {
+ $params = [];
+
+ $params['keywords'] = explode(' ', preg_replace("|[\s,.!:&?~();-]|i", " ", $word));
+ foreach($params['keywords'] as $i => &$keyword) {
+ $keyword = trim($keyword);
+ if (empty($keyword)) {
+ unset($params['keywords'][$i]);
+ }
+ }
+
+ $productModel = new ProductFrontendSearch();
+ $productProvider = $productModel->search($category, $params);
+
+ $categoriesQuery = Category::find()
+ ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() .'.category_id = '. Category::tableName() .'.category_id')
+ ->innerJoin(Product::tableName(), Product::tableName() .'.product_id = '. ProductCategory::tableName() .'.product_id');
+ foreach ($params['keywords'] as $keyword) {
+ $categoriesQuery->andWhere(['ilike', 'product.name', $keyword]);
+ }
+ $categories = $categoriesQuery->all();
+
+ return $this->render(
+ 'search',
+ [
+ 'keywords' => $params['keywords'],
+ 'category' => $category,
+ 'productModel' => $productModel,
+ 'productProvider' => $productProvider,
+ 'last_products' => $last_products,
+ 'categories' => $categories,
+ ]
+ );
+
+ } elseif ($category->depth < 2) {
+ return $this->render(
+ 'categories',
+ [
+ 'category' => $category,
+ 'last_products' => $last_products,
+ ]
+ );
+ } else {
+ $params = [];
+
+ if ( !empty($filter['brands']) ) {
+ $brands = Brand::find()->select('brand_id')->where(['in', 'alias', $filter['brands']])->all();
+ $params['brands'] = [];
+ foreach ($brands as $brand) {
+ $params['brands'][] = $brand->brand_id;
+ }
+ }
+
+ if ( !empty($filter['options']) ) {
+ $params['options'] = $filter['options'];
+ /*$optionQuery = TaxOption::find();
+ $optionQuery->select('tax_option_id');
+ $optionQuery->innerJoinWith('group');
+ foreach ($filter['options'] as $option_key => $option_values) {
+ $optionQuery->orWhere([
+ 'tax_group_id' => $option_key,
+ 'alias' => $filter['options']
+ ]);
+ }
+ $options = ->where(['in', 'alias', $filter['options']])->all();
+ $params['options'] = [];
+ foreach ($options as $option) {
+ $params['options'][] = $option->tax_option_id;
+ }*/
+ }
+
+ if ( !empty($filter['prices']) ) {
+ $params['prices'] = $filter['prices'];
+ }
+
+ $productModel = new ProductFrontendSearch();
+ $productProvider = $productModel->search($category, $params);
+
+ $brandModel = new BrandSearch();
+ $brandProvider = $brandModel->getBrands($category, $params);
+
+ $optionsProvider = $productModel->optionsForCategory($category, $params);
+ $groups = [];
+ foreach ($optionsProvider->models as $option) {
+ if (!isset($groups[$option->tax_group_id])) {
+ $groups[$option->tax_group_id] = $option->taxGroup;
+ $groups[$option->tax_group_id]->_options = [];
+ }
+ $groups[$option->tax_group_id]->_options[] = $option;
+ }
+ foreach($groups as $i => $group) {
+ if (empty($group->_options))
+ unset($groups[$i]);
+ }
+
+ $priceLimits = $productModel->priceLimits($category, $params);
+
+ return $this->render(
+ 'products',
+ [
+ 'category' => $category,
+ 'brandModel' => $brandModel,
+ 'brandProvider' => $brandProvider,
+ 'filter' => $filter,
+ 'productModel' => $productModel,
+ 'productProvider' => $productProvider,
+ 'optionsProvider' => $optionsProvider,
+ 'groups' => $groups,
+ 'priceLimits' => $priceLimits,
+ 'last_products' => $last_products,
+ ]
+ );
+ }
+ }
+
+ public function actionProduct()
+ {
+ $product = Yii::$app->request->get('product');
+
+ $groups = [];
+ foreach($product->category->getTaxGroups()->all() as $_group) {
+ $groups[$_group->tax_group_id] = $_group;
+ }
+ foreach ($product->options as $option) {
+ $groups[$option->tax_group_id]->_options[] = $option;
+ }
+ foreach($groups as $i => $group) {
+ if (empty($group->_options))
+ unset($groups[$i]);
+ }
+
+ $last_products = ProductHelper::getLastProducts(true);
+ ProductHelper::addLastProsucts($product->product_id);
+
+ return $this->render('product', [
+ 'product' => $product,
+ 'properties' => $groups,
+ 'last_products' => $last_products
+ ]);
+ }
+
+ public function actionBrands()
+ {
+ return 'actionBrands';
+ }
+
+ public function actionBrand($alias)
+ {
+ return 'actionBrand:'. $alias;
+ }
+
+}
diff --git a/frontend/controllers/EventController.php b/frontend/controllers/EventController.php
new file mode 100644
index 0000000..cd2716b
--- /dev/null
+++ b/frontend/controllers/EventController.php
@@ -0,0 +1,48 @@
+ Event::find() ]);
+
+ return $this->render('index', [
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+
+
+ public function actionView($alias)
+ {
+
+ return $this->render('view', [
+ 'model' => $this->findModel($alias),
+ ]);
+ }
+
+
+ protected function findModel($alias)
+ {
+ if (($model = Event::findOne(["alias"=>$alias])) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/frontend/controllers/OrdersController.php b/frontend/controllers/OrdersController.php
new file mode 100644
index 0000000..077c462
--- /dev/null
+++ b/frontend/controllers/OrdersController.php
@@ -0,0 +1,311 @@
+id == 'buy-items' || $action->id == 'delete') {
+ Yii::$app->controller->enableCsrfValidation = false;
+ }
+
+ return true;
+ }
+
+ public function actionFirst(){
+
+ $array = Yii::$app->session->get('order');
+
+ if(isset($array['order_id']) ) {
+ $model = Orders::findOne($array['order_id']);
+ }else {
+ $model = new Orders();
+ }
+
+
+ if(Yii::$app->request->post() && $model->load(Yii::$app->request->post())){
+
+ if($model->save()){
+
+ $array['order_id'] = $model->order_id;
+
+ Yii::$app->session->set('order', $array );
+
+ return $this->redirect(['orders/second']);
+ }
+
+ } else {
+ if (!Yii::$app->user->isGuest) {
+ $customer = Yii::$app->user->identity;
+ $model->name = $customer->name;
+ $model->email = $customer->email;
+ $model->phone = $customer->phone;
+ }
+ }
+
+
+ return $this->render('basket-step-01',[
+ 'model' => $model
+ ]);
+ }
+
+ public function actionSecond(){
+
+ $sessionData = \Yii::$app->session->get('order');
+
+ $order_id = $sessionData['order_id'];
+
+ if(!empty($order_id)){
+ $order_model = Orders::findOne($order_id);
+ } else{
+ $order_model = new Orders;
+ }
+
+ unset($sessionData['order_id']);
+
+ $variant = ProductVariant::find()->where(['product_variant_id'=>array_keys($sessionData)])->indexBy('product_variant_id')->all();
+
+
+ if(Yii::$app->request->post()){
+
+ foreach ($sessionData as $k => $item) {
+ $itemModel = OrderItems::find()->where(['order_id'=>$order_id, 'item_id'=> $variant[$k]->product_variant_id])->one();
+ if($itemModel instanceof OrderItems){
+ $itemModel->order_id = $order_id;
+ $itemModel->item_id = $variant[$k]->product_variant_id;
+ $itemModel->item_count = $sessionData[$k]['num'];
+ $itemModel->price = $variant[$k]->price;
+ $itemModel->save();
+ } else {
+ $itemModel = new OrderItems();
+ $itemModel->order_id = $order_id;
+ $itemModel->item_id = $variant[$k]->product_variant_id;
+ $itemModel->item_count = $sessionData[$k]['num'];
+ $itemModel->price = $variant[$k]->price;
+ $itemModel->save();
+ }
+
+ }
+ Yii::$app->session->set('order', [] );
+ return $this->redirect(['orders/third']);
+
+ } else {
+
+ $price = 0;
+
+ $count = count($sessionData);
+
+ foreach ($sessionData as $k => $item) {
+ $sessionData[$k]['item'] = $variant[$k];
+ $price += $variant[$k]->price * $sessionData[$k]['num'];
+ }
+
+ }
+
+ return $this->render('basket-step-02',[
+ 'items'=>$sessionData,
+ 'count' => $count,
+ 'price' => $price,
+ 'order_id' => $order_id,
+ 'order_model' => $order_model,
+ ]);
+
+ }
+
+ public function actionThird(){
+ return $this->render('basket-step-03');
+ }
+
+
+// /**
+// * Lists all Order models.
+// * @return mixed
+// */
+// public function actionIndex()
+// {
+//
+// if (Yii::$app->request->post()) {
+// $item = $items_id = array();
+//
+// $i = 0;
+// $order = Yii::$app->request->post();
+//
+// $orderData['Order'] = $order['OrderForm'];
+//
+// foreach($order['OrderForm']['one_item'] as $k => $v ){
+// $item[$k]['num'] = $v['num'];
+// $items_id[] = $k;
+// $i++;
+// }
+//
+// $items = Items::find()->where(['id'=>$items_id])->all();
+//
+//
+// $orderModel = new Order();
+// $orderModel->load($orderData);
+// $orderModel->save();
+//
+//
+// foreach($items as $one_item){
+// $ItemOrderModel = new ItemOrder();
+// $ItemOrderModel->order_id = $orderModel->id;
+// $ItemOrderModel->num = $item[$one_item->id]['num'];
+// $ItemOrderModel->item_id = $one_item->id;
+// $ItemOrderModel->price = $one_item->price * $item[$one_item->id]['num'];
+// $ItemOrderModel->item_name = $one_item->name;
+// $ItemOrderModel->save();
+// }
+// Yii::$app->session->set('order', [] );
+// return $this->redirect(['order/complete']);
+// }
+// $total_price = 0;
+//
+// $items_id = [];
+//
+// $orders = Yii::$app->session->get('order');
+//
+// if(!empty($orders)){
+// foreach($orders as $k => $v) {
+// $items_id[] = $k;
+// }
+// }
+//
+//
+// $items = Items::find()->where(['id'=>$items_id])->all();
+//
+// foreach($items as $item) {
+// $total_price += $orders[$item['id']]['num'] * $item['price'];
+// }
+//
+//
+// $dataProvider = new ArrayDataProvider([
+// 'allModels' => $items
+// ]);
+//
+// return $this->render('index', [
+// 'dataProvider' => $dataProvider,
+// 'total_price'=> $total_price,
+// 'model' => new OrderForm()
+// ]);
+// }
+
+
+ public function actionComplete()
+ {
+ return $this->render('complete', [
+ ]);
+ }
+
+ public function actionBuyItems(){
+ $data = Yii::$app->request->post();
+ $sessionData = Yii::$app->session->get('order');
+ if(isset($sessionData) && !array_search($data['id'],Yii::$app->session->get('order')) ){
+ $array = Yii::$app->session->get('order');
+ $array[$data['id']] = $data;
+ Yii::$app->session->set('order', $array );
+ } else {
+ $array[$data['id']] = $data;
+ Yii::$app->session->set('order', $array );
+ }
+ echo BasketModal::widget([]);
+
+ }
+ /**
+ * Displays a single Order model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Order model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Order();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ } else {
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Updates an existing Order model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ } else {
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Deletes an existing Order model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionDelete()
+ {
+ $data = Yii::$app->request->post();
+ $sessionData = Yii::$app->session->get('order');
+ unset($sessionData[$data['id']]);
+ Yii::$app->session->set('order', $sessionData);
+ return count(Yii::$app->session->get('order'));
+ }
+
+ /**
+ * Finds the Order model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Order the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Order::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
diff --git a/frontend/controllers/PageController.php b/frontend/controllers/PageController.php
new file mode 100644
index 0000000..b0c3c88
--- /dev/null
+++ b/frontend/controllers/PageController.php
@@ -0,0 +1,20 @@
+getPageTranslit($translit))
+ throw new \Exception(404,'The requested page does not exist.');
+ return $this->render('show',['page'=>$page]);
+ }
+}
\ No newline at end of file
diff --git a/frontend/controllers/PostController.php b/frontend/controllers/PostController.php
new file mode 100644
index 0000000..55bbfd3
--- /dev/null
+++ b/frontend/controllers/PostController.php
@@ -0,0 +1,20 @@
+ 55]);
+ }
+
+ public function actionView($id)
+ {
+ return 'actionView:'. $id;
+ }
+
+}
diff --git a/frontend/controllers/PuttyController.php b/frontend/controllers/PuttyController.php
new file mode 100644
index 0000000..32fa0fc
--- /dev/null
+++ b/frontend/controllers/PuttyController.php
@@ -0,0 +1,41 @@
+render('catalog');
+ }
+
+ public function actionItemCardOpen(){
+ return $this->render('item-card-open');
+ }
+
+ public function actionCategory(){
+ return $this->render('category');
+ }
+
+ public function actionManufacturers(){
+ return $this->render('manufacturers');
+ }
+
+
+
+
+ public function actionContacts(){
+ return $this->render('contacts');
+ }
+
+ public function actionDelivery(){
+ return $this->render('delivery');
+ }
+
+}
diff --git a/frontend/controllers/ServiceController.php b/frontend/controllers/ServiceController.php
new file mode 100644
index 0000000..48da911
--- /dev/null
+++ b/frontend/controllers/ServiceController.php
@@ -0,0 +1,48 @@
+ Service::find() ]);
+
+ return $this->render('index', [
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+
+
+ public function actionView($alias)
+ {
+
+ return $this->render('view', [
+ 'model' => $this->findModel($alias),
+ ]);
+ }
+
+
+ protected function findModel($alias)
+ {
+ if (($model = Service::findOne(["alias"=>$alias])) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php
new file mode 100644
index 0000000..94dde93
--- /dev/null
+++ b/frontend/controllers/SiteController.php
@@ -0,0 +1,267 @@
+ [
+ 'class' => AccessControl::className(),
+ 'only' => ['logout', 'signup'],
+ 'rules' => [
+ [
+ 'actions' => ['signup'],
+ 'allow' => true,
+ 'roles' => ['?'],
+ ],
+ [
+ 'actions' => ['logout'],
+ 'allow' => true,
+ 'roles' => ['@'],
+ ],
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'logout' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function beforeAction($action)
+ {
+ if ($action->id == 'signup') {
+ Yii::$app->controller->enableCsrfValidation = false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function actions()
+ {
+ return [
+ 'error' => [
+ 'class' => 'yii\web\ErrorAction',
+ ],
+ 'captcha' => [
+ 'class' => 'yii\captcha\CaptchaAction',
+ 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
+ ],
+ ];
+ }
+
+ /**
+ * Displays homepage.
+ *
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $this->layout = 'main';
+ return $this->render('index');
+ }
+
+
+ public function actionMail(){
+
+ $type = Yii::$app->request->post('type');
+
+ switch ($type) {
+ case 'call_me':
+ $num = Yii::$app->request->post('num');
+ if(!empty($num)){
+ return json_encode(Mailer::widget(['text' => $num, 'subject' => 'Обратный звонок']));
+ }
+
+ break;
+ case "consultation":
+ $num = Yii::$app->request->post('num');
+ $name = Yii::$app->request->post('name');
+
+ if(!empty($num)){
+ return json_encode(Mailer::widget(['text' => "Номер телефона".$num."; Имя:".$name, 'subject' => 'Обратный звонок']));
+ }
+ break;
+
+
+ }
+ }
+
+ /**
+ * Logs in a user.
+ *
+ * @return mixed
+ */
+ public function actionLogin()
+ {
+ if (!\Yii::$app->user->isGuest) {
+ return $this->goHome();
+ }
+
+ $model = new LoginForm();
+ if ($model->load(Yii::$app->request->post()) && $model->login()) {
+ return $this->goBack();
+ } else {
+ return $this->render('login', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Logs out the current user.
+ *
+ * @return mixed
+ */
+ public function actionLogout()
+ {
+ Yii::$app->user->logout();
+
+ return $this->goHome();
+ }
+
+ /**
+ * Displays contact page.
+ *
+ * @return mixed
+ */
+ public function actionContact()
+ {
+ $model = new ContactForm();
+ if ($model->load(Yii::$app->request->post()) && $model->validate()) {
+ if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
+ Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
+ } else {
+ Yii::$app->session->setFlash('error', 'There was an error sending email.');
+ }
+
+ return $this->refresh();
+ } else {
+ return $this->render('contact', [
+ 'model' => $model,
+ ]);
+ }
+ }
+
+ /**
+ * Displays about page.
+ *
+ * @return mixed
+ */
+ public function actionAbout()
+ {
+ return $this->render('about');
+ }
+
+ /**
+ * Signs user up.
+ *
+ * @return mixed
+ */
+ public function actionSignup()
+ {
+
+ if(Yii::$app->request->post()){
+ if (Yii::$app->request->isAjax) {
+ Yii::$app->response->format = Response::FORMAT_JSON;
+ $model = new SignupForm(['scenario' => SignupForm::SCENARIO_AJAX]);
+ $model->load(Yii::$app->request->post());
+ return ActiveForm::validate($model);
+ } else {
+ $model = new SignupForm(['scenario' => SignupForm::SCENARIO_SUBMIT]);
+ $model->load(Yii::$app->request->post());
+ if ($user = $model->signup()) {
+ if (Yii::$app->getUser()->login($user)) {
+ return $this->goHome();
+ }
+ }
+ }
+ }
+ return $this->render('signup', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Requests password reset.
+ *
+ * @return mixed
+ */
+ public function actionRequestPasswordReset()
+ {
+ $model = new PasswordResetRequestForm();
+ if ($model->load(Yii::$app->request->post()) && $model->validate()) {
+ if ($model->sendEmail()) {
+ Yii::$app->session->setFlash('success', 'Check your email for further instructions.');
+
+ return $this->goHome();
+ } else {
+ Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for email provided.');
+ }
+ }
+
+ return $this->render('requestPasswordResetToken', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Resets password.
+ *
+ * @param string $token
+ * @return mixed
+ * @throws BadRequestHttpException
+ */
+ public function actionResetPassword($token)
+ {
+ try {
+ $model = new ResetPasswordForm($token);
+ } catch (InvalidParamException $e) {
+ throw new BadRequestHttpException($e->getMessage());
+ }
+
+ if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
+ Yii::$app->session->setFlash('success', 'New password was saved.');
+
+ return $this->goHome();
+ }
+
+ return $this->render('resetPassword', [
+ 'model' => $model,
+ ]);
+ }
+
+
+
+}
diff --git a/frontend/helpers/TextHelper.php b/frontend/helpers/TextHelper.php
new file mode 100644
index 0000000..c247f64
--- /dev/null
+++ b/frontend/helpers/TextHelper.php
@@ -0,0 +1,24 @@
+')
+ {
+ if ($asHtml) {
+ return static::truncateHtml($string, $length, $suffix, $encoding ?: Yii::$app->charset);
+ }
+
+ if (mb_strlen($string, $encoding ?: Yii::$app->charset) > $length) {
+ return strip_tags(trim(mb_substr($string, 0, $length, $encoding ?: Yii::$app->charset)) . $suffix, $html);
+ } else {
+ return strip_tags($string, $html);
+ }
+
+
+ }
+}
diff --git a/frontend/models/ContactForm.php b/frontend/models/ContactForm.php
new file mode 100644
index 0000000..845de8e
--- /dev/null
+++ b/frontend/models/ContactForm.php
@@ -0,0 +1,59 @@
+ 'Verification Code',
+ ];
+ }
+
+ /**
+ * Sends an email to the specified email address using the information collected by this model.
+ *
+ * @param string $email the target email address
+ * @return boolean whether the email was sent
+ */
+ public function sendEmail($email)
+ {
+ return Yii::$app->mailer->compose()
+ ->setTo($email)
+ ->setFrom([$this->email => $this->name])
+ ->setSubject($this->subject)
+ ->setTextBody($this->body)
+ ->send();
+ }
+}
diff --git a/frontend/models/PasswordResetRequestForm.php b/frontend/models/PasswordResetRequestForm.php
new file mode 100644
index 0000000..fb239c1
--- /dev/null
+++ b/frontend/models/PasswordResetRequestForm.php
@@ -0,0 +1,68 @@
+ 'trim'],
+ ['email', 'required'],
+ ['email', 'email'],
+ ['email', 'exist',
+ 'targetClass' => '\common\models\User',
+ 'filter' => ['status' => User::STATUS_ACTIVE],
+ 'message' => 'There is no user with such email.'
+ ],
+ ];
+ }
+
+ /**
+ * Sends an email with a link, for resetting the password.
+ *
+ * @return boolean whether the email was send
+ */
+ public function sendEmail()
+ {
+ /* @var $user User */
+ $user = User::findOne([
+ 'status' => User::STATUS_ACTIVE,
+ 'email' => $this->email,
+ ]);
+
+ if (!$user) {
+ return false;
+ }
+
+ if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
+ $user->generatePasswordResetToken();
+ }
+
+ if (!$user->save()) {
+ return false;
+ }
+
+ return Yii::$app
+ ->mailer
+ ->compose(
+ ['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'],
+ ['user' => $user]
+ )
+ ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])
+ ->setTo($this->email)
+ ->setSubject('Password reset for ' . \Yii::$app->name)
+ ->send();
+ }
+}
diff --git a/frontend/models/ProductFrontendSearch.php b/frontend/models/ProductFrontendSearch.php
new file mode 100644
index 0000000..f01003a
--- /dev/null
+++ b/frontend/models/ProductFrontendSearch.php
@@ -0,0 +1,182 @@
+getRelations('product_categories');
+ } else {
+ $query = Product::find();
+ }
+ $query->joinWith('variant');
+ $query->joinWith('brand');
+ $query->joinWith('image');
+ $query->joinWith('categories');
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ 'pagination' => [
+ 'pageSize' => 24,
+ ],
+ 'sort' => [
+ 'attributes' => [
+ 'name' => [
+ 'asc' => ['name' => SORT_ASC],
+ 'desc' => ['name' => SORT_DESC],
+ 'default' => SORT_DESC,
+ 'label' => 'имени',
+ ],
+ 'price' => [
+ 'asc' => [ProductVariant::tableName() .'.price' => SORT_ASC],
+ 'desc' => [ProductVariant::tableName() .'.price' => SORT_DESC],
+ 'default' => SORT_DESC,
+ 'label' => 'цене',
+ ],
+ ],
+ ]
+ ]);
+
+ if (!$this->validate()) {
+ return $dataProvider;
+ }
+
+ $this->_setParams($query, $params);
+
+ return $dataProvider;
+ }
+
+ public function optionsForCategory($category = null, $params = []) {
+ $query = TaxOption::find()
+ ->select([
+ TaxOption::tableName() .'.*',
+ 'COUNT('. ProductOption::tableName() .'.product_id) AS _items_count'
+ ])
+ ->innerJoin(ProductOption::tableName(), ProductOption::tableName() .'.option_id='. TaxOption::tableName() .'.tax_option_id')
+ ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() .'.product_id='. ProductOption::tableName() .'.product_id')
+ ->innerJoin(TaxGroup::tableName(), TaxGroup::tableName() .'.tax_group_id='. TaxOption::tableName() .'.tax_group_id')
+ ->andWhere([TaxGroup::tableName() .'.is_filter' => true]);
+ if (!empty($category)) {
+ $query->andWhere([ProductCategory::tableName() .'.category_id' => $category->category_id]);
+ }
+ $query->groupBy(TaxOption::tableName() .'.tax_option_id');
+
+ if (!empty($params['prices'])) {
+ if ($params['prices']['min'] > 0 || $params['prices']['max'] > 0) {
+ $query->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id='. ProductCategory::tableName() .'.product_id');
+ }
+ if ($params['prices']['min'] > 0) {
+ $query->andWhere(['>=', ProductVariant::tableName() .'.price', $params['prices']['min']]);
+ }
+ if ($params['prices']['max'] > 0) {
+ $query->andWhere(['<=', ProductVariant::tableName() .'.price', $params['prices']['max']]);
+ }
+ }
+ if (!empty($params['brands'])) {
+ $query->innerJoin(Product::tableName(), Product::tableName() .'.product_id='. ProductCategory::tableName() .'.product_id');
+ $query->andWhere([Product::tableName() .'.brand_id' => $params['brands']]);
+ }
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ return $dataProvider;
+ }
+
+ public function priceLimits($category = null, $params = []) {
+ if (!empty($category)) {
+ /** @var ActiveQuery $query */
+ $query = $category->getRelations('product_categories');
+ } else {
+ $query = Product::find();
+ }
+ $query->joinWith('variant');
+
+ $this->_setParams($query, $params, false);
+
+// $query->select([
+// 'MIN('. ProductVariant::tableName() .'.price) AS priceMIN',
+// 'MAX('. ProductVariant::tableName() .'.price) AS priceMAX',
+// ]);
+
+ return [
+ 'min' => $query->min(ProductVariant::tableName() .'.price'),
+ 'max' => $query->max(ProductVariant::tableName() .'.price'),
+ ];
+ }
+
+ protected function _setParams(&$query, $params, $setPriceLimits = true) {
+ if (!empty($params['keywords'])) {
+ if (!is_array($params['keywords'])) {
+ $params['keywords'] = [$params['keywords']];
+ }
+ foreach ($params['keywords'] as $keyword) {
+ $query->andFilterWhere(['ilike', Product::tableName() .'.name', $keyword]);
+ }
+ }
+ if (!empty($params['brands'])) {
+ $query->andFilterWhere([Product::tableName() .'.brand_id' => $params['brands']]);
+ }
+ if (!empty($params['options'])) {
+ foreach ($params['options'] as $group => $options) {
+ foreach ($options as &$option) {
+ $option = "'$option'";
+ }
+ $query->andWhere(
+ Product::tableName() . '.product_id IN (SELECT product_id AS products FROM product_option INNER JOIN tax_option ON tax_option.tax_option_id = product_option.option_id INNER JOIN tax_group ON tax_group.tax_group_id = tax_option.tax_group_id WHERE tax_group.alias LIKE \''. $group .'\' AND tax_option.alias IN (' . implode(',', $options) . '))'
+ );
+ }
+ }
+ if ($setPriceLimits && !empty($params['prices'])) {
+ if ($params['prices']['min'] > 0) {
+ $query->andWhere(['>=', ProductVariant::tableName() .'.price', $params['prices']['min']]);
+ }
+ if ($params['prices']['max'] > 0) {
+ $query->andWhere(['<=', ProductVariant::tableName() .'.price', $params['prices']['max']]);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/frontend/models/ResetPasswordForm.php b/frontend/models/ResetPasswordForm.php
new file mode 100644
index 0000000..d92b49e
--- /dev/null
+++ b/frontend/models/ResetPasswordForm.php
@@ -0,0 +1,65 @@
+_user = User::findByPasswordResetToken($token);
+ if (!$this->_user) {
+ throw new InvalidParamException('Wrong password reset token.');
+ }
+ parent::__construct($config);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ ['password', 'required'],
+ ['password', 'string', 'min' => 6],
+ ];
+ }
+
+ /**
+ * Resets password.
+ *
+ * @return boolean if password was reset.
+ */
+ public function resetPassword()
+ {
+ $user = $this->_user;
+ $user->setPassword($this->password);
+ $user->removePasswordResetToken();
+
+ return $user->save(false);
+ }
+}
diff --git a/frontend/models/SignupForm.php b/frontend/models/SignupForm.php
new file mode 100644
index 0000000..7c7d9c0
--- /dev/null
+++ b/frontend/models/SignupForm.php
@@ -0,0 +1,106 @@
+ 'trim'],
+ ['username', 'required'],
+ [['username','surname'], 'string', 'min' => 2, 'max' => 255],
+
+ ['email', 'filter', 'filter' => 'trim'],
+ ['email', 'required'],
+ ['email', 'email'],
+ [['email','phone'], 'string', 'max' => 255],
+ ['email', 'unique', 'targetClass' => '\common\models\Customers', 'message' => Yii::t('app','message',[
+ 'field' => 'Email'
+ ])],
+
+ [['phone'], 'unique', 'targetClass' => '\common\models\Customers', 'message' => Yii::t('app','message',[
+ 'field' => 'Телефон'
+ ])],
+
+ ['password_repeat', 'required'],
+ ['password_repeat', 'compare', 'compareAttribute'=>'password', 'message'=> Yii::t('app', 'message_match_password') ],
+
+ ['password', 'required'],
+ ['password', 'string', 'min' => 6],
+
+ [
+ 'verifyCode',
+ 'safe',
+ 'on'=>[SignupForm::SCENARIO_AJAX]
+ ],
+ [
+ 'verifyCode',
+ 'captcha',
+ 'on'=>[SignupForm::SCENARIO_SUBMIT]
+ ],
+ [
+ 'verifyCode',
+ 'captcha',
+ 'on'=>[SignupForm::SCENARIO_DEFAULT]
+ ],
+
+
+
+ ];
+ }
+
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'verifyCode' => 'Verification Code',
+ ];
+ }
+
+ /**
+ * Signs user up.
+ *
+ * @return Customers|null the saved model or null if saving fails
+ */
+ public function signup()
+ {
+
+ if (!$this->validate()) {
+ return null;
+ }
+
+ $user = new Customers();
+ $user->username = $this->username;
+ $user->surname = $this->surname;
+ $user->email = $this->email;
+ $user->phone = $this->phone;
+ $user->setPassword($this->password);
+ $user->generateAuthKey();
+ $user->validate();
+ return $user->save() ? $user : null;
+ }
+}
diff --git a/frontend/page/show.php b/frontend/page/show.php
new file mode 100644
index 0000000..b7febbd
--- /dev/null
+++ b/frontend/page/show.php
@@ -0,0 +1,4 @@
+title = $page->title;
+$this->params['breadcrumbs'][] = $this->title;
+echo $page->body;
\ No newline at end of file
diff --git a/frontend/views/articles/index.php b/frontend/views/articles/index.php
new file mode 100644
index 0000000..989d394
--- /dev/null
+++ b/frontend/views/articles/index.php
@@ -0,0 +1,44 @@
+
+use yii\helpers\Url;
+use yii\widgets\Breadcrumbs;
+use app\models\News;
+use yii\widgets\LinkPager;
+use app\components\Text
+?>
+
+$this->title = 'Блог';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Блог']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Блог']);
+?>
+
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ 'Блог'
+ ],
+ ]) ?>
+
+
+
+
+
+
+
Блог
+
+
+
+
+
+
+ =LinkPager::widget([
+ 'pagination' => $pages,
+ 'registerLinkTags' => true
+ ]);?>
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/articles/show.php b/frontend/views/articles/show.php
new file mode 100644
index 0000000..85eb38f
--- /dev/null
+++ b/frontend/views/articles/show.php
@@ -0,0 +1,32 @@
+
+use yii\helpers\Url;
+use yii\widgets\Breadcrumbs;
+use app\models\News;
+?>
+
+$this->title = $news->meta_title;
+$this->registerMetaTag(['name' => 'description', 'content' => $news->meta_description]);
+$this->registerMetaTag(['name' => 'keywords', 'content' => $news->meta_keywords]);
+?>
+
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ ['label'=>'Новости','url'=>['news/index']],
+ $news->title
+ ],
+ ]) ?>
+
+
+
+
+
+
+
=$news->title?>
+
+
+ =$news->body?>
+
=$news->date?>
+
+
+
\ No newline at end of file
diff --git a/frontend/views/cabinet/bookmarks.php b/frontend/views/cabinet/bookmarks.php
new file mode 100644
index 0000000..d03dfc9
--- /dev/null
+++ b/frontend/views/cabinet/bookmarks.php
@@ -0,0 +1,24 @@
+title = 'Закладки';
+$this->params['breadcrumbs'][] = $this->title;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\widgets\ActiveForm;
+?>
+
+''
+]); ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/cabinet/index.php b/frontend/views/cabinet/index.php
new file mode 100644
index 0000000..fd47c28
--- /dev/null
+++ b/frontend/views/cabinet/index.php
@@ -0,0 +1,18 @@
+title = 'Moй кабинет';
+$this->params['breadcrumbs'][] = $this->title;
+
+?>
+
+
+
Имя
+
e-mail
+
Телефон
+
+
+
+
+
= Yii::$app->user->identity->name ?>
+
= Yii::$app->user->identity->email ?>
+
= Yii::$app->user->identity->phone ?>
+
\ No newline at end of file
diff --git a/frontend/views/cabinet/my-orders.php b/frontend/views/cabinet/my-orders.php
new file mode 100644
index 0000000..6105eae
--- /dev/null
+++ b/frontend/views/cabinet/my-orders.php
@@ -0,0 +1,24 @@
+title = 'Мои заказы';
+$this->params['breadcrumbs'][] = $this->title;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\widgets\ActiveForm;
+?>
+
+''
+]); ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/cabinet/update.php b/frontend/views/cabinet/update.php
new file mode 100644
index 0000000..dc02d4e
--- /dev/null
+++ b/frontend/views/cabinet/update.php
@@ -0,0 +1,56 @@
+title = 'Редактировать личные данные';
+ $this->params['breadcrumbs'][] = $this->title;
+ use yii\helpers\Html;
+ use yii\helpers\Url;
+ use yii\widgets\ActiveForm;
+?>
+
+''
+]); ?>
+
+
+
+
+
+ = $form->field($model, 'email', [
+ 'template' => ''.Yii::t('app', 'email').'{input}{error}{hint} ',
+ ]) ?>
+
+
+
+ = $form->field($model, 'username',[
+ 'template' => ''.Yii::t('app', 'username').'{input}{error}{hint} ',
+ ])->textInput() ?>
+
+
+
+ = $form->field($model, 'surname',[
+ 'template' => ''.Yii::t('app', 'surname').'{input}{error}{hint} ',
+ ])->textInput() ?>
+
+
+
+ = $form->field($model, 'phone', [
+ 'template' => ''.Yii::t('app', 'phone').'{input}{error}{hint} ',
+ ])->textInput() ?>
+
+
+
+
+ = Html::submitButton(Yii::t('app', 'registration'), ['class' => 'my_cust_cabinet_btn']) ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/call/index.php b/frontend/views/call/index.php
new file mode 100644
index 0000000..504ceb5
--- /dev/null
+++ b/frontend/views/call/index.php
@@ -0,0 +1,34 @@
+
+use yii\helpers\Url;
+use yii\widgets\Breadcrumbs;
+use app\models\News;
+use yii\widgets\LinkPager;
+use yii\widgets\ActiveForm;
+
+?>
+
+$this->title = 'Обратный звонок';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Обратный звонок']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Обратный звонок']);
+?>
+
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ 'Обратный звонок'
+ ],
+ ]) ?>
+
+
+
+
+
+
+
Обратный звонок
+
+
+= $form->errorSummary($model); ?>
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/call/success.php b/frontend/views/call/success.php
new file mode 100644
index 0000000..84999f5
--- /dev/null
+++ b/frontend/views/call/success.php
@@ -0,0 +1,32 @@
+
+use yii\helpers\Url;
+use yii\widgets\Breadcrumbs;
+use app\models\News;
+use yii\widgets\LinkPager;
+use app\components\Text
+?>
+
+$this->title = 'Обратный звонок';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Обратный звонок']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Обратный звонок']);
+?>
+
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ 'Обратный звонок'
+ ],
+ ]) ?>
+
+
+
+
+
+
+
Обратный звонок
+
+ Мы получили от Вас сообщение! Мы свяжемся с Вами в ближайшее время.
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/catalog/categories.php b/frontend/views/catalog/categories.php
new file mode 100644
index 0000000..06a21b8
--- /dev/null
+++ b/frontend/views/catalog/categories.php
@@ -0,0 +1,45 @@
+title = $category->name;
+foreach($category->getParents()->all() as $parent) {
+ $this->params['breadcrumbs'][] = ['label' => $parent->name, 'url' => ['catalog/category', 'category' => $parent]];
+}
+$this->params['breadcrumbs'][] = $this->title;
+?>
+= $this->title ?>
+
+
+
+
+
+ getAllChildrenTree(2, [], 'categoryName') as $category) :?>
+
+
+ image)) :?>
+
+
+
+
+
= $category['item']->name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php
new file mode 100644
index 0000000..16fa499
--- /dev/null
+++ b/frontend/views/catalog/product.php
@@ -0,0 +1,248 @@
+title = $product->name;
+foreach($product->category->getParents()->all() as $parent) {
+ $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]];
+}
+$this->params['breadcrumbs'][] = ['label' => $product->category->categoryName->value, 'url' => ['catalog/category', 'category' => $product->category]];
+$this->params['breadcrumbs'][] = $product->name .' #'. $product->variant->sku;
+?>
+= $product->name .' '. $product->variant->name?>
+
+
+
+
+ image)) :?>
+
+
+
+
+
+
+
+
+ images)) :?>
+
+ images as $image) :?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Код: = $product->variant->sku?>
+
= $product->stock !== 0 && $product->variant->price > 0 ? ' есть в наличии' : ' нет в наличии'?>
+
+
+
+
+ variant->price > 0) :?>
+
+ = $product->variant->price?>
+
+
грн.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Доставка товара на следующий день после выставления счета. Мы доставим “День в день” — уточните это у менеджера.
+
+
Подробно о доставке
+
+
+
+
+
+
+
Характеристики
+
+
+
+
+
= $group->name?>
+
+ _options as $option) :?> = $option->ValueRenderHTML?>
+
+
+
+
+
+
+
+
+
+
+
+
+
С этим товаром покупают
+
+
+
+
+
+
+ Характеристики
+
+ description)) :?>
+ Описание
+
+ video)) :?>
+ Видео
+
+
+
+
+
+
+
+
+
+
+
= $group->name?>
+
+ _options as $option) :?> = $option->ValueRenderHTML?>
+
+
+
+
+
+
+
+
+ description)) :?>
+
+ = $product->description?>
+
+
+ video)) :?>
+
+ = $product->video?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Вы недавно просматривали
+
+
+
+
+
+
+
+
+
diff --git a/frontend/views/catalog/product_item.php b/frontend/views/catalog/product_item.php
new file mode 100644
index 0000000..11b0a1f
--- /dev/null
+++ b/frontend/views/catalog/product_item.php
@@ -0,0 +1,27 @@
+
+
\ No newline at end of file
diff --git a/frontend/views/catalog/product_smart.php b/frontend/views/catalog/product_smart.php
new file mode 100644
index 0000000..9f6cc45
--- /dev/null
+++ b/frontend/views/catalog/product_smart.php
@@ -0,0 +1,20 @@
+
+
+
+
+ = $product->name?>
+ brand) :?>
+
Бренд: = $product->brand->name?>
+
+
= implode(', ', $product->categoriesNames)?>
+ variant) :?>
+
= $product->variant->price?> грн.
+
в корзину
+
+
добавить к сравнению
+
+
\ No newline at end of file
diff --git a/frontend/views/catalog/products.old.php b/frontend/views/catalog/products.old.php
new file mode 100644
index 0000000..201dd88
--- /dev/null
+++ b/frontend/views/catalog/products.old.php
@@ -0,0 +1,278 @@
+title = $category->categoryName->value;
+foreach($category->getParents()->all() as $parent) {
+ $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'alias' => $parent->alias]];
+}
+$this->params['breadcrumbs'][] = $category->categoryName->value;
+?>
+
+
+
+
+
+
+
+
= $category->categoryName->value?> (= $all_count?>)
+
+
+
По данному запросу товары не найдены.
+
Показать все товары из категории "= $category->categoryName->value?>"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ totalCount > $pages->pageSize) :?>
+
+
+
+
+ Страница:
+ = \yii\widgets\LinkPager::widget([
+ 'pagination' => $pages,
+ 'options' => ['class' => 'pagination pull-right'],
+ ]);
+ ?>
+
+
+
+
+
+ description)) :?>
+
+ = $category->description?>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/views/catalog/products.php b/frontend/views/catalog/products.php
new file mode 100644
index 0000000..47fc2a2
--- /dev/null
+++ b/frontend/views/catalog/products.php
@@ -0,0 +1,251 @@
+title = $category->categoryName->value;
+foreach($category->getParents()->all() as $parent) {
+ $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]];
+}
+$this->params['breadcrumbs'][] = $category->categoryName->value;
+
+$this->params['seo']['seo_text'] = 'TEST SEO TEXT';
+$this->params['seo']['h1'] = 'TEST H1';
+$this->params['seo']['description'] = 'TEST DESCRIPTION';
+$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD';
+$this->params['seo']['key']= 'product_list';
+?>
+
+
+
+
+
+
+
+
= $category->categoryName->value?> (= $productProvider->totalCount?>)
+ count) :?>
+
По данному запросу товары не найдены.
+
+
Показать все товары из категории "= $category->categoryName->value?>"
+
+
+
+
+
+
+
+
+
+ models as $product) :?>
+
+
+
+
+ totalCount > $productProvider->pagination->pageSize) :?>
+
+
+
+
+ Страница:
+ = \yii\widgets\LinkPager::widget([
+ 'pagination' => $productProvider->pagination,
+ 'options' => ['class' => 'pagination pull-right'],
+ ]);
+ ?>
+
+
+
+
+
+ description)) :?>
+
+ = $category->description?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Вы недавно просматривали
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/catalog/search.php b/frontend/views/catalog/search.php
new file mode 100644
index 0000000..cd00cbb
--- /dev/null
+++ b/frontend/views/catalog/search.php
@@ -0,0 +1,136 @@
+ implode(' ', $keywords),
+];
+
+if (!empty($category)) {
+ $page_data['category'] = $category->name;
+}
+
+$this->title = Yii::t('product', "Search for \"{keywords}\"". (empty($category) ? '' : ' in category \"{category}\"'), $page_data);
+
+$this->params['seo']['seo_text'] = 'TEST SEO TEXT';
+$this->params['seo']['h1'] = 'TEST H1';
+$this->params['seo']['description'] = 'TEST DESCRIPTION';
+$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD';
+$this->params['seo']['key']= 'product_list';
+?>
+
+
+
+
+
+
+
+
+
= Yii::t('product', "Search for \"{keywords}\"". (empty($category) ? '' : ' in category "{category}"'), $page_data)?>= $productProvider->totalCount ? ' ('.$productProvider->totalCount .')' : ''?>
+ count) :?>
+
По данному запросу товары не найдены.
+
+
Показать все товары из категории "= $category->name?>"
+
+
+
+
+
+
+
+
+
+ models as $product) :?>
+
+
+
+
+ totalCount > $productProvider->pagination->pageSize) :?>
+
+
+
+
+ Страница:
+ = \yii\widgets\LinkPager::widget([
+ 'pagination' => $productProvider->pagination,
+ 'options' => ['class' => 'pagination pull-right'],
+ ]);
+ ?>
+
+
+
+
+ description)) :?>
+
+ = $category->description?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Вы недавно просматривали
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/event/_objects.php b/frontend/views/event/_objects.php
new file mode 100644
index 0000000..20ae70b
--- /dev/null
+++ b/frontend/views/event/_objects.php
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+ = Html::a(Html::img($model->minImg($model->image, '200','200')),Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?>
+
+
+
+
+
+
+
= Html::a($model->name,Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?>
+
+ Срок действия по: = $model->end_at?>
+
+
+
+ = TextHelper::truncateHtmlText($model->body, 200, '...') ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/event/index.php b/frontend/views/event/index.php
new file mode 100644
index 0000000..a93a500
--- /dev/null
+++ b/frontend/views/event/index.php
@@ -0,0 +1,22 @@
+params['breadcrumbs'][] = ['label' => 'Акции', 'url' => ['index']];
+$this->params['seo']['seo_text'] = 'TEST SEO TEXT';
+$this->params['seo']['h1'] = 'TEST H1';
+$this->params['seo']['description'] = 'TEST DESCRIPTION';
+$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD';
+?>
+
+ $dataProvider,
+ 'itemView'=>'_objects',
+ 'summary'=>'',
+ 'layout' => "{items}
+ "
+ ] );
+?>
+
+ = Seo::widget(['row'=>'seo_text'])?>
+
diff --git a/frontend/views/event/view.php b/frontend/views/event/view.php
new file mode 100644
index 0000000..b6e8727
--- /dev/null
+++ b/frontend/views/event/view.php
@@ -0,0 +1,51 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Акции', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+$this->params['name'] = $this->title;
+?>
+
+
= $model->name?>
+ = Html::img($model->minImg($model->image, '940','480')) ?>
+
+ Срок действия по: = $model->end_at?>
+
+
+ = $model->body?>
+
+ $this,
+ 'model' => $model->className(),
+ 'model_id' => $model->event_id,
+ 'comment_class' => \common\modules\comment\models\Comment::className(),
+ 'rating_class' => \common\modules\comment\models\Rating::className(),
+ 'class_options' => [
+ 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST,
+ 'user_id' => \Yii::$app->user->getId(),
+ 'guestComment' => true,
+ 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE,
+ ],
+ 'list_options' => [
+ 'view' => 'list-comment-review',
+ ],
+ 'form_options' => [
+ 'view' => 'form-comment-review',
+ 'tag' => 'span',
+ ],
+ 'options' => [
+ 'class' => 'proektant-comments-wr style',
+ ],
+ ]);
+ ?>
+
+
+ = Seo::widget(['row'=>'seo_text'])?>
+
diff --git a/frontend/views/iam/1person.php b/frontend/views/iam/1person.php
new file mode 100644
index 0000000..22b800e
--- /dev/null
+++ b/frontend/views/iam/1person.php
@@ -0,0 +1,52 @@
+
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\web\View;
+use yii\widgets\Breadcrumbs;
+
+
+
+$this->title = 'Профиль';
+
+
+?>
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ ['label'=>'Мой кабинет'],
+ ],
+ ]) ?>
+
+
+
+
+
+
+
+
+
+
Имя
=Html::encode($model->name) . ' ' . Html::encode($model->surname);?>
+
Электронная почта
=Html::encode($model->username)?>
+
Телефон
=Html::encode($model->phone)?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/iam/admin.php b/frontend/views/iam/admin.php
new file mode 100644
index 0000000..3209060
--- /dev/null
+++ b/frontend/views/iam/admin.php
@@ -0,0 +1 @@
+Вы зашли как Админ! У вас нет личного кабинета!
\ No newline at end of file
diff --git a/frontend/views/iam/company.php b/frontend/views/iam/company.php
new file mode 100644
index 0000000..8e81497
--- /dev/null
+++ b/frontend/views/iam/company.php
@@ -0,0 +1,65 @@
+title = 'Профиль - Бычок';
+$this->params['breadcrumbs'][] = 'Профиль';
+
+?>
+
+
+
+
+
+
+
+time_online>time()):?>
online
+
+
=Html::encode($model->company)?>
+
Имя: =Html::encode($model->name) . ' ' . Html::encode($model->surname);?>
+
Логин: =Html::encode($model->username)?>
+
Телефон: =Html::encode($model->phone)?>
+
+
+=Html::a('Редактировать профиль', ['/iam/edit'], ['class'=>'btn btn-primary'])?>
+
+=Html::a('Создать услугу', ['/myservice/save'], ['class'=>'btn btn-success'])?>
+
+
+
+$p = 0;
+if(!empty($model->username))$p +=20;
+if(!empty($model->name))$p +=20;
+if(!empty($model->phone))$p +=20;
+if(!empty($model->company))$p +=20;
+
+
+if(!empty($model->body))$p +=20;
+echo 'Ваш профиль заполнен на '.round($p).'%:';
+echo Progress::widget([
+ 'percent' => round($p),
+ 'barOptions' => ['class' => 'progress-bar-success'],
+ 'options' => ['class' => 'progress-striped','style'=>'width:400px;']
+]);?>
+
+
+
О компании:
+
=(!empty($model->body))?nl2br(Html::encode($model->body)):'Не заполненно!'?>
+
+
+
+
+ active==0):?>
+
Ваш Профиль пока не проверен Бычком!
+
+
Поздравляем! Ваш Профиль проверен Бычком!
+
+ =Html::a('Создать услугу', ['/myservice/save'], ['class'=>'btn btn-success btn-lg btn-block'])?>
+ =Html::a('Ваши услуги', ['/myservice'], ['class'=>'btn btn-default btn-lg btn-block'])?>
+
+
+
+
diff --git a/frontend/views/iam/customer.php b/frontend/views/iam/customer.php
new file mode 100644
index 0000000..7f17027
--- /dev/null
+++ b/frontend/views/iam/customer.php
@@ -0,0 +1,68 @@
+title = 'Профиль - Бычок';
+$this->params['breadcrumbs'][] = 'Профиль';
+
+?>
+
+
+
+
+
+
+
+time_online>time()):?>
online
+
+
=Html::encode($model->name) . ' ' . Html::encode($model->surname);?>
+
Логин: =Html::encode($model->username)?>
+
Телефон: =Html::encode($model->phone)?>
+
Пол: =Html::encode($model->sex)?>
+
Семейное положение: =Html::encode($model->status)?>
+
Дети: =Html::encode($model->children)?>
+
Возраст: =$model->old;?> лет
+=Html::a('Редактировать профиль', ['/iam/edit'], ['class'=>'btn btn-primary'])?>
+
+=Html::a('Создать заказ', ['/myorders/save'], ['class'=>'btn btn-success'])?>
+
+
+
+$p = 0;
+if(!empty($model->username))$p +=14.5;
+if(!empty($model->name))$p +=14.5;
+if(!empty($model->phone))$p +=14.5;
+if(!empty($model->sex))$p +=14.5;
+if(!empty($model->status))$p +=14.5;
+if(!empty($model->children))$p +=14.5;
+if(!empty($model->old))$p +=14.5;
+
+if(!empty($model->body))$p +=14.5;
+echo 'Ваш профиль заполнен на '.round($p).'%:';
+echo Progress::widget([
+ 'percent' => round($p),
+ 'barOptions' => ['class' => 'progress-bar-success'],
+ 'options' => ['class' => 'progress-striped','style'=>'width:400px;']
+]);?>
+
+
+
О себе:
+
=(!empty($model->body))?nl2br(Html::encode($model->body)):'Не заполненно!'?>
+
+
+
+
+ active==0):?>
+
Ваш Профиль пока не проверен Бычком!
+
+
Поздравляем! Ваш Профиль проверен Бычком!
+
+ =Html::a('Создать заказ', ['/myorders/save'], ['class'=>'btn btn-success btn-lg btn-block'])?>
+ =Html::a('Ваши заказы', ['/myorders'], ['class'=>'btn btn-default btn-lg btn-block'])?>
+
+
+
+
diff --git a/frontend/views/iam/edit_company.php b/frontend/views/iam/edit_company.php
new file mode 100644
index 0000000..ba5e43c
--- /dev/null
+++ b/frontend/views/iam/edit_company.php
@@ -0,0 +1,58 @@
+title = 'Редактирование Исполнителя - Компании';
+$this->params['breadcrumbs'][] = ['label'=>'Профиль','url'=>['/iam/index']];
+$this->params['breadcrumbs'][] = $this->title;
+
+$this->registerJsFile(Yii::$app->request->baseUrl.'/js/jquery.mask.js',['position'=>View::POS_HEAD,'depends'=>['yii\web\YiiAsset']]);
+
+$this->registerJs("
+$('#user-phone').mask('(000) 000-0000');
+", View::POS_READY, 'mask');
+?>
+
+
= Html::encode($this->title) ?>
+
+ 'reg-form',
+ 'options' => ['class' => 'form-vertical','enctype' => 'multipart/form-data'],
+ 'fieldConfig' => [
+ //'template' => "{label}\n
{input}
\n
{error}
",
+ //'labelOptions' => ['class' => 'col-lg-2 control-label'],
+ ],
+ ]); ?>
+
+ = $form->field($model, 'company') ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'password_repeat')->passwordInput(['value'=>$model->password]) ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'surname') ?>
+
+
+
+
+ = $form->field($model, 'body')->textArea(['rows' => '6']) ?>
+
+ = $form->field($model, 'image')->fileInput() ?>
+
+ = $form->field($model, 'old_image')->hiddenInput(['value'=>$model->image])->label(false); ?>
+
+ = $form->field($model, 'role')->hiddenInput(['value'=>'company'])->label(false); ?>
+
+ = Html::submitButton(' Сохранить ', ['class' => 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/iam/edit_customer.php b/frontend/views/iam/edit_customer.php
new file mode 100644
index 0000000..febce4f
--- /dev/null
+++ b/frontend/views/iam/edit_customer.php
@@ -0,0 +1,86 @@
+title = 'Редактирование Заказчика';
+$this->params['breadcrumbs'][] = ['label'=>'Профиль','url'=>['/iam/index']];
+$this->params['breadcrumbs'][] = $this->title;
+
+$this->registerJsFile(Yii::$app->request->baseUrl.'/js/jquery.mask.js',['position'=>View::POS_HEAD,'depends'=>['yii\web\YiiAsset']]);
+
+$this->registerJs("
+$('#user-phone').mask('(000) 000-0000');
+", View::POS_READY, 'mask');
+?>
+
+
= Html::encode($this->title) ?>
+
+ 'reg-form',
+ 'options' => ['class' => 'form-vertical','enctype' => 'multipart/form-data'],
+ 'fieldConfig' => [
+ //'template' => "{label}\n
{input}
\n
{error}
",
+ //'labelOptions' => ['class' => 'col-lg-2 control-label'],
+ ],
+ ]); ?>
+
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'password_repeat')->passwordInput(['value'=>$model->password]) ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'surname') ?>
+
+
Дата рождения
+
+ $day = [];
+ for($i=1;$i<=31;$i++){
+ $day[$i] = $i;
+ }
+
+ echo $form->field($model, 'birth_day')->dropDownList($day,['prompt'=>'День'])->label(false);
+ ?>
+
+
+ echo $form->field($model, 'birth_mouth')->dropDownList(['1'=>'Январь','2'=>'Февраль','3'=>'Март','4'=>'Апрель','5'=>'Май','6'=>'Июнь','7'=>'Июль','8'=>'Август','9'=>'Сентябрь','10'=>'Октябрь','11'=>'Ноябрь','12'=>'Декабрь'],['prompt'=>'Месяц'])->label(false);
+ ?>
+
+
+ $year = [];
+ for($i=date('Y');$i>=1920;$i--){
+ $year[$i] = $i;
+ }
+
+ echo $form->field($model, 'birth_year')->dropDownList($year,['prompt'=>'Год'])->label(false);
+ ?>
+
+ = $form->field($model, 'phone') ?>
+
+ =$form->field($model, 'sex')->dropDownList(['мужской' => 'мужской', 'женский' => 'женский'],['prompt'=>'...']); ?>
+
+ =$form->field($model, 'status')->dropDownList(['Не женат' => 'Не женат','Не замужем'=>'Не замужем', 'Женат' => 'Женат','Замужем'=>'Замужем'],['prompt'=>'...']); ?>
+
+ =$form->field($model, 'children')->dropDownList(['есть' => 'есть', 'нет' => 'нет'],['prompt'=>'...']); ?>
+
+
+ = $form->field($model, 'body')->textArea(['rows' => '6']) ?>
+
+ = $form->field($model, 'image')->fileInput() ?>
+
+ = $form->field($model, 'old_image')->hiddenInput(['value'=>$model->image])->label(false); ?>
+
+ = $form->field($model, 'role')->hiddenInput(['value'=>'customer'])->label(false); ?>
+
+ = Html::submitButton(' Сохранить ', ['class' => 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/iam/edit_person.php b/frontend/views/iam/edit_person.php
new file mode 100644
index 0000000..9c8a170
--- /dev/null
+++ b/frontend/views/iam/edit_person.php
@@ -0,0 +1,107 @@
+title = 'Редактирование профиля';
+$this->params['breadcrumbs'][] = ['label'=>'Профиль','url'=>['/iam/index']];
+$this->params['breadcrumbs'][] = $this->title;
+
+$this->registerJsFile(Yii::$app->request->baseUrl.'/js/jquery.mask.js',['position'=>View::POS_HEAD,'depends'=>['yii\web\YiiAsset']]);
+
+$this->registerJs("
+$('#user-phone').mask('(000) 000-0000');
+", View::POS_READY, 'mask');
+?>
+
+ = Breadcrumbs::widget([
+ 'links' => ['Мой кабинет'],
+ ]) ?>
+
+
+
+
Редактировать личные данные
+
+
+
+
+
+
+ 'reg-form',
+ 'options' => ['class' => 'form-vertical','enctype' => 'multipart/form-data'],
+ 'fieldConfig' => [
+ //'template' => "{label}\n
{input}
\n
{error}
",
+ //'labelOptions' => ['class' => 'col-lg-2 control-label'],
+ ],
+ ]); ?>
+
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'password_repeat')->passwordInput(['value'=>$model->password]) ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'surname') ?>
+
+
Дата рождения
+
+ = $form->field($model, 'phone') ?>
+
+ =$form->field($model, 'sex')->dropDownList(['мужской' => 'мужской', 'женский' => 'женский'],['prompt'=>'...']); ?>
+
+
+ = $form->field($model, 'body')->textArea(['rows' => '6']) ?>
+
+
+ = $form->field($model, 'role')->hiddenInput(['value'=>'person'])->label(false); ?>
+
+
+
+ = Html::submitButton(' Сохранить ', ['class' => 'submit4 bottom3', 'name' => 'login-button']) ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/iam/myorders.php b/frontend/views/iam/myorders.php
new file mode 100644
index 0000000..5920c74
--- /dev/null
+++ b/frontend/views/iam/myorders.php
@@ -0,0 +1,82 @@
+
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\web\View;
+use yii\grid\GridView;
+use yii\widgets\Breadcrumbs;
+
+
+$this->title = 'Мои заказы';
+$this->params['breadcrumbs'][] = $this->title;
+
+$this->registerJs("
+
+ $('.orders_view').hide();
+ $('.fav_point .link').click(function(){
+ $(this).parent().parent().find('.orders_view').toggle();
+ return false;
+ });
+
+", View::POS_READY, 'orders_view');
+?>
+
+ = Breadcrumbs::widget([
+ 'links' => ['Мой кабинет'],
+ ]) ?>
+
+
+
+
Мои заказы
+
+
+
+
+
+
+
+
+
+
+
+
+
=$item->date_time?>
+
на =$item->total?> грн
+
=$item->status?>
+
+
+
+ products as $item_p):if(!empty($item_p->cost)):?>
+
+
mod->imageAvator)):?>
+
=$item_p->product_name?>
+
Кол-во: =$item_p->count?>
+
=$item_p->cost?> грн.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/views/iam/person.php b/frontend/views/iam/person.php
new file mode 100644
index 0000000..0075253
--- /dev/null
+++ b/frontend/views/iam/person.php
@@ -0,0 +1,52 @@
+
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\web\View;
+use yii\widgets\Breadcrumbs;
+
+
+
+$this->title = 'Профиль';
+?>
+
+
+ = Breadcrumbs::widget([
+ 'links' => ['Мой кабинет'],
+ ]) ?>
+
+
+
+
Личные данные
+
+
+
+
+
+
+
+
Имя
=Html::encode($model->name) . ' ' . Html::encode($model->surname);?>
+
Электронная почта
=Html::encode($model->username)?>
+
Телефон
=Html::encode($model->phone)?>
+
+
+
+
+
+
+
+
diff --git a/frontend/views/iam/price.php b/frontend/views/iam/price.php
new file mode 100644
index 0000000..52c57ba
--- /dev/null
+++ b/frontend/views/iam/price.php
@@ -0,0 +1,40 @@
+title = 'Пожелания';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Пожелания']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Пожелания']);
+
+?>
+
+Пожелания
+
+
+= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'columns' => [
+ [
+ 'attribute' => 'id',
+ 'value'=>'id',
+ 'contentOptions'=>['style'=>'width: 70px;']
+ ],
+ [
+ 'attribute' => 'date_time',
+ 'value'=>'date_time',
+ 'contentOptions'=>['style'=>'width: 150px;']
+ ],
+ [
+ 'attribute' => 'product_name',
+ 'value'=>function($data){
+ return (!empty($data->product->name))?Html::a($data->product->name, ['products/show','translit_rubric'=>$data->product->catalog->translit,'translit'=>$data->product->translit,'id'=>$data->product->id]):'Этот товар удален с сайта';
+ },
+ 'format'=>'raw',
+ ],
+
+
+
+ ],
+]) ?>
\ No newline at end of file
diff --git a/frontend/views/iam/share.php b/frontend/views/iam/share.php
new file mode 100644
index 0000000..e55d925
--- /dev/null
+++ b/frontend/views/iam/share.php
@@ -0,0 +1,79 @@
+title = 'Мои закладки';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Мои закладки']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Мои закладки']);
+
+$this->registerJs("
+
+ $('.orders_view').hide();
+ $('.fav_point .link').click(function(){
+ $(this).parent().parent().find('.orders_view').toggle();
+ return false;
+ });
+
+", View::POS_READY, 'orders_view');
+?>
+
+ = Breadcrumbs::widget([
+ 'links' => ['Мой кабинет'],
+ ]) ?>
+
+
+
+
Мои закладки
+
+
+
+
+
+
+
+
+
+ $item):?>
+
+
+
=$item->date?>
+
+
+
+ shareList as $item_p):if(!empty($item_p->product)):?>
+
+
+
+
+ product->cost->cost)):?>
=$item_p->product->cost->cost?> грн.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/views/iam/show_order.php b/frontend/views/iam/show_order.php
new file mode 100644
index 0000000..f24b5b0
--- /dev/null
+++ b/frontend/views/iam/show_order.php
@@ -0,0 +1,55 @@
+
+use yii\helpers\Html;
+use yii\grid\GridView;
+use yii\bootstrap\ActiveForm;
+
+
+$this->title = 'Заказ №'.$model->id;
+$this->params['breadcrumbs'][] = $this->title;
+?>
+Заказ №=$model->id?>
+
+
+= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'columns' => [
+ [
+ 'attribute' => 'id',
+ 'value'=>'id',
+ 'contentOptions'=>['style'=>'width: 70px;']
+ ],
+ [
+ 'attribute' => 'art',
+ 'value'=>'art',
+ 'contentOptions'=>['style'=>'width: 50px;']
+ ],
+ [
+ 'attribute' => 'product_name',
+ 'value'=>'product_name',
+ //'contentOptions'=>['style'=>'max-width: 300px;']
+ ],
+ [
+ 'attribute' => 'name',
+ 'value'=>'name',
+ //'contentOptions'=>['style'=>'max-width: 300px;']
+ ],
+ [
+ 'attribute' => 'cost',
+ 'value'=>'cost',
+ 'contentOptions'=>['style'=>'width: 100px;']
+ ],
+ [
+ 'attribute' => 'count',
+ 'value'=>'count',
+ 'contentOptions'=>['style'=>'width: 30px;']
+ ],
+ [
+ 'attribute' => 'sum_cost',
+ 'value'=>'sum_cost',
+ 'contentOptions'=>['style'=>'width: 100px;']
+ ],
+
+
+ ],
+]) ?>
+
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php
new file mode 100644
index 0000000..0341cf0
--- /dev/null
+++ b/frontend/views/layouts/main.php
@@ -0,0 +1,399 @@
+registerJs ("
+ $('.phone .more').bind('click',function(){
+ $('.phone .more_block').toggle();
+ });
+", View::POS_READY, 'phone');
+//$this->registerCssFile(Yii::$app->request->BaseUrl.'/css/style.css');
+ $this->registerJsFile (Yii::$app->request->baseUrl . '/js/basket.js', ['position' => View::POS_HEAD, 'depends' => ['yii\web\JqueryAsset']]);
+ $this->registerJs ("
+ $('#basket').basket();
+", View::POS_READY, 'basket');
+ $this->registerJsFile (Yii::$app->request->baseUrl . '/js/call.js', ['position' => View::POS_HEAD, 'depends' => ['yii\web\JqueryAsset']]);
+ $this->registerJs ("
+ $('#call').call({token:'" . Yii::$app->request->getCsrfToken () . "'});
+", View::POS_READY, 'call');
+ $this->registerJs ("
+ var activeTab = $('.social li:first a').attr('id');
+ $('.'+activeTab+'_box').show();
+ $('.social li').click(function(){
+ $('.hide').hide();
+ var activeTab = $(this).find('a').attr('id');
+ //alert(activeTab);
+ $('.'+activeTab+'_box').show();
+ return false;
+});
+", View::POS_READY, 'social');
+
+// AssetBundle jcarousel :D
+
+ // jquery-migrate
+ $this->registerJsFile('http://code.jquery.com/jquery-migrate-1.3.0.js',[
+ 'position' => View::POS_HEAD,
+ 'depends' => ['yii\web\JqueryAsset']
+ ]);
+
+ // jcarousel
+ $this->registerCssFile(Yii::$app->request->BaseUrl.'/js/jsor-jcarousel-7bb2e0a/skins/tango/skin.css');
+ $this->registerJsFile(Yii::$app->request->baseUrl.'/js/jsor-jcarousel-7bb2e0a/lib/jquery.jcarousel.min.js',[
+ 'position' => View::POS_HEAD,
+ 'depends' => ['yii\web\JqueryAsset']
+ ]);
+
+ $this->registerJs("
+ $('.jcarousel').jcarousel({
+ vertical: true,
+ scroll: 2
+ });
+ ", View::POS_READY);
+
+// AssetBundle jcarousel :D [close]
+
+?>
+beginPage () ?>
+
+
+
+
+ = Html::csrfMetaTags () ?>
+ = Html::encode ($this->title) ?>
+
+ = HreflangWidget::widget ([]) ?>
+ head () ?>
+
+
+ beginBody () ?>
+ = BgWidget::widget () ?>
+
+
+
+ = $this->render ('/basket/_popup') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /**
+ *
+ **/ ?>
+
+ = $content ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Пока нет!
+
+
+ ';
+
+ $ids = ViewProduct::listView ();
+ if (! empty($ids))
+ {
+ $products = Products::find ()->where (['id' => ViewProduct::listView ()])->all ();
+ echo 'Вы просматривали';
+ }
+ else
+ {
+ $products = Products::find ()->where (['new' => '1'])->orderBy ('id DESC')->innerJoinWith (['cost'])->groupBy ('id')->limit (4)->all ();
+ echo 'Товары со скидкой';
+ }
+ echo '';
+
+ echo '
+
';
+ */
+ ?>
+
+
+
+
+
+
+
+ (044) 303 90 15
+
+
+
+
+
+
Подписаться на акции
+ '/subscribe']);
+ ?>
+ field ($subscribe, 'email')->textInput (['placeholder' => 'E-mail'])->label (false); ?>
+ = $form->field ($subscribe, 'sale')->dropDownList (['10' => '10%', '20' => '20%'], ['prompt' => 'Скидка'])->label (false); ?>
+
укажите желаемый размер скидки
+ 'submit4m']); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
© 2015 Rukzachok. Все права защищены.
+
+
+
+
+
+ endBody () ?>
+
+
+endPage () ?>
\ No newline at end of file
diff --git a/frontend/views/login/error_log b/frontend/views/login/error_log
new file mode 100644
index 0000000..f293d9d
--- /dev/null
+++ b/frontend/views/login/error_log
@@ -0,0 +1 @@
+[23-Feb-2015 22:24:19 UTC] PHP Fatal error: Using $this when not in object context in /home/webplusn/public_html/yii2/modules/admin/views/login/index.php on line 9
diff --git a/frontend/views/login/forgot.php b/frontend/views/login/forgot.php
new file mode 100644
index 0000000..205d4ac
--- /dev/null
+++ b/frontend/views/login/forgot.php
@@ -0,0 +1,38 @@
+title = 'Забыли пароль?';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Забыли пароль?']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Забыли пароль?']);
+
+?>
+
+
+
+
= Html::encode($this->title) ?>
+
Если Вы по каким то причинам забыли свой пароль, то введите пожалуйста свой логин. После чего Вам на почтовый ящик прейдет письмо с вашим паролем.
+
+session->getFlash('success')):?>
+
=$flash?>
+
+
+ 'login-form',
+ 'options' => ['class' => 'well form-vertical'],
+ 'enableClientScript' => false,
+ ]); ?>
+
+ = $form->field($model, 'username') ?>
+
+
+ = Html::submitButton('Получить пароль', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/login/index.php b/frontend/views/login/index.php
new file mode 100644
index 0000000..2530136
--- /dev/null
+++ b/frontend/views/login/index.php
@@ -0,0 +1,36 @@
+title = 'Вход в личный кабинет';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
= Html::encode($this->title) ?>
+
+ 'login-form',
+ 'options' => ['class' => 'well form-vertical'],
+ 'enableClientScript' => false,
+ ]); ?>
+
+ = $form->field($model, 'username') ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'rememberMe')->checkbox() ?>
+
+
+
+ = Html::submitButton('Войти', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
+
+
+
+
+
+
diff --git a/frontend/views/modal/consultation_modal.php b/frontend/views/modal/consultation_modal.php
new file mode 100644
index 0000000..0f05bc2
--- /dev/null
+++ b/frontend/views/modal/consultation_modal.php
@@ -0,0 +1,19 @@
+
+
+
+
Заказать консультацию
+
+
+
Имя: = Html::textInput('name',"",['class'=>'consultation_name']) ?>
+
+
Номер телефона: = Html::textInput('phone',"",['class'=>'consultation_phone']) ?>
+
+
+ = Html::submitButton("Заказать консультацию", ['class' => 'my_cust_btn', 'name' => 'login-button']) ?>
+
+
+
\ No newline at end of file
diff --git a/frontend/views/modal/forgot_password_form_model_window.php b/frontend/views/modal/forgot_password_form_model_window.php
new file mode 100644
index 0000000..a5a58ec
--- /dev/null
+++ b/frontend/views/modal/forgot_password_form_model_window.php
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/frontend/views/modal/login_window_model_window.php b/frontend/views/modal/login_window_model_window.php
new file mode 100644
index 0000000..5118eeb
--- /dev/null
+++ b/frontend/views/modal/login_window_model_window.php
@@ -0,0 +1,52 @@
+title = 'Login';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
+ Url::toRoute('site/login'),
+ ]); ?>
+
= Yii::t('app', 'your_personal_area') ?>
+
+ = $form->field(new LoginForm(), 'email',
+ [
+ 'template' => '
'.Yii::t('app', 'email').'{input}{error}{hint} ',
+ ]
+ )->textInput(['autofocus' => true]) ?>
+
+ = $form->field(new LoginForm(), 'password',
+ [
+ 'template' => '
'.Yii::t('app', 'password').'{input}{error}{hint} ',
+ ]
+ )->passwordInput() ?>
+
+
+
+ = $form->field(new LoginForm(), 'rememberMe',[
+ 'checkboxTemplate' => "{beginLabel}\n{input}\n{labelTitle}\n{endLabel}",
+
+ ])->checkbox() ?>
+
+
+ = Html::a(Yii::t('app', 'forgot_password'), ['site/request-password-reset'],['class'=>'forgot_pass_link']) ?>
+
+
+
+ = Html::submitButton(Yii::t('app','enter'), ['class' => 'my_cust_btn', 'name' => 'login-button']) ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/modal/registration_window_model_window.php b/frontend/views/modal/registration_window_model_window.php
new file mode 100644
index 0000000..ee3e714
--- /dev/null
+++ b/frontend/views/modal/registration_window_model_window.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+ Url::toRoute('site/signup'),
+ ]); ?>
+
+
+
+
= Yii::t('app', 'registration') ?>
+
+ = $form->field(new SignupForm(), 'email', ['enableAjaxValidation' => true,
+ 'template' => '
'.Yii::t('app', 'email').'{input}{error}{hint} ',
+ ]) ?>
+
+ = $form->field(new SignupForm(), 'password',[
+ 'template' => '
'.Yii::t('app', 'password').'{input}{error}{hint} ',
+ ])->passwordInput() ?>
+
+ = $form->field(new SignupForm(), 'password_repeat',[
+ 'template' => '
'.Yii::t('app', 'password_repeat').'{input}{error}{hint} ',
+ ])->passwordInput() ?>
+
+ = $form->field(new SignupForm(), 'username',[
+ 'template' => '
'.Yii::t('app', 'username').'{input}{error}{hint} ',
+ ])->textInput() ?>
+
+ = $form->field(new SignupForm(), 'surname',[
+ 'template' => '
'.Yii::t('app', 'surname').'{input}{error}{hint} ',
+ ])->textInput() ?>
+
+ = $form->field(new SignupForm(), 'phone', ['enableAjaxValidation' => true,
+ 'template' => '
'.Yii::t('app', 'phone').'{input}{error}{hint} ',
+ ])->textInput() ?>
+
+
+ = $form->field(new SignupForm(), 'verifyCode')->widget(Captcha::className(), [
+ 'template' => '
'.Yii::t('app', 'verifyCode').'{image}{input} ',
+ ])->label(false) ?>
+
+
+
+ = Html::submitButton(Yii::t('app', 'registration'), ['class' => 'my_cust_btn', 'name' => 'signup-button']) ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/news/index.php b/frontend/views/news/index.php
new file mode 100644
index 0000000..237088a
--- /dev/null
+++ b/frontend/views/news/index.php
@@ -0,0 +1,44 @@
+
+use yii\helpers\Url;
+use yii\widgets\Breadcrumbs;
+use app\models\News;
+use yii\widgets\LinkPager;
+use app\components\Text;
+?>
+
+$this->title = 'Новости';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Новости']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Новости']);
+?>
+
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ 'Новости'
+ ],
+ ]) ?>
+
+
+
+
+
+
+
Новости
+
+
+
+
+
+
+ =LinkPager::widget([
+ 'pagination' => $pages,
+ 'registerLinkTags' => true
+ ]);?>
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/news/show.php b/frontend/views/news/show.php
new file mode 100644
index 0000000..4414595
--- /dev/null
+++ b/frontend/views/news/show.php
@@ -0,0 +1,32 @@
+
+use yii\helpers\Url;
+use yii\widgets\Breadcrumbs;
+use app\models\News;
+?>
+
+$this->title = $news->meta_title;
+$this->registerMetaTag(['name' => 'description', 'content' => $news->meta_description]);
+$this->registerMetaTag(['name' => 'keywords', 'content' => $news->meta_keywords]);
+?>
+
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ ['label'=>'Новости','url'=>['news/index']],
+ $news->title
+ ],
+ ]) ?>
+
+
+
+
+
+
+
=$news->title?>
+
+
+ =$news->body?>
+
=$news->date?>
+
+
+
\ No newline at end of file
diff --git a/frontend/views/orders/basket-step-01.php b/frontend/views/orders/basket-step-01.php
new file mode 100644
index 0000000..6bce023
--- /dev/null
+++ b/frontend/views/orders/basket-step-01.php
@@ -0,0 +1,104 @@
+title = 'Оформление заказа';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+Оформление заказа
+
+
+ 'basket_order_01_form'
+ ]); ?>
+
+
+
+
+
Личные данные
+
+
+ = $form->field($model, 'name',[
+ 'template' => ''.Yii::t('app', 'Ф.И.О.').'* {input}На это имя будут оформлены документы {error}{hint} ',
+ ])->textInput() ?>
+
+
+
+ = $form->field($model, 'email',[
+ 'template' => ''.Yii::t('app', 'E-mail').'* {input}Сюда пришлем подробности заказа {error}{hint} ',
+ ])->textInput() ?>
+
+
+
+ = $form->field($model, 'phone',[
+ 'template' => ''.Yii::t('app', 'Телефон').'* {input}Уточним важное {error}{hint} ',
+ ])->textInput() ?>
+
+
+
+
+
+
+
+
Доставка
+
+
+ field($model, 'delivery', [
+ ])->radioList([
+ '1' => '
Курьерска доставка по Киеву и области
',
+ '2' => '
В любой регион Украины
',
+ '3' => '
Самовывоз (бесплатно)
уточните подробности по телефону 044 ХХХ-ХХ-ХХ ',
+ ], [
+ 'item' => function ($index, $label, $name, $checked, $value) {
+ return '
' .
+ Html::radio($name, $checked, ['value' => $value]) . $label . '
';
+ },
+ ])->label(false);
+
+
+ ?>
+
+
+
+
+
+
Оплата
+
+ field($model, 'payment', [
+ ])->radioList([
+ '1' => '
Оплата наличными
',
+ '2' => '
Оплата по безналичному расчету. Код ЕГРПОУ
',
+ '3' => '
Приват 24
',
+ '4' => '
Согласовать с менеджером
',
+ ], [
+ 'item' => function ($index, $label, $name, $checked, $value) use ($model) {
+ if($index != 1){
+ return '
' .
+ Html::radio($name, $checked, ['value' => $value]) . $label . '
';
+ } else {
+ return '
' .
+ Html::radio($name, $checked, ['value' => $value]) . $label . ' '.Html::activeTextInput($model,'code').'
';
+ }
+
+ },
+ ])->label(false);
+
+
+ ?>
+
+
+
+
+ = Html::submitButton(Yii::t('app', 'продолжить оформление'), ['class' => 'order_01_btn', 'name' => 'signup-button']) ?>
+
+
+
\ No newline at end of file
diff --git a/frontend/views/orders/basket-step-02.php b/frontend/views/orders/basket-step-02.php
new file mode 100644
index 0000000..0737cc8
--- /dev/null
+++ b/frontend/views/orders/basket-step-02.php
@@ -0,0 +1,83 @@
+title = 'Оформление заказа';
+$this->params['breadcrumbs'][] = $this->title;
+
+?>
+
+
diff --git a/frontend/views/orders/basket-step-03.php b/frontend/views/orders/basket-step-03.php
new file mode 100644
index 0000000..7720312
--- /dev/null
+++ b/frontend/views/orders/basket-step-03.php
@@ -0,0 +1,10 @@
+title = 'Оформление заказа';
+$this->params['breadcrumbs'][] = $this->title;
+
+?>
+
Спасибо за ваш заказ!
diff --git a/frontend/views/page/show.php b/frontend/views/page/show.php
new file mode 100644
index 0000000..06cad7c
--- /dev/null
+++ b/frontend/views/page/show.php
@@ -0,0 +1,7 @@
+title = $page->title;
+$this->params['breadcrumbs'][] = $this->title;
+echo Html::tag('h1',$page->h1 ? $page->h1 : $page->title );
+echo $page->body;
\ No newline at end of file
diff --git a/frontend/views/reg/company.php b/frontend/views/reg/company.php
new file mode 100644
index 0000000..b662d11
--- /dev/null
+++ b/frontend/views/reg/company.php
@@ -0,0 +1,56 @@
+title = 'Регистрация Исполнителя - Компания';
+$this->params['breadcrumbs'][] = $this->title;
+
+$this->registerJsFile(Yii::$app->request->baseUrl.'/js/jquery.mask.js',['position'=>View::POS_HEAD,'depends'=>['yii\web\YiiAsset']]);
+
+$this->registerJs("
+$('#user-phone').mask('(000) 000-0000');
+", View::POS_READY, 'mask');
+?>
+
+
= Html::encode($this->title) ?>
+
+
Потратив пару минут для регистрации на Бычок, вы сможете создавать услуги и находить заказчиков.
+
+ 'reg-form',
+ 'options' => ['class' => 'form-vertical'],
+ 'fieldConfig' => [
+ //'template' => "{label}\n
{input}
\n
{error}
",
+ //'labelOptions' => ['class' => 'col-lg-2 control-label'],
+ ],
+ ]); ?>
+
+ = $form->field($model, 'username') ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'password_repeat')->passwordInput() ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'surname') ?>
+
+ = $form->field($model, 'company') ?>
+
+ = $form->field($model, 'phone') ?>
+
+ = $form->field($model, 'verifyCode')->widget(Captcha::className(),['captchaAction'=>'reg/captcha']) ?>
+
+ = $form->field($model, 'role')->hiddenInput(['value'=>'company'])->label(false); ?>
+
+ = Html::submitButton(' Регистрация ', ['class' => 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/reg/customer.php b/frontend/views/reg/customer.php
new file mode 100644
index 0000000..cf4646a
--- /dev/null
+++ b/frontend/views/reg/customer.php
@@ -0,0 +1,54 @@
+title = 'Регистрация Заказчика';
+$this->params['breadcrumbs'][] = $this->title;
+
+$this->registerJsFile(Yii::$app->request->baseUrl.'/js/jquery.mask.js',['position'=>View::POS_HEAD,'depends'=>['yii\web\YiiAsset']]);
+
+$this->registerJs("
+$('#user-phone').mask('(000) 000-0000');
+", View::POS_READY, 'mask');
+?>
+
+
= Html::encode($this->title) ?>
+
+
Потратив пару минут для регистрации на Бычок, вы сможете создавать заказы и находить исполнителей.
+
+ 'reg-form',
+ 'options' => ['class' => 'form-vertical'],
+ 'fieldConfig' => [
+ //'template' => "{label}\n
{input}
\n
{error}
",
+ //'labelOptions' => ['class' => 'col-lg-2 control-label'],
+ ],
+ ]); ?>
+
+ = $form->field($model, 'username') ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'password_repeat')->passwordInput() ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'surname') ?>
+
+ = $form->field($model, 'phone') ?>
+
+ = $form->field($model, 'verifyCode')->widget(Captcha::className(),['captchaAction'=>'reg/captcha']) ?>
+
+ = $form->field($model, 'role')->hiddenInput(['value'=>'customer'])->label(false); ?>
+
+ = Html::submitButton(' Регистрация ', ['class' => 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/reg/person.php b/frontend/views/reg/person.php
new file mode 100644
index 0000000..0b650b3
--- /dev/null
+++ b/frontend/views/reg/person.php
@@ -0,0 +1,54 @@
+title = 'Регистрация';
+$this->params['breadcrumbs'][] = $this->title;
+
+$this->registerJsFile(Yii::$app->request->baseUrl.'/js/jquery.mask.js',['position'=>View::POS_HEAD,'depends'=>['yii\web\YiiAsset']]);
+
+$this->registerJs("
+$('#user-phone').mask('(000) 000-0000');
+", View::POS_READY, 'mask');
+?>
+
+
= Html::encode($this->title) ?>
+
+ 'reg-form',
+ 'options' => ['class' => 'form-vertical'],
+ 'fieldConfig' => [
+ //'template' => "{label}\n
{input}
\n
{error}
",
+ //'labelOptions' => ['class' => 'col-lg-2 control-label'],
+ ],
+ 'enableClientScript' => false,
+ ]); ?>
+
+ = $form->field($model, 'username') ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'password_repeat')->passwordInput() ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'surname') ?>
+
+ = $form->field($model, 'phone') ?>
+
+ = $form->field($model, 'verifyCode')->widget(Captcha::className(),['captchaAction'=>'reg/captcha']) ?>
+
+ = $form->field($model, 'role')->hiddenInput(['value'=>'person'])->label(false); ?>
+ = $form->field($model, 'group_id')->hiddenInput(['value'=>'1'])->label(false); ?>
+
+ = Html::submitButton(' Регистрация ', ['class' => 'btn btn-primary btn-lg btn-block', 'name' => 'login-button']) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/service/_objects.php b/frontend/views/service/_objects.php
new file mode 100644
index 0000000..d9a48cb
--- /dev/null
+++ b/frontend/views/service/_objects.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+ = Html::a(Html::img($model->minImg($model->image, '200','200')),Url::toRoute(['service/view', 'alias' =>$model->alias ])) ?>
+
+
+
+
+
+
+
= Html::a($model->name,Url::toRoute(['service/view', 'alias' =>$model->alias ])) ?>
+
+
+ = TextHelper::truncateHtmlText($model->body, 200, '...') ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/service/index.php b/frontend/views/service/index.php
new file mode 100644
index 0000000..8e7df4b
--- /dev/null
+++ b/frontend/views/service/index.php
@@ -0,0 +1,13 @@
+params['breadcrumbs'][] = ['label' => 'Услуги', 'url' => ['index']];
+?>
+ $dataProvider,
+ 'itemView'=>'_objects',
+ 'summary'=>'',
+ 'layout' => "
{items}
+ "
+ ] );
+?>
diff --git a/frontend/views/service/view.php b/frontend/views/service/view.php
new file mode 100644
index 0000000..bced762
--- /dev/null
+++ b/frontend/views/service/view.php
@@ -0,0 +1,20 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Услуги', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+
+?>
+
+
= $model->name?>
+ = Html::img($model->minImg($model->image, '940','480')) ?>
+
+ = $model->body?>
+
+
diff --git a/frontend/views/site/_index.php b/frontend/views/site/_index.php
new file mode 100644
index 0000000..b9584a5
--- /dev/null
+++ b/frontend/views/site/_index.php
@@ -0,0 +1,98 @@
+title = 'My Yii Application';
+?>
+
+
+
+
Congratulations!
+
+= HelloWidget::widget(['message' => ' Yii2.0']) ?>
+
+
You have successfully created your Yii-powered application.
+
+
Get started with Yii
+
+
+
+
+
+= $form->field($model, 'term')->widget(\yii\jui\AutoComplete::classname(), [
+ 'clientOptions' => [
+ 'source' => Url::to(['site/term']),
+ ],
+ 'options'=>[
+ 'class'=>'form-control'
+ ]
+]) ?>
+= $form->field($model, 'term2')->widget(\yii\jui\AutoComplete::classname(), [
+ 'clientOptions' => [
+ 'source' => Url::to(['site/term']),
+ ],
+ 'options'=>[
+ 'class'=>'form-control'
+ ]
+]) ?>
+= $form->field($model,'date')->widget(\yii\jui\DatePicker::className(),['clientOptions' => [],'options' => ['class'=>'form-control']]) ?>
+= $form->field($model,'date_do')->widget(\yii\jui\DatePicker::className(),['clientOptions' => [],'options' => ['class'=>'form-control']]) ?>
+= $form->field($model, 'peoples')->widget(\yii\jui\Spinner::classname(), [
+ 'clientOptions' => ['step' => 1],
+
+]) ?>
+
+use app\components\ckeditor\CKEditor;
+use yii\helpers\Html;
+use app\mihaildev\elfinder\ElFinder;
+
+echo $form->field($model, 'username')->widget(CKEditor::className(),[
+'editorOptions' => ElFinder::ckeditorOptions('elfinder',[/* Some CKEditor Options */]),
+]);
+?>
+
+
+
+
+
+
+
Heading
+
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+ ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+ fugiat nulla pariatur.
+
+
Yii Documentation »
+
+
+
Heading
+
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+ ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+ fugiat nulla pariatur.
+
+
Yii Forum »
+
+
+
Heading
+
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+ ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+ fugiat nulla pariatur.
+
+
Yii Extensions »
+
+
+
+
+
diff --git a/frontend/views/site/about.php b/frontend/views/site/about.php
new file mode 100644
index 0000000..6923fac
--- /dev/null
+++ b/frontend/views/site/about.php
@@ -0,0 +1,16 @@
+title = 'About';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
= Html::encode($this->title) ?>
+
+
+ This is the About page. You may modify the following file to customize its content:
+
+
+
= __FILE__ ?>
+
diff --git a/frontend/views/site/contact.php b/frontend/views/site/contact.php
new file mode 100644
index 0000000..da84047
--- /dev/null
+++ b/frontend/views/site/contact.php
@@ -0,0 +1,57 @@
+title = 'Contact';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
diff --git a/frontend/views/site/error.php b/frontend/views/site/error.php
new file mode 100644
index 0000000..b16214d
--- /dev/null
+++ b/frontend/views/site/error.php
@@ -0,0 +1,20 @@
+title = 'Ошибка '.$code;
+?>
+
+
+
Ошибка =$code;?>
+
+
+ = nl2br(Html::encode($message)) ?>
+
+
+
diff --git a/frontend/views/site/error_log b/frontend/views/site/error_log
new file mode 100644
index 0000000..d5a1ce9
--- /dev/null
+++ b/frontend/views/site/error_log
@@ -0,0 +1 @@
+[20-Feb-2015 18:28:38 UTC] PHP Fatal error: Using $this when not in object context in /home/webplusn/public_html/yii2/views/site/index.php on line 3
diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php
new file mode 100644
index 0000000..43796e7
--- /dev/null
+++ b/frontend/views/site/index.php
@@ -0,0 +1,108 @@
+
+ use yii\helpers\Html;
+ use yii\web\View;
+ use app\components\SliderWidget;
+ use app\components\BannerWidget;
+ use yii\helpers\Url;
+
+ $this->title = $text->meta_title;
+ $this->registerMetaTag (['name' => 'description', 'content' => $text->meta_description]);
+ $this->registerMetaTag (['name' => 'keywords', 'content' => $text->meta_keywords]);
+ $this->registerJsFile (
+ Yii::$app->request->baseUrl . '/js/slides.min.jquery.js',
+ ['position' => View::POS_HEAD, 'depends' => ['yii\web\JqueryAsset']]);
+
+?>
+
+ 'HOME_SLIDER']);
+
+ echo BannerWidget::widget(['location' => 'HOME_RIGHT']);
+
+ echo '
';
+
+ echo BannerWidget::widget(['location' => 'HOME_UNDER_SLIDER_1']);
+ echo BannerWidget::widget(['location' => 'HOME_UNDER_SLIDER_2']);
+ echo BannerWidget::widget(['location' => 'HOME_UNDER_SLIDER_3']);
+
+ echo '
';
+?>
+
+
+
+
+ if (count ($products_top) > 0): ?>
+
+
Топ товары
+
+
+ foreach ($products_top as $item): ?>
+
+ = $this->render ('/products/_product', ['item' => $item, 'num' => 4]) ?>
+
+ endforeach; ?>
+
+
+
+
+ endif; ?>
+
+
+
+
Скидки
+
+ foreach ($products_new as $item): ?>
+
+ = $this->render ('/products/_product', ['item' => $item, 'num' => 4]) ?>
+
+ endforeach; ?>
+
+
+
+
+
+
Почему
+
+
+ Только брендовые товары. Мы не торгуем подделками — только проверенное качество.
+
+
+ Скидки постоянным клиентам. Постоянные клиенты получают гарантированную скидку
+ на неакционные товары.
+
+
+ Удобная оплата : наличными курьеру или же банковский перевод.
+
+
+ Квалифицированные менеджеры всегда рады помочь с выбором и консультацией.
+
+
+ 100% гарантия возврата. Если товар не подойдет,
+ мы вернем деньги.
+
+
+ Отслеживание статуса заказа и доставки.
+
+
+
+
+=BannerWidget::widget(['location' => 'HOME_CENTER']);?>
+
+
+ = $text->body ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/views/site/login.php b/frontend/views/site/login.php
new file mode 100644
index 0000000..72e46e2
--- /dev/null
+++ b/frontend/views/site/login.php
@@ -0,0 +1,46 @@
+title = 'Login';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
= Html::encode($this->title) ?>
+
+
Please fill out the following fields to login:
+
+ 'login-form',
+ 'options' => ['class' => 'form-horizontal'],
+ 'fieldConfig' => [
+ 'template' => "{label}\n
{input}
\n
{error}
",
+ 'labelOptions' => ['class' => 'col-lg-1 control-label'],
+ ],
+ ]); ?>
+
+ = $form->field($model, 'username') ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+ = $form->field($model, 'rememberMe', [
+ 'template' => "
{input}
\n
{error}
",
+ ])->checkbox() ?>
+
+
+
+
+
+
+ You may login with admin/admin or demo/demo .
+ To modify the username/password, please check out the code app\models\User::$users.
+
+
diff --git a/frontend/views/site/requestPasswordResetToken.php b/frontend/views/site/requestPasswordResetToken.php
new file mode 100644
index 0000000..58e019e
--- /dev/null
+++ b/frontend/views/site/requestPasswordResetToken.php
@@ -0,0 +1,31 @@
+title = 'Request password reset';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
= Html::encode($this->title) ?>
+
+
Please fill out your email. A link to reset password will be sent there.
+
+
+
+ 'request-password-reset-form']); ?>
+
+ = $form->field($model, 'email')->textInput(['autofocus' => true]) ?>
+
+
+ = Html::submitButton('Send', ['class' => 'btn btn-primary']) ?>
+
+
+
+
+
+
diff --git a/frontend/views/site/resetPassword.php b/frontend/views/site/resetPassword.php
new file mode 100644
index 0000000..236c9fd
--- /dev/null
+++ b/frontend/views/site/resetPassword.php
@@ -0,0 +1,31 @@
+title = 'Reset password';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
= Html::encode($this->title) ?>
+
+
Please choose your new password:
+
+
+
+ 'reset-password-form']); ?>
+
+ = $form->field($model, 'password')->passwordInput(['autofocus' => true]) ?>
+
+
+ = Html::submitButton('Save', ['class' => 'btn btn-primary']) ?>
+
+
+
+
+
+
diff --git a/frontend/views/site/signup.php b/frontend/views/site/signup.php
new file mode 100644
index 0000000..49423e4
--- /dev/null
+++ b/frontend/views/site/signup.php
@@ -0,0 +1,35 @@
+title = 'Signup';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
= Html::encode($this->title) ?>
+
+
Please fill out the following fields to signup:
+
+
+
+ 'form-signup']); ?>
+
+ = $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
+
+ = $form->field($model, 'email') ?>
+
+ = $form->field($model, 'password')->passwordInput() ?>
+
+
+ = Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
+
+
+
+
+
+
diff --git a/frontend/views/subscribe/index.php b/frontend/views/subscribe/index.php
new file mode 100644
index 0000000..00decc2
--- /dev/null
+++ b/frontend/views/subscribe/index.php
@@ -0,0 +1,38 @@
+
+use yii\widgets\Breadcrumbs;
+use yii\web\View;
+use yii\helpers\Url;
+use yii\widgets\ActiveForm;
+
+
+$this->title = 'Подписка';
+$this->registerMetaTag(['name' => 'description', 'content' => 'Подписка']);
+$this->registerMetaTag(['name' => 'keywords', 'content' => 'Подписка']);
+
+?>
+
+
+
+
+ = Breadcrumbs::widget([
+ 'links' => [
+ 'Подписаться на акции'
+ ],
+ ]) ?>
+
+
+
+
+
+
+
Подписаться на акции
+session->getFlash('success')):?>
+
=$flash?>
+
+
+
+= $form->errorSummary($model); ?>
+
+
+
+
diff --git a/frontend/views/text/index.php b/frontend/views/text/index.php
new file mode 100644
index 0000000..79ea03e
--- /dev/null
+++ b/frontend/views/text/index.php
@@ -0,0 +1,19 @@
+
+use yii\widgets\Breadcrumbs;
+?>
+
+$this->title = $text->meta_title;
+$this->registerMetaTag(['name' => 'description', 'content' => $text->meta_description]);
+$this->registerMetaTag(['name' => 'keywords', 'content' => $text->meta_keywords]);
+?>
+
+ = Breadcrumbs::widget([
+ 'links' => [$text->title],
+ ]) ?>
+
+
+
+
=$text->title;?>
+
+=$text->body;?>
+
\ No newline at end of file
diff --git a/frontend/web/.gitignore b/frontend/web/.gitignore
new file mode 100644
index 0000000..a6e95c8
--- /dev/null
+++ b/frontend/web/.gitignore
@@ -0,0 +1,2 @@
+/index.php
+/index-test.php
diff --git a/frontend/web/css/catalog.css b/frontend/web/css/catalog.css
new file mode 100644
index 0000000..4449db0
--- /dev/null
+++ b/frontend/web/css/catalog.css
@@ -0,0 +1,342 @@
+.w_100 {
+ width: 100%;
+}
+.w_960 {
+ width: 960px;
+ margin: auto;
+}
+.cat_p_bradcrump {
+ padding: 30px 0px;
+}
+.cat_p_bradcrump ul {
+ list-style: none;
+}
+.cat_p_bradcrump ul li {
+ display: inline-block;
+}
+.cat_p_bradcrump ul li i {
+ position: relative;
+ top: 1px;
+ padding: 0px 2px 0 8px;
+ color: #8C9295;
+ font-size: 13px;
+}
+.cat_p_bradcrump ul li a {
+ font-size: 12px;
+ color: #898b8e;
+}
+.cat_p_bradcrump ul .active a {
+ text-decoration: none;
+}
+.cat_p_filter_bar {
+ font-family: 'HelveticaRegular', sans-serif;
+ width: 210px;
+ padding-right: 20px;
+ display: inline-block;
+ float: left;
+}
+.cat_p_filter_bar .filter_list ul {
+ list-style: none;
+}
+.cat_p_filter_bar .filter_list ul .title_2 {
+ font-size: 15px;
+ font-weight: bold;
+ color: #898b8e;
+ padding: 30px 0 20px;
+}
+.cat_p_filter_bar .filter_list ul li {
+ border-bottom: 1px solid #bbbbbb;
+ position: relative;
+ padding: 15px 0;
+ font-weight: bold;
+ color: #333333;
+}
+.cat_p_filter_bar .filter_list ul li .width_li_filter {
+ width: 180px;
+ display: block;
+}
+.cat_p_filter_bar .filter_list ul li .arrow {
+ position: absolute;
+ right: 2px;
+ top: 3px;
+ font-size: 20px;
+ color: #727272;
+ padding: 10px 0 10px 200px;
+}
+.cat_p_filter_bar .filter_list ul li .arrow i {
+ font-weight: bold;
+}
+.cat_p_filter_bar .filter_list ul li .arrow img {
+ -webkit-transform: scale(1.3);
+ -ms-transform: scale(1.3);
+ transform: scale(1.3);
+ position: relative;
+ bottom: 3px;
+}
+.cat_p_filter_bar .filter_list .price_filter {
+ display: none;
+ padding-top: 10px;
+}
+.cat_p_filter_bar .filter_list .price_filter a {
+ color: #6aa033;
+}
+.cat_p_filter_bar .filter_list .first_price_li {
+ padding-top: 30px;
+ display: block;
+}
+.cat_p_filter_bar .filter_accept_bloc {
+ padding: 20px 0 40px;
+}
+.cat_p_filter_bar .filter_accept_bloc button {
+ color: #fff;
+ padding: 10px;
+ font-size: 15px;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #898b8e;
+ -webkit-box-shadow: 0 2px 0 #636567;
+ box-shadow: 0 2px 0 #636567;
+}
+.cat_p_filter_bar .filter_accept_bloc button:hover {
+ background-color: #707274;
+}
+.cat_p_filter_bar .filter_accept_bloc a {
+ color: #6AA033;
+ font-size: 12px;
+}
+.cat_p_filter_bar .product_list .title {
+ padding-bottom: 5px;
+ color: #898b8e;
+}
+.cat_p_filter_bar .product_list a {
+ display: block;
+ padding: 5px 0 0 15px;
+ font-weight: normal;
+}
+.cat_p_filter_bar .price_slider {
+ width: 203px;
+ /*margin: auto;*/
+}
+.cat_p_filter_bar .checkbox {
+ margin-top: 5px;
+ font-weight: normal;
+}
+.cat_p_filter_bar .see_all a {
+ font-size: 13px;
+ position: relative;
+ bottom: 3px;
+}
+.cat_p_filter_bar .see_all i {
+ font-size: 18px;
+ color: #898B8E;
+}
+.cat_p_filter_bar .title {
+ font-size: 16px;
+ font-weight: bold;
+ color: #898b8e;
+ padding-bottom: 20px;
+}
+.cat_p_filter_bar p {
+ margin-bottom: 20px;
+}
+.cat_p_filter_bar p input {
+ padding: 8px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ border: none;
+ border: 1px solid #bbb;
+ width: 60px;
+}
+.cat_p_filter_bar p label {
+ display: block;
+ margin-bottom: 15px;
+}
+.cat_p_catalog_list {
+ font-family: 'HelveticaRegular', sans-serif;
+ width: 700px;
+ padding-right: 10px;
+ display: inline-block;
+}
+.cat_p_catalog_list ul {
+ list-style: none;
+ display: inline-block;
+}
+.cat_p_catalog_list ul li {
+ display: inline-block;
+}
+.cat_p_catalog_list ul li .active {
+ color: #333333;
+ text-decoration: none;
+}
+.cat_p_catalog_list ul li a {
+ color: #6aa033;
+ font-size: 13px;
+}
+.cat_p_catalog_list .sort_menu {
+ padding-bottom: 10px;
+ border-bottom: 1px solid #DBDCDD;
+ margin-bottom: 30px;
+ width: 720px;
+}
+.cat_p_catalog_list .title {
+ font-size: 30px;
+ font-weight: bold;
+ padding-bottom: 20px;
+}
+.cat_p_catalog_list .sort_price {
+ display: inline-block;
+ width: 225px;
+ position: relative;
+ font-size: 13px;
+}
+.cat_p_catalog_list .sort_price select {
+ text-decoration: underline;
+ width: 120px;
+ border: none;
+ color: #6aa033;
+ -webkit-appearance: none;
+ /* скрытие треугольника в селекте */
+ -moz-appearance: none;
+ appearance: none;
+ /* скрытие треугольника в селекте */
+ text-indent: 0.01px;
+ /* скрытие треугольника в селекте в firefox */
+ text-overflow: '';
+ /* скрытие треугольника в селекте в firefox */
+ /*&::-ms-expand { display: none; } скрытие треугольника в селекте в IE */
+ background: transparent;
+}
+.cat_p_catalog_list .sort_price select:focus {
+ outline: none;
+}
+.cat_p_catalog_list .sort_price select option {
+ background: transparent;
+}
+.cat_p_catalog_list .sort_price i {
+ position: absolute;
+ right: 72px;
+ top: 3px;
+ cursor: pointer;
+ font-weight: bold;
+ color: #898b8e;
+ z-index: -1;
+}
+.cat_p_catalog_list .show {
+ display: inline-block;
+ width: 225px;
+ text-align: center;
+ font-size: 13px;
+}
+.cat_p_catalog_list .show_pages {
+ display: inline-block;
+ width: 250px;
+ text-align: right;
+ font-size: 13px;
+}
+.cat_p_catalog_list .show_pages i {
+ color: #898b8e;
+ position: relative;
+ top: 1px;
+ padding-left: 5px;
+ font-size: 15px;
+ cursor: pointer;
+}
+.cat_p_item_card_list {
+ font-family: 'HelveticaRegular', sans-serif;
+}
+.cat_p_item_card_list .novelty {
+ text-align: center;
+}
+.cat_p_item_card_list .novelty .content {
+ width: 720px;
+ padding: 0;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont {
+ width: 720px;
+ padding-bottom: 10px;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont .item {
+ min-height: 375px;
+ margin-right: 20px;
+ margin-bottom: 20px;
+ margin-left: 0;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont .item:after {
+ display: none;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont .item .item_bottom_img {
+ position: relative;
+ top: 3px;
+ right: 1px;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont .item:before {
+ content: "";
+ position: absolute;
+ bottom: -1px;
+ right: -1px;
+ width: 0px;
+ height: 0px;
+ border-width: 13px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ z-index: 2;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont .item .brand span {
+ color: #6aa033;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont .item .new {
+ background-color: red;
+ width: auto;
+ padding-right: 20px;
+}
+.cat_p_item_card_list .novelty .content .novelty_cont .item .new:after {
+ right: 0px;
+ width: 0px;
+ height: 0px;
+ border-width: 18px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+}
+.cat_p_item_card_list .novelty .content .load_more_btn {
+ font-size: 13px;
+ padding: 10px 15px;
+ background: #6AA033;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ border: none;
+ color: white;
+ -webkit-box-shadow: 0 2px 0 #507927;
+ box-shadow: 0 2px 0 #507927;
+ margin-bottom: 20px;
+}
+.cat_p_item_card_list .novelty .content .show_pages {
+ display: block;
+ margin: auto;
+ text-align: center;
+ margin-bottom: 7px;
+}
+.cat_p_item_card_list .novelty .content .description {
+ color: #333333;
+ text-align: left;
+ font-weight: normal;
+ font-size: 13px;
+}
+.cat_p_item_card_list .novelty .content .description h2 {
+ padding: 30px 0;
+ font-size: 30px;
+}
+.cat_p_item_card_list .novelty .content .description .bold {
+ font-weight: bold;
+}
+.cat_p_item_card_list .novelty .content .description h4 {
+ padding: 20px 0;
+ font-size: 14px;
+}
+.cat_p_item_card_list .novelty .content .description .margin_bottom_20 {
+ margin-bottom: 20px;
+}
+.cat_p_item_card_list .novelty .content .description .empty_padding_400 {
+ width: 100px;
+ height: 380px;
+}
diff --git a/frontend/web/css/concat_all.css b/frontend/web/css/concat_all.css
new file mode 100644
index 0000000..77e84a6
--- /dev/null
+++ b/frontend/web/css/concat_all.css
@@ -0,0 +1,3364 @@
+.w_100 {
+ width: 100%;
+}
+
+.w_960 {
+ width: 960px;
+ margin: auto;
+ overflow: hidden;
+
+}
+
+.cat_p_bradcrump {
+ padding: 30px 0px;
+}
+
+.cat_p_bradcrump ul {
+ list-style: none;
+}
+
+.cat_p_bradcrump ul li {
+ display: inline-block;
+}
+
+.cat_p_bradcrump ul li i {
+ position: relative;
+ top: 1px;
+ padding: 0px 2px 0 8px;
+ color: #8C9295;
+ font-size: 13px;
+}
+
+.cat_p_bradcrump ul li a {
+ font-size: 12px;
+ color: #898b8e;
+}
+
+.cat_p_bradcrump ul .active a {
+ text-decoration: none;
+}
+
+.cat_p_filter_bar {
+ font-family: 'HelveticaRegular', sans-serif;
+ width: 210px;
+ padding-right: 20px;
+ display: inline-block;
+ float: left;
+}
+.cat_p_filter_bar:before {
+ display: block;
+ content: '';
+ clear: both;
+}
+
+.cat_p_filter_bar .filter_list ul {
+ list-style: none;
+}
+
+.cat_p_filter_bar .filter_list ul .title_2 {
+ font-size: 15px;
+ font-weight: bold;
+ color: #898b8e;
+ padding: 30px 0 20px;
+}
+
+.cat_p_filter_bar .filter_list ul li {
+ border-bottom: 1px solid #bbbbbb;
+ position: relative;
+ padding: 15px 0;
+ font-weight: bold;
+ color: #333333;
+}
+
+.cat_p_filter_bar .filter_list ul li .width_li_filter {
+ width: 180px;
+ display: block;
+}
+
+.cat_p_filter_bar .filter_list ul li .arrow {
+ position: absolute;
+ right: 2px;
+ top: 3px;
+ font-size: 20px;
+ color: #727272;
+ padding: 10px 0 10px 200px;
+}
+
+.cat_p_filter_bar .filter_list ul li .arrow i {
+ font-weight: bold;
+}
+
+.cat_p_filter_bar .filter_list ul li .arrow img {
+ -webkit-transform: scale(1.3);
+ -ms-transform: scale(1.3);
+ transform: scale(1.3);
+ position: relative;
+ bottom: 3px;
+}
+
+.cat_p_filter_bar .filter_list .price_filter {
+ display: none;
+ padding-top: 10px;
+}
+
+.cat_p_filter_bar .filter_list .price_filter a {
+ color: #6aa033;
+}
+.cat_p_filter_bar .filter_list .price_filter.active-field {
+ display: block;
+}
+
+.cat_p_filter_bar .filter_list .first_price_li {
+ padding-top: 30px;
+ display: block;
+}
+
+.cat_p_filter_bar .filter_accept_bloc {
+ padding: 20px 0 40px;
+}
+
+.cat_p_filter_bar .filter_accept_bloc button {
+ color: #fff;
+ padding: 10px;
+ font-size: 15px;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #898b8e;
+ -webkit-box-shadow: 0 2px 0 #636567;
+ box-shadow: 0 2px 0 #636567;
+}
+
+.cat_p_filter_bar .filter_accept_bloc button:hover {
+ background-color: #707274;
+}
+
+.cat_p_filter_bar .filter_accept_bloc a {
+ color: #6AA033;
+ font-size: 12px;
+}
+
+.cat_p_filter_bar .product_list .title {
+ padding-bottom: 5px;
+ color: #898b8e;
+}
+
+.cat_p_filter_bar .product_list a {
+ display: block;
+ padding: 5px 0 0 15px;
+ font-weight: normal;
+}
+
+.cat_p_filter_bar .price_slider {
+ width: 203px;
+ /*margin: auto;*/
+}
+
+.cat_p_filter_bar .checkbox {
+ margin-top: 5px;
+ font-weight: normal;
+}
+
+.cat_p_filter_bar .see_all a {
+ font-size: 13px;
+ position: relative;
+ bottom: 3px;
+}
+
+.cat_p_filter_bar .see_all i {
+ font-size: 18px;
+ color: #898B8E;
+}
+
+.cat_p_filter_bar .title {
+ font-size: 16px;
+ font-weight: bold;
+ color: #898b8e;
+ padding-bottom: 20px;
+}
+
+.cat_p_filter_bar p {
+ margin-bottom: 20px;
+}
+
+.cat_p_filter_bar p input {
+ padding: 8px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ border: none;
+ border: 1px solid #bbb;
+ width: 60px;
+}
+
+.cat_p_filter_bar p label {
+ display: block;
+ margin-bottom: 15px;
+}
+
+.cat_p_catalog_list {
+ font-family: 'HelveticaRegular', sans-serif;
+ width: 700px;
+ padding-right: 10px;
+ display: inline-block;
+ min-height: 20em;
+}
+
+.cat_p_catalog_list ul {
+ list-style: none;
+ display: inline-block;
+}
+
+.cat_p_catalog_list ul li {
+ display: inline-block;
+}
+
+.cat_p_catalog_list ul li .active {
+ color: #333333;
+ text-decoration: none;
+}
+
+.cat_p_catalog_list ul li a {
+ color: #6aa033;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .sort_menu {
+ padding-bottom: 10px;
+ border-bottom: 1px solid #DBDCDD;
+ margin-bottom: 30px;
+ width: 720px;
+}
+
+.cat_p_catalog_list .title {
+ font-size: 30px;
+ font-weight: bold;
+ padding-bottom: 20px;
+}
+
+.cat_p_catalog_list .sort_price {
+ display: inline-block;
+ width: 225px;
+ position: relative;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .sort_price select {
+ text-decoration: underline;
+ width: 120px;
+ border: none;
+ color: #6aa033;
+ -webkit-appearance: none;
+ /* скрытие треугольника в селекте */
+ -moz-appearance: none;
+ appearance: none;
+ /* скрытие треугольника в селекте */
+ text-indent: 0.01px;
+ /* скрытие треугольника в селекте в firefox */
+ text-overflow: '';
+ /* скрытие треугольника в селекте в firefox */
+ /*&::-ms-expand { display: none; } скрытие треугольника в селекте в IE */
+ background: transparent;
+}
+
+.cat_p_catalog_list .sort_price select:focus {
+ outline: none;
+}
+
+.cat_p_catalog_list .sort_price select option {
+ background: transparent;
+}
+
+.cat_p_catalog_list .sort_price i {
+ position: absolute;
+ right: 72px;
+ top: 3px;
+ cursor: pointer;
+ font-weight: bold;
+ color: #898b8e;
+ z-index: -1;
+}
+
+.cat_p_catalog_list .show {
+ display: inline-block;
+ width: 225px;
+ text-align: center;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .show_pages {
+ display: inline-block;
+ width: 250px;
+ text-align: right;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .show_pages i {
+ color: #898b8e;
+ position: relative;
+ top: 1px;
+ padding-left: 5px;
+ font-size: 15px;
+ cursor: pointer;
+}
+
+.cat_p_item_card_list {
+ font-family: 'HelveticaRegular', sans-serif;
+}
+
+.cat_p_item_card_list .novelty {
+ text-align: center;
+}
+
+.cat_p_item_card_list .novelty .content {
+ width: 720px;
+ padding: 0;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont {
+ width: 720px;
+ padding-bottom: 10px;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item {
+ /*min-height: 375px;*/
+ margin-right: 20px;
+ margin-bottom: 20px;
+ margin-left: 0;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item:after {
+ display: none;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .item_bottom_img {
+ position: relative;
+ top: 3px;
+ right: 1px;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item:before {
+ content: "";
+ position: absolute;
+ bottom: -1px;
+ right: -1px;
+ width: 0px;
+ height: 0px;
+ border-width: 13px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ z-index: 2;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .brand span {
+ color: #6aa033;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .new {
+ background-color: red;
+ width: auto;
+ padding-right: 20px;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .new:after {
+ right: 0px;
+ width: 0px;
+ height: 0px;
+ border-width: 18px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+}
+
+.cat_p_item_card_list .novelty .content .load_more_btn {
+ font-size: 13px;
+ padding: 10px 15px;
+ background: #6AA033;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ border: none;
+ color: white;
+ -webkit-box-shadow: 0 2px 0 #507927;
+ box-shadow: 0 2px 0 #507927;
+ margin-bottom: 20px;
+}
+
+.cat_p_item_card_list .novelty .content .load_more_btn:hover {
+ background: #5d8d2d;
+}
+
+.cat_p_item_card_list .novelty .content .show_pages {
+ display: block;
+ margin: auto;
+ text-align: center;
+ margin-bottom: 7px;
+}
+
+.cat_p_item_card_list .novelty .content .description {
+ color: #333333;
+ text-align: left;
+ font-weight: normal;
+ font-size: 13px;
+}
+
+.cat_p_item_card_list .novelty .content .description h2 {
+ padding: 30px 0;
+ font-size: 30px;
+ font-weight: normal;
+}
+
+.cat_p_item_card_list .novelty .content .description .bold {
+ font-weight: bold;
+}
+
+.cat_p_item_card_list .novelty .content .description h4 {
+ padding: 20px 0;
+ font-size: 14px;
+}
+
+.cat_p_item_card_list .novelty .content .description .margin_bottom_20 {
+ margin-bottom: 20px;
+}
+
+.cat_p_item_card_list .novelty .content .description .empty_padding_400 {
+ width: 100px;
+ height: 380px;
+}
+/* светлый зеленый цвет, текст и кнопки */
+
+/* средний серый цвет, текст и кнопки */
+
+/* светлый серый цвет, рамки и линии */
+
+/* темный серый цвет, большие названия, цифры */
+
+a {
+ color: #6aa034;
+}
+
+a:hover {
+ color: #517a27;
+}
+
+h1 {
+ color: #333333;
+ font-size: 30px;
+ font-weight: normal;
+}
+
+.flex-container {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.bradcrumps_top {
+ padding: 30px 0;
+ line-height: 0;
+}
+
+.bradcrumps_top ul li {
+ display: inline-block;
+}
+
+.bradcrumps_top ul li a {
+ font-size: 12px;
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.bradcrumps_top ul li:last-child a {
+ text-decoration: none;
+ color: #898b8e;
+}
+
+.bradcrumps_top ul li:last-child i {
+ display: none;
+}
+
+.bradcrumps_top ul li i {
+ color: #898b8e;
+ padding: 0 2px 0 6px;
+ font-weight: bold;
+ font-size: 11px;
+}
+
+.my_custom_card {
+ width: 218px;
+ display: inline-block;
+ border: 1px solid #cdd1d9;
+ border-bottom: none;
+ -webkit-border-top-left-radius: 2px;
+ border-top-left-radius: 2px;
+ -webkit-border-top-right-radius: 2px;
+ border-top-right-radius: 2px;
+ position: relative;
+ text-align: center;
+ margin-bottom: 1px;
+ margin-bottom: 19px;
+ color: #333333;
+ /* &:before {
+ content: "";
+ position: absolute;
+ bottom: -1px;
+ right: -1px;
+ width: 0px;
+ height: 0px;
+ border-width: 13px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ z-index: 2;
+ }*/
+}
+
+.my_custom_card .item_bottom_img {
+ bottom: 61px;
+ left: -1px;
+ position: absolute;
+ top: 374px;
+}
+
+.my_custom_card .new {
+ position: absolute;
+ color: #ffffff;
+ left: 0px;
+ top: 7px;
+ text-transform: uppercase;
+ font-size: 10px;
+ text-align: left;
+ background-color: red;
+ width: auto;
+ padding: 1px 20px 0px 5px;
+ z-index: 1;
+ line-height: 17px;
+}
+
+.my_custom_card .new:after {
+ content: "";
+ height: 0px;
+ top: 0;
+ right: 0;
+ border-width: 21px 14px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ position: absolute;
+}
+
+.my_custom_card .top {
+ background: #ffde00;
+ position: absolute;
+ padding: 1px 20px 0px 5px;
+ color: #ffffff;
+ left: 0px;
+ top: 30px;
+ text-transform: uppercase;
+ font-size: 10px;
+ color: #333333;
+ z-index: 1;
+}
+
+.my_custom_card .top:after {
+ content: "";
+ top: 0;
+ right: 0px;
+ border-width: 21px 14px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ position: absolute;
+}
+
+.my_custom_card .item_link {
+ text-decoration: none;
+ border: 0;
+}
+
+.my_custom_card .item_link .pic {
+ margin-top: 25px;
+}
+
+.my_custom_card .item_link .title_item {
+ padding: 13px;
+ color: #6aa033;
+ margin-bottom: 3px;
+ font-size: 15px;
+ line-height: 17px;
+}
+
+.my_custom_card .brand {
+ font-size: 12px;
+ line-height: 12px;
+}
+
+.my_custom_card .brand span {
+ color: #6aa033;
+}
+
+.my_custom_card .type {
+ font-size: 12px;
+}
+
+.my_custom_card .price {
+ font-size: 20px;
+ font-weight: bold;
+ font-family: HelveticaBold;
+ padding-bottom: 11px;
+ padding-top: 6px;
+}
+
+.my_custom_card .price span {
+ font-size: 13px !important;
+}
+
+.my_custom_card .foo {
+ padding: 5px 53px 5px 14px;
+ border: none;
+ background-color: #6aa034;
+ color: white;
+ font-size: 12px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ position: relative;
+ display: block;
+ margin: 0 auto 10px;
+}
+
+.my_custom_card .foo:hover {
+ background-color: #5d8d2e;
+}
+
+.my_custom_card .foo:active {
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.my_custom_card .foo img {
+ position: absolute;
+ padding: 3px 3px 3px 8px;
+ border-left: 1px solid #527B28;
+ right: 12px;
+ top: 3px;
+}
+
+.my_custom_card .compare_add_but_d {
+ color: #6aa034;
+ font-size: 12px;
+ text-decoration: none;
+}
+
+.my_custom_card .compare_add_but_d span {
+ border-bottom: 1px dotted #6aa034;
+ padding-left: 10px;
+}
+
+.my_custom_card .compare_add_but_d span:hover {
+ color: #517a27;
+}
+
+.my_custom_card img {
+ position: relative;
+ top: 4px;
+ right: 1px;
+}
+
+ul {
+ list-style: none;
+}
+
+h1.with_this {
+ margin-bottom: 21px;
+}
+
+hr {
+ margin-bottom: 30px;
+ margin-top: 30px;
+ color: #C6C7C9;
+ border: none;
+ background-color: #C6C7C9;
+ height: 1px !important;
+ margin-right: -10px;
+ margin-left: -10px;
+}
+
+.tabs_item_name {
+ font-weight: bold;
+ padding-bottom: 15px;
+ display: block;
+}
+
+.open_card_item_title {
+ color: #333333;
+ font-size: 30px;
+ padding-bottom: 42px;
+ font-weight: bold;
+ margin: 0px;
+}
+
+.item_3_blocks_wrap {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.item_3_blocks_wrap .item_img_block {
+ width: 320px;
+ position: relative;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img {
+ text-align: center;
+ border: 1px solid #C6C7C9;
+ height: 317px;
+ width: 318px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img img {
+ height: 100%;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .new {
+ background: #00adf0;
+ font-size: 10px;
+ padding: 1px 5px 0px 5px;
+ position: absolute;
+ left: 0;
+ top: 15px;
+ color: white;
+ line-height: 17px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .new:after {
+ content: "";
+ border-width: 0px 0px 18px 17px;
+ border-style: solid;
+ border-color: black green transparent #00ADF0;
+ position: absolute;
+ bottom: 0px;
+ right: -17px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .top {
+ background: #ffde00;
+ font-size: 10px;
+ padding: 1px 5px 0px 5px;
+ position: absolute;
+ line-height: 17px;
+ left: 0;
+ top: 38px;
+ color: black;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .top:after {
+ content: "";
+ border-width: 0px 0px 18px 17px;
+ border-style: solid;
+ border-color: black green transparent #ffde00;
+ position: absolute;
+ bottom: 0px;
+ right: -17px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide {
+ position: relative;
+ margin-top: 20px;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-justify-content: space-around;
+ -ms-flex-pack: distribute;
+ justify-content: space-around;
+ -webkit-box-align: center;
+ -webkit-align-items: center;
+ -ms-flex-align: center;
+ align-items: center;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block {
+ width: 80px;
+ height: 77px;
+ border: 1px solid #C6C7C9;
+ display: inline-block;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block img {
+ width: 96%;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block:first-child {
+ margin-left: 10px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block:nth-child(3) {
+ margin-right: 10px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .active {
+ border: 2px solid #C6C7C9;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .slider_arrow_right {
+ position: absolute;
+ right: 0;
+ top: 39%;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .slider_arrow_left {
+ position: absolute;
+ left: 0;
+ top: 39%;
+}
+
+.item_3_blocks_wrap .busket_block {
+ position: relative;
+ width: 295px;
+}
+
+.item_3_blocks_wrap .busket_block .grey_bg {
+ background-color: #f4f4f4;
+ padding: 27px 0 20px;
+ margin-top: 20px;
+}
+
+.item_3_blocks_wrap .busket_block .top_code .code {
+ background: #ffde00;
+ color: black;
+ font-size: 12px;
+ color: #333333;
+ font-weight: bold;
+ padding: 4px 12px;
+ display: inline-block;
+}
+
+.item_3_blocks_wrap .busket_block .top_code .have {
+ font-size: 12px;
+ color: #333333;
+ font-weight: bold;
+ padding: 4px 19px 7px;
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+.item_3_blocks_wrap .busket_block .top_code .have img {
+ position: absolute;
+ right: 100px;
+ left: -5px;
+}
+
+.item_3_blocks_wrap .busket_block .counter {
+ text-align: center;
+}
+
+.item_3_blocks_wrap .busket_block .counter .price {
+ color: #333333;
+ font-size: 28px;
+ font-weight: bold;
+ display: inline-block;
+ padding-left: 20px;
+ padding-top: 8px;
+ padding-bottom: 11px;
+}
+
+.item_3_blocks_wrap .busket_block .counter .sign {
+ font-size: 15px;
+ color: #333333;
+ font-weight: bold;
+ display: inline-block;
+ margin-right: 15px;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block {
+ display: inline-block;
+ position: relative;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 6px 13px 6px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 6px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn {
+ text-align: center;
+ padding-top: 16px;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a {
+ color: white;
+ text-decoration: none;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn {
+ background: #6aa034;
+ border: none;
+ padding: 10px 55px 10px 15px;
+ font-size: 16px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ position: relative;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn:hover {
+ background: #5d8d2e;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn:active {
+ position: relative;
+ top: 2px;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn img {
+ position: absolute;
+ padding: 7px 7px 7px 9px;
+ right: 7px;
+ width: 18px;
+ border-left: 1px solid #5d8d2e;
+ bottom: 2px;
+}
+
+.item_3_blocks_wrap .busket_block .to_compare_link {
+ text-align: center;
+ margin-top: 18px;
+}
+
+.item_3_blocks_wrap .busket_block .to_compare_link .add_to_compare {
+ border-bottom: 1px solid #6aa034;
+ border-style: dotted;
+ text-decoration: none;
+ border-top: none;
+ border-left: none;
+ border-right: none;
+ font-size: 12px;
+}
+
+.item_3_blocks_wrap .busket_block .to_compare_link img {
+ position: relative;
+ top: 3px;
+ width: 19px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order {
+ margin-top: 16px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form .text {
+ font-size: 12px;
+ color: #333333;
+ font-weight: bold;
+ padding-right: 3px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form .quick_order_phone {
+ font-size: 12px;
+ color: #333333;
+ padding: 10px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ width: 100px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form placeholder {
+ color: #C6C7C9;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form button {
+ border: none;
+ font-size: 12px;
+ color: white;
+ padding: 7px 8px 6px 10px;
+ background: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ -webkit-border-top-right-radius: 2px;
+ border-top-right-radius: 2px;
+ -webkit-border-bottom-right-radius: 2px;
+ border-bottom-right-radius: 2px;
+ position: absolute;
+ right: 1px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form button:hover {
+ background: #5d8d2e;
+}
+
+.item_3_blocks_wrap .busket_block .delivery {
+ font-size: 13px;
+ color: #333333;
+ margin-top: 27px;
+}
+
+.item_3_blocks_wrap .busket_block .delivery a {
+ text-decoration: underline;
+}
+
+.character_block {
+ width: 265px;
+ color: #333333;
+}
+
+.character_block h3 {
+ line-height: 16px;
+}
+
+.character_block .each {
+ border-bottom: 1px solid #C6C7C9;
+ border-style: dotted;
+ border-top: none;
+ border-left: none;
+ border-right: none;
+ font-size: 13px;
+ margin-top: 2px;
+}
+
+.character_block .title {
+ display: inline-block;
+ background: white;
+ position: relative;
+ top: 4px;
+ color: #898b8e;
+}
+
+.character_block .tech {
+ display: inline-block;
+ background: white;
+ float: right;
+ position: relative;
+ top: 4px;
+}
+
+.character_block .tech_links {
+ margin-top: 20px;
+}
+
+.character_block .tech_links a {
+ text-decoration: none;
+ border-bottom: 1px solid #6aa034;
+ border-style: dashed;
+ border-left: none;
+ border-right: none;
+ border-top: none;
+ font-size: 18px;
+ margin-top: 6px;
+ margin-right: 100px;
+ display: inline-block;
+}
+
+.flex_container {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.tabs_block {
+ color: #333333;
+ width: 100%;
+}
+
+.watched_block {
+ margin-bottom: 45px;
+}
+
+.watched_block h1 {
+ font-size: 30px;
+ color: #333333;
+ margin-bottom: 18px;
+}
+
+.just_test_tracs {
+ -webkit-transition: all 02s easy;
+ transition: all 02s easy;
+ -webkit-transform: rotate(7deg);
+ -ms-transform: rotate(7deg);
+ transform: rotate(7deg);
+}
+/* светлый зеленый цвет, текст и кнопки */
+
+/* средний серый цвет, текст и кнопки */
+
+/* светлый серый цвет, рамки и линии */
+
+/* темный серый цвет, большие названия, цифры */
+
+.main_cont_wrap {
+ width: 940px;
+ margin: auto;
+ padding: 0px 10px;
+ color: #333333;
+ line-height: 19px;
+}
+
+.main_cont_wrap .services_title {
+ font-size: 30px;
+ padding-top: 0px;
+ padding-bottom: 26px;
+ font-weight: bold;
+ margin: 0px;
+}
+
+.main_cont_wrap .services_title_servis {
+ font-size: 30px;
+ padding-top: 0px;
+ padding-bottom: 39px;
+ font-weight: bold;
+ margin: 0px;
+}
+
+.main_cont_wrap .services_block {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.main_cont_wrap .services_block .services_each {
+ width: 215px;
+ padding: 0 10px;
+ text-align: center;
+ display: inline-block;
+ margin-bottom: 45px;
+}
+
+.main_cont_wrap .services_block .services_each .name {
+ font-size: 18px;
+ font-weight: bold;
+ padding: 20px 0px;
+ display: block;
+ padding-bottom: 16px;
+}
+
+.main_cont_wrap .services_block .services_each img {
+ display: block;
+ height: 65px;
+ margin: auto;
+}
+
+.main_cont_wrap .services_block .services_each p {
+ font-size: 13px;
+ line-height: 16px;
+}
+
+.delivery_block {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ padding-bottom: 362px;
+ padding-top: 11px;
+}
+
+.delivery_each_block {
+ font-size: 13px;
+ width: 450px;
+ line-height: 16px;
+}
+
+.delivery_each_block img {
+ display: block;
+ width: 290px;
+ margin: auto;
+}
+
+.delivery_each_block .name {
+ font-weight: bold;
+ padding: 27px 0 18px;
+ display: block;
+ text-align: center;
+ font-size: 15px;
+}
+
+.delivery_each_block .address {
+ font-size: 16px;
+ font-weight: bold;
+ display: block;
+ padding-bottom: 20px;
+}
+
+.contact_page_phones {
+ font-size: 16px;
+ font-weight: bold;
+ padding-bottom: 15px;
+}
+
+.align_items_bottom {
+ -webkit-box-align: end;
+ -webkit-align-items: flex-end;
+ -ms-flex-align: end;
+ align-items: flex-end;
+}
+
+.manufacturers_block {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ margin-bottom: 40px;
+ margin-top: 13px;
+}
+
+.manufacturers_block a {
+ width: 172px;
+ height: 100px;
+ overflow: hidden;
+ margin-bottom: 20px;
+ display: inline-block;
+}
+
+.payment_icon_1 {
+ display: inline-block;
+ background-image: url("../images/payment01.png");
+ background-repeat: no-repeat;
+ width: 90px;
+ height: 40px;
+ float: left;
+ background-position: 26px 5px;
+}
+
+.payment_icon_2 {
+ display: inline-block;
+ background-image: url("../images/payment01.png");
+ background-repeat: no-repeat;
+ width: 90px;
+ height: 40px;
+ float: left;
+ background-position: 26px -32px;
+}
+
+.payment_01 {
+ margin: 21px 2px;
+ display: block;
+}
+
+span.bold {
+ font-weight: bold;
+}
+
+span.red {
+ color: red;
+}
+
+.font_size_13 {
+ font-size: 13px;
+}
+
+.padding_450 {
+ padding-bottom: 450px;
+}
+
+.basket_main_title {
+ margin-top: 0;
+ font-weight: bold;
+ font-size: 30px;
+ margin-bottom: 29px;
+}
+
+.privet_info_block h3 {
+ font-size: 18px;
+ font-weight: bold;
+ padding-bottom: 16px;
+}
+
+.privet_info_block label {
+ font-size: 13px;
+ font-weight: bold;
+}
+
+.privet_info_block span.placehold {
+ font-size: 12px;
+ color: #898b8e;
+ font-weight: normal;
+}
+
+.privet_info_block input {
+ padding: 7px 5px 9px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ margin: 0 12px 0 8px;
+ width: 256px;
+}
+
+.privet_info_block .padding_cust {
+ padding: 0px 0px 8px 14px;
+}
+
+.privet_info_block .padding_cust:nth-child(3) {
+ padding-left: 17px;
+}
+
+.privet_info_block .padding_cust:nth-child(4) {
+ padding-left: 1px;
+}
+
+.separator {
+ width: 960px;
+ height: 1px;
+ border-bottom: 1px solid #C6C7C9;
+ margin: 11px 0 27px;
+}
+
+.delivery_radio h3 {
+ padding-bottom: 12px;
+}
+
+.delivery_radio p {
+ display: inline-block;
+ font-size: 13px;
+}
+
+.delivery_radio .padding_cust {
+ padding-bottom: 6px;
+}
+
+.delivery_radio span.placehold {
+ color: #898b8e;
+ display: block;
+ font-size: 13px;
+ padding-left: 23px;
+ position: relative;
+ bottom: 4px;
+}
+
+.basket_pay_block h3 {
+ padding-bottom: 12px;
+}
+
+.basket_pay_block p {
+ display: inline-block;
+ font-size: 13px;
+}
+
+.basket_pay_block .padding_cust {
+ padding-bottom: 6px;
+ position: relative;
+}
+
+.basket_pay_block span.placehold {
+ color: #898b8e;
+ display: block;
+ font-size: 13px;
+ padding-left: 23px;
+ position: relative;
+ bottom: 4px;
+}
+
+.basket_pay_block input[type="text"] {
+ margin-left: 8px;
+ height: 17px;
+ top: -11px;
+ position: absolute;
+ height: 22px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ border: 1px solid #C6C7C9;
+ width: 89px;
+ padding: 5px;
+}
+
+.separator_02 {
+ width: 960px;
+ height: 1px;
+ border-bottom: 1px solid #C6C7C9;
+ margin: 3px 0 27px;
+}
+
+.for_margin {
+ text-align: center;
+ margin: 27px 0 84px;
+}
+
+.order_01_btn {
+ font-size: 13px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ background-color: #6aa034;
+ padding: 6px 22px;
+ color: white;
+}
+
+.order_01_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.order_01_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+
+.order_list .active {
+ background-color: #e0e1e2;
+}
+
+.order_list h3 {
+ margin-bottom: 6px;
+}
+
+.order_list hr {
+ margin-top: 0px;
+ margin-right: 0;
+ margin-left: 0;
+ margin-bottom: 16px;
+}
+
+.order_list hr:nth-child(5) {
+ margin-top: 15px;
+ width: 930px;
+ margin-left: -10px;
+}
+
+.order_list .all_price p {
+ font-size: 15px;
+ display: inline-block;
+}
+
+.order_list .all_price p:nth-child(1) {
+ padding-left: 19px;
+ padding-right: 150px;
+}
+
+.order_list .all_price p:nth-child(2) {
+ padding-right: 20px;
+}
+
+.order_list .all_price .all_price {
+ font-size: 20px;
+ font-weight: bold;
+}
+
+.order_list_li {
+ padding: 10px 20px;
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+}
+
+.order_list_li .little_img {
+ height: 78px;
+ width: 78px;
+ border: 1px solid #C6C7C9;
+ overflow: hidden;
+ display: inline-block;
+ margin-right: 14px;
+ float: left;
+}
+
+.order_list_li .little_img img {
+ height: 100%;
+}
+
+.order_list_li .name_and_code {
+ display: inline-block;
+ float: left;
+}
+
+.order_list_li .name_and_code .name {
+ display: block;
+ color: #6aa034;
+ font-size: 15px;
+ width: 175px;
+ margin-bottom: 7px;
+ position: relative;
+ line-height: 18px;
+ top: -3px;
+}
+
+.order_list_li .name_and_code .code {
+ display: block;
+ font-size: 12px;
+}
+
+.order_list_li .how_many {
+ display: inline-block;
+ padding: 32px 20px 0px 85px;
+ font-weight: bold;
+}
+
+.order_list_li .price {
+ display: inline-block;
+ padding-left: 44px;
+ font-weight: bold;
+ font-size: 18px;
+ padding-top: 31px;
+ padding-left: 48px;
+}
+
+.order_list_li .price .price_text {
+ font-size: 15px;
+ font-weight: normal;
+}
+
+.basket_step_2_delivery h3 {
+ font-size: 18px;
+ font-weight: bold;
+ margin-top: 28px;
+ margin-bottom: 12px;
+}
+
+.basket_step_2_delivery h4 {
+ font-size: 18px;
+ font-weight: bold;
+ margin-top: 24px;
+ margin-bottom: 12px;
+}
+
+.basket_step_2_delivery .detail {
+ font-size: 13px;
+ margin-bottom: 7px;
+}
+
+.basket_step_2_delivery .detail .grey {
+ color: #898b8e;
+ display: inline-block;
+ width: 69px;
+}
+
+.for_margin_2 {
+ text-align: center;
+ margin: 34px 0 42px;
+}
+
+.cabinet_main_title {
+ margin-top: 0;
+ font-weight: bold;
+ font-size: 30px;
+ margin-bottom: 38px;
+}
+
+.cabinet_wrap {
+ position: relative;
+ margin-bottom: 282px;
+}
+
+.cabinet_wrap span.grey {
+ color: #898b8e;
+}
+
+.cabinet_wrap .cab_01 {
+ padding-bottom: 24px;
+}
+
+.cabinet_wrap .block_01 {
+ display: inline-block;
+ vertical-align: top;
+ width: 233px;
+}
+
+.cabinet_wrap .block_02 {
+ display: inline-block;
+ width: 79px;
+}
+
+.cabinet_wrap .block_03 {
+ display: inline-block;
+ width: auto;
+}
+
+.cabinet_wrap .block_04 {
+ display: inline-block;
+ padding-left: 60px;
+ border-left: 1px solid #C6C7C9;
+ position: relative;
+ vertical-align: top;
+ margin-left: 20px;
+}
+
+.cabinet_wrap .block_04 .link {
+ padding-top: 21px;
+ padding-bottom: 20px;
+ font-size: 13px;
+}
+
+.cabinet_wrap .block_04 .link .dotted {
+ border-bottom: 1px dotted #6aa034;
+}
+
+.cabinet_wrap .block_04 .link a {
+ text-decoration: none;
+}
+
+.cabinet_wrap .block_04 .link:nth-child(2) {
+ padding-top: 4px;
+ font-size: 13px;
+ padding-bottom: 20px;
+}
+
+.cabinet_wrap .block_04 .link:nth-child(2) a {
+ border-bottom: none;
+ text-decoration: none;
+}
+
+/*=============================================== MODAL WINDOWS ================================================*/
+
+/* registration window */
+
+/* стили модального окна*/
+
+/* стили основного модального окна */
+
+.modal_close_btn {
+ position: absolute;
+ right: -42px;
+ top: -59px;
+ cursor: pointer;
+ width: 100px;
+ height: 120px;
+ overflow: hidden;
+ background-image: url("../images/modal_close_btn.png");
+ background-repeat: no-repeat;
+ background-position: -143px 0;
+}
+
+.modal_close_btn:hover {
+ background-position: 0 0;
+}
+
+.modal_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 2;
+ top: 0;
+ left: 0;
+}
+
+.modal_wrapper_reg {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.modal_wrapper_reg .modal_window {
+ text-align: right;
+ height: 428px;
+ width: 560px;
+ background-color: #fff;
+ padding: 20px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ position: relative;
+ margin-left: auto;
+ margin-right: auto;
+ margin-top:35px;
+ z-index:5;
+}
+
+.modal_wrapper_reg .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.modal_wrapper_reg .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.modal_wrapper_reg .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.modal_wrapper_reg .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.modal_wrapper_reg .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.modal_wrapper_reg .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 30px;
+ padding-bottom: 26px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.modal_wrapper_reg .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 500px;
+ margin: auto;
+ margin-bottom: 8px;
+}
+
+.modal_wrapper_reg .modal_window label:last-of-type {
+ position: relative;
+}
+
+#signupform-verifycode{
+ width: 119px;
+ margin-left: 140px;
+}
+
+
+
+.modal_wrapper_reg .modal_window label:last-of-type img {
+ position: absolute;
+ top: 4px;
+ left: 176px;
+}
+
+.modal_wrapper_reg .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 30px;
+}
+
+/* login window */
+
+.modal_wrapper_login {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.modal_wrapper_login .modal_window {
+ text-align: right;
+ height: 247px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-left:auto;
+ margin-right:auto;
+ margin-top: 35px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ z-index:999;
+}
+
+.modal_wrapper_login .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.modal_wrapper_login .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.modal_wrapper_login .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.modal_wrapper_login .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.modal_wrapper_login .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.modal_wrapper_login .modal_window .title {
+ padding-right: 8px;
+}
+
+.modal_wrapper_login .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 459px;
+ margin: auto;
+ margin-bottom: 8px;
+}
+
+.modal_wrapper_login .modal_window label input {
+ margin-right: 68px;
+}
+
+.modal_wrapper_login .modal_window .pass_links {
+ text-align: center;
+ padding-left: 55px;
+ font-size: 13px;
+ margin-top: 11px;
+}
+
+.modal_wrapper_login .modal_window .pass_links a {
+ padding-left: 47px;
+}
+
+.modal_wrapper_login .modal_window .pass_links label {
+ display: inline;
+}
+
+.modal_wrapper_login .modal_window .pass_links .remember_pas {
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.modal_wrapper_login .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.modal_wrapper_login .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 38px;
+}
+
+/* consultation window */
+
+.consultation_modal {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.consultation_modal .modal_window {
+ text-align: right;
+ height: 247px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-left:auto;
+ margin-right:auto;
+ margin-top: 35px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ z-index:999;
+}
+
+.consultation_modal .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.consultation_modal .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.consultation_modal .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.consultation_modal .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.consultation_modal .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.consultation_modal .modal_window .title {
+ padding-right: 8px;
+}
+
+.consultation_modal .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 459px;
+ margin: auto;
+ margin-bottom: 8px;
+}
+
+.consultation_modal .modal_window label input {
+ margin-right: 68px;
+}
+
+.consultation_modal .modal_window .pass_links {
+ text-align: center;
+ padding-left: 55px;
+ font-size: 13px;
+ margin-top: 11px;
+}
+
+.consultation_modal .modal_window .pass_links a {
+ padding-left: 47px;
+}
+
+.consultation_modal .modal_window .pass_links label {
+ display: inline;
+}
+
+.consultation_modal .modal_window .pass_links .remember_pas {
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.consultation_modal .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.consultation_modal .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 38px;
+}
+
+/* forgot password window */
+
+.forgot_pass_modal_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.forgot_pass_modal_wrapper .modal_window {
+ text-align: right;
+ height: 252px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-top: 35px;
+ margin-left:auto;
+ margin-right:auto;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ z-index:5;
+}
+
+.forgot_pass_modal_wrapper .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.forgot_pass_modal_wrapper .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.forgot_pass_modal_wrapper .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.forgot_pass_modal_wrapper .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .title {
+ padding-right: 0px;
+ padding-top: 30px;
+ padding-bottom: 23px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .text {
+ color: #898b8e;
+ font-size: 13px;
+ text-align: left;
+ margin-bottom: 28px;
+}
+
+.forgot_pass_modal_wrapper .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 459px;
+ margin: auto;
+ margin-bottom: 30px;
+}
+
+.forgot_pass_modal_wrapper .modal_window label input {
+ margin-right: 52px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links {
+ text-align: center;
+ padding-left: 55px;
+ font-size: 13px;
+ margin-top: 11px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links a {
+ padding-left: 47px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links label {
+ display: inline;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links .remember_pas {
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.forgot_pass_modal_wrapper .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 28px;
+}
+
+/* forgot password success window */
+
+.forgot_pass_success_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 2;
+ top: 0;
+ left: 0;
+ display: none;
+ z-index:4;
+}
+
+.forgot_pass_success_wrapper .modal_window {
+ text-align: right;
+ height: 158px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-top: 35px;
+ margin-left:auto;
+ margin-right:auto;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+}
+
+.forgot_pass_success_wrapper .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.forgot_pass_success_wrapper .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.forgot_pass_success_wrapper .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.forgot_pass_success_wrapper .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.forgot_pass_success_wrapper .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.forgot_pass_success_wrapper .modal_window .title {
+ padding-right: 0px;
+ padding-top: 30px;
+ padding-bottom: 23px;
+}
+
+.forgot_pass_success_wrapper .modal_window .text {
+ color: #898b8e;
+ font-size: 13px;
+ text-align: center;
+ margin-bottom: 27px;
+}
+
+.forgot_pass_success_wrapper .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.forgot_pass_success_wrapper .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 22px;
+}
+/* callback window */
+
+.callback_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 2;
+ top: 0;
+ left: 0;
+ display: none;
+ z-index:5;
+}
+
+.callback_wrapper .modal_window {
+ text-align: right;
+ height: 158px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-top: 35px;
+ margin-left:auto;
+ margin-right:auto;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+}
+
+.callback_wrapper .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.callback_wrapper .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.callback_wrapper .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.callback_wrapper .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.callback_wrapper .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.callback_wrapper .modal_window .title {
+ padding-right: 0px;
+ padding-top: 32px;
+ padding-bottom: 25px;
+ font-size: 28px;
+}
+
+.callback_wrapper .modal_window .text {
+ color: #333333;
+ font-size: 16px;
+ text-align: center;
+ margin-bottom: 27px;
+}
+/* BUSKET MODAL WINDOW */
+
+/*==================== BUSKET MODAL BASIC */
+
+.busket_modal_basic {
+ display: inline-block;
+ background: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.busket_modal_basic .order_list {
+ width: auto;
+ padding: 25px;
+}
+
+.busket_modal_basic .order_list ul {
+ max-height: 350px;
+ overflow-y: overlay;
+ overflow-x: hidden;
+}
+
+.busket_modal_basic .order_list h3 {
+ text-transform: uppercase;
+ font-weight: normal;
+ font-size: 20px;
+ padding: 20px 0 15px;
+}
+
+.busket_modal_basic .order_list .order_list_li {
+ display: block;
+}
+
+.busket_modal_basic .order_list .order_list_li .little_img {
+ float: none;
+}
+
+.busket_modal_basic .order_list .order_list_li .name_and_code {
+ text-align: left;
+ float: none;
+}
+
+.busket_modal_basic .order_list .order_list_li .name_and_code .name {
+ margin-bottom: 14px;
+}
+
+.busket_modal_basic .order_list .order_list_li .price {
+ padding: 0;
+}
+
+.busket_modal_basic .order_list .order_list_li .count_block_wrap {
+ display: inline-block;
+ vertical-align: top;
+ text-align: right;
+}
+
+.busket_modal_basic .order_list .count_block {
+ display: block;
+ position: relative;
+ margin-bottom: 30px;
+}
+
+.busket_modal_basic .order_list .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 3px 13px 3px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 6px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ text-align: center;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn {
+ margin-top: 20px;
+ text-align: center;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn a {
+ display: inline-block;
+ font-size: 13px;
+ margin-right: 97px;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn button {
+ display: inline-block;
+ padding: 10px 20px;
+ color: white;
+ background-color: #6aa034;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ font-size: 13px;
+ font-weight: normal;
+ -webkit-box-shadow: 0px 2px 0px #517a27;
+ box-shadow: 0px 2px 0px #517a27;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn button:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn button:hover {
+ background-color: #5d8d2e;
+}
+
+.busket_modal_basic .order_list .delete_item_btn {
+ display: inline-block;
+ vertical-align: top;
+ margin-top: 30px;
+ padding: 0 10px 0 0;
+ cursor: pointer;
+ color: #C6C7C9;
+ font-size: 20px;
+}
+
+.busket_modal_basic .order_list .delete_item_btn:hover {
+ color: red;
+}
+
+/*==================== BUSKET MODAL 1 */
+
+.busket_modal_wrapper {
+ display: none;
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: fixed;
+ z-index: 4;
+ top: 0;
+ left: 0;
+}
+
+.busket_modal_wrapper .m_a {
+ display: block;
+ text-align: center;
+ position: relative;
+ margin-top: 35px;
+}
+
+.busket_modal_wrapper .busket_modal_01 {
+ display: inline-block;
+ background: white;
+ position: relative;
+ overflow: hidden;
+ border-radius:3px;
+ -webkit-border-radius:3px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list {
+ width: auto;
+ padding: 25px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list ul {
+ max-height: 350px;
+ overflow-y: overlay;
+ overflow-x: hidden;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list h3 {
+ text-transform: uppercase;
+ font-weight: normal;
+ font-size: 20px;
+ padding: 20px 0 15px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li {
+ display: block;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .little_img {
+ float: none;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .name_and_code {
+ text-align: left;
+ float: none;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .name_and_code .name {
+ margin-bottom: 14px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .price {
+ padding: 0;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .count_block_wrap {
+ display: inline-block;
+ vertical-align: top;
+ text-align: right;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block {
+ display: block;
+ position: relative;
+ margin-bottom: 30px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 3px 13px 3px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 16px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ text-align: center;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn {
+ margin-top: 20px;
+ text-align: center;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn a {
+ display: inline-block;
+ font-size: 13px;
+ margin-right: 97px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn button {
+ display: inline-block;
+ padding: 10px 20px;
+ color: white;
+ background-color: #6aa034;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ font-size: 13px;
+ font-weight: normal;
+ -webkit-box-shadow: 0px 2px 0px #517a27;
+ box-shadow: 0px 2px 0px #517a27;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn button:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn button:hover {
+ background-color: #5d8d2e;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .delete_item_btn {
+ display: inline-block;
+ vertical-align: top;
+ margin-top: 30px;
+ padding: 0 10px 0 0;
+ cursor: pointer;
+ color: #C6C7C9;
+ font-size: 20px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .delete_item_btn:hover {
+ color: red;
+}
+
+/*==================== BUSKET MODAL 2 */
+
+.busket_modal_header {
+ display: inline-block;
+ position: absolute;
+ top: 91px;
+ right: 0px;
+ border: 1px solid #898b8e;
+ z-index: 2;
+ display: none;
+ background-color: #fff;
+ box-shadow: 0px 0px 4px #757575;
+ border-radius: 3px 0px 3px 3px;
+}
+
+.busket_modal_header .busket_modal_02 {
+ display: inline-block;
+ background: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.busket_modal_header .busket_modal_02 .order_list {
+ /*width: auto;*/
+ padding: 25px 0px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list ul {
+ overflow-y: overlay;
+ overflow-x: hidden;
+}
+
+.busket_modal_header .busket_modal_02 .order_list h3 {
+ text-transform: uppercase;
+ font-weight: normal;
+ font-size: 20px;
+ padding: 20px 0 15px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li {
+ display: block;
+ max-width:440px;
+ overflow: hidden;
+}
+
+
+.busket_modal_header .busket_modal_02 .order_list li:nth-child(even){
+ background-color:#f4f4f4;
+}
+.busket_modal_01 .order_list li:nth-child(even){
+ background-color:#f4f4f4;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .little_img {
+ /*float: none;*/
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .name_and_code {
+ text-align: left;
+ /*float: none;*/
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .name_and_code .name {
+ margin-bottom: 14px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .price {
+ padding: 0;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .count_block_wrap {
+ display: inline-block;
+ vertical-align: top;
+ text-align: right;
+ float: left;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block {
+ display: block;
+ position: relative;
+ margin-bottom: 30px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 6px 13px 3px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 16px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ text-align: center;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn {
+ margin-top: 20px;
+ text-align: center;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn a {
+ display: inline-block;
+ font-size: 13px;
+ margin-right: 130px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn .button {
+ display: inline-block;
+ padding: 10px 20px;
+ text-decoration: none;
+ margin: 0;
+ color: white;
+ background-color: #6aa034;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ font-size: 13px;
+ font-weight: normal;
+ -webkit-box-shadow: 0px 2px 0px #517a27;
+ box-shadow: 0px 2px 0px #517a27;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn .button:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn .button:hover {
+ background-color: #5d8d2e;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .delete_item_btn {
+ display: inline-block;
+ vertical-align: top;
+ margin-top: 30px;
+ padding: 0 10px 0 0;
+ cursor: pointer;
+ color: #C6C7C9;
+ font-size: 20px;
+ float: left;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .delete_item_btn:hover {
+ color: red;
+}
+/********************BASKET *************************/
+
+
+.basket_form .order_list {
+ /*width: auto;*/
+ padding: 25px 0px;
+}
+
+.basket_form .order_list ul {
+ overflow-y: overlay;
+ overflow-x: hidden;
+}
+
+.basket_form .order_list h3 {
+ text-transform: uppercase;
+ font-weight: normal;
+ font-size: 20px;
+ padding: 20px 0 15px;
+}
+
+.basket_form .order_list .order_list_li {
+ display: block;
+ max-width:440px;
+ overflow: hidden;
+}
+
+
+.basket_form .order_list li:nth-child(even){
+ background-color:#f4f4f4;
+}
+.busket_modal_01 .order_list li:nth-child(even){
+ background-color:#f4f4f4;
+}
+
+.basket_form .order_list .order_list_li .little_img {
+ /*float: none;*/
+}
+
+.basket_form .order_list .order_list_li .name_and_code {
+ text-align: left;
+ /*float: none;*/
+}
+
+.basket_form .order_list .order_list_li .name_and_code .name {
+ margin-bottom: 14px;
+}
+
+.basket_form .order_list .order_list_li .price {
+ padding: 0;
+}
+
+.basket_form .order_list .order_list_li .count_block_wrap {
+ display: inline-block;
+ vertical-align: top;
+ text-align: right;
+ float: left;
+}
+
+.basket_form .order_list .count_block {
+ display: block;
+ position: relative;
+ margin-bottom: 30px;
+}
+
+.basket_form .order_list .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 6px 13px 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.basket_form .order_list .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 16px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.basket_form .order_list .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.basket_form .order_list .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.basket_form .order_list .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ text-align: center;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.basket_form .order_list .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.basket_form .order_list .busket_bottom_btn {
+ margin-top: 20px;
+ text-align: center;
+}
+
+.basket_form .order_list .busket_bottom_btn a {
+ display: inline-block;
+ font-size: 13px;
+ margin-right: 130px;
+}
+
+.basket_form .order_list .busket_bottom_btn .button {
+ display: inline-block;
+ padding: 10px 20px;
+ text-decoration: none;
+ margin: 0;
+ color: white;
+ background-color: #6aa034;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ font-size: 13px;
+ font-weight: normal;
+ -webkit-box-shadow: 0px 2px 0px #517a27;
+ box-shadow: 0px 2px 0px #517a27;
+}
+
+.basket_form .order_list .busket_bottom_btn .button:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.basket_form .order_list .busket_bottom_btn .button:hover {
+ background-color: #5d8d2e;
+}
+
+.basket_form .order_list .delete_item_btn {
+ display: inline-block;
+ vertical-align: top;
+ margin-top: 30px;
+ padding: 0 10px 0 0;
+ cursor: pointer;
+ color: #C6C7C9;
+ font-size: 20px;
+ float: left;
+}
+
+.basket_form .order_list .delete_item_btn:hover {
+ color: red;
+}
+/*=============================================== CATEGORY PAGE ================================================*/
+
+.category_page_main_title {
+ margin-top: 0;
+ margin-bottom: 41px;
+ font-weight: bold;
+}
+
+.category_wrap {
+ margin-bottom: 18px;
+}
+
+.category_wrap .category_wrap_3_colum {
+ width: 300px;
+ display: inline-block;
+ vertical-align: top;
+ margin-right: 15px;
+}
+
+.category_wrap .category_wrap_3_colum:last-of-type {
+ margin-right: 0px;
+}
+
+.category_wrap .wrap {
+ margin-bottom: 16px;
+}
+
+.category_wrap .wrap a {
+ text-decoration: none;
+}
+
+.category_wrap .wrap .cat_li_cont {
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ width: 298px;
+ height: 78px;
+ display: inline-block;
+ position: relative;
+}
+
+.category_wrap .wrap .cat_li_cont img {
+ padding-top: 9px;
+ padding-left: 7px;
+ float: left;
+ padding-right: 20px;
+}
+
+.category_wrap .wrap .cat_li_cont .desc {
+ font-size: 15px;
+ width: 150px;
+ color: #333333;
+ margin-left: 87px;
+ height: 78px;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+.category_wrap .wrap .cat_li_cont .arrow {
+ background-image: url("../images/category/green_arrows.png");
+ width: 20px;
+ height: 10px;
+ background-repeat: no-repeat;
+ display: block;
+ position: absolute;
+ right: 15px;
+ top: 35px;
+ background-position: 0px 0px;
+}
+
+.category_wrap .wrap .cat_li_sub_ul {
+ padding: 18px 2px 13px 18px;
+ font-size: 13px;
+ line-height: 20px;
+ border: 1px solid #C6C7C9;
+ width: 278px;
+ background-color: white;
+ position: relative;
+ top: -6px;
+ border-top: none;
+ display: none;
+}
+
+/*=============================================== 404 PAGE ================================================*/
+
+.wrap_for_404 {
+ min-height: 670px;
+}
+
+.wrap_for_404 .main_title_404 {
+ font-size: 30px;
+ margin-top: 0;
+ margin-bottom: 30px;
+ font-weight: bold;
+}
+
+.wrap_for_404 .main_img_404 {
+ float: left;
+ position: relative;
+ right: 10px;
+ padding: 27px 21px 10px 0px;
+}
+
+.wrap_for_404 .block_404 .first {
+ font-size: 16px;
+ margin-top: 103px;
+ line-height: 20px;
+}
+
+.wrap_for_404 .block_404 .second {
+ font-size: 13px;
+ margin-top: 60px;
+ line-height: 15px;
+ color: #898b8e;
+}
+
+.wrap_for_404 .block_404 button {
+ padding: 7px 21px;
+ background-color: #6aa034;
+ margin-top: 47px;
+ margin-left: 151px;
+ border: none;
+ font-size: 13px;
+ color: white;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.wrap_for_404 .block_404 button:hover {
+ background-color: #5d8d2e;
+}
+
+.wrap_for_404 .block_404 button:active {
+ position: relative;
+ top: 2px;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.test_flex_example {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+/*=============================================== ZAGLUSHKA PAGE ================================================*/
+
+.zaglushka_logo_img {
+ width: 230px;
+ margin: 80px auto 27px;
+}
+
+.zaglushka_main_img {
+ width: 880px;
+ position: relative;
+ left: -6px;
+}
+
+.zaglushka_text {
+ text-align: center;
+ font-weight: bold;
+ padding-top: 44px;
+ position: relative;
+ right: 4px;
+ padding-bottom: 130px;
+}
+
+.zaglushka_text h2 {
+ color: #6aa034;
+ font-size: 20px;
+ letter-spacing: 1px;
+}
+
+.zaglushka_text p {
+ font-size: 16px;
+ padding-bottom: 22px;
+}
+
+.zaglushka_text .zaglushka_separate_line {
+ height: 1px;
+ background: #C6C7C9;
+ width: 508px;
+ margin: 13px auto 17px;
+}
+
+/*=============================================== VALIDATION ================================================*/
+
+.reg_form label.error {
+ margin-left: 180px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
+
+.modal_wrapper_login .modal_window label.error {
+ margin-left: 127px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
+
+.consultation_modal .modal_window label.error {
+ margin-left: 127px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
+
+
+.forgot_password_form label.error {
+ margin-left: 141px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
+
+.customer_content{
+ display: inline-block;
+ width: 420px;
+}
+.modal_wrapper_cabinet .cabinet_window label {
+ display: block;
+ font-size: 13px;
+ width: 500px;
+ margin: auto;
+ margin-bottom: 8px;
+}
+
+.modal_wrapper_cabinet .cabinet_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.modal_wrapper_cabinet .cabinet_window{
+
+ text-align: right;
+}
+
+
+.modal_wrapper_cabinet{
+ margin-left: -60px;
+}
+
+.my_cust_cabinet_btn{
+ font-family: 'Ubuntu', sans-serif;
+ background-color: #6aa033;
+ border: 0;
+ color: #ffffff;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ font-size: 13px;
+ border-top: 1px solid #6aa033;
+ border-bottom: 2px solid #588c23;
+ border-radius: 0px 2px 2px 0px;
+ cursor: pointer;
+ padding-right: 10px;
+ padding-left: 10px;
+ z-index: 2;
+ height: 38px;
+}
+
+.product_service{
+ margin-top: 10px;
+}
+.product_service ul li{
+ font-size: 13px;
+}
+.product_service ul li.item1 {
+ background: url('/images/li1.png') left no-repeat;
+ padding: 3px 23px;
+}
+
+.product_service ul li.item3 {
+ background: url('/images/li3.png') left no-repeat;
+ padding: 3px 23px;
+}
+
+.head_basket_count{
+ color:#6aa033;
+}
+
diff --git a/frontend/web/css/concat_all_back.css b/frontend/web/css/concat_all_back.css
new file mode 100644
index 0000000..17ec0a1
--- /dev/null
+++ b/frontend/web/css/concat_all_back.css
@@ -0,0 +1,3096 @@
+.w_100 {
+ width: 100%;
+}
+
+.w_960 {
+ width: 960px;
+ margin: auto;
+}
+
+.cat_p_bradcrump {
+ padding: 30px 0px;
+}
+
+.cat_p_bradcrump ul {
+ list-style: none;
+}
+
+.cat_p_bradcrump ul li {
+ display: inline-block;
+}
+
+.cat_p_bradcrump ul li i {
+ position: relative;
+ top: 1px;
+ padding: 0px 2px 0 8px;
+ color: #8C9295;
+ font-size: 13px;
+}
+
+.cat_p_bradcrump ul li a {
+ font-size: 12px;
+ color: #898b8e;
+}
+
+.cat_p_bradcrump ul .active a {
+ text-decoration: none;
+}
+
+.cat_p_filter_bar {
+ font-family: 'HelveticaRegular', sans-serif;
+ width: 210px;
+ padding-right: 20px;
+ display: inline-block;
+ float: left;
+}
+
+.cat_p_filter_bar .filter_list ul {
+ list-style: none;
+}
+
+.cat_p_filter_bar .filter_list ul .title_2 {
+ font-size: 15px;
+ font-weight: bold;
+ color: #898b8e;
+ padding: 30px 0 20px;
+}
+
+.cat_p_filter_bar .filter_list ul li {
+ border-bottom: 1px solid #bbbbbb;
+ position: relative;
+ padding: 15px 0;
+ font-weight: bold;
+ color: #333333;
+}
+
+.cat_p_filter_bar .filter_list ul li .width_li_filter {
+ width: 180px;
+ display: block;
+}
+
+.cat_p_filter_bar .filter_list ul li .arrow {
+ position: absolute;
+ right: 2px;
+ top: 3px;
+ font-size: 20px;
+ color: #727272;
+ padding: 10px 0 10px 200px;
+}
+
+.cat_p_filter_bar .filter_list ul li .arrow i {
+ font-weight: bold;
+}
+
+.cat_p_filter_bar .filter_list ul li .arrow img {
+ -webkit-transform: scale(1.3);
+ -ms-transform: scale(1.3);
+ transform: scale(1.3);
+ position: relative;
+ bottom: 3px;
+}
+
+.cat_p_filter_bar .filter_list .price_filter {
+ display: none;
+ padding-top: 10px;
+}
+
+.cat_p_filter_bar .filter_list .price_filter a {
+ color: #6aa033;
+}
+
+.cat_p_filter_bar .filter_list .first_price_li {
+ padding-top: 30px;
+ display: block;
+}
+
+.cat_p_filter_bar .filter_accept_bloc {
+ padding: 20px 0 40px;
+}
+
+.cat_p_filter_bar .filter_accept_bloc button {
+ color: #fff;
+ padding: 10px;
+ font-size: 15px;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #898b8e;
+ -webkit-box-shadow: 0 2px 0 #636567;
+ box-shadow: 0 2px 0 #636567;
+}
+
+.cat_p_filter_bar .filter_accept_bloc button:hover {
+ background-color: #707274;
+}
+
+.cat_p_filter_bar .filter_accept_bloc a {
+ color: #6AA033;
+ font-size: 12px;
+}
+
+.cat_p_filter_bar .product_list .title {
+ padding-bottom: 5px;
+ color: #898b8e;
+}
+
+.cat_p_filter_bar .product_list a {
+ display: block;
+ padding: 5px 0 0 15px;
+ font-weight: normal;
+}
+
+.cat_p_filter_bar .price_slider {
+ width: 203px;
+ /*margin: auto;*/
+}
+
+.cat_p_filter_bar .checkbox {
+ margin-top: 5px;
+ font-weight: normal;
+}
+
+.cat_p_filter_bar .see_all a {
+ font-size: 13px;
+ position: relative;
+ bottom: 3px;
+}
+
+.cat_p_filter_bar .see_all i {
+ font-size: 18px;
+ color: #898B8E;
+}
+
+.cat_p_filter_bar .title {
+ font-size: 16px;
+ font-weight: bold;
+ color: #898b8e;
+ padding-bottom: 20px;
+}
+
+.cat_p_filter_bar p {
+ margin-bottom: 20px;
+}
+
+.cat_p_filter_bar p input {
+ padding: 8px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ border: none;
+ border: 1px solid #bbb;
+ width: 60px;
+}
+
+.cat_p_filter_bar p label {
+ display: block;
+ margin-bottom: 15px;
+}
+
+.cat_p_catalog_list {
+ font-family: 'HelveticaRegular', sans-serif;
+ width: 700px;
+ padding-right: 10px;
+ display: inline-block;
+}
+
+.cat_p_catalog_list ul {
+ list-style: none;
+ display: inline-block;
+}
+
+.cat_p_catalog_list ul li {
+ display: inline-block;
+}
+
+.cat_p_catalog_list ul li .active {
+ color: #333333;
+ text-decoration: none;
+}
+
+.cat_p_catalog_list ul li a {
+ color: #6aa033;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .sort_menu {
+ padding-bottom: 10px;
+ border-bottom: 1px solid #DBDCDD;
+ margin-bottom: 30px;
+ width: 720px;
+}
+
+.cat_p_catalog_list .title {
+ font-size: 30px;
+ font-weight: bold;
+ padding-bottom: 20px;
+}
+
+.cat_p_catalog_list .sort_price {
+ display: inline-block;
+ width: 225px;
+ position: relative;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .sort_price select {
+ text-decoration: underline;
+ width: 120px;
+ border: none;
+ color: #6aa033;
+ -webkit-appearance: none;
+ /* скрытие треугольника в селекте */
+ -moz-appearance: none;
+ appearance: none;
+ /* скрытие треугольника в селекте */
+ text-indent: 0.01px;
+ /* скрытие треугольника в селекте в firefox */
+ text-overflow: '';
+ /* скрытие треугольника в селекте в firefox */
+ /*&::-ms-expand { display: none; } скрытие треугольника в селекте в IE */
+ background: transparent;
+}
+
+.cat_p_catalog_list .sort_price select:focus {
+ outline: none;
+}
+
+.cat_p_catalog_list .sort_price select option {
+ background: transparent;
+}
+
+.cat_p_catalog_list .sort_price i {
+ position: absolute;
+ right: 72px;
+ top: 3px;
+ cursor: pointer;
+ font-weight: bold;
+ color: #898b8e;
+ z-index: -1;
+}
+
+.cat_p_catalog_list .show {
+ display: inline-block;
+ width: 225px;
+ text-align: center;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .show_pages {
+ display: inline-block;
+ width: 250px;
+ text-align: right;
+ font-size: 13px;
+}
+
+.cat_p_catalog_list .show_pages i {
+ color: #898b8e;
+ position: relative;
+ top: 1px;
+ padding-left: 5px;
+ font-size: 15px;
+ cursor: pointer;
+}
+
+.cat_p_item_card_list {
+ font-family: 'HelveticaRegular', sans-serif;
+}
+
+.cat_p_item_card_list .novelty {
+ text-align: center;
+}
+
+.cat_p_item_card_list .novelty .content {
+ width: 720px;
+ padding: 0;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont {
+ width: 720px;
+ padding-bottom: 10px;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item {
+ /*min-height: 375px;*/
+ margin-right: 20px;
+ margin-bottom: 20px;
+ margin-left: 0;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item:after {
+ display: none;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .item_bottom_img {
+ position: relative;
+ top: 3px;
+ right: 1px;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item:before {
+ content: "";
+ position: absolute;
+ bottom: -1px;
+ right: -1px;
+ width: 0px;
+ height: 0px;
+ border-width: 13px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ z-index: 2;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .brand span {
+ color: #6aa033;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .new {
+ background-color: red;
+ width: auto;
+ padding-right: 20px;
+}
+
+.cat_p_item_card_list .novelty .content .novelty_cont .item .new:after {
+ right: 0px;
+ width: 0px;
+ height: 0px;
+ border-width: 18px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+}
+
+.cat_p_item_card_list .novelty .content .load_more_btn {
+ font-size: 13px;
+ padding: 10px 15px;
+ background: #6AA033;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ border: none;
+ color: white;
+ -webkit-box-shadow: 0 2px 0 #507927;
+ box-shadow: 0 2px 0 #507927;
+ margin-bottom: 20px;
+}
+
+.cat_p_item_card_list .novelty .content .load_more_btn:hover {
+ background: #5d8d2d;
+}
+
+.cat_p_item_card_list .novelty .content .show_pages {
+ display: block;
+ margin: auto;
+ text-align: center;
+ margin-bottom: 7px;
+}
+
+.cat_p_item_card_list .novelty .content .description {
+ color: #333333;
+ text-align: left;
+ font-weight: normal;
+ font-size: 13px;
+}
+
+.cat_p_item_card_list .novelty .content .description h2 {
+ padding: 30px 0;
+ font-size: 30px;
+ font-weight: normal;
+}
+
+.cat_p_item_card_list .novelty .content .description .bold {
+ font-weight: bold;
+}
+
+.cat_p_item_card_list .novelty .content .description h4 {
+ padding: 20px 0;
+ font-size: 14px;
+}
+
+.cat_p_item_card_list .novelty .content .description .margin_bottom_20 {
+ margin-bottom: 20px;
+}
+
+.cat_p_item_card_list .novelty .content .description .empty_padding_400 {
+ width: 100px;
+ height: 380px;
+}
+/* светлый зеленый цвет, текст и кнопки */
+
+/* средний серый цвет, текст и кнопки */
+
+/* светлый серый цвет, рамки и линии */
+
+/* темный серый цвет, большие названия, цифры */
+
+a {
+ color: #6aa034;
+}
+
+a:hover {
+ color: #517a27;
+}
+
+h1 {
+ color: #333333;
+ font-size: 30px;
+ font-weight: normal;
+}
+
+.flex-container {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.bradcrumps_top {
+ padding: 30px 0;
+ line-height: 0;
+}
+
+.bradcrumps_top ul li {
+ display: inline-block;
+}
+
+.bradcrumps_top ul li a {
+ font-size: 12px;
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.bradcrumps_top ul li:last-child a {
+ text-decoration: none;
+ color: #898b8e;
+}
+
+.bradcrumps_top ul li:last-child i {
+ display: none;
+}
+
+.bradcrumps_top ul li i {
+ color: #898b8e;
+ padding: 0 2px 0 6px;
+ font-weight: bold;
+ font-size: 11px;
+}
+
+.my_custom_card {
+ width: 218px;
+ display: inline-block;
+ border: 1px solid #cdd1d9;
+ border-bottom: none;
+ -webkit-border-top-left-radius: 2px;
+ border-top-left-radius: 2px;
+ -webkit-border-top-right-radius: 2px;
+ border-top-right-radius: 2px;
+ position: relative;
+ text-align: center;
+ margin-bottom: 1px;
+ margin-bottom: 19px;
+ color: #333333;
+ /* &:before {
+ content: "";
+ position: absolute;
+ bottom: -1px;
+ right: -1px;
+ width: 0px;
+ height: 0px;
+ border-width: 13px 13px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ z-index: 2;
+ }*/
+}
+
+.my_custom_card .item_bottom_img {
+ bottom: 61px;
+ left: -1px;
+ position: absolute;
+ top: 374px;
+}
+
+.my_custom_card .new {
+ position: absolute;
+ color: #ffffff;
+ left: 0px;
+ top: 14px;
+ text-transform: uppercase;
+ font-size: 10px;
+ text-align: left;
+ background-color: red;
+ width: auto;
+ padding: 1px 20px 0px 5px;
+ z-index: 1;
+ line-height: 17px;
+}
+
+.my_custom_card .new:after {
+ content: "";
+ height: 0px;
+ top: 0;
+ right: 0;
+ border-width: 21px 14px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ position: absolute;
+}
+
+.my_custom_card .top {
+ background: #ffde00;
+ position: absolute;
+ padding: 1px 20px 0px 5px;
+ color: #ffffff;
+ left: 0px;
+ top: 35px;
+ text-transform: uppercase;
+ font-size: 10px;
+ color: #333333;
+ z-index: 1;
+}
+
+.my_custom_card .top:after {
+ content: "";
+ top: 0;
+ right: 0px;
+ border-width: 21px 14px 0px 0px;
+ border-style: solid;
+ border-color: transparent #fff;
+ position: absolute;
+}
+
+.my_custom_card .item_link {
+ text-decoration: none;
+ border: 0;
+}
+
+.my_custom_card .item_link .pic {
+ margin-top: 25px;
+}
+
+.my_custom_card .item_link .title_item {
+ padding: 13px;
+ color: #6aa033;
+ margin-bottom: 3px;
+ font-size: 15px;
+ line-height: 17px;
+}
+
+.my_custom_card .brand {
+ font-size: 12px;
+ line-height: 12px;
+}
+
+.my_custom_card .brand span {
+ color: #6aa033;
+}
+
+.my_custom_card .type {
+ font-size: 12px;
+}
+
+.my_custom_card .price {
+ font-size: 20px;
+ font-weight: bold;
+ font-family: HelveticaBold;
+ padding-bottom: 11px;
+ padding-top: 6px;
+}
+
+.my_custom_card .price span {
+ font-size: 13px !important;
+}
+
+.my_custom_card .foo {
+ padding: 5px 53px 5px 14px;
+ border: none;
+ background-color: #6aa034;
+ color: white;
+ font-size: 12px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ position: relative;
+ display: block;
+ margin: 0 auto 10px;
+}
+
+.my_custom_card .foo:hover {
+ background-color: #5d8d2e;
+}
+
+.my_custom_card .foo:active {
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.my_custom_card .foo img {
+ position: absolute;
+ padding: 3px 3px 3px 8px;
+ border-left: 1px solid #527B28;
+ right: 12px;
+ top: 3px;
+}
+
+.my_custom_card .compare_add_but_d {
+ color: #6aa034;
+ font-size: 12px;
+ text-decoration: none;
+}
+
+.my_custom_card .compare_add_but_d span {
+ border-bottom: 1px dotted #6aa034;
+ padding-left: 10px;
+}
+
+.my_custom_card .compare_add_but_d span:hover {
+ color: #517a27;
+}
+
+.my_custom_card img {
+ position: relative;
+ top: 4px;
+ right: 1px;
+}
+
+ul {
+ list-style: none;
+}
+
+h1.with_this {
+ margin-bottom: 21px;
+}
+
+hr {
+ margin-bottom: 30px;
+ margin-top: 30px;
+ color: #C6C7C9;
+ border: none;
+ background-color: #C6C7C9;
+ height: 1px !important;
+ margin-right: -10px;
+ margin-left: -10px;
+}
+
+.tabs_item_name {
+ font-weight: bold;
+ padding-bottom: 15px;
+ display: block;
+}
+
+.open_card_item_title {
+ color: #333333;
+ font-size: 30px;
+ padding-bottom: 42px;
+ font-weight: bold;
+ margin: 0px;
+}
+
+.item_3_blocks_wrap {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.item_3_blocks_wrap .item_img_block {
+ width: 320px;
+ position: relative;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img {
+ text-align: center;
+ border: 1px solid #C6C7C9;
+ height: 317px;
+ width: 318px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img img {
+ height: 100%;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .new {
+ background: #00adf0;
+ font-size: 10px;
+ padding: 1px 5px 0px 5px;
+ position: absolute;
+ left: 0;
+ top: 15px;
+ color: white;
+ line-height: 17px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .new:after {
+ content: "";
+ border-width: 0px 0px 18px 17px;
+ border-style: solid;
+ border-color: black green transparent #00ADF0;
+ position: absolute;
+ bottom: 0px;
+ right: -17px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .top {
+ background: #ffde00;
+ font-size: 10px;
+ padding: 1px 5px 0px 5px;
+ position: absolute;
+ line-height: 17px;
+ left: 0;
+ top: 38px;
+ color: black;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img .top:after {
+ content: "";
+ border-width: 0px 0px 18px 17px;
+ border-style: solid;
+ border-color: black green transparent #ffde00;
+ position: absolute;
+ bottom: 0px;
+ right: -17px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide {
+ position: relative;
+ margin-top: 20px;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-justify-content: space-around;
+ -ms-flex-pack: distribute;
+ justify-content: space-around;
+ -webkit-box-align: center;
+ -webkit-align-items: center;
+ -ms-flex-align: center;
+ align-items: center;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block {
+ width: 80px;
+ height: 77px;
+ border: 1px solid #C6C7C9;
+ display: inline-block;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block img {
+ width: 96%;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block:first-child {
+ margin-left: 10px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .small_img_block:nth-child(3) {
+ margin-right: 10px;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .active {
+ border: 2px solid #C6C7C9;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .slider_arrow_right {
+ position: absolute;
+ right: 0;
+ top: 39%;
+}
+
+.item_3_blocks_wrap .item_img_block .main_img_slide .slider_arrow_left {
+ position: absolute;
+ left: 0;
+ top: 39%;
+}
+
+.item_3_blocks_wrap .busket_block {
+ position: relative;
+ width: 295px;
+}
+
+.item_3_blocks_wrap .busket_block .grey_bg {
+ background-color: #f4f4f4;
+ padding: 27px 0 20px;
+ margin-top: 20px;
+}
+
+.item_3_blocks_wrap .busket_block .top_code .code {
+ background: #ffde00;
+ color: black;
+ font-size: 12px;
+ color: #333333;
+ font-weight: bold;
+ padding: 4px 12px;
+ display: inline-block;
+}
+
+.item_3_blocks_wrap .busket_block .top_code .have {
+ font-size: 12px;
+ color: #333333;
+ font-weight: bold;
+ padding: 4px 19px 7px;
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+.item_3_blocks_wrap .busket_block .top_code .have img {
+ position: absolute;
+ right: 100px;
+ left: -5px;
+}
+
+.item_3_blocks_wrap .busket_block .counter {
+ text-align: center;
+}
+
+.item_3_blocks_wrap .busket_block .counter .price {
+ color: #333333;
+ font-size: 28px;
+ font-weight: bold;
+ display: inline-block;
+ padding-left: 20px;
+ padding-top: 8px;
+ padding-bottom: 11px;
+}
+
+.item_3_blocks_wrap .busket_block .counter .sign {
+ font-size: 15px;
+ color: #333333;
+ font-weight: bold;
+ display: inline-block;
+ margin-right: 15px;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block {
+ display: inline-block;
+ position: relative;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 6px 13px 6px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 6px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.item_3_blocks_wrap .busket_block .counter .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn {
+ text-align: center;
+ padding-top: 16px;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a {
+ color: white;
+ text-decoration: none;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn {
+ background: #6aa034;
+ border: none;
+ padding: 10px 55px 10px 15px;
+ font-size: 16px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ position: relative;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn:hover {
+ background: #5d8d2e;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn:active {
+ position: relative;
+ top: 2px;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.item_3_blocks_wrap .busket_block .in_cart_btn a .cart_btn img {
+ position: absolute;
+ padding: 7px 7px 7px 9px;
+ right: 7px;
+ width: 18px;
+ border-left: 1px solid #5d8d2e;
+ bottom: 2px;
+}
+
+.item_3_blocks_wrap .busket_block .to_compare_link {
+ text-align: center;
+ margin-top: 18px;
+}
+
+.item_3_blocks_wrap .busket_block .to_compare_link .add_to_compare {
+ border-bottom: 1px solid #6aa034;
+ border-style: dotted;
+ text-decoration: none;
+ border-top: none;
+ border-left: none;
+ border-right: none;
+ font-size: 12px;
+}
+
+.item_3_blocks_wrap .busket_block .to_compare_link img {
+ position: relative;
+ top: 3px;
+ width: 19px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order {
+ margin-top: 16px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form .text {
+ font-size: 12px;
+ color: #333333;
+ font-weight: bold;
+ padding-right: 3px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form .quick_order_phone {
+ font-size: 12px;
+ color: #333333;
+ padding: 9px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ width: 100px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form placeholder {
+ color: #C6C7C9;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form button {
+ border: none;
+ font-size: 12px;
+ color: white;
+ padding: 7px 8px 6px 10px;
+ background: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ -webkit-border-top-right-radius: 2px;
+ border-top-right-radius: 2px;
+ -webkit-border-bottom-right-radius: 2px;
+ border-bottom-right-radius: 2px;
+ position: absolute;
+ right: 1px;
+}
+
+.item_3_blocks_wrap .busket_block .quick_order form button:hover {
+ background: #5d8d2e;
+}
+
+.item_3_blocks_wrap .busket_block .delivery {
+ font-size: 13px;
+ color: #333333;
+ margin-top: 27px;
+}
+
+.item_3_blocks_wrap .busket_block .delivery a {
+ text-decoration: underline;
+}
+
+.character_block {
+ width: 265px;
+ color: #333333;
+}
+
+.character_block h3 {
+ line-height: 16px;
+}
+
+.character_block .each {
+ border-bottom: 1px solid #C6C7C9;
+ border-style: dotted;
+ border-top: none;
+ border-left: none;
+ border-right: none;
+ font-size: 13px;
+ margin-top: 2px;
+}
+
+.character_block .title {
+ display: inline-block;
+ background: white;
+ position: relative;
+ top: 4px;
+ color: #898b8e;
+}
+
+.character_block .tech {
+ display: inline-block;
+ background: white;
+ float: right;
+ position: relative;
+ top: 4px;
+}
+
+.character_block .tech_links {
+ margin-top: 20px;
+}
+
+.character_block .tech_links a {
+ text-decoration: none;
+ border-bottom: 1px solid #6aa034;
+ border-style: dashed;
+ border-left: none;
+ border-right: none;
+ border-top: none;
+ font-size: 18px;
+ margin-top: 6px;
+ margin-right: 100px;
+ display: inline-block;
+}
+
+.flex_container {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+.tabs_block {
+ color: #333333;
+}
+
+.watched_block {
+ margin-bottom: 45px;
+}
+
+.watched_block h1 {
+ font-size: 30px;
+ color: #333333;
+ margin-bottom: 18px;
+}
+
+.just_test_tracs {
+ -webkit-transition: all 02s easy;
+ transition: all 02s easy;
+ -webkit-transform: rotate(7deg);
+ -ms-transform: rotate(7deg);
+ transform: rotate(7deg);
+}
+/* светлый зеленый цвет, текст и кнопки */
+
+/* средний серый цвет, текст и кнопки */
+
+/* светлый серый цвет, рамки и линии */
+
+/* темный серый цвет, большие названия, цифры */
+
+.main_cont_wrap {
+ width: 940px;
+ margin: auto;
+ padding: 0px 10px;
+ color: #333333;
+ line-height: 19px;
+}
+
+.main_cont_wrap .services_title {
+ font-size: 30px;
+ padding-top: 0px;
+ padding-bottom: 26px;
+ font-weight: bold;
+ margin: 0px;
+}
+
+.main_cont_wrap .services_title_servis {
+ font-size: 30px;
+ padding-top: 0px;
+ padding-bottom: 39px;
+ font-weight: bold;
+ margin: 0px;
+}
+
+.main_cont_wrap .services_block {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+}
+
+.main_cont_wrap .services_block .services_each {
+ width: 215px;
+ padding: 0 10px;
+ text-align: center;
+ display: inline-block;
+ margin-bottom: 45px;
+}
+
+.main_cont_wrap .services_block .services_each .name {
+ font-size: 18px;
+ font-weight: bold;
+ padding: 20px 0px;
+ display: block;
+ padding-bottom: 16px;
+}
+
+.main_cont_wrap .services_block .services_each img {
+ display: block;
+ height: 65px;
+ margin: auto;
+}
+
+.main_cont_wrap .services_block .services_each p {
+ font-size: 13px;
+ line-height: 16px;
+}
+
+.delivery_block {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ padding-bottom: 362px;
+ padding-top: 11px;
+}
+
+.delivery_each_block {
+ font-size: 13px;
+ width: 450px;
+ line-height: 16px;
+}
+
+.delivery_each_block img {
+ display: block;
+ width: 290px;
+ margin: auto;
+}
+
+.delivery_each_block .name {
+ font-weight: bold;
+ padding: 27px 0 18px;
+ display: block;
+ text-align: center;
+ font-size: 15px;
+}
+
+.delivery_each_block .address {
+ font-size: 16px;
+ font-weight: bold;
+ display: block;
+ padding-bottom: 20px;
+}
+
+.contact_page_phones {
+ font-size: 16px;
+ font-weight: bold;
+ padding-bottom: 15px;
+}
+
+.align_items_bottom {
+ -webkit-box-align: end;
+ -webkit-align-items: flex-end;
+ -ms-flex-align: end;
+ align-items: flex-end;
+}
+
+.manufacturers_block {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ margin-bottom: 40px;
+ margin-top: 13px;
+}
+
+.manufacturers_block a {
+ width: 172px;
+ height: 100px;
+ overflow: hidden;
+ margin-bottom: 20px;
+ display: inline-block;
+}
+
+.payment_icon_1 {
+ display: inline-block;
+ background-image: url("../images/payment01.png");
+ background-repeat: no-repeat;
+ width: 90px;
+ height: 40px;
+ float: left;
+ background-position: 26px 5px;
+}
+
+.payment_icon_2 {
+ display: inline-block;
+ background-image: url("../images/payment01.png");
+ background-repeat: no-repeat;
+ width: 90px;
+ height: 40px;
+ float: left;
+ background-position: 26px -32px;
+}
+
+.payment_01 {
+ margin: 21px 2px;
+ display: block;
+}
+
+span.bold {
+ font-weight: bold;
+}
+
+span.red {
+ color: red;
+}
+
+.font_size_13 {
+ font-size: 13px;
+}
+
+.padding_450 {
+ padding-bottom: 450px;
+}
+
+.basket_main_title {
+ margin-top: 0;
+ font-weight: bold;
+ font-size: 30px;
+ margin-bottom: 29px;
+}
+
+.privet_info_block h3 {
+ font-size: 18px;
+ font-weight: bold;
+ padding-bottom: 16px;
+}
+
+.privet_info_block label {
+ font-size: 13px;
+ font-weight: bold;
+}
+
+.privet_info_block span.placehold {
+ font-size: 12px;
+ color: #898b8e;
+ font-weight: normal;
+}
+
+.privet_info_block input {
+ padding: 7px 5px 9px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ margin: 0 12px 0 8px;
+ width: 256px;
+}
+
+.privet_info_block .padding_cust {
+ padding: 0px 0px 8px 14px;
+}
+
+.privet_info_block .padding_cust:nth-child(3) {
+ padding-left: 17px;
+}
+
+.privet_info_block .padding_cust:nth-child(4) {
+ padding-left: 1px;
+}
+
+.separator {
+ width: 960px;
+ height: 1px;
+ border-bottom: 1px solid #C6C7C9;
+ margin: 11px 0 27px;
+}
+
+.delivery_radio h3 {
+ padding-bottom: 12px;
+}
+
+.delivery_radio p {
+ display: inline-block;
+ font-size: 13px;
+}
+
+.delivery_radio .padding_cust {
+ padding-bottom: 6px;
+}
+
+.delivery_radio span.placehold {
+ color: #898b8e;
+ display: block;
+ font-size: 13px;
+ padding-left: 23px;
+ position: relative;
+ bottom: 4px;
+}
+
+.basket_pay_block h3 {
+ padding-bottom: 12px;
+}
+
+.basket_pay_block p {
+ display: inline-block;
+ font-size: 13px;
+}
+
+.basket_pay_block .padding_cust {
+ padding-bottom: 6px;
+ position: relative;
+}
+
+.basket_pay_block span.placehold {
+ color: #898b8e;
+ display: block;
+ font-size: 13px;
+ padding-left: 23px;
+ position: relative;
+ bottom: 4px;
+}
+
+.basket_pay_block input[type="text"] {
+ margin-left: 8px;
+ height: 17px;
+ top: -11px;
+ position: absolute;
+ left: 315px;
+ height: 22px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ border: 1px solid #C6C7C9;
+ width: 89px;
+ padding: 5px;
+}
+
+.separator_02 {
+ width: 960px;
+ height: 1px;
+ border-bottom: 1px solid #C6C7C9;
+ margin: 3px 0 27px;
+}
+
+.for_margin {
+ text-align: center;
+ margin: 27px 0 84px;
+}
+
+.order_01_btn {
+ font-size: 13px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ background-color: #6aa034;
+ padding: 6px 22px;
+ color: white;
+}
+
+.order_01_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.order_01_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.order_list {
+ width: 595px;
+}
+
+.order_list .active {
+ background-color: #e0e1e2;
+}
+
+.order_list h3 {
+ margin-bottom: 6px;
+}
+
+.order_list hr {
+ margin-top: 0px;
+ margin-right: 0;
+ margin-left: 0;
+ margin-bottom: 16px;
+}
+
+.order_list hr:nth-child(5) {
+ margin-top: 15px;
+ width: 930px;
+ margin-left: -10px;
+}
+
+.order_list .all_price p {
+ font-size: 15px;
+ display: inline-block;
+}
+
+.order_list .all_price p:nth-child(1) {
+ padding-left: 19px;
+ padding-right: 150px;
+}
+
+.order_list .all_price p:nth-child(2) {
+ padding-right: 20px;
+}
+
+.order_list .all_price .all_price {
+ font-size: 20px;
+ font-weight: bold;
+}
+
+.order_list_li {
+ padding: 10px 20px;
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+}
+
+.order_list_li .little_img {
+ height: 78px;
+ width: 78px;
+ border: 1px solid #C6C7C9;
+ overflow: hidden;
+ display: inline-block;
+ margin-right: 14px;
+ float: left;
+}
+
+.order_list_li .little_img img {
+ height: 100%;
+}
+
+.order_list_li .name_and_code {
+ display: inline-block;
+ float: left;
+}
+
+.order_list_li .name_and_code .name {
+ display: block;
+ color: #6aa034;
+ font-size: 15px;
+ width: 175px;
+ margin-bottom: 7px;
+ position: relative;
+ line-height: 18px;
+ top: -3px;
+}
+
+.order_list_li .name_and_code .code {
+ display: block;
+ font-size: 12px;
+}
+
+.order_list_li .how_many {
+ display: inline-block;
+ padding: 32px 20px 0px 85px;
+ font-weight: bold;
+}
+
+.order_list_li .price {
+ display: inline-block;
+ padding-left: 44px;
+ font-weight: bold;
+ font-size: 18px;
+ padding-top: 31px;
+ padding-left: 48px;
+}
+
+.order_list_li .price .price_text {
+ font-size: 15px;
+ font-weight: normal;
+}
+
+.basket_step_2_delivery h3 {
+ font-size: 18px;
+ font-weight: bold;
+ margin-top: 28px;
+ margin-bottom: 12px;
+}
+
+.basket_step_2_delivery h4 {
+ font-size: 18px;
+ font-weight: bold;
+ margin-top: 24px;
+ margin-bottom: 12px;
+}
+
+.basket_step_2_delivery .detail {
+ font-size: 13px;
+ margin-bottom: 7px;
+}
+
+.basket_step_2_delivery .detail .grey {
+ color: #898b8e;
+ display: inline-block;
+ width: 69px;
+}
+
+.for_margin_2 {
+ text-align: center;
+ margin: 34px 0 42px;
+}
+
+.cabinet_main_title {
+ margin-top: 0;
+ font-weight: bold;
+ font-size: 30px;
+ margin-bottom: 38px;
+}
+
+.cabinet_wrap {
+ position: relative;
+ margin-bottom: 282px;
+}
+
+.cabinet_wrap span.grey {
+ color: #898b8e;
+}
+
+.cabinet_wrap .cab_01 {
+ padding-bottom: 24px;
+}
+
+.cabinet_wrap .block_01 {
+ display: inline-block;
+ width: 233px;
+}
+
+.cabinet_wrap .block_02 {
+ display: inline-block;
+ width: 79px;
+}
+
+.cabinet_wrap .block_03 {
+ display: inline-block;
+ width: auto;
+}
+
+.cabinet_wrap .block_04 {
+ display: inline-block;
+ padding-left: 60px;
+ border-left: 1px solid #C6C7C9;
+ position: relative;
+ vertical-align: top;
+ margin-left: 20px;
+}
+
+.cabinet_wrap .block_04 .link {
+ padding-top: 21px;
+ padding-bottom: 20px;
+ font-size: 13px;
+}
+
+.cabinet_wrap .block_04 .link .dotted {
+ border-bottom: 1px dotted #6aa034;
+}
+
+.cabinet_wrap .block_04 .link a {
+ text-decoration: none;
+}
+
+.cabinet_wrap .block_04 .link:nth-child(2) {
+ padding-top: 4px;
+ font-size: 13px;
+ padding-bottom: 20px;
+}
+
+.cabinet_wrap .block_04 .link:nth-child(2) a {
+ border-bottom: none;
+ text-decoration: none;
+}
+
+/*=============================================== MODAL WINDOWS ================================================*/
+
+/* registration window */
+
+/* стили модального окна*/
+
+/* стили основного модального окна */
+
+.modal_close_btn {
+ position: absolute;
+ right: -42px;
+ top: -59px;
+ cursor: pointer;
+ width: 100px;
+ height: 120px;
+ overflow: hidden;
+ background-image: url("../images/modal_close_btn.png");
+ background-repeat: no-repeat;
+ background-position: -143px 0;
+}
+
+.modal_close_btn:hover {
+ background-position: 0 0;
+}
+
+.modal_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 2;
+ top: 0;
+ left: 0;
+}
+
+.modal_wrapper_reg {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.modal_wrapper_reg .modal_window {
+ text-align: right;
+ height: 428px;
+ width: 560px;
+ background-color: #fff;
+ padding: 20px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ position: relative;
+ margin-left: auto;
+ margin-right: auto;
+ margin-top:35px;
+ z-index:5;
+}
+
+.modal_wrapper_reg .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.modal_wrapper_reg .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.modal_wrapper_reg .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.modal_wrapper_reg .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.modal_wrapper_reg .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.modal_wrapper_reg .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 30px;
+ padding-bottom: 26px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.modal_wrapper_reg .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 500px;
+ margin: auto;
+ margin-bottom: 8px;
+}
+
+.modal_wrapper_reg .modal_window label:last-of-type {
+ position: relative;
+}
+
+.modal_wrapper_reg .modal_window label:last-of-type input {
+ width: 119px;
+ margin-left: 140px;
+}
+
+.modal_wrapper_reg .modal_window label:last-of-type img {
+ position: absolute;
+ top: 4px;
+ left: 176px;
+}
+
+.modal_wrapper_reg .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 30px;
+}
+
+/* login window */
+
+.modal_wrapper_login {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.modal_wrapper_login .modal_window {
+ text-align: right;
+ height: 247px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-left:auto;
+ margin-right:auto;
+ margin-top: 35px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ z-index:999;
+}
+
+.modal_wrapper_login .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.modal_wrapper_login .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.modal_wrapper_login .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.modal_wrapper_login .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.modal_wrapper_login .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.modal_wrapper_login .modal_window .title {
+ padding-right: 8px;
+}
+
+.modal_wrapper_login .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 459px;
+ margin: auto;
+ margin-bottom: 8px;
+}
+
+.modal_wrapper_login .modal_window label input {
+ margin-right: 68px;
+}
+
+.modal_wrapper_login .modal_window .pass_links {
+ text-align: center;
+ padding-left: 55px;
+ font-size: 13px;
+ margin-top: 11px;
+}
+
+.modal_wrapper_login .modal_window .pass_links a {
+ padding-left: 47px;
+}
+
+.modal_wrapper_login .modal_window .pass_links label {
+ display: inline;
+}
+
+.modal_wrapper_login .modal_window .pass_links .remember_pas {
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.modal_wrapper_login .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.modal_wrapper_login .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 38px;
+}
+
+/* login window */
+
+.consultation_modal {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.consultation_modal .modal_window {
+ text-align: right;
+ height: 247px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-left:auto;
+ margin-right:auto;
+ margin-top: 35px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ z-index:999;
+}
+
+.consultation_modal .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.consultation_modal .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.consultation_modal .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.consultation_modal .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.consultation_modal .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.consultation_modal .modal_window .title {
+ padding-right: 8px;
+}
+
+.consultation_modal .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 459px;
+ margin: auto;
+ margin-bottom: 8px;
+}
+
+.consultation_modal .modal_window label input {
+ margin-right: 68px;
+}
+
+.consultation_modal .modal_window .pass_links {
+ text-align: center;
+ padding-left: 55px;
+ font-size: 13px;
+ margin-top: 11px;
+}
+
+.consultation_modal .modal_window .pass_links a {
+ padding-left: 47px;
+}
+
+.consultation_modal .modal_window .pass_links label {
+ display: inline;
+}
+
+.consultation_modal .modal_window .pass_links .remember_pas {
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.consultation_modal .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.consultation_modal .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 38px;
+}
+
+/* forgot password window */
+
+.forgot_pass_modal_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 4;
+ top: 0;
+ left: 0;
+ display: none;
+}
+
+.forgot_pass_modal_wrapper .modal_window {
+ text-align: right;
+ height: 252px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-top: 35px;
+ margin-left:auto;
+ margin-right:auto;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+ z-index:5;
+}
+
+.forgot_pass_modal_wrapper .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.forgot_pass_modal_wrapper .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.forgot_pass_modal_wrapper .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.forgot_pass_modal_wrapper .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .title {
+ padding-right: 0px;
+ padding-top: 30px;
+ padding-bottom: 23px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .text {
+ color: #898b8e;
+ font-size: 13px;
+ text-align: left;
+ margin-bottom: 28px;
+}
+
+.forgot_pass_modal_wrapper .modal_window label {
+ display: block;
+ font-size: 13px;
+ width: 459px;
+ margin: auto;
+ margin-bottom: 30px;
+}
+
+.forgot_pass_modal_wrapper .modal_window label input {
+ margin-right: 52px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links {
+ text-align: center;
+ padding-left: 55px;
+ font-size: 13px;
+ margin-top: 11px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links a {
+ padding-left: 47px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links label {
+ display: inline;
+}
+
+.forgot_pass_modal_wrapper .modal_window .pass_links .remember_pas {
+ color: #6aa034;
+ text-decoration: underline;
+}
+
+.forgot_pass_modal_wrapper .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.forgot_pass_modal_wrapper .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 28px;
+}
+
+/* forgot password success window */
+
+.forgot_pass_success_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 2;
+ top: 0;
+ left: 0;
+ display: none;
+ z-index:4;
+}
+
+.forgot_pass_success_wrapper .modal_window {
+ text-align: right;
+ height: 158px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-top: 35px;
+ margin-left:auto;
+ margin-right:auto;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+}
+
+.forgot_pass_success_wrapper .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.forgot_pass_success_wrapper .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.forgot_pass_success_wrapper .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.forgot_pass_success_wrapper .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.forgot_pass_success_wrapper .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.forgot_pass_success_wrapper .modal_window .title {
+ padding-right: 0px;
+ padding-top: 30px;
+ padding-bottom: 23px;
+}
+
+.forgot_pass_success_wrapper .modal_window .text {
+ color: #898b8e;
+ font-size: 13px;
+ text-align: center;
+ margin-bottom: 27px;
+}
+
+.forgot_pass_success_wrapper .modal_window .for_btn_position {
+ text-align: center;
+ margin-top: 23px;
+}
+
+.forgot_pass_success_wrapper .modal_window .for_btn_position .my_cust_btn {
+ padding: 8px 22px;
+}
+/* callback window */
+
+.callback_wrapper {
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ z-index: 2;
+ top: 0;
+ left: 0;
+ display: none;
+ z-index:5;
+}
+
+.callback_wrapper .modal_window {
+ text-align: right;
+ height: 158px;
+ width: 459px;
+ background-color: #fff;
+ padding: 20px;
+ position: relative;
+ margin-top: 35px;
+ margin-left:auto;
+ margin-right:auto;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ overflow: hidden;
+}
+
+.callback_wrapper .modal_window .title {
+ font-size: 18px;
+ font-weight: bold;
+ padding-top: 29px;
+ padding-bottom: 27px;
+ text-transform: uppercase;
+ text-align: center;
+}
+
+.callback_wrapper .modal_window input {
+ padding: 8px;
+ width: 251px;
+ margin-right: 56px;
+ margin-left: 11px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+.callback_wrapper .modal_window .my_cust_btn {
+ font-size: 13px;
+ padding: 8px 31px;
+ color: white;
+ border: none;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background-color: #6aa034;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.callback_wrapper .modal_window .my_cust_btn:hover {
+ background-color: #5d8d2e;
+}
+
+.callback_wrapper .modal_window .my_cust_btn:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.callback_wrapper .modal_window .title {
+ padding-right: 0px;
+ padding-top: 32px;
+ padding-bottom: 25px;
+ font-size: 28px;
+}
+
+.callback_wrapper .modal_window .text {
+ color: #333333;
+ font-size: 16px;
+ text-align: center;
+ margin-bottom: 27px;
+}
+/* BUSKET MODAL WINDOW */
+
+/*==================== BUSKET MODAL BASIC */
+
+.busket_modal_basic {
+ display: inline-block;
+ background: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.busket_modal_basic .order_list {
+ width: auto;
+ padding: 25px;
+}
+
+.busket_modal_basic .order_list ul {
+ max-height: 350px;
+ overflow-y: overlay;
+ overflow-x: hidden;
+}
+
+.busket_modal_basic .order_list h3 {
+ text-transform: uppercase;
+ font-weight: normal;
+ font-size: 20px;
+ padding: 20px 0 15px;
+}
+
+.busket_modal_basic .order_list .order_list_li {
+ display: block;
+}
+
+.busket_modal_basic .order_list .order_list_li .little_img {
+ float: none;
+}
+
+.busket_modal_basic .order_list .order_list_li .name_and_code {
+ text-align: left;
+ float: none;
+}
+
+.busket_modal_basic .order_list .order_list_li .name_and_code .name {
+ margin-bottom: 14px;
+}
+
+.busket_modal_basic .order_list .order_list_li .price {
+ padding: 0;
+}
+
+.busket_modal_basic .order_list .order_list_li .count_block_wrap {
+ display: inline-block;
+ vertical-align: top;
+ text-align: right;
+}
+
+.busket_modal_basic .order_list .count_block {
+ display: block;
+ position: relative;
+ margin-bottom: 30px;
+}
+
+.busket_modal_basic .order_list .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 3px 13px 3px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 6px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ text-align: center;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.busket_modal_basic .order_list .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn {
+ margin-top: 20px;
+ text-align: center;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn a {
+ display: inline-block;
+ font-size: 13px;
+ margin-right: 97px;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn button {
+ display: inline-block;
+ padding: 10px 20px;
+ color: white;
+ background-color: #6aa034;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ font-size: 13px;
+ font-weight: normal;
+ -webkit-box-shadow: 0px 2px 0px #517a27;
+ box-shadow: 0px 2px 0px #517a27;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn button:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.busket_modal_basic .order_list .busket_bottom_btn button:hover {
+ background-color: #5d8d2e;
+}
+
+.busket_modal_basic .order_list .delete_item_btn {
+ display: inline-block;
+ vertical-align: top;
+ margin-top: 30px;
+ padding: 0 10px 0 0;
+ cursor: pointer;
+ color: #C6C7C9;
+ font-size: 20px;
+}
+
+.busket_modal_basic .order_list .delete_item_btn:hover {
+ color: red;
+}
+
+/*==================== BUSKET MODAL 1 */
+
+.busket_modal_wrapper {
+ display: none;
+ color: #333333;
+ width: 100%;
+ background: rgba(0, 0, 0, 0.4);
+ position: fixed;
+ z-index: 4;
+ top: 0;
+ left: 0;
+}
+
+.busket_modal_wrapper .m_a {
+ display: block;
+ text-align: center;
+ position: relative;
+ margin-top: 35px;
+}
+
+.busket_modal_wrapper .busket_modal_01 {
+ display: inline-block;
+ background: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list {
+ width: auto;
+ padding: 25px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list ul {
+ max-height: 350px;
+ overflow-y: overlay;
+ overflow-x: hidden;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list h3 {
+ text-transform: uppercase;
+ font-weight: normal;
+ font-size: 20px;
+ padding: 20px 0 15px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li {
+ display: block;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .little_img {
+ float: none;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .name_and_code {
+ text-align: left;
+ float: none;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .name_and_code .name {
+ margin-bottom: 14px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .price {
+ padding: 0;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .order_list_li .count_block_wrap {
+ display: inline-block;
+ vertical-align: top;
+ text-align: right;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block {
+ display: block;
+ position: relative;
+ margin-bottom: 30px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 3px 13px 3px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons {
+ position: relative;
+ right: 16px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ text-align: center;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn {
+ margin-top: 20px;
+ text-align: center;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn a {
+ display: inline-block;
+ font-size: 13px;
+ margin-right: 97px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn button {
+ display: inline-block;
+ padding: 10px 20px;
+ color: white;
+ background-color: #6aa034;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ font-size: 13px;
+ font-weight: normal;
+ -webkit-box-shadow: 0px 2px 0px #517a27;
+ box-shadow: 0px 2px 0px #517a27;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn button:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .busket_bottom_btn button:hover {
+ background-color: #5d8d2e;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .delete_item_btn {
+ display: inline-block;
+ vertical-align: top;
+ margin-top: 30px;
+ padding: 0 10px 0 0;
+ cursor: pointer;
+ color: #C6C7C9;
+ font-size: 20px;
+}
+
+.busket_modal_wrapper .busket_modal_01 .order_list .delete_item_btn:hover {
+ color: red;
+}
+
+/*==================== BUSKET MODAL 2 */
+
+.busket_modal_header {
+ display: inline-block;
+ position: absolute;
+ top: 91px;
+ right: 0px;
+ border: 1px solid #898b8e;
+ z-index: 2;
+ display: none;
+ background-color: #fff;
+}
+
+.busket_modal_header .busket_modal_02 {
+ display: inline-block;
+ background: white;
+ position: relative;
+ overflow: hidden;
+}
+
+.busket_modal_header .busket_modal_02 .order_list {
+ width: auto;
+ padding: 25px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list ul {
+ max-height: 350px;
+ overflow-y: overlay;
+ overflow-x: hidden;
+}
+
+.busket_modal_header .busket_modal_02 .order_list h3 {
+ text-transform: uppercase;
+ font-weight: normal;
+ font-size: 20px;
+ padding: 20px 0 15px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li {
+ display: block;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .little_img {
+ float: none;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .name_and_code {
+ text-align: left;
+ float: none;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .name_and_code .name {
+ margin-bottom: 14px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .price {
+ padding: 0;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .order_list_li .count_block_wrap {
+ display: inline-block;
+ vertical-align: top;
+ text-align: right;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block {
+ display: block;
+ position: relative;
+ margin-bottom: 30px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_number {
+ display: inline-block;
+ font-size: 22px;
+ padding: 3px 13px 3px;
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ position: relative;
+ /*top: -2px;*/
+ background-color: #fff;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons {
+ position: relative;
+ /*top: 4px;*/
+ right: 6px;
+ display: inline-block;
+ vertical-align: bottom;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_plus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ border-bottom: 1px solid #707274;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+ font-size: 15px;
+ line-height: 15px;
+ padding: 0 7px;
+ cursor: pointer;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_plus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_minus {
+ background-color: #898b8e;
+ color: white;
+ font-weight: bold;
+ line-height: 16px;
+ text-align: center;
+ border-top: 1px solid #A2A2A2;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ cursor: pointer;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .count_block .count_buttons .button_minus:hover {
+ background-color: #7c7e81;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn {
+ margin-top: 20px;
+ text-align: center;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn a {
+ display: inline-block;
+ font-size: 13px;
+ margin-right: 130px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn button {
+ display: inline-block;
+ padding: 10px 20px;
+ color: white;
+ background-color: #6aa034;
+ border: none;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ font-size: 13px;
+ font-weight: normal;
+ -webkit-box-shadow: 0px 2px 0px #517a27;
+ box-shadow: 0px 2px 0px #517a27;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn button:active {
+ position: relative;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ top: 2px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .busket_bottom_btn button:hover {
+ background-color: #5d8d2e;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .delete_item_btn {
+ display: inline-block;
+ vertical-align: top;
+ margin-top: 30px;
+ padding: 0 10px 0 0;
+ cursor: pointer;
+ color: #C6C7C9;
+ font-size: 20px;
+}
+
+.busket_modal_header .busket_modal_02 .order_list .delete_item_btn:hover {
+ color: red;
+}
+
+/*=============================================== CATEGORY PAGE ================================================*/
+
+.category_page_main_title {
+ margin-top: 0;
+ margin-bottom: 41px;
+ font-weight: bold;
+}
+
+.category_wrap {
+ margin-bottom: 18px;
+}
+
+.category_wrap .category_wrap_3_colum {
+ width: 300px;
+ display: inline-block;
+ vertical-align: top;
+ margin-right: 15px;
+}
+
+.category_wrap .category_wrap_3_colum:last-of-type {
+ margin-right: 0px;
+}
+
+.category_wrap .wrap {
+ margin-bottom: 16px;
+}
+
+.category_wrap .wrap a {
+ text-decoration: none;
+}
+
+.category_wrap .wrap .cat_li_cont {
+ border: 1px solid #C6C7C9;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+ width: 298px;
+ height: 78px;
+ display: inline-block;
+ position: relative;
+}
+
+.category_wrap .wrap .cat_li_cont img {
+ padding-top: 9px;
+ padding-left: 7px;
+ float: left;
+ padding-right: 20px;
+}
+
+.category_wrap .wrap .cat_li_cont .desc {
+ font-size: 15px;
+ width: 150px;
+ color: #333333;
+ margin-left: 87px;
+ height: 78px;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+.category_wrap .wrap .cat_li_cont .arrow {
+ background-image: url("../images/category/green_arrows.png");
+ width: 20px;
+ height: 10px;
+ background-repeat: no-repeat;
+ display: block;
+ position: absolute;
+ right: 15px;
+ top: 35px;
+ background-position: 0px 0px;
+}
+
+.category_wrap .wrap .cat_li_sub_ul {
+ padding: 18px 2px 13px 18px;
+ font-size: 13px;
+ line-height: 20px;
+ border: 1px solid #C6C7C9;
+ width: 278px;
+ background-color: white;
+ position: relative;
+ top: -6px;
+ border-top: none;
+ display: none;
+}
+
+/*=============================================== 404 PAGE ================================================*/
+
+.wrap_for_404 {
+ min-height: 670px;
+}
+
+.wrap_for_404 .main_title_404 {
+ font-size: 30px;
+ margin-top: 0;
+ margin-bottom: 30px;
+ font-weight: bold;
+}
+
+.wrap_for_404 .main_img_404 {
+ float: left;
+ position: relative;
+ right: 10px;
+ padding: 27px 21px 10px 0px;
+}
+
+.wrap_for_404 .block_404 .first {
+ font-size: 16px;
+ margin-top: 103px;
+ line-height: 20px;
+}
+
+.wrap_for_404 .block_404 .second {
+ font-size: 13px;
+ margin-top: 60px;
+ line-height: 15px;
+ color: #898b8e;
+}
+
+.wrap_for_404 .block_404 button {
+ padding: 7px 21px;
+ background-color: #6aa034;
+ margin-top: 47px;
+ margin-left: 151px;
+ border: none;
+ font-size: 13px;
+ color: white;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ -webkit-box-shadow: 0 2px #517a27;
+ box-shadow: 0 2px #517a27;
+}
+
+.wrap_for_404 .block_404 button:hover {
+ background-color: #5d8d2e;
+}
+
+.wrap_for_404 .block_404 button:active {
+ position: relative;
+ top: 2px;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.test_flex_example {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+}
+
+/*=============================================== ZAGLUSHKA PAGE ================================================*/
+
+.zaglushka_logo_img {
+ width: 230px;
+ margin: 80px auto 27px;
+}
+
+.zaglushka_main_img {
+ width: 880px;
+ position: relative;
+ left: -6px;
+}
+
+.zaglushka_text {
+ text-align: center;
+ font-weight: bold;
+ padding-top: 44px;
+ position: relative;
+ right: 4px;
+ padding-bottom: 130px;
+}
+
+.zaglushka_text h2 {
+ color: #6aa034;
+ font-size: 20px;
+ letter-spacing: 1px;
+}
+
+.zaglushka_text p {
+ font-size: 16px;
+ padding-bottom: 22px;
+}
+
+.zaglushka_text .zaglushka_separate_line {
+ height: 1px;
+ background: #C6C7C9;
+ width: 508px;
+ margin: 13px auto 17px;
+}
+
+/*=============================================== VALIDATION ================================================*/
+
+.reg_form label.error {
+ margin-left: 180px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
+
+.modal_wrapper_login .modal_window label.error {
+ margin-left: 127px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
+
+.consultation_modal .modal_window label.error {
+ margin-left: 127px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
+
+.forgot_password_form label.error {
+ margin-left: 141px;
+ width: 265px;
+ text-align: left;
+ color: #D75C5C;
+}
\ No newline at end of file
diff --git a/frontend/web/css/fonts.css b/frontend/web/css/fonts.css
new file mode 100644
index 0000000..3f4dd12
--- /dev/null
+++ b/frontend/web/css/fonts.css
@@ -0,0 +1,253 @@
+/* font-family: "HelveticaRegular"; */
+@font-face {
+ font-family: "HelveticaRegular";
+ src: url("../fonts/HelveticaRegular/HelveticaRegular.eot");
+ src: url("../fonts/HelveticaRegular/HelveticaRegular.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaRegular/HelveticaRegular.woff") format("woff"),
+ url("../fonts/HelveticaRegular/HelveticaRegular.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaBold"; */
+@font-face {
+ font-family: "HelveticaBold";
+ src: url("../fonts/HelveticaBold/HelveticaBold.eot");
+ src: url("../fonts/HelveticaBold/HelveticaBold.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaBold/HelveticaBold.woff") format("woff"),
+ url("../fonts/HelveticaBold/HelveticaBold.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaItalic"; */
+@font-face {
+ font-family: "HelveticaItalic";
+ src: url("../fonts/HelveticaItalic/HelveticaItalic.eot");
+ src: url("../fonts/HelveticaItalic/HelveticaItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaItalic/HelveticaItalic.woff") format("woff"),
+ url("../fonts/HelveticaItalic/HelveticaItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaLight"; */
+@font-face {
+ font-family: "HelveticaLight";
+ src: url("../fonts/HelveticaLight/HelveticaLight.eot");
+ src: url("../fonts/HelveticaLight/HelveticaLight.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaLight/HelveticaLight.woff") format("woff"),
+ url("../fonts/HelveticaLight/HelveticaLight.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaBlack"; */
+@font-face {
+ font-family: "HelveticaBlack";
+ src: url("../fonts/HelveticaBlack/HelveticaBlack.eot");
+ src: url("../fonts/HelveticaBlack/HelveticaBlack.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaBlack/HelveticaBlack.woff") format("woff"),
+ url("../fonts/HelveticaBlack/HelveticaBlack.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaHeavy"; */
+@font-face {
+ font-family: "HelveticaHeavy";
+ src: url("../fonts/HelveticaHeavy/HelveticaHeavy.eot");
+ src: url("../fonts/HelveticaHeavy/HelveticaHeavy.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaHeavy/HelveticaHeavy.woff") format("woff"),
+ url("../fonts/HelveticaHeavy/HelveticaHeavy.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaMedium"; */
+@font-face {
+ font-family: "HelveticaMedium";
+ src: url("../fonts/HelveticaMedium/HelveticaMedium.eot");
+ src: url("../fonts/HelveticaMedium/HelveticaMedium.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaMedium/HelveticaMedium.woff") format("woff"),
+ url("../fonts/HelveticaMedium/HelveticaMedium.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaThin"; */
+@font-face {
+ font-family: "HelveticaThin";
+ src: url("../fonts/HelveticaThin/HelveticaThin.eot");
+ src: url("../fonts/HelveticaThin/HelveticaThin.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaThin/HelveticaThin.woff") format("woff"),
+ url("../fonts/HelveticaThin/HelveticaThin.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaUltraLight"; */
+@font-face {
+ font-family: "HelveticaUltraLight";
+ src: url("../fonts/HelveticaUltraLight/HelveticaUltraLight.eot");
+ src: url("../fonts/HelveticaUltraLight/HelveticaUltraLight.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaUltraLight/HelveticaUltraLight.woff") format("woff"),
+ url("../fonts/HelveticaUltraLight/HelveticaUltraLight.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaBoldItalic"; */
+@font-face {
+ font-family: "HelveticaBoldItalic";
+ src: url("../fonts/HelveticaBoldItalic/HelveticaBoldItalic.eot");
+ src: url("../fonts/HelveticaBoldItalic/HelveticaBoldItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaBoldItalic/HelveticaBoldItalic.woff") format("woff"),
+ url("../fonts/HelveticaBoldItalic/HelveticaBoldItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaBlackItalic"; */
+@font-face {
+ font-family: "HelveticaBlackItalic";
+ src: url("../fonts/HelveticaBlackItalic/HelveticaBlackItalic.eot");
+ src: url("../fonts/HelveticaBlackItalic/HelveticaBlackItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaBlackItalic/HelveticaBlackItalic.woff") format("woff"),
+ url("../fonts/HelveticaBlackItalic/HelveticaBlackItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaLightItalic"; */
+@font-face {
+ font-family: "HelveticaLightItalic";
+ src: url("../fonts/HelveticaLightItalic/HelveticaLightItalic.eot");
+ src: url("../fonts/HelveticaLightItalic/HelveticaLightItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaLightItalic/HelveticaLightItalic.woff") format("woff"),
+ url("../fonts/HelveticaLightItalic/HelveticaLightItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaMediumItalic"; */
+@font-face {
+ font-family: "HelveticaMediumItalic";
+ src: url("../fonts/HelveticaMediumItalic/HelveticaMediumItalic.eot");
+ src: url("../fonts/HelveticaMediumItalic/HelveticaMediumItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaMediumItalic/HelveticaMediumItalic.woff") format("woff"),
+ url("../fonts/HelveticaMediumItalic/HelveticaMediumItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaHeavyItalic"; */
+@font-face {
+ font-family: "HelveticaHeavyItalic";
+ src: url("../fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.eot");
+ src: url("../fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.woff") format("woff"),
+ url("../fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaThinItalic"; */
+@font-face {
+ font-family: "HelveticaThinItalic";
+ src: url("../fonts/HelveticaThinItalic/HelveticaThinItalic.eot");
+ src: url("../fonts/HelveticaThinItalic/HelveticaThinItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaThinItalic/HelveticaThinItalic.woff") format("woff"),
+ url("../fonts/HelveticaThinItalic/HelveticaThinItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "HelveticaUltraLightItalic"; */
+@font-face {
+ font-family: "HelveticaUltraLightItalic";
+ src: url("../fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.eot");
+ src: url("../fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.woff") format("woff"),
+ url("../fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* font-family: "UbuntuRegular"; */
+@font-face {
+ font-family: "UbuntuRegular";
+ src: url("../fonts/UbuntuRegular/UbuntuRegular.eot");
+ src: url("../fonts/UbuntuRegular/UbuntuRegular.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuRegular/UbuntuRegular.woff") format("woff"),
+ url("../fonts/UbuntuRegular/UbuntuRegular.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "UbuntuBold"; */
+@font-face {
+ font-family: "UbuntuBold";
+ src: url("../fonts/UbuntuBold/UbuntuBold.eot");
+ src: url("../fonts/UbuntuBold/UbuntuBold.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuBold/UbuntuBold.woff") format("woff"),
+ url("../fonts/UbuntuBold/UbuntuBold.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "UbuntuItalic"; */
+@font-face {
+ font-family: "UbuntuItalic";
+ src: url("../fonts/UbuntuItalic/UbuntuItalic.eot");
+ src: url("../fonts/UbuntuItalic/UbuntuItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuItalic/UbuntuItalic.woff") format("woff"),
+ url("../fonts/UbuntuItalic/UbuntuItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "UbuntuLight"; */
+@font-face {
+ font-family: "UbuntuLight";
+ src: url("../fonts/UbuntuLight/UbuntuLight.eot");
+ src: url("../fonts/UbuntuLight/UbuntuLight.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuLight/UbuntuLight.woff") format("woff"),
+ url("../fonts/UbuntuLight/UbuntuLight.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "UbuntuLightItalic"; */
+@font-face {
+ font-family: "UbuntuLightItalic";
+ src: url("../fonts/UbuntuLightItalic/UbuntuLightItalic.eot");
+ src: url("../fonts/UbuntuLightItalic/UbuntuLightItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuLightItalic/UbuntuLightItalic.woff") format("woff"),
+ url("../fonts/UbuntuLightItalic/UbuntuLightItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "UbuntuMedium"; */
+@font-face {
+ font-family: "UbuntuMedium";
+ src: url("../fonts/UbuntuMedium/UbuntuMedium.eot");
+ src: url("../fonts/UbuntuMedium/UbuntuMedium.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuMedium/UbuntuMedium.woff") format("woff"),
+ url("../fonts/UbuntuMedium/UbuntuMedium.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "UbuntuMediumItalic"; */
+@font-face {
+ font-family: "UbuntuMediumItalic";
+ src: url("../fonts/UbuntuMediumItalic/UbuntuMediumItalic.eot");
+ src: url("../fonts/UbuntuMediumItalic/UbuntuMediumItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuMediumItalic/UbuntuMediumItalic.woff") format("woff"),
+ url("../fonts/UbuntuMediumItalic/UbuntuMediumItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
+/* font-family: "UbuntuBoldItalic"; */
+@font-face {
+ font-family: "UbuntuBoldItalic";
+ src: url("../fonts/UbuntuBoldItalic/UbuntuBoldItalic.eot");
+ src: url("../fonts/UbuntuBoldItalic/UbuntuBoldItalic.eot?#iefix")format("embedded-opentype"),
+ url("../fonts/UbuntuBoldItalic/UbuntuBoldItalic.woff") format("woff"),
+ url("../fonts/UbuntuBoldItalic/UbuntuBoldItalic.ttf") format("truetype");
+ font-style: normal;
+ font-weight: normal;
+}
diff --git a/frontend/web/css/ie.css b/frontend/web/css/ie.css
new file mode 100644
index 0000000..15beb76
--- /dev/null
+++ b/frontend/web/css/ie.css
@@ -0,0 +1,8 @@
+.search_head button{
+ right:481px!important;
+ height: 32px!important;
+}
+.phone_me_head button{
+ padding-top:7px!important;
+ padding-bottom:7px!important;
+}
\ No newline at end of file
diff --git a/frontend/web/css/item_card_open.css b/frontend/web/css/item_card_open.css
new file mode 100644
index 0000000..838320b
--- /dev/null
+++ b/frontend/web/css/item_card_open.css
@@ -0,0 +1,15 @@
+ul {
+ list-style: none;
+}
+.item_card_main_wrap {
+ width: 960px;
+ margin: auto;
+}
+.item_card_main_wrap .bradcrumps_top ul li a {
+ color: #6aa033;
+ text-decoration: underline;
+}
+.item_card_main_wrap .bradcrumps_top ul li:last-child {
+ text-decoration: none;
+ color: #898b8e;
+}
diff --git a/frontend/web/css/owl.carousel.css b/frontend/web/css/owl.carousel.css
new file mode 100644
index 0000000..72336a1
--- /dev/null
+++ b/frontend/web/css/owl.carousel.css
@@ -0,0 +1,216 @@
+/*
+ * Owl Carousel - Animate Plugin
+ */
+.owl-carousel .animated {
+ -webkit-animation-duration: 1000ms;
+ animation-duration: 1000ms;
+ -webkit-animation-fill-mode: both;
+ animation-fill-mode: both;
+}
+.owl-carousel .owl-animated-in {
+ z-index: 0;
+}
+.owl-carousel .owl-animated-out {
+ z-index: 1;
+}
+.owl-carousel .fadeOut {
+ -webkit-animation-name: fadeOut;
+ animation-name: fadeOut;
+}
+
+@-webkit-keyframes fadeOut {
+ 0% {
+ opacity: 1;
+ }
+
+ 100% {
+ opacity: 0;
+ }
+}
+@keyframes fadeOut {
+ 0% {
+ opacity: 1;
+ }
+
+ 100% {
+ opacity: 0;
+ }
+}
+
+/*
+ * Owl Carousel - Auto Height Plugin
+ */
+.owl-height {
+ -webkit-transition: height 500ms ease-in-out;
+ -moz-transition: height 500ms ease-in-out;
+ -ms-transition: height 500ms ease-in-out;
+ -o-transition: height 500ms ease-in-out;
+ transition: height 500ms ease-in-out;
+}
+
+/*
+ * Core Owl Carousel CSS File
+ */
+.owl-carousel {
+ display: none;
+ width: 100%;
+ -webkit-tap-highlight-color: transparent;
+ /* position relative and z-index fix webkit rendering fonts issue */
+ position: relative;
+ z-index: 1;
+}
+.owl-carousel .owl-stage {
+ position: relative;
+ -ms-touch-action: pan-Y;
+}
+.owl-carousel .owl-stage:after {
+ content: ".";
+ display: block;
+ clear: both;
+ visibility: hidden;
+ line-height: 0;
+ height: 0;
+}
+.owl-carousel .owl-stage-outer {
+ position: relative;
+ overflow: hidden;
+ /* fix for flashing background */
+ -webkit-transform: translate3d(0px, 0px, 0px);
+}
+.owl-carousel .owl-controls .owl-nav .owl-prev,
+.owl-carousel .owl-controls .owl-nav .owl-next,
+.owl-carousel .owl-controls .owl-dot {
+ cursor: pointer;
+ cursor: hand;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+.owl-carousel.owl-loaded {
+ display: block;
+}
+.owl-carousel.owl-loading {
+ opacity: 0;
+ display: block;
+}
+.owl-carousel.owl-hidden {
+ opacity: 0;
+}
+.owl-carousel .owl-refresh .owl-item {
+ display: none;
+}
+.owl-carousel .owl-item {
+ position: relative;
+ min-height: 1px;
+ float: left;
+ -webkit-backface-visibility: hidden;
+ -webkit-tap-highlight-color: transparent;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+.owl-carousel .owl-item img {
+ display: block;
+ width: 100%;
+ -webkit-transform-style: preserve-3d;
+}
+.owl-carousel.owl-text-select-on .owl-item {
+ -webkit-user-select: auto;
+ -moz-user-select: auto;
+ -ms-user-select: auto;
+ user-select: auto;
+}
+.owl-carousel .owl-grab {
+ cursor: move;
+ cursor: -webkit-grab;
+ cursor: -o-grab;
+ cursor: -ms-grab;
+ cursor: grab;
+}
+.owl-carousel.owl-rtl {
+ direction: rtl;
+}
+.owl-carousel.owl-rtl .owl-item {
+ float: right;
+}
+
+/* No Js */
+.no-js .owl-carousel {
+ display: block;
+}
+
+/*
+ * Owl Carousel - Lazy Load Plugin
+ */
+.owl-carousel .owl-item .owl-lazy {
+ opacity: 0;
+ -webkit-transition: opacity 400ms ease;
+ -moz-transition: opacity 400ms ease;
+ -ms-transition: opacity 400ms ease;
+ -o-transition: opacity 400ms ease;
+ transition: opacity 400ms ease;
+}
+.owl-carousel .owl-item img {
+ transform-style: preserve-3d;
+}
+
+/*
+ * Owl Carousel - Video Plugin
+ */
+.owl-carousel .owl-video-wrapper {
+ position: relative;
+ height: 100%;
+ background: #000;
+}
+.owl-carousel .owl-video-play-icon {
+ position: absolute;
+ height: 80px;
+ width: 80px;
+ left: 50%;
+ top: 50%;
+ margin-left: -40px;
+ margin-top: -40px;
+ background: url("owl.video.play.png") no-repeat;
+ cursor: pointer;
+ z-index: 1;
+ -webkit-backface-visibility: hidden;
+ -webkit-transition: scale 100ms ease;
+ -moz-transition: scale 100ms ease;
+ -ms-transition: scale 100ms ease;
+ -o-transition: scale 100ms ease;
+ transition: scale 100ms ease;
+}
+.owl-carousel .owl-video-play-icon:hover {
+ -webkit-transition: scale(1.3, 1.3);
+ -moz-transition: scale(1.3, 1.3);
+ -ms-transition: scale(1.3, 1.3);
+ -o-transition: scale(1.3, 1.3);
+ transition: scale(1.3, 1.3);
+}
+.owl-carousel .owl-video-playing .owl-video-tn,
+.owl-carousel .owl-video-playing .owl-video-play-icon {
+ display: none;
+}
+.owl-carousel .owl-video-tn {
+ opacity: 0;
+ height: 100%;
+ background-position: center center;
+ background-repeat: no-repeat;
+ -webkit-background-size: contain;
+ -moz-background-size: contain;
+ -o-background-size: contain;
+ background-size: contain;
+ -webkit-transition: opacity 400ms ease;
+ -moz-transition: opacity 400ms ease;
+ -ms-transition: opacity 400ms ease;
+ -o-transition: opacity 400ms ease;
+ transition: opacity 400ms ease;
+}
+.owl-carousel .owl-video-frame {
+ position: relative;
+ z-index: 1;
+}
diff --git a/frontend/web/css/site.css b/frontend/web/css/site.css
new file mode 100644
index 0000000..09a19f1
--- /dev/null
+++ b/frontend/web/css/site.css
@@ -0,0 +1,105 @@
+html,
+body {
+ height: 100%;
+}
+
+.wrap {
+ min-height: 100%;
+ height: auto;
+ margin: 0 auto -60px;
+ padding: 0 0 60px;
+}
+
+.wrap > .container {
+ padding: 70px 15px 20px;
+}
+
+.footer {
+ height: 60px;
+ background-color: #f5f5f5;
+ border-top: 1px solid #ddd;
+ padding-top: 20px;
+}
+
+.jumbotron {
+ text-align: center;
+ background-color: transparent;
+}
+
+.jumbotron .btn {
+ font-size: 21px;
+ padding: 14px 24px;
+}
+
+.not-set {
+ color: #c55;
+ font-style: italic;
+}
+
+/* add sorting icons to gridview sort links */
+a.asc:after, a.desc:after {
+ position: relative;
+ top: 1px;
+ display: inline-block;
+ font-family: 'Glyphicons Halflings';
+ font-style: normal;
+ font-weight: normal;
+ line-height: 1;
+ padding-left: 5px;
+}
+
+a.asc:after {
+ content: "\e151";
+}
+
+a.desc:after {
+ content: "\e152";
+}
+
+.sort-numerical a.asc:after {
+ content: "\e153";
+}
+
+.sort-numerical a.desc:after {
+ content: "\e154";
+}
+
+.sort-ordinal a.asc:after {
+ content: "\e155";
+}
+
+.sort-ordinal a.desc:after {
+ content: "\e156";
+}
+
+.grid-view td {
+ white-space: nowrap;
+}
+
+.grid-view .filters input,
+.grid-view .filters select {
+ min-width: 50px;
+}
+
+.hint-block {
+ display: block;
+ margin-top: 5px;
+ color: #999;
+}
+
+.error-summary {
+ color: #a94442;
+ background: #fdf7f7;
+ border-left: 3px solid #eed3d7;
+ padding: 10px 20px;
+ margin: 0 0 15px 0;
+}
+
+/* align the logout "link" (button in form) of the navbar */
+.nav > li > form {
+ padding: 8px;
+}
+
+.nav > li > form > button:hover {
+ text-decoration: none;
+}
diff --git a/frontend/web/css/style.css b/frontend/web/css/style.css
new file mode 100644
index 0000000..d90f3c4
--- /dev/null
+++ b/frontend/web/css/style.css
@@ -0,0 +1,1147 @@
+*{margin:0;padding:0;font-family:'HelveticaRegular',sans-serif;}
+.line_up{
+ background-color: #898b8e;
+ height:40px;
+ width:100%;
+}
+.line_up_in{
+ width:960px;
+ margin-left: auto;
+ margin-right: auto;
+ display:table;
+}
+.line_up_in .left_lineup, .line_up_in .right_lineup{
+ display:table-cell;
+ padding-left:10px;
+ padding-right:10px;
+}
+.line_up ul li{
+ list-style: none;
+ display: table-cell;
+ vertical-align: middle;
+ height: 40px;
+ color:#dde1e8;
+ font-size:13px;
+ padding-right:36px;
+}
+.line_up a{color:#dde1e8;text-decoration:none;}
+.line_up_in .left_lineup ul{ float:left;}
+.line_up_in .right_lineup ul{ float:right;}
+.login_button_lu, .user_button_lu{
+ padding-left:15px;
+ background:url('../images/ico_user.png') center left no-repeat;
+ cursor:pointer;
+}
+.reg_button_lu{
+ padding-left:20px;
+ background:url('../images/ico_note.png') center left no-repeat;
+ cursor:pointer;
+}
+.login_button_lu a, .reg_button_lu a, .user_button_lu a{border-bottom:1px dotted #dde1e8;}
+.line_up ul li:last-child{padding-right:0px;}
+.line_up a:hover{color:#eef1f5;transition:0.2s;}
+.login_button_lu a:hover, .reg_button_lu a:hover, .user_button_lu a:hover{border-bottom:1px dotted #eef1f5;}
+
+/* */
+
+.head{
+ width:960px;
+ margin-left: auto;
+ margin-right: auto;
+ position:relative;
+}
+.head_up{
+ display:table;
+ height:124px;
+ padding-left:10px;
+ padding-right:10px;
+}
+.bau_logo{opacity:0.8;transition:0.2s;width:170px;}
+.bau_logo:hover{opacity:1;}
+.head_up_cell{display:table-cell;vertical-align:middle;}
+
+.head_up_cell.srch{width:311px;}
+.search_head {
+ margin-left: 29px;
+ margin-right: auto;
+ margin-top: -6px;
+}
+.search_head input[type="text"]{
+ border: 1px solid #c3c6cb;
+ border-right: none;
+ padding: 8px;
+ padding-right:18px;
+ border-radius: 2px 0px 0px 2px;
+ width: 230px;
+ color: #515355;
+ font-family: 'HelveticaRegular',sans-serif;
+ font-size: 13px;
+ height:15px;
+}
+.search_head button{
+ background-color: #6aa033;
+ border: 0;
+ color: #ffffff;
+ padding-bottom: 8px;
+ font-size: 14px;
+ border-top: 1px solid #6aa033;
+ border-bottom: 2px solid #588c23;
+ border-radius: 0px 2px 2px 0px;
+ cursor: pointer;
+ width: 33px;
+ height: 33px;
+ max-height: 33px;
+ position: absolute;
+ overflow: hidden;
+ margin-left:-10px;
+}
+.srch_head_desc{color:#898b8e;font-size:12px;padding-bottom:5px;}
+.srch_head_desc a{margin-left: 3px;margin-right: 3px;color: #898b8e;text-decoration:none;border-bottom:1px dotted #898b8e;}
+input:focus {outline: none;}
+button:focus {outline: none;}
+.phone_me_head .phone_code{color:#898b8e;font-family:HelveticaBold;}
+.phone_me_head .phone_num{
+ letter-spacing: 0;
+ font-family: HelveticaBold;
+ font-size: 24px;
+ margin-bottom: 9px;
+ margin-top: -1px;
+ position: relative;
+ color: #333333;
+ margin-left: -2px;
+}
+.phone_desc{
+ font-size: 12px;
+ color: #898b8e;
+ text-align: center;
+ padding-top: 7px;
+ margin-left: -14px;
+ margin-top: 1px;
+}
+.phone_me_head button{
+ font-family: 'Ubuntu', sans-serif;
+ background-color: #6aa033;
+ border: 0;
+ color: #ffffff;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ font-size: 13px;
+ border-top: 1px solid #6aa033;
+ border-bottom: 2px solid #588c23;
+ border-radius: 0px 2px 2px 0px;
+ cursor: pointer;
+ padding-right: 10px;
+ padding-left: 10px;
+ position:absolute;
+ z-index:2;
+ height:33px;
+}
+.phone_me_head input[type="text"]{
+ text-transform: uppercase;
+ font-size: 12px;
+ border: 1px solid #c3c6cb;
+ border-right: none;
+ padding: 8px;
+ padding-top: 9px;
+ border-radius: 2px 0px 0px 2px;
+ width: 100px;
+ color: #515355;
+ margin-left: -1px;
+ padding-right: 3px;
+ padding-left: 10px;
+ z-index:2;
+ height:14px;
+}
+.phone_me_head{margin-left:10px;}
+
+/* */
+
+.menu_up {
+ width: 100%;
+ height: 60px;
+ background-color: #6AA033;
+ background: -webkit-linear-gradient(top, #588C23 0%,#6AA033 50%,#6AA033 51%,#6AA033 100%);
+ background: linear-gradient(to top, #6AA033 41px, #6AA033 47px, #588C23 57px) transparent;
+}
+.menu_up .home_button{float:left;}
+.menu_up .home_button a{
+ background:url('../images/ico_home.png') right center no-repeat;
+ height:60px;
+ display: table-cell;
+ vertical-align: middle;
+ text-align:left;
+ width:55px;
+ padding:0 !important;
+}
+.menu_up .home_button a:hover{
+ background:url('../images/ico_home_black.png') right center no-repeat;
+ background-color:#ffde00;
+}
+.menu_item a:after{
+ content:'';
+ width:1px;
+ height:44px;
+ position:absolute;
+ background-color:#90c25c;
+ left:0px;
+ top:7px;
+ opacity:1 !important;
+
+}
+.menu_item a:hover:after{opacity:0 !important;}
+.menu_up_center{width:960px;margin-left:auto;margin-right:auto;position:relative;}
+.menu_up a{
+ height: 60px;
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ text-transform: uppercase;
+ color: white;
+ text-decoration: none;
+ font-size: 15px;
+ position: relative;
+}
+.menu_up a:hover{background-color:#ffde00;color:#000000;}
+.submenu_button.m_item2.active:hover{background-color:#ffffff!important;color:#000000;border-top:1px solid #598d24!important;}
+.menu_up a:last-child:after, .menu_up a:hover:after{opacity:0;}
+.meter{
+ background-color:#737679;
+ width:100%;
+ height:3px;
+ position:relative;
+}
+.meter span{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffde00', endColorstr = '#e3c600');
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffde00', endColorstr = '#e3c600')";
+ background-image: -moz-linear-gradient(top, #ffde00, #e3c600);
+ background-image: -ms-linear-gradient(top, #ffde00, #e3c600);
+ background-image: -o-linear-gradient(top, #ffde00, #e3c600);
+ background-image: -webkit-gradient(linear, center top, center bottom, from(#ffde00), to(#e3c600));
+ background-image: -webkit-linear-gradient(top, #ffde00, #e3c600);
+ background-image: linear-gradient(top, #ffde00, #e3c600);
+ height:3px;
+ position: absolute;
+ left:0;
+}
+.meter.none{
+ background-color:#737679;
+ width:100%;
+ height:0px;
+ position:relative;
+}
+
+/* */
+
+.content{width:940px;margin-left:auto;margin-right:auto;padding:10px;padding-top:11px;}
+.content .title{font-size:30px;margin-top:14px;color:#333333;}
+.title.white{color:#ffffff;}
+.title.grey{color:#dde1e8;}
+
+/* */
+/* */
+.why_us{
+ width:100%;
+ height:260px;
+ background:url('../images/why_us_fon.png') center center no-repeat;
+ background-color:#898b8e;
+}
+.why_us .items_why{margin-top: 14px;}
+.why_us .items_why .item{
+ color: #ffffff;
+ font-size: 15px;
+ float: left;
+ width: 220px;
+ border-bottom: 2px solid #6aa034;
+ height: 50px;
+ display: inline-table;
+ margin: 10px;
+ margin-bottom: 14px;
+}
+.items_why .item span{
+ width:175px;
+ font-size:15px;
+ display:table-cell;
+ vertical-align:middle;
+ padding-left: 43px;
+ line-height:1.2;
+}
+.why_us .items_why .item.no_mrg_lt{
+ margin-left:0;
+}
+.why_us .items_why .item.no_mrg_rgt{
+ margin-right:0;
+}
+/**/
+
+.prods{background:#f4f4f4 url('../images/prods_grey_fon.png');}
+
+
+/* */
+
+.novelty .content{
+ padding-top:30px;
+}
+/* */
+.products .content{padding-top:30px;padding-bottom:52px;}
+.products .items{
+ display:table;
+ width:90%;
+ margin-left:auto;
+ margin-right:auto;
+ margin-top:24px;
+}
+.products .items .item .item_title{margin-top:8px;}
+.products .items .item{
+ text-align:center;
+ display:table-cell;
+ width:1000px;
+}
+.products .items .item a{color:#6aa033;font-size:15px;}
+
+/* */
+.footer_bl{background-color:#898b8e;}
+.footer{
+ width: 960px;
+ height: 215px;
+ margin-left: auto;
+ margin-right: auto;
+ position: relative;
+}
+.footer .content{
+ position: absolute;
+ font-size: 13px;
+ color: #dde1e8;
+ vertical-align: top;}
+.footer .content .title{font-size:24px;margin-top:15px;margin-bottom:13px;}
+.footer .content.small{
+ width: 130px;
+ right: -13px;
+ top: -1px;}
+.footer .content.big{width:360px;}
+.footer .content ul li{list-style:none;margin-bottom:9px;}
+.footer .content ul li a{color:#dde1e8;text-decoration:none;}
+.down_line .left{float:left;}
+.down_line .right{float:right;}
+.both{clear:both;}
+.down_line{
+ font-size: 11px;
+ color: #dde1e8;
+ padding: 10px;
+ padding-top: 14px;
+ position: absolute;
+ bottom: 8px;
+ width: 100%;}
+.footer .copyright{color:#dde1e8;background:url('../images/aw_logo.png') right center no-repeat; padding-right:35px;padding-top:9px;padding-bottom:9px;}
+.social_button {
+ float: left;
+ margin-left: 11px;
+ margin-top: 20px;
+ position: relative;
+ width: 32px;
+ height: 32px;
+}
+.social_button:first-child{margin-left:0px;}
+
+/* */
+.slider_prod{position:relative;}
+.prods .content{position:relative; padding-bottom:30px;}
+.prods_carousel{
+ margin-left:22px;
+ margin-top:24px;
+ width:100%;
+ position:relative;
+}
+.prods_carousel li{
+ background-color:#ffffff !important;
+ width:138px;
+ height:78px;
+ border:1px solid #cdd1d9;
+ border-radius:2px;
+ list-style:none;
+ text-align:center;
+ margin-right:12px;
+ vertical-align:middle;
+}
+.prods_carousel li img, .socbut{
+ opacity:0.4;
+ transition:0.3s;
+ -webkit-filter: grayscale(100%);
+ -moz-filter: grayscale(100%);
+ -ms-filter: grayscale(100%);
+ -o-filter: grayscale(100%);
+ filter: grayscale(100%);
+ filter: gray; /* IE 6-9 */}
+.prods_carousel li:hover img, .socbut:hover{
+ opacity:1!important;
+ transition:0.3s;
+ -webkit-filter: grayscale(0%);
+ -moz-filter: grayscale(0%);
+ -ms-filter: grayscale(0%);
+ -o-filter: grayscale(0%);
+ filter: grayscale(0%);
+}
+
+.pc_next,.pc_prev{cursor:pointer;position:absolute;z-index:99999; width:8px;height:18px;}
+.prods .content .pc_prev{left:2px; top:31px; background:url('../images/slider_left.png') center center no-repeat;}
+.prods .content .pc_next{right:-2px; top:31px; background:url('../images/slider_right.png') center center no-repeat;}
+.prods .content .pc_prev:hover{background:url('../images/slider_left_hover.png') center center no-repeat;transition:0.2s;}
+.prods .content .pc_next:hover{background:url('../images/slider_right_hover.png') center center no-repeat;transition:0.2s;}
+
+.prods_carousel ul li{display:table;}
+.prods_carousel ul li span{display:table-cell;vertical-align:middle; width:100%;height:100%;}
+
+.socbut{width:32px;height:32px;position:absolute;transition:0.2s; opacity:0.75!important;}
+.socbut.fb_button{background:url('../images/fb_small_color.png')center center no-repeat;}
+.socbut.vk_button{background:url('../images/vk_small_color.png')center center no-repeat;}
+.socbut.yt_button{background:url('../images/yt_small_color.png')center center no-repeat;}
+
+
+
+
+/***/
+
+
+.slider {
+ width: 100%;
+ height: 480px;
+ background: #eceff4;
+ margin-right: 25px;
+ display: inline-block;
+ float: left;
+ overflow:hidden;
+}
+.slider .slide{
+ width:100%;
+ height:480px;
+}
+.owl-nav {
+ position: relative;
+ width: 160px;
+ margin-left: auto;
+ margin-right: auto;
+ z-index: 9999999;
+}
+.owl-dots {
+ width: 100%;
+ margin: auto;
+ text-align: center;
+ position: absolute;
+ bottom: 17px;
+ margin-left:3px;
+}
+.owl-dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: rgba(0,0,0,0.0);
+ border: 2px solid #ffffff;
+ display: inline-block;
+ margin-right: 6px;
+}
+.owl-dot.active {width:12px;height:12px; background: #ffffff; border:none;}
+
+.owl-stage-outer{
+ position: relative;
+ height: 480px;
+}
+
+.slider .prev{position:absolute;width:8px;height:18px;background:url('../images/slider_left_white.png') center center no-repeat;left:0;bottom:17px;}
+.slider .next{position:absolute;width:8px;height:18px;background:url('../images/slider_right_white.png') center center no-repeat;right:0;bottom:17px;}
+.slide .content{padding-top: 35px;color:#333333;position:relative;}
+.slide .content .title span{color:#6aa033;text-transform:uppercase;font-family:HelveticaBold;font-size:36px;}
+.slide .content .title div{font-size:28px;}
+.slide .content .title div div{font-size:18px;}
+.slide .content .list .item{margin-bottom:8px;color:#333333;font-size:16px; background:url('../images/ico_ok.png') left center no-repeat;padding-left:28px;font-weight: 600;padding-top:2px;padding-bottom:1px;}
+.content .list{padding-top:20px;padding-bottom:27px;}
+
+.slide_about{background-color:#6aa033;color:#ffffff;font-family:Ubuntu;font-size:13px;text-decoration:none;padding-left:22px;padding-right:20px;padding-top:8px;padding-bottom:9px;border-bottom:2px solid #588c23;border-radius:2px;}
+
+.price_round_border{
+ position: absolute;
+ right: 19px;
+ top: 157px;
+ text-align: center;
+ width: 125px;
+ height: 125px;
+ overflow: hidden;
+ border-radius: 50%;
+ background-color: rgba(255,255,255,0.3);
+}
+.price_round{
+ position:absolute;
+ background-color:#ffde00;
+ margin:6px;
+ border-radius:50%;
+ overflow:hidden;
+ width:112px;
+ height:112px;
+}
+.price_round .title{
+ font-size:11px;
+ text-transform:uppercase;
+ font-weight:bold;
+ position:relative;
+ padding-top:9px;
+ padding-bottom:10px;
+}
+.price_round .title:after{
+ content:'';
+ width:74px;
+ height:1px;
+ background-color:#e3c600;
+ position:absolute;
+ top:25px;
+ left:19px;
+}
+.price_round .desc{font-weight:bold;font-size:24px;font-family:HelveticaBold;}
+.price_round .desc div{font-size:13px;}
+
+.novelty_cont{
+ margin-top:14px;
+ padding-bottom:60px;
+ color:#333333;
+}
+.novelty_cont:after {
+ display: block;
+ content: '';
+ clear: both;
+}
+.novelty_cont .item{
+ border:1px solid #cdd1d9;
+ border-bottom:none;
+ width:218px;
+ float:left;
+ margin-left:20px;
+ border-top-left-radius: 2px;
+ border-top-right-radius: 2px;
+ position:relative;
+ text-align:center;
+ min-height:367px;
+}
+.novelty_cont .item {opacity:0.9;transition:0.2s;}
+.novelty_cont .item:hover{opacity:1;}
+.novelty_cont .item:first-child{margin-left:0px;}
+.novelty_cont .item .item_link{
+ text-decoration:none;
+ border:0;
+}
+
+.novelty_cont .item:after{
+ content:'';
+ position:absolute;
+ width:220px;
+ height:19px;
+ bottom:-19px;
+ left:-1px;
+ background: url('../images/nc_item_bottom.png') bottom center no-repeat;
+ z-index: -1;
+}
+.compare_add_but{
+color:#6aa034;
+font-size:12px;
+text-decoration:none;
+background:url("../images/ico_scales.png") left center no-repeat;
+padding-left:27px;
+}
+.compare_add_but span{
+ border-bottom:1px dotted #6aa034;
+}
+.novelty_cont .item .pic{
+ margin-top:24px;
+}
+.novelty_cont .title_item{padding:13px;padding-top:0px;color:#6aa033;margin-top:10px;font-size:15px;line-height: 1.2;height: 4em}
+.novelty_cont .title_item a{text-decoration:none;color:#6aa033;}
+.novelty_cont .item .price{
+ font-size:20px;
+ font-weight:bold;
+ font-family:HelveticaBold;
+ padding-bottom: 17px;
+}
+.novelty_cont .item .price span{
+ font-size:13px !important;
+}
+
+.novelty_cont .item .brand, .novelty_cont .item .type{
+ font-size:12px;
+}
+.novelty_cont .item .brand{
+ padding-top:1px;
+}
+.novelty_cont .item .type{
+ margin-bottom:8px;
+}
+.novelty_cont .item .brand a{
+ text-decoration:none;
+ color:#6aa033;
+}
+.basket_add_but{
+ font-family:Ubuntu;
+ font-size:13px;
+ color:#ffffff;
+ text-decoration:none;
+ background:#6aa033;
+ border: none;
+ border-bottom:2px solid #588c23;
+ padding-bottom:9px;
+ padding-left:13px;
+ padding-top:8px;
+ padding-right:51px;
+ border-radius:2px;
+ display: block;
+ margin: auto;
+ position:relative;
+ margin-bottom: 10px;
+ width: 125px;
+}
+.basket_add_but:hover{
+ color:#ffffff;
+}
+.item .pic{
+ height:134px;
+ text-align:center;
+}
+.basket_add_but:after{
+ content:'';
+ width:18px;
+ height:18px;
+ position:absolute;
+ right:17px;
+ top:7px;
+ background:url('../images/ico_basket_white.png') center center no-repeat;
+}
+.basket_add_but:before{
+ content:'';
+ width:1px;
+ height:21px;
+ position:absolute;
+ right:45px;
+ top:7px;
+ background:#588c23;
+}
+
+.item .new{
+ background-color:#00adf0;
+ position:absolute;
+ width:52px;
+ height:14px;
+ color:#ffffff;
+ left:0px;
+ top:14px;
+ text-transform:uppercase;
+ font-size:10px;
+ padding-top:4px;
+ text-align:left;
+ padding-left:5px;
+}
+.item .new:after{
+ content:'';
+ background:url('../images/new_fon_blue.png') right center no-repeat;
+ position:absolute;
+ width:18px;
+ height:18px;
+ right:-18px;
+ top:0;
+}
+.item .top{
+ background:#ffde00;
+ position:absolute;
+ width:23px;
+ height:14px;
+ color:#ffffff;
+ left:0px;
+ top:34px;
+ text-transform:uppercase;
+ font-size:10px;
+ padding-top:4px;
+ text-align:left;
+ padding-left:5px;
+ color:#333333;
+}
+.item .top:after{
+ content:'';
+ background:url('../images/top_fon_yellow.png') right center no-repeat;
+ width:18px;
+ height:18px;
+ position:absolute;
+ top:0;
+ right:-18px;
+}
+
+
+
+/*firefox only hack*/
+@-moz-document url-prefix() {
+ .menu_up{
+ background-color:#6aa033;
+ }
+ button.fa.fa-search{
+ max-height: 32px;
+ max-width: 33px;
+ padding-top: 6px;
+ }
+ .phone_me_head button{
+ max-height: 33px;
+ padding-top: 3px;
+ border-width: 2px 0px !important;
+ top: 52px;
+ }
+ .search_head input[type="text"]{
+ margin-top:2px;
+ }
+ .search_head button{
+ height: 33px;
+ top: 53px;
+ }
+ .phone_me_head input[type="text"]{
+ margin-top:-1px;
+ }
+}
+
+.submenu{
+ background-color:white;
+ position:absolute;
+ width:950px;
+ right:0;
+ z-index:9999;
+ display:none;
+ height:480px;
+ padding-top:3px;
+ border-radius: 0px 0px 3px 3px;
+ box-shadow: 0px 3px 5px rgba(218,218,218,0.75);
+ overflow:hidden;
+ top: 60px;
+}
+.submenu.visible{
+ display:block;
+}
+
+.menu_item{
+ float:left;
+ height:60px;
+}
+
+.submenu_button.active:after{
+ content:'';
+ opacity:0;
+ left:-1px;
+}
+
+.submenu .categories{
+ list-style: none;
+ margin-top:11px;
+ margin-left:10px;
+ border-right: 1px solid #c3c6cb;
+ width:210px;
+}
+.submenu .categories li{
+ font-size: 15px;
+ padding-left: 5px;
+ padding-top: 8px;
+ padding-bottom: 7px;
+ margin-bottom: -3px;
+ max-width: 205px;
+ cursor: pointer;
+ padding-right: 5px;
+}
+.submenu .sub_cat.active span:after{
+ content: '';
+ position: absolute;
+ height: 100%;
+ background: url('../images/right_sub.png') center right;
+ top: 0;
+ left: 201px;
+ width: 13px;
+ cursor:pointer;
+}
+
+.submenu .sub_cat.active{
+ color:white;
+ background-color: #6aa033;
+ z-index: 9999;
+}
+.submenu .sub_cat.active:hover{
+ color:white;
+ background-color: #6aa033;
+}
+
+.sub_cat_content{
+ position:absolute;
+ top:40px;
+ right:10px;
+ width:700px;
+ height:420px;
+ color:black;
+ display: none;
+ overflow:hidden;
+}
+
+.sub_cat span{
+ font-size: 15px;
+ padding-top: 8px;
+ padding-bottom: 7px;
+ cursor: pointer;
+ position: relative;
+}
+.sub_cat_content.visible{
+ display: block;
+}
+
+.sub_cat_content .content_item{
+ width:160px;
+ height:207px;
+ float:left;
+ text-align: center;
+ font-size: 15px;
+ margin-right:20px;
+ margin-top:10px;
+}
+.sub_cat_content .content_item a{
+ color:#6aa033;
+ margin:0;
+ padding:0;
+ text-transform: none;
+ height:auto;
+ font-size: 15px;
+}
+.sub_cat_content .content_item a:after{content: none;}
+.sub_cat_content .content_item a:hover{color:#6aa033!important;background-color: #ffffff;}
+.sub_cat_content .content_item .picture{width:160px; height:170px;}
+.sub_cat_content .content_items{width:720px;}
+
+.filter_list .arrow{
+ cursor: pointer;
+}
+
+.head_up .head_up_cell.bau_logo img {
+ margin-top: 4px;
+ margin-left: -1px;
+}
+
+.order_list li{
+ cursor:pointer;
+}
+.order_list li .active{
+ cursor:default;
+}
+
+.menu_item a.m_item1{width: 119px;}
+.menu_item a.m_item2{width: 300px;}
+.menu_item a.m_item3{width: 178px;}
+.menu_item a.m_item4{width: 150px;}
+.menu_item a.m_item5{width: 158px;}
+
+.basket_head{
+ position:absolute;
+ width:198px;
+ height:54px;
+ border:1px solid #c3c6cb;
+ border-radius: 2px;
+ top:36px;
+ right:0;
+ opacity: 0.8;
+ cursor:default;
+ background-color: #ffffff;
+ z-index: 4;
+}
+.basket_head.basket_head_for_click {
+ opacity: 1;
+ border: 1px solid #737373;
+ border-bottom: 1px solid #ffffff !important;
+ box-shadow: 0px -1px 1px #B9B9B9;
+}
+.basket_head:hover{
+ opacity:1;
+}
+.basket_head .bh_cell{
+ position:absolute;
+}
+.basket_head .basket_head_title{
+ text-transform: uppercase;
+ font-size:18px;
+ color:#333333;
+ font-weight: 600;
+}
+.basket_head .bh_cell.img{
+ top:16px;
+ left:20px;
+}
+.basket_head .bh_cell.text{
+ top:20px;
+ left:66px;
+}
+.basket_head .basket_head_desc{
+ color:#6aa033;
+ font-size:14px;
+}
+i.head-down.bh_cell{
+ width: 9px;
+ height: 5px;
+ background: url('../images/head_down.png');
+ cursor: pointer;
+ right: 7px;
+ top: 5px;
+ opacity: 0.8;
+ background-repeat: no-repeat;
+ padding: 20px 0 20px 15px;
+ background-position: 15px 20px;
+}
+i.head-down.bh_cell_2{
+ width: 9px;
+ height: 5px;
+ background: url('../images/head_up.png');
+ cursor: pointer;
+ right: 7px;
+ top: 5px;
+ opacity: 0.8;
+ background-repeat: no-repeat;
+ padding: 20px 0 20px 15px;
+ background-position: 15px 20px;
+}
+i.head-down.bh_cell:after{
+ content: '';
+ position: absolute;
+ width: 1px;
+ height: 37px;
+ background-color: #d9dbde;
+ top: 3px;
+ right: 18px;
+}
+.phone_num .head-down{
+ width:9px;
+ height:5px;
+ background:url('../images/head_down.png') center center no-repeat;
+ cursor:pointer;
+ position: absolute;
+ right:-17px;
+ top:12px;
+}
+.prods{
+ height:212px;
+ overflow: hidden;
+}
+.prods .content .title{
+ padding-top:20px;
+}
+.prods_carousel li{
+ cursor:pointer;
+}
+.products{
+ height:257px;
+ overflow: hidden;
+}
+.products .title{
+ margin-top: 15px;
+}
+.phone_me_head button:hover, .search_head button:hover, .slide_about:hover, .basket_add_but:hover{
+ background-color: #588c23;
+ border-bottom: 2px solid #41671a;
+}
+.basket_add_but:hover:before{
+ content: '';
+ width: 1px;
+ height: 21px;
+ position: absolute;
+ right: 45px;
+ top: 7px;
+ background: #47711d;
+}
+.search_head button .search_img{
+ width:16px;
+ height:15px;
+ background:url('../images/search.png') center center no-repeat;
+ position: absolute;
+ top: 8px;
+ left: 9px;
+}
+.slider_arrow_left, .slider_arrow_right{
+ cursor:pointer;
+}
+.slide_about:hover{
+ color:#ffffff !important;
+}
+.sub_cat .arrow{
+ display:none;
+ width: 9px;
+ height: 0px;
+ background-color: rgba(0,0,0,0);
+ float: right;
+ margin-right: -22px;
+ margin-top: -8px;
+ border-left: 8px solid #6aa033;
+ border-top: 16px solid rgba(0,0,0,0);
+ border-bottom: 15px solid rgba(0,0,0,0);
+}
+.sub_cat.active .arrow, .sub_cat.active.big .arrow{
+ display:block;
+}
+.sub_cat.big .arrow{
+ display:none;
+ width: 9px;
+ height: 0px;
+ background-color: rgba(0,0,0,0);
+ float: right;
+ margin-right: -22px;
+ margin-top: -25px;
+ border-left: 8px solid #6aa033;
+ border-top: 24px solid rgba(0,0,0,0);
+ border-bottom: 23px solid rgba(0,0,0,0);
+}
+.menu_item a{border-top:1px solid #588c23;}
+.menu_item a:hover{border-top:1px solid #ffde00;}
+.menu_item .active{background-color: #fff;color: black;}
+.menu_item .active a:hover{
+ background-color: #fff;
+ color: black;}
+.content_item a, .content_item a:hover{border:none;}
+.meter .menu_up{
+ position: absolute;
+ z-index: 9;
+ top: -60px;
+}
+a.submenu_button{cursor:pointer;}
+
+.warning.phone{
+ position: absolute;
+ background-color: #cacc36;
+ font-size: 11px;
+ width: 240px;
+ right: 220px;
+ text-align: center;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ border-radius: 5px;
+ color: black;
+ top: 89px;
+ z-index: 1;
+ display:none;
+}
+input.error{
+ transition:0.2s;
+ /*background-color: #FFEDED;
+ position: relative;*/
+}
+
+input.error_pass{
+ transition:0.2s;
+ background-color: #F1B9B9;
+}
+.close_modal{
+ position: absolute;
+ background-color: rgba(0,0,0,0);
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ z-index: 1;
+}
+.forgot_pass_modal_wrapper .modal_window .text{
+ width: 420px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.modal_centered{
+ width: 100%;
+ height: 100%;
+ position: fixed;
+ padding-top: 3%;
+ z-index: 999;
+}
+
+.modal_registration_form, .modal_wrapper_login, .forgot_pass_modal_wrapper, .forgot_pass_success_wrapper, .callback_wrapper{
+ display: block;
+ position: fixed!important;
+ width: 100%!important;
+ height: 100%!important;
+}
+
+.modal_registration_form, .modal_wrapper_login, .forgot_pass_modal_wrapper, .forgot_pass_success_wrapper, .callback_wrapper, .consultation_modal{
+ display: block;
+ position: fixed!important;
+ width: 100%!important;
+ height: 100%!important;
+}
+
+.please_phone{
+ position: absolute;
+ border: 1px solid grey;
+ padding: 5px;
+ background-color: white;
+ z-index: 4;
+ font-size: 11px;
+ font-weight: bold;
+ border-radius: 3px;
+ padding-left: 12px;
+ padding-right: 12px;
+ top: 89px;
+ right: 219px;
+ display: none;
+}
+.please_phone.visible{
+ display:block;
+}
+
+#loginform-rememberme{
+ display: none;
+}
+
+.field-loginform-rememberme{
+ display: inline;
+ color: #6aa034;
+}
+
+.field-loginform-rememberme label:hover{
+ color: #517a27;
+}
+
+.buy_one_item {
+ display: inline-block;
+ width: 50px;
+ height: 31px;
+ vertical-align: top;
+ font-size: 17px;
+ line-height: 1;
+ padding: 0 10px 0 10px;
+ color: #555;
+ background-color: #fff;
+ background-image: none;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
+ -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
+ -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+ transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
+}
+
+.portfolio-portfolio {
+ width: 940px;
+ height:230px;
+ border-bottom: 1px solid #c8ced5;
+ padding-top: 15px;
+ box-sizing: border-box;
+ position: relative;
+}
+
+.portfolio-portfolio-img-wrap {
+ width: 200px;
+ height: 200px;
+ margin-right: 15px;
+ float: left;
+}
+
+
+.portfolio-portfolio-text-wrap {
+ width: 925px;
+}
+
+.date_end {
+ display: block;
+ padding: 10px 0;
+ font-size: 12px;
+
+}
+
+.portfolio-text-name{
+ padding: 20px 0;
+}
\ No newline at end of file
diff --git a/frontend/web/favicon.ico b/frontend/web/favicon.ico
new file mode 100644
index 0000000..580ed73
Binary files /dev/null and b/frontend/web/favicon.ico differ
diff --git a/frontend/web/fonts/FontAwesome.otf b/frontend/web/fonts/FontAwesome.otf
new file mode 100644
index 0000000..681bdd4
Binary files /dev/null and b/frontend/web/fonts/FontAwesome.otf differ
diff --git a/frontend/web/fonts/HelveticaBlack/HelveticaBlack.eot b/frontend/web/fonts/HelveticaBlack/HelveticaBlack.eot
new file mode 100644
index 0000000..99c2b3e
Binary files /dev/null and b/frontend/web/fonts/HelveticaBlack/HelveticaBlack.eot differ
diff --git a/frontend/web/fonts/HelveticaBlack/HelveticaBlack.ttf b/frontend/web/fonts/HelveticaBlack/HelveticaBlack.ttf
new file mode 100644
index 0000000..923e273
Binary files /dev/null and b/frontend/web/fonts/HelveticaBlack/HelveticaBlack.ttf differ
diff --git a/frontend/web/fonts/HelveticaBlack/HelveticaBlack.woff b/frontend/web/fonts/HelveticaBlack/HelveticaBlack.woff
new file mode 100644
index 0000000..4c807bb
Binary files /dev/null and b/frontend/web/fonts/HelveticaBlack/HelveticaBlack.woff differ
diff --git a/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.eot b/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.eot
new file mode 100644
index 0000000..bcbcf1c
Binary files /dev/null and b/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.eot differ
diff --git a/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.ttf b/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.ttf
new file mode 100644
index 0000000..b4701e3
Binary files /dev/null and b/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.ttf differ
diff --git a/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.woff b/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.woff
new file mode 100644
index 0000000..fd62f2c
Binary files /dev/null and b/frontend/web/fonts/HelveticaBlackItalic/HelveticaBlackItalic.woff differ
diff --git a/frontend/web/fonts/HelveticaBold/HelveticaBold.eot b/frontend/web/fonts/HelveticaBold/HelveticaBold.eot
new file mode 100644
index 0000000..48527c3
Binary files /dev/null and b/frontend/web/fonts/HelveticaBold/HelveticaBold.eot differ
diff --git a/frontend/web/fonts/HelveticaBold/HelveticaBold.ttf b/frontend/web/fonts/HelveticaBold/HelveticaBold.ttf
new file mode 100644
index 0000000..8dcfee9
Binary files /dev/null and b/frontend/web/fonts/HelveticaBold/HelveticaBold.ttf differ
diff --git a/frontend/web/fonts/HelveticaBold/HelveticaBold.woff b/frontend/web/fonts/HelveticaBold/HelveticaBold.woff
new file mode 100644
index 0000000..c760a30
Binary files /dev/null and b/frontend/web/fonts/HelveticaBold/HelveticaBold.woff differ
diff --git a/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.eot b/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.eot
new file mode 100644
index 0000000..b44f61c
Binary files /dev/null and b/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.eot differ
diff --git a/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.ttf b/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.ttf
new file mode 100644
index 0000000..048066c
Binary files /dev/null and b/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.ttf differ
diff --git a/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.woff b/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.woff
new file mode 100644
index 0000000..9d7e877
Binary files /dev/null and b/frontend/web/fonts/HelveticaBoldItalic/HelveticaBoldItalic.woff differ
diff --git a/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.eot b/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.eot
new file mode 100644
index 0000000..3338ddb
Binary files /dev/null and b/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.eot differ
diff --git a/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.ttf b/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.ttf
new file mode 100644
index 0000000..dea9299
Binary files /dev/null and b/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.ttf differ
diff --git a/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.woff b/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.woff
new file mode 100644
index 0000000..4cd9c11
Binary files /dev/null and b/frontend/web/fonts/HelveticaHeavy/HelveticaHeavy.woff differ
diff --git a/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.eot b/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.eot
new file mode 100644
index 0000000..0c1e441
Binary files /dev/null and b/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.eot differ
diff --git a/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.ttf b/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.ttf
new file mode 100644
index 0000000..988ec8a
Binary files /dev/null and b/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.ttf differ
diff --git a/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.woff b/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.woff
new file mode 100644
index 0000000..3a4279e
Binary files /dev/null and b/frontend/web/fonts/HelveticaHeavyItalic/HelveticaHeavyItalic.woff differ
diff --git a/frontend/web/fonts/HelveticaItalic/HelveticaItalic.eot b/frontend/web/fonts/HelveticaItalic/HelveticaItalic.eot
new file mode 100644
index 0000000..b3a9aa5
Binary files /dev/null and b/frontend/web/fonts/HelveticaItalic/HelveticaItalic.eot differ
diff --git a/frontend/web/fonts/HelveticaItalic/HelveticaItalic.ttf b/frontend/web/fonts/HelveticaItalic/HelveticaItalic.ttf
new file mode 100644
index 0000000..d25e429
Binary files /dev/null and b/frontend/web/fonts/HelveticaItalic/HelveticaItalic.ttf differ
diff --git a/frontend/web/fonts/HelveticaItalic/HelveticaItalic.woff b/frontend/web/fonts/HelveticaItalic/HelveticaItalic.woff
new file mode 100644
index 0000000..10edd36
Binary files /dev/null and b/frontend/web/fonts/HelveticaItalic/HelveticaItalic.woff differ
diff --git a/frontend/web/fonts/HelveticaLight/HelveticaLight.eot b/frontend/web/fonts/HelveticaLight/HelveticaLight.eot
new file mode 100644
index 0000000..7cfa597
Binary files /dev/null and b/frontend/web/fonts/HelveticaLight/HelveticaLight.eot differ
diff --git a/frontend/web/fonts/HelveticaLight/HelveticaLight.ttf b/frontend/web/fonts/HelveticaLight/HelveticaLight.ttf
new file mode 100644
index 0000000..9d3808f
Binary files /dev/null and b/frontend/web/fonts/HelveticaLight/HelveticaLight.ttf differ
diff --git a/frontend/web/fonts/HelveticaLight/HelveticaLight.woff b/frontend/web/fonts/HelveticaLight/HelveticaLight.woff
new file mode 100644
index 0000000..cae768f
Binary files /dev/null and b/frontend/web/fonts/HelveticaLight/HelveticaLight.woff differ
diff --git a/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.eot b/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.eot
new file mode 100644
index 0000000..3f0de7e
Binary files /dev/null and b/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.eot differ
diff --git a/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.ttf b/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.ttf
new file mode 100644
index 0000000..df0419d
Binary files /dev/null and b/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.ttf differ
diff --git a/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.woff b/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.woff
new file mode 100644
index 0000000..a9a6447
Binary files /dev/null and b/frontend/web/fonts/HelveticaLightItalic/HelveticaLightItalic.woff differ
diff --git a/frontend/web/fonts/HelveticaMedium/HelveticaMedium.eot b/frontend/web/fonts/HelveticaMedium/HelveticaMedium.eot
new file mode 100644
index 0000000..8c82342
Binary files /dev/null and b/frontend/web/fonts/HelveticaMedium/HelveticaMedium.eot differ
diff --git a/frontend/web/fonts/HelveticaMedium/HelveticaMedium.ttf b/frontend/web/fonts/HelveticaMedium/HelveticaMedium.ttf
new file mode 100644
index 0000000..cf97ecc
Binary files /dev/null and b/frontend/web/fonts/HelveticaMedium/HelveticaMedium.ttf differ
diff --git a/frontend/web/fonts/HelveticaMedium/HelveticaMedium.woff b/frontend/web/fonts/HelveticaMedium/HelveticaMedium.woff
new file mode 100644
index 0000000..4ccd3bf
Binary files /dev/null and b/frontend/web/fonts/HelveticaMedium/HelveticaMedium.woff differ
diff --git a/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.eot b/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.eot
new file mode 100644
index 0000000..77f2b7a
Binary files /dev/null and b/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.eot differ
diff --git a/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.ttf b/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.ttf
new file mode 100644
index 0000000..668a705
Binary files /dev/null and b/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.ttf differ
diff --git a/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.woff b/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.woff
new file mode 100644
index 0000000..48d06e0
Binary files /dev/null and b/frontend/web/fonts/HelveticaMediumItaicl/HelveticaMediumItaicl.woff differ
diff --git a/frontend/web/fonts/HelveticaRegular/HelveticaRegular.eot b/frontend/web/fonts/HelveticaRegular/HelveticaRegular.eot
new file mode 100644
index 0000000..881e0ab
Binary files /dev/null and b/frontend/web/fonts/HelveticaRegular/HelveticaRegular.eot differ
diff --git a/frontend/web/fonts/HelveticaRegular/HelveticaRegular.ttf b/frontend/web/fonts/HelveticaRegular/HelveticaRegular.ttf
new file mode 100644
index 0000000..d944a13
Binary files /dev/null and b/frontend/web/fonts/HelveticaRegular/HelveticaRegular.ttf differ
diff --git a/frontend/web/fonts/HelveticaRegular/HelveticaRegular.woff b/frontend/web/fonts/HelveticaRegular/HelveticaRegular.woff
new file mode 100644
index 0000000..66d9328
Binary files /dev/null and b/frontend/web/fonts/HelveticaRegular/HelveticaRegular.woff differ
diff --git a/frontend/web/fonts/HelveticaThin/HelveticaThin.eot b/frontend/web/fonts/HelveticaThin/HelveticaThin.eot
new file mode 100644
index 0000000..619a96d
Binary files /dev/null and b/frontend/web/fonts/HelveticaThin/HelveticaThin.eot differ
diff --git a/frontend/web/fonts/HelveticaThin/HelveticaThin.ttf b/frontend/web/fonts/HelveticaThin/HelveticaThin.ttf
new file mode 100644
index 0000000..45b7e67
Binary files /dev/null and b/frontend/web/fonts/HelveticaThin/HelveticaThin.ttf differ
diff --git a/frontend/web/fonts/HelveticaThin/HelveticaThin.woff b/frontend/web/fonts/HelveticaThin/HelveticaThin.woff
new file mode 100644
index 0000000..8ea4d26
Binary files /dev/null and b/frontend/web/fonts/HelveticaThin/HelveticaThin.woff differ
diff --git a/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.eot b/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.eot
new file mode 100644
index 0000000..a5aa177
Binary files /dev/null and b/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.eot differ
diff --git a/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.ttf b/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.ttf
new file mode 100644
index 0000000..5dad877
Binary files /dev/null and b/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.ttf differ
diff --git a/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.woff b/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.woff
new file mode 100644
index 0000000..ef351c6
Binary files /dev/null and b/frontend/web/fonts/HelveticaThinItalic/HelveticaThinItalic.woff differ
diff --git a/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.eot b/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.eot
new file mode 100644
index 0000000..73910db
Binary files /dev/null and b/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.eot differ
diff --git a/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.ttf b/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.ttf
new file mode 100644
index 0000000..f4363c3
Binary files /dev/null and b/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.ttf differ
diff --git a/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.woff b/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.woff
new file mode 100644
index 0000000..7fa72fa
Binary files /dev/null and b/frontend/web/fonts/HelveticaUltraLight/HelveticaUltraLight.woff differ
diff --git a/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.eot b/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.eot
new file mode 100644
index 0000000..1803126
Binary files /dev/null and b/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.eot differ
diff --git a/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.ttf b/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.ttf
new file mode 100644
index 0000000..d12c1f6
Binary files /dev/null and b/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.ttf differ
diff --git a/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.woff b/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.woff
new file mode 100644
index 0000000..6b3fea5
Binary files /dev/null and b/frontend/web/fonts/HelveticaUltraLightItalic/HelveticaUltraLightItalic.woff differ
diff --git a/frontend/web/fonts/UbuntuBold/UbuntuBold.eot b/frontend/web/fonts/UbuntuBold/UbuntuBold.eot
new file mode 100644
index 0000000..f21132e
Binary files /dev/null and b/frontend/web/fonts/UbuntuBold/UbuntuBold.eot differ
diff --git a/frontend/web/fonts/UbuntuBold/UbuntuBold.ttf b/frontend/web/fonts/UbuntuBold/UbuntuBold.ttf
new file mode 100644
index 0000000..e733c57
Binary files /dev/null and b/frontend/web/fonts/UbuntuBold/UbuntuBold.ttf differ
diff --git a/frontend/web/fonts/UbuntuBold/UbuntuBold.woff b/frontend/web/fonts/UbuntuBold/UbuntuBold.woff
new file mode 100644
index 0000000..1a9daf4
Binary files /dev/null and b/frontend/web/fonts/UbuntuBold/UbuntuBold.woff differ
diff --git a/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.eot b/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.eot
new file mode 100644
index 0000000..67fc359
Binary files /dev/null and b/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.eot differ
diff --git a/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.ttf b/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.ttf
new file mode 100644
index 0000000..749cd24
Binary files /dev/null and b/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.ttf differ
diff --git a/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.woff b/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.woff
new file mode 100644
index 0000000..0969e79
Binary files /dev/null and b/frontend/web/fonts/UbuntuBoldItalic/UbuntuBoldItalic.woff differ
diff --git a/frontend/web/fonts/UbuntuItalic/UbuntuItalic.eot b/frontend/web/fonts/UbuntuItalic/UbuntuItalic.eot
new file mode 100644
index 0000000..08c98dc
Binary files /dev/null and b/frontend/web/fonts/UbuntuItalic/UbuntuItalic.eot differ
diff --git a/frontend/web/fonts/UbuntuItalic/UbuntuItalic.ttf b/frontend/web/fonts/UbuntuItalic/UbuntuItalic.ttf
new file mode 100644
index 0000000..b37ab87
Binary files /dev/null and b/frontend/web/fonts/UbuntuItalic/UbuntuItalic.ttf differ
diff --git a/frontend/web/fonts/UbuntuItalic/UbuntuItalic.woff b/frontend/web/fonts/UbuntuItalic/UbuntuItalic.woff
new file mode 100644
index 0000000..b908c95
Binary files /dev/null and b/frontend/web/fonts/UbuntuItalic/UbuntuItalic.woff differ
diff --git a/frontend/web/fonts/UbuntuLight/UbuntuLight.eot b/frontend/web/fonts/UbuntuLight/UbuntuLight.eot
new file mode 100644
index 0000000..c95586e
Binary files /dev/null and b/frontend/web/fonts/UbuntuLight/UbuntuLight.eot differ
diff --git a/frontend/web/fonts/UbuntuLight/UbuntuLight.ttf b/frontend/web/fonts/UbuntuLight/UbuntuLight.ttf
new file mode 100644
index 0000000..ec2e13c
Binary files /dev/null and b/frontend/web/fonts/UbuntuLight/UbuntuLight.ttf differ
diff --git a/frontend/web/fonts/UbuntuLight/UbuntuLight.woff b/frontend/web/fonts/UbuntuLight/UbuntuLight.woff
new file mode 100644
index 0000000..9d65f31
Binary files /dev/null and b/frontend/web/fonts/UbuntuLight/UbuntuLight.woff differ
diff --git a/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.eot b/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.eot
new file mode 100644
index 0000000..302e49f
Binary files /dev/null and b/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.eot differ
diff --git a/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.ttf b/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.ttf
new file mode 100644
index 0000000..bb6559a
Binary files /dev/null and b/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.ttf differ
diff --git a/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.woff b/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.woff
new file mode 100644
index 0000000..8f41c55
Binary files /dev/null and b/frontend/web/fonts/UbuntuLightItalic/UbuntuLightItalic.woff differ
diff --git a/frontend/web/fonts/UbuntuMedium/UbuntuMedium.eot b/frontend/web/fonts/UbuntuMedium/UbuntuMedium.eot
new file mode 100644
index 0000000..b824b76
Binary files /dev/null and b/frontend/web/fonts/UbuntuMedium/UbuntuMedium.eot differ
diff --git a/frontend/web/fonts/UbuntuMedium/UbuntuMedium.ttf b/frontend/web/fonts/UbuntuMedium/UbuntuMedium.ttf
new file mode 100644
index 0000000..8cfc2b0
Binary files /dev/null and b/frontend/web/fonts/UbuntuMedium/UbuntuMedium.ttf differ
diff --git a/frontend/web/fonts/UbuntuMedium/UbuntuMedium.woff b/frontend/web/fonts/UbuntuMedium/UbuntuMedium.woff
new file mode 100644
index 0000000..2e7f6ec
Binary files /dev/null and b/frontend/web/fonts/UbuntuMedium/UbuntuMedium.woff differ
diff --git a/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.eot b/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.eot
new file mode 100644
index 0000000..4caca07
Binary files /dev/null and b/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.eot differ
diff --git a/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.ttf b/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.ttf
new file mode 100644
index 0000000..7030705
Binary files /dev/null and b/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.ttf differ
diff --git a/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.woff b/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.woff
new file mode 100644
index 0000000..2a5606f
Binary files /dev/null and b/frontend/web/fonts/UbuntuMediumItalic/UbuntuMediumItalic.woff differ
diff --git a/frontend/web/fonts/UbuntuRegular/UbuntuRegular.eot b/frontend/web/fonts/UbuntuRegular/UbuntuRegular.eot
new file mode 100644
index 0000000..c3befbc
Binary files /dev/null and b/frontend/web/fonts/UbuntuRegular/UbuntuRegular.eot differ
diff --git a/frontend/web/fonts/UbuntuRegular/UbuntuRegular.ttf b/frontend/web/fonts/UbuntuRegular/UbuntuRegular.ttf
new file mode 100644
index 0000000..9a295e8
Binary files /dev/null and b/frontend/web/fonts/UbuntuRegular/UbuntuRegular.ttf differ
diff --git a/frontend/web/fonts/UbuntuRegular/UbuntuRegular.woff b/frontend/web/fonts/UbuntuRegular/UbuntuRegular.woff
new file mode 100644
index 0000000..7adfda1
Binary files /dev/null and b/frontend/web/fonts/UbuntuRegular/UbuntuRegular.woff differ
diff --git a/frontend/web/fonts/fontawesome-webfont.eot b/frontend/web/fonts/fontawesome-webfont.eot
new file mode 100644
index 0000000..a30335d
Binary files /dev/null and b/frontend/web/fonts/fontawesome-webfont.eot differ
diff --git a/frontend/web/fonts/fontawesome-webfont.svg b/frontend/web/fonts/fontawesome-webfont.svg
new file mode 100644
index 0000000..9f53245
--- /dev/null
+++ b/frontend/web/fonts/fontawesome-webfont.svg
@@ -0,0 +1,640 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/web/fonts/fontawesome-webfont.ttf b/frontend/web/fonts/fontawesome-webfont.ttf
new file mode 100644
index 0000000..d7994e1
Binary files /dev/null and b/frontend/web/fonts/fontawesome-webfont.ttf differ
diff --git a/frontend/web/fonts/fontawesome-webfont.woff b/frontend/web/fonts/fontawesome-webfont.woff
new file mode 100644
index 0000000..6fd4ede
Binary files /dev/null and b/frontend/web/fonts/fontawesome-webfont.woff differ
diff --git a/frontend/web/fonts/fontawesome-webfont.woff2 b/frontend/web/fonts/fontawesome-webfont.woff2
new file mode 100644
index 0000000..5560193
Binary files /dev/null and b/frontend/web/fonts/fontawesome-webfont.woff2 differ
diff --git a/frontend/web/images/aw_logo.png b/frontend/web/images/aw_logo.png
new file mode 100644
index 0000000..a0ee47f
Binary files /dev/null and b/frontend/web/images/aw_logo.png differ
diff --git a/frontend/web/images/bau_logo.png b/frontend/web/images/bau_logo.png
new file mode 100644
index 0000000..18c2720
Binary files /dev/null and b/frontend/web/images/bau_logo.png differ
diff --git a/frontend/web/images/category/1.png b/frontend/web/images/category/1.png
new file mode 100644
index 0000000..7da8870
Binary files /dev/null and b/frontend/web/images/category/1.png differ
diff --git a/frontend/web/images/category/10.png b/frontend/web/images/category/10.png
new file mode 100644
index 0000000..e8e58d9
Binary files /dev/null and b/frontend/web/images/category/10.png differ
diff --git a/frontend/web/images/category/11.png b/frontend/web/images/category/11.png
new file mode 100644
index 0000000..fe5b157
Binary files /dev/null and b/frontend/web/images/category/11.png differ
diff --git a/frontend/web/images/category/12.png b/frontend/web/images/category/12.png
new file mode 100644
index 0000000..694bd4e
Binary files /dev/null and b/frontend/web/images/category/12.png differ
diff --git a/frontend/web/images/category/13.png b/frontend/web/images/category/13.png
new file mode 100644
index 0000000..b1a79ff
Binary files /dev/null and b/frontend/web/images/category/13.png differ
diff --git a/frontend/web/images/category/14.png b/frontend/web/images/category/14.png
new file mode 100644
index 0000000..3194663
Binary files /dev/null and b/frontend/web/images/category/14.png differ
diff --git a/frontend/web/images/category/15.png b/frontend/web/images/category/15.png
new file mode 100644
index 0000000..2dbc904
Binary files /dev/null and b/frontend/web/images/category/15.png differ
diff --git a/frontend/web/images/category/2.png b/frontend/web/images/category/2.png
new file mode 100644
index 0000000..8bce442
Binary files /dev/null and b/frontend/web/images/category/2.png differ
diff --git a/frontend/web/images/category/3.png b/frontend/web/images/category/3.png
new file mode 100644
index 0000000..9d728a1
Binary files /dev/null and b/frontend/web/images/category/3.png differ
diff --git a/frontend/web/images/category/4.png b/frontend/web/images/category/4.png
new file mode 100644
index 0000000..5f14727
Binary files /dev/null and b/frontend/web/images/category/4.png differ
diff --git a/frontend/web/images/category/5.png b/frontend/web/images/category/5.png
new file mode 100644
index 0000000..8d78c0b
Binary files /dev/null and b/frontend/web/images/category/5.png differ
diff --git a/frontend/web/images/category/6.png b/frontend/web/images/category/6.png
new file mode 100644
index 0000000..001757a
Binary files /dev/null and b/frontend/web/images/category/6.png differ
diff --git a/frontend/web/images/category/7.png b/frontend/web/images/category/7.png
new file mode 100644
index 0000000..6325dc8
Binary files /dev/null and b/frontend/web/images/category/7.png differ
diff --git a/frontend/web/images/category/8.png b/frontend/web/images/category/8.png
new file mode 100644
index 0000000..362e621
Binary files /dev/null and b/frontend/web/images/category/8.png differ
diff --git a/frontend/web/images/category/9.png b/frontend/web/images/category/9.png
new file mode 100644
index 0000000..0345772
Binary files /dev/null and b/frontend/web/images/category/9.png differ
diff --git a/frontend/web/images/category/green_arrows.png b/frontend/web/images/category/green_arrows.png
new file mode 100644
index 0000000..0872f46
Binary files /dev/null and b/frontend/web/images/category/green_arrows.png differ
diff --git a/frontend/web/images/delivery01.png b/frontend/web/images/delivery01.png
new file mode 100644
index 0000000..57e1217
Binary files /dev/null and b/frontend/web/images/delivery01.png differ
diff --git a/frontend/web/images/delivery02.png b/frontend/web/images/delivery02.png
new file mode 100644
index 0000000..9f372e3
Binary files /dev/null and b/frontend/web/images/delivery02.png differ
diff --git a/frontend/web/images/fb_small_color.png b/frontend/web/images/fb_small_color.png
new file mode 100644
index 0000000..3813edd
Binary files /dev/null and b/frontend/web/images/fb_small_color.png differ
diff --git a/frontend/web/images/fon_up_slider.jpg b/frontend/web/images/fon_up_slider.jpg
new file mode 100644
index 0000000..82bf05b
Binary files /dev/null and b/frontend/web/images/fon_up_slider.jpg differ
diff --git a/frontend/web/images/head_down.png b/frontend/web/images/head_down.png
new file mode 100644
index 0000000..29febdc
Binary files /dev/null and b/frontend/web/images/head_down.png differ
diff --git a/frontend/web/images/head_up.png b/frontend/web/images/head_up.png
new file mode 100644
index 0000000..3c5e2db
Binary files /dev/null and b/frontend/web/images/head_up.png differ
diff --git a/frontend/web/images/ico-2.jpg b/frontend/web/images/ico-2.jpg
new file mode 100644
index 0000000..286598c
Binary files /dev/null and b/frontend/web/images/ico-2.jpg differ
diff --git a/frontend/web/images/ico_basket.png b/frontend/web/images/ico_basket.png
new file mode 100644
index 0000000..617b34d
Binary files /dev/null and b/frontend/web/images/ico_basket.png differ
diff --git a/frontend/web/images/ico_basket_white.png b/frontend/web/images/ico_basket_white.png
new file mode 100644
index 0000000..0b4c2b1
Binary files /dev/null and b/frontend/web/images/ico_basket_white.png differ
diff --git a/frontend/web/images/ico_home.png b/frontend/web/images/ico_home.png
new file mode 100644
index 0000000..96362f8
Binary files /dev/null and b/frontend/web/images/ico_home.png differ
diff --git a/frontend/web/images/ico_home_black.png b/frontend/web/images/ico_home_black.png
new file mode 100644
index 0000000..a5c7cb4
Binary files /dev/null and b/frontend/web/images/ico_home_black.png differ
diff --git a/frontend/web/images/ico_home_white.png b/frontend/web/images/ico_home_white.png
new file mode 100644
index 0000000..63a0191
Binary files /dev/null and b/frontend/web/images/ico_home_white.png differ
diff --git a/frontend/web/images/ico_note.png b/frontend/web/images/ico_note.png
new file mode 100644
index 0000000..8d84a1e
Binary files /dev/null and b/frontend/web/images/ico_note.png differ
diff --git a/frontend/web/images/ico_ok.png b/frontend/web/images/ico_ok.png
new file mode 100644
index 0000000..f18df01
Binary files /dev/null and b/frontend/web/images/ico_ok.png differ
diff --git a/frontend/web/images/ico_scales.png b/frontend/web/images/ico_scales.png
new file mode 100644
index 0000000..db3951a
Binary files /dev/null and b/frontend/web/images/ico_scales.png differ
diff --git a/frontend/web/images/ico_user.png b/frontend/web/images/ico_user.png
new file mode 100644
index 0000000..73132ee
Binary files /dev/null and b/frontend/web/images/ico_user.png differ
diff --git a/frontend/web/images/items/01.jpg b/frontend/web/images/items/01.jpg
new file mode 100644
index 0000000..a397fce
Binary files /dev/null and b/frontend/web/images/items/01.jpg differ
diff --git a/frontend/web/images/items/02.jpg b/frontend/web/images/items/02.jpg
new file mode 100644
index 0000000..666e8c5
Binary files /dev/null and b/frontend/web/images/items/02.jpg differ
diff --git a/frontend/web/images/items/03.jpg b/frontend/web/images/items/03.jpg
new file mode 100644
index 0000000..81e1095
Binary files /dev/null and b/frontend/web/images/items/03.jpg differ
diff --git a/frontend/web/images/items/04.jpg b/frontend/web/images/items/04.jpg
new file mode 100644
index 0000000..f18ec9b
Binary files /dev/null and b/frontend/web/images/items/04.jpg differ
diff --git a/frontend/web/images/items/11.png b/frontend/web/images/items/11.png
new file mode 100644
index 0000000..e9c3e26
Binary files /dev/null and b/frontend/web/images/items/11.png differ
diff --git a/frontend/web/images/items/12.png b/frontend/web/images/items/12.png
new file mode 100644
index 0000000..4ace3f8
Binary files /dev/null and b/frontend/web/images/items/12.png differ
diff --git a/frontend/web/images/items/13.png b/frontend/web/images/items/13.png
new file mode 100644
index 0000000..1bce2af
Binary files /dev/null and b/frontend/web/images/items/13.png differ
diff --git a/frontend/web/images/items/14.png b/frontend/web/images/items/14.png
new file mode 100644
index 0000000..ba06549
Binary files /dev/null and b/frontend/web/images/items/14.png differ
diff --git a/frontend/web/images/items/15.png b/frontend/web/images/items/15.png
new file mode 100644
index 0000000..6a52edf
Binary files /dev/null and b/frontend/web/images/items/15.png differ
diff --git a/frontend/web/images/items/16.png b/frontend/web/images/items/16.png
new file mode 100644
index 0000000..3d77b11
Binary files /dev/null and b/frontend/web/images/items/16.png differ
diff --git a/frontend/web/images/items/17.png b/frontend/web/images/items/17.png
new file mode 100644
index 0000000..da105f0
Binary files /dev/null and b/frontend/web/images/items/17.png differ
diff --git a/frontend/web/images/items/big_img.png b/frontend/web/images/items/big_img.png
new file mode 100644
index 0000000..bd82d31
Binary files /dev/null and b/frontend/web/images/items/big_img.png differ
diff --git a/frontend/web/images/li1.png b/frontend/web/images/li1.png
new file mode 100644
index 0000000..f02d9a6
Binary files /dev/null and b/frontend/web/images/li1.png differ
diff --git a/frontend/web/images/li3.png b/frontend/web/images/li3.png
new file mode 100644
index 0000000..ea42367
Binary files /dev/null and b/frontend/web/images/li3.png differ
diff --git a/frontend/web/images/logos/404.png b/frontend/web/images/logos/404.png
new file mode 100644
index 0000000..28880dd
Binary files /dev/null and b/frontend/web/images/logos/404.png differ
diff --git a/frontend/web/images/logos/ceresit.jpg b/frontend/web/images/logos/ceresit.jpg
new file mode 100644
index 0000000..9022959
Binary files /dev/null and b/frontend/web/images/logos/ceresit.jpg differ
diff --git a/frontend/web/images/logos/knauf.jpg b/frontend/web/images/logos/knauf.jpg
new file mode 100644
index 0000000..61c16da
Binary files /dev/null and b/frontend/web/images/logos/knauf.jpg differ
diff --git a/frontend/web/images/logos/kolorit.jpg b/frontend/web/images/logos/kolorit.jpg
new file mode 100644
index 0000000..f84633a
Binary files /dev/null and b/frontend/web/images/logos/kolorit.jpg differ
diff --git a/frontend/web/images/logos/rukki.jpg b/frontend/web/images/logos/rukki.jpg
new file mode 100644
index 0000000..4508146
Binary files /dev/null and b/frontend/web/images/logos/rukki.jpg differ
diff --git a/frontend/web/images/logos/tikkurila.jpg b/frontend/web/images/logos/tikkurila.jpg
new file mode 100644
index 0000000..464b810
Binary files /dev/null and b/frontend/web/images/logos/tikkurila.jpg differ
diff --git a/frontend/web/images/logos/triora.jpg b/frontend/web/images/logos/triora.jpg
new file mode 100644
index 0000000..21f0831
Binary files /dev/null and b/frontend/web/images/logos/triora.jpg differ
diff --git a/frontend/web/images/manufacturers/1.png b/frontend/web/images/manufacturers/1.png
new file mode 100644
index 0000000..ab24dc2
Binary files /dev/null and b/frontend/web/images/manufacturers/1.png differ
diff --git a/frontend/web/images/manufacturers/10.png b/frontend/web/images/manufacturers/10.png
new file mode 100644
index 0000000..b2dedda
Binary files /dev/null and b/frontend/web/images/manufacturers/10.png differ
diff --git a/frontend/web/images/manufacturers/11.png b/frontend/web/images/manufacturers/11.png
new file mode 100644
index 0000000..a6abf2b
Binary files /dev/null and b/frontend/web/images/manufacturers/11.png differ
diff --git a/frontend/web/images/manufacturers/12.png b/frontend/web/images/manufacturers/12.png
new file mode 100644
index 0000000..a0dcf7b
Binary files /dev/null and b/frontend/web/images/manufacturers/12.png differ
diff --git a/frontend/web/images/manufacturers/13.png b/frontend/web/images/manufacturers/13.png
new file mode 100644
index 0000000..0dbf003
Binary files /dev/null and b/frontend/web/images/manufacturers/13.png differ
diff --git a/frontend/web/images/manufacturers/14.png b/frontend/web/images/manufacturers/14.png
new file mode 100644
index 0000000..a72637f
Binary files /dev/null and b/frontend/web/images/manufacturers/14.png differ
diff --git a/frontend/web/images/manufacturers/15.png b/frontend/web/images/manufacturers/15.png
new file mode 100644
index 0000000..0d56f21
Binary files /dev/null and b/frontend/web/images/manufacturers/15.png differ
diff --git a/frontend/web/images/manufacturers/16.png b/frontend/web/images/manufacturers/16.png
new file mode 100644
index 0000000..a7dc9b2
Binary files /dev/null and b/frontend/web/images/manufacturers/16.png differ
diff --git a/frontend/web/images/manufacturers/17.png b/frontend/web/images/manufacturers/17.png
new file mode 100644
index 0000000..b2aaf4f
Binary files /dev/null and b/frontend/web/images/manufacturers/17.png differ
diff --git a/frontend/web/images/manufacturers/18.png b/frontend/web/images/manufacturers/18.png
new file mode 100644
index 0000000..8bf1eae
Binary files /dev/null and b/frontend/web/images/manufacturers/18.png differ
diff --git a/frontend/web/images/manufacturers/19.png b/frontend/web/images/manufacturers/19.png
new file mode 100644
index 0000000..daf9daa
Binary files /dev/null and b/frontend/web/images/manufacturers/19.png differ
diff --git a/frontend/web/images/manufacturers/2.png b/frontend/web/images/manufacturers/2.png
new file mode 100644
index 0000000..0ea46c5
Binary files /dev/null and b/frontend/web/images/manufacturers/2.png differ
diff --git a/frontend/web/images/manufacturers/20.png b/frontend/web/images/manufacturers/20.png
new file mode 100644
index 0000000..0eca99d
Binary files /dev/null and b/frontend/web/images/manufacturers/20.png differ
diff --git a/frontend/web/images/manufacturers/3.png b/frontend/web/images/manufacturers/3.png
new file mode 100644
index 0000000..9fb6903
Binary files /dev/null and b/frontend/web/images/manufacturers/3.png differ
diff --git a/frontend/web/images/manufacturers/4.png b/frontend/web/images/manufacturers/4.png
new file mode 100644
index 0000000..6b13fa4
Binary files /dev/null and b/frontend/web/images/manufacturers/4.png differ
diff --git a/frontend/web/images/manufacturers/5.png b/frontend/web/images/manufacturers/5.png
new file mode 100644
index 0000000..8e26674
Binary files /dev/null and b/frontend/web/images/manufacturers/5.png differ
diff --git a/frontend/web/images/manufacturers/6.png b/frontend/web/images/manufacturers/6.png
new file mode 100644
index 0000000..af37318
Binary files /dev/null and b/frontend/web/images/manufacturers/6.png differ
diff --git a/frontend/web/images/manufacturers/7.png b/frontend/web/images/manufacturers/7.png
new file mode 100644
index 0000000..d45b2ac
Binary files /dev/null and b/frontend/web/images/manufacturers/7.png differ
diff --git a/frontend/web/images/manufacturers/8.png b/frontend/web/images/manufacturers/8.png
new file mode 100644
index 0000000..ecdb896
Binary files /dev/null and b/frontend/web/images/manufacturers/8.png differ
diff --git a/frontend/web/images/manufacturers/9.png b/frontend/web/images/manufacturers/9.png
new file mode 100644
index 0000000..dc45b7b
Binary files /dev/null and b/frontend/web/images/manufacturers/9.png differ
diff --git a/frontend/web/images/manufacturers/manufacturers.png b/frontend/web/images/manufacturers/manufacturers.png
new file mode 100644
index 0000000..a7946f5
Binary files /dev/null and b/frontend/web/images/manufacturers/manufacturers.png differ
diff --git a/frontend/web/images/modal_capcha.png b/frontend/web/images/modal_capcha.png
new file mode 100644
index 0000000..0a52230
Binary files /dev/null and b/frontend/web/images/modal_capcha.png differ
diff --git a/frontend/web/images/modal_close_btn.png b/frontend/web/images/modal_close_btn.png
new file mode 100644
index 0000000..f1b483d
Binary files /dev/null and b/frontend/web/images/modal_close_btn.png differ
diff --git a/frontend/web/images/nc_item_bottom.png b/frontend/web/images/nc_item_bottom.png
new file mode 100644
index 0000000..e3713ee
Binary files /dev/null and b/frontend/web/images/nc_item_bottom.png differ
diff --git a/frontend/web/images/new_fon_blue.jpg b/frontend/web/images/new_fon_blue.jpg
new file mode 100644
index 0000000..d5593ac
Binary files /dev/null and b/frontend/web/images/new_fon_blue.jpg differ
diff --git a/frontend/web/images/new_fon_blue.png b/frontend/web/images/new_fon_blue.png
new file mode 100644
index 0000000..b8a13f8
Binary files /dev/null and b/frontend/web/images/new_fon_blue.png differ
diff --git a/frontend/web/images/no_photo.png b/frontend/web/images/no_photo.png
new file mode 100644
index 0000000..aef9e08
Binary files /dev/null and b/frontend/web/images/no_photo.png differ
diff --git a/frontend/web/images/no_photo_big.png b/frontend/web/images/no_photo_big.png
new file mode 100644
index 0000000..fc71420
Binary files /dev/null and b/frontend/web/images/no_photo_big.png differ
diff --git a/frontend/web/images/ok_icon_green.png b/frontend/web/images/ok_icon_green.png
new file mode 100644
index 0000000..2809faf
Binary files /dev/null and b/frontend/web/images/ok_icon_green.png differ
diff --git a/frontend/web/images/payment01.png b/frontend/web/images/payment01.png
new file mode 100644
index 0000000..3d50e79
Binary files /dev/null and b/frontend/web/images/payment01.png differ
diff --git a/frontend/web/images/pr_img1.jpg b/frontend/web/images/pr_img1.jpg
new file mode 100644
index 0000000..58be45c
Binary files /dev/null and b/frontend/web/images/pr_img1.jpg differ
diff --git a/frontend/web/images/pr_img2.jpg b/frontend/web/images/pr_img2.jpg
new file mode 100644
index 0000000..adeff3d
Binary files /dev/null and b/frontend/web/images/pr_img2.jpg differ
diff --git a/frontend/web/images/pr_img3.jpg b/frontend/web/images/pr_img3.jpg
new file mode 100644
index 0000000..5dd33bc
Binary files /dev/null and b/frontend/web/images/pr_img3.jpg differ
diff --git a/frontend/web/images/pr_img4.jpg b/frontend/web/images/pr_img4.jpg
new file mode 100644
index 0000000..16df53c
Binary files /dev/null and b/frontend/web/images/pr_img4.jpg differ
diff --git a/frontend/web/images/pr_img5.jpg b/frontend/web/images/pr_img5.jpg
new file mode 100644
index 0000000..74767e0
Binary files /dev/null and b/frontend/web/images/pr_img5.jpg differ
diff --git a/frontend/web/images/pr_img6.jpg b/frontend/web/images/pr_img6.jpg
new file mode 100644
index 0000000..125ec74
Binary files /dev/null and b/frontend/web/images/pr_img6.jpg differ
diff --git a/frontend/web/images/prods_grey_fon.png b/frontend/web/images/prods_grey_fon.png
new file mode 100644
index 0000000..de04e47
Binary files /dev/null and b/frontend/web/images/prods_grey_fon.png differ
diff --git a/frontend/web/images/search.png b/frontend/web/images/search.png
new file mode 100644
index 0000000..4a9b72f
Binary files /dev/null and b/frontend/web/images/search.png differ
diff --git a/frontend/web/images/services01.png b/frontend/web/images/services01.png
new file mode 100644
index 0000000..01d877c
Binary files /dev/null and b/frontend/web/images/services01.png differ
diff --git a/frontend/web/images/services02.png b/frontend/web/images/services02.png
new file mode 100644
index 0000000..c8e082b
Binary files /dev/null and b/frontend/web/images/services02.png differ
diff --git a/frontend/web/images/services03.png b/frontend/web/images/services03.png
new file mode 100644
index 0000000..4f67172
Binary files /dev/null and b/frontend/web/images/services03.png differ
diff --git a/frontend/web/images/services04.png b/frontend/web/images/services04.png
new file mode 100644
index 0000000..74495bf
Binary files /dev/null and b/frontend/web/images/services04.png differ
diff --git a/frontend/web/images/slider_fon_fanera.jpg b/frontend/web/images/slider_fon_fanera.jpg
new file mode 100644
index 0000000..4da7b29
Binary files /dev/null and b/frontend/web/images/slider_fon_fanera.jpg differ
diff --git a/frontend/web/images/slider_left.png b/frontend/web/images/slider_left.png
new file mode 100644
index 0000000..c91014b
Binary files /dev/null and b/frontend/web/images/slider_left.png differ
diff --git a/frontend/web/images/slider_left_hover.png b/frontend/web/images/slider_left_hover.png
new file mode 100644
index 0000000..460feb0
Binary files /dev/null and b/frontend/web/images/slider_left_hover.png differ
diff --git a/frontend/web/images/slider_left_white.png b/frontend/web/images/slider_left_white.png
new file mode 100644
index 0000000..57689f6
Binary files /dev/null and b/frontend/web/images/slider_left_white.png differ
diff --git a/frontend/web/images/slider_right.png b/frontend/web/images/slider_right.png
new file mode 100644
index 0000000..7506196
Binary files /dev/null and b/frontend/web/images/slider_right.png differ
diff --git a/frontend/web/images/slider_right_hover.png b/frontend/web/images/slider_right_hover.png
new file mode 100644
index 0000000..179e854
Binary files /dev/null and b/frontend/web/images/slider_right_hover.png differ
diff --git a/frontend/web/images/slider_right_white.png b/frontend/web/images/slider_right_white.png
new file mode 100644
index 0000000..7e5de6e
Binary files /dev/null and b/frontend/web/images/slider_right_white.png differ
diff --git a/frontend/web/images/top_fon_yellow.png b/frontend/web/images/top_fon_yellow.png
new file mode 100644
index 0000000..e64848f
Binary files /dev/null and b/frontend/web/images/top_fon_yellow.png differ
diff --git a/frontend/web/images/vk_small_color.png b/frontend/web/images/vk_small_color.png
new file mode 100644
index 0000000..c1433bc
Binary files /dev/null and b/frontend/web/images/vk_small_color.png differ
diff --git a/frontend/web/images/warning_form.jpg b/frontend/web/images/warning_form.jpg
new file mode 100644
index 0000000..68ed96b
Binary files /dev/null and b/frontend/web/images/warning_form.jpg differ
diff --git a/frontend/web/images/why01.png b/frontend/web/images/why01.png
new file mode 100644
index 0000000..fc0ee9b
Binary files /dev/null and b/frontend/web/images/why01.png differ
diff --git a/frontend/web/images/why02.png b/frontend/web/images/why02.png
new file mode 100644
index 0000000..192e894
Binary files /dev/null and b/frontend/web/images/why02.png differ
diff --git a/frontend/web/images/why03.png b/frontend/web/images/why03.png
new file mode 100644
index 0000000..648d2db
Binary files /dev/null and b/frontend/web/images/why03.png differ
diff --git a/frontend/web/images/why04.png b/frontend/web/images/why04.png
new file mode 100644
index 0000000..1df340e
Binary files /dev/null and b/frontend/web/images/why04.png differ
diff --git a/frontend/web/images/why05.png b/frontend/web/images/why05.png
new file mode 100644
index 0000000..902aaa7
Binary files /dev/null and b/frontend/web/images/why05.png differ
diff --git a/frontend/web/images/why06.png b/frontend/web/images/why06.png
new file mode 100644
index 0000000..69fe5ed
Binary files /dev/null and b/frontend/web/images/why06.png differ
diff --git a/frontend/web/images/why07.png b/frontend/web/images/why07.png
new file mode 100644
index 0000000..d885d8c
Binary files /dev/null and b/frontend/web/images/why07.png differ
diff --git a/frontend/web/images/why08.png b/frontend/web/images/why08.png
new file mode 100644
index 0000000..efedc7c
Binary files /dev/null and b/frontend/web/images/why08.png differ
diff --git a/frontend/web/images/why_us_fon.png b/frontend/web/images/why_us_fon.png
new file mode 100644
index 0000000..f34e0ef
Binary files /dev/null and b/frontend/web/images/why_us_fon.png differ
diff --git a/frontend/web/images/yt_small_color.png b/frontend/web/images/yt_small_color.png
new file mode 100644
index 0000000..d7ebd77
Binary files /dev/null and b/frontend/web/images/yt_small_color.png differ
diff --git a/frontend/web/js/basket.js b/frontend/web/js/basket.js
new file mode 100644
index 0000000..173662a
--- /dev/null
+++ b/frontend/web/js/basket.js
@@ -0,0 +1,181 @@
+$(document).ready(function(){
+
+ var result_block = $('.basket_result');
+ var one_item_block = $('.busket_block');
+
+ function countItems(){
+ var length = $('.busket_modal_01').find('.order_list_li').length;
+ if(length >= 1){
+ $('.head_basket_count').html(length);
+ $('.all_count').html(length);
+ } else {
+ $('.head_basket_count').html('');
+ $('.all_count').html('');
+ }
+ }
+
+
+
+ function changeAjaxPrice(id, num){
+ $.post( "/orders/buy-items", {id: id, num:num}, function( data ) {
+ });
+ }
+
+ function countPrise(block){
+ var totalBlock = block.parents('.order_list');
+ var total_price = 0;
+ totalBlock.find('.price_val').each(function(){
+ total_price += +$(this).html();
+ });
+ $('.all_price_span').html(total_price);
+ }
+
+
+ $('.item').on('click', '.basket_add_but', function(e){
+ var id = $(this).data('id');
+ $.post( "/orders/buy-items", {id: id, num:1}, function( data ) {
+ $('.basket_result').each(function(){
+ $(this).html(data);
+ countItems();
+ });
+
+ });
+
+ });
+
+ $('.main_cont_wrap').on('click', '.cart_btn', function(e){
+ var id = $(this).data('id');
+ var num = one_item_block.find('.buy_one_item').val();
+ $.post( "/orders/buy-items", {id: id, num:num}, function( data ) {
+ $('.basket_result').each(function(){
+ $(this).html(data)
+ });
+ });
+
+ });
+
+ result_block.on('click', '.delete_item_btn', function(){
+ var block = $(this).parents('.order_list_li');
+
+
+ var id = block.data('id');
+
+ $.post( "/orders/delete", {id: id}, function( data ) {
+ });
+ var forCount = block.parents('ul');
+ $('.order_list_li[data-id='+id+']').each(function(){
+ var block = $(this);
+ block.remove();
+ });
+ countPrise(forCount);
+ countItems();
+
+
+
+ });
+
+ result_block.on('click', '.button_minus', function(){
+ var block = $(this).parents('.order_list_li');
+ var price_block = block.find('.price_val');
+ var input = block.find('input');
+ var number = input.val();
+ var id = block.data('id');
+
+ if(number > 1){
+ number--;
+ input.val(number);
+ var price = price_block.data('price');
+ var new_price = number * +price;
+ price_block.html(new_price);
+ changeAjaxPrice(id, number);
+ synchronizationPriceData(id, number);
+ }
+
+ countPrise(block);
+ });
+
+
+ result_block.on('click', '.button_plus', function(){
+ var block = $(this).parents('.order_list_li');
+ var price_block = block.find('.price_val');
+ var input = block.find('input');
+ var number = input.val();
+ var id = block.data('id');
+
+ number++;
+ input.val(number);
+ var price = price_block.data('price');
+ var new_price = number * +price;
+ price_block.html(new_price);
+
+ changeAjaxPrice(id, number);
+ synchronizationPriceData(id, number);
+ countPrise(block);
+ });
+
+ result_block.on('change', '.buy_one_item', function(){
+ var block = $(this).parents('.order_list_li');
+ var num = $(this).val();
+ var price_block = block.find('.price_val');
+ var price = price_block.data('price');
+ var id = block.data('id');
+
+ var new_price = num * +price;
+ price_block.html(new_price);
+ changeAjaxPrice(id, num);
+ synchronizationPriceData(id, num);
+ countPrise(block);
+ });
+
+ function synchronizationPriceData(id, number){
+ $('.order_list_li[data-id='+id+']').each(function(){
+ var block = $(this);
+ block.find('input').val(number);
+ var price_block = block.find('.price_val');
+ var price = price_block.data('price');
+ var new_price = number * +price;
+ price_block.html(new_price);
+ });
+ }
+
+
+
+ one_item_block.on('click', '.button_minus', function(){
+ var input = one_item_block.find('.buy_one_item');
+ var number = input.val();
+ if(number > 1){
+ number--;
+ input.val(number);
+ }
+ });
+
+
+ one_item_block.on('click', '.button_plus', function(){
+ var input = one_item_block.find('.buy_one_item');
+ var number = input.val();
+ number++;
+ input.val(number);
+ });
+
+ /****************************compare and bookmarks********************************************/
+
+ function addItemToCompare(id){
+ $.post( "/orders/compare", {id: id}, function( data ) {
+ });
+ }
+
+ $('#add_to_compare').click(function (event) {
+ event.preventDefault();
+ var id = $('#one_item_block').data('id');
+ addItemToCompare(id);
+ });
+
+ $('#add_to_bookmarks').click(function(event){
+ event.preventDefault();
+ var id = $('#one_item_block').data('id');
+ $.post( "/orders/bookmarks", {id: id}, function( data ) {
+ });
+ });
+
+
+});
\ No newline at end of file
diff --git a/frontend/web/js/jquery.jcarousellite-1.0.1.js b/frontend/web/js/jquery.jcarousellite-1.0.1.js
new file mode 100644
index 0000000..51497f4
--- /dev/null
+++ b/frontend/web/js/jquery.jcarousellite-1.0.1.js
@@ -0,0 +1,342 @@
+/**
+ * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
+ * @requires jQuery v1.2 or above
+ *
+ * http://gmarwaha.com/jquery/jcarousellite/
+ *
+ * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Version: 1.0.1
+ * Note: Requires jquery 1.2 or above from version 1.0.1
+ */
+
+/**
+ * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
+ *
+ * The HTML markup that is used to build the carousel can be as simple as...
+ *
+ *
+ *
+ * As you can see, this snippet is nothing but a simple div containing an unordered list of images.
+ * You don't need any special "class" attribute, or a special "css" file for this plugin.
+ * I am using a class attribute just for the sake of explanation here.
+ *
+ * To navigate the elements of the carousel, you need some kind of navigation buttons.
+ * For example, you will need a "previous" button to go backward, and a "next" button to go forward.
+ * This need not be part of the carousel "div" itself. It can be any element in your page.
+ * Lets assume that the following elements in your document can be used as next, and prev buttons...
+ *
+ *
<<
+ *
>>
+ *
+ * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
+ * navigation buttons as options.
+ *
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev"
+ * });
+ *
+ * That's it, you would have now converted your raw div, into a magnificient carousel.
+ *
+ * There are quite a few other options that you can use to customize it though.
+ * Each will be explained with an example below.
+ *
+ * @param an options object - You can specify all the options shown below as an options object param.
+ *
+ * @option btnPrev, btnNext : string - no defaults
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev"
+ * });
+ * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
+ *
+ * @option btnGo - array - no defaults
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * btnGo: [".0", ".1", ".2"]
+ * });
+ * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
+ * the item number within the carousel, you can use this option. Just supply an array of selectors for each element
+ * in the carousel. The index of the array represents the index of the element. What i mean is, if the
+ * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
+ * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
+ * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
+ * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
+ * The best part is that, the tab will "slide" based on the provided effect. :-)
+ *
+ * @option mouseWheel : boolean - default is false
+ * @example
+ * $(".carousel").jCarouselLite({
+ * mouseWheel: true
+ * });
+ * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
+ * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
+ * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
+ * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
+ * as well. They complement each other. To use both together, just supply the options required for both as shown below.
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * mouseWheel: true
+ * });
+ *
+ * @option auto : number - default is null, meaning autoscroll is disabled by default
+ * @example
+ * $(".carousel").jCarouselLite({
+ * auto: 800,
+ * speed: 500
+ * });
+ * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
+ * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
+ * Specify this value and magically your carousel will start auto scrolling.
+ *
+ * @option speed : number - 200 is default
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * speed: 800
+ * });
+ * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
+ * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
+ *
+ * @option easing : string - no easing effects by default.
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * easing: "bounceout"
+ * });
+ * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
+ * the carousel will slide based on the provided easing effect.
+ *
+ * @option vertical : boolean - default is false
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * vertical: true
+ * });
+ * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
+ * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
+ * display horizontally. The next and prev items will slide the items from left-right in this case.
+ *
+ * @option circular : boolean - default is true
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * circular: false
+ * });
+ * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
+ * element, you will automatically slide to the first element and vice versa. If you set circular to false, then
+ * if you click on the "next" button after you reach the last element, you will stay in the last element itself
+ * and similarly for "previous" button and first element.
+ *
+ * @option visible : number - default is 3
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * visible: 4
+ * });
+ * @desc This specifies the number of items visible at all times within the carousel. The default is 3.
+ * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
+ * last item half visible. This gives you the effect of showing the user that there are more images to the right.
+ *
+ * @option start : number - default is 0
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * start: 2
+ * });
+ * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
+ * has a start of 0, and so on.
+ *
+ * @option scrool : number - default is 1
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * scroll: 2
+ * });
+ * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
+ * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
+ * 2 items when you click the next or previous buttons.
+ *
+ * @option beforeStart, afterEnd : function - callbacks
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * beforeStart: function(a) {
+ * alert("Before animation starts:" + a);
+ * },
+ * afterEnd: function(a) {
+ * alert("After animation ends:" + a);
+ * }
+ * });
+ * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
+ * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
+ * are visible at the time of callback.
+ *
+ *
+ * @cat Plugins/Image Gallery
+ * @author Ganeshji Marwaha/ganeshread@gmail.com
+ */
+
+(function($) { // Compliant with jquery.noConflict()
+$.fn.jCarouselLite = function(o) {
+ o = $.extend({
+ btnPrev: null,
+ btnNext: null,
+ btnGo: null,
+ mouseWheel: false,
+ auto: null,
+
+ speed: 200,
+ easing: null,
+
+ vertical: false,
+ circular: true,
+ visible: 3,
+ start: 0,
+ scroll: 1,
+
+ beforeStart: null,
+ afterEnd: null
+ }, o || {});
+
+ return this.each(function() { // Returns the element collection. Chainable.
+
+ var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
+ var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
+
+ if(o.circular) {
+ ul.prepend(tLi.slice(tl-v-1+1).clone())
+ .append(tLi.slice(0,v).clone());
+ o.start += v;
+ }
+
+ var li = $("li", ul), itemLength = li.size(), curr = o.start;
+ div.css("visibility", "visible");
+
+ li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
+ ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
+ div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
+
+ var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation
+ var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items)
+ var divSize = liSize * v; // size of entire div(total length for just the visible items)
+
+ li.css({width: li.width(), height: li.height()});
+ ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
+
+ div.css(sizeCss, divSize+"px"); // Width of the DIV. length of visible images
+
+ if(o.btnPrev)
+ $(o.btnPrev).click(function() {
+ return go(curr-o.scroll);
+ });
+
+ if(o.btnNext)
+ $(o.btnNext).click(function() {
+ return go(curr+o.scroll);
+ });
+
+ if(o.btnGo)
+ $.each(o.btnGo, function(i, val) {
+ $(val).click(function() {
+ return go(o.circular ? o.visible+i : i);
+ });
+ });
+
+ if(o.mouseWheel && div.mousewheel)
+ div.mousewheel(function(e, d) {
+ return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
+ });
+
+ if(o.auto)
+ setInterval(function() {
+ go(curr+o.scroll);
+ }, o.auto+o.speed);
+
+ function vis() {
+ return li.slice(curr).slice(0,v);
+ };
+
+ function go(to) {
+ if(!running) {
+
+ if(o.beforeStart)
+ o.beforeStart.call(this, vis());
+
+ if(o.circular) { // If circular we are in first or last, then goto the other end
+ if(to<=o.start-v-1) { // If first, then goto last
+ ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
+ // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
+ curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
+ } else if(to>=itemLength-v+1) { // If last, then goto first
+ ul.css(animCss, -( (v) * liSize ) + "px" );
+ // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
+ curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
+ } else curr = to;
+ } else { // If non-circular and to points to first or last, we just return.
+ if(to<0 || to>itemLength-v) return;
+ else curr = to;
+ } // If neither overrides it, the curr will still be "to" and we can proceed.
+
+ running = true;
+
+ ul.animate(
+ animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
+ function() {
+ if(o.afterEnd)
+ o.afterEnd.call(this, vis());
+ running = false;
+ }
+ );
+ // Disable buttons when the carousel reaches the last/first, and enable when not
+ if(!o.circular) {
+ $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
+ $( (curr-o.scroll<0 && o.btnPrev)
+ ||
+ (curr+o.scroll > itemLength-v && o.btnNext)
+ ||
+ []
+ ).addClass("disabled");
+ }
+
+ }
+ return false;
+ };
+ });
+};
+
+function css(el, prop) {
+ return parseInt($.css(el[0], prop)) || 0;
+};
+function width(el) {
+
+ return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
+};
+function height(el) {
+ return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/frontend/web/js/jquery.maskedinput.min.js b/frontend/web/js/jquery.maskedinput.min.js
new file mode 100644
index 0000000..e4112e3
--- /dev/null
+++ b/frontend/web/js/jquery.maskedinput.min.js
@@ -0,0 +1,7 @@
+/*
+ jQuery Masked Input Plugin
+ Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
+ Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
+ Version: 1.4.1
+*/
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a
=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.beging)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
\ No newline at end of file
diff --git a/frontend/web/js/my_scripts.js b/frontend/web/js/my_scripts.js
new file mode 100644
index 0000000..acd74a8
--- /dev/null
+++ b/frontend/web/js/my_scripts.js
@@ -0,0 +1,524 @@
+$(document).ready(function(){
+ // ion tabs
+ $.ionTabs("#tabs_1");
+
+ // ion checkradio init
+ $("input[type='radio'], input[type='checkbox']").ionCheckRadio();
+
+ // filter open li
+ var filter_list = $('.filter_list ul li .arrow');
+
+ filter_list.on('click', function(){
+ $(this).next().slideToggle(300);
+ var this_img = $(this).children('img');
+ if (this_img.attr('src') === "/images/head_down.png" ) {
+ this_img.attr('src', '/images/head_up.png');
+ } else {
+ this_img.attr('src', '/images/head_down.png');
+ };
+ });
+
+ $('.form_checkbox_reset').click(function(e){
+ e.preventDefault();
+ $('.price_filter input[type="checkbox"]').prop('checked', false);
+ $('.price_filter label').removeClass('checked');
+ });
+
+
+ // CHANGE ACTIVE CLASS
+ function change_right(){
+ var main_div = $('.main_img_slide'),
+
+ arrow_right = $('.slider_arrow_right'),
+ arrow_left = $('.slider_arrow_left'),
+ main_img = $('.main_img img');
+
+
+ arrow_right.on('click', function(){
+ var next = $('.small_img_block.active').next();
+ var next_attr = next.children().attr('src');
+ if (next.hasClass('small_img_block')) {
+ main_div.find('.active').removeClass('active');
+ next.addClass('active');
+ main_img.attr('src', next_attr);
+ };
+
+ });
+ }
+
+ // CHANGE ACTIVE CLASS
+ function change_left(){
+ var main_div = $('.main_img_slide'),
+
+ arrow_right = $('.slider_arrow_right'),
+ arrow_left = $('.slider_arrow_left'),
+ main_img = $('.main_img img');
+
+
+ arrow_left.on('click', function(){
+ var prev = $('.small_img_block.active').prev();
+ var prev_attr = prev.children().attr('src');
+ if (prev.hasClass('small_img_block')) {
+ main_div.find('.active').removeClass('active');
+ prev.addClass('active');
+ main_img.attr('src', prev_attr);
+ };
+
+ });
+ };
+ var arrow_right = $('.slider_arrow_right'),
+ arrow_left = $('.slider_arrow_left');
+ // change active class init
+ arrow_right.on('click', change_right());
+ arrow_left.on('click', change_left());
+
+ // arrow left hover
+ arrow_left.hover(
+ function(){
+ $(this).attr('src', '/images/slider_left_hover.png');
+ }, function(){
+ $(this).attr('src', '/images/slider_left.png');
+ });
+
+ // arrow right hover
+ arrow_right.hover(
+ function(){
+ $(this).attr('src', '/images/slider_right_hover.png');
+ }, function(){
+ $(this).attr('src', '/images/slider_right.png');
+ });
+
+ // добавить в корзину - счетчик + - товар
+ var open_card_item_price = $('.counter').children('.price'),
+ counter_item_count = $('.counter').find('.count_number'),
+ state_price = 1*($('.counter').children('.price').html());
+
+
+
+ // активный класс для корзины
+ var basket_order_list = $('.order_list').find('.order_list_li');
+ /*basket_order_list.click(function(){
+ basket_order_list.removeClass('active');
+ $(this).addClass('active');
+ // console.log('hello');
+ });*/
+
+ // оформить заказ сумма всех товаров в корзине
+ var basket_all_items = $('.all_price').find('.all_count'), // количество товаров в корзине
+ basket_all_price = $('.all_price').find('.all_price'), // общая сумма за все товары
+ basket_each_price = basket_order_list.children('.price'), // цена товара(ов)
+ basket_each_count = basket_order_list.children('.how_many'); // количество каждого товара
+ // console.log(basket_each_price);
+
+ //function basket_all_prices() {
+ // var all_count = 0;
+ // var all_price = 0;
+ // for (var i = basket_each_count.length - 1; i >= 0; i--) {
+ // var temp = basket_each_count[i].innerHTML;
+ // var temp_price = basket_each_price[i].innerHTML;
+ // all_count += parseInt(temp);
+ // all_price += parseFloat(temp_price);
+ // };
+ // basket_all_items.text(all_count);
+ // basket_all_price.text(all_price.toFixed(2));
+ //}
+ //basket_all_prices();
+
+
+ // modal widows
+ function modal_windows() {
+ $(".modal_wrapper_login").append("
");
+ $(".modal_wrapper_reg").append("
");
+ $(".forgot_pass_modal_wrapper").append("
");
+
+ var reg_wrap = $('.modal_wrapper_reg'), // окно регистрации
+ log_wrap = $('.modal_wrapper_login'), // окно логина
+ forgot_pass_wrap = $('.forgot_pass_modal_wrapper'), // окно забыли пароль
+ forgot_pass_success_wrap = $('.forgot_pass_success_wrapper'), // окошко успешно отправлен пароль
+ forgot_pass_success_open_btn = $('.forgot_pass_modal_wrapper').find('.my_cust_btn');
+ forget_pass_again_btn = $('.forgot_pass_success_wrapper').find('.my_cust_btn'),
+ log_open_btn = $('.login_button_lu'), // окно логина
+ reg_open_btn = $('.reg_button_lu'), // кнопка открыть
+ consultation_open_btn = $('.consultation_btn'), // кнопка консультации
+ consultation_btn = $('.consultation_modal button'),
+ consultation_modal = $('.consultation_modal'),
+ modal_busket_open = $('.basket_add_but, .cart_btn'), // открыть модалку корзины
+ modal_busket_header_open = $('i.head-down.bh_cell'), // открыть корзину в хедере
+ modal_busket_header = $('.busket_modal_header'), // модальная корзина хедер
+ modal_busket_header_cont = $('.busket_modal_header .busket_bottom_btn .close'),
+ modal_busket_cont = $('.busket_bottom_btn .close'), // ссылка модалки корзины - продолжить покупки
+ forgot_pass_open_btn = $('.forgot_pass_link'), // ссылка на окно - забыли пароль
+ close_btn = $('.modal_close_btn'), // кнопка закрыть регистрацию
+ doc_h = $(document).height(),
+ callback_wrap = $('.callback_wrapper'),
+ callback_open_btn = $('.phone_me_head button'),
+ busket_modal_wrapper = $('.busket_modal_wrapper'),
+ main_wrap = $('.modal_wrapper');
+ reg_wrap_btn = $('.modal_wrapper_reg').find('button');
+
+
+ reg_wrap.css({'height': doc_h}); // высота заднего фона = высоте документа
+ log_wrap.css({'height': doc_h}); // высота заднего фона = высоте документа
+ forgot_pass_wrap.css({'height': doc_h}); // высота заднего фона = высоте документа
+ forgot_pass_success_wrap.css({'height': doc_h}); // высота заднего фона = высоте документа
+ callback_wrap.css({'height': doc_h}); // высота заднего фона = высоте документа
+ busket_modal_wrapper.css({'height' : doc_h}); // высота заднего фона = высоте документа
+
+
+
+ $('body').keydown(function(event){
+ if (event.which == 27) {
+ $(this).parent().find("input").val('');
+ reg_wrap.fadeOut(200);
+ log_wrap.fadeOut(200);
+ forgot_pass_wrap.fadeOut(200);
+ forgot_pass_success_wrap.fadeOut(200);
+ callback_wrap.fadeOut(200);
+ };
+ });
+
+ callback_open_btn.click(function(){ // открываем окно регистрации
+ $(".error").removeClass("error");
+ $(".error_pass").removeClass("error_pass");
+ if($(".phone_me_head").find("input").val().length == 0){
+ $(".phone_me_head").find("input").addClass("error");
+ }
+ else{
+ var num = $(".phone_me_head").find("input").val();
+
+ var type = 'call_me';
+ var data = {"num":num,"type":type};
+ send_call_me_back( data, function(data){
+ callback_wrap.fadeIn(200);
+ $(".phone_me_head").find("input").val('');
+ });
+
+ }
+ });
+
+
+ consultation_btn.click(function(){ // открываем окно регистрации
+ $(".error").removeClass("error");
+ $(".error_pass").removeClass("error_pass");
+ if($(".consultation_phone").val().length == 0){
+ $(".consultation_phone").addClass("error");
+ }
+ else{
+ var num = $(".consultation_phone").val();
+ var name = $(".consultation_name").val();
+ var type = 'consultation';
+ var data = {"num":num,"name":name,"type":type};
+ send_call_me_back( data, function(data){
+ consultation_modal.fadeIn(200);
+ $(".consultation_phone").find("input").val('');
+ $(".consultation_name").find("input").val('');
+ });
+
+ }
+ });
+
+
+ consultation_open_btn.click(function(event){
+ event.preventDefault();
+ consultation_modal.toggle();
+
+ });
+ modal_busket_header_cont.click(function(){ // скрываем модальную корзину в хедере по ссылке
+ modal_busket_header.toggle();
+ modal_busket_header_open.toggleClass('bh_cell_2'); // меняем класс у кнопочки вызова корзины хедера
+ modal_busket_header_open.parent('.basket_head').toggleClass('basket_head_for_click'); // убираем тень
+ });
+ modal_busket_cont.click(function(e){ // скрываем корзину для продолжения покупок
+ e.preventDefault();
+ busket_modal_wrapper.fadeOut(200);
+ });
+ reg_open_btn.click(function(e){ // открываем окно регистрации
+ $(".error").removeClass("error");
+ $(".error_pass").removeClass("error_pass");
+ e.preventDefault();
+ reg_wrap.fadeIn(200);
+ });
+ log_open_btn.click(function(e){ // открываем окно логина
+ $(".error").removeClass("error");
+ $(".error_pass").removeClass("error_pass");
+ e.preventDefault();
+ log_wrap.fadeIn(200);
+ });
+ modal_busket_open.click(function () { // открываем модальную корзину по клику купить на карточку товара
+ busket_modal_wrapper.fadeIn(200);
+ });
+ modal_busket_header_open.click(function() {
+ modal_busket_header.toggle(100);
+ $(this).toggleClass('bh_cell_2');
+ $(this).parent('.basket_head').toggleClass('basket_head_for_click');
+ //console.log($(this).css('background'));
+ });
+ forgot_pass_open_btn.click(function(e){ // открываем окно забыли пароль
+ $(".error").removeClass("error");
+ $(".error_pass").removeClass("error_pass");
+ e.preventDefault();
+ forgot_pass_wrap.fadeIn(50);
+ log_wrap.fadeOut(50);
+ });
+ forgot_pass_success_open_btn.click(function(){ // сообщение об успешной отправке пароля на почту
+ $(".error").removeClass("error");
+ if($(".forgot_pass_modal_wrapper").find("input").val().length == 0){ //проверка ввода поля
+ $(".forgot_pass_modal_wrapper").find("input").addClass("error");
+ }
+ else{
+
+ var email = $(".forgot_pass_modal_wrapper").find("input").val();
+
+ function isValidEmailAddress(emailAddress) {
+ var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
+ return pattern.test(emailAddress);
+ }
+ if(isValidEmailAddress(email))
+ {
+ $(".forgot_pass_modal_wrapper").find("input").removeClass("error");
+ forgot_pass_success_wrap.fadeIn(200);
+ forgot_pass_wrap.fadeOut(200);
+ } else {
+ $(".forgot_pass_modal_wrapper").find("input").addClass("error");
+ }
+
+
+ /*// if ($('#forgot_pass_form')[0].checkValidity()) {
+ forgot_pass_success_wrap.fadeIn(200);
+ forgot_pass_wrap.fadeOut(200);
+ // }; */
+ }
+ });
+ forget_pass_again_btn.click(function(){ // еще раз отправить пароль
+ forgot_pass_wrap.fadeIn(50);
+ forgot_pass_success_wrap.fadeOut(50);
+ });
+ close_btn.click(function(){ // закрываем любые
+ $(this).parent().find("input").val('');
+ $(".error").removeClass("error");
+ reg_wrap.fadeOut(200);
+ log_wrap.fadeOut(200);
+ forgot_pass_wrap.fadeOut(200);
+ forgot_pass_success_wrap.fadeOut(200);
+ forgot_pass_success_wrap.fadeOut(200);
+ busket_modal_wrapper.fadeOut(200);
+ callback_wrap.fadeOut(200);
+ consultation_modal.fadeOut(200);
+ });
+ $(".close_modal").click(function(){
+ reg_wrap.fadeOut(200);
+ log_wrap.fadeOut(200);
+ forgot_pass_wrap.fadeOut(200);
+ forgot_pass_success_wrap.fadeOut(200);
+ callback_wrap.fadeOut(200);
+ });
+
+ reg_wrap_btn.click(function(){
+ /*$(".modal_wrapper_reg").find(".modal_window:label").each(function (i) {
+ if (this.find("input").val().length == 0) {
+ this.find("input").addClass("error");
+ alert('fdfdf');
+ } else {
+ this.find("input").removeClass("error");
+ }
+ });*/
+ var email_reg = $("#email_reg").val();
+ var pass_reg = $("#pass_reg").val();
+ var pass_reg_rep = $("#pass_reg_rep").val();
+ $(this).parent().parent().find("label").each(function(nf, form)
+ {
+ if($(this).find("input").val().length == 0){
+ $(this).find("input").addClass("error");
+ if(pass_reg !== pass_reg_rep){
+ $("#pass_reg").addClass("error_pass");
+ $("#pass_reg_rep").addClass("error_pass");
+ }
+ else{
+ $("#pass_reg").removeClass("error_pass");
+ $("#pass_reg_rep").removeClass("error_pass");
+ }
+ }
+ else{
+
+ function isValidEmailAddress(emailAddress) {
+ var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
+ return pattern.test(emailAddress);
+ }
+
+ if(isValidEmailAddress(email_reg))
+ {
+ $("#email_reg").removeClass("error");
+ $(this).find("input").removeClass("error");
+ } else {
+ $(this).find("input").removeClass("error");
+ $("#email_reg").addClass("error");
+ }
+
+ if(pass_reg !== pass_reg_rep){
+ $("#pass_reg").addClass("error_pass");
+ $("#pass_reg_rep").addClass("error_pass");
+ }
+ else{
+ $("#pass_reg").removeClass("error_pass");
+ $("#pass_reg_rep").removeClass("error_pass");
+ }
+
+ }
+ });
+ });
+ }
+ modal_windows();
+
+
+ // category open blocks
+ function category_open_blocks() {
+ var open_block_btn = $('.category_wrap').find('.arrow');
+ open_block_btn.click(function(){
+ var block = $(this).parent('.cat_li_cont').next();
+ block.slideToggle(200);
+
+ if($(this).css('background-position')==='0px 0px') {
+ $(this).css('background-position','0px -15px');
+ }else{
+ $(this).css('background-position','0px 0px');
+ };
+ });
+ }
+ category_open_blocks();
+
+
+
+ //
+ //// VALIDATION FORM JS
+ //$.validator.addMethod("equals_code", function(value, element, string) {
+ // return value === string;
+ //}, $.validator.format("вы ввели не правильные буквы с картинки"));
+ //// registration form
+ //$('.reg_form').validate({
+ // rules: {
+ // name: {
+ // required: true
+ // },
+ // email: {
+ // required: true,
+ // email: true
+ // },
+ // password: {
+ // required: true
+ // },
+ // password_repeat: {
+ // required: true,
+ // equalTo: '.reg_input_password'
+ // },
+ // phone: {
+ // required: true,
+ // number: true
+ // },
+ // last_name: {
+ // required: true
+ // },
+ // code: {
+ // required: true,
+ // equals_code: 'ricswoc'
+ // },
+ // login: {
+ // required: true
+ // }
+ // },
+ // messages: {
+ // name: {
+ // required: "введите имя..."
+ // },
+ // email: {
+ // required: "введите электронную почту...",
+ // email: "введите правильный адрес ( example@mail.com )"
+ // },
+ // password: {
+ // required: 'введите пароль...'
+ // },
+ // password_repeat: {
+ // required: 'повторите пароль...',
+ // equalTo: 'пароль не совпадает...'
+ // },
+ // phone: {
+ // required: 'введите телефон...',
+ // number: 'должны быть только цифры...'
+ // },
+ // last_name: {
+ // required: 'введите имя...'
+ // },
+ // code: {
+ // required: 'введите проверочный код...'
+ // },
+ // login: {
+ // required: 'введите ваш логин...'
+ // }
+ // }
+ // // submitHandler: function () {
+ // // $('.foo_text').delay( 100 ).show(200);
+ // // }
+ //});
+ //// login form
+ //$('.log_form').validate({
+ // rules: {
+ // password: {
+ // required: true
+ // },
+ // login: {
+ // required: true
+ // }
+ // },
+ // messages: {
+ // password: {
+ // required: 'введите ваш пароль'
+ // },
+ // login: {
+ // required: 'введите ваш логин'
+ // }
+ // }
+ //});
+ //// forget password form
+ //$('.forgot_password_form').validate({
+ // rules: {
+ // email: {
+ // required: true,
+ // email: true
+ // }
+ // },
+ // messages: {
+ // email: {
+ // required: 'введите ваш логин...',
+ // email: 'введите правильный адресс (example@mail.com)'
+ // }
+ // },
+ // submitHandler: function () {
+ // $('.forgot_pass_success_wrapper').fadeIn(200);
+ // $('.forgot_pass_modal_wrapper').fadeOut(200);
+ // }
+ //});
+
+
+
+ //=============================================== BUSKET MODAL WINDOW FUNCTIONS
+
+ function send_call_me_back( data,callback )
+ {
+ $.ajax({
+ url: '/site/mail',
+ data : data,
+ type : 'POST',
+ dataType: 'json',
+ success: function (data)
+ {
+ if(callback)
+ callback(data);
+ },
+ error: function()
+ {
+ console.info('error');
+ }
+ });
+ }
+
+
+});
\ No newline at end of file
diff --git a/frontend/web/js/owl.carousel.js b/frontend/web/js/owl.carousel.js
new file mode 100644
index 0000000..2296115
--- /dev/null
+++ b/frontend/web/js/owl.carousel.js
@@ -0,0 +1,3069 @@
+/**
+ * Owl carousel
+ * @version 2.0.0
+ * @author Bartosz Wojciechowski
+ * @license The MIT License (MIT)
+ * @todo Lazy Load Icon
+ * @todo prevent animationend bubling
+ * @todo itemsScaleUp
+ * @todo Test Zepto
+ * @todo stagePadding calculate wrong active classes
+ */
+;(function($, window, document, undefined) {
+
+ var drag, state, e;
+
+ /**
+ * Template for status information about drag and touch events.
+ * @private
+ */
+ drag = {
+ start: 0,
+ startX: 0,
+ startY: 0,
+ current: 0,
+ currentX: 0,
+ currentY: 0,
+ offsetX: 0,
+ offsetY: 0,
+ distance: null,
+ startTime: 0,
+ endTime: 0,
+ updatedX: 0,
+ targetEl: null
+ };
+
+ /**
+ * Template for some status informations.
+ * @private
+ */
+ state = {
+ isTouch: false,
+ isScrolling: false,
+ isSwiping: false,
+ direction: false,
+ inMotion: false
+ };
+
+ /**
+ * Event functions references.
+ * @private
+ */
+ e = {
+ _onDragStart: null,
+ _onDragMove: null,
+ _onDragEnd: null,
+ _transitionEnd: null,
+ _resizer: null,
+ _responsiveCall: null,
+ _goToLoop: null,
+ _checkVisibile: null
+ };
+
+ /**
+ * Creates a carousel.
+ * @class The Owl Carousel.
+ * @public
+ * @param {HTMLElement|jQuery} element - The element to create the carousel for.
+ * @param {Object} [options] - The options
+ */
+ function Owl(element, options) {
+
+ /**
+ * Current settings for the carousel.
+ * @public
+ */
+ this.settings = null;
+
+ /**
+ * Current options set by the caller including defaults.
+ * @public
+ */
+ this.options = $.extend({}, Owl.Defaults, options);
+
+ /**
+ * Plugin element.
+ * @public
+ */
+ this.$element = $(element);
+
+ /**
+ * Caches informations about drag and touch events.
+ */
+ this.drag = $.extend({}, drag);
+
+ /**
+ * Caches some status informations.
+ * @protected
+ */
+ this.state = $.extend({}, state);
+
+ /**
+ * @protected
+ * @todo Must be documented
+ */
+ this.e = $.extend({}, e);
+
+ /**
+ * References to the running plugins of this carousel.
+ * @protected
+ */
+ this._plugins = {};
+
+ /**
+ * Currently suppressed events to prevent them from beeing retriggered.
+ * @protected
+ */
+ this._supress = {};
+
+ /**
+ * Absolute current position.
+ * @protected
+ */
+ this._current = null;
+
+ /**
+ * Animation speed in milliseconds.
+ * @protected
+ */
+ this._speed = null;
+
+ /**
+ * Coordinates of all items in pixel.
+ * @todo The name of this member is missleading.
+ * @protected
+ */
+ this._coordinates = [];
+
+ /**
+ * Current breakpoint.
+ * @todo Real media queries would be nice.
+ * @protected
+ */
+ this._breakpoint = null;
+
+ /**
+ * Current width of the plugin element.
+ */
+ this._width = null;
+
+ /**
+ * All real items.
+ * @protected
+ */
+ this._items = [];
+
+ /**
+ * All cloned items.
+ * @protected
+ */
+ this._clones = [];
+
+ /**
+ * Merge values of all items.
+ * @todo Maybe this could be part of a plugin.
+ * @protected
+ */
+ this._mergers = [];
+
+ /**
+ * Invalidated parts within the update process.
+ * @protected
+ */
+ this._invalidated = {};
+
+ /**
+ * Ordered list of workers for the update process.
+ * @protected
+ */
+ this._pipe = [];
+
+ $.each(Owl.Plugins, $.proxy(function(key, plugin) {
+ this._plugins[key[0].toLowerCase() + key.slice(1)]
+ = new plugin(this);
+ }, this));
+
+ $.each(Owl.Pipe, $.proxy(function(priority, worker) {
+ this._pipe.push({
+ 'filter': worker.filter,
+ 'run': $.proxy(worker.run, this)
+ });
+ }, this));
+
+ this.setup();
+ this.initialize();
+ }
+
+ /**
+ * Default options for the carousel.
+ * @public
+ */
+ Owl.Defaults = {
+ items: 3,
+ loop: false,
+ center: false,
+
+ mouseDrag: true,
+ touchDrag: true,
+ pullDrag: true,
+ freeDrag: false,
+
+ margin: 0,
+ stagePadding: 0,
+
+ merge: false,
+ mergeFit: true,
+ autoWidth: false,
+
+ startPosition: 0,
+ rtl: false,
+
+ smartSpeed: 250,
+ fluidSpeed: false,
+ dragEndSpeed: false,
+
+ responsive: {},
+ responsiveRefreshRate: 200,
+ responsiveBaseElement: window,
+ responsiveClass: false,
+
+ fallbackEasing: 'swing',
+
+ info: false,
+
+ nestedItemSelector: false,
+ itemElement: 'div',
+ stageElement: 'div',
+
+ // Classes and Names
+ themeClass: 'owl-theme',
+ baseClass: 'owl-carousel',
+ itemClass: 'owl-item',
+ centerClass: 'center',
+ activeClass: 'active'
+ };
+
+ /**
+ * Enumeration for width.
+ * @public
+ * @readonly
+ * @enum {String}
+ */
+ Owl.Width = {
+ Default: 'default',
+ Inner: 'inner',
+ Outer: 'outer'
+ };
+
+ /**
+ * Contains all registered plugins.
+ * @public
+ */
+ Owl.Plugins = {};
+
+ /**
+ * Update pipe.
+ */
+ Owl.Pipe = [ {
+ filter: [ 'width', 'items', 'settings' ],
+ run: function(cache) {
+ cache.current = this._items && this._items[this.relative(this._current)];
+ }
+ }, {
+ filter: [ 'items', 'settings' ],
+ run: function() {
+ var cached = this._clones,
+ clones = this.$stage.children('.cloned');
+
+ if (clones.length !== cached.length || (!this.settings.loop && cached.length > 0)) {
+ this.$stage.children('.cloned').remove();
+ this._clones = [];
+ }
+ }
+ }, {
+ filter: [ 'items', 'settings' ],
+ run: function() {
+ var i, n,
+ clones = this._clones,
+ items = this._items,
+ delta = this.settings.loop ? clones.length - Math.max(this.settings.items * 2, 4) : 0;
+
+ for (i = 0, n = Math.abs(delta / 2); i < n; i++) {
+ if (delta > 0) {
+ this.$stage.children().eq(items.length + clones.length - 1).remove();
+ clones.pop();
+ this.$stage.children().eq(0).remove();
+ clones.pop();
+ } else {
+ clones.push(clones.length / 2);
+ this.$stage.append(items[clones[clones.length - 1]].clone().addClass('cloned'));
+ clones.push(items.length - 1 - (clones.length - 1) / 2);
+ this.$stage.prepend(items[clones[clones.length - 1]].clone().addClass('cloned'));
+ }
+ }
+ }
+ }, {
+ filter: [ 'width', 'items', 'settings' ],
+ run: function() {
+ var rtl = (this.settings.rtl ? 1 : -1),
+ width = (this.width() / this.settings.items).toFixed(3),
+ coordinate = 0, merge, i, n;
+
+ this._coordinates = [];
+ for (i = 0, n = this._clones.length + this._items.length; i < n; i++) {
+ merge = this._mergers[this.relative(i)];
+ merge = (this.settings.mergeFit && Math.min(merge, this.settings.items)) || merge;
+ coordinate += (this.settings.autoWidth ? this._items[this.relative(i)].width() + this.settings.margin : width * merge) * rtl;
+
+ this._coordinates.push(coordinate);
+ }
+ }
+ }, {
+ filter: [ 'width', 'items', 'settings' ],
+ run: function() {
+ var i, n, width = (this.width() / this.settings.items).toFixed(3), css = {
+ 'width': Math.abs(this._coordinates[this._coordinates.length - 1]) + this.settings.stagePadding * 2,
+ 'padding-left': this.settings.stagePadding || '',
+ 'padding-right': this.settings.stagePadding || ''
+ };
+
+ this.$stage.css(css);
+
+ css = { 'width': this.settings.autoWidth ? 'auto' : width - this.settings.margin };
+ css[this.settings.rtl ? 'margin-left' : 'margin-right'] = this.settings.margin;
+
+ if (!this.settings.autoWidth && $.grep(this._mergers, function(v) { return v > 1 }).length > 0) {
+ for (i = 0, n = this._coordinates.length; i < n; i++) {
+ css.width = Math.abs(this._coordinates[i]) - Math.abs(this._coordinates[i - 1] || 0) - this.settings.margin;
+ this.$stage.children().eq(i).css(css);
+ }
+ } else {
+ this.$stage.children().css(css);
+ }
+ }
+ }, {
+ filter: [ 'width', 'items', 'settings' ],
+ run: function(cache) {
+ cache.current && this.reset(this.$stage.children().index(cache.current));
+ }
+ }, {
+ filter: [ 'position' ],
+ run: function() {
+ this.animate(this.coordinates(this._current));
+ }
+ }, {
+ filter: [ 'width', 'position', 'items', 'settings' ],
+ run: function() {
+ var rtl = this.settings.rtl ? 1 : -1,
+ padding = this.settings.stagePadding * 2,
+ begin = this.coordinates(this.current()) + padding,
+ end = begin + this.width() * rtl,
+ inner, outer, matches = [], i, n;
+
+ for (i = 0, n = this._coordinates.length; i < n; i++) {
+ inner = this._coordinates[i - 1] || 0;
+ outer = Math.abs(this._coordinates[i]) + padding * rtl;
+
+ if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
+ || (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
+ matches.push(i);
+ }
+ }
+
+ this.$stage.children('.' + this.settings.activeClass).removeClass(this.settings.activeClass);
+ this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass(this.settings.activeClass);
+
+ if (this.settings.center) {
+ this.$stage.children('.' + this.settings.centerClass).removeClass(this.settings.centerClass);
+ this.$stage.children().eq(this.current()).addClass(this.settings.centerClass);
+ }
+ }
+ } ];
+
+ /**
+ * Initializes the carousel.
+ * @protected
+ */
+ Owl.prototype.initialize = function() {
+ this.trigger('initialize');
+
+ this.$element
+ .addClass(this.settings.baseClass)
+ .addClass(this.settings.themeClass)
+ .toggleClass('owl-rtl', this.settings.rtl);
+
+ // check support
+ this.browserSupport();
+
+ if (this.settings.autoWidth && this.state.imagesLoaded !== true) {
+ var imgs, nestedSelector, width;
+ imgs = this.$element.find('img');
+ nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
+ width = this.$element.children(nestedSelector).width();
+
+ if (imgs.length && width <= 0) {
+ this.preloadAutoWidthImages(imgs);
+ return false;
+ }
+ }
+
+ this.$element.addClass('owl-loading');
+
+ // create stage
+ this.$stage = $('<' + this.settings.stageElement + ' class="owl-stage"/>')
+ .wrap('');
+
+ // append stage
+ this.$element.append(this.$stage.parent());
+
+ // append content
+ this.replace(this.$element.children().not(this.$stage.parent()));
+
+ // set view width
+ this._width = this.$element.width();
+
+ // update view
+ this.refresh();
+
+ this.$element.removeClass('owl-loading').addClass('owl-loaded');
+
+ // attach generic events
+ this.eventsCall();
+
+ // attach generic events
+ this.internalEvents();
+
+ // attach custom control events
+ this.addTriggerableEvents();
+
+ this.trigger('initialized');
+ };
+
+ /**
+ * Setups the current settings.
+ * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
+ * @todo Support for media queries by using `matchMedia` would be nice.
+ * @public
+ */
+ Owl.prototype.setup = function() {
+ var viewport = this.viewport(),
+ overwrites = this.options.responsive,
+ match = -1,
+ settings = null;
+
+ if (!overwrites) {
+ settings = $.extend({}, this.options);
+ } else {
+ $.each(overwrites, function(breakpoint) {
+ if (breakpoint <= viewport && breakpoint > match) {
+ match = Number(breakpoint);
+ }
+ });
+
+ settings = $.extend({}, this.options, overwrites[match]);
+ delete settings.responsive;
+
+ // responsive class
+ if (settings.responsiveClass) {
+ this.$element.attr('class', function(i, c) {
+ return c.replace(/\b owl-responsive-\S+/g, '');
+ }).addClass('owl-responsive-' + match);
+ }
+ }
+
+ if (this.settings === null || this._breakpoint !== match) {
+ this.trigger('change', { property: { name: 'settings', value: settings } });
+ this._breakpoint = match;
+ this.settings = settings;
+ this.invalidate('settings');
+ this.trigger('changed', { property: { name: 'settings', value: this.settings } });
+ }
+ };
+
+ /**
+ * Updates option logic if necessery.
+ * @protected
+ */
+ Owl.prototype.optionsLogic = function() {
+ // Toggle Center class
+ this.$element.toggleClass('owl-center', this.settings.center);
+
+ // if items number is less than in body
+ if (this.settings.loop && this._items.length < this.settings.items) {
+ this.settings.loop = false;
+ }
+
+ if (this.settings.autoWidth) {
+ this.settings.stagePadding = false;
+ this.settings.merge = false;
+ }
+ };
+
+ /**
+ * Prepares an item before add.
+ * @todo Rename event parameter `content` to `item`.
+ * @protected
+ * @returns {jQuery|HTMLElement} - The item container.
+ */
+ Owl.prototype.prepare = function(item) {
+ var event = this.trigger('prepare', { content: item });
+
+ if (!event.data) {
+ event.data = $('<' + this.settings.itemElement + '/>')
+ .addClass(this.settings.itemClass).append(item)
+ }
+
+ this.trigger('prepared', { content: event.data });
+
+ return event.data;
+ };
+
+ /**
+ * Updates the view.
+ * @public
+ */
+ Owl.prototype.update = function() {
+ var i = 0,
+ n = this._pipe.length,
+ filter = $.proxy(function(p) { return this[p] }, this._invalidated),
+ cache = {};
+
+ while (i < n) {
+ if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
+ this._pipe[i].run(cache);
+ }
+ i++;
+ }
+
+ this._invalidated = {};
+ };
+
+ /**
+ * Gets the width of the view.
+ * @public
+ * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
+ * @returns {Number} - The width of the view in pixel.
+ */
+ Owl.prototype.width = function(dimension) {
+ dimension = dimension || Owl.Width.Default;
+ switch (dimension) {
+ case Owl.Width.Inner:
+ case Owl.Width.Outer:
+ return this._width;
+ default:
+ return this._width - this.settings.stagePadding * 2 + this.settings.margin;
+ }
+ };
+
+ /**
+ * Refreshes the carousel primarily for adaptive purposes.
+ * @public
+ */
+ Owl.prototype.refresh = function() {
+ if (this._items.length === 0) {
+ return false;
+ }
+
+ var start = new Date().getTime();
+
+ this.trigger('refresh');
+
+ this.setup();
+
+ this.optionsLogic();
+
+ // hide and show methods helps here to set a proper widths,
+ // this prevents scrollbar to be calculated in stage width
+ this.$stage.addClass('owl-refresh');
+
+ this.update();
+
+ this.$stage.removeClass('owl-refresh');
+
+ this.state.orientation = window.orientation;
+
+ this.watchVisibility();
+
+ this.trigger('refreshed');
+ };
+
+ /**
+ * Save internal event references and add event based functions.
+ * @protected
+ */
+ Owl.prototype.eventsCall = function() {
+ // Save events references
+ this.e._onDragStart = $.proxy(function(e) {
+ this.onDragStart(e);
+ }, this);
+ this.e._onDragMove = $.proxy(function(e) {
+ this.onDragMove(e);
+ }, this);
+ this.e._onDragEnd = $.proxy(function(e) {
+ this.onDragEnd(e);
+ }, this);
+ this.e._onResize = $.proxy(function(e) {
+ this.onResize(e);
+ }, this);
+ this.e._transitionEnd = $.proxy(function(e) {
+ this.transitionEnd(e);
+ }, this);
+ this.e._preventClick = $.proxy(function(e) {
+ this.preventClick(e);
+ }, this);
+ };
+
+ /**
+ * Checks window `resize` event.
+ * @protected
+ */
+ Owl.prototype.onThrottledResize = function() {
+ window.clearTimeout(this.resizeTimer);
+ this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate);
+ };
+
+ /**
+ * Checks window `resize` event.
+ * @protected
+ */
+ Owl.prototype.onResize = function() {
+ if (!this._items.length) {
+ return false;
+ }
+
+ if (this._width === this.$element.width()) {
+ return false;
+ }
+
+ if (this.trigger('resize').isDefaultPrevented()) {
+ return false;
+ }
+
+ this._width = this.$element.width();
+
+ this.invalidate('width');
+
+ this.refresh();
+
+ this.trigger('resized');
+ };
+
+ /**
+ * Checks for touch/mouse drag event type and add run event handlers.
+ * @protected
+ */
+ Owl.prototype.eventsRouter = function(event) {
+ var type = event.type;
+
+ if (type === "mousedown" || type === "touchstart") {
+ this.onDragStart(event);
+ } else if (type === "mousemove" || type === "touchmove") {
+ this.onDragMove(event);
+ } else if (type === "mouseup" || type === "touchend") {
+ this.onDragEnd(event);
+ } else if (type === "touchcancel") {
+ this.onDragEnd(event);
+ }
+ };
+
+ /**
+ * Checks for touch/mouse drag options and add necessery event handlers.
+ * @protected
+ */
+ Owl.prototype.internalEvents = function() {
+ var isTouch = isTouchSupport(),
+ isTouchIE = isTouchSupportIE();
+
+ if (this.settings.mouseDrag){
+ this.$stage.on('mousedown', $.proxy(function(event) { this.eventsRouter(event) }, this));
+ this.$stage.on('dragstart', function() { return false });
+ this.$stage.get(0).onselectstart = function() { return false };
+ } else {
+ this.$element.addClass('owl-text-select-on');
+ }
+
+ if (this.settings.touchDrag && !isTouchIE){
+ this.$stage.on('touchstart touchcancel', $.proxy(function(event) { this.eventsRouter(event) }, this));
+ }
+
+ // catch transitionEnd event
+ if (this.transitionEndVendor) {
+ this.on(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd, false);
+ }
+
+ // responsive
+ if (this.settings.responsive !== false) {
+ this.on(window, 'resize', $.proxy(this.onThrottledResize, this));
+ }
+ };
+
+ /**
+ * Handles touchstart/mousedown event.
+ * @protected
+ * @param {Event} event - The event arguments.
+ */
+ Owl.prototype.onDragStart = function(event) {
+ var ev, isTouchEvent, pageX, pageY, animatedPos;
+
+ ev = event.originalEvent || event || window.event;
+
+ // prevent right click
+ if (ev.which === 3 || this.state.isTouch) {
+ return false;
+ }
+
+ if (ev.type === 'mousedown') {
+ this.$stage.addClass('owl-grab');
+ }
+
+ this.trigger('drag');
+ this.drag.startTime = new Date().getTime();
+ this.speed(0);
+ this.state.isTouch = true;
+ this.state.isScrolling = false;
+ this.state.isSwiping = false;
+ this.drag.distance = 0;
+
+ pageX = getTouches(ev).x;
+ pageY = getTouches(ev).y;
+
+ // get stage position left
+ this.drag.offsetX = this.$stage.position().left;
+ this.drag.offsetY = this.$stage.position().top;
+
+ if (this.settings.rtl) {
+ this.drag.offsetX = this.$stage.position().left + this.$stage.width() - this.width()
+ + this.settings.margin;
+ }
+
+ // catch position // ie to fix
+ if (this.state.inMotion && this.support3d) {
+ animatedPos = this.getTransformProperty();
+ this.drag.offsetX = animatedPos;
+ this.animate(animatedPos);
+ this.state.inMotion = true;
+ } else if (this.state.inMotion && !this.support3d) {
+ this.state.inMotion = false;
+ return false;
+ }
+
+ this.drag.startX = pageX - this.drag.offsetX;
+ this.drag.startY = pageY - this.drag.offsetY;
+
+ this.drag.start = pageX - this.drag.startX;
+ this.drag.targetEl = ev.target || ev.srcElement;
+ this.drag.updatedX = this.drag.start;
+
+ // to do/check
+ // prevent links and images dragging;
+ if (this.drag.targetEl.tagName === "IMG" || this.drag.targetEl.tagName === "A") {
+ this.drag.targetEl.draggable = false;
+ }
+
+ $(document).on('mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents', $.proxy(function(event) {this.eventsRouter(event)},this));
+ };
+
+ /**
+ * Handles the touchmove/mousemove events.
+ * @todo Simplify
+ * @protected
+ * @param {Event} event - The event arguments.
+ */
+ Owl.prototype.onDragMove = function(event) {
+ var ev, isTouchEvent, pageX, pageY, minValue, maxValue, pull;
+
+ if (!this.state.isTouch) {
+ return;
+ }
+
+ if (this.state.isScrolling) {
+ return;
+ }
+
+ ev = event.originalEvent || event || window.event;
+
+ pageX = getTouches(ev).x;
+ pageY = getTouches(ev).y;
+
+ // Drag Direction
+ this.drag.currentX = pageX - this.drag.startX;
+ this.drag.currentY = pageY - this.drag.startY;
+ this.drag.distance = this.drag.currentX - this.drag.offsetX;
+
+ // Check move direction
+ if (this.drag.distance < 0) {
+ this.state.direction = this.settings.rtl ? 'right' : 'left';
+ } else if (this.drag.distance > 0) {
+ this.state.direction = this.settings.rtl ? 'left' : 'right';
+ }
+ // Loop
+ if (this.settings.loop) {
+ if (this.op(this.drag.currentX, '>', this.coordinates(this.minimum())) && this.state.direction === 'right') {
+ this.drag.currentX -= (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
+ } else if (this.op(this.drag.currentX, '<', this.coordinates(this.maximum())) && this.state.direction === 'left') {
+ this.drag.currentX += (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
+ }
+ } else {
+ // pull
+ minValue = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
+ maxValue = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
+ pull = this.settings.pullDrag ? this.drag.distance / 5 : 0;
+ this.drag.currentX = Math.max(Math.min(this.drag.currentX, minValue + pull), maxValue + pull);
+ }
+
+ // Lock browser if swiping horizontal
+
+ if ((this.drag.distance > 8 || this.drag.distance < -8)) {
+ if (ev.preventDefault !== undefined) {
+ ev.preventDefault();
+ } else {
+ ev.returnValue = false;
+ }
+ this.state.isSwiping = true;
+ }
+
+ this.drag.updatedX = this.drag.currentX;
+
+ // Lock Owl if scrolling
+ if ((this.drag.currentY > 16 || this.drag.currentY < -16) && this.state.isSwiping === false) {
+ this.state.isScrolling = true;
+ this.drag.updatedX = this.drag.start;
+ }
+
+ this.animate(this.drag.updatedX);
+ };
+
+ /**
+ * Handles the touchend/mouseup events.
+ * @protected
+ */
+ Owl.prototype.onDragEnd = function(event) {
+ var compareTimes, distanceAbs, closest;
+
+ if (!this.state.isTouch) {
+ return;
+ }
+
+ if (event.type === 'mouseup') {
+ this.$stage.removeClass('owl-grab');
+ }
+
+ this.trigger('dragged');
+
+ // prevent links and images dragging;
+ this.drag.targetEl.removeAttribute("draggable");
+
+ // remove drag event listeners
+
+ this.state.isTouch = false;
+ this.state.isScrolling = false;
+ this.state.isSwiping = false;
+
+ // to check
+ if (this.drag.distance === 0 && this.state.inMotion !== true) {
+ this.state.inMotion = false;
+ return false;
+ }
+
+ // prevent clicks while scrolling
+
+ this.drag.endTime = new Date().getTime();
+ compareTimes = this.drag.endTime - this.drag.startTime;
+ distanceAbs = Math.abs(this.drag.distance);
+
+ // to test
+ if (distanceAbs > 3 || compareTimes > 300) {
+ this.removeClick(this.drag.targetEl);
+ }
+
+ closest = this.closest(this.drag.updatedX);
+
+ this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
+ this.current(closest);
+ this.invalidate('position');
+ this.update();
+
+ // if pullDrag is off then fire transitionEnd event manually when stick
+ // to border
+ if (!this.settings.pullDrag && this.drag.updatedX === this.coordinates(closest)) {
+ this.transitionEnd();
+ }
+
+ this.drag.distance = 0;
+
+ $(document).off('.owl.dragEvents');
+ };
+
+ /**
+ * Attaches `preventClick` to disable link while swipping.
+ * @protected
+ * @param {HTMLElement} [target] - The target of the `click` event.
+ */
+ Owl.prototype.removeClick = function(target) {
+ this.drag.targetEl = target;
+ $(target).on('click.preventClick', this.e._preventClick);
+ // to make sure click is removed:
+ window.setTimeout(function() {
+ $(target).off('click.preventClick');
+ }, 300);
+ };
+
+ /**
+ * Suppresses click event.
+ * @protected
+ * @param {Event} ev - The event arguments.
+ */
+ Owl.prototype.preventClick = function(ev) {
+ if (ev.preventDefault) {
+ ev.preventDefault();
+ } else {
+ ev.returnValue = false;
+ }
+ if (ev.stopPropagation) {
+ ev.stopPropagation();
+ }
+ $(ev.target).off('click.preventClick');
+ };
+
+ /**
+ * Catches stage position while animate (only CSS3).
+ * @protected
+ * @returns
+ */
+ Owl.prototype.getTransformProperty = function() {
+ var transform, matrix3d;
+
+ transform = window.getComputedStyle(this.$stage.get(0), null).getPropertyValue(this.vendorName + 'transform');
+ // var transform = this.$stage.css(this.vendorName + 'transform')
+ transform = transform.replace(/matrix(3d)?\(|\)/g, '').split(',');
+ matrix3d = transform.length === 16;
+
+ return matrix3d !== true ? transform[4] : transform[12];
+ };
+
+ /**
+ * Gets absolute position of the closest item for a coordinate.
+ * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
+ * @protected
+ * @param {Number} coordinate - The coordinate in pixel.
+ * @return {Number} - The absolute position of the closest item.
+ */
+ Owl.prototype.closest = function(coordinate) {
+ var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates();
+
+ if (!this.settings.freeDrag) {
+ // check closest item
+ $.each(coordinates, $.proxy(function(index, value) {
+ if (coordinate > value - pull && coordinate < value + pull) {
+ position = index;
+ } else if (this.op(coordinate, '<', value)
+ && this.op(coordinate, '>', coordinates[index + 1] || value - width)) {
+ position = this.state.direction === 'left' ? index + 1 : index;
+ }
+ return position === -1;
+ }, this));
+ }
+
+ if (!this.settings.loop) {
+ // non loop boundries
+ if (this.op(coordinate, '>', coordinates[this.minimum()])) {
+ position = coordinate = this.minimum();
+ } else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
+ position = coordinate = this.maximum();
+ }
+ }
+
+ return position;
+ };
+
+ /**
+ * Animates the stage.
+ * @public
+ * @param {Number} coordinate - The coordinate in pixels.
+ */
+ Owl.prototype.animate = function(coordinate) {
+ this.trigger('translate');
+ this.state.inMotion = this.speed() > 0;
+
+ if (this.support3d) {
+ this.$stage.css({
+ transform: 'translate3d(' + coordinate + 'px' + ',0px, 0px)',
+ transition: (this.speed() / 1000) + 's'
+ });
+ } else if (this.state.isTouch) {
+ this.$stage.css({
+ left: coordinate + 'px'
+ });
+ } else {
+ this.$stage.animate({
+ left: coordinate
+ }, this.speed() / 1000, this.settings.fallbackEasing, $.proxy(function() {
+ if (this.state.inMotion) {
+ this.transitionEnd();
+ }
+ }, this));
+ }
+ };
+
+ /**
+ * Sets the absolute position of the current item.
+ * @public
+ * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
+ * @returns {Number} - The absolute position of the current item.
+ */
+ Owl.prototype.current = function(position) {
+ if (position === undefined) {
+ return this._current;
+ }
+
+ if (this._items.length === 0) {
+ return undefined;
+ }
+
+ position = this.normalize(position);
+
+ if (this._current !== position) {
+ var event = this.trigger('change', { property: { name: 'position', value: position } });
+
+ if (event.data !== undefined) {
+ position = this.normalize(event.data);
+ }
+
+ this._current = position;
+
+ this.invalidate('position');
+
+ this.trigger('changed', { property: { name: 'position', value: this._current } });
+ }
+
+ return this._current;
+ };
+
+ /**
+ * Invalidates the given part of the update routine.
+ * @param {String} part - The part to invalidate.
+ */
+ Owl.prototype.invalidate = function(part) {
+ this._invalidated[part] = true;
+ }
+
+ /**
+ * Resets the absolute position of the current item.
+ * @public
+ * @param {Number} position - The absolute position of the new item.
+ */
+ Owl.prototype.reset = function(position) {
+ position = this.normalize(position);
+
+ if (position === undefined) {
+ return;
+ }
+
+ this._speed = 0;
+ this._current = position;
+
+ this.suppress([ 'translate', 'translated' ]);
+
+ this.animate(this.coordinates(position));
+
+ this.release([ 'translate', 'translated' ]);
+ };
+
+ /**
+ * Normalizes an absolute or a relative position for an item.
+ * @public
+ * @param {Number} position - The absolute or relative position to normalize.
+ * @param {Boolean} [relative=false] - Whether the given position is relative or not.
+ * @returns {Number} - The normalized position.
+ */
+ Owl.prototype.normalize = function(position, relative) {
+ var n = (relative ? this._items.length : this._items.length + this._clones.length);
+
+ if (!$.isNumeric(position) || n < 1) {
+ return undefined;
+ }
+
+ if (this._clones.length) {
+ position = ((position % n) + n) % n;
+ } else {
+ position = Math.max(this.minimum(relative), Math.min(this.maximum(relative), position));
+ }
+
+ return position;
+ };
+
+ /**
+ * Converts an absolute position for an item into a relative position.
+ * @public
+ * @param {Number} position - The absolute position to convert.
+ * @returns {Number} - The converted position.
+ */
+ Owl.prototype.relative = function(position) {
+ position = this.normalize(position);
+ position = position - this._clones.length / 2;
+ return this.normalize(position, true);
+ };
+
+ /**
+ * Gets the maximum position for an item.
+ * @public
+ * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
+ * @returns {Number}
+ */
+ Owl.prototype.maximum = function(relative) {
+ var maximum, width, i = 0, coordinate,
+ settings = this.settings;
+
+ if (relative) {
+ return this._items.length - 1;
+ }
+
+ if (!settings.loop && settings.center) {
+ maximum = this._items.length - 1;
+ } else if (!settings.loop && !settings.center) {
+ maximum = this._items.length - settings.items;
+ } else if (settings.loop || settings.center) {
+ maximum = this._items.length + settings.items;
+ } else if (settings.autoWidth || settings.merge) {
+ revert = settings.rtl ? 1 : -1;
+ width = this.$stage.width() - this.$element.width();
+ while (coordinate = this.coordinates(i)) {
+ if (coordinate * revert >= width) {
+ break;
+ }
+ maximum = ++i;
+ }
+ } else {
+ throw 'Can not detect maximum absolute position.'
+ }
+
+ return maximum;
+ };
+
+ /**
+ * Gets the minimum position for an item.
+ * @public
+ * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
+ * @returns {Number}
+ */
+ Owl.prototype.minimum = function(relative) {
+ if (relative) {
+ return 0;
+ }
+
+ return this._clones.length / 2;
+ };
+
+ /**
+ * Gets an item at the specified relative position.
+ * @public
+ * @param {Number} [position] - The relative position of the item.
+ * @return {jQuery|Array.
} - The item at the given position or all items if no position was given.
+ */
+ Owl.prototype.items = function(position) {
+ if (position === undefined) {
+ return this._items.slice();
+ }
+
+ position = this.normalize(position, true);
+ return this._items[position];
+ };
+
+ /**
+ * Gets an item at the specified relative position.
+ * @public
+ * @param {Number} [position] - The relative position of the item.
+ * @return {jQuery|Array.} - The item at the given position or all items if no position was given.
+ */
+ Owl.prototype.mergers = function(position) {
+ if (position === undefined) {
+ return this._mergers.slice();
+ }
+
+ position = this.normalize(position, true);
+ return this._mergers[position];
+ };
+
+ /**
+ * Gets the absolute positions of clones for an item.
+ * @public
+ * @param {Number} [position] - The relative position of the item.
+ * @returns {Array.} - The absolute positions of clones for the item or all if no position was given.
+ */
+ Owl.prototype.clones = function(position) {
+ var odd = this._clones.length / 2,
+ even = odd + this._items.length,
+ map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
+
+ if (position === undefined) {
+ return $.map(this._clones, function(v, i) { return map(i) });
+ }
+
+ return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
+ };
+
+ /**
+ * Sets the current animation speed.
+ * @public
+ * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
+ * @returns {Number} - The current animation speed in milliseconds.
+ */
+ Owl.prototype.speed = function(speed) {
+ if (speed !== undefined) {
+ this._speed = speed;
+ }
+
+ return this._speed;
+ };
+
+ /**
+ * Gets the coordinate of an item.
+ * @todo The name of this method is missleanding.
+ * @public
+ * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
+ * @returns {Number|Array.} - The coordinate of the item in pixel or all coordinates.
+ */
+ Owl.prototype.coordinates = function(position) {
+ var coordinate = null;
+
+ if (position === undefined) {
+ return $.map(this._coordinates, $.proxy(function(coordinate, index) {
+ return this.coordinates(index);
+ }, this));
+ }
+
+ if (this.settings.center) {
+ coordinate = this._coordinates[position];
+ coordinate += (this.width() - coordinate + (this._coordinates[position - 1] || 0)) / 2 * (this.settings.rtl ? -1 : 1);
+ } else {
+ coordinate = this._coordinates[position - 1] || 0;
+ }
+
+ return coordinate;
+ };
+
+ /**
+ * Calculates the speed for a translation.
+ * @protected
+ * @param {Number} from - The absolute position of the start item.
+ * @param {Number} to - The absolute position of the target item.
+ * @param {Number} [factor=undefined] - The time factor in milliseconds.
+ * @returns {Number} - The time in milliseconds for the translation.
+ */
+ Owl.prototype.duration = function(from, to, factor) {
+ return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
+ };
+
+ /**
+ * Slides to the specified item.
+ * @public
+ * @param {Number} position - The position of the item.
+ * @param {Number} [speed] - The time in milliseconds for the transition.
+ */
+ Owl.prototype.to = function(position, speed) {
+ if (this.settings.loop) {
+ var distance = position - this.relative(this.current()),
+ revert = this.current(),
+ before = this.current(),
+ after = this.current() + distance,
+ direction = before - after < 0 ? true : false,
+ items = this._clones.length + this._items.length;
+
+ if (after < this.settings.items && direction === false) {
+ revert = before + this._items.length;
+ this.reset(revert);
+ } else if (after >= items - this.settings.items && direction === true) {
+ revert = before - this._items.length;
+ this.reset(revert);
+ }
+ window.clearTimeout(this.e._goToLoop);
+ this.e._goToLoop = window.setTimeout($.proxy(function() {
+ this.speed(this.duration(this.current(), revert + distance, speed));
+ this.current(revert + distance);
+ this.update();
+ }, this), 30);
+ } else {
+ this.speed(this.duration(this.current(), position, speed));
+ this.current(position);
+ this.update();
+ }
+ };
+
+ /**
+ * Slides to the next item.
+ * @public
+ * @param {Number} [speed] - The time in milliseconds for the transition.
+ */
+ Owl.prototype.next = function(speed) {
+ speed = speed || false;
+ this.to(this.relative(this.current()) + 1, speed);
+ };
+
+ /**
+ * Slides to the previous item.
+ * @public
+ * @param {Number} [speed] - The time in milliseconds for the transition.
+ */
+ Owl.prototype.prev = function(speed) {
+ speed = speed || false;
+ this.to(this.relative(this.current()) - 1, speed);
+ };
+
+ /**
+ * Handles the end of an animation.
+ * @protected
+ * @param {Event} event - The event arguments.
+ */
+ Owl.prototype.transitionEnd = function(event) {
+
+ // if css2 animation then event object is undefined
+ if (event !== undefined) {
+ event.stopPropagation();
+
+ // Catch only owl-stage transitionEnd event
+ if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
+ return false;
+ }
+ }
+
+ this.state.inMotion = false;
+ this.trigger('translated');
+ };
+
+ /**
+ * Gets viewport width.
+ * @protected
+ * @return {Number} - The width in pixel.
+ */
+ Owl.prototype.viewport = function() {
+ var width;
+ if (this.options.responsiveBaseElement !== window) {
+ width = $(this.options.responsiveBaseElement).width();
+ } else if (window.innerWidth) {
+ width = window.innerWidth;
+ } else if (document.documentElement && document.documentElement.clientWidth) {
+ width = document.documentElement.clientWidth;
+ } else {
+ throw 'Can not detect viewport width.';
+ }
+ return width;
+ };
+
+ /**
+ * Replaces the current content.
+ * @public
+ * @param {HTMLElement|jQuery|String} content - The new content.
+ */
+ Owl.prototype.replace = function(content) {
+ this.$stage.empty();
+ this._items = [];
+
+ if (content) {
+ content = (content instanceof jQuery) ? content : $(content);
+ }
+
+ if (this.settings.nestedItemSelector) {
+ content = content.find('.' + this.settings.nestedItemSelector);
+ }
+
+ content.filter(function() {
+ return this.nodeType === 1;
+ }).each($.proxy(function(index, item) {
+ item = this.prepare(item);
+ this.$stage.append(item);
+ this._items.push(item);
+ this._mergers.push(item.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
+ }, this));
+
+ this.reset($.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
+
+ this.invalidate('items');
+ };
+
+ /**
+ * Adds an item.
+ * @todo Use `item` instead of `content` for the event arguments.
+ * @public
+ * @param {HTMLElement|jQuery|String} content - The item content to add.
+ * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
+ */
+ Owl.prototype.add = function(content, position) {
+ position = position === undefined ? this._items.length : this.normalize(position, true);
+
+ this.trigger('add', { content: content, position: position });
+
+ if (this._items.length === 0 || position === this._items.length) {
+ this.$stage.append(content);
+ this._items.push(content);
+ this._mergers.push(content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
+ } else {
+ this._items[position].before(content);
+ this._items.splice(position, 0, content);
+ this._mergers.splice(position, 0, content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
+ }
+
+ this.invalidate('items');
+
+ this.trigger('added', { content: content, position: position });
+ };
+
+ /**
+ * Removes an item by its position.
+ * @todo Use `item` instead of `content` for the event arguments.
+ * @public
+ * @param {Number} position - The relative position of the item to remove.
+ */
+ Owl.prototype.remove = function(position) {
+ position = this.normalize(position, true);
+
+ if (position === undefined) {
+ return;
+ }
+
+ this.trigger('remove', { content: this._items[position], position: position });
+
+ this._items[position].remove();
+ this._items.splice(position, 1);
+ this._mergers.splice(position, 1);
+
+ this.invalidate('items');
+
+ this.trigger('removed', { content: null, position: position });
+ };
+
+ /**
+ * Adds triggerable events.
+ * @protected
+ */
+ Owl.prototype.addTriggerableEvents = function() {
+ var handler = $.proxy(function(callback, event) {
+ return $.proxy(function(e) {
+ if (e.relatedTarget !== this) {
+ this.suppress([ event ]);
+ callback.apply(this, [].slice.call(arguments, 1));
+ this.release([ event ]);
+ }
+ }, this);
+ }, this);
+
+ $.each({
+ 'next': this.next,
+ 'prev': this.prev,
+ 'to': this.to,
+ 'destroy': this.destroy,
+ 'refresh': this.refresh,
+ 'replace': this.replace,
+ 'add': this.add,
+ 'remove': this.remove
+ }, $.proxy(function(event, callback) {
+ this.$element.on(event + '.owl.carousel', handler(callback, event + '.owl.carousel'));
+ }, this));
+
+ };
+
+ /**
+ * Watches the visibility of the carousel element.
+ * @protected
+ */
+ Owl.prototype.watchVisibility = function() {
+
+ // test on zepto
+ if (!isElVisible(this.$element.get(0))) {
+ this.$element.addClass('owl-hidden');
+ window.clearInterval(this.e._checkVisibile);
+ this.e._checkVisibile = window.setInterval($.proxy(checkVisible, this), 500);
+ }
+
+ function isElVisible(el) {
+ return el.offsetWidth > 0 && el.offsetHeight > 0;
+ }
+
+ function checkVisible() {
+ if (isElVisible(this.$element.get(0))) {
+ this.$element.removeClass('owl-hidden');
+ this.refresh();
+ window.clearInterval(this.e._checkVisibile);
+ }
+ }
+ };
+
+ /**
+ * Preloads images with auto width.
+ * @protected
+ * @todo Still to test
+ */
+ Owl.prototype.preloadAutoWidthImages = function(imgs) {
+ var loaded, that, $el, img;
+
+ loaded = 0;
+ that = this;
+ imgs.each(function(i, el) {
+ $el = $(el);
+ img = new Image();
+
+ img.onload = function() {
+ loaded++;
+ $el.attr('src', img.src);
+ $el.css('opacity', 1);
+ if (loaded >= imgs.length) {
+ that.state.imagesLoaded = true;
+ that.initialize();
+ }
+ };
+
+ img.src = $el.attr('src') || $el.attr('data-src') || $el.attr('data-src-retina');
+ });
+ };
+
+ /**
+ * Destroys the carousel.
+ * @public
+ */
+ Owl.prototype.destroy = function() {
+
+ if (this.$element.hasClass(this.settings.themeClass)) {
+ this.$element.removeClass(this.settings.themeClass);
+ }
+
+ if (this.settings.responsive !== false) {
+ $(window).off('resize.owl.carousel');
+ }
+
+ if (this.transitionEndVendor) {
+ this.off(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd);
+ }
+
+ for ( var i in this._plugins) {
+ this._plugins[i].destroy();
+ }
+
+ if (this.settings.mouseDrag || this.settings.touchDrag) {
+ this.$stage.off('mousedown touchstart touchcancel');
+ $(document).off('.owl.dragEvents');
+ this.$stage.get(0).onselectstart = function() {};
+ this.$stage.off('dragstart', function() { return false });
+ }
+
+ // remove event handlers in the ".owl.carousel" namespace
+ this.$element.off('.owl');
+
+ this.$stage.children('.cloned').remove();
+ this.e = null;
+ this.$element.removeData('owlCarousel');
+
+ this.$stage.children().contents().unwrap();
+ this.$stage.children().unwrap();
+ this.$stage.unwrap();
+ };
+
+ /**
+ * Operators to calculate right-to-left and left-to-right.
+ * @protected
+ * @param {Number} [a] - The left side operand.
+ * @param {String} [o] - The operator.
+ * @param {Number} [b] - The right side operand.
+ */
+ Owl.prototype.op = function(a, o, b) {
+ var rtl = this.settings.rtl;
+ switch (o) {
+ case '<':
+ return rtl ? a > b : a < b;
+ case '>':
+ return rtl ? a < b : a > b;
+ case '>=':
+ return rtl ? a <= b : a >= b;
+ case '<=':
+ return rtl ? a >= b : a <= b;
+ default:
+ break;
+ }
+ };
+
+ /**
+ * Attaches to an internal event.
+ * @protected
+ * @param {HTMLElement} element - The event source.
+ * @param {String} event - The event name.
+ * @param {Function} listener - The event handler to attach.
+ * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
+ */
+ Owl.prototype.on = function(element, event, listener, capture) {
+ if (element.addEventListener) {
+ element.addEventListener(event, listener, capture);
+ } else if (element.attachEvent) {
+ element.attachEvent('on' + event, listener);
+ }
+ };
+
+ /**
+ * Detaches from an internal event.
+ * @protected
+ * @param {HTMLElement} element - The event source.
+ * @param {String} event - The event name.
+ * @param {Function} listener - The attached event handler to detach.
+ * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
+ */
+ Owl.prototype.off = function(element, event, listener, capture) {
+ if (element.removeEventListener) {
+ element.removeEventListener(event, listener, capture);
+ } else if (element.detachEvent) {
+ element.detachEvent('on' + event, listener);
+ }
+ };
+
+ /**
+ * Triggers an public event.
+ * @protected
+ * @param {String} name - The event name.
+ * @param {*} [data=null] - The event data.
+ * @param {String} [namespace=.owl.carousel] - The event namespace.
+ * @returns {Event} - The event arguments.
+ */
+ Owl.prototype.trigger = function(name, data, namespace) {
+ var status = {
+ item: { count: this._items.length, index: this.current() }
+ }, handler = $.camelCase(
+ $.grep([ 'on', name, namespace ], function(v) { return v })
+ .join('-').toLowerCase()
+ ), event = $.Event(
+ [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
+ $.extend({ relatedTarget: this }, status, data)
+ );
+
+ if (!this._supress[name]) {
+ $.each(this._plugins, function(name, plugin) {
+ if (plugin.onTrigger) {
+ plugin.onTrigger(event);
+ }
+ });
+
+ this.$element.trigger(event);
+
+ if (this.settings && typeof this.settings[handler] === 'function') {
+ this.settings[handler].apply(this, event);
+ }
+ }
+
+ return event;
+ };
+
+ /**
+ * Suppresses events.
+ * @protected
+ * @param {Array.} events - The events to suppress.
+ */
+ Owl.prototype.suppress = function(events) {
+ $.each(events, $.proxy(function(index, event) {
+ this._supress[event] = true;
+ }, this));
+ }
+
+ /**
+ * Releases suppressed events.
+ * @protected
+ * @param {Array.} events - The events to release.
+ */
+ Owl.prototype.release = function(events) {
+ $.each(events, $.proxy(function(index, event) {
+ delete this._supress[event];
+ }, this));
+ }
+
+ /**
+ * Checks the availability of some browser features.
+ * @protected
+ */
+ Owl.prototype.browserSupport = function() {
+ this.support3d = isPerspective();
+
+ if (this.support3d) {
+ this.transformVendor = isTransform();
+
+ // take transitionend event name by detecting transition
+ var endVendors = [ 'transitionend', 'webkitTransitionEnd', 'transitionend', 'oTransitionEnd' ];
+ this.transitionEndVendor = endVendors[isTransition()];
+
+ // take vendor name from transform name
+ this.vendorName = this.transformVendor.replace(/Transform/i, '');
+ this.vendorName = this.vendorName !== '' ? '-' + this.vendorName.toLowerCase() + '-' : '';
+ }
+
+ this.state.orientation = window.orientation;
+ };
+
+ /**
+ * Get touch/drag coordinats.
+ * @private
+ * @param {event} - mousedown/touchstart event
+ * @returns {object} - Contains X and Y of current mouse/touch position
+ */
+
+ function getTouches(event) {
+ if (event.touches !== undefined) {
+ return {
+ x: event.touches[0].pageX,
+ y: event.touches[0].pageY
+ };
+ }
+
+ if (event.touches === undefined) {
+ if (event.pageX !== undefined) {
+ return {
+ x: event.pageX,
+ y: event.pageY
+ };
+ }
+
+ if (event.pageX === undefined) {
+ return {
+ x: event.clientX,
+ y: event.clientY
+ };
+ }
+ }
+ }
+
+ /**
+ * Checks for CSS support.
+ * @private
+ * @param {Array} array - The CSS properties to check for.
+ * @returns {Array} - Contains the supported CSS property name and its index or `false`.
+ */
+ function isStyleSupported(array) {
+ var p, s, fake = document.createElement('div'), list = array;
+ for (p in list) {
+ s = list[p];
+ if (typeof fake.style[s] !== 'undefined') {
+ fake = null;
+ return [ s, p ];
+ }
+ }
+ return [ false ];
+ }
+
+ /**
+ * Checks for CSS transition support.
+ * @private
+ * @todo Realy bad design
+ * @returns {Number}
+ */
+ function isTransition() {
+ return isStyleSupported([ 'transition', 'WebkitTransition', 'MozTransition', 'OTransition' ])[1];
+ }
+
+ /**
+ * Checks for CSS transform support.
+ * @private
+ * @returns {String} The supported property name or false.
+ */
+ function isTransform() {
+ return isStyleSupported([ 'transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ])[0];
+ }
+
+ /**
+ * Checks for CSS perspective support.
+ * @private
+ * @returns {String} The supported property name or false.
+ */
+ function isPerspective() {
+ return isStyleSupported([ 'perspective', 'webkitPerspective', 'MozPerspective', 'OPerspective', 'MsPerspective' ])[0];
+ }
+
+ /**
+ * Checks wether touch is supported or not.
+ * @private
+ * @returns {Boolean}
+ */
+ function isTouchSupport() {
+ return 'ontouchstart' in window || !!(navigator.msMaxTouchPoints);
+ }
+
+ /**
+ * Checks wether touch is supported or not for IE.
+ * @private
+ * @returns {Boolean}
+ */
+ function isTouchSupportIE() {
+ return window.navigator.msPointerEnabled;
+ }
+
+ /**
+ * The jQuery Plugin for the Owl Carousel
+ * @public
+ */
+ $.fn.owlCarousel = function(options) {
+ return this.each(function() {
+ if (!$(this).data('owlCarousel')) {
+ $(this).data('owlCarousel', new Owl(this, options));
+ }
+ });
+ };
+
+ /**
+ * The constructor for the jQuery Plugin
+ * @public
+ */
+ $.fn.owlCarousel.Constructor = Owl;
+
+})(window.Zepto || window.jQuery, window, document);
+
+/**
+ * Lazy Plugin
+ * @version 2.0.0
+ * @author Bartosz Wojciechowski
+ * @license The MIT License (MIT)
+ */
+;(function($, window, document, undefined) {
+
+ /**
+ * Creates the lazy plugin.
+ * @class The Lazy Plugin
+ * @param {Owl} carousel - The Owl Carousel
+ */
+ var Lazy = function(carousel) {
+
+ /**
+ * Reference to the core.
+ * @protected
+ * @type {Owl}
+ */
+ this._core = carousel;
+
+ /**
+ * Already loaded items.
+ * @protected
+ * @type {Array.}
+ */
+ this._loaded = [];
+
+ /**
+ * Event handlers.
+ * @protected
+ * @type {Object}
+ */
+ this._handlers = {
+ 'initialized.owl.carousel change.owl.carousel': $.proxy(function(e) {
+ if (!e.namespace) {
+ return;
+ }
+
+ if (!this._core.settings || !this._core.settings.lazyLoad) {
+ return;
+ }
+
+ if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
+ var settings = this._core.settings,
+ n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
+ i = ((settings.center && n * -1) || 0),
+ position = ((e.property && e.property.value) || this._core.current()) + i,
+ clones = this._core.clones().length,
+ load = $.proxy(function(i, v) { this.load(v) }, this);
+
+ while (i++ < n) {
+ this.load(clones / 2 + this._core.relative(position));
+ clones && $.each(this._core.clones(this._core.relative(position++)), load);
+ }
+ }
+ }, this)
+ };
+
+ // set the default options
+ this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
+
+ // register event handler
+ this._core.$element.on(this._handlers);
+ }
+
+ /**
+ * Default options.
+ * @public
+ */
+ Lazy.Defaults = {
+ lazyLoad: false
+ }
+
+ /**
+ * Loads all resources of an item at the specified position.
+ * @param {Number} position - The absolute position of the item.
+ * @protected
+ */
+ Lazy.prototype.load = function(position) {
+ var $item = this._core.$stage.children().eq(position),
+ $elements = $item && $item.find('.owl-lazy');
+
+ if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
+ return;
+ }
+
+ $elements.each($.proxy(function(index, element) {
+ var $element = $(element), image,
+ url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src');
+
+ this._core.trigger('load', { element: $element, url: url }, 'lazy');
+
+ if ($element.is('img')) {
+ $element.one('load.owl.lazy', $.proxy(function() {
+ $element.css('opacity', 1);
+ this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
+ }, this)).attr('src', url);
+ } else {
+ image = new Image();
+ image.onload = $.proxy(function() {
+ $element.css({
+ 'background-image': 'url(' + url + ')',
+ 'opacity': '1'
+ });
+ this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
+ }, this);
+ image.src = url;
+ }
+ }, this));
+
+ this._loaded.push($item.get(0));
+ }
+
+ /**
+ * Destroys the plugin.
+ * @public
+ */
+ Lazy.prototype.destroy = function() {
+ var handler, property;
+
+ for (handler in this.handlers) {
+ this._core.$element.off(handler, this.handlers[handler]);
+ }
+ for (property in Object.getOwnPropertyNames(this)) {
+ typeof this[property] != 'function' && (this[property] = null);
+ }
+ }
+
+ $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
+
+})(window.Zepto || window.jQuery, window, document);
+
+/**
+ * AutoHeight Plugin
+ * @version 2.0.0
+ * @author Bartosz Wojciechowski
+ * @license The MIT License (MIT)
+ */
+;(function($, window, document, undefined) {
+
+ /**
+ * Creates the auto height plugin.
+ * @class The Auto Height Plugin
+ * @param {Owl} carousel - The Owl Carousel
+ */
+ var AutoHeight = function(carousel) {
+ /**
+ * Reference to the core.
+ * @protected
+ * @type {Owl}
+ */
+ this._core = carousel;
+
+ /**
+ * All event handlers.
+ * @protected
+ * @type {Object}
+ */
+ this._handlers = {
+ 'initialized.owl.carousel': $.proxy(function() {
+ if (this._core.settings.autoHeight) {
+ this.update();
+ }
+ }, this),
+ 'changed.owl.carousel': $.proxy(function(e) {
+ if (this._core.settings.autoHeight && e.property.name == 'position'){
+ this.update();
+ }
+ }, this),
+ 'loaded.owl.lazy': $.proxy(function(e) {
+ if (this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass)
+ === this._core.$stage.children().eq(this._core.current())) {
+ this.update();
+ }
+ }, this)
+ };
+
+ // set default options
+ this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
+
+ // register event handlers
+ this._core.$element.on(this._handlers);
+ };
+
+ /**
+ * Default options.
+ * @public
+ */
+ AutoHeight.Defaults = {
+ autoHeight: false,
+ autoHeightClass: 'owl-height'
+ };
+
+ /**
+ * Updates the view.
+ */
+ AutoHeight.prototype.update = function() {
+ this._core.$stage.parent()
+ .height(this._core.$stage.children().eq(this._core.current()).height())
+ .addClass(this._core.settings.autoHeightClass);
+ };
+
+ AutoHeight.prototype.destroy = function() {
+ var handler, property;
+
+ for (handler in this._handlers) {
+ this._core.$element.off(handler, this._handlers[handler]);
+ }
+ for (property in Object.getOwnPropertyNames(this)) {
+ typeof this[property] != 'function' && (this[property] = null);
+ }
+ };
+
+ $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
+
+})(window.Zepto || window.jQuery, window, document);
+
+/**
+ * Video Plugin
+ * @version 2.0.0
+ * @author Bartosz Wojciechowski
+ * @license The MIT License (MIT)
+ */
+;(function($, window, document, undefined) {
+
+ /**
+ * Creates the video plugin.
+ * @class The Video Plugin
+ * @param {Owl} carousel - The Owl Carousel
+ */
+ var Video = function(carousel) {
+ /**
+ * Reference to the core.
+ * @protected
+ * @type {Owl}
+ */
+ this._core = carousel;
+
+ /**
+ * Cache all video URLs.
+ * @protected
+ * @type {Object}
+ */
+ this._videos = {};
+
+ /**
+ * Current playing item.
+ * @protected
+ * @type {jQuery}
+ */
+ this._playing = null;
+
+ /**
+ * Whether this is in fullscreen or not.
+ * @protected
+ * @type {Boolean}
+ */
+ this._fullscreen = false;
+
+ /**
+ * All event handlers.
+ * @protected
+ * @type {Object}
+ */
+ this._handlers = {
+ 'resize.owl.carousel': $.proxy(function(e) {
+ if (this._core.settings.video && !this.isInFullScreen()) {
+ e.preventDefault();
+ }
+ }, this),
+ 'refresh.owl.carousel changed.owl.carousel': $.proxy(function(e) {
+ if (this._playing) {
+ this.stop();
+ }
+ }, this),
+ 'prepared.owl.carousel': $.proxy(function(e) {
+ var $element = $(e.content).find('.owl-video');
+ if ($element.length) {
+ $element.css('display', 'none');
+ this.fetch($element, $(e.content));
+ }
+ }, this)
+ };
+
+ // set default options
+ this._core.options = $.extend({}, Video.Defaults, this._core.options);
+
+ // register event handlers
+ this._core.$element.on(this._handlers);
+
+ this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
+ this.play(e);
+ }, this));
+ };
+
+ /**
+ * Default options.
+ * @public
+ */
+ Video.Defaults = {
+ video: false,
+ videoHeight: false,
+ videoWidth: false
+ };
+
+ /**
+ * Gets the video ID and the type (YouTube/Vimeo only).
+ * @protected
+ * @param {jQuery} target - The target containing the video data.
+ * @param {jQuery} item - The item containing the video.
+ */
+ Video.prototype.fetch = function(target, item) {
+
+ var type = target.attr('data-vimeo-id') ? 'vimeo' : 'youtube',
+ id = target.attr('data-vimeo-id') || target.attr('data-youtube-id'),
+ width = target.attr('data-width') || this._core.settings.videoWidth,
+ height = target.attr('data-height') || this._core.settings.videoHeight,
+ url = target.attr('href');
+
+ if (url) {
+ id = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
+
+ if (id[3].indexOf('youtu') > -1) {
+ type = 'youtube';
+ } else if (id[3].indexOf('vimeo') > -1) {
+ type = 'vimeo';
+ } else {
+ throw new Error('Video URL not supported.');
+ }
+ id = id[6];
+ } else {
+ throw new Error('Missing video URL.');
+ }
+
+ this._videos[url] = {
+ type: type,
+ id: id,
+ width: width,
+ height: height
+ };
+
+ item.attr('data-video', url);
+
+ this.thumbnail(target, this._videos[url]);
+ };
+
+ /**
+ * Creates video thumbnail.
+ * @protected
+ * @param {jQuery} target - The target containing the video data.
+ * @param {Object} info - The video info object.
+ * @see `fetch`
+ */
+ Video.prototype.thumbnail = function(target, video) {
+
+ var tnLink,
+ icon,
+ path,
+ dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
+ customTn = target.find('img'),
+ srcType = 'src',
+ lazyClass = '',
+ settings = this._core.settings,
+ create = function(path) {
+ icon = '
';
+
+ if (settings.lazyLoad) {
+ tnLink = '
';
+ } else {
+ tnLink = '
';
+ }
+ target.after(tnLink);
+ target.after(icon);
+ };
+
+ // wrap video content into owl-video-wrapper div
+ target.wrap('
');
+
+ if (this._core.settings.lazyLoad) {
+ srcType = 'data-src';
+ lazyClass = 'owl-lazy';
+ }
+
+ // custom thumbnail
+ if (customTn.length) {
+ create(customTn.attr(srcType));
+ customTn.remove();
+ return false;
+ }
+
+ if (video.type === 'youtube') {
+ path = "http://img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
+ create(path);
+ } else if (video.type === 'vimeo') {
+ $.ajax({
+ type: 'GET',
+ url: 'http://vimeo.com/api/v2/video/' + video.id + '.json',
+ jsonp: 'callback',
+ dataType: 'jsonp',
+ success: function(data) {
+ path = data[0].thumbnail_large;
+ create(path);
+ }
+ });
+ }
+ };
+
+ /**
+ * Stops the current video.
+ * @public
+ */
+ Video.prototype.stop = function() {
+ this._core.trigger('stop', null, 'video');
+ this._playing.find('.owl-video-frame').remove();
+ this._playing.removeClass('owl-video-playing');
+ this._playing = null;
+ };
+
+ /**
+ * Starts the current video.
+ * @public
+ * @param {Event} ev - The event arguments.
+ */
+ Video.prototype.play = function(ev) {
+ this._core.trigger('play', null, 'video');
+
+ if (this._playing) {
+ this.stop();
+ }
+
+ var target = $(ev.target || ev.srcElement),
+ item = target.closest('.' + this._core.settings.itemClass),
+ video = this._videos[item.attr('data-video')],
+ width = video.width || '100%',
+ height = video.height || this._core.$stage.height(),
+ html, wrap;
+
+ if (video.type === 'youtube') {
+ html = 'VIDEO ';
+ } else if (video.type === 'vimeo') {
+ html = '';
+ }
+
+ item.addClass('owl-video-playing');
+ this._playing = item;
+
+ wrap = $(''
+ + html + '
');
+ target.after(wrap);
+ };
+
+ /**
+ * Checks whether an video is currently in full screen mode or not.
+ * @todo Bad style because looks like a readonly method but changes members.
+ * @protected
+ * @returns {Boolean}
+ */
+ Video.prototype.isInFullScreen = function() {
+
+ // if Vimeo Fullscreen mode
+ var element = document.fullscreenElement || document.mozFullScreenElement
+ || document.webkitFullscreenElement;
+
+ if (element && $(element).parent().hasClass('owl-video-frame')) {
+ this._core.speed(0);
+ this._fullscreen = true;
+ }
+
+ if (element && this._fullscreen && this._playing) {
+ return false;
+ }
+
+ // comming back from fullscreen
+ if (this._fullscreen) {
+ this._fullscreen = false;
+ return false;
+ }
+
+ // check full screen mode and window orientation
+ if (this._playing) {
+ if (this._core.state.orientation !== window.orientation) {
+ this._core.state.orientation = window.orientation;
+ return false;
+ }
+ }
+
+ return true;
+ };
+
+ /**
+ * Destroys the plugin.
+ */
+ Video.prototype.destroy = function() {
+ var handler, property;
+
+ this._core.$element.off('click.owl.video');
+
+ for (handler in this._handlers) {
+ this._core.$element.off(handler, this._handlers[handler]);
+ }
+ for (property in Object.getOwnPropertyNames(this)) {
+ typeof this[property] != 'function' && (this[property] = null);
+ }
+ };
+
+ $.fn.owlCarousel.Constructor.Plugins.Video = Video;
+
+})(window.Zepto || window.jQuery, window, document);
+
+/**
+ * Animate Plugin
+ * @version 2.0.0
+ * @author Bartosz Wojciechowski
+ * @license The MIT License (MIT)
+ */
+;(function($, window, document, undefined) {
+
+ /**
+ * Creates the animate plugin.
+ * @class The Navigation Plugin
+ * @param {Owl} scope - The Owl Carousel
+ */
+ var Animate = function(scope) {
+ this.core = scope;
+ this.core.options = $.extend({}, Animate.Defaults, this.core.options);
+ this.swapping = true;
+ this.previous = undefined;
+ this.next = undefined;
+
+ this.handlers = {
+ 'change.owl.carousel': $.proxy(function(e) {
+ if (e.property.name == 'position') {
+ this.previous = this.core.current();
+ this.next = e.property.value;
+ }
+ }, this),
+ 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
+ this.swapping = e.type == 'translated';
+ }, this),
+ 'translate.owl.carousel': $.proxy(function(e) {
+ if (this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
+ this.swap();
+ }
+ }, this)
+ };
+
+ this.core.$element.on(this.handlers);
+ };
+
+ /**
+ * Default options.
+ * @public
+ */
+ Animate.Defaults = {
+ animateOut: false,
+ animateIn: false
+ };
+
+ /**
+ * Toggles the animation classes whenever an translations starts.
+ * @protected
+ * @returns {Boolean|undefined}
+ */
+ Animate.prototype.swap = function() {
+
+ if (this.core.settings.items !== 1 || !this.core.support3d) {
+ return;
+ }
+
+ this.core.speed(0);
+
+ var left,
+ clear = $.proxy(this.clear, this),
+ previous = this.core.$stage.children().eq(this.previous),
+ next = this.core.$stage.children().eq(this.next),
+ incoming = this.core.settings.animateIn,
+ outgoing = this.core.settings.animateOut;
+
+ if (this.core.current() === this.previous) {
+ return;
+ }
+
+ if (outgoing) {
+ left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
+ previous.css( { 'left': left + 'px' } )
+ .addClass('animated owl-animated-out')
+ .addClass(outgoing)
+ .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
+ }
+
+ if (incoming) {
+ next.addClass('animated owl-animated-in')
+ .addClass(incoming)
+ .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
+ }
+ };
+
+ Animate.prototype.clear = function(e) {
+ $(e.target).css( { 'left': '' } )
+ .removeClass('animated owl-animated-out owl-animated-in')
+ .removeClass(this.core.settings.animateIn)
+ .removeClass(this.core.settings.animateOut);
+ this.core.transitionEnd();
+ }
+
+ /**
+ * Destroys the plugin.
+ * @public
+ */
+ Animate.prototype.destroy = function() {
+ var handler, property;
+
+ for (handler in this.handlers) {
+ this.core.$element.off(handler, this.handlers[handler]);
+ }
+ for (property in Object.getOwnPropertyNames(this)) {
+ typeof this[property] != 'function' && (this[property] = null);
+ }
+ };
+
+ $.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
+
+})(window.Zepto || window.jQuery, window, document);
+
+/**
+ * Autoplay Plugin
+ * @version 2.0.0
+ * @author Bartosz Wojciechowski
+ * @license The MIT License (MIT)
+ */
+;(function($, window, document, undefined) {
+
+ /**
+ * Creates the autoplay plugin.
+ * @class The Autoplay Plugin
+ * @param {Owl} scope - The Owl Carousel
+ */
+ var Autoplay = function(scope) {
+ this.core = scope;
+ this.core.options = $.extend({}, Autoplay.Defaults, this.core.options);
+
+ this.handlers = {
+ 'translated.owl.carousel refreshed.owl.carousel': $.proxy(function() {
+ this.autoplay();
+ }, this),
+ 'play.owl.autoplay': $.proxy(function(e, t, s) {
+ this.play(t, s);
+ }, this),
+ 'stop.owl.autoplay': $.proxy(function() {
+ this.stop();
+ }, this),
+ 'mouseover.owl.autoplay': $.proxy(function() {
+ if (this.core.settings.autoplayHoverPause) {
+ this.pause();
+ }
+ }, this),
+ 'mouseleave.owl.autoplay': $.proxy(function() {
+ if (this.core.settings.autoplayHoverPause) {
+ this.autoplay();
+ }
+ }, this)
+ };
+
+ this.core.$element.on(this.handlers);
+ };
+
+ /**
+ * Default options.
+ * @public
+ */
+ Autoplay.Defaults = {
+ autoplay: false,
+ autoplayTimeout: 5000,
+ autoplayHoverPause: false,
+ autoplaySpeed: false
+ };
+
+ /**
+ * @protected
+ * @todo Must be documented.
+ */
+ Autoplay.prototype.autoplay = function() {
+ if (this.core.settings.autoplay && !this.core.state.videoPlay) {
+ window.clearInterval(this.interval);
+
+ this.interval = window.setInterval($.proxy(function() {
+ this.play();
+ }, this), this.core.settings.autoplayTimeout);
+ } else {
+ window.clearInterval(this.interval);
+ }
+ };
+
+ /**
+ * Starts the autoplay.
+ * @public
+ * @param {Number} [timeout] - ...
+ * @param {Number} [speed] - ...
+ * @returns {Boolean|undefined} - ...
+ * @todo Must be documented.
+ */
+ Autoplay.prototype.play = function(timeout, speed) {
+ // if tab is inactive - doesnt work in }
+ */
+ this._templates = [];
+
+ /**
+ * The carousel element.
+ * @type {jQuery}
+ */
+ this.$element = this._core.$element;
+
+ /**
+ * Overridden methods of the carousel.
+ * @protected
+ * @type {Object}
+ */
+ this._overrides = {
+ next: this._core.next,
+ prev: this._core.prev,
+ to: this._core.to
+ };
+
+ /**
+ * All event handlers.
+ * @protected
+ * @type {Object}
+ */
+ this._handlers = {
+ 'prepared.owl.carousel': $.proxy(function(e) {
+ if (this._core.settings.dotsData) {
+ this._templates.push($(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
+ }
+ }, this),
+ 'add.owl.carousel': $.proxy(function(e) {
+ if (this._core.settings.dotsData) {
+ this._templates.splice(e.position, 0, $(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
+ }
+ }, this),
+ 'remove.owl.carousel prepared.owl.carousel': $.proxy(function(e) {
+ if (this._core.settings.dotsData) {
+ this._templates.splice(e.position, 1);
+ }
+ }, this),
+ 'change.owl.carousel': $.proxy(function(e) {
+ if (e.property.name == 'position') {
+ if (!this._core.state.revert && !this._core.settings.loop && this._core.settings.navRewind) {
+ var current = this._core.current(),
+ maximum = this._core.maximum(),
+ minimum = this._core.minimum();
+ e.data = e.property.value > maximum
+ ? current >= maximum ? minimum : maximum
+ : e.property.value < minimum ? maximum : e.property.value;
+ }
+ }
+ }, this),
+ 'changed.owl.carousel': $.proxy(function(e) {
+ if (e.property.name == 'position') {
+ this.draw();
+ }
+ }, this),
+ 'refreshed.owl.carousel': $.proxy(function() {
+ if (!this._initialized) {
+ this.initialize();
+ this._initialized = true;
+ }
+ this._core.trigger('refresh', null, 'navigation');
+ this.update();
+ this.draw();
+ this._core.trigger('refreshed', null, 'navigation');
+ }, this)
+ };
+
+ // set default options
+ this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
+
+ // register event handlers
+ this.$element.on(this._handlers);
+ }
+
+ /**
+ * Default options.
+ * @public
+ * @todo Rename `slideBy` to `navBy`
+ */
+ Navigation.Defaults = {
+ nav: false,
+ navRewind: true,
+ navText: [ 'prev', 'next' ],
+ navSpeed: false,
+ navElement: 'div',
+ navContainer: false,
+ navContainerClass: 'owl-nav',
+ navClass: [ 'owl-prev', 'owl-next' ],
+ slideBy: 1,
+ dotClass: 'owl-dot',
+ dotsClass: 'owl-dots',
+ dots: true,
+ dotsEach: false,
+ dotData: false,
+ dotsSpeed: false,
+ dotsContainer: false,
+ controlsClass: 'owl-controls'
+ }
+
+ /**
+ * Initializes the layout of the plugin and extends the carousel.
+ * @protected
+ */
+ Navigation.prototype.initialize = function() {
+ var $container, override,
+ options = this._core.settings;
+
+ // create the indicator template
+ if (!options.dotsData) {
+ this._templates = [ $('')
+ .addClass(options.dotClass)
+ .append($('
'))
+ .prop('outerHTML') ];
+ }
+
+ // create controls container if needed
+ if (!options.navContainer || !options.dotsContainer) {
+ this._controls.$container = $('')
+ .addClass(options.controlsClass)
+ .appendTo(this.$element);
+ }
+
+ // create DOM structure for absolute navigation
+ this._controls.$indicators = options.dotsContainer ? $(options.dotsContainer)
+ : $('
').hide().addClass(options.dotsClass).appendTo(this._controls.$container);
+
+ this._controls.$indicators.on('click', 'div', $.proxy(function(e) {
+ var index = $(e.target).parent().is(this._controls.$indicators)
+ ? $(e.target).index() : $(e.target).parent().index();
+
+ e.preventDefault();
+
+ this.to(index, options.dotsSpeed);
+ }, this));
+
+ // create DOM structure for relative navigation
+ $container = options.navContainer ? $(options.navContainer)
+ : $('
').addClass(options.navContainerClass).prependTo(this._controls.$container);
+
+ this._controls.$next = $('<' + options.navElement + '>');
+ this._controls.$previous = this._controls.$next.clone();
+
+ this._controls.$previous
+ .addClass(options.navClass[0])
+ .html(options.navText[0])
+ .hide()
+ .prependTo($container)
+ .on('click', $.proxy(function(e) {
+ this.prev(options.navSpeed);
+ }, this));
+ this._controls.$next
+ .addClass(options.navClass[1])
+ .html(options.navText[1])
+ .hide()
+ .appendTo($container)
+ .on('click', $.proxy(function(e) {
+ this.next(options.navSpeed);
+ }, this));
+
+ // override public methods of the carousel
+ for (override in this._overrides) {
+ this._core[override] = $.proxy(this[override], this);
+ }
+ }
+
+ /**
+ * Destroys the plugin.
+ * @protected
+ */
+ Navigation.prototype.destroy = function() {
+ var handler, control, property, override;
+
+ for (handler in this._handlers) {
+ this.$element.off(handler, this._handlers[handler]);
+ }
+ for (control in this._controls) {
+ this._controls[control].remove();
+ }
+ for (override in this.overides) {
+ this._core[override] = this._overrides[override];
+ }
+ for (property in Object.getOwnPropertyNames(this)) {
+ typeof this[property] != 'function' && (this[property] = null);
+ }
+ }
+
+ /**
+ * Updates the internal state.
+ * @protected
+ */
+ Navigation.prototype.update = function() {
+ var i, j, k,
+ options = this._core.settings,
+ lower = this._core.clones().length / 2,
+ upper = lower + this._core.items().length,
+ size = options.center || options.autoWidth || options.dotData
+ ? 1 : options.dotsEach || options.items;
+
+ if (options.slideBy !== 'page') {
+ options.slideBy = Math.min(options.slideBy, options.items);
+ }
+
+ if (options.dots || options.slideBy == 'page') {
+ this._pages = [];
+
+ for (i = lower, j = 0, k = 0; i < upper; i++) {
+ if (j >= size || j === 0) {
+ this._pages.push({
+ start: i - lower,
+ end: i - lower + size - 1
+ });
+ j = 0, ++k;
+ }
+ j += this._core.mergers(this._core.relative(i));
+ }
+ }
+ }
+
+ /**
+ * Draws the user interface.
+ * @todo The option `dotData` wont work.
+ * @protected
+ */
+ Navigation.prototype.draw = function() {
+ var difference, i, html = '',
+ options = this._core.settings,
+ $items = this._core.$stage.children(),
+ index = this._core.relative(this._core.current());
+
+ if (options.nav && !options.loop && !options.navRewind) {
+ this._controls.$previous.toggleClass('disabled', index <= 0);
+ this._controls.$next.toggleClass('disabled', index >= this._core.maximum());
+ }
+
+ this._controls.$previous.toggle(options.nav);
+ this._controls.$next.toggle(options.nav);
+
+ if (options.dots) {
+ difference = this._pages.length - this._controls.$indicators.children().length;
+
+ if (options.dotData && difference !== 0) {
+ for (i = 0; i < this._controls.$indicators.children().length; i++) {
+ html += this._templates[this._core.relative(i)];
+ }
+ this._controls.$indicators.html(html);
+ } else if (difference > 0) {
+ html = new Array(difference + 1).join(this._templates[0]);
+ this._controls.$indicators.append(html);
+ } else if (difference < 0) {
+ this._controls.$indicators.children().slice(difference).remove();
+ }
+
+ this._controls.$indicators.find('.active').removeClass('active');
+ this._controls.$indicators.children().eq($.inArray(this.current(), this._pages)).addClass('active');
+ }
+
+ this._controls.$indicators.toggle(options.dots);
+ }
+
+ /**
+ * Extends event data.
+ * @protected
+ * @param {Event} event - The event object which gets thrown.
+ */
+ Navigation.prototype.onTrigger = function(event) {
+ var settings = this._core.settings;
+
+ event.page = {
+ index: $.inArray(this.current(), this._pages),
+ count: this._pages.length,
+ size: settings && (settings.center || settings.autoWidth || settings.dotData
+ ? 1 : settings.dotsEach || settings.items)
+ };
+ }
+
+ /**
+ * Gets the current page position of the carousel.
+ * @protected
+ * @returns {Number}
+ */
+ Navigation.prototype.current = function() {
+ var index = this._core.relative(this._core.current());
+ return $.grep(this._pages, function(o) {
+ return o.start <= index && o.end >= index;
+ }).pop();
+ }
+
+ /**
+ * Gets the current succesor/predecessor position.
+ * @protected
+ * @returns {Number}
+ */
+ Navigation.prototype.getPosition = function(successor) {
+ var position, length,
+ options = this._core.settings;
+
+ if (options.slideBy == 'page') {
+ position = $.inArray(this.current(), this._pages);
+ length = this._pages.length;
+ successor ? ++position : --position;
+ position = this._pages[((position % length) + length) % length].start;
+ } else {
+ position = this._core.relative(this._core.current());
+ length = this._core.items().length;
+ successor ? position += options.slideBy : position -= options.slideBy;
+ }
+ return position;
+ }
+
+ /**
+ * Slides to the next item or page.
+ * @public
+ * @param {Number} [speed=false] - The time in milliseconds for the transition.
+ */
+ Navigation.prototype.next = function(speed) {
+ $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
+ }
+
+ /**
+ * Slides to the previous item or page.
+ * @public
+ * @param {Number} [speed=false] - The time in milliseconds for the transition.
+ */
+ Navigation.prototype.prev = function(speed) {
+ $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
+ }
+
+ /**
+ * Slides to the specified item or page.
+ * @public
+ * @param {Number} position - The position of the item or page.
+ * @param {Number} [speed] - The time in milliseconds for the transition.
+ * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
+ */
+ Navigation.prototype.to = function(position, speed, standard) {
+ var length;
+
+ if (!standard) {
+ length = this._pages.length;
+ $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
+ } else {
+ $.proxy(this._overrides.to, this._core)(position, speed);
+ }
+ }
+
+ $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
+
+})(window.Zepto || window.jQuery, window, document);
+
+/**
+ * Hash Plugin
+ * @version 2.0.0
+ * @author Artus Kolanowski
+ * @license The MIT License (MIT)
+ */
+;(function($, window, document, undefined) {
+ 'use strict';
+
+ /**
+ * Creates the hash plugin.
+ * @class The Hash Plugin
+ * @param {Owl} carousel - The Owl Carousel
+ */
+ var Hash = function(carousel) {
+ /**
+ * Reference to the core.
+ * @protected
+ * @type {Owl}
+ */
+ this._core = carousel;
+
+ /**
+ * Hash table for the hashes.
+ * @protected
+ * @type {Object}
+ */
+ this._hashes = {};
+
+ /**
+ * The carousel element.
+ * @type {jQuery}
+ */
+ this.$element = this._core.$element;
+
+ /**
+ * All event handlers.
+ * @protected
+ * @type {Object}
+ */
+ this._handlers = {
+ 'initialized.owl.carousel': $.proxy(function() {
+ if (this._core.settings.startPosition == 'URLHash') {
+ $(window).trigger('hashchange.owl.navigation');
+ }
+ }, this),
+ 'prepared.owl.carousel': $.proxy(function(e) {
+ var hash = $(e.content).find('[data-hash]').andSelf('[data-hash]').attr('data-hash');
+ this._hashes[hash] = e.content;
+ }, this)
+ };
+
+ // set default options
+ this._core.options = $.extend({}, Hash.Defaults, this._core.options);
+
+ // register the event handlers
+ this.$element.on(this._handlers);
+
+ // register event listener for hash navigation
+ $(window).on('hashchange.owl.navigation', $.proxy(function() {
+ var hash = window.location.hash.substring(1),
+ items = this._core.$stage.children(),
+ position = this._hashes[hash] && items.index(this._hashes[hash]) || 0;
+
+ if (!hash) {
+ return false;
+ }
+
+ this._core.to(position, false, true);
+ }, this));
+ }
+
+ /**
+ * Default options.
+ * @public
+ */
+ Hash.Defaults = {
+ URLhashListener: false
+ }
+
+ /**
+ * Destroys the plugin.
+ * @public
+ */
+ Hash.prototype.destroy = function() {
+ var handler, property;
+
+ $(window).off('hashchange.owl.navigation');
+
+ for (handler in this._handlers) {
+ this._core.$element.off(handler, this._handlers[handler]);
+ }
+ for (property in Object.getOwnPropertyNames(this)) {
+ typeof this[property] != 'function' && (this[property] = null);
+ }
+ }
+
+ $.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
+
+})(window.Zepto || window.jQuery, window, document);
diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js
new file mode 100644
index 0000000..4d8e93d
--- /dev/null
+++ b/frontend/web/js/script.js
@@ -0,0 +1,120 @@
+$(document).ready(function(){
+
+ $(".phone_me_head").append("
Введите номер телефона
");
+ $(".submenu_button").removeAttr("href");
+
+
+
+
+ $(".submenu_button").click(function(){
+ $(".submenu_button").not(this).removeClass("active");
+ if($(this).hasClass("active")){
+ $(this).removeClass("active");
+ $(this).parent().find(".submenu").hide();
+ $(".meter").find(".menu_up").remove();
+ }
+ else{
+ $(this).addClass("active");
+ $(this).parent().find(".submenu").show();
+ $(".menu_up").clone().appendTo(".meter");
+ $(".meter").find(".menu_up").find(".submenu").remove();
+ $(document).mouseup(function (e){ // событие клика по веб-документу
+ var div = $(".submenu"); // тут указываем ID элемента
+ if (!div.is(e.target) // если клик был не по нашему блоку
+ && div.has(e.target).length === 0) { // и не по его дочерним элементам
+ if($(".submenu").is(":visible")){
+ $(".submenu_button").removeClass("active");
+ div.hide();
+ }
+ else{
+ }
+ div.hide(); // скрываем его
+ $(".meter").find(".menu_up").remove();
+ }
+ });
+ }
+ });
+
+ $(".sub_cat").hover(function(){
+ $(".sub_cat").not(this).removeClass("active");
+ $(".sub_cat_content").removeClass("visible");
+ $(this).addClass("active");
+ $(this).find(".sub_cat_content").addClass("visible");
+ });
+
+ $(".categories").find(".sub_cat").append('
');
+
+ $(".sub_cat").hover(function(){
+ $(".sub_cat").not(this).removeClass("active");
+ $(".sub_cat").not(this).removeClass("test_on");
+ $(".sub_cat_content").removeClass("visible");
+ $(this).addClass("active");
+ $(this).find(".sub_cat_content").addClass("visible");
+
+ if( $(this).height() > 20 )
+ {
+ $(this).addClass('big');
+ };
+ },
+ function(){
+ // $(this).find('span').removeClass('test_on');
+ });
+
+ //$(".modal_wrapper_login").find(".for_btn_position").find("button").click(function(){
+ // if($(".modal_wrapper_login").find("label:first").find("input").val().length == 0){
+ // $(".modal_wrapper_login").find("label:first").find("input").addClass("error");
+ // }
+ // if($(".modal_wrapper_login").find("label:first").next().find("input").val().length == 0){
+ // $(".modal_wrapper_login").find("label:first").next().find("input").addClass("error");
+ // }
+ //});
+ //$("input").focus(function(){
+ // $(this).removeClass('error');
+ //})
+ //
+ //$(".head_up_cell.srch").find(".srch_head_desc").find("a").click(function(){
+ // var link_text = $(this).text();
+ // $(".head_up_cell.srch").find("input").val(link_text);
+ //});
+ //
+ // $('#phone_num').keydown(function(e){
+ // $('.please_phone').addClass('visible');
+ // if (e.which == 48) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 49) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 50) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 51) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 52) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 53) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 54) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 55) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 56) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 57) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 96) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 97) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 98) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 99) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 100) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 101) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 102) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 103) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 104) {$('.please_phone').removeClass('visible');}
+ // else if (e.which == 105) {$('.please_phone').removeClass('visible');}
+ // else{$('.please_phone').removeClass('visible');}
+ //
+ // if(e.which == 13){
+ // $(".phone_me_head").find("button").click();
+ // }
+ // });
+ // $(".modal_window").keydown(function(e){
+ // if(e.which == 13){
+ // $(this).find("button").click();
+ // }
+ // });
+ // $(".busket_modal_wrapper").find(".modal_close_btn").click(function(){
+ // $(".busket_modal_wrapper").fadeOut(200);
+ // });
+ //
+ // $(".modal_window").find('form').submit(function() {
+ // return false;
+ // });
+});
diff --git a/frontend/web/robots.txt b/frontend/web/robots.txt
new file mode 100644
index 0000000..8093c87
--- /dev/null
+++ b/frontend/web/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow:
\ No newline at end of file
diff --git a/frontend/widgets/Seo.php b/frontend/widgets/Seo.php
new file mode 100644
index 0000000..f683633
--- /dev/null
+++ b/frontend/widgets/Seo.php
@@ -0,0 +1,160 @@
+url = \Yii::$app->request->url;
+ $this->project_name = \Yii::$app->name;
+ parent::init();
+
+ }
+
+
+ public function run()
+ {
+
+ $seoData = $this->getViewData();
+ foreach($seoData as $key=>$value){
+ $this->$key = $value;
+ }
+
+
+ switch ($this->row) {
+ case self::SEO_TEXT:
+ return $this->selectSeoData(self::SEO_TEXT);
+
+ break;
+ case self::H1:
+ return $this->selectSeoData(self::H1);
+ break;
+ case self::TITLE:
+
+ $filter = \Yii::$app->request->get('filter', []);
+ if(!empty($filter)){
+ $filter_row = '';
+ foreach($filter as $sub_filter_name => $sub_filter_array){
+ if($sub_filter_name=='options'){
+ foreach($sub_filter_array as $f_name=>$f_values){
+ $filter_row .= $f_name.':'.implode(',',$f_values).'|';
+ }
+ }
+
+ }
+ $this->fields['name'] = $filter_row;
+ }
+
+ $title = $this->selectSeoData(self::TITLE);
+
+
+
+ if(!empty($title)){
+ return $title;
+ } else {
+ return $this->project_name;
+ }
+
+ break;
+ case self::DESCRIPTION:
+ $description = $this->selectSeoData(self::DESCRIPTION);
+
+ if(!empty($description)){
+
+ $this->getView()->registerMetaTag([
+ 'name' => 'description',
+ 'content' => $description
+ ]);
+
+ }
+
+ break;
+ }
+
+
+ }
+
+ protected function replaceData($str)
+ {
+
+ if(!empty($this->fields)){
+ foreach($this->fields as $field_name => $field_value){
+ $str = str_replace('{'.$field_name.'}', $field_value, $str);
+ }
+ }
+ $str = str_replace('{project_name}', $this->project_name, $str);
+ return Html::encode($str);
+ }
+
+ protected function findSeoByUrl()
+ {
+ return \common\models\Seo::findOne(['url'=>$this->url]);
+ }
+
+ protected function findSeoByDynamic()
+ {
+ $query = SeoDynamic::find()->joinWith('seoCategory')->where(['controller'=> \Yii::$app->controller->id, 'action'=>\Yii::$app->controller->action->id]);
+ if(!empty($this->key)){
+ $query->andWhere(['key'=>$this->key]);
+ }
+ return $query->one();
+ }
+
+
+ protected function getViewData(){
+ $params = $this->getView()->params;
+ if(isset($params['seo'])){
+ return $params['seo'];
+ } else {
+ return [];
+ }
+ }
+
+ protected function selectSeoData($param){
+ $result = '';
+
+ $widgetData = $this->findSeoByUrl();
+
+ if($widgetData instanceof \common\models\Seo){
+
+ $result = $widgetData->$param;
+
+ }else if(!empty($this->$param)){
+
+ $result = $this->$param;
+
+ } else {
+
+ $widgetData = $this->findSeoByDynamic();
+
+ if($widgetData instanceof SeoDynamic){
+
+ $result = $widgetData->$param;
+
+ }
+
+ }
+
+ return $this->replaceData($result);
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/frontend/widgets/Slider.php b/frontend/widgets/Slider.php
new file mode 100644
index 0000000..0b3d536
--- /dev/null
+++ b/frontend/widgets/Slider.php
@@ -0,0 +1,30 @@
+where([\common\models\Slider::tableName().'.title'=>$this->title])->joinWith("sliderImage")->one();
+
+ return $this->render('slider',[
+ 'slider'=>$slider
+ ]);
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/frontend/widgets/views/slider.php b/frontend/widgets/views/slider.php
new file mode 100644
index 0000000..775ffaa
--- /dev/null
+++ b/frontend/widgets/views/slider.php
@@ -0,0 +1,63 @@
+
+
+ sliderImage as $image):
+ $htm = <<
+
+
+
+HTML;
+
+ if(!empty($image->price)) {
+ $htm .= <<
+
+
+HTML;
+ }
+
+ $htm .= <<
+
+HTML;
+ ?>
+
+
+ = Html::a($htm, Url::toRoute($image->url)); ?>
+
+
+
+
+
+duration ? $slider->duration : 5000;
+$speed = $slider->speed ? $slider->speed : 500;
+$js=" $(\".carousel\").owlCarousel({
+ items: 1,
+ loop: true,
+ nav: true,
+ startPosition: 2,
+ mouseDrag: false,
+ navSpeed: 800,
+ autoplay:true,
+ autoplayTimeout: $dur,
+ autoplaySpeed: $speed,
+ autoplayHoverPause:true,
+ navText: ['
', '
']
+ });";
+
+$this->registerJs($js);
+
+?>
diff --git a/init b/init
new file mode 100644
index 0000000..4c5145d
--- /dev/null
+++ b/init
@@ -0,0 +1,213 @@
+#!/usr/bin/env php
+
+ *
+ * @link http://www.yiiframework.com/
+ * @copyright Copyright (c) 2008 Yii Software LLC
+ * @license http://www.yiiframework.com/license/
+ */
+
+if (!extension_loaded('openssl')) {
+ die('The OpenSSL PHP extension is required by Yii2.');
+}
+
+$params = getParams();
+$root = str_replace('\\', '/', __DIR__);
+$envs = require("$root/environments/index.php");
+$envNames = array_keys($envs);
+
+echo "Yii Application Initialization Tool v1.0\n\n";
+
+$envName = null;
+if (empty($params['env']) || $params['env'] === '1') {
+ echo "Which environment do you want the application to be initialized in?\n\n";
+ foreach ($envNames as $i => $name) {
+ echo " [$i] $name\n";
+ }
+ echo "\n Your choice [0-" . (count($envs) - 1) . ', or "q" to quit] ';
+ $answer = trim(fgets(STDIN));
+
+ if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) {
+ echo "\n Quit initialization.\n";
+ exit(0);
+ }
+
+ if (isset($envNames[$answer])) {
+ $envName = $envNames[$answer];
+ }
+} else {
+ $envName = $params['env'];
+}
+
+if (!in_array($envName, $envNames)) {
+ $envsList = implode(', ', $envNames);
+ echo "\n $envName is not a valid environment. Try one of the following: $envsList. \n";
+ exit(2);
+}
+
+$env = $envs[$envName];
+
+if (empty($params['env'])) {
+ echo "\n Initialize the application under '{$envNames[$answer]}' environment? [yes|no] ";
+ $answer = trim(fgets(STDIN));
+ if (strncasecmp($answer, 'y', 1)) {
+ echo "\n Quit initialization.\n";
+ exit(0);
+ }
+}
+
+echo "\n Start initialization ...\n\n";
+$files = getFileList("$root/environments/{$env['path']}");
+if (isset($env['skipFiles'])) {
+ $skipFiles = $env['skipFiles'];
+ array_walk($skipFiles, function(&$value) use($env, $root) { $value = "$root/$value"; });
+ $files = array_diff($files, array_intersect_key($env['skipFiles'], array_filter($skipFiles, 'file_exists')));
+}
+$all = false;
+foreach ($files as $file) {
+ if (!copyFile($root, "environments/{$env['path']}/$file", $file, $all, $params)) {
+ break;
+ }
+}
+
+$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable', 'createSymlink'];
+foreach ($callbacks as $callback) {
+ if (!empty($env[$callback])) {
+ $callback($root, $env[$callback]);
+ }
+}
+
+echo "\n ... initialization completed.\n\n";
+
+function getFileList($root, $basePath = '')
+{
+ $files = [];
+ $handle = opendir($root);
+ while (($path = readdir($handle)) !== false) {
+ if ($path === '.git' || $path === '.svn' || $path === '.' || $path === '..') {
+ continue;
+ }
+ $fullPath = "$root/$path";
+ $relativePath = $basePath === '' ? $path : "$basePath/$path";
+ if (is_dir($fullPath)) {
+ $files = array_merge($files, getFileList($fullPath, $relativePath));
+ } else {
+ $files[] = $relativePath;
+ }
+ }
+ closedir($handle);
+ return $files;
+}
+
+function copyFile($root, $source, $target, &$all, $params)
+{
+ if (!is_file($root . '/' . $source)) {
+ echo " skip $target ($source not exist)\n";
+ return true;
+ }
+ if (is_file($root . '/' . $target)) {
+ if (file_get_contents($root . '/' . $source) === file_get_contents($root . '/' . $target)) {
+ echo " unchanged $target\n";
+ return true;
+ }
+ if ($all) {
+ echo " overwrite $target\n";
+ } else {
+ echo " exist $target\n";
+ echo " ...overwrite? [Yes|No|All|Quit] ";
+
+
+ $answer = !empty($params['overwrite']) ? $params['overwrite'] : trim(fgets(STDIN));
+ if (!strncasecmp($answer, 'q', 1)) {
+ return false;
+ } else {
+ if (!strncasecmp($answer, 'y', 1)) {
+ echo " overwrite $target\n";
+ } else {
+ if (!strncasecmp($answer, 'a', 1)) {
+ echo " overwrite $target\n";
+ $all = true;
+ } else {
+ echo " skip $target\n";
+ return true;
+ }
+ }
+ }
+ }
+ file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source));
+ return true;
+ }
+ echo " generate $target\n";
+ @mkdir(dirname($root . '/' . $target), 0777, true);
+ file_put_contents($root . '/' . $target, file_get_contents($root . '/' . $source));
+ return true;
+}
+
+function getParams()
+{
+ $rawParams = [];
+ if (isset($_SERVER['argv'])) {
+ $rawParams = $_SERVER['argv'];
+ array_shift($rawParams);
+ }
+
+ $params = [];
+ foreach ($rawParams as $param) {
+ if (preg_match('/^--(\w+)(=(.*))?$/', $param, $matches)) {
+ $name = $matches[1];
+ $params[$name] = isset($matches[3]) ? $matches[3] : true;
+ } else {
+ $params[] = $param;
+ }
+ }
+ return $params;
+}
+
+function setWritable($root, $paths)
+{
+ foreach ($paths as $writable) {
+ if (is_dir("$root/$writable")) {
+ echo " chmod 0777 $writable\n";
+ @chmod("$root/$writable", 0777);
+ } else {
+ echo "\n Error. Directory $writable does not exist. \n";
+ }
+ }
+}
+
+function setExecutable($root, $paths)
+{
+ foreach ($paths as $executable) {
+ echo " chmod 0755 $executable\n";
+ @chmod("$root/$executable", 0755);
+ }
+}
+
+function setCookieValidationKey($root, $paths)
+{
+ foreach ($paths as $file) {
+ echo " generate cookie validation key in $file\n";
+ $file = $root . '/' . $file;
+ $length = 32;
+ $bytes = openssl_random_pseudo_bytes($length);
+ $key = strtr(substr(base64_encode($bytes), 0, $length), '+/=', '_-.');
+ $content = preg_replace('/(("|\')cookieValidationKey("|\')\s*=>\s*)(""|\'\')/', "\\1'$key'", file_get_contents($file));
+ file_put_contents($file, $content);
+ }
+}
+
+function createSymlink($root, $links) {
+ foreach ($links as $link => $target) {
+ echo " symlink " . $root . "/" . $target . " " . $root . "/" . $link . "\n";
+ //first removing folders to avoid errors if the folder already exists
+ @rmdir($root . "/" . $link);
+ @symlink($root . "/" . $target, $root . "/" . $link);
+ }
+}
diff --git a/init.bat b/init.bat
new file mode 100644
index 0000000..2ade505
--- /dev/null
+++ b/init.bat
@@ -0,0 +1,20 @@
+@echo off
+
+rem -------------------------------------------------------------
+rem Yii command line init script for Windows.
+rem
+rem @author Qiang Xue
+rem @link http://www.yiiframework.com/
+rem @copyright Copyright (c) 2008 Yii Software LLC
+rem @license http://www.yiiframework.com/license/
+rem -------------------------------------------------------------
+
+@setlocal
+
+set YII_PATH=%~dp0
+
+if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
+
+"%PHP_COMMAND%" "%YII_PATH%init" %*
+
+@endlocal
diff --git a/requirements.php b/requirements.php
new file mode 100644
index 0000000..aa93439
--- /dev/null
+++ b/requirements.php
@@ -0,0 +1,132 @@
+Error';
+ echo 'The path to yii framework seems to be incorrect.
';
+ echo 'You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ' .
';
+ echo 'Please refer to the README on how to install Yii.
';
+}
+
+require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
+$requirementsChecker = new YiiRequirementChecker();
+
+$gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.';
+$gdOK = $imagickOK = false;
+
+if (extension_loaded('imagick')) {
+ $imagick = new Imagick();
+ $imagickFormats = $imagick->queryFormats('PNG');
+ if (in_array('PNG', $imagickFormats)) {
+ $imagickOK = true;
+ } else {
+ $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.';
+ }
+}
+
+if (extension_loaded('gd')) {
+ $gdInfo = gd_info();
+ if (!empty($gdInfo['FreeType Support'])) {
+ $gdOK = true;
+ } else {
+ $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.';
+ }
+}
+
+/**
+ * Adjust requirements according to your application specifics.
+ */
+$requirements = array(
+ // Database :
+ array(
+ 'name' => 'PDO extension',
+ 'mandatory' => true,
+ 'condition' => extension_loaded('pdo'),
+ 'by' => 'All DB-related classes',
+ ),
+ array(
+ 'name' => 'PDO SQLite extension',
+ 'mandatory' => false,
+ 'condition' => extension_loaded('pdo_sqlite'),
+ 'by' => 'All DB-related classes',
+ 'memo' => 'Required for SQLite database.',
+ ),
+ array(
+ 'name' => 'PDO MySQL extension',
+ 'mandatory' => false,
+ 'condition' => extension_loaded('pdo_mysql'),
+ 'by' => 'All DB-related classes',
+ 'memo' => 'Required for MySQL database.',
+ ),
+ array(
+ 'name' => 'PDO PostgreSQL extension',
+ 'mandatory' => false,
+ 'condition' => extension_loaded('pdo_pgsql'),
+ 'by' => 'All DB-related classes',
+ 'memo' => 'Required for PostgreSQL database.',
+ ),
+ // Cache :
+ array(
+ 'name' => 'Memcache extension',
+ 'mandatory' => false,
+ 'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
+ 'by' => 'MemCache ',
+ 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached to true.' : ''
+ ),
+ array(
+ 'name' => 'APC extension',
+ 'mandatory' => false,
+ 'condition' => extension_loaded('apc'),
+ 'by' => 'ApcCache ',
+ ),
+ // CAPTCHA:
+ array(
+ 'name' => 'GD PHP extension with FreeType support',
+ 'mandatory' => false,
+ 'condition' => $gdOK,
+ 'by' => 'Captcha ',
+ 'memo' => $gdMemo,
+ ),
+ array(
+ 'name' => 'ImageMagick PHP extension with PNG support',
+ 'mandatory' => false,
+ 'condition' => $imagickOK,
+ 'by' => 'Captcha ',
+ 'memo' => $imagickMemo,
+ ),
+ // PHP ini :
+ 'phpExposePhp' => array(
+ 'name' => 'Expose PHP',
+ 'mandatory' => false,
+ 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
+ 'by' => 'Security reasons',
+ 'memo' => '"expose_php" should be disabled at php.ini',
+ ),
+ 'phpAllowUrlInclude' => array(
+ 'name' => 'PHP allow url include',
+ 'mandatory' => false,
+ 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
+ 'by' => 'Security reasons',
+ 'memo' => '"allow_url_include" should be disabled at php.ini',
+ ),
+ 'phpSmtp' => array(
+ 'name' => 'PHP mail SMTP',
+ 'mandatory' => false,
+ 'condition' => strlen(ini_get('SMTP')) > 0,
+ 'by' => 'Email sending',
+ 'memo' => 'PHP mail SMTP server required',
+ ),
+);
+$requirementsChecker->checkYii()->check($requirements)->render();
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 0000000..5de94c6
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1,58 @@
+This directory contains various tests for the advanced applications.
+
+Tests in `codeception` directory are developed with [Codeception PHP Testing Framework](http://codeception.com/).
+
+After creating and setting up the advanced application, follow these steps to prepare for the tests:
+
+1. Install Codeception if it's not yet installed:
+
+ ```
+ composer global require "codeception/codeception=2.0.*" "codeception/specify=*" "codeception/verify=*"
+ ```
+
+ If you've never used Composer for global packages run `composer global status`. It should output:
+
+ ```
+ Changed current directory to
+ ```
+
+ Then add `/vendor/bin` to you `PATH` environment variable. Now you're able to use `codecept` from command
+ line globally.
+
+2. Install faker extension by running the following from template root directory where `composer.json` is:
+
+ ```
+ composer require --dev yiisoft/yii2-faker:*
+ ```
+
+3. Create `yii2_advanced_tests` database then update it by applying migrations:
+
+ ```
+ codeception/bin/yii migrate
+ ```
+
+4. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use PHP built in
+ webserver. In the root directory where `common`, `frontend` etc. are execute the following:
+
+ ```
+ php -S localhost:8080
+ ```
+
+5. Now you can run the tests with the following commands, assuming you are in the `tests/codeception` directory:
+
+ ```
+ # frontend tests
+ cd frontend
+ codecept build
+ codecept run
+
+ # backend tests
+
+ cd backend
+ codecept build
+ codecept run
+
+ # etc.
+ ```
+
+ If you already have run `codecept build` for each application, you can skip that step and run all tests by a single `codecept run`.
diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php
new file mode 100644
index 0000000..a302dda
--- /dev/null
+++ b/tests/_bootstrap.php
@@ -0,0 +1,2 @@
+getScenario()->runStep(new \Codeception\Step\Action('debugWebDriverLogs', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Changes the subdomain for the 'url' configuration parameter.
+ * Does not open a page; use `amOnPage` for that.
+ *
+ * ``` php
+ * amOnSubdomain('user');
+ * $I->amOnPage('/');
+ * // moves to http://user.mysite.com/
+ * ?>
+ * ```
+ *
+ * @param $subdomain
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::amOnSubdomain()
+ */
+ public function amOnSubdomain($subdomain) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Takes a screenshot of the current window and saves it to `tests/_output/debug`.
+ *
+ * ``` php
+ * amOnPage('/user/edit');
+ * $I->makeScreenshot('edit_page');
+ * // saved to: tests/_output/debug/edit_page.png
+ * ?>
+ * ```
+ *
+ * @param $name
+ * @see \Codeception\Module\WebDriver::makeScreenshot()
+ */
+ public function makeScreenshot($name) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('makeScreenshot', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Resize the current window.
+ *
+ * ``` php
+ * resizeWindow(800, 600);
+ *
+ * ```
+ *
+ * @param int $width
+ * @param int $height
+ * @see \Codeception\Module\WebDriver::resizeWindow()
+ */
+ public function resizeWindow($width, $height) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('resizeWindow', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that a cookie with the given name is set.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * ``` php
+ * seeCookie('PHPSESSID');
+ * ?>
+ * ```
+ *
+ * @param $cookie
+ * @param array $params
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeCookie()
+ */
+ public function canSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that a cookie with the given name is set.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * ``` php
+ * seeCookie('PHPSESSID');
+ * ?>
+ * ```
+ *
+ * @param $cookie
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::seeCookie()
+ */
+ public function seeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there isn't a cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeCookie()
+ */
+ public function cantSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there isn't a cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` as array passed in last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::dontSeeCookie()
+ */
+ public function dontSeeCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Sets a cookie with the given name and value.
+ * You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
+ *
+ * ``` php
+ * setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
+ * ?>
+ * ```
+ *
+ * @param $name
+ * @param $val
+ * @param array $params
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::setCookie()
+ */
+ public function setCookie($cookie, $value, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Unsets cookie with the given name.
+ * You can set additional cookie params like `domain`, `path` in array passed as last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::resetCookie()
+ */
+ public function resetCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs a cookie value.
+ * You can set additional cookie params like `domain`, `path` in array passed as last argument.
+ *
+ * @param $cookie
+ *
+ * @param array $params
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::grabCookie()
+ */
+ public function grabCookie($cookie, $params = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Open web page at the given absolute URL and sets its hostname as the base host.
+ *
+ * ``` php
+ * amOnUrl('http://codeception.com');
+ * $I->amOnPage('/quickstart'); // moves to http://codeception.com/quickstart
+ * ?>
+ * ```
+ * @see \Codeception\Module\WebDriver::amOnUrl()
+ */
+ public function amOnUrl($url) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Opens the page for the given relative URI.
+ *
+ * ``` php
+ * amOnPage('/');
+ * // opens /register page
+ * $I->amOnPage('/register');
+ * ```
+ *
+ * @param $page
+ * @see \Codeception\Module\WebDriver::amOnPage()
+ */
+ public function amOnPage($page) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string (case insensitive).
+ *
+ * You can specify a specific HTML element (via CSS or XPath) as the second
+ * parameter to only search within that element.
+ *
+ * ``` php
+ * see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up', '//body/h1'); // with XPath
+ * ```
+ *
+ * Note that the search is done after stripping all HTML tags from the body,
+ * so `$I->see('strong')` will return true for strings like:
+ *
+ * - `I am Stronger than thou
`
+ * - ``
+ *
+ * But will *not* be true for strings like:
+ *
+ * - `Home `
+ * - `Home`
+ * - ``
+ *
+ * For checking the raw source code, use `seeInSource()`.
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::see()
+ */
+ public function canSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string (case insensitive).
+ *
+ * You can specify a specific HTML element (via CSS or XPath) as the second
+ * parameter to only search within that element.
+ *
+ * ``` php
+ * see('Logout'); // I can suppose user is logged in
+ * $I->see('Sign Up', 'h1'); // I can suppose it's a signup page
+ * $I->see('Sign Up', '//body/h1'); // with XPath
+ * ```
+ *
+ * Note that the search is done after stripping all HTML tags from the body,
+ * so `$I->see('strong')` will return true for strings like:
+ *
+ * - `
I am Stronger than thou
`
+ * - ``
+ *
+ * But will *not* be true for strings like:
+ *
+ * - `
Home `
+ * - `
Home`
+ * - ``
+ *
+ * For checking the raw source code, use `seeInSource()`.
+ *
+ * @param $text
+ * @param null $selector
+ * @see \Codeception\Module\WebDriver::see()
+ */
+ public function see($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('see', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page doesn't contain the text specified (case insensitive).
+ * Give a locator as the second parameter to match a specific region.
+ *
+ * ```php
+ * dontSee('Login'); // I can suppose user is already logged in
+ * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
+ * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ```
+ *
+ * Note that the search is done after stripping all HTML tags from the body,
+ * so `$I->dontSee('strong')` will fail on strings like:
+ *
+ * - `
I am Stronger than thou
`
+ * - ``
+ *
+ * But will ignore strings like:
+ *
+ * - `
Home `
+ * - `
Home`
+ * - ``
+ *
+ * For checking the raw source code, use `seeInSource()`.
+ *
+ * @param $text
+ * @param null $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSee()
+ */
+ public function cantSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page doesn't contain the text specified (case insensitive).
+ * Give a locator as the second parameter to match a specific region.
+ *
+ * ```php
+ * dontSee('Login'); // I can suppose user is already logged in
+ * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
+ * $I->dontSee('Sign Up','//body/h1'); // with XPath
+ * ```
+ *
+ * Note that the search is done after stripping all HTML tags from the body,
+ * so `$I->dontSee('strong')` will fail on strings like:
+ *
+ * - `
I am Stronger than thou
`
+ * - ``
+ *
+ * But will ignore strings like:
+ *
+ * - `
Home `
+ * - `
Home`
+ * - ``
+ *
+ * For checking the raw source code, use `seeInSource()`.
+ *
+ * @param $text
+ * @param null $selector
+ * @see \Codeception\Module\WebDriver::dontSee()
+ */
+ public function dontSee($text, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string in its
+ * raw source code.
+ *
+ * ``` php
+ * seeInSource('
Green eggs & ham ');
+ * ```
+ *
+ * @param $raw
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeInSource()
+ */
+ public function canSeeInSource($raw) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInSource', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string in its
+ * raw source code.
+ *
+ * ``` php
+ * seeInSource('
Green eggs & ham ');
+ * ```
+ *
+ * @param $raw
+ * @see \Codeception\Module\WebDriver::seeInSource()
+ */
+ public function seeInSource($raw) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInSource', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string in its
+ * raw source code.
+ *
+ * ```php
+ * dontSeeInSource('
Green eggs & ham ');
+ * ```
+ *
+ * @param $raw
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeInSource()
+ */
+ public function cantSeeInSource($raw) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInSource', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current page contains the given string in its
+ * raw source code.
+ *
+ * ```php
+ * dontSeeInSource('
Green eggs & ham ');
+ * ```
+ *
+ * @param $raw
+ * @see \Codeception\Module\WebDriver::dontSeeInSource()
+ */
+ public function dontSeeInSource($raw) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInSource', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page source contains the given string.
+ *
+ * ```php
+ * seeInPageSource('
getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPageSource', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page source contains the given string.
+ *
+ * ```php
+ * seeInPageSource('
getScenario()->runStep(new \Codeception\Step\Assertion('seeInPageSource', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page source doesn't contain the given string.
+ *
+ * @param $text
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeInPageSource()
+ */
+ public function cantSeeInPageSource($text) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInPageSource', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page source doesn't contain the given string.
+ *
+ * @param $text
+ * @see \Codeception\Module\WebDriver::dontSeeInPageSource()
+ */
+ public function dontSeeInPageSource($text) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInPageSource', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Perform a click on a link or a button, given by a locator.
+ * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
+ * For buttons, the "value" attribute, "name" attribute, and inner text are searched.
+ * For links, the link text is searched.
+ * For images, the "alt" attribute and inner text of any parent links are searched.
+ *
+ * The second parameter is a context (CSS or XPath locator) to narrow the search.
+ *
+ * Note that if the locator matches a button of type `submit`, the form will be submitted.
+ *
+ * ``` php
+ * click('Logout');
+ * // button of form
+ * $I->click('Submit');
+ * // CSS button
+ * $I->click('#form input[type=submit]');
+ * // XPath
+ * $I->click('//form/*[@type=submit]');
+ * // link in context
+ * $I->click('Logout', '#nav');
+ * // using strict locator
+ * $I->click(['link' => 'Login']);
+ * ?>
+ * ```
+ *
+ * @param $link
+ * @param $context
+ * @see \Codeception\Module\WebDriver::click()
+ */
+ public function click($link, $context = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('click', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there's a link with the specified text.
+ * Give a full URL as the second parameter to match links with that exact URL.
+ *
+ * ``` php
+ * seeLink('Logout'); // matches
Logout
+ * $I->seeLink('Logout','/logout'); // matches
Logout
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeLink()
+ */
+ public function canSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there's a link with the specified text.
+ * Give a full URL as the second parameter to match links with that exact URL.
+ *
+ * ``` php
+ * seeLink('Logout'); // matches
Logout
+ * $I->seeLink('Logout','/logout'); // matches
Logout
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * @see \Codeception\Module\WebDriver::seeLink()
+ */
+ public function seeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page doesn't contain a link with the given string.
+ * If the second parameter is given, only links with a matching "href" attribute will be checked.
+ *
+ * ``` php
+ * dontSeeLink('Logout'); // I suppose user is not logged in
+ * $I->dontSeeLink('Checkout now', '/store/cart.php');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeLink()
+ */
+ public function cantSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page doesn't contain a link with the given string.
+ * If the second parameter is given, only links with a matching "href" attribute will be checked.
+ *
+ * ``` php
+ * dontSeeLink('Logout'); // I suppose user is not logged in
+ * $I->dontSeeLink('Checkout now', '/store/cart.php');
+ * ?>
+ * ```
+ *
+ * @param $text
+ * @param null $url
+ * @see \Codeception\Module\WebDriver::dontSeeLink()
+ */
+ public function dontSeeLink($text, $url = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current URI contains the given string.
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeInCurrentUrl()
+ */
+ public function canSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current URI contains the given string.
+ *
+ * ``` php
+ * seeInCurrentUrl('home');
+ * // to match: /users/1
+ * $I->seeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Module\WebDriver::seeInCurrentUrl()
+ */
+ public function seeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL is equal to the given string.
+ * Unlike `seeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals()
+ */
+ public function canSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL is equal to the given string.
+ * Unlike `seeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * seeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Module\WebDriver::seeCurrentUrlEquals()
+ */
+ public function seeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL matches the given regular expression.
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches()
+ */
+ public function canSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL matches the given regular expression.
+ *
+ * ``` php
+ * seeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Module\WebDriver::seeCurrentUrlMatches()
+ */
+ public function seeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URI doesn't contain the given string.
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl()
+ */
+ public function cantSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URI doesn't contain the given string.
+ *
+ * ``` php
+ * dontSeeInCurrentUrl('/users/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Module\WebDriver::dontSeeInCurrentUrl()
+ */
+ public function dontSeeInCurrentUrl($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL doesn't equal the given string.
+ * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals()
+ */
+ public function cantSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the current URL doesn't equal the given string.
+ * Unlike `dontSeeInCurrentUrl`, this only matches the full URL.
+ *
+ * ``` php
+ * dontSeeCurrentUrlEquals('/');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlEquals()
+ */
+ public function dontSeeCurrentUrlEquals($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url doesn't match the given regular expression.
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches()
+ */
+ public function cantSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that current url doesn't match the given regular expression.
+ *
+ * ``` php
+ * dontSeeCurrentUrlMatches('~$/users/(\d+)~');
+ * ?>
+ * ```
+ *
+ * @param $uri
+ * @see \Codeception\Module\WebDriver::dontSeeCurrentUrlMatches()
+ */
+ public function dontSeeCurrentUrlMatches($uri) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Executes the given regular expression against the current URI and returns the first match.
+ * If no parameters are provided, the full URI is returned.
+ *
+ * ``` php
+ * grabFromCurrentUrl('~$/user/(\d+)/~');
+ * $uri = $I->grabFromCurrentUrl();
+ * ?>
+ * ```
+ *
+ * @param null $uri
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::grabFromCurrentUrl()
+ */
+ public function grabFromCurrentUrl($uri = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the specified checkbox is checked.
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked()
+ */
+ public function canSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the specified checkbox is checked.
+ *
+ * ``` php
+ * seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
+ * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see \Codeception\Module\WebDriver::seeCheckboxIsChecked()
+ */
+ public function seeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that the specified checkbox is unchecked.
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked()
+ */
+ public function cantSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Check that the specified checkbox is unchecked.
+ *
+ * ``` php
+ * dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
+ * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
+ * ?>
+ * ```
+ *
+ * @param $checkbox
+ * @see \Codeception\Module\WebDriver::dontSeeCheckboxIsChecked()
+ */
+ public function dontSeeCheckboxIsChecked($checkbox) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given input field or textarea contains the given value.
+ * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
+ *
+ * ``` php
+ * seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * $I->seeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeInField()
+ */
+ public function canSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given input field or textarea contains the given value.
+ * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
+ *
+ * ``` php
+ * seeInField('Body','Type your comment here');
+ * $I->seeInField('form textarea[name=body]','Type your comment here');
+ * $I->seeInField('form input[type=hidden]','hidden_value');
+ * $I->seeInField('#searchform input','Search');
+ * $I->seeInField('//form/*[@name=search]','Search');
+ * $I->seeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Module\WebDriver::seeInField()
+ */
+ public function seeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that an input field or textarea doesn't contain the given value.
+ * For fuzzy locators, the field is matched by label text, CSS and XPath.
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * $I->dontSeeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeInField()
+ */
+ public function cantSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that an input field or textarea doesn't contain the given value.
+ * For fuzzy locators, the field is matched by label text, CSS and XPath.
+ *
+ * ``` php
+ * dontSeeInField('Body','Type your comment here');
+ * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
+ * $I->dontSeeInField('form input[type=hidden]','hidden_value');
+ * $I->dontSeeInField('#searchform input','Search');
+ * $I->dontSeeInField('//form/*[@name=search]','Search');
+ * $I->dontSeeInField(['name' => 'search'], 'Search');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Module\WebDriver::dontSeeInField()
+ */
+ public function dontSeeInField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are set on the form matched with the
+ * passed selector.
+ *
+ * ``` php
+ * seeInFormFields('form[name=myform]', [
+ * 'input1' => 'value',
+ * 'input2' => 'other value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * For multi-select elements, or to check values of multiple elements with the same name, an
+ * array may be passed:
+ *
+ * ``` php
+ * seeInFormFields('.form-class', [
+ * 'multiselect' => [
+ * 'value1',
+ * 'value2',
+ * ],
+ * 'checkbox[]' => [
+ * 'a checked value',
+ * 'another checked value',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * seeInFormFields('#form-id', [
+ * 'checkbox1' => true, // passes if checked
+ * 'checkbox2' => false, // passes if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * Pair this with submitForm for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeInFormFields()
+ */
+ public function canSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInFormFields', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are set on the form matched with the
+ * passed selector.
+ *
+ * ``` php
+ * seeInFormFields('form[name=myform]', [
+ * 'input1' => 'value',
+ * 'input2' => 'other value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * For multi-select elements, or to check values of multiple elements with the same name, an
+ * array may be passed:
+ *
+ * ``` php
+ * seeInFormFields('.form-class', [
+ * 'multiselect' => [
+ * 'value1',
+ * 'value2',
+ * ],
+ * 'checkbox[]' => [
+ * 'a checked value',
+ * 'another checked value',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * seeInFormFields('#form-id', [
+ * 'checkbox1' => true, // passes if checked
+ * 'checkbox2' => false, // passes if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * Pair this with submitForm for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * @see \Codeception\Module\WebDriver::seeInFormFields()
+ */
+ public function seeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInFormFields', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are not set on the form matched with
+ * the passed selector.
+ *
+ * ``` php
+ * dontSeeInFormFields('form[name=myform]', [
+ * 'input1' => 'non-existent value',
+ * 'input2' => 'other non-existent value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * To check that an element hasn't been assigned any one of many values, an array can be passed
+ * as the value:
+ *
+ * ``` php
+ * dontSeeInFormFields('.form-class', [
+ * 'fieldName' => [
+ * 'This value shouldn\'t be set',
+ * 'And this value shouldn\'t be set',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * dontSeeInFormFields('#form-id', [
+ * 'checkbox1' => true, // fails if checked
+ * 'checkbox2' => false, // fails if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeInFormFields()
+ */
+ public function cantSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInFormFields', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks if the array of form parameters (name => value) are not set on the form matched with
+ * the passed selector.
+ *
+ * ``` php
+ * dontSeeInFormFields('form[name=myform]', [
+ * 'input1' => 'non-existent value',
+ * 'input2' => 'other non-existent value',
+ * ]);
+ * ?>
+ * ```
+ *
+ * To check that an element hasn't been assigned any one of many values, an array can be passed
+ * as the value:
+ *
+ * ``` php
+ * dontSeeInFormFields('.form-class', [
+ * 'fieldName' => [
+ * 'This value shouldn\'t be set',
+ * 'And this value shouldn\'t be set',
+ * ],
+ * ]);
+ * ?>
+ * ```
+ *
+ * Additionally, checkbox values can be checked with a boolean.
+ *
+ * ``` php
+ * dontSeeInFormFields('#form-id', [
+ * 'checkbox1' => true, // fails if checked
+ * 'checkbox2' => false, // fails if unchecked
+ * ]);
+ * ?>
+ * ```
+ *
+ * @param $formSelector
+ * @param $params
+ * @see \Codeception\Module\WebDriver::dontSeeInFormFields()
+ */
+ public function dontSeeInFormFields($formSelector, $params) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInFormFields', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Selects an option in a select tag or in radio button group.
+ *
+ * ``` php
+ * selectOption('form select[name=account]', 'Premium');
+ * $I->selectOption('form input[name=payment]', 'Monthly');
+ * $I->selectOption('//form/select[@name=account]', 'Monthly');
+ * ?>
+ * ```
+ *
+ * Provide an array for the second argument to select multiple options:
+ *
+ * ``` php
+ * selectOption('Which OS do you use?', array('Windows','Linux'));
+ * ?>
+ * ```
+ *
+ * @param $select
+ * @param $option
+ * @see \Codeception\Module\WebDriver::selectOption()
+ */
+ public function selectOption($select, $option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('selectOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ *
+ * @see \Codeception\Module\WebDriver::unselectOption()
+ */
+ public function unselectOption($select, $option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('unselectOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Ticks a checkbox. For radio buttons, use the `selectOption` method instead.
+ *
+ * ``` php
+ * checkOption('#agree');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see \Codeception\Module\WebDriver::checkOption()
+ */
+ public function checkOption($option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('checkOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Unticks a checkbox.
+ *
+ * ``` php
+ * uncheckOption('#notify');
+ * ?>
+ * ```
+ *
+ * @param $option
+ * @see \Codeception\Module\WebDriver::uncheckOption()
+ */
+ public function uncheckOption($option) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Fills a text field or textarea with the given string.
+ *
+ * ``` php
+ * fillField("//input[@type='text']", "Hello World!");
+ * $I->fillField(['name' => 'email'], 'jon@mail.com');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $value
+ * @see \Codeception\Module\WebDriver::fillField()
+ */
+ public function fillField($field, $value) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('fillField', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Attaches a file relative to the Codeception data directory to the given file upload field.
+ *
+ * ``` php
+ * attachFile('input[@type="file"]', 'prices.xls');
+ * ?>
+ * ```
+ *
+ * @param $field
+ * @param $filename
+ * @see \Codeception\Module\WebDriver::attachFile()
+ */
+ public function attachFile($field, $filename) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('attachFile', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs all visible text from the current page.
+ *
+ * @return string
+ * @see \Codeception\Module\WebDriver::getVisibleText()
+ */
+ public function getVisibleText() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('getVisibleText', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Finds and returns the text contents of the given element.
+ * If a fuzzy locator is used, the element is found using CSS, XPath, and by matching the full page source by regular expression.
+ *
+ * ``` php
+ * grabTextFrom('h1');
+ * $heading = $I->grabTextFrom('descendant-or-self::h1');
+ * $value = $I->grabTextFrom('~
+ * ```
+ *
+ * @param $cssOrXPathOrRegex
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::grabTextFrom()
+ */
+ public function grabTextFrom($cssOrXPathOrRegex) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs the value of the given attribute value from the given element.
+ * Fails if element is not found.
+ *
+ * ``` php
+ * grabAttributeFrom('#tooltip', 'title');
+ * ?>
+ * ```
+ *
+ *
+ * @param $cssOrXpath
+ * @param $attribute
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::grabAttributeFrom()
+ */
+ public function grabAttributeFrom($cssOrXpath, $attribute) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabAttributeFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Finds the value for the given form field.
+ * If a fuzzy locator is used, the field is found by field name, CSS, and XPath.
+ *
+ * ``` php
+ * grabValueFrom('Name');
+ * $name = $I->grabValueFrom('input[name=username]');
+ * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']');
+ * $name = $I->grabValueFrom(['name' => 'username']);
+ * ?>
+ * ```
+ *
+ * @param $field
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::grabValueFrom()
+ */
+ public function grabValueFrom($field) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Grabs either the text content, or attribute values, of nodes
+ * matched by $cssOrXpath and returns them as an array.
+ *
+ * ```html
+ *
First
+ *
Second
+ *
Third
+ * ```
+ *
+ * ```php
+ * grabMultiple('a');
+ *
+ * // would return ['#first', '#second', '#third']
+ * $aLinks = $I->grabMultiple('a', 'href');
+ * ?>
+ * ```
+ *
+ * @param $cssOrXpath
+ * @param $attribute
+ * @return string[]
+ * @see \Codeception\Module\WebDriver::grabMultiple()
+ */
+ public function grabMultiple($cssOrXpath, $attribute = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('grabMultiple', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page and is visible.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * $I->seeElement('input', ['name' => 'login']);
+ * $I->seeElement('input', ['value' => '123456']);
+ *
+ * // strict locator in first arg, attributes in second
+ * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @return
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeElement()
+ */
+ public function canSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page and is visible.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * seeElement('.error');
+ * $I->seeElement('//form/input[1]');
+ * $I->seeElement('input', ['name' => 'login']);
+ * $I->seeElement('input', ['value' => '123456']);
+ *
+ * // strict locator in first arg, attributes in second
+ * $I->seeElement(['css' => 'form input'], ['name' => 'login']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @return
+ * @see \Codeception\Module\WebDriver::seeElement()
+ */
+ public function seeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element is invisible or not present on the page.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * $I->dontSeeElement('input', ['name' => 'login']);
+ * $I->dontSeeElement('input', ['value' => '123456']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeElement()
+ */
+ public function cantSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element is invisible or not present on the page.
+ * You can also specify expected attributes of this element.
+ *
+ * ``` php
+ * dontSeeElement('.error');
+ * $I->dontSeeElement('//form/input[1]');
+ * $I->dontSeeElement('input', ['name' => 'login']);
+ * $I->dontSeeElement('input', ['value' => '123456']);
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param array $attributes
+ * @see \Codeception\Module\WebDriver::dontSeeElement()
+ */
+ public function dontSeeElement($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page, even it is invisible.
+ *
+ * ``` php
+ * seeElementInDOM('//form/input[type=hidden]');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeElementInDOM()
+ */
+ public function canSeeElementInDOM($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeElementInDOM', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given element exists on the page, even it is invisible.
+ *
+ * ``` php
+ * seeElementInDOM('//form/input[type=hidden]');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @see \Codeception\Module\WebDriver::seeElementInDOM()
+ */
+ public function seeElementInDOM($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeElementInDOM', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Opposite of `seeElementInDOM`.
+ *
+ * @param $selector
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeElementInDOM()
+ */
+ public function cantSeeElementInDOM($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeElementInDOM', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Opposite of `seeElementInDOM`.
+ *
+ * @param $selector
+ * @see \Codeception\Module\WebDriver::dontSeeElementInDOM()
+ */
+ public function dontSeeElementInDOM($selector, $attributes = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeElementInDOM', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there are a certain number of elements matched by the given locator on the page.
+ *
+ * ``` php
+ * seeNumberOfElements('tr', 10);
+ * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
+ * ?>
+ * ```
+ * @param $selector
+ * @param mixed $expected :
+ * - string: strict number
+ * - array: range of numbers [0,10]
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeNumberOfElements()
+ */
+ public function canSeeNumberOfElements($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElements', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that there are a certain number of elements matched by the given locator on the page.
+ *
+ * ``` php
+ * seeNumberOfElements('tr', 10);
+ * $I->seeNumberOfElements('tr', [0,10]); //between 0 and 10 elements
+ * ?>
+ * ```
+ * @param $selector
+ * @param mixed $expected :
+ * - string: strict number
+ * - array: range of numbers [0,10]
+ * @see \Codeception\Module\WebDriver::seeNumberOfElements()
+ */
+ public function seeNumberOfElements($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElements', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ *
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM()
+ */
+ public function canSeeNumberOfElementsInDOM($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberOfElementsInDOM', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ *
+ * @see \Codeception\Module\WebDriver::seeNumberOfElementsInDOM()
+ */
+ public function seeNumberOfElementsInDOM($selector, $expected) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberOfElementsInDOM', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is selected.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeOptionIsSelected()
+ */
+ public function canSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is selected.
+ *
+ * ``` php
+ * seeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::seeOptionIsSelected()
+ */
+ public function seeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is not selected.
+ *
+ * ``` php
+ * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected()
+ */
+ public function cantSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the given option is not selected.
+ *
+ * ``` php
+ * dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
+ * ?>
+ * ```
+ *
+ * @param $selector
+ * @param $optionText
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::dontSeeOptionIsSelected()
+ */
+ public function dontSeeOptionIsSelected($selector, $optionText) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title contains the given string.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeInTitle()
+ */
+ public function canSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title contains the given string.
+ *
+ * ``` php
+ * seeInTitle('Blog - Post #1');
+ * ?>
+ * ```
+ *
+ * @param $title
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::seeInTitle()
+ */
+ public function seeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title does not contain the given string.
+ *
+ * @param $title
+ *
+ * @return mixed
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::dontSeeInTitle()
+ */
+ public function cantSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the page title does not contain the given string.
+ *
+ * @param $title
+ *
+ * @return mixed
+ * @see \Codeception\Module\WebDriver::dontSeeInTitle()
+ */
+ public function dontSeeInTitle($title) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Accepts the active JavaScript native popup window, as created by `window.alert`|`window.confirm`|`window.prompt`.
+ * Don't confuse popups with modal windows, as created by [various libraries](http://jster.net/category/windows-modals-popups).
+ * @see \Codeception\Module\WebDriver::acceptPopup()
+ */
+ public function acceptPopup() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('acceptPopup', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Dismisses the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`.
+ * @see \Codeception\Module\WebDriver::cancelPopup()
+ */
+ public function cancelPopup() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('cancelPopup', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
+ *
+ * @param $text
+ * Conditional Assertion: Test won't be stopped on fail
+ * @see \Codeception\Module\WebDriver::seeInPopup()
+ */
+ public function canSeeInPopup($text) {
+ return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args()));
+ }
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Checks that the active JavaScript popup, as created by `window.alert`|`window.confirm`|`window.prompt`, contains the given string.
+ *
+ * @param $text
+ * @see \Codeception\Module\WebDriver::seeInPopup()
+ */
+ public function seeInPopup($text) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Enters text into a native JavaScript prompt popup, as created by `window.prompt`.
+ *
+ * @param $keys
+ * @see \Codeception\Module\WebDriver::typeInPopup()
+ */
+ public function typeInPopup($keys) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('typeInPopup', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Reloads the current page.
+ * @see \Codeception\Module\WebDriver::reloadPage()
+ */
+ public function reloadPage() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('reloadPage', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Moves back in history.
+ * @see \Codeception\Module\WebDriver::moveBack()
+ */
+ public function moveBack() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('moveBack', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Moves forward in history.
+ * @see \Codeception\Module\WebDriver::moveForward()
+ */
+ public function moveForward() {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('moveForward', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Submits the given form on the page, optionally with the given form
+ * values. Give the form fields values as an array. Note that hidden fields
+ * can't be accessed.
+ *
+ * Skipped fields will be filled by their values from the page.
+ * You don't need to click the 'Submit' button afterwards.
+ * This command itself triggers the request to form's action.
+ *
+ * You can optionally specify what button's value to include
+ * in the request with the last parameter as an alternative to
+ * explicitly setting its value in the second parameter, as
+ * button values are not otherwise included in the request.
+ *
+ * Examples:
+ *
+ * ``` php
+ * submitForm('#login', [
+ * 'login' => 'davert',
+ * 'password' => '123456'
+ * ]);
+ * // or
+ * $I->submitForm('#login', [
+ * 'login' => 'davert',
+ * 'password' => '123456'
+ * ], 'submitButtonName');
+ *
+ * ```
+ *
+ * For example, given this sample "Sign Up" form:
+ *
+ * ``` html
+ *
+ * ```
+ *
+ * You could write the following to submit it:
+ *
+ * ``` php
+ * submitForm(
+ * '#userForm',
+ * [
+ * 'user[login]' => 'Davert',
+ * 'user[password]' => '123456',
+ * 'user[agree]' => true
+ * ],
+ * 'submitButton'
+ * );
+ * ```
+ * Note that "2" will be the submitted value for the "plan" field, as it is
+ * the selected option.
+ *
+ * Also note that this differs from PhpBrowser, in that
+ * ```'user' => [ 'login' => 'Davert' ]``` is not supported at the moment.
+ * Named array keys *must* be included in the name as above.
+ *
+ * Pair this with seeInFormFields for quick testing magic.
+ *
+ * ``` php
+ * 'value',
+ * 'field2' => 'another value',
+ * 'checkbox1' => true,
+ * // ...
+ * ];
+ * $I->submitForm('//form[@id=my-form]', $form, 'submitButton');
+ * // $I->amOnPage('/path/to/form-page') may be needed
+ * $I->seeInFormFields('//form[@id=my-form]', $form);
+ * ?>
+ * ```
+ *
+ * Parameter values must be set to arrays for multiple input fields
+ * of the same name, or multi-select combo boxes. For checkboxes,
+ * either the string value can be used, or boolean values which will
+ * be replaced by the checkbox's value in the DOM.
+ *
+ * ``` php
+ * submitForm('#my-form', [
+ * 'field1' => 'value',
+ * 'checkbox' => [
+ * 'value of first checkbox',
+ * 'value of second checkbox,
+ * ],
+ * 'otherCheckboxes' => [
+ * true,
+ * false,
+ * false
+ * ],
+ * 'multiselect' => [
+ * 'first option value',
+ * 'second option value'
+ * ]
+ * ]);
+ * ?>
+ * ```
+ *
+ * Mixing string and boolean values for a checkbox's value is not supported
+ * and may produce unexpected results.
+ *
+ * Field names ending in "[]" must be passed without the trailing square
+ * bracket characters, and must contain an array for its value. This allows
+ * submitting multiple values with the same name, consider:
+ *
+ * ```php
+ * $I->submitForm('#my-form', [
+ * 'field[]' => 'value',
+ * 'field[]' => 'another value', // 'field[]' is already a defined key
+ * ]);
+ * ```
+ *
+ * The solution is to pass an array value:
+ *
+ * ```php
+ * // this way both values are submitted
+ * $I->submitForm('#my-form', [
+ * 'field' => [
+ * 'value',
+ * 'another value',
+ * ]
+ * ]);
+ * ```
+ * @param $selector
+ * @param $params
+ * @param $button
+ * @see \Codeception\Module\WebDriver::submitForm()
+ */
+ public function submitForm($selector, $params, $button = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('submitForm', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Waits up to $timeout seconds for the given element to change.
+ * Element "change" is determined by a callback function which is called repeatedly until the return value evaluates to true.
+ *
+ * ``` php
+ * waitForElementChange('#menu', function(WebDriverElement $el) {
+ * return $el->isDisplayed();
+ * }, 100);
+ * ?>
+ * ```
+ *
+ * @param $element
+ * @param \Closure $callback
+ * @param int $timeout seconds
+ * @throws \Codeception\Exception\ElementNotFound
+ * @see \Codeception\Module\WebDriver::waitForElementChange()
+ */
+ public function waitForElementChange($element, $callback, $timeout = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementChange', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Waits up to $timeout seconds for an element to appear on the page.
+ * If the element doesn't appear, a timeout exception is thrown.
+ *
+ * ``` php
+ * waitForElement('#agree_button', 30); // secs
+ * $I->click('#agree_button');
+ * ?>
+ * ```
+ *
+ * @param $element
+ * @param int $timeout seconds
+ * @throws \Exception
+ * @see \Codeception\Module\WebDriver::waitForElement()
+ */
+ public function waitForElement($element, $timeout = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElement', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Waits up to $timeout seconds for the given element to be visible on the page.
+ * If element doesn't appear, a timeout exception is thrown.
+ *
+ * ``` php
+ * waitForElementVisible('#agree_button', 30); // secs
+ * $I->click('#agree_button');
+ * ?>
+ * ```
+ *
+ * @param $element
+ * @param int $timeout seconds
+ * @throws \Exception
+ * @see \Codeception\Module\WebDriver::waitForElementVisible()
+ */
+ public function waitForElementVisible($element, $timeout = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementVisible', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Waits up to $timeout seconds for the given element to become invisible.
+ * If element stays visible, a timeout exception is thrown.
+ *
+ * ``` php
+ * waitForElementNotVisible('#agree_button', 30); // secs
+ * ?>
+ * ```
+ *
+ * @param $element
+ * @param int $timeout seconds
+ * @throws \Exception
+ * @see \Codeception\Module\WebDriver::waitForElementNotVisible()
+ */
+ public function waitForElementNotVisible($element, $timeout = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForElementNotVisible', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Waits up to $timeout seconds for the given string to appear on the page.
+ * Can also be passed a selector to search in.
+ * If the given text doesn't appear, a timeout exception is thrown.
+ *
+ * ``` php
+ * waitForText('foo', 30); // secs
+ * $I->waitForText('foo', 30, '.title'); // secs
+ * ?>
+ * ```
+ *
+ * @param string $text
+ * @param int $timeout seconds
+ * @param null $selector
+ * @throws \Exception
+ * @see \Codeception\Module\WebDriver::waitForText()
+ */
+ public function waitForText($text, $timeout = null, $selector = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('waitForText', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Wait for $timeout seconds.
+ *
+ * @param int $timeout secs
+ * @throws \Codeception\Exception\TestRuntimeException
+ * @see \Codeception\Module\WebDriver::wait()
+ */
+ public function wait($timeout) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('wait', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Low-level API method.
+ * If Codeception commands are not enough, this allows you to use Selenium WebDriver methods directly:
+ *
+ * ``` php
+ * $I->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
+ * $webdriver->get('http://google.com');
+ * });
+ * ```
+ *
+ * This runs in the context of the [RemoteWebDriver class](https://github.com/facebook/php-webdriver/blob/master/lib/remote/RemoteWebDriver.php).
+ * Try not to use this command on a regular basis.
+ * If Codeception lacks a feature you need, please implement it and submit a patch.
+ *
+ * @param callable $function
+ * @see \Codeception\Module\WebDriver::executeInSelenium()
+ */
+ public function executeInSelenium($function) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('executeInSelenium', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Switch to another window identified by name.
+ *
+ * The window can only be identified by name. If the $name parameter is blank, the parent window will be used.
+ *
+ * Example:
+ * ``` html
+ *
+ * ```
+ *
+ * ``` php
+ * click("Open window");
+ * # switch to another window
+ * $I->switchToWindow("another_window");
+ * # switch to parent window
+ * $I->switchToWindow();
+ * ?>
+ * ```
+ *
+ * If the window has no name, the only way to access it is via the `executeInSelenium()` method, like so:
+ *
+ * ``` php
+ * executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
+ * $handles=$webdriver->getWindowHandles();
+ * $last_window = end($handles);
+ * $webdriver->switchTo()->window($last_window);
+ * });
+ * ?>
+ * ```
+ *
+ * @param string|null $name
+ * @see \Codeception\Module\WebDriver::switchToWindow()
+ */
+ public function switchToWindow($name = null) {
+ return $this->getScenario()->runStep(new \Codeception\Step\Action('switchToWindow', func_get_args()));
+ }
+
+
+ /**
+ * [!] Method is generated. Documentation taken from corresponding module.
+ *
+ * Switch to another frame on the page.
+ *
+ * Example:
+ * ``` html
+ *