public function run() { $type = $this->type; echo BsHtml::openTag('div', array('id' => $this->id)); /*** Nav tabs ***/ echo BsHtml::$type($this->_labels); /*** Tab panes ***/ echo BsHtml::openTag('div', array('class' => 'tab-content')); foreach ($this->_content as $content) { $class = 'tab-pane' . ($content['active'] == true ? ' active' : ''); echo BsHtml::tag('div', array('class' => $class, 'id' => $content['id'], 'role' => 'tabpanel'), $content['content']); } echo BsHtml::closeTag('div'); echo BsHtml::closeTag('div'); /*** clientScript ***/ $cs = Yii::app()->getClientScript(); $navs = ' $("#' . $this->id . ' ul.nav a").on("click",function(e){ e.preventDefault(); $(this).tab("show"); }) '; $cs->registerScript("navs-" . $this->id, $navs); }
<?php $baseUrl = Yii::app()->baseUrl; Yii::app()->getClientScript()->registerCssFile($baseUrl . '/css/bootstrap.cerulean.min.css')->registerCoreScript('jquery')->registerScriptFile($baseUrl . '/js/bootstrap.js', CClientScript::POS_END); ?> <link rel="icon" type="image/png" href="<?php echo $baseUrl; ?> /images/favicon.png" /> <title><?php echo CHtml::encode($this->pageTitle); ?> </title> </head> <body> <div class="container"> <?php $this->widget('bootstrap.widgets.BsNavbar', array('collapse' => true, 'brandLabel' => BsHtml::icon(BsHtml::GLYPHICON_FIRE) . BsHtml::bold(' Modelo de Evaluación') . BsHtml::small(' Qualitatcorp'), 'brandUrl' => Yii::app()->homeUrl, 'items' => array(array('class' => 'bootstrap.widgets.BsNav', 'type' => 'navbar', 'activateParents' => true, 'items' => array(array('label' => 'Evaluación', 'items' => array(BsHtml::menuHeader(BsHtml::italics('Evaluación')), array('label' => 'Administar Evaluación', 'url' => array('evaluacion/admin')), array('label' => 'Crear preguntas', 'url' => array('evaluacion/create')), BsHtml::menuHeader(BsHtml::italics('Evaluación Trabajador')), array('label' => 'Evaluar Trabajador', 'url' => array('evaluacion/evaluation')), array('label' => 'Resultados Trabajadores', 'url' => array('evaluacion/adminTRA')), BsHtml::menuHeader(BsHtml::italics('Preguntas')), array('label' => 'Administar preguntas', 'url' => array('evaluacion/adminPRE')), array('label' => 'Crear preguntas', 'url' => array('evaluacion/createPRE')), BsHtml::menuHeader(BsHtml::italics('Perfil Tecnico')), array('label' => 'Administar Perfil Tecnico', 'url' => array('evaluacion/adminPT')), array('label' => 'Crear Perfil Tecnico', 'url' => array('evaluacion/createPT')))), array('label' => 'Administración', 'items' => array(BsHtml::menuHeader(BsHtml::italics('Usuarios')), array('label' => 'Administar Usuarios', 'url' => array('usuario/admin')), array('label' => 'Crear Usuario', 'url' => array('usuario/create')), BsHtml::menuHeader(BsHtml::italics('Empresas')), array('label' => 'Administar Empresas', 'url' => array('empresa/admin')), array('label' => 'Crear Empresa', 'url' => array('empresa/create')), BsHtml::menuHeader(BsHtml::italics('Trabajadores')), array('label' => 'Administar Trabajadores', 'url' => array('trabajador/admin')), array('label' => 'Crear Trabajador', 'url' => array('trabajador/create')))))), array('class' => 'bootstrap.widgets.BsNav', 'type' => 'navbar', 'activateParents' => true, 'items' => array(array('label' => 'Login', 'url' => array('/site/login'), 'pull' => BsHtml::NAVBAR_NAV_PULL_RIGHT, 'visible' => Yii::app()->user->isGuest), array('label' => 'Logout (' . Yii::app()->user->name . ')', 'pull' => BsHtml::NAVBAR_NAV_PULL_RIGHT, 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)), 'htmlOptions' => array('pull' => BsHtml::NAVBAR_NAV_PULL_RIGHT))))); ?> <?php // breadcrumbs $this->widget('bootstrap.widgets.BsBreadCrumb', array('links' => $this->breadcrumbs, 'tagName' => 'ul', 'activeLinkTemplate' => '<li><a href="{url}">{label}</a></li>', 'inactiveLinkTemplate' => '<li>{label}</li>', 'homeLink' => BsHtml::openTag('li') . BsHtml::icon(BsHtml::GLYPHICON_HOME) . BsHtml::closeTag('li'))); ?> <div class="content"> <?php echo $content; ?> </div> </div> </body> </html>
/** * Runs the widget. */ public function run() { echo BsHtml::closeTag($this->tagName); $selector = '#' . $this->htmlOptions['id']; $this->registerEvents($selector, $this->events); }