diff --git a/backend/controllers/ProductController.php b/backend/controllers/ProductController.php
new file mode 100644
index 0000000..8961388
--- /dev/null
+++ b/backend/controllers/ProductController.php
@@ -0,0 +1,77 @@
+search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Creates a new Tile model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Product();
+ $model->generateLangs();
+
+ if ($model->loadWithLangs(\Yii::$app->request)) {
+ if ($model->saveWithLangs()) {
+ return $this->redirect(
+ [
+ 'view',
+ 'id' => $model->id,
+ ]
+ );
+ }
+ }
+ return $this->render(
+ 'create',
+ [
+ 'model' => $model,
+ 'modelLangs' => $model->modelLangs,
+ ]
+ );
+ }
+ public function actionView($id): string
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ protected function findModel($id): Product
+ {
+ if (($model = Product::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+}
\ No newline at end of file
diff --git a/backend/views/layouts/menu_items.php b/backend/views/layouts/menu_items.php
index b96ce22..626a83c 100755
--- a/backend/views/layouts/menu_items.php
+++ b/backend/views/layouts/menu_items.php
@@ -116,6 +116,11 @@
'icon' => 'sun-o',
],
[
+ 'label' => \Yii::t('core', 'Продукты'),
+ 'url' => ['/product/index'],
+ 'icon' => 'sun-o',
+ ],
+ [
'label' => \Yii::t('core', 'Комментарии'),
'url' => ['/comment/index'],
'icon' => 'sun-o',
diff --git a/backend/views/product/_form.php b/backend/views/product/_form.php
new file mode 100755
index 0000000..56851c7
--- /dev/null
+++ b/backend/views/product/_form.php
@@ -0,0 +1,61 @@
+
+
+
diff --git a/backend/views/product/_form_language.php b/backend/views/product/_form_language.php
new file mode 100755
index 0000000..8ef6997
--- /dev/null
+++ b/backend/views/product/_form_language.php
@@ -0,0 +1,23 @@
+field($model_lang, '[' . $language->id . ']title')
+ ->textInput(['maxlength' => true]);
+
+echo $attributeField;
+$attributeField2 = $form->field($model_lang, '[' . $language->id . ']link')
+ ->textInput(['maxlength' => true]);
+
+echo $attributeField2;
+
+?>
\ No newline at end of file
diff --git a/backend/views/product/_search.php b/backend/views/product/_search.php
new file mode 100755
index 0000000..a4effa5
--- /dev/null
+++ b/backend/views/product/_search.php
@@ -0,0 +1,35 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'id') ?>
+
+ = $form->field($model, 'sku') ?>
+
+ = $form->field($model, 'status')->checkbox() ?>
+
+ = $form->field($model, 'sort') ?>
+
+ = $form->field($model, 'image_id') ?>
+
+
+ = 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/product/create.php b/backend/views/product/create.php
new file mode 100755
index 0000000..537a10d
--- /dev/null
+++ b/backend/views/product/create.php
@@ -0,0 +1,24 @@
+title = Yii::t('app', 'Create Product');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Products'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'modelLangs' => $modelLangs,
+ ]) ?>
+
+
diff --git a/backend/views/product/index.php b/backend/views/product/index.php
new file mode 100755
index 0000000..e820754
--- /dev/null
+++ b/backend/views/product/index.php
@@ -0,0 +1,36 @@
+title = Yii::t('app', 'Products');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Product'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id',
+ 'sku',
+ 'status:boolean',
+ 'sort',
+ 'image_id',
+
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+ ]); ?>
+
diff --git a/backend/views/product/update.php b/backend/views/product/update.php
new file mode 100755
index 0000000..c1f2923
--- /dev/null
+++ b/backend/views/product/update.php
@@ -0,0 +1,27 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Product',
+]) . $model->id;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Products'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ 'modelLangs' => $modelLangs,
+ ]) ?>
+
+
diff --git a/backend/views/product/view.php b/backend/views/product/view.php
new file mode 100755
index 0000000..543a12f
--- /dev/null
+++ b/backend/views/product/view.php
@@ -0,0 +1,39 @@
+title = $model->id;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Products'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->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' => [
+ 'id',
+ 'sku',
+ 'status:boolean',
+ 'sort',
+ 'image_id',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/tile/_search.php b/backend/views/tile/_search.php
index 988ab09..279be35 100755
--- a/backend/views/tile/_search.php
+++ b/backend/views/tile/_search.php
@@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
-/* @var $model common\models\ObjectkbSearch */
+/* @var $model common\models\TileSearch */
/* @var $form yii\widgets\ActiveForm */
?>
@@ -17,13 +17,11 @@ use yii\widgets\ActiveForm;
= $form->field($model, 'id') ?>
- = $form->field($model, 'slider_id') ?>
-
= $form->field($model, 'status')->checkbox() ?>
= $form->field($model, 'sort') ?>
- = $form->field($model, 'image_mini_id') ?>
+ = $form->field($model, 'image_id') ?>
= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
diff --git a/backend/views/tile/update.php b/backend/views/tile/update.php
index 37a781c..7d499f4 100755
--- a/backend/views/tile/update.php
+++ b/backend/views/tile/update.php
@@ -4,15 +4,15 @@ use yii\helpers\Html;
/**
* @var $this yii\web\View
- * @var $model common\models\Objectkb
- * @var \common\models\ObjectkbLang $modelLangs
+ * @var $model common\models\Tile
+ * @var \common\models\TileLang $modelLangs
* @var \common\models\Slider[] $sliders
*/
$this->title = Yii::t('app', 'Update {modelClass}: ', [
- 'modelClass' => 'Objectkb',
+ 'modelClass' => 'Tile',
]) . $model->id;
-$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Objectkbs'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Tiles'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
?>
@@ -23,7 +23,7 @@ $this->params['breadcrumbs'][] = Yii::t('app', 'Update');
= $this->render('_form', [
'model' => $model,
'modelLangs' => $modelLangs,
- 'sliders' => $sliders,
+ //'sliders' => $sliders,
]) ?>
diff --git a/backend/views/tile/view.php b/backend/views/tile/view.php
index 991d9e6..214b273 100755
--- a/backend/views/tile/view.php
+++ b/backend/views/tile/view.php
@@ -32,7 +32,7 @@ $this->params['breadcrumbs'][] = $this->title;
'slider_id',
'status:boolean',
'sort',
- 'image_mini_id',
+ 'image_id',
],
]) ?>
diff --git a/common/models/ProductSearch.php b/common/models/ProductSearch.php
new file mode 100644
index 0000000..b48dfda
--- /dev/null
+++ b/common/models/ProductSearch.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(
+ [
+ 'id' => $this->id,
+ 'status' => $this->status,
+ 'sort' => $this->sort,
+ 'image_id' => $this->image_id,
+ 'sku'=>$this->sku,
+ ]
+ );
+
+ return $dataProvider;
+ }
+}
\ No newline at end of file
--
libgit2 0.21.4