コード例 #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $session = Yii::$app->session;
     if (WebRecord::existsMoreWebRecords()) {
         if (!$session->has('web')) {
             $session->set('web', \Yii::$app->request->get('web', \Yii::$app->params['defaultWeb']));
         }
         if (!($this->web = WebRecord::findOne(FrontEndHelper::getWebIdFromTextId($session->get('web'))))) {
             $session->set('web', \Yii::$app->params['defaultWeb']);
             throw new NotFoundHttpException(Yii::t('front', 'The requested page does not exist.'));
         }
     } else {
         $this->redirect(['install/default/index']);
     }
     if (!$this->web) {
         $this->web = WebRecord::findOne(FrontEndHelper::getWebIdFromTextId($session->get('web')));
     }
     $session->set('web', null);
     $this->setWebTheme($this->web->theme);
     \Yii::$app->language = \Yii::$app->request->get('language', \Yii::$app->params['defaultLanguage']);
     $this->language = LanguageRecord::findOne(FrontEndHelper::getLanguageIdFromAcronym());
 }
コード例 #2
0
ファイル: _form.php プロジェクト: czechcamus/dasport
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'weburl')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'theme')->dropDownList(Yii::$app->params['themeOptions']);
?>

    <?php 
echo $form->field($model, 'boxes')->inline()->checkboxList([WebRecord::PROPERTY_MAIN => Yii::t('back', 'Main'), WebRecord::PROPERTY_ACTIVE => Yii::t('back', 'Active'), WebRecord::PROPERTY_PUBLIC => Yii::t('back', 'Public')], ['id' => 'modal-boxes', 'data-main' => (WebRecord::existsMoreWebRecords($model->isNewRecord ? true : false) && !$model->main) == true ? 0 : 1]);
?>

    <div class="form-group modal-footer">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('back', 'Create') : Yii::t('back', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        <button type="button" class="btn btn-default" data-dismiss="modal"><?php 
echo Yii::t('back', 'Close');
?>
</button>
    </div>

    <?php 
ActiveForm::end();
?>
コード例 #3
0
ファイル: main.php プロジェクト: czechcamus/dasport
    <title><?php 
echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
    <?php 
$this->beginBody();
?>
    <div class="wrap">
        <?php 
NavBar::begin(['brandLabel' => Html::img('@web/images/design/logo-albert5.png', ['alt' => Yii::t('back', 'Image') . ' - ' . Yii::t('back', 'Albert 5 logo')]), 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => Yii::t('back', 'Home'), 'url' => ['/site/index'], 'visible' => Yii::$app->user->can('manager')], ['label' => Yii::t('back', 'Content'), 'items' => [['label' => Yii::t('back', 'Articles'), 'url' => ['/article/index'], 'visible' => Yii::$app->user->can('user')], ['label' => Yii::t('back', 'Pages'), 'url' => ['/page/index'], 'visible' => Yii::$app->user->can('user')], '<li class="divider"></li>', ['label' => Yii::t('back', 'Menu items'), 'url' => ['/menu-item/index'], 'visible' => Yii::$app->user->can('manager')], '<li class="divider"></li>', ['label' => Yii::t('back', 'Categories'), 'url' => ['/category/index'], 'visible' => Yii::$app->user->can('manager')], ['label' => Yii::t('back', 'Galleries'), 'url' => ['/gallery/index'], 'visible' => Yii::$app->user->can('user')], '<li class="divider"></li>', ['label' => Yii::t('back', 'Polls'), 'url' => ['/poll/index'], 'visible' => Yii::$app->user->can('user')], '<li class="divider"></li>', ['label' => Yii::t('back', 'Images'), 'url' => ['/file/images'], 'visible' => Yii::$app->user->can('user')], ['label' => Yii::t('back', 'Files'), 'url' => ['/file/files'], 'visible' => Yii::$app->user->can('user')]], 'visible' => Yii::$app->user->can('user')], ['label' => Yii::t('back', 'Reservations'), 'items' => [['label' => Yii::t('back', 'Devices'), 'url' => ['/reservation/device/index'], 'visible' => Yii::$app->user->can('booker')], ['label' => Yii::t('back', 'Subjects'), 'url' => ['/reservation/subject/index'], 'visible' => Yii::$app->user->can('booker')]], 'visible' => isset(Yii::$app->modules['reservation']) && Yii::$app->user->can('booker')], ['label' => Yii::t('back', 'Manage newsletter'), 'items' => [['label' => Yii::t('back', 'Newsletters'), 'url' => ['/newsletter/index'], 'visible' => Yii::$app->user->can('user') && WebRecord::existsMoreWebRecords()], ['label' => Yii::t('back', 'Emails'), 'url' => ['/email/index'], 'visible' => Yii::$app->user->can('user')]], 'visible' => isset(Yii::$app->params['backendModules']['newsletter']) && Yii::$app->user->can('user')], ['label' => Yii::t('back', Yii::t('back', 'Admin')), 'items' => [['label' => Yii::t('back', 'Menus'), 'url' => ['/menu/index'], 'visible' => Yii::$app->user->can('admin') && WebRecord::existsMoreWebRecords()], ['label' => Yii::t('back', 'Webs'), 'url' => ['/web/index'], 'visible' => Yii::$app->user->can('admin')], Yii::$app->user->can('admin') ? '<li class="divider"></li>' : '', ['label' => Yii::t('back', 'Layouts'), 'url' => ['/layout/index'], 'visible' => Yii::$app->user->can('admin')], ['label' => Yii::t('back', 'Additional fields'), 'url' => ['/additional-field/index'], 'visible' => Yii::$app->user->can('admin')], ['label' => Yii::t('back', 'Languages'), 'url' => ['/language/index'], 'visible' => Yii::$app->user->can('admin')], Yii::$app->user->can('admin') ? '<li class="divider"></li>' : '', ['label' => Yii::t('back', 'Users'), 'url' => ['/user/index'], 'visible' => Yii::$app->user->can('admin')]], 'visible' => Yii::$app->user->can('admin')], ['label' => Yii::t('back', Yii::t('back', 'Webs')), 'items' => WebRecord::getNavBarItems(), 'visible' => WebRecord::existsMoreWebRecords()]];
if (Yii::$app->user->isGuest) {
    /** @noinspection PhpUndefinedFieldInspection */
    $menuItems[] = ['label' => Yii::t('back', 'Login'), 'url' => ['/site/login'], 'visible' => $this->context->action->id != 'login'];
} else {
    /** @noinspection PhpUndefinedFieldInspection */
    $menuItems[] = ['label' => Yii::t('back', 'Logout') . ' (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
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'] : []]);
?>