See also: http://twitter.github.com/bootstrap/javascript.html#collapse
Inheritance: extends CWidget
Ejemplo n.º 1
0
 /**
  *### .run()
  *
  * Runs the widget.
  */
 public function run()
 {
     echo CHtml::openTag('div', $this->htmlOptions);
     echo '<div class="navbar-inner"><div class="' . $this->getContainerCssClass() . '">';
     $collapseId = null === $this->collapseName ? '#' . TbCollapse::getNextContainerId() : $this->collapseName;
     if ($this->collapse !== false) {
         echo '<a class="btn btn-navbar" data-toggle="collapse" data-target="' . $collapseId . '">';
         echo '<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>';
         echo '</a>';
     }
     if ($this->brand !== false) {
         if ($this->brandUrl !== false) {
             echo CHtml::openTag('a', $this->brandOptions) . $this->brand . '</a>';
         } else {
             unset($this->brandOptions['href']);
             // spans cannot have a href attribute
             echo CHtml::openTag('span', $this->brandOptions) . $this->brand . '</span>';
         }
     }
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             if (isset($item['class'])) {
                 $className = $item['class'];
                 unset($item['class']);
                 $this->controller->widget($className, $item);
             }
         }
     }
     echo '</div></div></div>';
 }
Ejemplo n.º 2
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     echo CHtml::openTag('div', $this->htmlOptions);
     echo '<div class="navbar-inner"><div class="' . $this->getContainerCssClass() . '">';
     $collapseId = TbCollapse::getNextContainerId();
     if ($this->collapse !== false) {
         echo '<a class="btn btn-navbar" data-toggle="collapse" data-target="#' . $collapseId . '">';
         echo '<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>';
         echo '</a>';
     }
     if ($this->brand !== false) {
         if ($this->brandUrl !== false) {
             echo CHtml::openTag('a', $this->brandOptions) . $this->brand . '</a>';
         } else {
             unset($this->brandOptions['href']);
             // spans cannot have a href attribute
             echo CHtml::openTag('span', $this->brandOptions) . $this->brand . '</span>';
         }
     }
     if ($this->navText !== false) {
         echo CHtml::openTag('div', array('class' => 'navbar-text ' . $this->navTextClass)) . $this->navText . '</div>';
     }
     if ($this->collapse !== false) {
         $this->controller->beginWidget('bootstrap.widgets.TbCollapse', array('id' => $collapseId, 'toggle' => false, 'htmlOptions' => array('class' => 'nav-collapse')));
     }
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             if (isset($item['class'])) {
                 $className = $item['class'];
                 unset($item['class']);
                 $this->controller->widget($className, $item);
             }
         }
     }
     if ($this->collapse !== false) {
         $this->controller->endWidget();
     }
     echo '</div></div></div>';
 }
Ejemplo n.º 3
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     echo CHtml::openTag('nav', $this->htmlOptions);
     if ($this->fluid) {
         echo CHtml::openTag('div', array('class' => 'container-fluid'));
     } else {
         echo CHtml::openTag('div', array('class' => 'container'));
     }
     echo CHtml::openTag('div', array('class' => 'navbar-header'));
     $collapseId = TbCollapse::getNextContainerId();
     if ($this->collapse !== false) {
         echo CHtml::openTag('button', array('type' => 'button', 'class' => 'navbar-toggle collapsed', 'data-toggle' => 'collapse', 'data-target' => '#' . $collapseId));
         echo CHtml::openTag('span', array('class' => 'sr-only'));
         echo 'Toggle navigation';
         echo CHtml::closeTag('span');
         echo CHtml::openTag('span', array('class' => 'icon-bar'));
         echo CHtml::closeTag('span');
         echo CHtml::openTag('span', array('class' => 'icon-bar'));
         echo CHtml::closeTag('span');
         echo CHtml::closeTag('button');
     }
     if ($this->brand !== false) {
         if ($this->brandUrl !== false) {
             echo CHtml::openTag('a', $this->brandOptions) . $this->brand . '</a>';
         } else {
             unset($this->brandOptions['href']);
             // spans cannot have a href attribute
             echo CHtml::openTag('span', $this->brandOptions) . $this->brand . '</span>';
         }
     }
     echo CHtml::closeTag('div');
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             if (isset($item['class'])) {
                 $className = $item['class'];
                 unset($item['class']);
                 $this->controller->widget($className, $item);
             }
         }
     }
     echo CHtml::closeTag('div');
     echo CHtml::closeTag('nav');
 }
Ejemplo n.º 4
0
 /**
  *### .run()
  *
  * Runs the widget.
  */
 public function run()
 {
     echo CHtml::openTag('div', $this->htmlOptions);
     echo '<div class="navbar-inner"><div class="' . $this->getContainerCssClass() . '">';
     //lp 封装流式布局
     echo '<div class="span2">';
     $collapseId = TbCollapse::getNextContainerId();
     if ($this->collapse !== false) {
         echo '<a class="btn btn-navbar" data-toggle="collapse" data-target="#' . $collapseId . '">';
         echo '<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>';
         echo '</a>';
     }
     if ($this->brand !== false) {
         echo CHtml::openTag('a', $this->brandOptions);
         if ($this->headerIcon) {
             echo '<i class="pull-left ' . $this->headerIcon . '" style="margin-right:10px;"></i>';
         }
         echo $this->brand . '</a>';
     }
     //流式布局12-2结束
     echo '</div>';
     echo '<div class="span10">';
     if ($this->collapse !== false) {
         $this->controller->beginWidget('bootstrap.widgets.TbCollapse', array('id' => $collapseId, 'toggle' => false, 'htmlOptions' => array('class' => 'nav-collapse')));
     }
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             if (isset($item['class'])) {
                 $className = $item['class'];
                 unset($item['class']);
                 $this->controller->widget($className, $item);
             }
         }
     }
     if ($this->collapse !== false) {
         $this->controller->endWidget();
     }
     //流式布局12-10列结束
     echo '</div>';
     echo '</div></div></div>';
 }
Ejemplo n.º 5
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     echo CHtml::openTag('nav', $this->htmlOptions);
     echo '<div class="' . $this->getContainerCssClass() . '">';
     $collapseId = TbCollapse::getNextContainerId();
     echo '<div class="navbar-header">';
     if ($this->collapse !== false) {
         echo '<a class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target="#' . $collapseId . '">';
         echo '<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>';
         echo '</a>';
     }
     if ($this->brand !== false) {
         if ($this->brandUrl !== false) {
             echo CHtml::openTag('a', $this->brandOptions) . $this->brand . '</a>';
         } else {
             unset($this->brandOptions['href']);
             // spans cannot have a href attribute
             echo CHtml::openTag('span', $this->brandOptions) . $this->brand . '</span>';
         }
     }
     echo "</div>";
     if ($this->collapse !== false) {
         $this->controller->beginWidget('TbCollapse', array('id' => $collapseId, 'toggle' => false, 'htmlOptions' => array('class' => 'collapse navbar-collapse')));
     }
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             if (isset($item['class'])) {
                 $className = $item['class'];
                 if (preg_match('/TbMenu/i', $className)) {
                     if ($this->justified == true) {
                         $item['justified'] = true;
                     } else {
                         isset($item['htmlOptions']['class']) ? $item['htmlOptions']['class'] .= " navbar-nav" : ($item['htmlOptions']['class'] = " navbar-nav");
                     }
                     if ($this->dropup == true) {
                         $item['htmlOptions']['class'] .= " dropup";
                     }
                 }
                 unset($item['class']);
                 $this->controller->widget($className, $item);
             }
         }
     }
     if ($this->collapse !== false) {
         $this->controller->endWidget();
     }
     echo '</div></nav>';
 }