Commit 65a96fd3b356a648fba7378fb5b522f2eabb9174

Authored by Anastasia
2 parents 03ffbf5b 4ef198f9

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	frontend/views/layouts/main.php
backend/views/layouts/menu_items.php
... ... @@ -61,7 +61,7 @@
61 61  
62 62 ],
63 63 [
64   - 'label' => \Yii::t('app', 'Package Offers'),
  64 + 'label' => \Yii::t('app', 'Package offerings'),
65 65 'url' => [ '/package/index' ],
66 66  
67 67 ],
... ...
common/messages/ru/app.php
... ... @@ -24,7 +24,7 @@ return [
24 24 'All callbacks' =>'Все отзывы',
25 25 'All questions' =>'Все вопросы',
26 26 'All categories' =>'Все рубрики',
27   -
  27 + 'Doctors' =>'Врачи',
28 28  
29 29  
30 30 'Ua short valute' =>'грн',
... ... @@ -47,12 +47,12 @@ return [
47 47 'Asc question' =>'Задать вопрос',
48 48 'Request password reset' =>'Запрос на восстановление пароля',
49 49  
50   -
  50 + 'Comments' =>'Коментарии',
51 51 'Buy' =>'Купить',
52 52 'Contacts' =>'Контакты',
53 53  
54 54  
55   -
  55 + 'Label' =>'Название',
56 56 'ours clients' =>'наших клиентов',
57 57  
58 58  
... ... @@ -90,7 +90,7 @@ return [
90 90 'Slide Down' =>'свернуть',
91 91 'Save' =>'Сохранить',
92 92 'Message' =>'Сообщение',
93   -
  93 + 'Slides' =>'Слайды',
94 94  
95 95 'Phone' =>'Телефон',
96 96  
... ...
common/models/blog/TagLang.php
... ... @@ -50,7 +50,7 @@
50 50 'id' => 'ID',
51 51 'blog_tag_id' => 'Blog Tag ID',
52 52 'language_id' => 'Language ID',
53   - 'label' => \Yii::t('core', 'Label'),
  53 + 'label' => \Yii::t('app', 'Label'),
54 54 ];
55 55 }
56 56  
... ...
frontend/components/UrlManager.php
... ... @@ -62,6 +62,7 @@
62 62 // $this->checkRedirect($request->url);
63 63  
64 64 $request = $this->parseLanguage($request);
  65 +
65 66 /**
66 67 * @var Alias $alias
67 68 */
... ... @@ -111,8 +112,11 @@
111 112 $params,
112 113 ];
113 114 }
114   -
115   - return parent::parseRequest($request);
  115 + $request=parent::parseRequest($request);
  116 + $request[0]=rtrim($request[0],'/');
  117 +
  118 +
  119 + return $request;
116 120 }
117 121  
118 122 /**
... ... @@ -122,6 +126,7 @@
122 126 */
123 127 public function createUrl($params)
124 128 {
  129 +
125 130 if ($this->hideDefaultLanguagePrefix && ( $this->languages->getCurrent(
126 131 )->url == $this->languages->getDefault()->url )) {
127 132 $prefix = '';
... ... @@ -136,7 +141,10 @@
136 141 return $prefix . '/' . $params[ 'alias' ][ 'value' ];
137 142 }
138 143 }
139   -
  144 +
  145 +
  146 +
  147 +
140 148 return $prefix . parent::createUrl($params);
141 149 }
142 150  
... ... @@ -153,7 +161,7 @@
153 161 if (in_array($split[ 0 ], array_keys($this->languages->getActive()))) {
154 162 if ($this->hideDefaultLanguagePrefix && ( $split[ 0 ] == $this->languages->getDefault()->url )) {
155 163 unset($split[ 0 ]);
156   -
  164 +
157 165 \Yii::$app->response->redirect('/' . implode('/', $split), 301)
158 166 ->send();
159 167 \Yii::$app->end();
... ... @@ -188,6 +196,7 @@
188 196 */
189 197 protected function checkRedirect(string $url)
190 198 {
  199 +
191 200 // $redirect = Redirect::find()
192 201 // ->where(
193 202 // [
... ...
frontend/controllers/SiteController.php
... ... @@ -80,6 +80,7 @@
80 80 )->orderBy([ new Expression('sort ASC NULLS LAST') ])
81 81 ->all();
82 82 $comments = Comment::find()->where(['status' => true, 'on_main' => true])->limit(6)->all();
  83 +
83 84 $package = Package::find()->with(['language.alias'])->where(['status' => true])->orderBy('sort')->limit(3)->all();
84 85 $settings = Settings::getInstance();
85 86 return $this->render('index', [
... ... @@ -227,7 +228,10 @@
227 228 public function actionPage6(){
228 229 return $this->render('page6');
229 230 }
  231 +
230 232  
  233 +
  234 + # Вопрос/ответ
231 235 public function actionQuestions($service_id = null){
232 236 Language::getCurrent();
233 237  
... ... @@ -269,11 +273,15 @@
269 273 }
270 274  
271 275 public function actionComments($service_id = null){
272   -
  276 +
273 277 if (\Yii::$app->request->isAjax){
274 278 Yii::$app->response->format = Response::FORMAT_JSON;
275 279 $model = new Comment();
276   - if ($model->load(\Yii::$app->request->post()) and $model->save()){
  280 + #if ($model->load(\Yii::$app->request->post()) and $model->save()){
  281 + if ($model->load(\Yii::$app->request->post())){
  282 + if(!$model->entity_id)$model->entity_id=0;
  283 + $model->entity=Service::className();
  284 + $model->save();
277 285 return [
278 286 'status' => true,
279 287 'message' => 'Спасибо за Ваш отзыв. После проверки модератором он появиться на сайте'
... ... @@ -285,14 +293,22 @@
285 293 ];
286 294 }
287 295 }
  296 +
  297 +
  298 + # подкоректировал логику для сохранрения в БД/выдачи вопросов с категории "Общие вопросы"
  299 + # закрепил за ними entity_id=0
  300 + if($service_id==null)$service_id=0;
288 301 $dataProvider = new ActiveDataProvider([
289   - 'query' => Comment::find()->where(['status' => true])->andWhere(['entity' => Service::className()])->andFilterWhere(['entity_id' => $service_id]),
  302 + 'query' => Comment::find()
  303 + ->where(['status' => true])
  304 + ->andWhere(['entity' => Service::className()])
  305 + ->andFilterWhere(['entity_id' => $service_id]),//'SELECT * FROM \"comment\" WHERE (\"status\"=TRUE) AND (\"entity\"=\'common\\models\\Service\')'
290 306 'pagination' => [
291 307 'pageSize' => 10,
292 308 ],
293 309 ]);
294 310 $services = Service::find()->where(['status' => true])->andWhere(['parent_id' => null])->all();
295   -
  311 +
296 312 return $this->render('comments', [
297 313 'dataProvider' => $dataProvider,
298 314 'services' => $services,
... ...
frontend/helpers/Url.php
... ... @@ -22,9 +22,9 @@
22 22 $languages = \Yii::$container->get($languagesClass);
23 23  
24 24 $url = '/' . $languages->getCurrent()->url;
25   -
  25 +
26 26 $urlManager = \Yii::$app->urlManager;
27   -
  27 +
28 28 if (( $languages->getCurrent()->id === $languages->getDefault(
29 29 )->id ) && $urlManager->hideDefaultLanguagePrefix) {
30 30 $url = '/';
... ...
frontend/views/layouts/main.php
... ... @@ -79,7 +79,7 @@
79 79 <!DOCTYPE html >
80 80 <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>">
81 81 <head>
82   -
  82 +
83 83 <meta charset="<?= \Yii::$app->charset ?>">
84 84 <meta name="viewport" content="width=device-width">
85 85 <link type="image/x-icon" href="favicon.ico" rel="icon">
... ... @@ -157,8 +157,8 @@
157 157 </div>
158 158  
159 159 <ul class="hidden-xs hidden-sm">
160   - <li><a href="#" class="new"><span> <?=\Yii::t('app','Second thing')?> </span></a></li>
161   - <li><a href="<?=(isset($aliases['{"0":"site/questions"}'])) ? Url::to(['alias' => $aliases['{"0":"site/questions"}']]): Url::to(['site/questions'])?>"><?=\Yii::t('app','Quest/Answer')?></a></li>
  160 + <li><a href="/vtoroe-mnenie" class="new"><span> <?=\Yii::t('app','Second thing')?> </span></a></li>
  161 + <li><a href="<?=(isset($aliases['{"0":"site/questions"}'])) ?Url::to(['alias' => $aliases['{"0":"site/questions"}']]): Url::to(['site/questions']): Url::to(['site/questions'])?>"><?=\Yii::t('app','Quest/Answer')?></a></li>
162 162 <li><a href="<?=Url::to(['site/comments'])?>"><?=\Yii::t('app','Callbacks')?></a></li>
163 163 </ul>
164 164 <!-- -->
... ... @@ -199,11 +199,40 @@
199 199 $items[] = [
200 200 'label' => \Yii::t('app', 'Package offerings'),
201 201 'url' => Url::to(['package/index']),
202   - ]
  202 + ];
  203 +
  204 + # определяю, кому из итемов присвоить class="active'
  205 + $itemKey=0;
  206 + $test=[];
  207 + foreach ($items as $key => $item)
  208 + {
  209 +
  210 + if(strpos(\Yii::$app->request->url,$item['url'])!==false )
  211 + {
  212 + $test[$key]['label']=$item['label'];
  213 + $test[$key]['options'] = [ 'class' => 'active' ];
  214 +
  215 + }
  216 + elseif( \Yii::$app->request->url=='/' && $item['label']==\Yii::t('app', 'Prices'))
  217 + {
  218 + $test[$key]['label']=$item['label'];
  219 + $test[$key]['options'] = [ 'class' => 'active' ];
  220 + $test[$key]['url']= Url::to(['site/prices']);
  221 +
  222 + }
  223 + else
  224 + {
  225 + $test[$key]['label']=$item['label'];
  226 + $test[$key]['url']=$item['url'];
  227 + }
  228 +
  229 + }
  230 +
  231 +
203 232 ?>
204 233 <?php echo Nav::widget(
205 234 [
206   - 'items' => $items,
  235 + 'items' => $test,
207 236 'activateItems' => false,
208 237 ]
209 238 ); ?>
... ... @@ -265,9 +294,11 @@
265 294 <div class="menu-second-mob">
266 295 <ul class="footer-menu">
267 296  
268   - <li><a href="<?= Url::to([ 'site/contacts' ]) ?>"><?= \Yii::t('app', 'Contacts') ?></a></li>
269   - <li><a href="#" class="new"><span><?= \Yii::t('app', 'Second thing') ?></span></a></li>
270   - <li><a href="#"><?= \Yii::t('app', 'Quest/Answer') ?></a></li>
  297 + <li><a href="<?= Url::to([ 'site/contact' ]) ?>"><?= \Yii::t('app', 'Contacts') ?></a></li>
  298 + <li><a href="/vtoroe-mnenie" class="new"><span><?= \Yii::t('app', 'Second thing') ?></span></a></li>
  299 + <li><a href="<?=(isset($aliases['{"0":"site/questions"}'])) ?
  300 + Url::to(['alias' => $aliases['{"0":"site/questions"}']]) : Url::to(['site/questions'])?>">
  301 + <?= \Yii::t('app', 'Quest/Answer') ?></a></li>
271 302 <li><a href="#"><?= \Yii::t('app', 'Callbacks') ?></a></li>
272 303 </ul>
273 304 </div>
... ... @@ -351,9 +382,10 @@
351 382 <div class="col-xs-9 col-sm-2">
352 383 <ul class="footer-menu">
353 384 <li><a href="<?=Url::to(['site/about'])?>"><?=\Yii::t('app','About us')?></a></li>
354   - <li><a href="#" ><?=\Yii::t('app','Contacts');?></a></li>
355   - <li><a href="<?=Url::to(['site/questions'])?>" class="new"><span><?=\Yii::t('app','Second thing');?></span></a></li>
356   - <li><a href="<?=Url::to(['site/comments'])?>"><?=\Yii::t('app','Quest/Answer');?></a></li>
  385 + <li><a href="<?= Url::to([ 'site/contact' ]);?>" ><?=\Yii::t('app','Contacts');?></a></li>
  386 + <li><a href="/vtoroe-mnenie" class="new"><span><?=\Yii::t('app','Second thing');?></span></a></li>
  387 + <li><a href="<?=(isset($aliases['{"0":"site/questions"}'])) ?
  388 + Url::to(['alias' => $aliases['{"0":"site/questions"}']]) : Url::to(['site/questions'])?>"><?=\Yii::t('app','Quest/Answer');?></a></li>
357 389 <li><a href="<?=Url::to(['site/comments'])?>"><?=\Yii::t('app','Callbacks');?></a></li>
358 390 </ul>
359 391 </div>
... ...
frontend/views/service/view.php
... ... @@ -63,7 +63,13 @@
63 63 if (($model->id == $service->id or $model->parent_id == $service->id) and !empty($service->services)) {?>
64 64 <ul>
65 65 <?php foreach ($service->services as $item){?>
66   - <li class="<?=($model->id == $item->id ? 'active' : '')?>"><a href="<?=Url::to(['alias' => $item->language->alias])?>"><?=$item->title?></a></li>
  66 + <?php if($model->id == $item->id) : ?>
  67 + <li class="active"><a ><?=$item->title?></a></li>
  68 +
  69 + <?php else: ?>
  70 + <li class=""><a href="<?=Url::to(['alias' => $item->language->alias])?>"><?=$item->title?></a></li>
  71 + <?php endif;?>
  72 +
67 73 <?php }?>
68 74 </ul>
69 75 <?php } ?>
... ...