* @license http://creativecommons.org/licenses/by-nc-sa/4.0/deed.ru «Attribution-NonCommercial-ShareAlike» */ $form = $this->beginWidget('bootstrap3.widgets.BsActiveForm', array('id' => 'usermenu-form', 'enableAjaxValidation' => TRUE, 'layout' => 'horizontal')); $q = Yii::app()->db->createCommand('SELECT MAX(`pos`) AS `mpos` FROM {{usermenu}}')->queryAll(); $q = intval($q[0]['mpos'] + 1); if ($model->isNewRecord) { $model->pos = $q; } ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->dropDownListControlGroup($model, 'pos', Usermenu::getPositions(), array('class' => 'span5')); ?> <?php echo $form->dropDownListControlGroup($model, 'activ', array('0' => 'Нет', '1' => 'Да'), array('class' => 'span5')); ?> <?php echo $form->textFieldControlGroup($model, 'lang_key', array('class' => 'span5', 'maxlength' => 64)); ?> <?php echo $form->textFieldControlGroup($model, 'url', array('class' => 'span5', 'maxlength' => 64)); ?> <?php
<div id="wrapper" class="clearfix"> <div id="header"> <div class="container"> <h1> <?php echo CHtml::link(CHtml::encode(Yii::app()->name), Yii::app()->createUrl('/site/index')); ?> </h1> </div> </div> <div id="nav" class="clearfix"> <div class="container"> <ul class="main-nav"> <?php foreach (Usermenu::getMenu() as $item) { ?> <li> <?php echo CHtml::link(CHtml::encode($item['label']), $item['url']); ?> </li> <?php } ?> </ul> <ul class="main-nav pull-right"> <li class="dropdown"> <?php if (Yii::app()->user->isguest) { ?>
$cs->registerCssFile($themePath . '/css/bootstrap' . $min . '.css'); $cs->registerCssFile($themePath . '/css/bootstrap-theme' . $min . '.css'); $cs->registerCssFile($themePath . '/css/font-awesome' . $min . '.css'); $cs->registerCssFile($themePath . '/css/csbans.css'); /** * JavaScripts */ $cs->scriptMap['jquery.js'] = $themePath . '/js/jquery.js'; $cs->scriptMap['jquery.min.js'] = $themePath . '/js/jquery.min.js'; $cs->registerCoreScript('jquery'); $cs->registerScriptFile($themePath . '/js/bootstrap' . $min . '.js', CClientScript::POS_END); $cs->registerScript('tooltip', ' $(\'[data-toggle="tooltip"]\').tooltip(); $(\'[data-toggle="popover"]\').popover(); ', CClientScript::POS_END); $mainMenu = Usermenu::getMenu(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title><?php echo CHtml::encode($this->pageTitle); ?> </title> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Usermenu::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function getPositions() { $count = Usermenu::model()->count(); $return = array(); for ($i = 1; $i <= $count + 1; $i++) { $return[$i] = $i; } return $return; }
Yii::app()->bootstrap->registerCoreCss(); ?> <?php Yii::app()->bootstrap->registerYiiCss(); ?> <?php Yii::app()->bootstrap->registerCoreScripts(); ?> <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->urlManager->baseUrl; ?> /css/styles.css" /> </head> <body> <?php $this->widget('bootstrap.widgets.TbNavbar', array('brand' => false, 'items' => array(array('class' => 'bootstrap.widgets.TbMenu', 'items' => Usermenu::getMenu()), array('class' => 'bootstrap.widgets.TbMenu', 'htmlOptions' => array('class' => 'pull-right'), 'encodeLabel' => false, 'items' => array(array('label' => 'Войти', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest, 'items' => array(array('label' => '<p><form method="post" action="' . Yii::app()->createUrl('/site/login') . '" accept-charset="UTF-8"> <input style="margin-bottom: 15px;" type="text" placeholder="Логин" id="LoginForm_username" name="LoginForm[username]"> <input style="margin-bottom: 15px;" type="password" placeholder="Пароль" id="LoginForm_password" name="LoginForm[password]"> <input type="hidden" value="' . Yii::app()->request->csrfToken . '" name="' . Yii::app()->request->csrfTokenName . '" /> <input class="btn btn-primary btn-block" name="yt0" type="submit" value="Войти"> </form></p>'))), array('label' => Yii::app()->user->name, 'url' => '#', 'visible' => !Yii::app()->user->isGuest, 'items' => array(array('label' => 'Админцентр', 'url' => array('/admin'), 'visible' => !Yii::app()->user->isGuest), '---', array('label' => 'Выйти', 'url' => array('/site/logout'), 'icon' => 'icon-off')))))))); ?> <div id="wrap"> <div class="container" id="page"> <?php if (isset($this->breadcrumbs)) { ?> <?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array('links' => $this->breadcrumbs)); ?> <?php