Commit 90a6ed1a30bf8dd26b371bdee8721395779b1f9e

Authored by Administrator
1 parent 2f93d129

basket

Showing 119 changed files with 3210 additions and 1018 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 119 files are displayed.

backend/config/main.php
... ... @@ -43,6 +43,17 @@ return [
43 43 ],
44 44 ],
45 45 ],
  46 + 'imageCache' => [
  47 + 'class' => 'iutbay\yii2imagecache\ImageCache',
  48 + 'sourcePath' => '@storage',
  49 + 'sourceUrl' => '/storage',
  50 + 'thumbsPath' => '@storage/thumbs',
  51 + 'thumbsUrl' => '/storage/thumbs',
  52 +
  53 + 'sizes' => [
  54 + 'slider' => [720, 340],
  55 + ],
  56 + ],
46 57 'errorHandler' => [
47 58 'errorAction' => 'site/error',
48 59 ],
... ...
backend/controllers/ArticlesController.php 0 → 100755
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Articles;
  7 +use common\models\ArticlesSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * ArticlesController implements the CRUD actions for Articles model.
  14 + */
  15 +class ArticlesController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'verbs' => [
  24 + 'class' => VerbFilter::className(),
  25 + 'actions' => [
  26 + 'delete' => ['POST'],
  27 + ],
  28 + ],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Lists all Articles models.
  34 + * @return mixed
  35 + */
  36 + public function actionIndex()
  37 + {
  38 + $searchModel = new ArticlesSearch();
  39 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  40 +
  41 + return $this->render('index', [
  42 + 'searchModel' => $searchModel,
  43 + 'dataProvider' => $dataProvider,
  44 + ]);
  45 + }
  46 +
  47 + /**
  48 + * Displays a single Articles model.
  49 + * @param integer $id
  50 + * @return mixed
  51 + */
  52 + public function actionView($id)
  53 + {
  54 + return $this->render('view', [
  55 + 'model' => $this->findModel($id),
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Creates a new Articles model.
  61 + * If creation is successful, the browser will be redirected to the 'view' page.
  62 + * @return mixed
  63 + */
  64 + public function actionCreate()
  65 + {
  66 + $model = new Articles();
  67 +
  68 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  69 + return $this->redirect(['view', 'id' => $model->id]);
  70 + } else {
  71 + return $this->render('create', [
  72 + 'model' => $model,
  73 + ]);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * Updates an existing Articles model.
  79 + * If update is successful, the browser will be redirected to the 'view' page.
  80 + * @param integer $id
  81 + * @return mixed
  82 + */
  83 + public function actionUpdate($id)
  84 + {
  85 + $model = $this->findModel($id);
  86 +
  87 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 + return $this->redirect(['view', 'id' => $model->id]);
  89 + } else {
  90 + return $this->render('update', [
  91 + 'model' => $model,
  92 + ]);
  93 + }
  94 + }
  95 +
  96 + /**
  97 + * Deletes an existing Articles model.
  98 + * If deletion is successful, the browser will be redirected to the 'index' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionDelete($id)
  103 + {
  104 + $this->findModel($id)->delete();
  105 +
  106 + return $this->redirect(['index']);
  107 + }
  108 +
  109 + /**
  110 + * Finds the Articles model based on its primary key value.
  111 + * If the model is not found, a 404 HTTP exception will be thrown.
  112 + * @param integer $id
  113 + * @return Articles the loaded model
  114 + * @throws NotFoundHttpException if the model cannot be found
  115 + */
  116 + protected function findModel($id)
  117 + {
  118 + if (($model = Articles::findOne($id)) !== null) {
  119 + return $model;
  120 + } else {
  121 + throw new NotFoundHttpException('The requested page does not exist.');
  122 + }
  123 + }
  124 +}
... ...
backend/controllers/BgController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Bg;
  7 +use common\models\BgSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * BgController implements the CRUD actions for Bg model.
  14 + */
  15 +class BgController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'verbs' => [
  24 + 'class' => VerbFilter::className(),
  25 + 'actions' => [
  26 + 'delete' => ['POST'],
  27 + ],
  28 + ],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Lists all Bg models.
  34 + * @return mixed
  35 + */
  36 + public function actionIndex()
  37 + {
  38 + $searchModel = new BgSearch();
  39 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  40 +
  41 + return $this->render('index', [
  42 + 'searchModel' => $searchModel,
  43 + 'dataProvider' => $dataProvider,
  44 + ]);
  45 + }
  46 +
  47 + /**
  48 + * Displays a single Bg model.
  49 + * @param integer $id
  50 + * @return mixed
  51 + */
  52 + public function actionView($id)
  53 + {
  54 + return $this->render('view', [
  55 + 'model' => $this->findModel($id),
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Creates a new Bg model.
  61 + * If creation is successful, the browser will be redirected to the 'view' page.
  62 + * @return mixed
  63 + */
  64 + public function actionCreate()
  65 + {
  66 + $model = new Bg();
  67 +
  68 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  69 + return $this->redirect(['view', 'id' => $model->id]);
  70 + } else {
  71 + return $this->render('create', [
  72 + 'model' => $model,
  73 + ]);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * Updates an existing Bg model.
  79 + * If update is successful, the browser will be redirected to the 'view' page.
  80 + * @param integer $id
  81 + * @return mixed
  82 + */
  83 + public function actionUpdate($id)
  84 + {
  85 + $model = $this->findModel($id);
  86 +
  87 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 + return $this->redirect(['view', 'id' => $model->id]);
  89 + } else {
  90 + return $this->render('update', [
  91 + 'model' => $model,
  92 + ]);
  93 + }
  94 + }
  95 +
  96 + /**
  97 + * Deletes an existing Bg model.
  98 + * If deletion is successful, the browser will be redirected to the 'index' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionDelete($id)
  103 + {
  104 + $this->findModel($id)->delete();
  105 +
  106 + return $this->redirect(['index']);
  107 + }
  108 +
  109 + /**
  110 + * Finds the Bg model based on its primary key value.
  111 + * If the model is not found, a 404 HTTP exception will be thrown.
  112 + * @param integer $id
  113 + * @return Bg the loaded model
  114 + * @throws NotFoundHttpException if the model cannot be found
  115 + */
  116 + protected function findModel($id)
  117 + {
  118 + if (($model = Bg::findOne($id)) !== null) {
  119 + return $model;
  120 + } else {
  121 + throw new NotFoundHttpException('The requested page does not exist.');
  122 + }
  123 + }
  124 +}
... ...
backend/controllers/CustomerController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Customer;
  7 +use common\models\CustomerSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * CustomerController implements the CRUD actions for Customer model.
  14 + */
  15 +class CustomerController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'verbs' => [
  24 + 'class' => VerbFilter::className(),
  25 + 'actions' => [
  26 + 'delete' => ['POST'],
  27 + ],
  28 + ],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Lists all Customer models.
  34 + * @return mixed
  35 + */
  36 + public function actionIndex()
  37 + {
  38 + $searchModel = new CustomerSearch();
  39 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  40 +
  41 + return $this->render('index', [
  42 + 'searchModel' => $searchModel,
  43 + 'dataProvider' => $dataProvider,
  44 + ]);
  45 + }
  46 +
  47 + /**
  48 + * Displays a single Customer model.
  49 + * @param integer $id
  50 + * @return mixed
  51 + */
  52 + public function actionView($id)
  53 + {
  54 + return $this->render('view', [
  55 + 'model' => $this->findModel($id),
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Creates a new Customer model.
  61 + * If creation is successful, the browser will be redirected to the 'view' page.
  62 + * @return mixed
  63 + */
  64 + public function actionCreate()
  65 + {
  66 + $model = new Customer();
  67 +
  68 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  69 + return $this->redirect(['view', 'id' => $model->id]);
  70 + } else {
  71 + return $this->render('create', [
  72 + 'model' => $model,
  73 + ]);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * Updates an existing Customer model.
  79 + * If update is successful, the browser will be redirected to the 'view' page.
  80 + * @param integer $id
  81 + * @return mixed
  82 + */
  83 + public function actionUpdate($id)
  84 + {
  85 + $model = $this->findModel($id);
  86 +
  87 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 + return $this->redirect(['view', 'id' => $model->id]);
  89 + } else {
  90 + return $this->render('update', [
  91 + 'model' => $model,
  92 + ]);
  93 + }
  94 + }
  95 +
  96 + /**
  97 + * Deletes an existing Customer model.
  98 + * If deletion is successful, the browser will be redirected to the 'index' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionDelete($id)
  103 + {
  104 + $this->findModel($id)->delete();
  105 +
  106 + return $this->redirect(['index']);
  107 + }
  108 +
  109 + /**
  110 + * Finds the Customer model based on its primary key value.
  111 + * If the model is not found, a 404 HTTP exception will be thrown.
  112 + * @param integer $id
  113 + * @return Customer the loaded model
  114 + * @throws NotFoundHttpException if the model cannot be found
  115 + */
  116 + protected function findModel($id)
  117 + {
  118 + if (($model = Customer::findOne($id)) !== null) {
  119 + return $model;
  120 + } else {
  121 + throw new NotFoundHttpException('The requested page does not exist.');
  122 + }
  123 + }
  124 +}
... ...
backend/controllers/PageController.php
1   -<?php
2   -
3   -namespace backend\controllers;
4   -
5   -use Yii;
6   -use yii\filters\AccessControl;
7   -use common\models\Page;
8   -use common\models\PageSearch;
9   -use yii\web\Controller;
10   -use yii\web\NotFoundHttpException;
11   -use yii\filters\VerbFilter;
12   -
13   -/**
14   - * PageController implements the CRUD actions for Page model.
15   - */
16   -class PageController extends Controller
17   -{
18   - public function behaviors()
19   - {
20   - return [
21   - 'access' => [
22   - 'class' => AccessControl::className(),
23   - 'rules' => [
24   - [
25   - 'actions' => ['login', 'error'],
26   - 'allow' => true,
27   - ],
28   - [
29   - 'actions' => ['logout', 'index','create','update','view','delete','test-img' ],
30   - 'allow' => true,
31   - 'roles' => ['@'],
32   - ],
33   - ],
34   - ],
35   - 'verbs' => [
36   - 'class' => VerbFilter::className(),
37   - 'actions' => [
38   - 'logout' => ['post'],
39   - ],
40   - ],
41   - ];
42   - }
43   -
44   - /**
45   - * Lists all Page models.
46   - * @return mixed
47   - */
48   - public function actionIndex()
49   - {
50   - $searchModel = new PageSearch();
51   - $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
52   -
53   - return $this->render('index', [
54   - 'searchModel' => $searchModel,
55   - 'dataProvider' => $dataProvider,
56   - ]);
57   - }
58   -
59   - /**
60   - * Displays a single Page model.
61   - * @param integer $id
62   - * @return mixed
63   - */
64   - public function actionView($id)
65   - {
66   - return $this->render('view', [
67   - 'model' => $this->findModel($id),
68   - ]);
69   - }
70   -
71   - /**
72   - * Creates a new Page model.
73   - * If creation is successful, the browser will be redirected to the 'view' page.
74   - * @return mixed
75   - */
76   - public function actionCreate()
77   - {
78   - $model = new Page();
79   -
80   - if ($model->load(Yii::$app->request->post()) && $model->save()) {
81   - return $this->redirect(['view', 'id' => $model->id]);
82   - } else {
83   - return $this->render('create', [
84   - 'model' => $model,
85   - ]);
86   - }
87   - }
88   -
89   - /**
90   - * Updates an existing Page model.
91   - * If update is successful, the browser will be redirected to the 'view' page.
92   - * @param integer $id
93   - * @return mixed
94   - */
95   - public function actionUpdate($id)
96   - {
97   - $model = $this->findModel($id);
98   -
99   - if ($model->load(Yii::$app->request->post()) && $model->save()) {
100   - return $this->redirect(['view', 'id' => $model->id]);
101   - } else {
102   - return $this->render('update', [
103   - 'model' => $model,
104   - ]);
105   - }
106   - }
107   -
108   - /**
109   - * Deletes an existing Page model.
110   - * If deletion is successful, the browser will be redirected to the 'index' page.
111   - * @param integer $id
112   - * @return mixed
113   - */
114   - public function actionDelete($id)
115   - {
116   - $this->findModel($id)->delete();
117   -
118   - return $this->redirect(['index']);
119   - }
120   -
121   - /**
122   - * Finds the Page model based on its primary key value.
123   - * If the model is not found, a 404 HTTP exception will be thrown.
124   - * @param integer $id
125   - * @return Page the loaded model
126   - * @throws NotFoundHttpException if the model cannot be found
127   - */
128   - protected function findModel($id)
129   - {
130   - if (($model = Page::findOne($id)) !== null) {
131   - return $model;
132   - } else {
133   - throw new NotFoundHttpException('The requested page does not exist.');
134   - }
135   - }
136   -}
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Page;
  7 +use common\models\PageSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * PageController implements the CRUD actions for Page model.
  14 + */
  15 +class PageController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'verbs' => [
  24 + 'class' => VerbFilter::className(),
  25 + 'actions' => [
  26 + 'delete' => ['POST'],
  27 + ],
  28 + ],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Lists all Page models.
  34 + * @return mixed
  35 + */
  36 + public function actionIndex()
  37 + {
  38 + $searchModel = new PageSearch();
  39 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  40 +
  41 + return $this->render('index', [
  42 + 'searchModel' => $searchModel,
  43 + 'dataProvider' => $dataProvider,
  44 + ]);
  45 + }
  46 +
  47 + /**
  48 + * Displays a single Page model.
  49 + * @param integer $id
  50 + * @return mixed
  51 + */
  52 + public function actionView($id)
  53 + {
  54 + return $this->render('view', [
  55 + 'model' => $this->findModel($id),
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Creates a new Page model.
  61 + * If creation is successful, the browser will be redirected to the 'view' page.
  62 + * @return mixed
  63 + */
  64 + public function actionCreate()
  65 + {
  66 + $model = new Page();
  67 +
  68 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  69 + return $this->redirect(['view', 'id' => $model->id]);
  70 + } else {
  71 + return $this->render('create', [
  72 + 'model' => $model,
  73 + ]);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * Updates an existing Page model.
  79 + * If update is successful, the browser will be redirected to the 'view' page.
  80 + * @param integer $id
  81 + * @return mixed
  82 + */
  83 + public function actionUpdate($id)
  84 + {
  85 + $model = $this->findModel($id);
  86 +
  87 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 + return $this->redirect(['view', 'id' => $model->id]);
  89 + } else {
  90 + return $this->render('update', [
  91 + 'model' => $model,
  92 + ]);
  93 + }
  94 + }
  95 +
  96 + /**
  97 + * Deletes an existing Page model.
  98 + * If deletion is successful, the browser will be redirected to the 'index' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionDelete($id)
  103 + {
  104 + $this->findModel($id)->delete();
  105 +
  106 + return $this->redirect(['index']);
  107 + }
  108 +
  109 + /**
  110 + * Finds the Page model based on its primary key value.
  111 + * If the model is not found, a 404 HTTP exception will be thrown.
  112 + * @param integer $id
  113 + * @return Page the loaded model
  114 + * @throws NotFoundHttpException if the model cannot be found
  115 + */
  116 + protected function findModel($id)
  117 + {
  118 + if (($model = Page::findOne($id)) !== null) {
  119 + return $model;
  120 + } else {
  121 + throw new NotFoundHttpException('The requested page does not exist.');
  122 + }
  123 + }
  124 +}
... ...
backend/controllers/SliderImageController.php
... ... @@ -9,7 +9,7 @@ use common\models\SliderImageSearch;
9 9 use yii\web\Controller;
10 10 use yii\web\NotFoundHttpException;
11 11 use yii\filters\VerbFilter;
12   -
  12 +use yii\web\UploadedFile;
13 13 /**
14 14 * SliderImageController implements the CRUD actions for SliderImage model.
15 15 */
... ... @@ -73,7 +73,12 @@ class SliderImageController extends Controller
73 73  
74 74 if ($model->load(Yii::$app->request->post())) {
75 75 $model->slider_id = $slider_id;
76   - $model->save();
  76 + if ( ($image = UploadedFile::getInstance($model, 'image')) ) {
  77 + $model->image = $image->name;
  78 + }
  79 + if ($model->save() && $image) {
  80 + $image->saveAs(Yii::getAlias('@storage/slider/' . $image->name));
  81 + }
77 82 return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]);
78 83 } else {
79 84  
... ... @@ -98,7 +103,14 @@ class SliderImageController extends Controller
98 103 {
99 104 $model = $this->findModel($slider_id, $id);
100 105  
101   - if ($model->load(Yii::$app->request->post()) && $model->save()) {
  106 + if ($model->load(Yii::$app->request->post())) {
  107 + if ( ($image = UploadedFile::getInstance($model, 'image')) ) {
  108 + $model->image = $image->name;
  109 + }
  110 +
  111 + if ($model->save() && $image) {
  112 + $image->saveAs(Yii::getAlias('@storage/slider/' . $image->name));
  113 + }
102 114 return $this->redirect(['view', 'slider_id'=>$slider_id, 'id' => $model->slider_image_id]);
103 115 } else {
104 116  
... ...
backend/controllers/SubscribeController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Subscribe;
  7 +use common\models\SubscribeSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * SubscribeController implements the CRUD actions for Subscribe model.
  14 + */
  15 +class SubscribeController extends Controller
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'verbs' => [
  24 + 'class' => VerbFilter::className(),
  25 + 'actions' => [
  26 + 'delete' => ['POST'],
  27 + ],
  28 + ],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Lists all Subscribe models.
  34 + * @return mixed
  35 + */
  36 + public function actionIndex()
  37 + {
  38 + $searchModel = new SubscribeSearch();
  39 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  40 +
  41 + return $this->render('index', [
  42 + 'searchModel' => $searchModel,
  43 + 'dataProvider' => $dataProvider,
  44 + ]);
  45 + }
  46 +
  47 + /**
  48 + * Displays a single Subscribe model.
  49 + * @param integer $id
  50 + * @return mixed
  51 + */
  52 + public function actionView($id)
  53 + {
  54 + return $this->render('view', [
  55 + 'model' => $this->findModel($id),
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Creates a new Subscribe model.
  61 + * If creation is successful, the browser will be redirected to the 'view' page.
  62 + * @return mixed
  63 + */
  64 + public function actionCreate()
  65 + {
  66 + $model = new Subscribe();
  67 +
  68 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  69 + return $this->redirect(['view', 'id' => $model->id]);
  70 + } else {
  71 + return $this->render('create', [
  72 + 'model' => $model,
  73 + ]);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * Updates an existing Subscribe model.
  79 + * If update is successful, the browser will be redirected to the 'view' page.
  80 + * @param integer $id
  81 + * @return mixed
  82 + */
  83 + public function actionUpdate($id)
  84 + {
  85 + $model = $this->findModel($id);
  86 +
  87 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 + return $this->redirect(['view', 'id' => $model->id]);
  89 + } else {
  90 + return $this->render('update', [
  91 + 'model' => $model,
  92 + ]);
  93 + }
  94 + }
  95 +
  96 + /**
  97 + * Deletes an existing Subscribe model.
  98 + * If deletion is successful, the browser will be redirected to the 'index' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionDelete($id)
  103 + {
  104 + $this->findModel($id)->delete();
  105 +
  106 + return $this->redirect(['index']);
  107 + }
  108 +
  109 + /**
  110 + * Finds the Subscribe model based on its primary key value.
  111 + * If the model is not found, a 404 HTTP exception will be thrown.
  112 + * @param integer $id
  113 + * @return Subscribe the loaded model
  114 + * @throws NotFoundHttpException if the model cannot be found
  115 + */
  116 + protected function findModel($id)
  117 + {
  118 + if (($model = Subscribe::findOne($id)) !== null) {
  119 + return $model;
  120 + } else {
  121 + throw new NotFoundHttpException('The requested page does not exist.');
  122 + }
  123 + }
  124 +}
... ...
backend/views/articles/_form.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +use common\modules\file\widgets\ImageUploader;
  6 +use mihaildev\ckeditor\CKEditor;
  7 +use mihaildev\elfinder\ElFinder;
  8 +use yii\jui\DatePicker;
  9 +/* @var $this yii\web\View */
  10 +/* @var $model common\models\Articles */
  11 +/* @var $form yii\widgets\ActiveForm */
  12 +?>
  13 +
  14 +<div class="articles-form">
  15 +
  16 + <?php $form = ActiveForm::begin(); ?>
  17 +
  18 +
  19 + <?= $form->field($model, 'date')
  20 + ->widget(DatePicker::className(), [
  21 + 'dateFormat' => 'yyyy-MM-dd',
  22 + 'clientOptions' => [ 'minDate' => 1 ],
  23 + ]) ?>
  24 + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  25 +
  26 + <?= $form->field($model, 'body')->widget(CKEditor::className(),
  27 + [
  28 + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
  29 + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  30 + 'inline' => false, //по умолчанию false]),
  31 + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
  32 + ]
  33 + )
  34 + ]) ?>
  35 +
  36 +
  37 + <?= $form->field($model, 'image')->textInput(['maxlength' => true]) ?>
  38 +
  39 + <?= $form->field($model, 'translit')->textInput(['maxlength' => true]) ?>
  40 +
  41 + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
  42 +
  43 + <?= $form->field($model, 'meta_keywords')->textInput(['maxlength' => true]) ?>
  44 +
  45 + <?= $form->field($model, 'meta_description')->textInput(['maxlength' => true]) ?>
  46 +
  47 + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
  48 +
  49 + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?>
  50 +
  51 + <div class="form-group">
  52 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  53 + </div>
  54 +
  55 + <?php ActiveForm::end(); ?>
  56 +
  57 +</div>
... ...
backend/views/articles/_search.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\ArticlesSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="articles-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'date') ?>
  21 +
  22 + <?= $form->field($model, 'title') ?>
  23 +
  24 + <?= $form->field($model, 'body') ?>
  25 +
  26 + <?= $form->field($model, 'image') ?>
  27 +
  28 + <?php // echo $form->field($model, 'translit') ?>
  29 +
  30 + <?php // echo $form->field($model, 'meta_title') ?>
  31 +
  32 + <?php // echo $form->field($model, 'meta_keywords') ?>
  33 +
  34 + <?php // echo $form->field($model, 'meta_description') ?>
  35 +
  36 + <?php // echo $form->field($model, 'seo_text') ?>
  37 +
  38 + <?php // echo $form->field($model, 'h1') ?>
  39 +
  40 + <div class="form-group">
  41 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  42 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  43 + </div>
  44 +
  45 + <?php ActiveForm::end(); ?>
  46 +
  47 +</div>
... ...
backend/views/articles/create.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Articles */
  8 +
  9 +$this->title = 'Create Articles';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Articles', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="articles-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/articles/index.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\ArticlesSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Articles';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="articles-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Articles', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'date',
  29 + 'title',
  30 + 'image',
  31 + // 'translit',
  32 + // 'meta_title',
  33 + // 'meta_keywords',
  34 + // 'meta_description',
  35 + // 'seo_text:ntext',
  36 + // 'h1',
  37 +
  38 + ['class' => 'yii\grid\ActionColumn'],
  39 + ],
  40 + ]); ?>
  41 +</div>
... ...
backend/views/articles/update.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Articles */
  7 +
  8 +$this->title = 'Update Articles: ' . $model->title;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Articles', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="articles-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/articles/view.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Articles */
  8 +
  9 +$this->title = $model->title;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Articles', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="articles-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'date',
  33 + 'title',
  34 + 'body:ntext',
  35 + 'image',
  36 + 'translit',
  37 + 'meta_title',
  38 + 'meta_keywords',
  39 + 'meta_description',
  40 + 'seo_text:ntext',
  41 + 'h1',
  42 + ],
  43 + ]) ?>
  44 +
  45 +</div>
... ...
backend/views/bg/_form.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Bg */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="bg-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  16 +
  17 + <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
  18 +
  19 + <?= $form->field($model, 'image')->textInput(['maxlength' => true]) ?>
  20 +
  21 + <div class="form-group">
  22 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  23 + </div>
  24 +
  25 + <?php ActiveForm::end(); ?>
  26 +
  27 +</div>
... ...
backend/views/bg/_search.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\BgSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="bg-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'title') ?>
  21 +
  22 + <?= $form->field($model, 'url') ?>
  23 +
  24 + <?= $form->field($model, 'image') ?>
  25 +
  26 + <div class="form-group">
  27 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  28 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  29 + </div>
  30 +
  31 + <?php ActiveForm::end(); ?>
  32 +
  33 +</div>
... ...
backend/views/bg/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Bg */
  8 +
  9 +$this->title = 'Create Bg';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Bgs', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bg-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/bg/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\BgSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Bgs';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bg-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Bg', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'title',
  29 + 'url:url',
  30 + 'image',
  31 +
  32 + ['class' => 'yii\grid\ActionColumn'],
  33 + ],
  34 + ]); ?>
  35 +</div>
... ...
backend/views/bg/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Bg */
  7 +
  8 +$this->title = 'Update Bg: ' . $model->title;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Bgs', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="bg-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/bg/view.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Bg */
  8 +
  9 +$this->title = $model->title;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Bgs', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bg-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'title',
  33 + 'url:url',
  34 + 'image',
  35 + ],
  36 + ]) ?>
  37 +
  38 +</div>
... ...
backend/views/customer/_form.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Customer */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="customer-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'id')->textInput() ?>
  16 +
  17 + <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
  18 +
  19 + <?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>
  20 +
  21 + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
  22 +
  23 + <?= $form->field($model, 'surname')->textInput(['maxlength' => true]) ?>
  24 +
  25 + <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
  26 +
  27 + <?= $form->field($model, 'date_time')->textInput() ?>
  28 +
  29 + <?= $form->field($model, 'sex')->textInput(['maxlength' => true]) ?>
  30 +
  31 + <?= $form->field($model, 'birth_day')->textInput() ?>
  32 +
  33 + <?= $form->field($model, 'birth_month')->textInput() ?>
  34 +
  35 + <?= $form->field($model, 'birth_year')->textInput() ?>
  36 +
  37 + <?= $form->field($model, 'body')->textarea(['rows' => 6]) ?>
  38 +
  39 + <?= $form->field($model, 'group_id')->textInput() ?>
  40 +
  41 + <div class="form-group">
  42 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  43 + </div>
  44 +
  45 + <?php ActiveForm::end(); ?>
  46 +
  47 +</div>
... ...
backend/views/customer/_search.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\CustomerSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="customer-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'username') ?>
  21 +
  22 + <?= $form->field($model, 'password') ?>
  23 +
  24 + <?= $form->field($model, 'name') ?>
  25 +
  26 + <?= $form->field($model, 'surname') ?>
  27 +
  28 + <?php // echo $form->field($model, 'phone') ?>
  29 +
  30 + <?php // echo $form->field($model, 'date_time') ?>
  31 +
  32 + <?php // echo $form->field($model, 'sex') ?>
  33 +
  34 + <?php // echo $form->field($model, 'birth_day') ?>
  35 +
  36 + <?php // echo $form->field($model, 'birth_month') ?>
  37 +
  38 + <?php // echo $form->field($model, 'birth_year') ?>
  39 +
  40 + <?php // echo $form->field($model, 'body') ?>
  41 +
  42 + <?php // echo $form->field($model, 'group_id') ?>
  43 +
  44 + <div class="form-group">
  45 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  46 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  47 + </div>
  48 +
  49 + <?php ActiveForm::end(); ?>
  50 +
  51 +</div>
... ...
backend/views/customer/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Customer */
  8 +
  9 +$this->title = 'Create Customer';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="customer-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/customer/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\CustomerSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Customers';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="customer-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Customer', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'username',
  29 + 'password',
  30 + 'name',
  31 + 'surname',
  32 + // 'phone',
  33 + // 'date_time',
  34 + // 'sex',
  35 + // 'birth_day',
  36 + // 'birth_month',
  37 + // 'birth_year',
  38 + // 'body:ntext',
  39 + // 'group_id',
  40 +
  41 + ['class' => 'yii\grid\ActionColumn'],
  42 + ],
  43 + ]); ?>
  44 +</div>
... ...
backend/views/customer/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Customer */
  7 +
  8 +$this->title = 'Update Customer: ' . $model->name;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="customer-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/customer/view.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Customer */
  8 +
  9 +$this->title = $model->name;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Customers', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="customer-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'username',
  33 + 'password',
  34 + 'name',
  35 + 'surname',
  36 + 'phone',
  37 + 'date_time',
  38 + 'sex',
  39 + 'birth_day',
  40 + 'birth_month',
  41 + 'birth_year',
  42 + 'body:ntext',
  43 + 'group_id',
  44 + ],
  45 + ]) ?>
  46 +
  47 +</div>
... ...
backend/views/layouts/main-sidebar.php
... ... @@ -54,9 +54,9 @@ use yii\widgets\Menu;
54 54 ['label' => 'Зависимости', 'url' => ['/relation/manage']]
55 55 ]
56 56 ],
57   - ['label' => 'Статические страницы', 'url' => ['/page/index']],
  57 + ['label' => 'Текстовые страницы', 'url' => ['/page/index']],
  58 + ['label' => 'Статьи', 'url' => ['/articles/index']],
58 59 ['label' => 'Акции', 'url' => ['/event/index']],
59   - ['label' => 'Услуги', 'url' => ['/service/index']],
60 60 [
61 61 'label' => 'SEO',
62 62 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>',
... ... @@ -65,8 +65,11 @@ use yii\widgets\Menu;
65 65 ['label' => 'Шаблоны', 'url' => ['/seo-category/index']]
66 66 ]
67 67 ],
68   -// ['label' => 'Rubrication', 'url' => ['/rubrication/tax-group']],
69   -// ['label' => 'Relation', 'url' => ['/relation/manage']],
  68 + ['label' => 'Фон', 'url' => ['/bg/index']],
  69 + ['label' => 'Подписка', 'url' => ['/subscribe/index']],
  70 + ['label' => 'Пользователи', 'url' => ['/customer/index']],
  71 + ['label' => 'Группы пользователей', 'url' => ['/group/index']],
  72 +
70 73 ],
71 74  
72 75 ]);
... ...
backend/views/page/_form.php
1   -<?php
2   -
3   -use yii\helpers\Html;
4   -use yii\widgets\ActiveForm;
5   -use mihaildev\ckeditor\CKEditor;
6   -use mihaildev\elfinder\ElFinder;
7   -/* @var $this yii\web\View */
8   -/* @var $model backend\models\Page */
9   -/* @var $form yii\widgets\ActiveForm */
10   -?>
11   -
12   -<div class="page-form">
13   -
14   - <?php $form = ActiveForm::begin(); ?>
15   -
16   - <?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
17   -
18   - <?= $form->field($model, 'alias')->textInput(['maxlength' => 250]) ?>
19   -
20   - <?= $form->field($model, 'title')->textInput(['maxlength' => 250]) ?>
21   -
22   - <?= $form->field($model, 'body')->widget(CKEditor::className(),
23   - [
24   - 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
25   - 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
26   - 'inline' => false, //по умолчанию false]),
27   - 'allowedContent' => true,
28   - 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
29   - ]
30   - )
31   - ]) ?>
32   -
33   - <?= $form->field($model, 'meta_title')->textInput(['maxlength' => 250]) ?>
34   -
35   - <?= $form->field($model, 'description')->textInput(['maxlength' => 250]) ?>
36   -
37   - <?= $form->field($model, 'h1')->textInput(['maxlength' => 255]) ?>
38   -
39   - <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
40   -
41   - <div class="form-group">
42   - <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
43   - </div>
44   -
45   - <?php ActiveForm::end(); ?>
46   -
47   -</div>
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +use mihaildev\ckeditor\CKEditor;
  6 +use mihaildev\elfinder\ElFinder;
  7 +/* @var $this yii\web\View */
  8 +/* @var $model common\models\Page */
  9 +/* @var $form yii\widgets\ActiveForm */
  10 +?>
  11 +
  12 +<div class="page-form">
  13 +
  14 + <?php $form = ActiveForm::begin(); ?>
  15 +
  16 + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  17 +
  18 +
  19 + <?= $form->field($model, 'body')->widget(CKEditor::className(),
  20 + [
  21 + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
  22 + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  23 + 'inline' => false, //по умолчанию false]),
  24 + 'allowedContent' => true,
  25 + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
  26 + ]
  27 + )
  28 + ]) ?>
  29 +
  30 + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
  31 +
  32 + <?= $form->field($model, 'meta_keywords')->textInput(['maxlength' => true]) ?>
  33 +
  34 + <?= $form->field($model, 'meta_description')->textInput(['maxlength' => true]) ?>
  35 +
  36 + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?>
  37 +
  38 + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?>
  39 +
  40 + <div class="form-group">
  41 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  42 + </div>
  43 +
  44 + <?php ActiveForm::end(); ?>
  45 +
  46 +</div>
... ...
backend/views/page/_search.php
1   -<?php
2   -
3   -use yii\helpers\Html;
4   -use yii\widgets\ActiveForm;
5   -
6   -/* @var $this yii\web\View */
7   -/* @var $model backend\models\PageSearch */
8   -/* @var $form yii\widgets\ActiveForm */
9   -?>
10   -
11   -<div class="page-search">
12   -
13   - <?php $form = ActiveForm::begin([
14   - 'action' => ['index'],
15   - 'method' => 'get',
16   - ]); ?>
17   -
18   - <?= $form->field($model, 'id') ?>
19   -
20   - <?= $form->field($model, 'name') ?>
21   -
22   - <?= $form->field($model, 'alias') ?>
23   -
24   - <?= $form->field($model, 'title') ?>
25   -
26   - <?= $form->field($model, 'body') ?>
27   -
28   - <?php // echo $form->field($model, 'meta_title') ?>
29   -
30   - <?php // echo $form->field($model, 'description') ?>
31   -
32   - <?php // echo $form->field($model, 'h1') ?>
33   -
34   - <?php // echo $form->field($model, 'seo_text') ?>
35   -
36   - <div class="form-group">
37   - <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
38   - <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
39   - </div>
40   -
41   - <?php ActiveForm::end(); ?>
42   -
43   -</div>
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\PageSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="page-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'translit') ?>
  21 +
  22 + <?= $form->field($model, 'title') ?>
  23 +
  24 + <?= $form->field($model, 'body') ?>
  25 +
  26 + <?= $form->field($model, 'meta_title') ?>
  27 +
  28 + <?php // echo $form->field($model, 'meta_keywords') ?>
  29 +
  30 + <?php // echo $form->field($model, 'meta_description') ?>
  31 +
  32 + <?php // echo $form->field($model, 'seo_text') ?>
  33 +
  34 + <?php // echo $form->field($model, 'h1') ?>
  35 +
  36 + <div class="form-group">
  37 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  38 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  39 + </div>
  40 +
  41 + <?php ActiveForm::end(); ?>
  42 +
  43 +</div>
... ...
backend/views/page/create.php
1   -<?php
2   -
3   -use yii\helpers\Html;
4   -
5   -
6   -/* @var $this yii\web\View */
7   -/* @var $model backend\models\Page */
8   -
9   -$this->title = 'Create Page';
10   -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
11   -$this->params['breadcrumbs'][] = $this->title;
12   -?>
13   -<div class="page-create">
14   -
15   - <h1><?= Html::encode($this->title) ?></h1>
16   -
17   - <?= $this->render('_form', [
18   - 'model' => $model,
19   - ]) ?>
20   -
21   -</div>
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Page */
  8 +
  9 +$this->title = 'Create Page';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="page-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/page/index.php
1   -<?php
2   -
3   -use yii\helpers\Html;
4   -use yii\grid\GridView;
5   -
6   -/* @var $this yii\web\View */
7   -/* @var $searchModel backend\models\PageSearch */
8   -/* @var $dataProvider yii\data\ActiveDataProvider */
9   -
10   -$this->title = 'Статические страницы';
11   -$this->params['breadcrumbs'][] = $this->title;
12   -?>
13   -<div class="page-index">
14   -
15   - <h1><?= Html::encode($this->title) ?></h1>
16   - <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
17   -
18   - <p>
19   - <?= Html::a('Создать', ['create'], ['class' => 'btn btn-success']) ?>
20   - </p>
21   -
22   - <?= GridView::widget([
23   - 'dataProvider' => $dataProvider,
24   - 'filterModel' => $searchModel,
25   - 'columns' => [
26   - ['class' => 'yii\grid\SerialColumn'],
27   -
28   - 'id',
29   - 'name',
30   - 'alias',
31   - 'title',
32   - // 'meta_title',
33   - // 'description',
34   - // 'h1',
35   - // 'seo_text:ntext',
36   -
37   - ['class' => 'yii\grid\ActionColumn'],
38   - ],
39   - ]); ?>
40   -
41   -</div>
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\PageSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Pages';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="page-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Page', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'translit',
  29 + 'title',
  30 + 'meta_title',
  31 + // 'meta_keywords',
  32 + // 'meta_description',
  33 + // 'seo_text:ntext',
  34 + // 'h1',
  35 +
  36 + ['class' => 'yii\grid\ActionColumn'],
  37 + ],
  38 + ]); ?>
  39 +</div>
... ...
backend/views/page/update.php
1   -<?php
2   -
3   -use yii\helpers\Html;
4   -
5   -/* @var $this yii\web\View */
6   -/* @var $model backend\models\Page */
7   -
8   -$this->title = 'Update Page: ' . ' ' . $model->name;
9   -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
10   -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
11   -$this->params['breadcrumbs'][] = 'Обновление';
12   -?>
13   -<div class="page-update">
14   -
15   - <h1><?= Html::encode($this->title) ?></h1>
16   -
17   - <?= $this->render('_form', [
18   - 'model' => $model,
19   - ]) ?>
20   -
21   -</div>
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Page */
  7 +
  8 +$this->title = 'Update Page: ' . $model->title;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="page-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/page/view.php
1   -<?php
2   -
3   -use yii\helpers\Html;
4   -use yii\widgets\DetailView;
5   -
6   -/* @var $this yii\web\View */
7   -/* @var $model backend\models\Page */
8   -
9   -$this->title = $model->name;
10   -$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
11   -$this->params['breadcrumbs'][] = $this->title;
12   -?>
13   -<div class="page-view">
14   -
15   - <h1><?= Html::encode($this->title) ?></h1>
16   -
17   - <p>
18   - <?= Html::a('Обновить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
19   - <?=Html::a('Удалить', ['delete', 'id' => $model->id], [
20   - 'class' => 'btn btn-danger',
21   - 'data' => [
22   - 'confirm' => 'Вы уверены что хотите удалить этот элемент?',
23   - 'method' => 'post',
24   - ],
25   - ]) ?>
26   - </p>
27   -
28   - <?= DetailView::widget([
29   - 'model' => $model,
30   - 'attributes' => [
31   - 'id',
32   - 'name',
33   - 'alias',
34   - 'title',
35   - 'meta_title',
36   - 'description',
37   - 'h1',
38   - 'seo_text:ntext',
39   - ],
40   - ]) ?>
41   -
42   -</div>
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Page */
  8 +
  9 +$this->title = $model->title;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="page-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'translit',
  33 + 'title',
  34 + 'body:ntext',
  35 + 'meta_title',
  36 + 'meta_keywords',
  37 + 'meta_description',
  38 + 'seo_text:ntext',
  39 + 'h1',
  40 + ],
  41 + ]) ?>
  42 +
  43 +</div>
... ...
backend/views/slider-image/_form.php
... ... @@ -14,29 +14,27 @@ use yii\widgets\ActiveForm;
14 14  
15 15 <div class="slider-image-form">
16 16  
17   - <?php $form = ActiveForm::begin(); ?>
18   - <?= ImageUploader::widget([
19   - 'model'=> $model,
20   - 'field'=>'image',
21   - 'size' => [
22   - [
23   - 'width'=>$slider->width,
24   - 'height'=>$slider->height,
25   - ],
26   - ],
27   - 'gallery' =>$model->image,
28   - 'name' => 'Загрузить миниатюру статьи'
29   - ]);
30   - ?>
  17 + <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
31 18  
  19 + <?= $form->field($model, 'image')->widget(\kartik\file\FileInput::classname(), [
  20 + 'options' => [
  21 + 'accept' => 'image/*',
  22 + 'multiple' => true
  23 + ],
  24 + 'pluginOptions' => [
  25 + 'allowedFileExtensions' => ['jpg','gif','png'],
  26 + 'initialPreview' => $model->imageUrl ? Yii::$app->imageCache->thumb($model->imageUrl, 'slider') : '',
  27 + 'overwriteInitial' => true,
  28 + 'showRemove' => true,
  29 + 'showUpload' => false,
  30 + ],
  31 + ]); ?>
32 32 <?= $form->field($model, 'alt')->textInput(['maxlength' => true]) ?>
33 33  
34 34 <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
35 35  
36 36 <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
37 37  
38   - <?= $form->field($model, 'price')->textInput(['maxlength' => true]) ?>
39   -
40 38 <?= $form->field($model, 'status')->widget(Select2::className(),([
41 39 'name' => 'status',
42 40 'hideSearch' => true,
... ...
backend/views/subscribe/_form.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Subscribe */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="subscribe-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
  16 +
  17 + <?= $form->field($model, 'sale')->textInput() ?>
  18 +
  19 + <div class="form-group">
  20 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  21 + </div>
  22 +
  23 + <?php ActiveForm::end(); ?>
  24 +
  25 +</div>
... ...
backend/views/subscribe/_search.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\SubscribeSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="subscribe-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'id') ?>
  19 +
  20 + <?= $form->field($model, 'email') ?>
  21 +
  22 + <?= $form->field($model, 'sale') ?>
  23 +
  24 + <?= $form->field($model, 'sand') ?>
  25 +
  26 + <div class="form-group">
  27 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  28 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  29 + </div>
  30 +
  31 + <?php ActiveForm::end(); ?>
  32 +
  33 +</div>
... ...
backend/views/subscribe/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Subscribe */
  8 +
  9 +$this->title = 'Create Subscribe';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Subscribes', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="subscribe-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/subscribe/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\SubscribeSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Subscribes';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="subscribe-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Subscribe', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'id',
  28 + 'email:email',
  29 + 'sale',
  30 + 'sand',
  31 +
  32 + ['class' => 'yii\grid\ActionColumn'],
  33 + ],
  34 + ]); ?>
  35 +</div>
... ...
backend/views/subscribe/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Subscribe */
  7 +
  8 +$this->title = 'Update Subscribe: ' . $model->id;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Subscribes', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="subscribe-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/subscribe/view.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Subscribe */
  8 +
  9 +$this->title = $model->id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Subscribes', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="subscribe-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'id',
  32 + 'email:email',
  33 + 'sale',
  34 + 'sand',
  35 + ],
  36 + ]) ?>
  37 +
  38 +</div>
... ...
common/models/Articles.php
... ... @@ -2,13 +2,63 @@
2 2  
3 3 namespace common\models;
4 4  
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "articles".
  9 + *
  10 + * @property integer $id
  11 + * @property string $date
  12 + * @property string $title
  13 + * @property string $body
  14 + * @property string $image
  15 + * @property string $translit
  16 + * @property string $meta_title
  17 + * @property string $meta_keywords
  18 + * @property string $meta_description
  19 + * @property string $seo_text
  20 + * @property string $h1
  21 + */
5 22 class Articles extends \yii\db\ActiveRecord
6 23 {
  24 + /**
  25 + * @inheritdoc
  26 + */
7 27 public static function tableName()
8 28 {
9 29 return 'articles';
10 30 }
11   -
12   -
13   -
14   -}
15 31 \ No newline at end of file
  32 +
  33 + /**
  34 + * @inheritdoc
  35 + */
  36 + public function rules()
  37 + {
  38 + return [
  39 + [['date'], 'safe'],
  40 + [['title', 'body', 'image', 'translit'], 'required'],
  41 + [['body', 'seo_text'], 'string'],
  42 + [['title', 'image', 'translit', 'meta_title', 'meta_keywords', 'meta_description', 'h1'], 'string', 'max' => 255],
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * @inheritdoc
  48 + */
  49 + public function attributeLabels()
  50 + {
  51 + return [
  52 + 'id' => 'ID',
  53 + 'date' => 'Date',
  54 + 'title' => 'Title',
  55 + 'body' => 'Body',
  56 + 'image' => 'Image',
  57 + 'translit' => 'Translit',
  58 + 'meta_title' => 'Meta Title',
  59 + 'meta_keywords' => 'Meta Keywords',
  60 + 'meta_description' => 'Meta Description',
  61 + 'seo_text' => 'Seo Text',
  62 + 'h1' => 'H1',
  63 + ];
  64 + }
  65 +}
... ...
common/models/ArticlesSearch.php 0 → 100755
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\Articles;
  9 +
  10 +/**
  11 + * ArticlesSearch represents the model behind the search form about `common\models\Articles`.
  12 + */
  13 +class ArticlesSearch extends Articles
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id'], 'integer'],
  22 + [['date', 'title', 'body', 'image', 'translit', 'meta_title', 'meta_keywords', 'meta_description', 'seo_text', 'h1'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = Articles::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'id' => $this->id,
  63 + 'date' => $this->date,
  64 + ]);
  65 +
  66 + $query->andFilterWhere(['like', 'title', $this->title])
  67 + ->andFilterWhere(['like', 'body', $this->body])
  68 + ->andFilterWhere(['like', 'image', $this->image])
  69 + ->andFilterWhere(['like', 'translit', $this->translit])
  70 + ->andFilterWhere(['like', 'meta_title', $this->meta_title])
  71 + ->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords])
  72 + ->andFilterWhere(['like', 'meta_description', $this->meta_description])
  73 + ->andFilterWhere(['like', 'seo_text', $this->seo_text])
  74 + ->andFilterWhere(['like', 'h1', $this->h1]);
  75 +
  76 + return $dataProvider;
  77 + }
  78 +}
... ...
common/models/BgSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\Bg;
  9 +
  10 +/**
  11 + * BgSearch represents the model behind the search form about `common\models\Bg`.
  12 + */
  13 +class BgSearch extends Bg
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id'], 'integer'],
  22 + [['title', 'url', 'image'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = Bg::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'id' => $this->id,
  63 + ]);
  64 +
  65 + $query->andFilterWhere(['like', 'title', $this->title])
  66 + ->andFilterWhere(['like', 'url', $this->url])
  67 + ->andFilterWhere(['like', 'image', $this->image]);
  68 +
  69 + return $dataProvider;
  70 + }
  71 +}
... ...
common/models/CustomerSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\Customer;
  9 +
  10 +/**
  11 + * CustomerSearch represents the model behind the search form about `common\models\Customer`.
  12 + */
  13 +class CustomerSearch extends Customer
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id', 'birth_day', 'birth_month', 'birth_year', 'group_id'], 'integer'],
  22 + [['username', 'password', 'name', 'surname', 'phone', 'date_time', 'sex', 'body'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = Customer::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'id' => $this->id,
  63 + 'date_time' => $this->date_time,
  64 + 'birth_day' => $this->birth_day,
  65 + 'birth_month' => $this->birth_month,
  66 + 'birth_year' => $this->birth_year,
  67 + 'group_id' => $this->group_id,
  68 + ]);
  69 +
  70 + $query->andFilterWhere(['like', 'username', $this->username])
  71 + ->andFilterWhere(['like', 'password', $this->password])
  72 + ->andFilterWhere(['like', 'name', $this->name])
  73 + ->andFilterWhere(['like', 'surname', $this->surname])
  74 + ->andFilterWhere(['like', 'phone', $this->phone])
  75 + ->andFilterWhere(['like', 'sex', $this->sex])
  76 + ->andFilterWhere(['like', 'body', $this->body]);
  77 +
  78 + return $dataProvider;
  79 + }
  80 +}
... ...
common/models/Delivery.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +class Delivery extends \yii\db\ActiveRecord
  6 +{
  7 + public static function tableName()
  8 + {
  9 + return 'orders_delivery';
  10 + }
  11 +
  12 +}
0 13 \ No newline at end of file
... ...
common/models/OrderItems.php deleted
1   -<?php
2   -
3   -namespace common\models;
4   -
5   -use common\modules\product\models\ProductVariant;
6   -use Yii;
7   -
8   -/**
9   - * This is the model class for table "order_items".
10   - *
11   - * @property integer $order_items_id
12   - * @property integer $order_id
13   - * @property integer $item_id
14   - * @property integer $item_count
15   - * @property double $price
16   - *
17   - * @property Orders $order
18   - * @property ProductVariant $item
19   - */
20   -class OrderItems extends \yii\db\ActiveRecord
21   -{
22   - /**
23   - * @inheritdoc
24   - */
25   - public static function tableName()
26   - {
27   - return 'order_items';
28   - }
29   -
30   - /**
31   - * @inheritdoc
32   - */
33   - public function rules()
34   - {
35   - return [
36   - [['order_id', 'item_id', 'item_count'], 'integer'],
37   - [['price'], 'number'],
38   - [['order_id'], 'exist', 'skipOnError' => true, 'targetClass' => Orders::className(), 'targetAttribute' => ['order_id' => 'order_id']],
39   - [['item_id'], 'exist', 'skipOnError' => true, 'targetClass' => ProductVariant::className(), 'targetAttribute' => ['item_id' => 'product_variant_id']],
40   - ];
41   - }
42   -
43   - /**
44   - * @inheritdoc
45   - */
46   - public function attributeLabels()
47   - {
48   - return [
49   - 'order_items_id' => Yii::t('app', 'order_items_id'),
50   - 'order_id' => Yii::t('app', 'order_id'),
51   - 'item_id' => Yii::t('app', 'item_id'),
52   - 'item_count' => Yii::t('app', 'item_count'),
53   - 'price' => Yii::t('app', 'price'),
54   - ];
55   - }
56   -
57   - /**
58   - * @return \yii\db\ActiveQuery
59   - */
60   - public function getOrder()
61   - {
62   - return $this->hasOne(Orders::className(), ['order_id' => 'order_id']);
63   - }
64   -
65   - /**
66   - * @return \yii\db\ActiveQuery
67   - */
68   - public function getItem()
69   - {
70   - return $this->hasOne(ProductVariant::className(), ['product_variant_id' => 'item_id']);
71   - }
72   -}
common/models/Orders.php
1 1 <?php
2   -
3 2 namespace common\models;
4 3  
5 4 use Yii;
6   -use yii\behaviors\TimestampBehavior;
7   -/**
8   - * This is the model class for table "orders".
9   - *
10   - * @property integer $order_id
11   - * @property integer $customer_id
12   - * @property string $name
13   - * @property string $email
14   - * @property string $phone
15   - * @property integer $delivery
16   - * @property integer $payment
17   - * @property string $code
18   - * @property integer $status
19   - * @property integer $created_at
20   - * @property integer $updated_at
21   - *
22   - * @property OrderItems[] $orderItems
23   - */
  5 +use yii\web\Session;
  6 +use common\modules\product\models\ProductVariant;
  7 +
24 8 class Orders extends \yii\db\ActiveRecord
25 9 {
26 10  
27   -
28   - /**
29   - * @inheritdoc
30   - */
31 11 public static function tableName()
32 12 {
33 13 return 'orders';
34 14 }
35 15  
36   -
37   - /**
38   - * @inheritdoc
39   - */
40 16 public function rules()
41 17 {
42 18 return [
43   - [['customer_id', 'delivery', 'payment', 'status', 'created_at', 'updated_at'], 'integer'],
44   - [['created', 'updated'],'safe'],
45   - [['name', 'email', 'phone'], 'required'],
46   - [['name', 'email', 'code'], 'string', 'max' => 255],
47   - [['phone'], 'string', 'max' => 32],
  19 + [['name', 'phone'], 'required','whenClient' => true],
  20 + //['email', 'email'],
  21 + [['total','body','patronymic','surname','email','phone2','delivery','payment'], 'safe'],
  22 + [['email'],'email'],
48 23 ];
49 24 }
50 25  
51   - /**
52   - * @inheritdoc
53   - */
54   - public function behaviors()
  26 + public function attributeLabels()
55 27 {
56 28 return [
57   - TimestampBehavior::className(),
  29 + 'name' => 'Имя',
  30 + 'phone'=>'Телефон',
  31 + 'phone2'=>'Дополнительный телефон',
  32 + 'body'=>'Сообщение',
  33 + 'adress'=>'Адрес',
  34 + 'city'=>'Город',
  35 + 'patronymic'=>'Отчество',
  36 + 'surname'=>'Фамилия',
  37 + 'email'=>'E-mail',
  38 + 'date_time'=>'Дата',
  39 + 'total'=>'Сума',
  40 + 'status'=>'Статус',
  41 + 'delivery'=>'Вариант доставки',
  42 + 'payment'=>'Способы оплаты',
58 43 ];
59 44 }
60 45  
  46 + public function beforeSave($insert) {
  47 + $this->user_id = Yii::$app->user->id;
  48 + $this->date_time = new \yii\db\Expression('NOW()');
  49 + return parent::beforeSave($insert);
  50 + }
61 51  
62   - public function getCreated(){
63   - if(!empty($this->created_at)){
64   - return date("Y-m-d" , $this->created_at);
  52 + public function beforeDelete() {
  53 + return parent::beforeDelete();
  54 + }
  55 +
  56 + public function contact($email,$body)
  57 + {
  58 + if ($this->validate()) {
  59 + $body .= 'Вся сумма: '.$this->total;
  60 + $body .= "\n\r";
  61 + $body .= 'Имя: '.$this->name;
  62 + $body .= "\n\r";
  63 + $body .= 'Фамилия: '.$this->surname;
  64 + $body .= "\n\r";
  65 + $body .= 'Отчество: '.$this->patronymic;
  66 + $body .= "\n\r";
  67 + $body .= 'E-mail: '.$this->email;
  68 + $body .= "\n\r";
  69 + $body .= 'Телефон: '.$this->phone;
  70 + $body .= "\n\r";
  71 + $body .= 'Адрес: '.$this->adress;
  72 + $body .= "\n\r";
  73 + $body .= 'Сообщение: '.$this->body;
  74 + $body .= "\n\r";
  75 +
  76 + Yii::$app->mailer->compose()
  77 + ->setTo($email)
  78 + ->setFrom(['send@artweb.ua' => 'send'])
  79 + ->setSubject('Заказ на сайте Рюкзаки')
  80 + ->setTextBody($body)
  81 + ->send();
  82 + return true;
65 83 } else {
66   - return '';
  84 + return false;
  85 + }
  86 + }
  87 + public function addBasket ($mod_id, $count)
  88 + {
  89 + $session = new Session;
  90 + $session->open ();
  91 + $data = $session['basket'];
  92 + $i = 0;
  93 + if (isset($session['basket']))
  94 + {
  95 + foreach ($session['basket'] as $key => $basket)
  96 + {
  97 + if ($mod_id == $basket['id'])
  98 + {
  99 + $data[$key]['count'] += $count;
  100 + $session['basket'] = $data;
  101 + $i++;
  102 + }
  103 + }
  104 + }
  105 + if ($i == 0)
  106 + {
  107 + $data[] = ['id' => $mod_id, 'count' => $count];
  108 + $session['basket'] = $data;
67 109 }
68 110 }
69 111  
70 112  
71   - public function getUpdated(){
72   - if(!empty($this->updated_at)){
73   - return date("Y-m-d" , $this->updated_at);
74   - } else {
75   - return '';
  113 + public function rowBasket ()
  114 + {
  115 + $session = new Session;
  116 + $session->open ();
  117 + $cost = 0;
  118 + $count = 0;
  119 + if (isset($session['basket']) && count ($session['basket']))
  120 + {
  121 + foreach ($session['basket'] as $product)
  122 + {
  123 + $count += $product['count'];
  124 + }
76 125 }
  126 +
  127 + return (object)['cost' => $cost, 'count' => $count];
77 128 }
78 129  
79   - /**
80   - * @inheritdoc
81   - */
82   - public function attributeLabels()
  130 +
  131 + public function deleteBasketMod ($id)
83 132 {
84   - return [
85   - 'order_id' => Yii::t('app', 'order_id'),
86   - 'customer_id' => Yii::t('app', 'customer_id'),
87   - 'name' => Yii::t('app', 'name'),
88   - 'email' => Yii::t('app', 'email'),
89   - 'phone' => Yii::t('app', 'phone'),
90   - 'delivery' => Yii::t('app', 'delivery'),
91   - 'payment' => Yii::t('app', 'payment'),
92   - 'code' => Yii::t('app', 'code'),
93   - 'status' => Yii::t('app', 'status'),
94   - 'created_at' => Yii::t('app', 'created_at'),
95   - 'updated_at' => Yii::t('app', 'updated_at'),
96   - ];
  133 + $session = new Session;
  134 + $session->open ();
  135 + $basket = $session['basket'];
  136 + foreach ($basket as $key => $product)
  137 + {
  138 + if ($id == $product['id']) unset($basket[$key]);
  139 + }
  140 + $session['basket'] = $basket;
  141 + }
  142 +
  143 + public function updateBasket ($row)
  144 + {
  145 + $session = new Session;
  146 + $session->open ();
  147 + //$data = array();
  148 + if ($row['count'] > 0) $this->data[] = ['id' => $row['id'], 'count' => $row['count']];
  149 + $session['basket'] = $this->data;
  150 + }
  151 +
  152 +
  153 + public function getBasketMods ()
  154 + {
  155 + $session = new Session;
  156 + $session->open ();
  157 + $products = [];
  158 + if (empty($session['basket'])) return [];
  159 + foreach ($session['basket'] as $product)
  160 + {
  161 + $row = ProductVariant::find ()->select (['product_variant.*', 'product.name as product_name', 'product.alias'])
  162 + ->where (['product_variant.product_variant_id' => $product['id']])
  163 + ->leftJoin ('product', 'product.product_id = product_variant.product_id')
  164 + ->one ();
  165 + $row->count = $product['count'];
  166 + $row->sum_cost = $product['count'] * $row->price;
  167 + $products[] = $row;
  168 + }
  169 +
  170 + return $products;
  171 + }
  172 +
  173 + public function getSumCost ()
  174 + {
  175 + $session = new Session;
  176 + $session->open ();
  177 + $cost = 0;
  178 + if (empty($session['basket'])) return false;
  179 + foreach ($session['basket'] as $product)
  180 + {
  181 + $cost += ($this->getModCost ($product['id']) * $product['count']);
  182 + }
  183 +
  184 + return $cost;
  185 + }
  186 +
  187 + private function getModCost ($mod_id)
  188 + {
  189 + $mod = ProductVariant::find ()->where (['product_variant_id' => $mod_id])->one ();
  190 +
  191 + return $mod->price;
  192 + }
  193 +
  194 + public function getUser()
  195 + {
  196 + return $this->hasOne(User::className(), ['id' => 'user_id']);
97 197 }
98 198  
99   - /**
100   - * @return \yii\db\ActiveQuery
101   - */
102   - public function getOrderItems()
  199 + public function getProducts()
103 200 {
104   - return $this->hasMany(OrderItems::className(), ['order_id' => 'order_id']);
  201 + return $this->hasMany(OrdersProducts::className(), ['order_id' => 'id']);
105 202 }
106 203 -}
  204 +}
107 205 \ No newline at end of file
... ...
common/models/OrdersProducts.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +class OrdersProducts extends \yii\db\ActiveRecord
  6 +{
  7 + public static function tableName()
  8 + {
  9 + return 'orders_products';
  10 + }
  11 +
  12 + public function rules()
  13 + {
  14 + return [
  15 + [['order_id'], 'required'],
  16 + //['email', 'email'],
  17 + [['product_name','name','price','count','sum_cost','mod_id','sku'], 'safe'],
  18 + ];
  19 + }
  20 +
  21 +
  22 + public function attributeLabels()
  23 + {
  24 + return [
  25 + 'product_name'=>'Продукт',
  26 + 'name'=>'Вид',
  27 + 'art'=>'Артикул',
  28 + 'cost'=>'Цена за один',
  29 + 'count'=>'Кол.',
  30 + 'sum_cost'=>'Сумма',
  31 + ];
  32 + }
  33 +
  34 + public function getMod()
  35 + {
  36 + return $this->hasOne(Mod::className(), ['id' => 'mod_id']);
  37 + }
  38 +}
0 39 \ No newline at end of file
... ...
common/models/Page.php
... ... @@ -5,17 +5,17 @@ namespace common\models;
5 5 use Yii;
6 6  
7 7 /**
8   - * This is the model class for table "{{%page}}".
  8 + * This is the model class for table "page".
9 9 *
10 10 * @property integer $id
11   - * @property string $name
12 11 * @property string $translit
13 12 * @property string $title
14 13 * @property string $body
15 14 * @property string $meta_title
16   - * @property string $description
17   - * @property string $h1
  15 + * @property string $meta_keywords
  16 + * @property string $meta_description
18 17 * @property string $seo_text
  18 + * @property string $h1
19 19 */
20 20 class Page extends \yii\db\ActiveRecord
21 21 {
... ... @@ -24,56 +24,53 @@ class Page extends \yii\db\ActiveRecord
24 24 */
25 25 public static function tableName()
26 26 {
27   - return '{{page}}';
  27 + return 'page';
28 28 }
29   -
30 29 /**
31 30 * @inheritdoc
32 31 */
33   - public function rules()
  32 + public function behaviors()
34 33 {
35 34 return [
36   - [['name', 'body'], 'required'],
37   - [['body', 'seo_text'], 'string'],
38   - [['name', 'h1'], 'string', 'max' => 255],
39   - [['alias', 'title', 'meta_title', 'description'], 'string', 'max' => 250]
  35 + 'slug' => [
  36 + 'class' => 'common\behaviors\Slug',
  37 + 'in_attribute' => 'title',
  38 + 'out_attribute' => 'translit',
  39 + 'translit' => true
  40 + ]
40 41 ];
41 42 }
42   -
43 43 /**
44 44 * @inheritdoc
45 45 */
46   - public function attributeLabels()
47   - {
48   - return [
49   - 'id' => Yii::t('app', 'id'),
50   - 'name' => Yii::t('app', 'name'),
51   - 'alias' => Yii::t('app', 'alias'),
52   - 'title' => Yii::t('app', 'title'),
53   - 'body' => Yii::t('app', 'body'),
54   - 'meta_title' => Yii::t('app', 'meta_title'),
55   - 'description' => Yii::t('app', 'description'),
56   - 'h1' =>Yii::t('app', 'h1'),
57   - 'seo_text' => Yii::t('app', 'seo_text'),
58   - ];
59   - }
60   -
61   - public function behaviors()
  46 + public function rules()
62 47 {
63 48 return [
64   - 'slug' => [
65   - 'class' => 'common\behaviors\Slug',
66   - 'in_attribute' => 'name',
67   - 'out_attribute' => 'alias',
68   - 'translit' => true
69   - ]
  49 + [['body', 'seo_text'], 'string'],
  50 + [['translit', 'title', 'meta_title', 'meta_keywords', 'meta_description', 'h1'], 'string', 'max' => 255],
70 51 ];
71 52 }
72   -
73 53 public function getPageTranslit($page){
74 54 return self::find()
75   - ->where(['alias' => $page])
  55 + ->where(['translit' => $page])
76 56 ->one();
77 57  
78 58 }
  59 + /**
  60 + * @inheritdoc
  61 + */
  62 + public function attributeLabels()
  63 + {
  64 + return [
  65 + 'id' => 'ID',
  66 + 'translit' => 'Translit',
  67 + 'title' => 'Title',
  68 + 'body' => 'Body',
  69 + 'meta_title' => 'Meta Title',
  70 + 'meta_keywords' => 'Meta Keywords',
  71 + 'meta_description' => 'Meta Description',
  72 + 'seo_text' => 'Seo Text',
  73 + 'h1' => 'H1',
  74 + ];
  75 + }
79 76 }
... ...
common/models/PageSearch.php
1   -<?php
2   -
3   -namespace common\models;
4   -
5   -use Yii;
6   -use yii\base\Model;
7   -use yii\data\ActiveDataProvider;
8   -
9   -/**
10   - * PageSearch represents the model behind the search form about `backend\models\Page`.
11   - */
12   -class PageSearch extends Page
13   -{
14   - /**
15   - * @inheritdoc
16   - */
17   - public function rules()
18   - {
19   - return [
20   - [['id'], 'integer'],
21   - [['name', 'alias', 'title', 'body', 'meta_title', 'description', 'h1', 'seo_text'], 'safe'],
22   - ];
23   - }
24   -
25   - /**
26   - * @inheritdoc
27   - */
28   - public function scenarios()
29   - {
30   - // bypass scenarios() implementation in the parent class
31   - return Model::scenarios();
32   - }
33   -
34   - /**
35   - * Creates data provider instance with search query applied
36   - *
37   - * @param array $params
38   - *
39   - * @return ActiveDataProvider
40   - */
41   - public function search($params)
42   - {
43   - $query = Page::find();
44   -
45   - $dataProvider = new ActiveDataProvider([
46   - 'query' => $query,
47   - ]);
48   -
49   - $this->load($params);
50   -
51   - if (!$this->validate()) {
52   - // uncomment the following line if you do not want to any records when validation fails
53   - // $query->where('0=1');
54   - return $dataProvider;
55   - }
56   -
57   - $query->andFilterWhere([
58   - 'id' => $this->id,
59   - ]);
60   -
61   - $query->andFilterWhere(['like', 'name', $this->name])
62   - ->andFilterWhere(['like', 'alias', $this->alias])
63   - ->andFilterWhere(['like', 'title', $this->title])
64   - ->andFilterWhere(['like', 'body', $this->body])
65   - ->andFilterWhere(['like', 'meta_title', $this->meta_title])
66   - ->andFilterWhere(['like', 'description', $this->description])
67   - ->andFilterWhere(['like', 'h1', $this->h1])
68   - ->andFilterWhere(['like', 'seo_text', $this->seo_text]);
69   -
70   - return $dataProvider;
71   - }
72   -}
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\Page;
  9 +
  10 +/**
  11 + * PageSearch represents the model behind the search form about `common\models\Page`.
  12 + */
  13 +class PageSearch extends Page
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id'], 'integer'],
  22 + [['translit', 'title', 'body', 'meta_title', 'meta_keywords', 'meta_description', 'seo_text', 'h1'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = Page::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'id' => $this->id,
  63 + ]);
  64 +
  65 + $query->andFilterWhere(['like', 'translit', $this->translit])
  66 + ->andFilterWhere(['like', 'title', $this->title])
  67 + ->andFilterWhere(['like', 'body', $this->body])
  68 + ->andFilterWhere(['like', 'meta_title', $this->meta_title])
  69 + ->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords])
  70 + ->andFilterWhere(['like', 'meta_description', $this->meta_description])
  71 + ->andFilterWhere(['like', 'seo_text', $this->seo_text])
  72 + ->andFilterWhere(['like', 'h1', $this->h1]);
  73 +
  74 + return $dataProvider;
  75 + }
  76 +}
... ...
common/models/SliderImage.php
... ... @@ -15,7 +15,6 @@ use Yii;
15 15 * @property string $url
16 16 * @property integer $status
17 17 * @property integer $sort
18   - * @property double $price
19 18 *
20 19 * @property Slider $slider
21 20 */
... ... @@ -36,7 +35,6 @@ class SliderImage extends \yii\db\ActiveRecord
36 35 {
37 36 return [
38 37 [['slider_id', 'status', 'sort'], 'integer'],
39   - [['price'], 'number'],
40 38 [['image', 'alt', 'title', 'url'], 'string', 'max' => 255],
41 39 [['slider_id'], 'exist', 'skipOnError' => true, 'targetClass' => Slider::className(), 'targetAttribute' => ['slider_id' => 'slider_id']],
42 40 ];
... ... @@ -56,7 +54,6 @@ class SliderImage extends \yii\db\ActiveRecord
56 54 'url' => Yii::t('app', 'url'),
57 55 'status' => Yii::t('app', 'status'),
58 56 'sort' => Yii::t('app', 'sort'),
59   - 'price' => Yii::t('app', 'price'),
60 57 ];
61 58 }
62 59  
... ... @@ -67,4 +64,13 @@ class SliderImage extends \yii\db\ActiveRecord
67 64 {
68 65 return $this->hasOne(Slider::className(), ['slider_id' => 'slider_id']);
69 66 }
  67 +
  68 + public function getImageFile() {
  69 + return empty($this->image) ? null : '/storage/slider/'. $this->image;
  70 + }
  71 +
  72 + public function getImageUrl() {
  73 + return empty($this->image) ? null : '/storage/slider/'. $this->image;
  74 + }
  75 +
70 76 }
... ...
common/models/Subscribe.php 100644 → 100755
common/models/SubscribeSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\Subscribe;
  9 +
  10 +/**
  11 + * SubscribeSearch represents the model behind the search form about `common\models\Subscribe`.
  12 + */
  13 +class SubscribeSearch extends Subscribe
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id', 'sale', 'sand'], 'integer'],
  22 + [['email'], 'safe'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = Subscribe::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'id' => $this->id,
  63 + 'sale' => $this->sale,
  64 + 'sand' => $this->sand,
  65 + ]);
  66 +
  67 + $query->andFilterWhere(['like', 'email', $this->email]);
  68 +
  69 + return $dataProvider;
  70 + }
  71 +}
... ...
common/modules/product/controllers/ProductUnitController.php 100644 → 100755
common/modules/product/models/ProductUnitSearch.php 100644 → 100755
common/modules/product/models/ProductVariant.php
... ... @@ -24,6 +24,17 @@ use Yii;
24 24 */
25 25 class ProductVariant extends \yii\db\ActiveRecord
26 26 {
  27 +
  28 + /**just for rukzachok**/
  29 + public $count;
  30 + public $sum_cost;
  31 + public $product_name;
  32 + //public $image;
  33 + public $translit;
  34 + public $translit_rubric;
  35 + private $data;
  36 +
  37 +
27 38 /** @var array $_images */
28 39 public $imagesUpload = [];
29 40 /**
... ... @@ -128,4 +139,8 @@ class ProductVariant extends \yii\db\ActiveRecord
128 139 {
129 140 return new ProductVariantQuery(get_called_class());
130 141 }
  142 +
  143 + public function getId(){
  144 + return $this->product_variant_id;
  145 + }
131 146 }
... ...
common/modules/product/views/product-unit/_form.php 100644 → 100755
common/modules/product/views/product-unit/_search.php 100644 → 100755
common/modules/product/views/product-unit/create.php 100644 → 100755
common/modules/product/views/product-unit/index.php 100644 → 100755
common/modules/product/views/product-unit/update.php 100644 → 100755
common/modules/product/views/product-unit/view.php 100644 → 100755
console/migrations/m160320_174258_customer.php 100644 → 100755
console/migrations/m160321_232402_orders.php renamed to console/migrations/m160321_232402_orders1.php
console/migrations/m160509_214535_customer.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160509_214535_customer extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 +
  10 + $this->createTable('{{%customer}}', [
  11 +
  12 +
  13 + 'id' => $this->primaryKey(),
  14 + 'username' => $this->string()->notNull(),
  15 + 'password' => $this->string()->notNull(),
  16 + 'name' => $this->string()->notNull(),
  17 + 'surname' => $this->string(),
  18 + 'phone' => $this->string(),
  19 + 'date_time' => $this->date()->defaultExpression('NOW()'),
  20 + 'sex' => $this->string(32),
  21 + 'birth_day' => $this->integer(),
  22 + 'birth_month' => $this->integer(),
  23 + 'birth_year' => $this->integer(),
  24 + 'body' => $this->text(),
  25 + 'group_id' => $this->integer(),
  26 + ]);
  27 + }
  28 +
  29 + public function down()
  30 + {
  31 + $this->dropTable('{{%customer}}');
  32 + }
  33 +
  34 + /*
  35 + // Use safeUp/safeDown to run migration code within a transaction
  36 + public function safeUp()
  37 + {
  38 + }
  39 +
  40 + public function safeDown()
  41 + {
  42 + }
  43 + */
  44 +}
... ...
console/migrations/m160509_231345_auth_assignment.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160509_231345_auth_assignment extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->createTable('{{%auth_assignment}}', [
  10 +
  11 +
  12 + 'item_name' => $this->string(),
  13 + 'user_id' => $this->integer(),
  14 + 'created_at' => $this->integer(),
  15 + ]);
  16 + }
  17 +
  18 + public function down()
  19 + {
  20 + $this->dropTable('{{%auth_assignment}}');
  21 + }
  22 +
  23 + /*
  24 + // Use safeUp/safeDown to run migration code within a transaction
  25 + public function safeUp()
  26 + {
  27 + }
  28 +
  29 + public function safeDown()
  30 + {
  31 + }
  32 + */
  33 +}
... ...
console/migrations/m160512_153443_subscribe.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160512_153443_subscribe extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->createTable('{{%subscribe}}', [
  10 +
  11 +
  12 + 'id' => $this->primaryKey(),
  13 + 'email' => $this->string()->notNull(),
  14 + 'sale' => $this->integer()->notNull(),
  15 + 'sand' => $this->smallInteger()->notNull()->defaultValue(0),
  16 + ]);
  17 + }
  18 +
  19 + public function down()
  20 + {
  21 + $this->dropTable('{{%subscribe}}');
  22 + }
  23 +
  24 +}
... ...
console/migrations/m160516_222821_orders.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160516_222821_orders extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $tableOptions = null;
  10 + if ($this->db->driverName === 'mysql') {
  11 + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
  12 + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
  13 + }
  14 +
  15 +
  16 + $this->createTable('{{%orders}}', [
  17 + 'id' => $this->primaryKey(),
  18 + 'user_id' => $this->integer(),
  19 + 'name' => $this->string()->notNull(),
  20 + 'surname' => $this->string()->notNull(),
  21 + 'patronymic' => $this->string()->notNull(),
  22 + 'phone' => $this->string(),
  23 + 'phone2' => $this->string(),
  24 + 'email' => $this->string(),
  25 + 'adress' => $this->string(),
  26 + 'body' => $this->text(),
  27 + 'total' => $this->float(),
  28 + 'date_time' => $this->dateTime(),
  29 + 'date_dedline' => $this->date(),
  30 + 'reserve' => $this->string(),
  31 + 'status' => $this->string(),
  32 + 'comment' => $this->text(),
  33 + 'label' => $this->integer(),
  34 + 'pay' => $this->integer(),
  35 + 'numbercard' => $this->integer(),
  36 + 'delivery' => $this->string(),
  37 + 'declaration' => $this->string(),
  38 + 'stock' => $this->string(),
  39 + 'consignment' => $this->string(),
  40 + 'payment' => $this->string(),
  41 + 'insurance' => $this->string(),
  42 + 'amount_imposed' => $this->float(),
  43 + 'shipping_by' => $this->string(),
  44 + 'city' => $this->string(),
  45 + ], $tableOptions);
  46 +
  47 +
  48 + $this->createTable('{{%orders_products}}', [
  49 + 'id' => $this->primaryKey(),
  50 + 'order_id' => $this->integer(),
  51 + 'mod_id' => $this->integer(),
  52 + 'product_name' => $this->string(),
  53 + 'name' => $this->string(),
  54 + 'sku' => $this->string(),
  55 + 'price' => $this->float(),
  56 + 'count' => $this->integer(),
  57 + 'sum_cost' => $this->float(),
  58 + ], $tableOptions);
  59 +
  60 + $this->addForeignKey('orders_products_fk', '{{%orders_products}}', 'order_id', '{{%orders}}', 'id', 'CASCADE', 'CASCADE');
  61 + $this->addForeignKey('orders_products_items_fk', '{{%orders_products}}', 'id', '{{%product}}', 'product_id', 'RESTRICT', 'RESTRICT');
  62 + }
  63 +
  64 + public function down()
  65 + {
  66 + $this->dropForeignKey('orders_products_fk', '{{%orders_products}}');
  67 + $this->dropForeignKey('orders_products_items_fk', '{{%orders_products}}');
  68 + $this->dropTable('{{%orders}}');
  69 + $this->dropTable('{{%orders_products}}');
  70 + }
  71 +
  72 +}
0 73 \ No newline at end of file
... ...
console/migrations/m160516_234753_orders_delivery.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160516_234753_orders_delivery extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 +
  10 + $this->createTable('{{%orders_delivery}}', [
  11 + 'id' => $this->primaryKey(),
  12 + 'parent_id' => $this->integer(),
  13 + 'title' => $this->string(),
  14 + 'title_ukr' => $this->string(),
  15 + 'value' => $this->integer(),
  16 + 'text' => $this->text(),
  17 + 'text_ukr' => $this->text(),
  18 + 'sort' => $this->integer(),
  19 + ]);
  20 +
  21 + }
  22 +
  23 + public function down()
  24 + {
  25 + $this->dropTable('{{%orders_delivery}}');
  26 + }
  27 +
  28 + /*
  29 + // Use safeUp/safeDown to run migration code within a transaction
  30 + public function safeUp()
  31 + {
  32 + }
  33 +
  34 + public function safeDown()
  35 + {
  36 + }
  37 + */
  38 +}
... ...
frontend/controllers/BasketController.php 100755 → 100644
1 1 <?php
2 2  
3   -namespace app\controllers;
  3 +namespace frontend\controllers;
4 4  
  5 +
  6 +use common\models\Customer;
  7 +use common\models\OrdersProducts;
5 8 use Yii;
6 9 use yii\web\Controller;
7   -use app\models\Mod;
8   -use app\models\Order;
9   -use app\models\User;
10   -use app\models\OrdersProducts;
  10 +use common\modules\product\models\ProductVariant;
  11 +use common\models\Orders;
  12 +//use app\models\User;
  13 +//use app\models\OrdersProducts;
11 14 use yii\web\HttpException;
12 15  
13 16 class BasketController extends Controller
14 17 {
15 18  
16 19 public function actionIndex(){
17   - $modelMod = new Mod;
18   - $modelOrder = new Order;
  20 + $modelMod = new ProductVariant;
  21 + $modelOrder = new Orders;
19 22  
20 23 if(!empty($_GET['deleteID'])){
21   - $modelMod->deleteBasketMod($_GET['deleteID']);
  24 + $modelOrder->deleteBasketMod($_GET['deleteID']);
22 25 return Yii::$app->response->redirect(['basket/index']);
23 26 }
24 27  
25 28 if(isset($_POST['update'])){
26 29 foreach ($_POST['Mod'] as $index=>$row) {
27   - $modelMod->updateBasket($row);
  30 + $modelOrder->updateBasket($row);
28 31 }
29 32 }elseif(isset($_POST['Mod'])){
30 33 $body = '';
... ... @@ -36,7 +39,7 @@ class BasketController extends Controller
36 39  
37 40 if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->save() && $modelOrder->contact('borisenko.pavel@gmail.com',$body)) {
38 41 foreach ($_POST['Mod'] as $index=>$row) {
39   - $modelOrdersProducts = new OrdersProducts;
  42 + $modelOrdersProducts = new OrdersProducts();
40 43 $mod_id = $row['id'];
41 44 unset($row['id']);
42 45 $data['OrdersProducts'] = $row;
... ... @@ -47,7 +50,7 @@ class BasketController extends Controller
47 50 $modelOrdersProducts->save();
48 51 }
49 52 if(!Yii::$app->user->id){
50   - $modelUser = new User;
  53 + $modelUser = new Customer();
51 54 $modelUser->role = 'person';
52 55 $modelUser->username = $modelOrder->email;
53 56 $modelUser->name = $modelOrder->name;
... ... @@ -61,10 +64,10 @@ class BasketController extends Controller
61 64 }
62 65 }
63 66  
64   - $basket_mods = $modelMod->getBasketMods();
  67 + $basket_mods = $modelOrder->getBasketMods();
65 68  
66 69 if(!empty(Yii::$app->user->id)){
67   - $user = User::findOne(Yii::$app->user->id);
  70 + $user = Customer::findOne(Yii::$app->user->id);
68 71 $modelOrder->email = $user->username;
69 72 $modelOrder->phone = $user->phone;
70 73 $modelOrder->name = $user->name;
... ... @@ -79,7 +82,7 @@ class BasketController extends Controller
79 82 }
80 83  
81 84 public function actionItems(){
82   - $modelMod = new Mod;
  85 + $modelMod = new Orders;
83 86 if(!empty($_GET['deleteID'])){
84 87 $modelMod->deleteBasketMod($_GET['deleteID']);
85 88 }
... ... @@ -98,7 +101,7 @@ class BasketController extends Controller
98 101  
99 102 public function actionInfo()
100 103 {
101   - $modelMod = new Mod;
  104 + $modelMod = new Orders();
102 105 $info = $modelMod->rowBasket();
103 106 return $this->renderAjax('ajax_info', [
104 107 'info'=>$info,
... ... @@ -106,9 +109,9 @@ class BasketController extends Controller
106 109 }
107 110  
108 111 public function actionAdd(){
109   - $modelMod = new Mod;
  112 + $modelOrders = new Orders();
110 113 if(isset($_GET['mod_id'],$_GET['count']) && $_GET['mod_id']>0 && $_GET['count']>0){
111   - $modelMod->addBasket($_GET['mod_id'],$_GET['count']);
  114 + $modelOrders->addBasket($_GET['mod_id'],$_GET['count']);
112 115 }
113 116  
114 117 Yii::$app->end();
... ...
frontend/controllers/CabinetController.php 100644 → 100755
frontend/controllers/EventController.php 100644 → 100755
frontend/controllers/OrdersController.php 100644 → 100755
1   -<?php
2   -
3   -namespace frontend\controllers;
4   -
5   -use common\models\Customers;
6   -use common\models\OrderItems;
7   -use common\models\Orders;
8   -use common\modules\product\models\ProductVariant;
9   -use common\widgets\BasketModal;
10   -use Yii;
11   -
12   -use yii\web\Controller;
13   -use yii\web\NotFoundHttpException;
14   -use yii\data\ArrayDataProvider;
15   -/**
16   - * OrderController implements the CRUD actions for Order model.
17   - */
18   -class OrdersController extends Controller
19   -{
20   -
21   -
22   - /**
23   - * @inheritdoc
24   - */
25   - public function beforeAction($action)
26   - {
27   - if ($action->id == 'buy-items' || $action->id == 'delete') {
28   - Yii::$app->controller->enableCsrfValidation = false;
29   - }
30   -
31   - return true;
32   - }
33   -
34   - public function actionFirst(){
35   -
36   - $array = Yii::$app->session->get('order');
37   -
38   - if(isset($array['order_id']) ) {
39   - $model = Orders::findOne($array['order_id']);
40   - }else {
41   - $model = new Orders();
42   - }
43   -
44   -
45   - if(Yii::$app->request->post() && $model->load(Yii::$app->request->post())){
46   -
47   - if($model->save()){
48   -
49   - $array['order_id'] = $model->order_id;
50   -
51   - Yii::$app->session->set('order', $array );
52   -
53   - return $this->redirect(['orders/second']);
54   - }
55   -
56   - } else {
57   - if (!Yii::$app->user->isGuest) {
58   - $customer = Yii::$app->user->identity;
59   - $model->name = $customer->name;
60   - $model->email = $customer->email;
61   - $model->phone = $customer->phone;
62   - }
63   - }
64   -
65   -
66   - return $this->render('basket-step-01',[
67   - 'model' => $model
68   - ]);
69   - }
70   -
71   - public function actionSecond(){
72   -
73   - $sessionData = \Yii::$app->session->get('order');
74   -
75   - $order_id = $sessionData['order_id'];
76   -
77   - if(!empty($order_id)){
78   - $order_model = Orders::findOne($order_id);
79   - } else{
80   - $order_model = new Orders;
81   - }
82   -
83   - unset($sessionData['order_id']);
84   -
85   - $variant = ProductVariant::find()->where(['product_variant_id'=>array_keys($sessionData)])->indexBy('product_variant_id')->all();
86   -
87   -
88   - if(Yii::$app->request->post()){
89   -
90   - foreach ($sessionData as $k => $item) {
91   - $itemModel = OrderItems::find()->where(['order_id'=>$order_id, 'item_id'=> $variant[$k]->product_variant_id])->one();
92   - if($itemModel instanceof OrderItems){
93   - $itemModel->order_id = $order_id;
94   - $itemModel->item_id = $variant[$k]->product_variant_id;
95   - $itemModel->item_count = $sessionData[$k]['num'];
96   - $itemModel->price = $variant[$k]->price;
97   - $itemModel->save();
98   - } else {
99   - $itemModel = new OrderItems();
100   - $itemModel->order_id = $order_id;
101   - $itemModel->item_id = $variant[$k]->product_variant_id;
102   - $itemModel->item_count = $sessionData[$k]['num'];
103   - $itemModel->price = $variant[$k]->price;
104   - $itemModel->save();
105   - }
106   -
107   - }
108   - Yii::$app->session->set('order', [] );
109   - return $this->redirect(['orders/third']);
110   -
111   - } else {
112   -
113   - $price = 0;
114   -
115   - $count = count($sessionData);
116   -
117   - foreach ($sessionData as $k => $item) {
118   - $sessionData[$k]['item'] = $variant[$k];
119   - $price += $variant[$k]->price * $sessionData[$k]['num'];
120   - }
121   -
122   - }
123   -
124   - return $this->render('basket-step-02',[
125   - 'items'=>$sessionData,
126   - 'count' => $count,
127   - 'price' => $price,
128   - 'order_id' => $order_id,
129   - 'order_model' => $order_model,
130   - ]);
131   -
132   - }
133   -
134   - public function actionThird(){
135   - return $this->render('basket-step-03');
136   - }
137   -
138   -
139   -// /**
140   -// * Lists all Order models.
141   -// * @return mixed
142   -// */
143   -// public function actionIndex()
144   -// {
145   -//
146   -// if (Yii::$app->request->post()) {
147   -// $item = $items_id = array();
148   -//
149   -// $i = 0;
150   -// $order = Yii::$app->request->post();
151   -//
152   -// $orderData['Order'] = $order['OrderForm'];
153   -//
154   -// foreach($order['OrderForm']['one_item'] as $k => $v ){
155   -// $item[$k]['num'] = $v['num'];
156   -// $items_id[] = $k;
157   -// $i++;
158   -// }
159   -//
160   -// $items = Items::find()->where(['id'=>$items_id])->all();
161   -//
162   -//
163   -// $orderModel = new Order();
164   -// $orderModel->load($orderData);
165   -// $orderModel->save();
166   -//
167   -//
168   -// foreach($items as $one_item){
169   -// $ItemOrderModel = new ItemOrder();
170   -// $ItemOrderModel->order_id = $orderModel->id;
171   -// $ItemOrderModel->num = $item[$one_item->id]['num'];
172   -// $ItemOrderModel->item_id = $one_item->id;
173   -// $ItemOrderModel->price = $one_item->price * $item[$one_item->id]['num'];
174   -// $ItemOrderModel->item_name = $one_item->name;
175   -// $ItemOrderModel->save();
176   -// }
177   -// Yii::$app->session->set('order', [] );
178   -// return $this->redirect(['order/complete']);
179   -// }
180   -// $total_price = 0;
181   -//
182   -// $items_id = [];
183   -//
184   -// $orders = Yii::$app->session->get('order');
185   -//
186   -// if(!empty($orders)){
187   -// foreach($orders as $k => $v) {
188   -// $items_id[] = $k;
189   -// }
190   -// }
191   -//
192   -//
193   -// $items = Items::find()->where(['id'=>$items_id])->all();
194   -//
195   -// foreach($items as $item) {
196   -// $total_price += $orders[$item['id']]['num'] * $item['price'];
197   -// }
198   -//
199   -//
200   -// $dataProvider = new ArrayDataProvider([
201   -// 'allModels' => $items
202   -// ]);
203   -//
204   -// return $this->render('index', [
205   -// 'dataProvider' => $dataProvider,
206   -// 'total_price'=> $total_price,
207   -// 'model' => new OrderForm()
208   -// ]);
209   -// }
210   -
211   -
212   - public function actionComplete()
213   - {
214   - return $this->render('complete', [
215   - ]);
216   - }
217   -
218   - public function actionBuyItems(){
219   - $data = Yii::$app->request->post();
220   - $sessionData = Yii::$app->session->get('order');
221   - if(isset($sessionData) && !array_search($data['id'],Yii::$app->session->get('order')) ){
222   - $array = Yii::$app->session->get('order');
223   - $array[$data['id']] = $data;
224   - Yii::$app->session->set('order', $array );
225   - } else {
226   - $array[$data['id']] = $data;
227   - Yii::$app->session->set('order', $array );
228   - }
229   - echo BasketModal::widget([]);
230   -
231   - }
232   - /**
233   - * Displays a single Order model.
234   - * @param integer $id
235   - * @return mixed
236   - */
237   - public function actionView($id)
238   - {
239   - return $this->render('view', [
240   - 'model' => $this->findModel($id),
241   - ]);
242   - }
243   -
244   - /**
245   - * Creates a new Order model.
246   - * If creation is successful, the browser will be redirected to the 'view' page.
247   - * @return mixed
248   - */
249   - public function actionCreate()
250   - {
251   - $model = new Order();
252   -
253   - if ($model->load(Yii::$app->request->post()) && $model->save()) {
254   - return $this->redirect(['view', 'id' => $model->id]);
255   - } else {
256   - return $this->render('create', [
257   - 'model' => $model,
258   - ]);
259   - }
260   - }
261   -
262   - /**
263   - * Updates an existing Order model.
264   - * If update is successful, the browser will be redirected to the 'view' page.
265   - * @param integer $id
266   - * @return mixed
267   - */
268   - public function actionUpdate($id)
269   - {
270   - $model = $this->findModel($id);
271   -
272   - if ($model->load(Yii::$app->request->post()) && $model->save()) {
273   - return $this->redirect(['view', 'id' => $model->id]);
274   - } else {
275   - return $this->render('update', [
276   - 'model' => $model,
277   - ]);
278   - }
279   - }
280   -
281   - /**
282   - * Deletes an existing Order model.
283   - * If deletion is successful, the browser will be redirected to the 'index' page.
284   - * @param integer $id
285   - * @return mixed
286   - */
287   - public function actionDelete()
288   - {
289   - $data = Yii::$app->request->post();
290   - $sessionData = Yii::$app->session->get('order');
291   - unset($sessionData[$data['id']]);
292   - Yii::$app->session->set('order', $sessionData);
293   - return count(Yii::$app->session->get('order'));
294   - }
295   -
296   - /**
297   - * Finds the Order model based on its primary key value.
298   - * If the model is not found, a 404 HTTP exception will be thrown.
299   - * @param integer $id
300   - * @return Order the loaded model
301   - * @throws NotFoundHttpException if the model cannot be found
302   - */
303   - protected function findModel($id)
304   - {
305   - if (($model = Order::findOne($id)) !== null) {
306   - return $model;
307   - } else {
308   - throw new NotFoundHttpException('The requested page does not exist.');
309   - }
310   - }
311   -}
  1 +<?php
  2 +
  3 +namespace frontend\controllers;
  4 +
  5 +use common\models\Customer;
  6 +use common\models\OrderItems;
  7 +use common\models\Orders;
  8 +use common\modules\product\models\ProductVariant;
  9 +use common\widgets\BasketModal;
  10 +use Yii;
  11 +
  12 +use yii\web\Controller;
  13 +use yii\web\NotFoundHttpException;
  14 +use yii\data\ArrayDataProvider;
  15 +/**
  16 + * OrderController implements the CRUD actions for Order model.
  17 + */
  18 +class OrdersController extends Controller
  19 +{
  20 +
  21 +
  22 + /**
  23 + * @inheritdoc
  24 + */
  25 + public function beforeAction($action)
  26 + {
  27 + if ($action->id == 'buy-items' || $action->id == 'delete') {
  28 + Yii::$app->controller->enableCsrfValidation = false;
  29 + }
  30 +
  31 + return true;
  32 + }
  33 +
  34 + public function actionFirst(){
  35 +
  36 + $array = Yii::$app->session->get('order');
  37 +
  38 + if(isset($array['order_id']) ) {
  39 + $model = Orders::findOne($array['order_id']);
  40 + }else {
  41 + $model = new Orders();
  42 + }
  43 +
  44 +
  45 + if(Yii::$app->request->post() && $model->load(Yii::$app->request->post())){
  46 +
  47 + if($model->save()){
  48 +
  49 + $array['order_id'] = $model->order_id;
  50 +
  51 + Yii::$app->session->set('order', $array );
  52 +
  53 + return $this->redirect(['orders/second']);
  54 + }
  55 +
  56 + } else {
  57 + if (!Yii::$app->user->isGuest) {
  58 + $customer = Yii::$app->user->identity;
  59 + $model->name = $customer->name;
  60 + $model->email = $customer->email;
  61 + $model->phone = $customer->phone;
  62 + }
  63 + }
  64 +
  65 +
  66 + return $this->render('basket-step-01',[
  67 + 'model' => $model
  68 + ]);
  69 + }
  70 +
  71 + public function actionSecond(){
  72 +
  73 + $sessionData = \Yii::$app->session->get('order');
  74 +
  75 + $order_id = $sessionData['order_id'];
  76 +
  77 + if(!empty($order_id)){
  78 + $order_model = Orders::findOne($order_id);
  79 + } else{
  80 + $order_model = new Orders;
  81 + }
  82 +
  83 + unset($sessionData['order_id']);
  84 +
  85 + $variant = ProductVariant::find()->where(['product_variant_id'=>array_keys($sessionData)])->indexBy('product_variant_id')->all();
  86 +
  87 +
  88 + if(Yii::$app->request->post()){
  89 +
  90 + foreach ($sessionData as $k => $item) {
  91 + $itemModel = OrderItems::find()->where(['order_id'=>$order_id, 'item_id'=> $variant[$k]->product_variant_id])->one();
  92 + if($itemModel instanceof OrderItems){
  93 + $itemModel->order_id = $order_id;
  94 + $itemModel->item_id = $variant[$k]->product_variant_id;
  95 + $itemModel->item_count = $sessionData[$k]['num'];
  96 + $itemModel->price = $variant[$k]->price;
  97 + $itemModel->save();
  98 + } else {
  99 + $itemModel = new OrderItems();
  100 + $itemModel->order_id = $order_id;
  101 + $itemModel->item_id = $variant[$k]->product_variant_id;
  102 + $itemModel->item_count = $sessionData[$k]['num'];
  103 + $itemModel->price = $variant[$k]->price;
  104 + $itemModel->save();
  105 + }
  106 +
  107 + }
  108 + Yii::$app->session->set('order', [] );
  109 + return $this->redirect(['orders/third']);
  110 +
  111 + } else {
  112 +
  113 + $price = 0;
  114 +
  115 + $count = count($sessionData);
  116 +
  117 + foreach ($sessionData as $k => $item) {
  118 + $sessionData[$k]['item'] = $variant[$k];
  119 + $price += $variant[$k]->price * $sessionData[$k]['num'];
  120 + }
  121 +
  122 + }
  123 +
  124 + return $this->render('basket-step-02',[
  125 + 'items'=>$sessionData,
  126 + 'count' => $count,
  127 + 'price' => $price,
  128 + 'order_id' => $order_id,
  129 + 'order_model' => $order_model,
  130 + ]);
  131 +
  132 + }
  133 +
  134 + public function actionThird(){
  135 + return $this->render('basket-step-03');
  136 + }
  137 +
  138 +
  139 +// /**
  140 +// * Lists all Order models.
  141 +// * @return mixed
  142 +// */
  143 +// public function actionIndex()
  144 +// {
  145 +//
  146 +// if (Yii::$app->request->post()) {
  147 +// $item = $items_id = array();
  148 +//
  149 +// $i = 0;
  150 +// $order = Yii::$app->request->post();
  151 +//
  152 +// $orderData['Order'] = $order['OrderForm'];
  153 +//
  154 +// foreach($order['OrderForm']['one_item'] as $k => $v ){
  155 +// $item[$k]['num'] = $v['num'];
  156 +// $items_id[] = $k;
  157 +// $i++;
  158 +// }
  159 +//
  160 +// $items = Items::find()->where(['id'=>$items_id])->all();
  161 +//
  162 +//
  163 +// $orderModel = new Order();
  164 +// $orderModel->load($orderData);
  165 +// $orderModel->save();
  166 +//
  167 +//
  168 +// foreach($items as $one_item){
  169 +// $ItemOrderModel = new ItemOrder();
  170 +// $ItemOrderModel->order_id = $orderModel->id;
  171 +// $ItemOrderModel->num = $item[$one_item->id]['num'];
  172 +// $ItemOrderModel->item_id = $one_item->id;
  173 +// $ItemOrderModel->price = $one_item->price * $item[$one_item->id]['num'];
  174 +// $ItemOrderModel->item_name = $one_item->name;
  175 +// $ItemOrderModel->save();
  176 +// }
  177 +// Yii::$app->session->set('order', [] );
  178 +// return $this->redirect(['order/complete']);
  179 +// }
  180 +// $total_price = 0;
  181 +//
  182 +// $items_id = [];
  183 +//
  184 +// $orders = Yii::$app->session->get('order');
  185 +//
  186 +// if(!empty($orders)){
  187 +// foreach($orders as $k => $v) {
  188 +// $items_id[] = $k;
  189 +// }
  190 +// }
  191 +//
  192 +//
  193 +// $items = Items::find()->where(['id'=>$items_id])->all();
  194 +//
  195 +// foreach($items as $item) {
  196 +// $total_price += $orders[$item['id']]['num'] * $item['price'];
  197 +// }
  198 +//
  199 +//
  200 +// $dataProvider = new ArrayDataProvider([
  201 +// 'allModels' => $items
  202 +// ]);
  203 +//
  204 +// return $this->render('index', [
  205 +// 'dataProvider' => $dataProvider,
  206 +// 'total_price'=> $total_price,
  207 +// 'model' => new OrderForm()
  208 +// ]);
  209 +// }
  210 +
  211 +
  212 + public function actionComplete()
  213 + {
  214 + return $this->render('complete', [
  215 + ]);
  216 + }
  217 +
  218 + public function actionBuyItems(){
  219 + $data = Yii::$app->request->post();
  220 + $sessionData = Yii::$app->session->get('order');
  221 + if(isset($sessionData) && !array_search($data['id'],Yii::$app->session->get('order')) ){
  222 + $array = Yii::$app->session->get('order');
  223 + $array[$data['id']] = $data;
  224 + Yii::$app->session->set('order', $array );
  225 + } else {
  226 + $array[$data['id']] = $data;
  227 + Yii::$app->session->set('order', $array );
  228 + }
  229 + echo BasketModal::widget([]);
  230 +
  231 + }
  232 + /**
  233 + * Displays a single Order model.
  234 + * @param integer $id
  235 + * @return mixed
  236 + */
  237 + public function actionView($id)
  238 + {
  239 + return $this->render('view', [
  240 + 'model' => $this->findModel($id),
  241 + ]);
  242 + }
  243 +
  244 + /**
  245 + * Creates a new Order model.
  246 + * If creation is successful, the browser will be redirected to the 'view' page.
  247 + * @return mixed
  248 + */
  249 + public function actionCreate()
  250 + {
  251 + $model = new Orders();
  252 +
  253 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  254 + return $this->redirect(['view', 'id' => $model->id]);
  255 + } else {
  256 + return $this->render('create', [
  257 + 'model' => $model,
  258 + ]);
  259 + }
  260 + }
  261 +
  262 + /**
  263 + * Updates an existing Order model.
  264 + * If update is successful, the browser will be redirected to the 'view' page.
  265 + * @param integer $id
  266 + * @return mixed
  267 + */
  268 + public function actionUpdate($id)
  269 + {
  270 + $model = $this->findModel($id);
  271 +
  272 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  273 + return $this->redirect(['view', 'id' => $model->id]);
  274 + } else {
  275 + return $this->render('update', [
  276 + 'model' => $model,
  277 + ]);
  278 + }
  279 + }
  280 +
  281 + /**
  282 + * Deletes an existing Order model.
  283 + * If deletion is successful, the browser will be redirected to the 'index' page.
  284 + * @param integer $id
  285 + * @return mixed
  286 + */
  287 + public function actionDelete()
  288 + {
  289 + $data = Yii::$app->request->post();
  290 + $sessionData = Yii::$app->session->get('order');
  291 + unset($sessionData[$data['id']]);
  292 + Yii::$app->session->set('order', $sessionData);
  293 + return count(Yii::$app->session->get('order'));
  294 + }
  295 +
  296 + /**
  297 + * Finds the Order model based on its primary key value.
  298 + * If the model is not found, a 404 HTTP exception will be thrown.
  299 + * @param integer $id
  300 + * @return Orders the loaded model
  301 + * @throws NotFoundHttpException if the model cannot be found
  302 + */
  303 + protected function findModel($id)
  304 + {
  305 + if (($model = Orders::findOne($id)) !== null) {
  306 + return $model;
  307 + } else {
  308 + throw new NotFoundHttpException('The requested page does not exist.');
  309 + }
  310 + }
  311 +}
... ...
frontend/controllers/PageController.php 100644 → 100755
frontend/controllers/PostController.php 100644 → 100755
frontend/controllers/ServiceController.php 100644 → 100755
frontend/controllers/SubscribeController.php
... ... @@ -7,6 +7,8 @@ use yii\web\Controller;
7 7 use common\models\Subscribe;
8 8 use yii\web\HttpException;
9 9 use yii\data\Pagination;
  10 +use yii\web\Response;
  11 +use yii\widgets\ActiveForm;
10 12  
11 13 class SubscribeController extends Controller
12 14 {
... ... @@ -14,12 +16,18 @@ class SubscribeController extends Controller
14 16 public function actionIndex()
15 17 {
16 18 $model = new Subscribe;
  19 + if (Yii::$app->request->isAjax) {
  20 + Yii::$app->response->format = Response::FORMAT_JSON;
  21 + $model->load(Yii::$app->request->post());
  22 + return ActiveForm::validate($model);
  23 + } else {
  24 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  25 +
  26 + Yii::$app->getSession()->setFlash('success', 'Вы успешно подписались на рассылку!');
  27 + return $this->refresh();
  28 + }
  29 + }
17 30  
18   - if ($model->load(Yii::$app->request->post()) && $model->save()) {
19   -
20   - Yii::$app->getSession()->setFlash('success', 'Вы успешно подписались на рассылку!');
21   - return $this->refresh();
22   - }
23 31 return $this->render('index',['model'=>$model]);
24 32 }
25 33  
... ...
frontend/views/basket/ajax_items.php
... ... @@ -3,16 +3,16 @@ use yii\widgets\ActiveForm;
3 3 use yii\helpers\Html;
4 4 ?>
5 5 <?php $form = ActiveForm::begin(['enableClientScript' => false,'id'=>'basket_form2']); ?>
6   -<?foreach($basket_mods as $i=>$item):?>
  6 +<?php foreach($basket_mods as $i=>$item):?>
7 7 <div class="basket_item">
8 8 <?php echo $form->field($item,'['.$i.']id')->hiddenInput()->label(false); ?>
9 9 <div style="display: table-cell;vertical-align: middle;"><a href="#" data-id="<?=$item->id?>" class="delete_button" style="margin-right:20px;"></a></div>
10   - <div style="width:100px;height:100px;display: table-cell;vertical-align: middle; border:1px solid #d2d2d2;text-align:center;margin-left:10px;margin-right:10px;"><img src="<?=Yii::$app->request->baseUrl.'/upload/products/ico/'.$item->image?>" style="margin:0;" width="100"></div>
  10 + <div style="width:100px;height:100px;display: table-cell;vertical-align: middle; border:1px solid #d2d2d2;text-align:center;margin-left:10px;margin-right:10px;"><img src="<?=Yii::$app->request->baseUrl.'/upload/products/ico/'.$item->image->image?>" style="margin:0;" width="100"></div>
11 11 <div style="display: table-cell;vertical-align: middle; font-size:15px;width:210px; font-weight:normal;padding-left:15px;">
12 12 <div><?=$item->product_name?></div>
13 13 <div style="text-transform:none; margin-top:20px; font-weight:bold;">
14   - <?if($item->old_cost>0):?><div style="text-decoration:line-through;font-size:13px;"><?=$item->old_cost?> грн.</div><?endif;?>
15   - <div style="font-size:15px;color:#f75d50;"><?=$item->cost?> грн.</div>
  14 + <?php if($item->price_old>0):?><div style="text-decoration:line-through;font-size:13px;"><?=$item->price_old?> грн.</div><?php endif;?>
  15 + <div style="font-size:15px;color:#f75d50;"><?=$item->price?> грн.</div>
16 16 </div>
17 17 </div>
18 18 <div style="display: table-cell;vertical-align: middle;">
... ... @@ -21,7 +21,7 @@ use yii\helpers\Html;
21 21 <div style="display: table-cell;vertical-align: middle; font-size:16px;color:#f75d50; font-weight:bold; padding-left:54px;"><?=$item->sum_cost?> грн.</div>
22 22 <div style="clear:both;"></div>
23 23 </div>
24   -<?endforeach;?>
  24 +<?php endforeach;?>
25 25  
26 26 <div class="basket_sum">
27 27 <div class="sum_text" style="float:left;">Всего: <span><?=$modelMod->getSumCost()?> грн.</span></div>
... ...
frontend/views/basket/index.php
... ... @@ -5,7 +5,7 @@ use yii\web\View;
5 5 use yii\helpers\ArrayHelper;
6 6 use yii\widgets\Breadcrumbs;
7 7 use yii\bootstrap\ActiveForm;
8   -use app\models\Delivery;
  8 +use common\models\Delivery;
9 9  
10 10 $this->title = 'Корзина';
11 11 $this->registerMetaTag(['name' => 'description', 'content' => 'Корзина']);
... ... @@ -57,14 +57,14 @@ $(&#39;#order-delivery input[type=\&quot;radio\&quot;]&#39;).click(function(){
57 57 ?>
58 58 <div class="both"></div>
59 59  
60   -<?foreach(Delivery::find()->where(['parent_id'=>0])->all() as $item):?>
  60 +<?php foreach(Delivery::find()->where(['parent_id'=>0])->all() as $item):?>
61 61 <div class='delivery-data' id='delivery-data-<?=$item->id?>'>
62 62 <?=$item->text?>
63 63 <?= $form->field($modelOrder, 'delivery')
64 64 ->radioList(ArrayHelper::map(Delivery::find()->where(['parent_id'=>$item->id])->asArray()->all(), 'id', 'title'),['id' => 'order-delivery-childs'])->label(false)
65 65 ?>
66 66 </div>
67   -<?endforeach;?>
  67 +<?php endforeach;?>
68 68  
69 69 <?php echo $form->field($modelOrder, 'payment')->radioList(['Оплатить наличными'=>'Оплатить наличными','Оплатить на карту Приват Банка'=>'Оплатить на карту Приват Банка','Оплатить по безналичному расчету'=>'Оплатить по безналичному расчету','Оплатить Правекс-телеграф'=>'Оплатить Правекс-телеграф','Наложенным платежом'=>'Наложенным платежом']); ?>
70 70 <div class="both"></div>
... ... @@ -77,32 +77,32 @@ $(&#39;#order-delivery input[type=\&quot;radio\&quot;]&#39;).click(function(){
77 77 <div class="content">
78 78  
79 79  
80   -<?foreach($basket_mods as $i=>$item):?>
  80 +<?php foreach($basket_mods as $i=>$item):?>
81 81 <div class="basket_item">
82   - <a href="<?=Url::to(['products/show','translit_rubric'=>$item->translit_rubric,'translit'=>$item->translit,'id'=>$item->product_id])?>"><img src="<?=Yii::$app->request->baseUrl.'/upload/products/ico/'.$item->image?>" border="0" width="90" height="120" align="left" /></a>
  82 + <a href="<?=Url::to(['products/show','translit_rubric'=>$item->translit_rubric,'translit'=>$item->translit,'id'=>$item->product_id])?>"><img src="<?=Yii::$app->request->baseUrl.'/upload/products/ico/'.$item->image->image?>" border="0" width="90" height="120" align="left" /></a>
83 83 <div class="info">
84 84 <a href="<?=Url::to(['products/show','translit_rubric'=>$item->translit_rubric,'translit'=>$item->translit,'id'=>$item->product_id])?>" class="link2"><?=$item->product_name?></a>
85   - <p>Код: <?=$item->art?>, цвет: <?=$item->color?></p>
  85 + <p>Код: <?=$item->sku?>, цвет: <?=$item->name?></p>
86 86 <?php echo $form->field($item,'['.$i.']id')->hiddenInput()->label(false); ?>
87 87 <?php echo $form->field($item,'['.$i.']product_name')->hiddenInput()->label(false); ?>
88   - <?php echo $form->field($item,'['.$i.']art')->hiddenInput()->label(false); ?>
  88 + <?php echo $form->field($item,'['.$i.']sku')->hiddenInput()->label(false); ?>
89 89 <?php echo $form->field($item,'['.$i.']name')->hiddenInput()->label(false); ?>
90   - <?php echo $form->field($item,'['.$i.']cost')->hiddenInput()->label(false); ?>
  90 + <?php echo $form->field($item,'['.$i.']price')->hiddenInput()->label(false); ?>
91 91 <?php echo $form->field($item,'['.$i.']sum_cost')->hiddenInput()->label(false); ?>
92 92 <div class="count">
93   - <div class="fr txtf"><span style="color:silver">цена за один <?=$item->cost?> грн,</span> цена <?=$item->sum_cost?> грн</div>
  93 + <div class="fr txtf"><span style="color:silver">цена за один <?=$item->price?> грн,</span> цена <?=$item->sum_cost?> грн</div>
94 94 <label for="count" class="txtf">Количество</label> <?php echo $form->field($item,'['.$i.']count')->textInput(['type'=>'number'])->label(false); ?><div class="both"></div>
95 95 </div>
96 96 <a href="<?=Url::to(['basket/index','deleteID'=>$item->id]);?>" class="del">Удалить</a>
97 97 </div><div class="both"></div>
98 98 </div>
99   -<?endforeach;?>
  99 +<?php endforeach;?>
100 100  
101 101 <?php echo Html::submitButton(' Пересчитать ',array('name'=>"update",'class'=>'submit4 fl')); ?>
102 102  
103 103 <div class="total">
104   - <?= $form->field($modelOrder, 'total')->hiddenInput(['value'=>$modelMod->getSumCost()])->label(false); ?>
105   - Общая сумма: <?=$modelMod->getSumCost();?> грн.
  104 + <?= $form->field($modelOrder, 'total')->hiddenInput(['value'=>$modelOrder->getSumCost()])->label(false); ?>
  105 + Общая сумма: <?=$modelOrder->getSumCost();?> грн.
106 106 </div>
107 107 <div class="both"></div>
108 108  
... ...
frontend/views/cabinet/bookmarks.php 100644 → 100755
frontend/views/cabinet/index.php 100644 → 100755
frontend/views/cabinet/my-orders.php 100644 → 100755
frontend/views/cabinet/update.php 100644 → 100755
frontend/views/catalog/categories.php 100644 → 100755
frontend/views/catalog/product.php 100644 → 100755
frontend/views/catalog/product_item.php 100644 → 100755
frontend/views/catalog/product_smart.php 100644 → 100755
frontend/views/catalog/products.old.php 100644 → 100755
frontend/views/catalog/products.php 100644 → 100755
frontend/views/catalog/search.php 100644 → 100755
frontend/views/event/_objects.php 100644 → 100755
frontend/views/event/index.php 100644 → 100755
frontend/views/event/view.php 100644 → 100755
frontend/views/layouts/main.php
1 1 <?php
  2 +
2 3 use yii\helpers\Html;
3 4 use yii\helpers\Url;
4 5 use frontend\assets\AppAsset;
... ... @@ -103,12 +104,12 @@
103 104 </form>
104 105 </div>
105 106 <div class="fr">
106   - <? if (Yii::$app->user->isGuest): ?>
  107 + <?php if (Yii::$app->user->isGuest): ?>
107 108 <a href="<?= Url::to (['login/index']) ?>" id='login'><span>Личный кабинет</span></a>
108   - <? else: ?>
  109 + <?php else: ?>
109 110 <a href="<?= Url::to (['iam/index']) ?>"><?= Text::getShort (Yii::$app->user->identity->username, 20) ?></a>
110 111 <a href="<?= Url::to (['login/logout']) ?>" class='logout'>Выход</a>
111   - <? endif; ?>
  112 + <?php endif; ?>
112 113 </div>
113 114 <div class="both"></div>
114 115 </div>
... ... @@ -155,10 +156,10 @@
155 156  
156 157 <div class="menu">
157 158 <ul>
158   - <? foreach (Category::find ()->all () as $category): ?>
  159 + <?php foreach (Category::find ()->all () as $category): ?>
159 160 <li><a href="<?= \yii\helpers\Url::to(['catalog/category', 'category' => $category])?>"><?= $category->name ?></a>
160 161 </li>
161   - <? endforeach; ?>
  162 + <?php endforeach; ?>
162 163 </ul>
163 164  
164 165 <div class="fr">
... ... @@ -169,19 +170,6 @@
169 170 </div>
170 171 <div class="both"></div>
171 172 </div>
172   - <? /**
173   - * <div class="menu_childs">
174   - * <ul>
175   - * <?
176   - * $items = Catalog::find();
177   - * if($row->parent_id>0)$items->where(['parent_id'=>$row->parent_id]);
178   - * else $items->where(['parent_id'=>$row->id]);
179   - * foreach($items->orderBy('sort')->all() as $key=>$item):?>
180   - * <li><a href="<?=Url::to(['products/index','translit'=>$item->translit])?>"><?=$item->name?></a></li>
181   - * <?endforeach;?>
182   - * </ul><div class="both"></div>
183   - * </div>
184   - **/ ?>
185 173  
186 174 <?= $content ?>
187 175  
... ... @@ -336,8 +324,8 @@
336 324 $subscribe = new Subscribe;
337 325 $form = ActiveForm::begin (['action' => '/subscribe']);
338 326 ?>
339   - <?php echo $form->field ($subscribe, 'email')->textInput (['placeholder' => 'E-mail'])->label (false); ?>
340   - <?= $form->field ($subscribe, 'sale')->dropDownList (['10' => '10%', '20' => '20%'], ['prompt' => 'Скидка'])->label (false); ?>
  327 + <?php echo $form->field ($subscribe, 'email')->textInput (['placeholder' => 'E-mail', 'enableAjaxValidation' => true])->label (false); ?>
  328 + <?= $form->field ($subscribe, 'sale')->dropDownList (['10' => '10%', '20' => '20%'], ['prompt' => 'Скидка', 'enableAjaxValidation' => true])->label (false); ?>
341 329 <div class="saletxt">укажите желаемый размер скидки</div>
342 330 <?php echo Html::submitButton (' Подписаться ', ['class' => 'submit4m']); ?>
343 331 <?php ActiveForm::end (); ?>
... ... @@ -364,7 +352,7 @@
364 352  
365 353 <div class="fotter">
366 354 <div class="wrap">
367   - <div class="fl">© 2015 Rukzachok. Все права защищены.</div>
  355 + <div class="fl">© <?= date('Y')?> Rukzachok. Все права защищены.</div>
368 356 <div class="fr"><a href="http://artweb.ua" target="_blank">Создание сайтов</a> <img
369 357 src="<?= Yii::$app->request->baseUrl ?>/img/artweb.png" width="58" height="17" alt="ArtWeb Studio"/>
370 358 </div>
... ...
frontend/views/modal/consultation_modal.php 100644 → 100755
frontend/views/modal/forgot_password_form_model_window.php 100644 → 100755
frontend/views/modal/login_window_model_window.php 100644 → 100755
frontend/views/modal/registration_window_model_window.php 100644 → 100755
frontend/views/news/index.php
1   -<?
2   -use yii\helpers\Url;
  1 +<?phpuse yii\helpers\Url;
3 2 use yii\widgets\Breadcrumbs;
4 3 use app\models\News;
5 4 use yii\widgets\LinkPager;
6 5 use app\components\Text;
7 6 ?>
8   -<?
9   -$this->title = 'Новости';
  7 +<?php$this->title = 'Новости';
10 8 $this->registerMetaTag(['name' => 'description', 'content' => 'Новости']);
11 9 $this->registerMetaTag(['name' => 'keywords', 'content' => 'Новости']);
12 10 ?>
... ...
frontend/views/news/show.php
1   -<?
2   -use yii\helpers\Url;
  1 +<?phpuse yii\helpers\Url;
3 2 use yii\widgets\Breadcrumbs;
4 3 use app\models\News;
5 4 ?>
6   -<?
7   -$this->title = $news->meta_title;
  5 +<?php$this->title = $news->meta_title;
8 6 $this->registerMetaTag(['name' => 'description', 'content' => $news->meta_description]);
9 7 $this->registerMetaTag(['name' => 'keywords', 'content' => $news->meta_keywords]);
10 8 ?>
... ...
frontend/views/orders/basket-step-01.php 100644 → 100755