diff --git a/backend/controllers/BlogController.php b/backend/controllers/BlogController.php deleted file mode 100755 index 4bf7891..0000000 --- a/backend/controllers/BlogController.php +++ /dev/null @@ -1,160 +0,0 @@ -[ - 'class' => AccessBehavior::className(), - 'rules' => - ['site' => - [ - [ - 'actions' => ['login', 'error'], - 'allow' => true, - ] - ] - ] - ], - '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())) { - - Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru'); - - if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) { - $model->cover = $image->name; - } - - if ($model->save() && $image) { - $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name)); - } - - 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())) { - - Fields::saveFieldData(Yii::$app->request->post('Fields'), $model->blog_id, Blog::className(), 'ru'); - - if ( ($image = UploadedFile::getInstance($model, 'imageUpload')) ) { - $model->cover = $image->name; - } - - if ($model->save() && $image) { - $image->saveAs(Yii::getAlias('@imagesDir/articles/' . $image->name)); - } - - 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/views/blog/_form.php b/backend/views/blog/_form.php deleted file mode 100755 index 5f27928..0000000 --- a/backend/views/blog/_form.php +++ /dev/null @@ -1,65 +0,0 @@ - - -
- - false, - 'options' => ['enctype' => 'multipart/form-data'] - ]); ?> - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'link')->textInput(['maxlength' => true]) ?> - - 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') - ] - ) - ]) ?> - - field($model, 'imageUpload')->widget(\kartik\file\FileInput::classname(), [ - 'language' => 'ru', - 'options' => [ - 'accept' => 'image/*', - 'multiple' => false, - ], - 'pluginOptions' => [ - 'allowedFileExtensions' => ['jpg', 'gif', 'png'], - 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '', - 'overwriteInitial' => true, - 'showRemove' => false, - 'showUpload' => false, - 'previewFileType' => 'image', - ], - ]); ?> - - 'education', - 'item_id' => $model->blog_id, - 'model' => 'common\models\Blog', - 'language' => 'ru', - ]); ?> -
- 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 deleted file mode 100755 index c3ac459..0000000 --- a/backend/views/blog/_search.php +++ /dev/null @@ -1,43 +0,0 @@ - - - diff --git a/backend/views/blog/create.php b/backend/views/blog/create.php deleted file mode 100755 index 54c74d2..0000000 --- a/backend/views/blog/create.php +++ /dev/null @@ -1,21 +0,0 @@ -title = 'Create Blog'; -$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/backend/views/blog/index.php b/backend/views/blog/index.php deleted file mode 100755 index 5a2716d..0000000 --- a/backend/views/blog/index.php +++ /dev/null @@ -1,40 +0,0 @@ -title = 'Blogs'; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- render('_search', ['model' => $searchModel]); ?> - -

- 'btn btn-success']) ?> -

- $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 deleted file mode 100755 index 05ecebd..0000000 --- a/backend/views/blog/update.php +++ /dev/null @@ -1,21 +0,0 @@ -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'; -?> -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/backend/views/blog/view.php b/backend/views/blog/view.php deleted file mode 100755 index 08a4665..0000000 --- a/backend/views/blog/view.php +++ /dev/null @@ -1,43 +0,0 @@ -title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Blogs', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- -

- $model->blog_id], ['class' => 'btn btn-primary']) ?> - $model->blog_id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', - ], - ]) ?> -

- - $model, - 'attributes' => [ - 'blog_id', - 'user_id', - 'name', - 'link', - 'date_add', - 'user_add_id', - 'view_count', - 'description:ntext', - 'cover', - ], - ]) ?> - -
diff --git a/common/models/Articles.php b/common/models/Articles.php index bd90b81..7dec7ed 100755 --- a/common/models/Articles.php +++ b/common/models/Articles.php @@ -5,6 +5,7 @@ namespace common\models; use common\behaviors\RatingBehavior; use common\modules\comment\models\CommentModel; use Yii; +use yii\db\ActiveQuery; /** * This is the model class for table "articles". @@ -20,9 +21,12 @@ use Yii; * @property string $meta_description * @property string $seo_text * @property string $h1 + * + * @todo Two same methods: getImageFile(), getImageUrl() */ class Articles extends \yii\db\ActiveRecord { + public $imageUpload; /** @@ -86,16 +90,25 @@ class Articles extends \yii\db\ActiveRecord 'h1' => 'H1', ]; } - + + /** + * @return bool|null|string + */ public function getImageFile() { return empty($this->image) ? null : Yii::getAlias('@imagesDir/articles/'. $this->image); } - + + /** + * @return bool|null|string + */ public function getImageUrl() { return empty($this->image) ? null : Yii::getAlias('@imagesUrl/articles/' . $this->image); } + /** + * @return bool + */ public function recalculateRating() { /** * @var ArticleToRating $averageRating @@ -117,10 +130,16 @@ class Articles extends \yii\db\ActiveRecord } } + /** + * @return ActiveQuery + */ public function getComments() { return $this->hasMany(CommentModel::className(), ['entity_id' => 'id'])->where(['artbox_comment.entity' => self::className(), 'artbox_comment.status' => CommentModel::STATUS_ACTIVE, 'artbox_comment.artbox_comment_pid' => NULL]); } + /** + * @return ActiveQuery + */ public function getAverageRating() { return $this->hasOne(ArticleToRating::className(), ['articles_id' => 'id']); } diff --git a/common/modules/comment/views/artbox_comment_item.php b/common/modules/comment/views/artbox_comment_item.php index c263fa9..59a4841 100755 --- a/common/modules/comment/views/artbox_comment_item.php +++ b/common/modules/comment/views/artbox_comment_item.php @@ -35,7 +35,7 @@ rating )) { ?> -
+
1 rating->value; ?> 5 diff --git a/common/modules/rubrication/behaviors/ArtboxSynonymBehavior.php b/common/modules/rubrication/behaviors/ArtboxSynonymBehavior.php index 093fc15..3677547 100755 --- a/common/modules/rubrication/behaviors/ArtboxSynonymBehavior.php +++ b/common/modules/rubrication/behaviors/ArtboxSynonymBehavior.php @@ -7,10 +7,7 @@ use dosamigos\transliterator\TransliteratorHelper; use yii\base\Behavior; use yii\base\Exception; use yii\db\ActiveRecord; -use Yii; -use yii\helpers\ArrayHelper; use yii\helpers\Inflector; -use yii\web\NotFoundHttpException; class ArtboxSynonymBehavior extends Behavior { diff --git a/console/migrations/m160811_143339_delete_blog_column.php b/console/migrations/m160811_143339_delete_blog_column.php new file mode 100644 index 0000000..622b5d8 --- /dev/null +++ b/console/migrations/m160811_143339_delete_blog_column.php @@ -0,0 +1,28 @@ +dropTable('{{%blog}}'); + } + + public function down() + { + $tableOptions = null; + + $this->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); + } +} diff --git a/frontend/controllers/ProductsController.php b/frontend/controllers/ProductsController.php deleted file mode 100755 index 56e1ff5..0000000 --- a/frontend/controllers/ProductsController.php +++ /dev/null @@ -1,154 +0,0 @@ -load ($_POST); - if (! $catalog = Catalog::find ()->where (['translit' => $_GET['translit']])->with ('parent')->one ()) - throw new HttpException(404, 'Данной странице не существует!'); - $query = Products::find ()->where ('catalog_id=:catalog_id OR catalog_parent_id=:catalog_parent_id', [':catalog_id' => $catalog->id, ':catalog_parent_id' => $catalog->id])->with (['catalog'])->innerJoinWith (['cost']); - if (! empty($_POST['Products']['minCost']) && ! empty($_POST['Products']['maxCost'])) $query->andWhere ('(cost>=:minCost and cost<=:maxCost)', [':minCost' => $_POST['Products']['minCost'], ':maxCost' => $_POST['Products']['maxCost']]); - if (! empty($_GET['brends'])) - { - $b = explode (';', $_GET['brends']); - $query->andWhere (['brend_id' => $b]); - } - if (! empty($_GET['filters'])) - { - $l = explode (';', $_GET['filters']); - $items = Filters::find ()->where (['parent_id' => 0])->all (); - foreach ($items as $key => $it) - { - $f = []; - foreach ($it->childs as $c) - { - if (in_array ($c['id'], $l)) $f[] = $c['id']; - } - if (count ($f) > 0) - $query->innerJoin ('productsFilters as filter_' . $key, 'filter_' . $key . '.product_id=products.id')->andWhere (['filter_' . $key . '.filter_id' => $f]); - // $childs->leftJoin('productsFilters as pf_'.$key, 'pf_'.$key.'.product_id = productsFilters.product_id')->andWhere(['pf_'.$key.'.filter_id'=>$f]); - } - } - if (! empty($modelProducts->fasovka)) - { - $query->innerJoinWith (['fasovka'])->andWhere ([ProductsFasovka::tableName () . '.fasovka_id' => $modelProducts->fasovka]); - } - if (! empty($modelProducts->type)) - { - $query->innerJoinWith (['type'])->andWhere ([ProductsType::tableName () . '.type_id' => $modelProducts->type]); - } - if (! empty($modelProducts->brends)) - { - $query->innerJoinWith (['brends'])->andWhere ([ProductsBrends::tableName () . '.brend_id' => $modelProducts->brends]); - } - $query->groupBy (['id']); - $countQuery = clone $query; - $pages = new Pagination(['totalCount' => $countQuery->count (), 'pageSize' => 15]); - $pages->forcePageParam = false; - $pages->pageSizeParam = false; - $products = $query->offset ($pages->offset) - ->limit ($pages->limit) - ->all (); - - return $this->render ('index', [ - 'modelProducts' => $modelProducts, - 'catalog' => $catalog, - 'pages' => $pages, - 'products' => $products, - ]); - } - - public function actionSearch () - { - $query = Products::find ()->innerJoinWith (['catalog'])->innerJoinWith (['cost'])->innerJoinWith (['brend']); - if (! empty($_GET['search_str'])) - { - $query->andWhere (['like', 'products.name', $_GET['search_str']]); - $query->orWhere (['like', 'catalog.name', $_GET['search_str']]); - $query->orWhere (['like', 'catalog_brends.name', $_GET['search_str']]); - $query->orWhere (['like', 'mod.art', $_GET['search_str']]); - } - $query->groupBy (['id']); - $countQuery = clone $query; - $pages = new Pagination(['totalCount' => $countQuery->count (), 'pageSize' => 20]); - $pages->forcePageParam = false; - $pages->pageSizeParam = false; - $products = $query->offset ($pages->offset) - ->limit ($pages->limit) - ->all (); - - return $this->render ('search', [ - 'pages' => $pages, - 'products' => $products, - ]); - } - - public function actionShow () - { - if (! $catalog = Catalog::find ()->where (['translit' => $_GET['translit_rubric']])->with ('parent')->one ()) - throw new HttpException(404, 'Данной странице не существует!'); - if (! $product = Products::find ()->where (['id' => $_GET['id']])->one ()) - throw new HttpException(404, 'Данной странице не существует!'); - ViewProduct::add ($product->id); - - return $this->render ('show', [ - 'catalog' => $catalog, - 'product' => $product, - ]); - } - - public function actionCompare () - { - $session = new Session; - $session->open (); - if (! empty($_GET['id'])) - { - $i = 0; - if (isset($session['compare'])) - { - foreach ($session['compare'] as $key => $compare) - { - if ($_GET['id'] == $compare) - { - $i++; - } - } - } - if ($i == 0) - { - $data[] = $_GET['id']; - $session['compare'] = $data; - } - Yii::$app->getSession ()->setFlash ('success', 'Этот товар добавлен к сравнению!'); - - return $this->redirect (Yii::$app->request->referrer); - } - else - { - //print_r($session['compare']); - $products = Products::find ()->where (['id' => $session['compare']])->all (); - - return $this->render ('compare', [ - 'products' => $products, - ]); - } - } -} \ No newline at end of file diff --git a/frontend/views/catalog/products.php b/frontend/views/catalog/products.php index 5aabb59..d1ec4c3 100755 --- a/frontend/views/catalog/products.php +++ b/frontend/views/catalog/products.php @@ -178,6 +178,11 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[

'h1'])?>

+
+ UAH + + +
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 95dca86..124983a 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -177,15 +177,17 @@ $this->registerJs("
-
-
- (044) 303 90 15
- (093) 911 05 03
- (095) 004 56 55
- (068) 083 62 01 +
+
+
+ (044) 303 90 15
+ (093) 911 05 03
+ (095) 004 56 55
+ (068) 083 62 01 +
+ rukza4ok@eltrade.com.ua +
- rukza4ok@eltrade.com.ua -
Корзина 0
@@ -392,66 +394,70 @@ $this->registerJs(" ?>
-
- - - -
- (044) 303 90 15
- (093) 911 05 03
- (095) 004 56 55
- (068) 083 62 01 +
+ +
+ + + +
+ (044) 303 90 15
+ (093) 911 05 03
+ (095) 004 56 55
+ (068) 083 62 01 +
+ + rukza4ok@eltrade.com.ua +
- - rukza4ok@eltrade.com.ua - -
- -
-

Подписаться на акции

- '/subscribe']); - ?> - field ($subscribe, 'email')->textInput (['placeholder' => 'E-mail', 'enableAjaxValidation' => true])->label (false); ?> - field ($subscribe, 'sale')->dropDownList (['10' => '10%', '20' => '20%'], ['prompt' => 'Скидка', 'enableAjaxValidation' => true])->label (false); ?> -
укажите желаемый размер скидки
- 'submit4m']); ?> - - -
-- libgit2 0.21.4