Esempio n. 1
0
 /**
  * run this widgets(non-PHPdoc)
  * @see CWidget::run()
  */
 public function run()
 {
     if ($this->list == "unordered") {
         echo CHtml::openTag('ul', $this->htmlOptions);
     } elseif ($this->list == "ordered") {
         echo CHtml::openTag('ol', $this->htmlOptions);
     }
     if (isset($this->items)) {
         foreach ($this->items as $list) {
             if (is_array($list)) {
                 if (isset($list['icon'])) {
                     $list['text'] = BS3::glyphicon($list['icon']) . ' ' . $list['text'];
                 }
                 if (isset($this->customType)) {
                     is_array($this->customType) and isset($this->customType['icon']) ? $customType = BS3::glyphicon($this->customType['icon']) : ($customType = $this->customType);
                     $list['text'] = $customType . ' ' . $list['text'];
                 }
                 echo CHtml::tag('li', isset($list['htmlOptions']) ? $list['htmlOptions'] : array(), $list['text']);
             } else {
                 if (isset($this->customType)) {
                     is_array($this->customType) and isset($this->customType['icon']) ? $customType = BS3::glyphicon($this->customType['icon']) : ($customType = $this->customType);
                     $list = $customType . ' ' . $list;
                 }
                 echo CHtml::tag('li', array(), $list);
             }
         }
     }
     if ($this->list == "unordered") {
         echo CHtml::closeTag('ul');
     } elseif ($this->list == "ordered") {
         echo CHtml::closeTag('ol');
     }
 }
Esempio n. 2
0
 /**
  * initialize widgets. (non-PHPdoc)
  * @see CWidget::init()
  */
 public function init()
 {
     isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] .= ' page-header' : ($this->htmlOptions['class'] = 'page-header');
     $validTypes = array(self::TYPE_PURPLE, self::TYPE_PRIMARY, self::TYPE_INFO, self::TYPE_SUCCESS, self::TYPE_WARNING, self::TYPE_DANGER, self::TYPE_INVERSE);
     if (isset($this->textType) and in_array($this->textType, $validTypes)) {
         isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] .= ' text-' . $this->textType : ($this->htmlOptions['class'] = 'text-' . $this->textType);
     }
     if (isset($this->icon)) {
         $this->heading = BS3::glyphicon($this->icon, array('style' => 'font-size:36px')) . ' ' . $this->heading;
     }
 }
Esempio n. 3
0
 /**
  * Returns the append element for the input.
  * @return string the element
  */
 protected function getAppend()
 {
     if ($this->hasAddOn()) {
         $htmlOptions = $this->appendOptions;
         if (isset($htmlOptions['class'])) {
             $htmlOptions['class'] .= ' input-group-addon';
         } else {
             $htmlOptions['class'] = 'input-group-addon';
         }
         ob_start();
         if (isset($this->append)) {
             if (is_array($this->append)) {
                 if (isset($this->append['type']) and $this->append['type'] == "button") {
                     $this->append['options']['htmlOptions']['apprepend'] = 'input-group-btn';
                     $this->widget('widgets.TbButton', $this->append['options']);
                 } elseif (isset($this->append['type']) and $this->append['type'] == "buttonGroup") {
                     $this->append['options']['htmlOptions']['apprepend'] = 'input-group-btn';
                     $this->widget('widgets.TbButtonGroup', $this->append['options']);
                 } elseif (isset($this->append['icon'])) {
                     $icon = BS3::glyphicon($this->append['icon']);
                     echo CHtml::tag('span', $htmlOptions, $icon);
                 }
             } else {
                 echo CHtml::tag('span', $htmlOptions, $this->append);
             }
         }
         echo '</div>';
         return ob_get_clean();
     } else {
         return '';
     }
 }