Esempio n. 1
0
 static function getCurrent()
 {
     $cookies = \Yii::$app->response->cookies;
     if ($cookies->has('language')) {
         self::$current = Lang::getLangByUrl($cookies->get('language'));
     }
     if (self::$current === null) {
         self::$current = self::getDefaultLang();
     }
     return self::$current;
 }
Esempio n. 2
0
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'Improving LIVES', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
if (\frontend\models\User::isActive() || true) {
    $menuItems = [['label' => Yii::t('frontend', 'My Page'), 'items' => [['label' => Yii::t('frontend', 'Weight Tracker'), 'url' => ['/members/weight-tracker']], ['label' => Yii::t('frontend', 'Meal Plan'), 'url' => ['/members/meal-plan']]]], ['label' => Yii::t('frontend', 'PDFs'), 'url' => ['/members/pdfs']], ['label' => Yii::t('frontend', 'Recipes'), 'url' => ['/recipes/categories']], ['label' => Yii::t('frontend', 'Articles'), 'url' => ['/articles/categories']], ['label' => Yii::t('frontend', 'FAQ'), 'url' => ['/faq/categories']]];
}
if (Yii::$app->user->isGuest) {
    $menuItems[] = ['label' => Yii::t('frontend', 'Signup'), 'url' => ['/site/signup']];
    $menuItems[] = ['label' => Yii::t('frontend', 'Login'), 'url' => ['/site/login']];
} else {
    $menuItems[] = ['label' => Yii::t('frontend', 'Logout ({name})', ['name' => Yii::$app->user->identity->email]), 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
$menuItems[] = ['label' => Yii::t('frontend', Lang::getLangByUrl(Yii::$app->language)->name), 'items' => WLang::getItems()];
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
?>

    <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
        <?php 
echo Alert::widget();
?>
        <?php 
echo $content;
?>
        <?php