/** * Create a pager button. * * @param string $label * @param string $page * @param string $class * @param boolean $hidden * @param boolean $selected * * @access protected * @return string */ protected function createPageButton($label, $page, $class, $hidden, $selected) { if ($hidden || $selected) { $class .= ' ' . ($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE); } if (!$hidden) { return '<li class="' . $class . '">' . EBootstrap::link($label, $this->createPageUrl($page)) . '</li>'; } else { return '<li class="' . $class . '">' . EBootstrap::link($label, '') . '</li>'; } }
/** * Render the breadcrumbs */ public function run() { if (empty($this->links)) { return; } echo EBootstrap::openTag('ul', $this->htmlOptions) . "\n"; $links = array(); if ($this->homeLink === null) { $links[] = EBootstrap::openTag('li') . EBootstrap::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl); } else { if ($this->homeLink !== false) { $links[] = EBootstrap::openTag('li') . $this->homeLink; } } $count = count($this->links); if ($count > 0) { $links[] = $this->separator . EBootstrap::closeTag('li') . "\n"; $i = 0; foreach ($this->links as $label => $url) { $i++; if (is_string($label) || is_array($url)) { $links[] = EBootstrap::openTag('li') . EBootstrap::link($this->encodeLabel ? EBootstrap::encode($label) : $label, $url); } else { $links[] = EBootstrap::openTag('li') . '<span>' . ($this->encodeLabel ? EBootstrap::encode($url) : $url) . '</span>'; } if ($i < $count) { $links[] = $this->separator; } $links[] = EBootstrap::closeTag('li') . "\n"; } } else { $links[] = EBootstrap::closeTag('li') . "\n"; } echo implode($links); echo EBootstrap::closeTag('ul'); }
/** * Renders the content of a menu item. * * You can pass an 'icon' as item option as well as a bolean 'iconWhite' */ protected function renderMenuItem($item) { if (isset($item['icon']) and !empty($item['icon'])) { $icon = '<span class="glyphicon glyphicon-' . $item['icon']; if (isset($item['iconWhite']) and $item['iconWhite'] == true) { $icon .= ' icon-white'; } $icon .= '"></span> '; } else { $icon = ''; } if (isset($item['url'])) { $label = $this->linkLabelWrapper === null ? $icon . $item['label'] : '<' . $this->linkLabelWrapper . '>' . $icon . $item['label'] . '</' . $this->linkLabelWrapper . '>'; return EBootstrap::link($label, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array()); } else { return EBootstrap::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $icon . $item['label']); } }
/** * 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"; } }
/** * Outputs the button */ public function __tostring() { $class = array(); if (!empty($this->size)) { $class[] = 'btn-' . $this->size; } if (!empty($this->type)) { $class[] = 'btn-' . $this->type; } else { $class[] = 'btn-default'; } if ($this->disabled) { $class[] = 'disabled'; } if ($this->block) { $class[] = 'btn-block'; } if (!empty($this->icon)) { $this->text = EBootstrap::icon($this->icon, $this->iconWhite) . ' ' . $this->text; } EBootstrap::mergeClass($this->htmlOptions, $class); switch ($this->element) { case 'button': return EBootstrap::tag('button', $this->htmlOptions, $this->text) . "\n"; break; default: return EBootstrap::link($this->text, $this->url, $this->htmlOptions) . "\n"; break; } }