Пример #1
0
 /**
  * Initializes the widget
  */
 public function init()
 {
     $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.joyride.js' : 'foundation.min.js');
     Html::addCssClass($this->htmlOptions, Enum::JOYRIDE_LIST);
     ArrayHelper::addValue('data-joyride', 'data-joyride', $this->htmlOptions);
     $this->registerClientScript();
     parent::init();
 }
Пример #2
0
 /**
  * Initializes the widget
  */
 public function init()
 {
     $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.dropdown.js' : 'foundation.min.js');
     Html::addCssClass($this->htmlOptions, Enum::DROPDOWN_LIST);
     ArrayHelper::addValue('data-dropdown-content', '-', $this->htmlOptions);
     if ($this->type === Enum::DROPDOWN_CONTENT) {
         Html::addCssClass($this->htmlOptions, Enum::CONTENT);
     }
     parent::init();
 }
Пример #3
0
 /**
  * Widget's initialization
  */
 public function init()
 {
     Html::addCssClass($this->htmlOptions, Enum::SWITCH_BUTTON);
     if ($this->size) {
         Html::addCssClass($this->htmlOptions, $this->size);
     }
     if ($this->radius) {
         Html::addCssClass($this->htmlOptions, $this->radius);
     }
     parent::init();
 }
Пример #4
0
 /**
  * Initializes the widget
  */
 public function init()
 {
     $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.tooltips.js' : 'foundation.min.js');
     Html::addCssClass($this->htmlOptions, Enum::TOOLTIP);
     Html::addCssClass($this->htmlOptions, $this->position);
     ArrayHelper::addValue('title', $this->tip, $this->htmlOptions);
     ArrayHelper::addValue('data-tooltip', 'data-tooltip', $this->htmlOptions);
     if ($this->tip === null || $this->text === null) {
         throw new InvalidConfigException('"tip" and "text" cannot be null.');
     }
     $this->registerClientScript();
     parent::init();
 }
Пример #5
0
 /**
  * Renders a clearing (lightbox) item
  * @param array $item
  * @return string the resulting LI tag item
  */
 public function renderItem($item)
 {
     $options = ArrayHelper::getValue($item, 'options', array());
     if (isset($item['featured'])) {
         Html::addCssClass($this->htmlOptions, Enum::ClEARING_FEATURE);
         Html::addCssClass($options, Enum::CLEARING_FEATURE_IMG);
     }
     $imgOptions = array();
     $imgOptions['src'] = ArrayHelper::getValue($item, 'th', '#');
     $imgOptions['data-caption'] = ArrayHelper::getValue($item, 'caption', null);
     $imgOptions['class'] = 'th';
     $url = ArrayHelper::getValue($item, 'img', '#');
     return \CHtml::tag('li', $options, \CHtml::link(\CHtml::tag('img', $imgOptions), $url));
 }
Пример #6
0
 /**
  * Initializes the widget
  * @throws InvalidConfigException
  */
 public function init()
 {
     if ($this->source === null) {
         throw new InvalidConfigException('"source" cannot be null.');
     }
     Html::addCssClass($this->htmlOptions, Enum::VIDEO_FLEXVIDEO);
     if ($this->widescreen) {
         Html::addCssClass($this->htmlOptions, Enum::VIDEO_WIDESCREEN);
     }
     if ($this->vimeo) {
         Html::addCssClass($this->htmlOptions, Enum::VIDEO_VIMEO);
     }
     parent::init();
 }
Пример #7
0
 /**
  * Renders the alert
  * @return string the rendering result
  */
 public function renderAlert()
 {
     $user = \Yii::app()->user;
     if (count($user->getFlashes(false)) == 0) {
         return;
     }
     $alerts = array();
     foreach ($this->config as $style => $config) {
         if ($user->hasFlash($style)) {
             $options = ArrayHelper::getValue($config, 'htmlOptions', array());
             Html::addCssClass($options, $style);
             $close = ArrayHelper::getValue($config, 'close', '×');
             $alerts[] = \foundation\helpers\Alert::alert($user->getFlash($style), $options, $close);
         }
     }
     $this->registerEvents("#{$this->htmlOptions['id']} > .alert-box", $this->events);
     return \CHtml::tag('div', $this->htmlOptions, implode("\n", $alerts));
 }
Пример #8
0
 /**
  * Renders breadcrumbs
  */
 public function renderItems()
 {
     if (empty($this->items)) {
         return;
     }
     Html::addCssClass($this->htmlOptions, Enum::BREADCRUMBS);
     echo \CHtml::openTag($this->tagName, $this->htmlOptions);
     foreach ($this->items as $label => $options) {
         $this->renderItem($label, $options);
     }
     echo \CHtml::closeTag($this->tagName);
 }
Пример #9
0
 /**
  * Generates a button
  * @param string $label
  * @param array $htmlOptions
  * @return string the generated button.
  */
 public static function button($label = 'button', $htmlOptions = array())
 {
     $htmlOptions = ArrayHelper::defaultValue('name', \CHtml::ID_PREFIX . \CHtml::$count++, $htmlOptions);
     Html::clientChange('click', $htmlOptions);
     return static::btn('button', $label, $htmlOptions);
 }
Пример #10
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     Html::addCssClass($this->htmlOptions, Enum::PAGINATION);
     parent::init();
 }
Пример #11
0
 /**
  * Renders the close button.
  * @return string the rendering result
  */
 protected function renderCloseButton()
 {
     if ($this->closeButton !== null) {
         $tag = ArrayHelper::removeValue($this->closeButton, 'tag', 'a');
         $label = ArrayHelper::removeValue($this->closeButton, 'label', '×');
         if ($tag === 'button' && !isset($this->closeButton['type'])) {
             $this->closeButton['type'] = 'button';
         }
         Html::addCssClass($this->closeButton, Enum::DIALOG_CLOSE);
         return \CHtml::tag($tag, $this->closeButton, $label);
     } else {
         return null;
     }
 }
Пример #12
0
 /**
  * Initializes the widget
  */
 public function init()
 {
     $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.orbit.js' : 'foundation.min.js');
     Html::addCssClass($this->htmlOptions, Enum::ORBIT_WRAPPER);
     $this->setId(ArrayHelper::removeValue($this->htmlOptions, 'id', $this->getId()));
     $this->registerClientScript();
     parent::init();
 }
Пример #13
0
 /**
  * Renders a section item
  * @param array $item the section item
  * @return string the section result
  */
 public function renderItem($item)
 {
     $sectionItem = array();
     $sectionItem[] = \CHtml::tag('p', array('class' => 'title', 'data-section-title' => 'data-section-title'), \CHtml::link(ArrayHelper::getValue($item, 'label', 'Section Title'), '#'));
     $options = ArrayHelper::getValue($item, 'options', array());
     Html::addCssClass($options, 'content');
     ArrayHelper::addValue('data-section-content', 'data-section-content', $options);
     $sectionOptions = array();
     if (ArrayHelper::getValue($item, 'active')) {
         ArrayHelper::addValue('class', 'active', $sectionOptions);
     }
     $sectionItem[] = \CHtml::tag('div', $options, ArrayHelper::getValue($item, 'content', 'Section Content'));
     return \CHtml::tag('section', $sectionOptions, implode("\n", $sectionItem));
 }
Пример #14
0
 /**
  * Renders a widget's item
  * @param mixed $item the item to render
  * @return string the rendering result.
  * @throws InvalidConfigException
  */
 protected function renderItem($item)
 {
     if (is_string($item)) {
         return $item;
     }
     if (!isset($item['label'])) {
         throw new InvalidConfigException("The 'label' option is required.");
     }
     $label = $this->encodeLabels ? \CHtml::encode($item['label']) : $item['label'];
     $options = ArrayHelper::getValue($item, 'options', array());
     $items = ArrayHelper::getValue($item, 'items');
     $url = \CHtml::normalizeUrl(ArrayHelper::getValue($item, 'url', '#'));
     $linkOptions = ArrayHelper::getValue($item, 'linkOptions', array());
     if (ArrayHelper::getValue($item, Enum::STATE_ACTIVE)) {
         ArrayHelper::addValue('class', Enum::STATE_ACTIVE, $options);
     }
     if ($items !== null) {
         Html::addCssClass($options, Enum::DROPDOWN_HAS);
         if (is_array($items)) {
             $items = Nav::dropdown($items, $this->encodeLabels);
         }
     }
     return \CHtml::tag('li', $options, \CHtml::link($label, $url, $linkOptions) . $items);
 }