예제 #1
0
 /**
  * @return string
  */
 public function actionLogin($username)
 {
     /* @var $user User */
     $user = User::findByUsername($username);
     Yii::$app->user->login($user, 0);
     if (Yii::$app->user->can('AdmRoot') || Yii::$app->user->can('AdmAdmin')) {
         return $this->redirect(['/adm/user/update']);
     }
     return $this->redirect(Url::getLangUrl());
 }
예제 #2
0
use yii\helpers\Html;
use app\helpers\Url;
use yii\widgets\Breadcrumbs;
/* @var $this \yii\web\View */
/* @var $content string */
$appAsset = AppAsset::register($this);
/* @var $i18n \pavlinter\translation\I18N */
$i18n = Yii::$app->getI18n();
\app\modules\admunderconst\Module::loadUnderConstruction($this);
$menus = Page::find()->with(['translations', 'childs' => function ($q) {
    $q->andWhere(['active' => 1, 'visible' => 1]);
}])->where(['id_parent' => [1, 2, 3], 'active' => 1, 'visible' => 1])->orderBy(['weight' => SORT_ASC])->all();
$Menu1 = [];
$Menu2 = [];
$Menu3 = [];
$baseUrl = Url::getLangUrl();
foreach ($menus as $menu) {
    $item = [];
    $item['label'] = $menu->name;
    if ($menu->type === 'main') {
        $item['url'] = $baseUrl;
    } else {
        $item['url'] = $menu->url();
    }
    if ($menu->childs) {
        foreach ($menu->childs as $child) {
            $item['items'][] = ['label' => $child->name, 'url' => $child->url()];
        }
    }
    if ($menu->id_parent == 1) {
        $Menu1[] = $item;