Commit 84cd230a9ae90f7c672dcb57a2b41ddb2749479d

Authored by Alex Savenko
2 parents ce505eb6 e05947e9

Merge branch 'master' of gitlab.artweb.com.ua:steska/clinica

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
... ... @@ -227,7 +227,10 @@
227 227 public function actionPage6(){
228 228 return $this->render('page6');
229 229 }
  230 +
230 231  
  232 +
  233 + # ะ’ะพะฟั€ะพั/ะพั‚ะฒะตั‚
231 234 public function actionQuestions($service_id = null){
232 235 Language::getCurrent();
233 236  
... ...
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="<?=Url::to(['alias' => $aliases['{"0":"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'])?>"><?=\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,35 @@
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 + if(strpos($item['url'],\Yii::$app->request->url)!==false)
  210 + {
  211 + $test[$key]['label']=$item['label'];
  212 + $test[$key]['options'] = [ 'class' => 'active' ];
  213 + $test[$key]['url']='/';
  214 + # die(var_dump($item));
  215 + }
  216 + else
  217 + {
  218 + $test[$key]['label']=$item['label'];
  219 + $test[$key]['url']=$item['url'];
  220 + }
  221 +
  222 + }
  223 +
  224 +
  225 + #var_dump(\Yii::$app->request->url);
  226 + # die(var_dump($test,Url::current()));
203 227 ?>
204 228 <?php echo Nav::widget(
205 229 [
206   - 'items' => $items,
  230 + 'items' => $test,
207 231 'activateItems' => false,
208 232 ]
209 233 ); ?>
... ... @@ -265,9 +289,9 @@
265 289 <div class="menu-second-mob">
266 290 <ul class="footer-menu">
267 291  
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>
  292 + <li><a href="<?= Url::to([ 'site/contact' ]) ?>"><?= \Yii::t('app', 'Contacts') ?></a></li>
  293 + <li><a href="/vtoroe-mnenie" class="new"><span><?= \Yii::t('app', 'Second thing') ?></span></a></li>
  294 + <li><a href="<?=Url::to(['site/questions'])?>"><?= \Yii::t('app', 'Quest/Answer') ?></a></li>
271 295 <li><a href="#"><?= \Yii::t('app', 'Callbacks') ?></a></li>
272 296 </ul>
273 297 </div>
... ... @@ -351,9 +375,9 @@
351 375 <div class="col-xs-9 col-sm-2">
352 376 <ul class="footer-menu">
353 377 <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>
  378 + <li><a href="<?= Url::to([ 'site/contact' ]);?>" ><?=\Yii::t('app','Contacts');?></a></li>
  379 + <li><a href="/vtoroe-mnenie" class="new"><span><?=\Yii::t('app','Second thing');?></span></a></li>
  380 + <li><a href="<?=Url::to(['site/questions'])?>"><?=\Yii::t('app','Quest/Answer');?></a></li>
357 381 <li><a href="<?=Url::to(['site/comments'])?>"><?=\Yii::t('app','Callbacks');?></a></li>
358 382 </ul>
359 383 </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 } ?>
... ...