Commit 84b2aeadbdc775b9d09b41e8544df24e7106058a

Authored by Administrator
1 parent 82b29c31

add active menu

backend/controllers/OrdersController.php
@@ -16,7 +16,6 @@ use common\modules\product\models\ProductVariant; @@ -16,7 +16,6 @@ use common\modules\product\models\ProductVariant;
16 16
17 class OrdersController extends Controller 17 class OrdersController extends Controller
18 { 18 {
19 -// public $layout = 'update';  
20 /** 19 /**
21 * @inheritdoc 20 * @inheritdoc
22 */ 21 */
@@ -43,7 +42,6 @@ class OrdersController extends Controller @@ -43,7 +42,6 @@ class OrdersController extends Controller
43 if(!empty($searchModel->id))$query->andFilterWhere(['like', 'id', $searchModel->id]); 42 if(!empty($searchModel->id))$query->andFilterWhere(['like', 'id', $searchModel->id]);
44 if(!empty($searchModel->phone))$query->andFilterWhere(['like', 'phone', $searchModel->phone]); 43 if(!empty($searchModel->phone))$query->andFilterWhere(['like', 'phone', $searchModel->phone]);
45 if(!empty($searchModel->name))$query->andFilterWhere(['like', 'name', $searchModel->name]); 44 if(!empty($searchModel->name))$query->andFilterWhere(['like', 'name', $searchModel->name]);
46 - if(!empty($searchModel->surname))$query->andFilterWhere(['like', 'surname', $searchModel->surname]);  
47 if(!empty($searchModel->total))$query->andFilterWhere(['like', 'total', $searchModel->total]); 45 if(!empty($searchModel->total))$query->andFilterWhere(['like', 'total', $searchModel->total]);
48 if(!empty($searchModel->reserve))$query->andFilterWhere(['like', 'reserve', $searchModel->reserve]); 46 if(!empty($searchModel->reserve))$query->andFilterWhere(['like', 'reserve', $searchModel->reserve]);
49 if(!empty($searchModel->status))$query->andFilterWhere(['like', 'status', $searchModel->status]); 47 if(!empty($searchModel->status))$query->andFilterWhere(['like', 'status', $searchModel->status]);
common/components/Mailer.php
@@ -6,7 +6,7 @@ use yii\base\Widget; @@ -6,7 +6,7 @@ use yii\base\Widget;
6 6
7 class Mailer extends Widget{ 7 class Mailer extends Widget{
8 public $message; 8 public $message;
9 - public $email = 'dockdep@gmail.com'; 9 + public $email;
10 public $text; 10 public $text;
11 public $subject; 11 public $subject;
12 12
@@ -30,6 +30,7 @@ class Mailer extends Widget{ @@ -30,6 +30,7 @@ class Mailer extends Widget{
30 $mail->MsgHTML($this->text); 30 $mail->MsgHTML($this->text);
31 $address = "dockdep@gmail.com"; 31 $address = "dockdep@gmail.com";
32 $mail->AddAddress($address); 32 $mail->AddAddress($address);
  33 + $mail->AddAddress($this->email);
33 if(!$mail->send()) { 34 if(!$mail->send()) {
34 \Yii::$app->getSession()->setFlash('error', 'Mailer Error: ' . $mail->ErrorInfo); 35 \Yii::$app->getSession()->setFlash('error', 'Mailer Error: ' . $mail->ErrorInfo);
35 return 'Mailer Error: ' . $mail->ErrorInfo; 36 return 'Mailer Error: ' . $mail->ErrorInfo;
common/models/Customer.php
1 <?php 1 <?php
2 2
3 namespace common\models; 3 namespace common\models;
  4 +use common\components\Mailer;
4 use Yii; 5 use Yii;
5 6
6 class Customer extends \yii\db\ActiveRecord implements \yii\web\IdentityInterface 7 class Customer extends \yii\db\ActiveRecord implements \yii\web\IdentityInterface
@@ -75,43 +76,32 @@ class Customer extends \yii\db\ActiveRecord implements \yii\web\IdentityInterfac @@ -75,43 +76,32 @@ class Customer extends \yii\db\ActiveRecord implements \yii\web\IdentityInterfac
75 } 76 }
76 77
77 public function sendMsg(){ 78 public function sendMsg(){
78 - $body = 'Вас приветствует сайт Rukzachok';  
79 - $body .= "\n\r";  
80 - $body .= 'Ваш логин: '.$this->username;  
81 - $body .= "\n\r";  
82 - $body .= 'Ваш пароль: '.$this->password;  
83 -  
84 -  
85 - Yii::$app->mailer->compose()  
86 - ->setTo($this->username)  
87 - ->setFrom(['send@artweb.ua' => 'send'])  
88 - ->setSubject('Rukzachok Ваш пароль')  
89 - ->setTextBody($body)  
90 - ->send(); 79 + $body = 'Вас приветствует сайт Rukzachok';
  80 + $body .= "\n\r";
  81 + $body .= 'Ваш логин: '.$this->username;
  82 + $body .= "\n\r";
  83 + $body .= 'Ваш пароль: '.$this->password;
  84 +
  85 + Mailer::widget(['text'=> $body, 'subject'=> 'Спасибо за регистрацию', 'email' => $this->username ]);
91 86
92 } 87 }
93 88
94 - public function afterSave($insert, $changedAttributes)  
95 - {  
96 - parent::afterSave($insert, $changedAttributes);  
97 -/*  
98 -$auth = new DbManager;  
99 -$auth->init();  
100 -$role = $auth->createRole('company');  
101 -$auth->add($role);  
102 -$role = $auth->createRole('customer');  
103 -$auth->add($role);  
104 -*/  
105 - // установка роли пользователя  
106 - $auth = Yii::$app->authManager;  
107 - $role = $auth->getRole($this->role);  
108 - if (!$insert) {  
109 - $auth->revokeAll($this->id);  
110 - }  
111 - $auth->assign($role, $this->id);  
112 -  
113 - $this->sendMsg();  
114 - } 89 + public function afterSave($insert, $changedAttributes)
  90 + {
  91 + parent::afterSave($insert, $changedAttributes);
  92 +
  93 + // установка роли пользователя
  94 + $auth = Yii::$app->authManager;
  95 + $role = $auth->getRole($this->role);
  96 + if (!$insert) {
  97 + $auth->revokeAll($this->id);
  98 + }
  99 + $auth->assign($role, $this->id);
  100 +
  101 + if($this->isNewRecord){
  102 + $this->sendMsg();
  103 + }
  104 + }
115 105
116 public function beforeSave($insert) { 106 public function beforeSave($insert) {
117 107
@@ -135,37 +125,32 @@ $auth-&gt;add($role); @@ -135,37 +125,32 @@ $auth-&gt;add($role);
135 return parent::beforeSave($insert); 125 return parent::beforeSave($insert);
136 } 126 }
137 127
138 - public function beforeDelete() {  
139 - //$this->deleteImage($this->image);  
140 - return parent::beforeDelete();  
141 - }  
142 -  
143 - public function deleteImage($file){  
144 - if(!empty($file)){  
145 - @unlink('upload/profile/'.$file);  
146 - @unlink('upload/profile/ico/'.$file);  
147 - // @unlink('upload/fotos/big/'.$file);  
148 - }  
149 - }  
150 -  
151 -  
152 - public function getOld(){  
153 - if(empty($this->birth_year) || empty($this->birth_mouth) || empty($this->birth_day))return;  
154 - $birthday = $this->birth_year.'-'.$this->birth_mouth.'-'.$this->birth_day;  
155 - if($birthday=="0000-00-00")return;  
156 - $birthday_timestamp = strtotime($birthday);  
157 - $age = date('Y') - date('Y', $birthday_timestamp);  
158 - if (date('md', $birthday_timestamp) > date('md')) {  
159 - $age--;  
160 - }  
161 - return $age;  
162 - 128 + public function beforeDelete() {
  129 + //$this->deleteImage($this->image);
  130 + return parent::beforeDelete();
  131 + }
  132 +
  133 + public function deleteImage($file){
  134 + if(!empty($file)){
  135 + @unlink('upload/profile/'.$file);
  136 + @unlink('upload/profile/ico/'.$file);
  137 + // @unlink('upload/fotos/big/'.$file);
  138 + }
  139 + }
  140 +
  141 +
  142 + public function getOld(){
  143 + if(empty($this->birth_year) || empty($this->birth_mouth) || empty($this->birth_day))return;
  144 + $birthday = $this->birth_year.'-'.$this->birth_mouth.'-'.$this->birth_day;
  145 + if($birthday=="0000-00-00")return;
  146 + $birthday_timestamp = strtotime($birthday);
  147 + $age = date('Y') - date('Y', $birthday_timestamp);
  148 + if (date('md', $birthday_timestamp) > date('md')) {
  149 + $age--;
163 } 150 }
164 -  
165 -// public function getOfferCustomer(){  
166 -// return $this->hasMany(OfferCustomer::className(), ['service_user_id' => 'id'])->where(['done'=>1]);  
167 -// }  
168 -// 151 + return $age;
  152 +
  153 + }
169 154
170 /** 155 /**
171 * @inheritdoc 156 * @inheritdoc
common/models/Orders.php
@@ -18,7 +18,7 @@ class Orders extends \yii\db\ActiveRecord @@ -18,7 +18,7 @@ class Orders extends \yii\db\ActiveRecord
18 return [ 18 return [
19 [['name', 'phone'], 'required','whenClient' => true], 19 [['name', 'phone'], 'required','whenClient' => true],
20 //['email', 'email'], 20 //['email', 'email'],
21 - [['total','body','patronymic','surname','email','phone2','delivery','payment'], 'safe'], 21 + [['total','body','email','phone2','delivery','payment'], 'safe'],
22 [['email'],'email'], 22 [['email'],'email'],
23 ]; 23 ];
24 } 24 }
@@ -26,14 +26,12 @@ class Orders extends \yii\db\ActiveRecord @@ -26,14 +26,12 @@ class Orders extends \yii\db\ActiveRecord
26 public function attributeLabels() 26 public function attributeLabels()
27 { 27 {
28 return [ 28 return [
29 - 'name' => 'Имя', 29 + 'name' => 'Ф.И.О',
30 'phone'=>'Телефон', 30 'phone'=>'Телефон',
31 'phone2'=>'Дополнительный телефон', 31 'phone2'=>'Дополнительный телефон',
32 'body'=>'Сообщение', 32 'body'=>'Сообщение',
33 'adress'=>'Адрес', 33 'adress'=>'Адрес',
34 'city'=>'Город', 34 'city'=>'Город',
35 - 'patronymic'=>'Отчество',  
36 - 'surname'=>'Фамилия',  
37 'email'=>'E-mail', 35 'email'=>'E-mail',
38 'date_time'=>'Дата', 36 'date_time'=>'Дата',
39 'total'=>'Сума', 37 'total'=>'Сума',
@@ -60,10 +58,6 @@ class Orders extends \yii\db\ActiveRecord @@ -60,10 +58,6 @@ class Orders extends \yii\db\ActiveRecord
60 $body .= "\n\r"; 58 $body .= "\n\r";
61 $body .= 'Имя: '.$this->name; 59 $body .= 'Имя: '.$this->name;
62 $body .= "\n\r"; 60 $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; 61 $body .= 'E-mail: '.$this->email;
68 $body .= "\n\r"; 62 $body .= "\n\r";
69 $body .= 'Телефон: '.$this->phone; 63 $body .= 'Телефон: '.$this->phone;
console/migrations/m160518_185644_change_order.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160518_185644_change_order extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->dropColumn('orders', 'surname');
  10 + $this->dropColumn('orders', 'patronymic');
  11 + }
  12 +
  13 + public function down()
  14 + {
  15 + $this->addColumn('orders', 'surname','string');
  16 + $this->addColumn('orders', 'patronymic','string');
  17 + }
  18 +
  19 + /*
  20 + // Use safeUp/safeDown to run migration code within a transaction
  21 + public function safeUp()
  22 + {
  23 + }
  24 +
  25 + public function safeDown()
  26 + {
  27 + }
  28 + */
  29 +}
frontend/config/main.php
@@ -85,6 +85,8 @@ return [ @@ -85,6 +85,8 @@ return [
85 'brends' => 'brends/index', 85 'brends' => 'brends/index',
86 'blog' => 'articles/index', 86 'blog' => 'articles/index',
87 'blog/<translit:[\w\-]+>-<id:\d+>' => 'articles/show', 87 'blog/<translit:[\w\-]+>-<id:\d+>' => 'articles/show',
  88 + 'event' => 'event/index',
  89 + 'event/<alias:[\w\-]+>-<id:\d+>' => 'event/show',
88 '<language:(ru|ua|en)>/<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>', 90 '<language:(ru|ua|en)>/<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
89 '<language:(ru|ua|en)>/<controller:\w+>/<action:\w+>' => '<controller>/<action>', 91 '<language:(ru|ua|en)>/<controller:\w+>/<action:\w+>' => '<controller>/<action>',
90 '<language:(ru|ua|en)>/admin' => 'admin/default/index', 92 '<language:(ru|ua|en)>/admin' => 'admin/default/index',
frontend/controllers/BasketController.php
@@ -50,7 +50,7 @@ class BasketController extends Controller @@ -50,7 +50,7 @@ class BasketController extends Controller
50 $modelOrdersProducts->load($data); 50 $modelOrdersProducts->load($data);
51 $modelOrdersProducts->save(); 51 $modelOrdersProducts->save();
52 } 52 }
53 - if(!Yii::$app->user->id){ 53 + if(!Yii::$app->user->id && !empty($modelOrder->email)){
54 $modelUser = new Customer(); 54 $modelUser = new Customer();
55 $modelUser->role = 'person'; 55 $modelUser->role = 'person';
56 $modelUser->username = $modelOrder->email; 56 $modelUser->username = $modelOrder->email;
@@ -72,7 +72,6 @@ class BasketController extends Controller @@ -72,7 +72,6 @@ class BasketController extends Controller
72 $modelOrder->email = $user->username; 72 $modelOrder->email = $user->username;
73 $modelOrder->phone = $user->phone; 73 $modelOrder->phone = $user->phone;
74 $modelOrder->name = $user->name; 74 $modelOrder->name = $user->name;
75 - $modelOrder->surname = $user->surname;  
76 } 75 }
77 76
78 return $this->render('index', [ 77 return $this->render('index', [
frontend/controllers/EventController.php 100755 → 100644
1 -<?php  
2 -  
3 -namespace frontend\controllers;  
4 -  
5 -use Yii;  
6 -use common\models\Event;  
7 -use yii\web\Controller;  
8 -use yii\web\NotFoundHttpException;  
9 -use yii\data\ActiveDataProvider;  
10 -  
11 -  
12 -  
13 -class EventController extends Controller  
14 -{  
15 -  
16 - public function actionIndex()  
17 - {  
18 -  
19 - $dataProvider = new ActiveDataProvider([  
20 - 'query' => Event::find() ]);  
21 -  
22 - return $this->render('index', [  
23 - 'dataProvider' => $dataProvider,  
24 - ]);  
25 - }  
26 -  
27 -  
28 -  
29 - public function actionView($alias)  
30 - {  
31 -  
32 - return $this->render('view', [  
33 - 'model' => $this->findModel($alias),  
34 - ]);  
35 - }  
36 -  
37 -  
38 - protected function findModel($alias)  
39 - {  
40 - if (($model = Event::findOne(["alias"=>$alias])) !== null) {  
41 - return $model;  
42 - } else {  
43 - throw new NotFoundHttpException('The requested page does not exist.');  
44 - }  
45 - }  
46 -  
47 - 1 +<?php
  2 +
  3 +namespace frontend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Event;
  7 +use yii\web\Controller;
  8 +use yii\web\NotFoundHttpException;
  9 +use yii\data\ActiveDataProvider;
  10 +
  11 +
  12 +
  13 +class EventController extends Controller
  14 +{
  15 +
  16 + public function actionIndex()
  17 + {
  18 +
  19 + $dataProvider = new ActiveDataProvider([
  20 + 'query' => Event::find() ]);
  21 +
  22 + return $this->render('index', [
  23 + 'dataProvider' => $dataProvider,
  24 + ]);
  25 + }
  26 +
  27 +
  28 +
  29 + public function actionShow($alias)
  30 + {
  31 +
  32 + return $this->render('show', [
  33 + 'model' => $this->findModel($alias),
  34 + ]);
  35 + }
  36 +
  37 +
  38 + protected function findModel($alias)
  39 + {
  40 + if (($model = Event::findOne(["alias"=>$alias])) !== null) {
  41 + return $model;
  42 + } else {
  43 + throw new NotFoundHttpException('The requested page does not exist.');
  44 + }
  45 + }
  46 +
  47 +
48 } 48 }
49 \ No newline at end of file 49 \ No newline at end of file
frontend/views/basket/index.php
@@ -43,12 +43,10 @@ $(&#39;#order-delivery input[type=\&quot;radio\&quot;]&#39;).click(function(){ @@ -43,12 +43,10 @@ $(&#39;#order-delivery input[type=\&quot;radio\&quot;]&#39;).click(function(){
43 <?= Html::a('Вернуться в каталог', ['/site/index'], ['class'=>'btn-success']) ?> 43 <?= Html::a('Вернуться в каталог', ['/site/index'], ['class'=>'btn-success']) ?>
44 <?php $form = ActiveForm::begin(['enableClientScript' => false]); ?> 44 <?php $form = ActiveForm::begin(['enableClientScript' => false]); ?>
45 <div class="rightbar"> 45 <div class="rightbar">
46 - <div class="form-order">  
47 -<?php echo $form->field($modelOrder,'surname'); ?> 46 + <div class="form-order">
48 <?php echo $form->field($modelOrder,'name'); ?> 47 <?php echo $form->field($modelOrder,'name'); ?>
49 -<?php echo $form->field($modelOrder,'patronymic'); ?>  
50 <?php echo $form->field($modelOrder,'phone'); ?> 48 <?php echo $form->field($modelOrder,'phone'); ?>
51 -<?php echo $form->field($modelOrder,'phone2'); ?> 49 +<?php echo $form->field($modelOrder,'phone2'); ?>
52 <?php echo $form->field($modelOrder,'city'); ?> 50 <?php echo $form->field($modelOrder,'city'); ?>
53 <?php echo $form->field($modelOrder,'adress'); ?> 51 <?php echo $form->field($modelOrder,'adress'); ?>
54 <?php echo $form->field($modelOrder,'email'); ?> 52 <?php echo $form->field($modelOrder,'email'); ?>
frontend/views/event/_objects.php 100755 → 100644
@@ -2,37 +2,10 @@ @@ -2,37 +2,10 @@
2 use yii\helpers\Html; 2 use yii\helpers\Html;
3 use frontend\helpers\TextHelper; 3 use frontend\helpers\TextHelper;
4 use yii\helpers\Url; 4 use yii\helpers\Url;
5 - 5 +use frontend\components\Text;
6 ?> 6 ?>
7 -<div class="portfolio-portfolio">  
8 - <div class="portfolio-portfolio-overflow">  
9 -  
10 - <div class="portfolio-portfolio-img-wrap">  
11 - <div class="portfolio-portfolio-img">  
12 - <?= Html::a(Html::img($model->minImg($model->image, '200','200')),Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?>  
13 - </div>  
14 - </div>  
15 -  
16 - <div class="portfolio-portfolio-text-wrap">  
17 -  
18 -  
19 - <div class="portfolio-category-name"><?= Html::a($model->name,Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?></div>  
20 - <div class="date_end">  
21 - Срок действия по: <?= $model->end_at?>  
22 - </div>  
23 - <div class="portfolio-text-name">  
24 - <p>  
25 - <span><?= TextHelper::truncateHtmlText($model->body, 200, '...') ?></span>  
26 - </p>  
27 - </div>  
28 - <table class="tov-tb-3" cellspacing="0" cellpadding="0" border="0">  
29 - <tbody>  
30 - <tr>  
31 - <td height="25"><img src="/images/ico-2.jpg" alt=""></td>  
32 - <td height="25"></td><td><a class="consultation_btn" href="#" style="margin-left: 11px; font-size: 13px; font-family: arial; color: #6b7b9d; border-bottom: 1px dotted;">Заказать консультацию</a></td>  
33 - </tr>  
34 - </tbody>  
35 - </table>  
36 - </div>  
37 - </div> 7 +<div class="news_item">
  8 + <a href="<?=Url::to(['event/show','alias'=>$model->alias,'id'=>$model->primaryKey])?>"><img src="<?=Yii::$app->request->baseUrl.'/storage/articles/ico/'.$model->image?>" width="180" height="125" border="0" align="left" /></a>
  9 + <a href="<?=Url::to(['event/show','alias'=>$model->alias,'id'=>$model->primaryKey])?>" class="name"><?=$model->name?></a><br />
  10 + <?=Text::getShort($model->body,600);?><div class="both"></div>
38 </div> 11 </div>
39 \ No newline at end of file 12 \ No newline at end of file
frontend/views/event/index.php
1 <?php 1 <?php
  2 +use yii\helpers\Url;
  3 +use yii\widgets\Breadcrumbs;
  4 +//use app\models\News;
  5 +use yii\widgets\LinkPager;
  6 +
2 use yii\widgets\ListView; 7 use yii\widgets\ListView;
3 -use frontend\widgets\Seo;  
4 -$this->params['breadcrumbs'][] = ['label' => 'Акции', 'url' => ['index']];  
5 -$this->params['seo']['seo_text'] = 'TEST SEO TEXT';  
6 -$this->params['seo']['h1'] = 'TEST H1';  
7 -$this->params['seo']['description'] = 'TEST DESCRIPTION';  
8 -$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD';  
9 -?>  
10 8
  9 +?>
11 <?php 10 <?php
12 - echo ListView::widget( [  
13 - 'dataProvider' => $dataProvider,  
14 - 'itemView'=>'_objects',  
15 - 'summary'=>'',  
16 - 'layout' => "<div class='portfolio-block-left'>{items}</div>  
17 - <div class='pager-block' id='pager-block-single'>{pager}</div>"  
18 - ] ); 11 +$this->title = 'Акции';
  12 +$this->registerMetaTag(['name' => 'description', 'content' => 'Акции']);
  13 +$this->registerMetaTag(['name' => 'keywords', 'content' => 'Акции']);
19 ?> 14 ?>
20 -<div class="seo-text">  
21 - <?= Seo::widget(['row'=>'seo_text'])?>  
22 -</div> 15 +
  16 + <nav class="bread-crumbs">
  17 + <?= Breadcrumbs::widget([
  18 + 'links' => [
  19 + 'Акции'
  20 + ],
  21 + ]) ?>
  22 + <div class="both"></div>
  23 + </nav>
  24 +
  25 +<div class="layout">
  26 +
  27 + <div class="content">
  28 + <h1>Акции</h1>
  29 + <?php
  30 + echo ListView::widget( [
  31 + 'dataProvider' => $dataProvider,
  32 + 'itemView'=>'_objects',
  33 + 'summary'=>''
  34 + ] );
  35 + ?>
  36 +
  37 + <div class="both"></div>
  38 +
  39 +
  40 + </div>
  41 +
  42 +</div>
23 \ No newline at end of file 43 \ No newline at end of file
frontend/views/event/show.php 0 → 100755
  1 +<?php
  2 +use yii\helpers\Url;
  3 +use yii\widgets\Breadcrumbs;
  4 +?>
  5 +<?php
  6 +$this->title = $model->name;
  7 +
  8 +?>
  9 +
  10 + <nav class="bread-crumbs">
  11 + <?= Breadcrumbs::widget([
  12 + 'links' => [
  13 + ['label'=>'Акции','url'=>['news/index']],
  14 + $model->name
  15 + ],
  16 + ]) ?>
  17 + <div class="both"></div>
  18 + </nav>
  19 +
  20 +<div class="layout">
  21 +
  22 + <div class="content">
  23 + <h1><?=$model->name?></h1>
  24 +
  25 + <img src="<?=Yii::$app->request->baseUrl.'/storage/articles/big/'.$model->image?>" width="400" height="400" border="0" align="left" class='pic' />
  26 + <?=$model->body?>
  27 + </div>
  28 +
  29 +</div>
0 \ No newline at end of file 30 \ No newline at end of file
frontend/views/event/view.php deleted
1 -<?php  
2 -  
3 -use yii\helpers\Html;  
4 -use yii\widgets\DetailView;  
5 -use frontend\widgets\Seo;  
6 -/* @var $this yii\web\View */  
7 -/* @var $model common\models\Stone */  
8 -  
9 -$this->title = $model->name;  
10 -$this->params['breadcrumbs'][] = ['label' => 'Акции', 'url' => ['index']];  
11 -$this->params['breadcrumbs'][] = $this->title;  
12 -$this->params['name'] = $this->title;  
13 -?>  
14 -<div class="events-one-item">  
15 - <h1><?= $model->name?></h1>  
16 - <?= Html::img($model->minImg($model->image, '940','480')) ?>  
17 - <div class="date_end">  
18 - Срок действия по: <?= $model->end_at?>  
19 - </div>  
20 - <div class="content-last-block-text-wrap">  
21 - <?= $model->body?>  
22 - </div>  
23 - <?php  
24 - echo \common\modules\comment\widgets\CommentWidget::widget([  
25 - 'context' => $this,  
26 - 'model' => $model->className(),  
27 - 'model_id' => $model->event_id,  
28 - 'comment_class' => \common\modules\comment\models\Comment::className(),  
29 - 'rating_class' => \common\modules\comment\models\Rating::className(),  
30 - 'class_options' => [  
31 - 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST,  
32 - 'user_id' => \Yii::$app->user->getId(),  
33 - 'guestComment' => true,  
34 - 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE,  
35 - ],  
36 - 'list_options' => [  
37 - 'view' => 'list-comment-review',  
38 - ],  
39 - 'form_options' => [  
40 - 'view' => 'form-comment-review',  
41 - 'tag' => 'span',  
42 - ],  
43 - 'options' => [  
44 - 'class' => 'proektant-comments-wr style',  
45 - ],  
46 - ]);  
47 - ?>  
48 -</div>  
49 -<div class="seo-text">  
50 - <?= Seo::widget(['row'=>'seo_text'])?>  
51 -</div>  
frontend/views/layouts/main-menu.php 0 → 100644
  1 +<?php
  2 +use common\modules\product\models\Category;
  3 +use yii\helpers\Url;
  4 +use yii\widgets\Menu;
  5 +
  6 +
  7 +foreach (Category::find ()->all () as $category){
  8 + $menu[] = ['label' => $category->name ,
  9 + 'url' => Url::to(['catalog/category', 'category' => $category]),
  10 + 'active' => Yii::$app->request->get('category')->alias == $category->alias ? true : false ];
  11 +}
  12 +
  13 +$main_menu = Menu::widget([
  14 + 'items' => $menu,
  15 +]);
  16 +?>
  17 +
  18 +<?=$main_menu?>
  19 +<div class="fr">
  20 + <ul>
  21 + <li class="akciya"><a href="<?= Url::to (['event/index',]) ?>">Акции</a></li>
  22 + <li class="brands"><a href="<?= Url::to (['brand/index']) ?>">Бренды</a></li>
  23 + </ul>
  24 +</div>
frontend/views/layouts/main.php
@@ -154,19 +154,7 @@ @@ -154,19 +154,7 @@
154 154
155 155
156 <div class="menu"> 156 <div class="menu">
157 - <ul>  
158 - <?php foreach (Category::find ()->all () as $category): ?>  
159 - <li><a href="<?= \yii\helpers\Url::to(['catalog/category', 'category' => $category])?>"><?= $category->name ?></a>  
160 - </li>  
161 - <?php endforeach; ?>  
162 - </ul>  
163 -  
164 - <div class="fr">  
165 - <ul>  
166 - <li class="akciya"><a href="<?= Url::to (['text/index', 'translit' => 'akcii']) ?>">Акции</a></li>  
167 - <li class="brands"><a href="<?= Url::to (['brand/index']) ?>">Бренды</a></li>  
168 - </ul>  
169 - </div> 157 + <?= $this->render('main-menu', Category::find ()->all())?>
170 <div class="both"></div> 158 <div class="both"></div>
171 </div> 159 </div>
172 160
@@ -306,7 +294,7 @@ @@ -306,7 +294,7 @@
306 <li><a href="<?= Url::to (['text/index', 'translit' => 'oplata_i_dostavka']) ?>">Оплата и 294 <li><a href="<?= Url::to (['text/index', 'translit' => 'oplata_i_dostavka']) ?>">Оплата и
307 доставка</a></li> 295 доставка</a></li>
308 <li><a href="<?= Url::to (['iam/index']) ?>">Личный кабинет</a></li> 296 <li><a href="<?= Url::to (['iam/index']) ?>">Личный кабинет</a></li>
309 - <li><a href="#">Акции</a></li> 297 + <li><a href="<?= Url::to (['event/index']) ?>">Акции</a></li>
310 <li><a href="<?= Url::to (['text/index', 'translit' => 'about']) ?>">О магазине</a></li> 298 <li><a href="<?= Url::to (['text/index', 'translit' => 'about']) ?>">О магазине</a></li>
311 </ul> 299 </ul>
312 300