Пример #1
0
 /**
  * Runs the widget.
  * This registers the necessary javascript code and renders the form close tag.
  * @throws InvalidCallException if `beginField()` and `endField()` calls are not matching
  */
 public function run()
 {
     if (!empty($this->_fields)) {
         throw new InvalidCallException('Each beginField() should have a matching endField() call.');
     }
     if ($this->enableClientScript) {
         $id = $this->options['id'];
         $options = Json::htmlEncode($this->getClientOptions());
         $attributes = Json::htmlEncode($this->attributes);
         $view = $this->getView();
         ActiveFormAsset::register($view);
         $view->registerJs("jQuery('#{$id}').leapsActiveForm({$attributes}, {$options});");
     }
     echo Html::endForm();
 }
Пример #2
0
?>
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'CodeForge', 'brandUrl' => Leaps::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => '威客', 'url' => ['/site/index']], ['label' => '源代码', 'url' => ['/site/code']], ['label' => '活动', 'url' => ['/event']], ['label' => 'CF币', 'url' => ['/site/cfcoin']], ['label' => '关于我们', 'url' => ['/site/about']], ['label' => '联系我们', 'url' => ['/site/contact']]];
if (Leaps::$app->user->isGuest) {
    $menuItems[] = ['label' => '注册', 'url' => ['/site/signup']];
    $menuItems[] = ['label' => '登陆', 'url' => ['/site/login']];
} else {
    $menuItems[] = '<li>' . Html::beginForm(['/site/logout'], 'post') . Html::submitButton('Logout (' . Leaps::$app->user->identity->username . ')', ['class' => 'btn btn-link']) . Html::endForm() . '</li>';
}
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 '';
?>
        <?php 
echo $content;
?>