Kaynağa Gözat

Mise en place de l'environnement de production

master
keun 8 yıl önce
ebeveyn
işleme
864541e214
3 değiştirilmiş dosya ile 55 ekleme ve 8 silme
  1. +2
    -6
      backend/views/layouts/main.php
  2. +50
    -0
      common/helpers/Url.php
  3. +3
    -2
      frontend/views/layouts/main.php

+ 2
- 6
backend/views/layouts/main.php Dosyayı Görüntüle

use common\models\User ; use common\models\User ;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper ; use yii\helpers\ArrayHelper ;
use common\helpers\Url ;


/* @var $this \yii\web\View */ /* @var $this \yii\web\View */
/* @var $content string */ /* @var $content string */
'linkOptions' => ['data-method' => 'post','title' => 'Déconnexion'] 'linkOptions' => ['data-method' => 'post','title' => 'Déconnexion']
]; ];
if(Yii::$app->getRequest()->serverName == 'localhost')
$url = '../../frontend/web/' ;
else
$url = 'http://www.laboiteapain.net/' ;
$menuItems[] = [ $menuItems[] = [
'label' => '<span class="retour-site">Retour sur le site</span>', 'label' => '<span class="retour-site">Retour sur le site</span>',
'url' => $url,
'url' => Url::frontend(),
]; ];
} }
echo Nav::widget([ echo Nav::widget([

+ 50
- 0
common/helpers/Url.php Dosyayı Görüntüle

<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

namespace common\helpers;

class Url
{
public static function frontend()
{
$server_name = Yii::$app->getRequest()->serverName ;
if($server_name == 'localhost')
{
return '../../frontend/web/' ;
}
elseif($server_name == 'www.laboiteapain.net' ||
$server_name == 'boulanger.laboiteapain.net')
{
return 'http://www.laboiteapain.net/' ;
}
elseif($server_name == 'dev.laboiteapain.net' ||
$server_name == 'boulanger-dev.laboiteapain.net')
{
return 'http://dev.laboiteapain.net/' ;
}
}
public static function backend()
{
$server_name = Yii::$app->getRequest()->serverName ;
if($server_name == 'localhost')
{
return '../../backend/web/' ;
}
elseif($server_name == 'www.laboiteapain.net' ||
$server_name == 'boulanger.laboiteapain.net')
{
return 'http://boulanger.laboiteapain.net/' ;
}
elseif($server_name == 'dev.laboiteapain.net' ||
$server_name == 'boulanger-dev.laboiteapain.net')
{
return 'http://boulanger-dev.laboiteapain.net/' ;
}
}
}

+ 3
- 2
frontend/views/layouts/main.php Dosyayı Görüntüle

use yii\widgets\Breadcrumbs; use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset; use frontend\assets\AppAsset;
use frontend\widgets\Alert; use frontend\widgets\Alert;
use common\helpers\Url ;


/* @var $this \yii\web\View */ /* @var $this \yii\web\View */
/* @var $content string */ /* @var $content string */
<li><a <?php if(Yii::$app->controller->id == 'commande' && Yii::$app->controller->action->id == 'create'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('commande/create') ; ?>"><span class="glyphicon glyphicon-plus"></span> Commander</a></li> <li><a <?php if(Yii::$app->controller->id == 'commande' && Yii::$app->controller->action->id == 'create'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('commande/create') ; ?>"><span class="glyphicon glyphicon-plus"></span> Commander</a></li>
<li><a <?php if(Yii::$app->controller->id == 'user' && Yii::$app->controller->action->id == 'update'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('user/update') ; ?>"><span class="glyphicon glyphicon-user"></span> Profil</a></li> <li><a <?php if(Yii::$app->controller->id == 'user' && Yii::$app->controller->action->id == 'update'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('user/update') ; ?>"><span class="glyphicon glyphicon-user"></span> Profil</a></li>
<li><a id="link-logout" href="<?php echo Yii::$app->urlManager->createUrl('site/logout') ; ?>"><span class="glyphicon glyphicon-off"></span> Déconnexion<br /><span class="nom"><?php echo Html::encode(Yii::$app->user->identity->prenom .' '. substr(strtoupper(Yii::$app->user->identity->nom), 0, 1).'.') ; ?></span></a></li> <li><a id="link-logout" href="<?php echo Yii::$app->urlManager->createUrl('site/logout') ; ?>"><span class="glyphicon glyphicon-off"></span> Déconnexion<br /><span class="nom"><?php echo Html::encode(Yii::$app->user->identity->prenom .' '. substr(strtoupper(Yii::$app->user->identity->nom), 0, 1).'.') ; ?></span></a></li>
<?php if(Yii::$app->user->identity->isBoulanger()): ?><li><a class="" id="link-espace-boulanger" href="<?php if(Yii::$app->getRequest()->serverName == 'localhost'): ?>../../backend/web/<?php else: ?>http://boulanger.laboiteapain.net<?php endif; ?>"><span class="glyphicon glyphicon-grain"></span> Espace boulanger</a></li><?php endif; ?>
<?php if(Yii::$app->user->identity->isBoulanger()): ?><li><a class="" id="link-espace-boulanger" href="<?php Url::backend(); ?>"><span class="glyphicon glyphicon-grain"></span> Espace boulanger</a></li><?php endif; ?>
<?php else: ?> <?php else: ?>
<li><a <?php if(Yii::$app->controller->id == 'site' && Yii::$app->controller->action->id == 'login'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('site/login') ; ?>"><span class="glyphicon glyphicon-log-in"></span> Connexion</a></li> <li><a <?php if(Yii::$app->controller->id == 'site' && Yii::$app->controller->action->id == 'login'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('site/login') ; ?>"><span class="glyphicon glyphicon-log-in"></span> Connexion</a></li>
<li><a <?php if(Yii::$app->controller->id == 'site' && Yii::$app->controller->action->id == 'signup'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('site/signup') ; ?>"><span class="glyphicon glyphicon-user"></span> Inscription</a></li> <li><a <?php if(Yii::$app->controller->id == 'site' && Yii::$app->controller->action->id == 'signup'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('site/signup') ; ?>"><span class="glyphicon glyphicon-user"></span> Inscription</a></li>
</ul> </ul>
</nav> </nav>
</div> </div>
</header>
</header>Yii::$app->getRequest()->serverName == 'localhost'
<div id="main"> <div id="main">
<section class="<?php if(!$is_home): ?>container<?php endif;?>" id="content"> <section class="<?php if(!$is_home): ?>container<?php endif;?>" id="content">
<?php if(Yii::$app->session->hasFlash('error')): ?> <?php if(Yii::$app->session->hasFlash('error')): ?>

Yükleniyor…
İptal
Kaydet