/**
     * Init the widget
     */
    public function init()
    {
        parent::init();
        if (!isset($this->htmlOptions['id'])) {
            $this->htmlOptions['id'] = $this->getId();
        }
        if (is_null($this->jsFile)) {
            $jsFile = dirname(__FILE__) . '/js/bootstrap.min.js';
            $this->jsFile = Yii::app()->getAssetManager()->publish($jsFile);
            Yii::app()->clientScript->registerScriptFile($this->jsFile);
        } elseif ($this->jsFile !== false) {
            Yii::app()->clientScript->registerScriptFile($this->jsFile);
        }
        if ($this->valueToggle !== false) {
            switch ($this->sender) {
                case 'img':
                case 'input':
                    $jsFunction = 'val';
                    break;
                default:
                    $jsFunction = 'html';
            }
            Yii::app()->clientScript->registerScript('ebootstrap-collapse-' . $this->getId(), '
				$("' . $this->target . '").on("show", function() {
					$("#' . $this->htmlOptions['id'] . '").' . $jsFunction . '("' . $this->valueToggle . '");
				});
				$("' . $this->target . '").on("hide", function() {
					$("#' . $this->htmlOptions['id'] . '").' . $jsFunction . '("' . $this->value . '");;
				});
			', CClientScript::POS_READY);
        }
    }
 /**
  * Render footer
  */
 public function run()
 {
     parent::run();
     if (!empty($this->position)) {
         echo EBootstrap::closeTag('div');
     }
 }
 /**
  * Render progress bar
  */
 public function run()
 {
     parent::run();
     echo EBootstrap::openTag('div', $this->htmlOptions);
     echo EBootstrap::openTag('div', array('class' => 'bar', 'style' => 'width: ' . $this->width . '%;'));
     echo EBootstrap::closeTag('div');
     echo EBootstrap::closeTag('div');
 }
 /**
  * Render trigger
  */
 public function run()
 {
     parent::run();
     if ($this->html === false) {
         echo EBootstrap::tag($this->element, $this->htmlOptions, $this->value);
     } else {
         echo $this->html;
     }
 }
 /**
  * Render the hero element
  */
 public function run()
 {
     parent::run();
     echo EBootstrap::openTag('div', $this->htmlOptions) . "\n";
     echo EBootstrap::tag('h1', array(), $this->headline) . "\n";
     echo EBootstrap::tag('div', array(), $this->body) . "\n";
     if (!empty($this->actions)) {
         echo EBootstrap::openTag('p');
         foreach ($this->actions as $button) {
             echo $button . " \n";
         }
         echo "\n";
         echo EBootstrap::closeTag('p') . "\n";
     }
     echo EBootstrap::closeTag('div') . "\n";
 }
 /**
  * Render the flash messages
  */
 public function run()
 {
     parent::run();
     $flashMessages = Yii::app()->user->getFlashes();
     if (is_array($flashMessages) and count($flashMessages)) {
         echo EBootstrap::openTag('div', $this->htmlOptions);
         foreach ($flashMessages as $key => $message) {
             if (substr($key, 0, 5) == 'block') {
                 $block = true;
                 $key = substr($key, 6);
             } else {
                 $block = false;
             }
             $this->widget('EBootstrapAlert', array('type' => $key, 'message' => $message, 'block' => $block));
         }
         echo EBootstrap::closeTag('div');
     }
 }
 /**
  * Render alert
  */
 public function run()
 {
     parent::run();
     if ($this->type == 'error') {
         $this->type = 'danger';
     }
     EBootstrap::mergeClass($this->htmlOptions, array('alert', 'alert-dismissable', 'fade', 'in'));
     EBootstrap::mergeClass($this->htmlOptions, array('alert-' . $this->type));
     echo EBootstrap::openTag('div', $this->htmlOptions);
     if ($this->canClose) {
         echo EBootstrap::tag('button', array('type' => 'button', 'class' => 'close', 'data-dismiss' => 'alert', 'aria-hidden' => 'true'), "×");
     }
     if ($this->block) {
         echo $this->message;
     } else {
         echo EBootstrap::tag('span', array(), $this->message);
     }
     echo EBootstrap::closeTag('div');
 }
 /**
  * Render the widget
  */
 public function run()
 {
     parent::run();
     if (empty($this->content)) {
         $content = ob_get_contents();
         $content = str_replace('>', '>', $content);
         $content = str_replace('&lt;', '<', $content);
         ob_end_clean();
     } else {
         $content = $this->content;
     }
     EBootstrap::mergeClass($this->htmlOptions, array('prettyprint', 'well'));
     if (!empty($this->language)) {
         EBootstrap::mergeClass($this->htmlOptions, array('lang-' . $this->language));
     }
     if ($this->lineNumbers) {
         EBootstrap::mergeClass($this->htmlOptions, array('linenums'));
     }
     echo CHtml::openTag('pre', $this->htmlOptions);
     echo htmlspecialchars($content);
     echo CHtml::closeTag('pre');
 }
 /**
  * Render footer
  */
 public function run()
 {
     parent::run();
     echo EBootstrap::closeTag('div');
     echo EBootstrap::openTag('div', array('class' => 'modal-footer'));
     foreach ($this->footer as $action) {
         echo $action . " \n";
     }
     echo EBootstrap::closeTag('div');
     echo EBootstrap::closeTag('div');
 }
 /**
  * Render footer
  */
 public function run()
 {
     parent::run();
     echo EBootstrap::closeTag('div');
 }
 /**
  * Render the carousel
  */
 public function run()
 {
     parent::run();
     if (is_array($this->items) and count($this->items)) {
         EBootstrap::mergeClass($this->htmlOptions, array('carousel'));
         echo EBootstrap::openTag('div', $this->htmlOptions) . "\n";
         echo EBootstrap::openTag('div', array('class' => 'carousel-inner')) . "\n";
         foreach ($this->items as $item) {
             $itemOptions = isset($item['htmlOptions']) ? $item['htmlOptions'] : array();
             EBootstrap::mergeClass($itemOptions, array('item'));
             if (isset($item['active']) and $item['active'] == true) {
                 EBootstrap::mergeClass($itemOptions, array('active'));
             }
             echo EBootstrap::openTag('div', $itemOptions) . "\n";
             if (!isset($item['alt'])) {
                 $item['alt'] = isset($item['caption']) ? $item['caption'] : '';
             }
             if (isset($item['href'])) {
                 echo EBootstrap::openTag('a', array('href' => $item['href']));
             }
             echo EBootstrap::image($item['src'], $item['alt'], array()) . "\n";
             if (isset($item['caption']) and !empty($item['caption']) or isset($item['body']) and !empty($item['body'])) {
                 echo EBootstrap::openTag('div', array('class' => 'carousel-caption'));
                 if (isset($item['caption']) and !empty($item['caption'])) {
                     echo EBootstrap::tag('h4', array(), $item['caption']) . "\n";
                 }
                 if (isset($item['body']) and !empty($item['body'])) {
                     echo EBootstrap::tag('p', array(), $item['body']) . "\n";
                 }
                 echo EBootstrap::closeTag('div');
             }
             if (isset($item['href'])) {
                 echo EBootstrap::closeTag('a');
             }
             echo EBootstrap::closeTag('div') . "\n";
         }
         echo EBootstrap::closeTag('div') . "\n";
         echo EBootstrap::link($this->controlPrev, '#' . $this->htmlOptions['id'], array('data-slide' => 'prev', 'class' => 'left carousel-control')) . "\n";
         echo EBootstrap::link($this->controlNext, '#' . $this->htmlOptions['id'], array('data-slide' => 'next', 'class' => 'right carousel-control')) . "\n";
         echo EBootstrap::closeTag('div') . "\n";
     }
 }