Commit 464ede30f0e40192535f4062ad72295b68e6630e

Authored by Alexey Boroda
1 parent b433e560

-Global comments

frontend/controllers/SiteController.php
1 <?php 1 <?php
2 namespace frontend\controllers; 2 namespace frontend\controllers;
3 - 3 +
4 use artbox\core\models\Feedback; 4 use artbox\core\models\Feedback;
5 use artbox\core\models\Page; 5 use artbox\core\models\Page;
  6 + use artbox\webcomment\models\CommentModel;
6 use common\models\Settings; 7 use common\models\Settings;
7 use Yii; 8 use Yii;
8 use yii\filters\VerbFilter; 9 use yii\filters\VerbFilter;
@@ -10,7 +11,7 @@ @@ -10,7 +11,7 @@
10 use yii\web\BadRequestHttpException; 11 use yii\web\BadRequestHttpException;
11 use yii\web\Controller; 12 use yii\web\Controller;
12 use yii\web\Response; 13 use yii\web\Response;
13 - 14 +
14 /** 15 /**
15 * Site controller 16 * Site controller
16 */ 17 */
@@ -27,7 +28,7 @@ @@ -27,7 +28,7 @@
27 ], 28 ],
28 ]; 29 ];
29 } 30 }
30 - 31 +
31 /** 32 /**
32 * @inheritdoc 33 * @inheritdoc
33 */ 34 */
@@ -42,7 +43,7 @@ @@ -42,7 +43,7 @@
42 ], 43 ],
43 ]; 44 ];
44 } 45 }
45 - 46 +
46 /** 47 /**
47 * Displays homepage. 48 * Displays homepage.
48 * 49 *
@@ -52,7 +53,7 @@ @@ -52,7 +53,7 @@
52 { 53 {
53 return $this->render('index'); 54 return $this->render('index');
54 } 55 }
55 - 56 +
56 /** 57 /**
57 * Displays contact page. 58 * Displays contact page.
58 * 59 *
@@ -68,7 +69,7 @@ @@ -68,7 +69,7 @@
68 ] 69 ]
69 ); 70 );
70 } 71 }
71 - 72 +
72 /** 73 /**
73 * Displays about page. 74 * Displays about page.
74 * 75 *
@@ -78,7 +79,7 @@ @@ -78,7 +79,7 @@
78 { 79 {
79 return $this->render('about'); 80 return $this->render('about');
80 } 81 }
81 - 82 +
82 /** 83 /**
83 * Action to view robots.txt file dinamycli 84 * Action to view robots.txt file dinamycli
84 * 85 *
@@ -99,23 +100,23 @@ @@ -99,23 +100,23 @@
99 $response->headers->set('Content-Type', 'text/plain'); 100 $response->headers->set('Content-Type', 'text/plain');
100 return $this->renderFile($meta[ 'uri' ]); 101 return $this->renderFile($meta[ 'uri' ]);
101 } 102 }
102 - 103 +
103 public function actionFeedback() 104 public function actionFeedback()
104 { 105 {
105 Yii::$app->response->format = Response::FORMAT_JSON; 106 Yii::$app->response->format = Response::FORMAT_JSON;
106 - 107 +
107 /** 108 /**
108 * @var Mailer $mailer 109 * @var Mailer $mailer
109 */ 110 */
110 $mailer = \Yii::$app->get('smtpmailer'); 111 $mailer = \Yii::$app->get('smtpmailer');
111 $settings = Settings::getInstance(); 112 $settings = Settings::getInstance();
112 - 113 +
113 if (empty(Yii::$app->request->post())) { 114 if (empty(Yii::$app->request->post())) {
114 throw new BadRequestHttpException(); 115 throw new BadRequestHttpException();
115 } else { 116 } else {
116 $model = new Feedback(); 117 $model = new Feedback();
117 if ($model->load(Yii::$app->request->post()) && $model->save()) { 118 if ($model->load(Yii::$app->request->post()) && $model->save()) {
118 - 119 +
119 $mailer->compose( 120 $mailer->compose(
120 'feedback', 121 'feedback',
121 [ 122 [
@@ -126,7 +127,7 @@ @@ -126,7 +127,7 @@
126 ->setTo($settings->email) 127 ->setTo($settings->email)
127 ->setSubject(\Yii::t('app', 'Feedback')) 128 ->setSubject(\Yii::t('app', 'Feedback'))
128 ->send(); 129 ->send();
129 - 130 +
130 return [ 131 return [
131 'success' => true, 132 'success' => true,
132 'message' => 'Success message', 133 'message' => 'Success message',
@@ -145,18 +146,47 @@ @@ -145,18 +146,47 @@
145 } 146 }
146 } 147 }
147 } 148 }
148 -  
149 - public function actionAppment(){ 149 +
  150 + public function actionAppment()
  151 + {
150 return $this->render('appment'); 152 return $this->render('appment');
151 } 153 }
152 -  
153 - public function actionPrice(){  
154 - $page_stom = Page::find()->with('lang')->where(['id' => 3])->one();  
155 - $page_cosm = Page::find()->with('lang')->where(['id' => 4])->one();  
156 -  
157 - return $this->render('price',[  
158 - 'page_stom' => $page_stom,  
159 - 'page_cosm' => $page_cosm,  
160 - ]); 154 +
  155 + public function actionPrice()
  156 + {
  157 + $page_stom = Page::find()
  158 + ->with('lang')
  159 + ->where([ 'id' => 3 ])
  160 + ->one();
  161 + $page_cosm = Page::find()
  162 + ->with('lang')
  163 + ->where([ 'id' => 4 ])
  164 + ->one();
  165 +
  166 + return $this->render(
  167 + 'price',
  168 + [
  169 + 'page_stom' => $page_stom,
  170 + 'page_cosm' => $page_cosm,
  171 + ]
  172 + );
  173 + }
  174 +
  175 + public function actionComments()
  176 + {
  177 + $model = new CommentModel(
  178 + [
  179 + 'id' => 1,
  180 + ]
  181 + );
  182 +
  183 + $this->view->params[ 'breadcrumbs' ][] = \Yii::t('app', 'Комментарии');
  184 +
  185 + return $this->render(
  186 + 'comments',
  187 + [
  188 + 'model' => $model,
  189 + ]
  190 + );
161 } 191 }
162 } 192 }
frontend/models/CommentPage.php 0 → 100644
  1 +<?php
  2 +
  3 + namespace frontend\models;
  4 +
  5 + use yii\base\Object;
  6 +
  7 + /**
  8 + * Class CommentPage
  9 + *
  10 + * @package frontend\models
  11 + */
  12 + class CommentPage extends Object
  13 + {
  14 + public $id;
  15 + }
0 \ No newline at end of file 16 \ No newline at end of file
frontend/views/layouts/main.php
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 'lang', 39 'lang',
40 'pages' => function (ActiveQuery $query) { 40 'pages' => function (ActiveQuery $query) {
41 $query->with('lang.alias') 41 $query->with('lang.alias')
42 - ->where(['in_menu' => true]) 42 + ->where([ 'in_menu' => true ])
43 ->orderBy([ 'sort' => SORT_ASC ]); 43 ->orderBy([ 'sort' => SORT_ASC ]);
44 }, 44 },
45 ] 45 ]
@@ -78,171 +78,171 @@ @@ -78,171 +78,171 @@
78 <body> 78 <body>
79 <?php $this->beginBody() ?> 79 <?php $this->beginBody() ?>
80 <!-- Google Analytics --> 80 <!-- Google Analytics -->
81 - <?php if (!empty($settings->ga_code)) { ?>  
82 - <script>  
83 - (function(i, s, o, g, r, a, m) {  
84 - i[ 'GoogleAnalyticsObject' ] = r;  
85 - i[ r ] = i[ r ] || function() {  
86 - (i[ r ].q = i[ r ].q || []).push(arguments)  
87 - }, i[ r ].l = 1 * new Date();  
88 - a = s.createElement(o), m = s.getElementsByTagName(o)[ 0 ];  
89 - a.async = 1;  
90 - a.src = g;  
91 - m.parentNode.insertBefore(a, m)  
92 - })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 81 + <?php if (!empty($settings->ga_code)) { ?>
  82 + <script>
  83 + (function(i, s, o, g, r, a, m) {
  84 + i[ 'GoogleAnalyticsObject' ] = r;
  85 + i[ r ] = i[ r ] || function() {
  86 + (i[ r ].q = i[ r ].q || []).push(arguments)
  87 + }, i[ r ].l = 1 * new Date();
  88 + a = s.createElement(o), m = s.getElementsByTagName(o)[ 0 ];
  89 + a.async = 1;
  90 + a.src = g;
  91 + m.parentNode.insertBefore(a, m)
  92 + })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
93 93
94 - ga('create', '<?=$settings->ga_code?>', 'auto');  
95 - ga('send', 'pageview');  
96 -  
97 - </script>  
98 - <?php } ?> 94 + ga('create', '<?=$settings->ga_code?>', 'auto');
  95 + ga('send', 'pageview');
  96 +
  97 + </script>
  98 + <?php } ?>
99 <div id="all"> 99 <div id="all">
100 <header> 100 <header>
101 - <!-- *** TOP ***  
102 - _________________________________________________________ -->  
103 - <div id="top">  
104 - <div class="container">  
105 - <div class="row">  
106 - <div class="col-xs-5 contact">  
107 - <p class="hidden-sm hidden-xs">  
108 - <?php  
109 - if (!empty($settings->phone)) {  
110 - echo \Yii::t('app', 'Связаться с нами ');  
111 - echo Html::a($settings->phone, "тел.: {$settings->phone}");  
112 - if (!empty($settings->email)) {  
113 - echo \Yii::t('app', ' или ');  
114 - echo Html::a($settings->email, "mailto:$settings->email");  
115 - }  
116 - }  
117 - ?>  
118 - </p>  
119 - <p class="hidden-md hidden-lg">  
120 - <a href="#" data-animate-hover="pulse"><i class="fa fa-phone"></i></a>  
121 - <a href="#" data-animate-hover="pulse"><i class="fa fa-envelope"></i></a>  
122 - </p>  
123 - </div>  
124 - <div class="col-xs-7">  
125 - <div class="social">  
126 - <?php  
127 - if (!empty($settings->facebook)) {  
128 - echo Html::a(  
129 - Html::icon(  
130 - 'facebook',  
131 - [  
132 - 'prefix' => 'fa fa-',  
133 - ]  
134 - ),  
135 - $settings->facebook,  
136 - [  
137 - 'class' => 'external facebook',  
138 - 'data' => [  
139 - 'animate-hover' => 'pulse',  
140 - ],  
141 - ]  
142 - );  
143 - }  
144 - ?>  
145 - <?php  
146 - if (!empty($settings->vk)) {  
147 - echo Html::a(  
148 - Html::icon(  
149 - 'vk',  
150 - [  
151 - 'prefix' => 'fa fa-',  
152 - ]  
153 - ),  
154 - $settings->vk,  
155 - [  
156 - 'class' => 'external vk',  
157 - 'data' => [  
158 - 'animate-hover' => 'pulse',  
159 - ],  
160 - ]  
161 - );  
162 - }  
163 - ?>  
164 - <?php  
165 - if (!empty($settings->google)) {  
166 - echo Html::a(  
167 - Html::icon(  
168 - 'google-plus',  
169 - [  
170 - 'prefix' => 'fa fa-',  
171 - ]  
172 - ),  
173 - $settings->google,  
174 - [  
175 - 'class' => 'external gplus',  
176 - 'data' => [  
177 - 'animate-hover' => 'pulse',  
178 - ],  
179 - ]  
180 - );  
181 - }  
182 - ?>  
183 - <?php  
184 - if (!empty($settings->twitter)) {  
185 - echo Html::a(  
186 - Html::icon(  
187 - 'twitter',  
188 - [  
189 - 'prefix' => 'fa fa-',  
190 - ]  
191 - ),  
192 - $settings->twitter,  
193 - [  
194 - 'class' => 'external twitter',  
195 - 'data' => [  
196 - 'animate-hover' => 'pulse',  
197 - ],  
198 - ]  
199 - );  
200 - }  
201 - ?>  
202 - <?php  
203 - if (!empty($settings->ok)) {  
204 - echo Html::a(  
205 - Html::icon(  
206 - 'odnoklassniki',  
207 - [  
208 - 'prefix' => 'fa fa-',  
209 - ]  
210 - ),  
211 - $settings->ok,  
212 - [  
213 - 'class' => 'external odnoklassniki',  
214 - 'data' => [  
215 - 'animate-hover' => 'pulse',  
216 - ],  
217 - ]  
218 - );  
219 - }  
220 - ?>  
221 - <?php  
222 - if (!empty($settings->email)) {  
223 - echo Html::a(  
224 - Html::icon(  
225 - 'envelope',  
226 - [  
227 - 'prefix' => 'fa fa-',  
228 - ]  
229 - ),  
230 - "mailto:$settings->email",  
231 - [  
232 - 'class' => 'email',  
233 - 'data' => [  
234 - 'animate-hover' => 'pulse',  
235 - ],  
236 - ]  
237 - );  
238 - }  
239 - ?>  
240 - </div>  
241 - </div>  
242 - </div> 101 + <!-- *** TOP ***
  102 +_________________________________________________________ -->
  103 + <div id="top">
  104 + <div class="container">
  105 + <div class="row">
  106 + <div class="col-xs-5 contact">
  107 + <p class="hidden-sm hidden-xs">
  108 + <?php
  109 + if (!empty($settings->phone)) {
  110 + echo \Yii::t('app', 'Связаться с нами ');
  111 + echo Html::a($settings->phone, "тел.: {$settings->phone}");
  112 + if (!empty($settings->email)) {
  113 + echo \Yii::t('app', ' или ');
  114 + echo Html::a($settings->email, "mailto:$settings->email");
  115 + }
  116 + }
  117 + ?>
  118 + </p>
  119 + <p class="hidden-md hidden-lg">
  120 + <a href="#" data-animate-hover="pulse"><i class="fa fa-phone"></i></a>
  121 + <a href="#" data-animate-hover="pulse"><i class="fa fa-envelope"></i></a>
  122 + </p>
  123 + </div>
  124 + <div class="col-xs-7">
  125 + <div class="social">
  126 + <?php
  127 + if (!empty($settings->facebook)) {
  128 + echo Html::a(
  129 + Html::icon(
  130 + 'facebook',
  131 + [
  132 + 'prefix' => 'fa fa-',
  133 + ]
  134 + ),
  135 + $settings->facebook,
  136 + [
  137 + 'class' => 'external facebook',
  138 + 'data' => [
  139 + 'animate-hover' => 'pulse',
  140 + ],
  141 + ]
  142 + );
  143 + }
  144 + ?>
  145 + <?php
  146 + if (!empty($settings->vk)) {
  147 + echo Html::a(
  148 + Html::icon(
  149 + 'vk',
  150 + [
  151 + 'prefix' => 'fa fa-',
  152 + ]
  153 + ),
  154 + $settings->vk,
  155 + [
  156 + 'class' => 'external vk',
  157 + 'data' => [
  158 + 'animate-hover' => 'pulse',
  159 + ],
  160 + ]
  161 + );
  162 + }
  163 + ?>
  164 + <?php
  165 + if (!empty($settings->google)) {
  166 + echo Html::a(
  167 + Html::icon(
  168 + 'google-plus',
  169 + [
  170 + 'prefix' => 'fa fa-',
  171 + ]
  172 + ),
  173 + $settings->google,
  174 + [
  175 + 'class' => 'external gplus',
  176 + 'data' => [
  177 + 'animate-hover' => 'pulse',
  178 + ],
  179 + ]
  180 + );
  181 + }
  182 + ?>
  183 + <?php
  184 + if (!empty($settings->twitter)) {
  185 + echo Html::a(
  186 + Html::icon(
  187 + 'twitter',
  188 + [
  189 + 'prefix' => 'fa fa-',
  190 + ]
  191 + ),
  192 + $settings->twitter,
  193 + [
  194 + 'class' => 'external twitter',
  195 + 'data' => [
  196 + 'animate-hover' => 'pulse',
  197 + ],
  198 + ]
  199 + );
  200 + }
  201 + ?>
  202 + <?php
  203 + if (!empty($settings->ok)) {
  204 + echo Html::a(
  205 + Html::icon(
  206 + 'odnoklassniki',
  207 + [
  208 + 'prefix' => 'fa fa-',
  209 + ]
  210 + ),
  211 + $settings->ok,
  212 + [
  213 + 'class' => 'external odnoklassniki',
  214 + 'data' => [
  215 + 'animate-hover' => 'pulse',
  216 + ],
  217 + ]
  218 + );
  219 + }
  220 + ?>
  221 + <?php
  222 + if (!empty($settings->email)) {
  223 + echo Html::a(
  224 + Html::icon(
  225 + 'envelope',
  226 + [
  227 + 'prefix' => 'fa fa-',
  228 + ]
  229 + ),
  230 + "mailto:$settings->email",
  231 + [
  232 + 'class' => 'email',
  233 + 'data' => [
  234 + 'animate-hover' => 'pulse',
  235 + ],
  236 + ]
  237 + );
  238 + }
  239 + ?>
  240 + </div>
243 </div> 241 </div>
  242 + </div>
244 </div> 243 </div>
245 - <!-- *** TOP END *** --> 244 + </div>
  245 + <!-- *** TOP END *** -->
246 <!-- *** NAVBAR *** 246 <!-- *** NAVBAR ***
247 _________________________________________________________ --> 247 _________________________________________________________ -->
248 <div class="navbar-affixed-top" data-spy="affix" data-offset-top="200"> 248 <div class="navbar-affixed-top" data-spy="affix" data-offset-top="200">
@@ -280,18 +280,23 @@ @@ -280,18 +280,23 @@
280 ]; 280 ];
281 foreach ($pageCategories as $category) { 281 foreach ($pageCategories as $category) {
282 if (empty($category->pages)) { 282 if (empty($category->pages)) {
283 - continue; 283 + continue;
284 } 284 }
285 $pages = []; 285 $pages = [];
286 foreach ($category->pages as $page) { 286 foreach ($category->pages as $page) {
287 - $pages[] = [  
288 - 'label' => $page->lang->title,  
289 - 'url' => Url::to(['page/view','alias' => $page->lang->alias]),  
290 - ]; 287 + $pages[] = [
  288 + 'label' => $page->lang->title,
  289 + 'url' => Url::to(
  290 + [
  291 + 'page/view',
  292 + 'alias' => $page->lang->alias,
  293 + ]
  294 + ),
  295 + ];
291 } 296 }
292 $items[] = [ 297 $items[] = [
293 - 'label' => $category->lang->title,  
294 - 'items' => $pages, 298 + 'label' => $category->lang->title,
  299 + 'items' => $pages,
295 ]; 300 ];
296 } 301 }
297 $items[] = [ 302 $items[] = [
@@ -306,10 +311,14 @@ @@ -306,10 +311,14 @@
306 'label' => \Yii::t('app', 'Контакты'), 311 'label' => \Yii::t('app', 'Контакты'),
307 'url' => [ 'site/contact' ], 312 'url' => [ 'site/contact' ],
308 ]; 313 ];
309 - $items[] = [ 314 + $items[] = [
310 'label' => \Yii::t('app', 'О клинике'), 315 'label' => \Yii::t('app', 'О клинике'),
311 'url' => [ 'site/about' ], 316 'url' => [ 'site/about' ],
312 ]; 317 ];
  318 + $items[] = [
  319 + 'label' => \Yii::t('app', 'Отзывы'),
  320 + 'url' => [ 'site/comments' ],
  321 + ];
313 echo Nav::widget( 322 echo Nav::widget(
314 [ 323 [
315 'items' => $items, 324 'items' => $items,
@@ -349,119 +358,118 @@ @@ -349,119 +358,118 @@
349 <!-- *** NAVBAR END *** --> 358 <!-- *** NAVBAR END *** -->
350 359
351 </header> 360 </header>
352 -  
353 -  
354 -  
355 - <!-- *** appointment MODAL ***  
356 - _________________________________________________________ -->  
357 - <div class="forms_" id="appointment-modal" aria-labelledby="Login" style="display:none;" aria-hidden="true">  
358 - <div class="forms_wr_">  
359 - <div class="modal-header">  
360 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>  
361 - <h3 class="modal-title" id="Login">Обратная связь</h3>  
362 - </div>  
363 - <div class="modal-body">  
364 -  
365 - <form id="appointment-form" action="/site/appointment" method="POST" role="form">  
366 - <div class="form-group field-appointment-name">  
367 - <div class="on_input_"></div>  
368 - <label class="control-label" for="appointment-name">Имя</label>  
369 - <input type="text" id="appointment-name" class="form-control" name="Appointment[name]" aria-invalid="false">  
370 -  
371 - <p class="help-block help-block-error"></p>  
372 - </div>  
373 - <div class="form-group field-appointment-name required">  
374 - <div class="on_input_"></div>  
375 - <label class="control-label" for="appointment-name">Номер телефона</label>  
376 - <input type="text" id="appointment-phone" class="form-control" name="Appointment[phone]">  
377 -  
378 - <p class="help-block help-block-error"></p>  
379 - </div>  
380 - <div class="form-group field-appointment-date required has-datepicker">  
381 - <div class="on_input_"></div>  
382 - <label class="control-label" for="appointment-date">Дата</label>  
383 - <input type="text" id="appointment-date" class="form-control" name="Appointment[date]">  
384 -  
385 - <p class="help-block help-block-error"></p>  
386 - </div>  
387 - <div class="datepicker-wr">  
388 - <div id="datepicker"></div>  
389 - </div>  
390 - <div class="form-group field-appointment-time">  
391 - <div class="on_input_"></div>  
392 - <label class="control-label" for="appointment-service">Время</label>  
393 - <input type="text" id="appointment-time" class="form-control" name="Appointment[time]">  
394 -  
395 - <p class="help-block help-block-error"></p>  
396 - </div>  
397 - <div class="form-group field-appointment-service">  
398 - <div class="on_input_"></div>  
399 - <label class="control-label" for="appointment-service">Услуга</label>  
400 - <input type="text" id="appointment-service" class="form-control" name="Appointment[service]">  
401 -  
402 - <p class="help-block help-block-error"></p>  
403 - </div>  
404 - <p class="text-center">  
405 - <button type="submit" class="send-form btn btn-lg btn-template-primary">Отправить</button>  
406 - </p>  
407 - </form>  
408 -  
409 - </div>  
410 - </div>  
411 - <div class="overlay-new"></div> 361 +
  362 +
  363 + <!-- *** appointment MODAL ***
  364 +_________________________________________________________ -->
  365 + <div class="forms_" id="appointment-modal" aria-labelledby="Login" style="display:none;" aria-hidden="true">
  366 + <div class="forms_wr_">
  367 + <div class="modal-header">
  368 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>
  369 + <h3 class="modal-title" id="Login">Обратная связь</h3>
  370 + </div>
  371 + <div class="modal-body">
  372 +
  373 + <form id="appointment-form" action="/site/appointment" method="POST" role="form">
  374 + <div class="form-group field-appointment-name">
  375 + <div class="on_input_"></div>
  376 + <label class="control-label" for="appointment-name">Имя</label>
  377 + <input type="text" id="appointment-name" class="form-control" name="Appointment[name]" aria-invalid="false">
  378 +
  379 + <p class="help-block help-block-error"></p>
  380 + </div>
  381 + <div class="form-group field-appointment-name required">
  382 + <div class="on_input_"></div>
  383 + <label class="control-label" for="appointment-name">Номер телефона</label>
  384 + <input type="text" id="appointment-phone" class="form-control" name="Appointment[phone]">
  385 +
  386 + <p class="help-block help-block-error"></p>
  387 + </div>
  388 + <div class="form-group field-appointment-date required has-datepicker">
  389 + <div class="on_input_"></div>
  390 + <label class="control-label" for="appointment-date">Дата</label>
  391 + <input type="text" id="appointment-date" class="form-control" name="Appointment[date]">
  392 +
  393 + <p class="help-block help-block-error"></p>
  394 + </div>
  395 + <div class="datepicker-wr">
  396 + <div id="datepicker"></div>
  397 + </div>
  398 + <div class="form-group field-appointment-time">
  399 + <div class="on_input_"></div>
  400 + <label class="control-label" for="appointment-service">Время</label>
  401 + <input type="text" id="appointment-time" class="form-control" name="Appointment[time]">
  402 +
  403 + <p class="help-block help-block-error"></p>
  404 + </div>
  405 + <div class="form-group field-appointment-service">
  406 + <div class="on_input_"></div>
  407 + <label class="control-label" for="appointment-service">Услуга</label>
  408 + <input type="text" id="appointment-service" class="form-control" name="Appointment[service]">
  409 +
  410 + <p class="help-block help-block-error"></p>
  411 + </div>
  412 + <p class="text-center">
  413 + <button type="submit" class="send-form btn btn-lg btn-template-primary">Отправить</button>
  414 + </p>
  415 + </form>
  416 +
  417 + </div>
412 </div> 418 </div>
413 -  
414 - <!-- *** appointment MODAL END *** -->  
415 -  
416 - 419 + <div class="overlay-new"></div>
  420 + </div>
  421 +
  422 + <!-- *** appointment MODAL END *** -->
  423 +
  424 +
417 <!-- *** FeedBack MODAL *** 425 <!-- *** FeedBack MODAL ***
418 _________________________________________________________ --> 426 _________________________________________________________ -->
419 <div class="forms_" id="feedback-modal" aria-labelledby="Login" style="display:none;" aria-hidden="true"> 427 <div class="forms_" id="feedback-modal" aria-labelledby="Login" style="display:none;" aria-hidden="true">
420 - <div class="forms_wr_">  
421 - <div class="modal-header">  
422 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>  
423 - <h3 class="modal-title" id="Login">Обратная связь</h3>  
424 - </div>  
425 - <div class="modal-body">  
426 -  
427 - <?php $form = ActiveForm::begin(  
428 - [  
429 - 'id' => 'feedback-form',  
430 - 'method' => 'POST',  
431 - 'action' => '/site/feedback',  
432 - ]  
433 - ); ?>  
434 -  
435 - <?= $form->field($feedback, 'name')  
436 - ->textInput(); ?>  
437 -  
438 - <?= $form->field($feedback, 'email')  
439 - ->textInput(); ?>  
440 -  
441 - <?= $form->field($feedback, 'phone')  
442 - ->textInput(); ?>  
443 -  
444 - <?= $form->field($feedback, 'message')  
445 - ->textarea(  
446 - [  
447 - 'rows' => 4,  
448 - ]  
449 - ); ?>  
450 -  
451 - <p class="text-center">  
452 - <?= Html::submitButton(  
453 - 'Отправить',  
454 - [  
455 - 'class' => 'send-form btn btn-lg btn-template-primary',  
456 - ]  
457 - ) ?>  
458 - </p>  
459 -  
460 - <?php ActiveForm::end(); ?>  
461 -  
462 - </div> 428 + <div class="forms_wr_">
  429 + <div class="modal-header">
  430 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>
  431 + <h3 class="modal-title" id="Login">Обратная связь</h3>
  432 + </div>
  433 + <div class="modal-body">
  434 +
  435 + <?php $form = ActiveForm::begin(
  436 + [
  437 + 'id' => 'feedback-form',
  438 + 'method' => 'POST',
  439 + 'action' => '/site/feedback',
  440 + ]
  441 + ); ?>
  442 +
  443 + <?= $form->field($feedback, 'name')
  444 + ->textInput(); ?>
  445 +
  446 + <?= $form->field($feedback, 'email')
  447 + ->textInput(); ?>
  448 +
  449 + <?= $form->field($feedback, 'phone')
  450 + ->textInput(); ?>
  451 +
  452 + <?= $form->field($feedback, 'message')
  453 + ->textarea(
  454 + [
  455 + 'rows' => 4,
  456 + ]
  457 + ); ?>
  458 +
  459 + <p class="text-center">
  460 + <?= Html::submitButton(
  461 + 'Отправить',
  462 + [
  463 + 'class' => 'send-form btn btn-lg btn-template-primary',
  464 + ]
  465 + ) ?>
  466 + </p>
  467 +
  468 + <?php ActiveForm::end(); ?>
  469 +
463 </div> 470 </div>
464 - <div class="overlay-new"></div> 471 + </div>
  472 + <div class="overlay-new"></div>
465 </div> 473 </div>
466 474
467 <!-- *** FeedBack MODAL END *** --> 475 <!-- *** FeedBack MODAL END *** -->
@@ -469,19 +477,19 @@ _________________________________________________________ --&gt; @@ -469,19 +477,19 @@ _________________________________________________________ --&gt;
469 <!-- *** FeedBack MODAL *** 477 <!-- *** FeedBack MODAL ***
470 _________________________________________________________ --> 478 _________________________________________________________ -->
471 <div class="success_" id="success-modal" aria-labelledby="Success" aria-hidden="true"> 479 <div class="success_" id="success-modal" aria-labelledby="Success" aria-hidden="true">
472 - <div class="forms_wr_">  
473 - <div class="modal-header">  
474 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>  
475 - <h3 class="modal-title" id="Success">Отправлено</h3>  
476 - </div>  
477 - <div class="modal-body">  
478 -  
479 - <p>Thank for your reply, we will call you, maybe.</p>  
480 - <p class="text-center">  
481 - <button type="button" class="btn btn-template-primary" data-dismiss="modal">Закрыть</button>  
482 - </p>  
483 - </div> 480 + <div class="forms_wr_">
  481 + <div class="modal-header">
  482 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>
  483 + <h3 class="modal-title" id="Success">Отправлено</h3>
484 </div> 484 </div>
  485 + <div class="modal-body">
  486 +
  487 + <p>Thank for your reply, we will call you, maybe.</p>
  488 + <p class="text-center">
  489 + <button type="button" class="btn btn-template-primary" data-dismiss="modal">Закрыть</button>
  490 + </p>
  491 + </div>
  492 + </div>
485 </div> 493 </div>
486 494
487 <!-- *** FeedBack MODAL END *** --> 495 <!-- *** FeedBack MODAL END *** -->
@@ -584,7 +592,7 @@ _________________________________________________________ --&gt; @@ -584,7 +592,7 @@ _________________________________________________________ --&gt;
584 <!-- /#footer --> 592 <!-- /#footer -->
585 593
586 <!-- *** FOOTER END *** --> 594 <!-- *** FOOTER END *** -->
587 - 595 +
588 <span id="back-to-top" title="Back to top"><i class="fa fa-arrow-up"></i></span> 596 <span id="back-to-top" title="Back to top"><i class="fa fa-arrow-up"></i></span>
589 597
590 </div> 598 </div>
frontend/views/site/comment/artbox_comment_form.php 0 → 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use artbox\webcomment\models\RatingModel;
  4 + use yii\base\Model;
  5 + use yii\helpers\Html;
  6 + use yii\helpers\Url;
  7 + use yii\web\View;
  8 + use yii\widgets\ActiveForm;
  9 +
  10 + /**
  11 + * @var CommentModel $comment_model
  12 + * @var array $form_params
  13 + * @var Model $model
  14 + * @var string $formId
  15 + * @var View $this
  16 + * @var RatingModel|NULL $rating_model
  17 + */
  18 + $form = ActiveForm::begin(
  19 + [
  20 + 'id' => $formId,
  21 + 'action' => Url::to(
  22 + [
  23 + 'artbox-comment/default/create',
  24 + 'entity' => $comment_model->encryptedEntity,
  25 + ]
  26 + ),
  27 + ]
  28 + );
  29 +?>
  30 + <div class="form-comm-wr">
  31 + <?php
  32 + if (!empty($rating_model)) {
  33 + ?>
  34 + <div class="input_bl stars-wr_">
  35 + <?php
  36 + echo $form->field($rating_model, 'value', [ 'enableClientValidation' => false ])
  37 + ->hiddenInput()
  38 + ->label(false);
  39 + echo Html::tag(
  40 + 'div',
  41 + '',
  42 + [
  43 + 'class' => 'rateit',
  44 + 'data-rateit-backingfld' => '#' . Html::getInputId($rating_model, 'value'),
  45 + ]
  46 + );
  47 + ?>
  48 + </div>
  49 + <?php
  50 + }
  51 + if (\Yii::$app->user->isGuest) {
  52 + echo $form->field($comment_model, 'username', [ 'options' => [ 'class' => 'form-group input_bl' ] ])
  53 + ->textInput();
  54 + echo $form->field($comment_model, 'email', [ 'options' => [ 'class' => 'form-group input_bl' ] ])
  55 + ->textInput();
  56 + }
  57 + echo $form->field($comment_model, 'text', [ 'options' => [ 'class' => 'form-group input_bl area_bl' ] ])
  58 + ->textarea();
  59 + echo Html::tag(
  60 + 'div',
  61 + Html::submitButton(
  62 + Yii::t('app', 'Submit comment')
  63 + ),
  64 + [ 'class' => 'input_bl submit_btn' ]
  65 + );
  66 + ?>
  67 + </div>
  68 +<?php
  69 + ActiveForm::end();
  70 +?>
0 \ No newline at end of file 71 \ No newline at end of file
frontend/views/site/comment/artbox_comment_item.php 0 → 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use yii\helpers\Html;
  4 + use yii\helpers\Url;
  5 + use yii\widgets\ListView;
  6 +
  7 + /**
  8 + * @var CommentModel $model
  9 + * @var mixed $key
  10 + * @var int $index
  11 + * @var ListView $widget
  12 + * @var string $display_name
  13 + * @var array $more
  14 + */
  15 +
  16 +?>
  17 +
  18 +<div class="comments-wr">
  19 + <div class="artbox_item_info">
  20 + <div class="user-ico">
  21 + <?php
  22 + echo mb_substr($model->username, 0,1);
  23 + ?>
  24 + </div>
  25 + <div class="user_data" itemprop="datePublished">
  26 + <?php
  27 + echo date('d.m.Y', $model->created_at);
  28 + ?>
  29 + </div>
  30 + <div class="user_name" itemprop="author">
  31 + <?php
  32 + $nameField = $display_name;
  33 + echo $model->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
  34 + ?>
  35 + </div>
  36 + <?php
  37 + if (!empty($model->rating)) {
  38 + ?>
  39 + <div class="user_rating" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
  40 + <span itemprop="worstRating" style="display: none">1</span>
  41 + <span itemprop="ratingValue" style="display: none"><?php echo $model->rating->value; ?></span>
  42 + <span itemprop="bestRating" style="display: none">5</span>
  43 + <div class="rateit" data-rateit-value="<?php echo $model->rating->value; ?>" data-rateit-ispreset="true" data-rateit-readonly="true"></div>
  44 + </div>
  45 + <?php
  46 + }
  47 + ?>
  48 + <div class="user_txt" itemprop="description">
  49 + <?php
  50 + echo $model->text;
  51 + ?>
  52 + </div>
  53 + </div>
  54 + <div class="artbox_item_tools comment-panel">
  55 + <?php
  56 + if (!\Yii::$app->user->isGuest && $reply && \Yii::$app->user->id != $model->customer_id) {
  57 + ?>
  58 + <a href="" class="btn-comm-answer" data-action="reply"><?php echo \Yii::t(
  59 + 'artbox-comment',
  60 + 'Ответить'
  61 + ); ?></a>
  62 + <?php
  63 + }
  64 + if (!\Yii::$app->user->isGuest && \Yii::$app->user->id == $model->customer_id && $delete) {
  65 + ?>
  66 + <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to(
  67 + [
  68 + 'artbox-comment/default/delete',
  69 + 'id' => $model->id,
  70 + ]
  71 + ); ?>"><?php echo \Yii::t('artbox-comment', 'Удалить'); ?></a>
  72 + <?php
  73 + }
  74 + // Like / dislike to be done
  75 + /*
  76 + ?>
  77 + <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
  78 + 'artbox-comment/default/like',
  79 + 'id' => $model->artbox_comment_id,
  80 + ]); ?>">Like</a>
  81 + <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
  82 + 'artbox-comment/default/dislike',
  83 + 'id' => $model->artbox_comment_id,
  84 + ]); ?>">Dislike</a>
  85 + <?php
  86 + */
  87 + ?>
  88 + <div class="artbox_item_reply"></div>
  89 + </div>
  90 +</div>
  91 +<div class="artbox_children_container">
  92 + <?php
  93 + if (!empty($model->children)) {
  94 + foreach ($model->children as $index => $child) {
  95 + ?>
  96 + <div class="artbox_child_container comment-answer" data-key="<?php echo $child->id; ?>">
  97 + <div class="artbox_child_info">
  98 + <div class="user-ico">
  99 + <?php
  100 + echo Html::img('/img/no-image.png');
  101 + ?>
  102 + </div>
  103 + <div class="user_data">
  104 + <?php
  105 + echo date('d.m.Y', $child->created_at);
  106 + ?>
  107 + </div>
  108 + <div class="user_name">
  109 + <?php
  110 + $nameField = $display_name;
  111 + if (!empty($child->customer)) {
  112 + echo $child->customer->$nameField;
  113 + } else {
  114 + echo $child->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
  115 + }
  116 + ?>
  117 + </div>
  118 + <div class="user_txt">
  119 + <?php
  120 + echo $child->text;
  121 + ?>
  122 + </div>
  123 + </div>
  124 + <div class="artbox_child_tools comment-panel">
  125 + <?php
  126 + if (!\Yii::$app->user->isGuest && $reply && \Yii::$app->user->id != $child->customer_id) {
  127 + ?>
  128 + <a href="" class="btn-comm-answer" data-action="reply"><?php echo \Yii::t(
  129 + 'artbox-comment',
  130 + 'Ответить'
  131 + ); ?></a>
  132 + <?php
  133 + }
  134 + if (!\Yii::$app->user->isGuest && \Yii::$app->user->id == $child->customer_id && $delete) {
  135 + ?>
  136 + <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to(
  137 + [
  138 + 'artbox-comment/default/delete',
  139 + 'id' => $child->id,
  140 + ]
  141 + ); ?>"><?php echo \Yii::t('artbox-comment', 'Удалить'); ?></a>
  142 + <?php
  143 + }
  144 + /* Like /dislike to be done
  145 + ?>
  146 + <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
  147 + 'artbox-comment/default/like',
  148 + 'id' => $child->artbox_comment_id,
  149 + ]); ?>">Like</a>
  150 + <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
  151 + 'artbox-comment/default/dislike',
  152 + 'id' => $child->artbox_comment_id,
  153 + ]); ?>">Dislike</a>
  154 + <?php
  155 + */
  156 + ?>
  157 + <div class="artbox_child_reply"></div>
  158 + </div>
  159 + </div>
  160 + <?php
  161 + }
  162 + }
  163 + ?>
  164 +</div>
  165 +
  166 +
frontend/views/site/comment/artbox_comment_list.php 0 → 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use yii\base\Model;
  4 + use yii\data\ActiveDataProvider;
  5 + use yii\helpers\Html;
  6 + use yii\web\View;
  7 + use yii\widgets\ListView;
  8 + use yii\widgets\Pjax;
  9 +
  10 + /**
  11 + * @var CommentModel $comment_model
  12 + * @var array $list_params
  13 + * @var array $item_options
  14 + * @var string $item_view
  15 + * @var Model $model
  16 + * @var ActiveDataProvider $comments
  17 + * @var View $this
  18 + * @var string $display_name
  19 + * @var boolean $reply ,
  20 + * @var boolean $delete
  21 + */
  22 + Pjax::begin();
  23 + if(( $success = \Yii::$app->session->getFlash('artbox_comment_success') ) != NULL) {
  24 + echo Html::tag('p', $success);
  25 + }
  26 + echo ListView::widget([
  27 + 'dataProvider' => $comments,
  28 + 'itemOptions' => $item_options,
  29 + 'itemView' => $item_view,
  30 + 'emptyText' => false,
  31 + 'summary' => '',
  32 + 'viewParams' => [
  33 + 'display_name' => $display_name,
  34 + 'reply' => $reply,
  35 + 'delete' => $delete,
  36 + 'more' => $more,
  37 + 'last' => $comments->count,
  38 + ],
  39 + 'beforeItem' => function ($model, $key, $index, $widget) use ($more, $comments) {
  40 + if ($more['key'] == $index and $more['show_'] ){
  41 +
  42 + return "<a id='show_more_link' style='cursor:pointer'>Показать еще</a>
  43 + <div id='show_more' style='display: none'>";
  44 + }
  45 + },
  46 + 'afterItem' => function ($model, $key, $index, $widget) use ($more, $comments) {
  47 + if ($index == ($comments->count-1) and $more['show_'] and $more['key'] < $comments->count){
  48 +
  49 + return "<a id='hide_more_link' style='cursor:pointer'>Скрыть комментарии</a></div>";
  50 + }
  51 +}
  52 +
  53 +
  54 + ]);
  55 + Pjax::end();
  56 +
0 \ No newline at end of file 57 \ No newline at end of file
frontend/views/site/comment/artbox_comment_reply.php 0 → 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use yii\base\Model;
  4 + use yii\helpers\Html;
  5 + use yii\helpers\Url;
  6 + use yii\web\View;
  7 + use yii\widgets\ActiveForm;
  8 +
  9 + /**
  10 + * @var CommentModel $comment_model
  11 + * @var array $form_params
  12 + * @var Model $model
  13 + * @var string $formId
  14 + * @var View $this
  15 + */
  16 + $text_input_id = Html::getInputId($comment_model, 'text') . '-reply';
  17 + $parent_id_input_id = Html::getInputId($comment_model, 'parent_id') . '-reply';
  18 + $text_input_selectors = [
  19 + 'container' => '.field-' . $text_input_id,
  20 + 'input' => '#' . $text_input_id,
  21 + ];
  22 + $parent_id_input_selectors = [
  23 + 'container' => '.field-' . $parent_id_input_id,
  24 + 'input' => '#' . $parent_id_input_id,
  25 + ];
  26 + $form = ActiveForm::begin([
  27 + 'id' => $formId . '-reply',
  28 + 'action' => Url::to([
  29 + 'artbox-comment/default/create',
  30 + 'entity' => $comment_model->encryptedEntity,
  31 + ]),
  32 + ]);
  33 +?>
  34 + <div class="answer-form">
  35 + <?php
  36 + echo $form->field(
  37 + $comment_model,
  38 + 'parent_id',
  39 + [
  40 + 'selectors' => $parent_id_input_selectors,
  41 + 'inputOptions' => [
  42 + 'id' => $parent_id_input_id,
  43 + 'class' => 'form-control',
  44 + ],
  45 + ])
  46 + ->hiddenInput()
  47 + ->label(false);
  48 + echo $form->field($comment_model, 'text', [
  49 + 'selectors' => $text_input_selectors,
  50 + 'inputOptions' => [
  51 + 'id' => $text_input_id,
  52 + 'class' => 'form-control',
  53 + 'cols' => 30,
  54 + 'rows' => 10,
  55 + ],
  56 + ])
  57 + ->textarea();
  58 + echo Html::submitButton(Yii::t('artbox-comment', 'Submit'));
  59 + echo Html::button(Yii::t('artbox-comment', 'Cancel'), [ 'data-action' => 'reply-cancel' ]);
  60 + ?>
  61 + </div>
  62 +<?php
  63 + ActiveForm::end();
  64 +?>
0 \ No newline at end of file 65 \ No newline at end of file
frontend/views/site/comments.php 0 → 100644
  1 +<?php
  2 +
  3 + use artbox\webcomment\models\CommentModel;
  4 + use artbox\webcomment\widgets\CommentWidget;
  5 + use yii\web\View;
  6 +
  7 + /**
  8 + * @var View $this
  9 + * @var CommentModel $model
  10 + */
  11 +
  12 +?>
  13 +
  14 +<div>
  15 +
  16 + <?php
  17 + echo CommentWidget::widget(
  18 + [
  19 + 'model' => $model,
  20 + 'display_name' => 'name',
  21 + 'reply' => true,
  22 + 'delete' => false,
  23 + 'more' => [
  24 + 'show_' => true,
  25 + 'key' => 2,
  26 + ],
  27 + 'formView' => '@frontend/views/site/comment/artbox_comment_form',
  28 + 'listView' => '@frontend/views/site/comment/artbox_comment_list',
  29 + 'replyView' => '@frontend/views/site/comment/artbox_comment_reply',
  30 + 'itemView' => '@frontend/views/site/comment/artbox_comment_item',
  31 + ]
  32 + );
  33 + ?>
  34 +
  35 +</div>