public function renderTableRow($row) { $data = $this->dataProvider->data[$row]; $value = CHtml::value($data, $this->rankKey); $this->count++; if ($this->lastRankValue != $value) { $this->lastRankValue = $value; $this->lastRank = $this->rank; $this->rank = $this->count; } $htmlOptions = array(); if ($this->rowHtmlOptionsExpression !== null) { $options = $this->evaluateExpression($this->rowHtmlOptionsExpression, array('row' => $row, 'data' => $data, 'rank' => $this->rank)); if (is_array($options)) { $htmlOptions = $options; } } if ($this->rowCssClassExpression !== null) { $class = $this->evaluateExpression($this->rowCssClassExpression, array('row' => $row, 'data' => $data, 'rank' => $this->rank)); } elseif (is_array($this->rowCssClass) && ($n = count($this->rowCssClass)) > 0) { $class = $this->rowCssClass[$row % $n]; } if (!empty($class)) { if (isset($htmlOptions['class'])) { $htmlOptions['class'] .= ' ' . $class; } else { $htmlOptions['class'] = $class; } } echo CHtml::openTag('tr', $htmlOptions) . "\n"; foreach ($this->columns as $column) { $column->renderDataCell($row); } echo "</tr>\n"; }
/** * Initializes the widget. */ public function init() { parent::init(); $this->initOptions(); echo \CHtml::openTag('div', $this->options) . "\n"; echo $this->renderBodyBegin() . "\n"; }
/** * Run this widget. * This method registers necessary javascript and renders the needed HTML code. */ public function run() { $themeURL = Yii::app()->theme->getBaseUrl(); Yii::app()->clientScript->registerScript('logos', "\n\t\t\$(window).load(function(){\n\t\t\tif((!\$('#main-menu-icon').length) || (!\$('#x2touch-logo').length) || (!\$('#x2crm-logo').length)){\n\t\t\t\t\$('a').removeAttr('href');\n\t\t\t\talert('Please put the logo back');\n\t\t\t\twindow.location='http://www.x2engine.com';\n\t\t\t}\n\t\t\tvar touchlogosrc = \$('#x2touch-logo').attr('src');\n\t\t\tvar logosrc=\$('#x2crm-logo').attr('src');\n\t\t\tif(logosrc!='{$themeURL}/images/x2footer.png'|| touchlogosrc!='{$themeURL}/images/x2touch.png'){\n\t\t\t\t\$('a').removeAttr('href');\n\t\t\t\talert('Please put the logo back');\n\t\t\t\twindow.location='http://www.x2engine.com';\n\t\t\t}\n\t\t}); \n\t\t"); Yii::app()->clientScript->registerScript('toggleWidgetState', "\n\t\t\tfunction toggleWidgetState(widget,state) {\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . CHtml::normalizeUrl(array('/site/widgetState')) . "',\n\t\t\t\t\ttype: 'GET',\n\t\t\t\t\tdata: 'widget='+widget+'&state='+state,\n\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\tif(response=='success') {\n\t\t\t\t\t\t\tvar link = \$('#widget_'+widget+' .portlet-minimize a');\n\t\t\t\t\t\t\tvar newLink = (link.html()=='[+]')? '[–]' : '[+]';\t\t\t// toggle link between [+] and [-]\n\t\t\t\t\t\t\tlink.html(newLink);\n\t\t\t\t\t\t\t\$('#widget_'+widget+' .portlet-content').toggle('blind',{},200);\t// slide widget open or closed\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t", CClientScript::POS_HEAD); $id = $this->getId(); //get generated id if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } $options = empty($this->jQueryOptions) ? '' : CJavaScript::encode($this->jQueryOptions); Yii::app()->getClientScript()->registerScript('SortableWidgets' . '#' . $id, "jQuery('#{$id}').sortable({$options});"); echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n"; $hideWidgetJs = ''; foreach ($this->portlets as $class => $properties) { $visible = $properties['visibility'] == '1'; if (!$visible) { $hideWidgetJs .= "\$('#widget_" . $class . " .portlet-content').hide();\n"; } $minimizeLink = CHtml::link($visible ? '[–]' : '[+]', '#', array('onclick' => "toggleWidgetState('{$class}'," . ($visible ? 0 : 1) . "); return false;")); // $t0 = microtime(true); $this->beginWidget('zii.widgets.CPortlet', array('title' => Yii::t('app', Yii::app()->params->registeredWidgets[$class]) . '<div class="portlet-minimize">' . $minimizeLink . '</div>', 'id' => $properties['id'])); $this->widget($class); $this->endWidget(); // echo (round(microtime(true)-$t0,3)*1000).'ms'; } Yii::app()->clientScript->registerScript('setWidgetState', "\n\t\t\t\$(document).ready(function() {\n\t\t\t\t" . $hideWidgetJs . "\n\t\t\t});", CClientScript::POS_HEAD); echo CHtml::closeTag($this->tagName); }
/** * Renders the data item list. */ public function renderItems() { echo CHtml::openTag('table', array('class' => 'po-table mind-list')) . "\n"; echo CHtml::openTag('thead') . "\n"; echo CHtml::tag('th', array('width' => 20), ' ') . "\n"; echo CHtml::tag('th', array(), ' ') . "\n"; echo CHtml::tag('th', array('width' => 30), ' ') . "\n"; echo CHtml::tag('th', array('width' => 100), ' ') . "\n"; echo CHtml::tag('th', array('width' => 150), '<span class="mind-list__clear-all">удалить все</span>') . "\n"; echo CHtml::closeTag('thead'); echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n"; $data = $this->dataProvider->getData(); if (($n = count($data)) > 0) { $owner = $this->getOwner(); $viewFile = $owner->getViewFile($this->itemView); $j = 0; foreach ($data as $i => $item) { $data = $this->viewData; $data['index'] = $i; $data['data'] = $item; $data['widget'] = $this; $owner->renderFile($viewFile, $data); if ($j++ < $n - 1) { echo $this->separator; } } } echo CHtml::closeTag($this->itemsTagName); echo CHtml::closeTag('table'); }
/** * ### .run() * * Runs the widget. */ public function run() { $options = !empty($this->options) ? CJavaScript::encode($this->options) : ''; $id = !empty($this->htmlOptions['id']) ? $this->htmlOptions['id'] : $this->getId(); $elementId = !empty($this->options['elementId']) ? $this->options['elementId'] : 'null'; $elementUrl = !empty($this->options['elementUrl']) ? $this->options['elementUrl'] : 'null'; echo CHtml::openTag('div', $this->htmlOptions); echo CHtml::openTag('table'); echo '<thead><tr class="head"><th id="prev" style="visibility: visible;"><i class="icon-arrow-left"></i></th><th colspan="5" class="switch" style="text-align:center;">' . date("Y") . "年" . date("n") . "月" . '</th><th id="next" style="visibility: visible;"><i class="icon-arrow-right-2"></i></th></thead>'; echo '<tbody></tbody>'; echo CHtml::closeTag('table'); echo CHtml::closeTag('div'); ob_start(); Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';'); if (isset($_GET['date'])) { $year = date("Y", strtotime($_GET['date'])); $month = date("n", strtotime($_GET['date'])); $day = date("j", strtotime($_GET['date'])); } else { $year = date("Y"); $month = date("n"); $day = date("j"); } $this->registerJs($id, $year, $month, $day, $elementId, $elementUrl); }
public function run() { if (empty($this->links)) { return; } echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n"; $links = array(); if ($this->homeLink === null) { $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl); } else { if ($this->homeLink !== false) { $links[] = $this->homeLink; } } $i = 1; foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { if (count($this->links) == $i) { $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url, array('class' => $this->lastCssClass)); } else { $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url); } } else { if (count($this->links) == $i) { $links[] = '<span class="' . $this->lastCssClass . '">' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>'; } else { $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>'; } } $i++; } echo implode($this->separator, $links); echo CHtml::closeTag($this->tagName); }
/** * ### . * run() * * Renders the content of the widget. */ public function run() { if (empty($this->links)) { return; } echo CHtml::openTag($this->tagName, $this->htmlOptions); if ($this->homeLink === null) { $this->homeLink = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl); } if ($this->homeLink !== false) { // check whether home link is not a link $active = stripos($this->homeLink, '<a') === false ? ' class="active"' : ''; echo '<li' . $active . '>' . $this->homeLink . '</li>'; } end($this->links); $lastLink = key($this->links); foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { echo '<li>'; echo strtr($this->activeLinkTemplate, array('{url}' => CHtml::normalizeUrl($url), '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label)); } else { echo '<li class="active">'; echo str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $this->inactiveLinkTemplate); } echo '</li>'; } echo CHtml::closeTag($this->tagName); }
public function run() { $moduleModel = SiteModule::model()->findByPk(4); if (!empty($moduleModel)) { $root = CatalogRubrics::getRoot(); $categories = $root->descendants()->findAll($root->id); $tree = ''; $level = 0; foreach ($categories as $n => $category) { if ($category->status == 1) { if ($category->level == $level) { $tree .= CHtml::closeTag('li') . "\r\n"; } else { if ($category->level > $level) { $tree .= CHtml::openTag('ul') . "\r\n"; } else { $tree .= CHtml::closeTag('li') . "\r\n"; for ($i = $level - $category->level; $i; $i--) { $tree .= CHtml::closeTag('ul') . "\r\n"; $tree .= CHtml::closeTag('li') . "\r\n"; } } } $tree .= CHtml::openTag('li'); $tree .= CHtml::link($category->name, Yii::app()->urlManager->createUrl($moduleModel->url_to_controller . '/element', array('param' => $category->url))); $level = $category->level; } } $tree .= CHtml::closeTag('li') . "\r\n"; $tree .= CHtml::closeTag('ul') . "\r\n"; $data['tree'] = $tree; $this->render('view_Categories', $data); } }
/** * Renders the widget. If there are no items, nothing will be rendered. * TODO: Reuse TbCollapse somehow */ public function run() { $itemCount = count($this->items); if ($itemCount === 0) { return; } echo CHtml::openTag('div', $this->htmlOptions); foreach ($this->items as $k => $item) { $id = __CLASS__ . '_' . $this->id . '_' . $k; $contentId = $id . '_content'; $linkOptions = array('class' => 'accordion-toggle episode-toggle', 'data-content-id' => $contentId, 'data-toggle' => 'collapse', 'data-parent' => $this->id); // Add content-url data attributes to the link when available if (isset($item['contentUrl'])) { $linkOptions['data-content-url'] = $item['contentUrl']; } // Render the contents of the heading $heading = $this->render('_seasonAccordionHeading', array('linkUrl' => '#' . $id, 'linkOptions' => $linkOptions, 'season' => $item['season']), true); $bodyOptions = array('class' => 'accordion-body collapse', 'id' => $id); if ($itemCount === 1) { TbHtml::addCssClass('in', $bodyOptions); } echo CHtml::openTag('div', array('class' => 'accordion-group')); echo CHtml::tag('div', array('class' => 'accordion-heading'), $heading); echo CHtml::openTag('div', $bodyOptions); echo CHtml::tag('div', array('id' => $contentId, 'class' => 'accordion-inner'), $item['content']); echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); } echo CHtml::closeTag('div'); }
/** * Runs the widget. */ public function run() { $id = $this->id; if (is_string($this->keys)) { $this->keys = array($this->keys); } echo CHtml::openTag('div', $this->htmlOptions); foreach ($this->keys as $key) { if (Yii::app()->user->hasFlash($key)) { echo strtr($this->template, array('{class}' => ' fade in', '{key}' => $key, '{message}' => Yii::app()->user->getFlash($key))); } } echo '</div>'; /** @var CClientScript $cs */ $cs = Yii::app()->getClientScript(); $selector = "#{$id} .alert"; $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('{$selector}').alert();"); // Register the "close" event-handler. if (isset($this->events['close'])) { $fn = CJavaScript::encode($this->events['close']); $cs->registerScript(__CLASS__ . '#' . $id . '.close', "jQuery('{$selector}').bind('close', {$fn});"); } // Register the "closed" event-handler. if (isset($this->events['closed'])) { $fn = CJavaScript::encode($this->events['closed']); $cs->registerScript(__CLASS__ . '#' . $id . '.closed', "jQuery('{$selector}').bind('closed', {$fn});"); } }
public function run() { if (empty($this->links)) { return; } echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n"; $links = array(); echo '<span class="m_left20">当前位置:</span>'; if ($this->homeLink === null) { $links[] = CHtml::link("工作台", Yii::app()->homeUrl); } else { if ($this->homeLink !== false) { $links[] = $this->homeLink; } } foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url); } else { $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>'; } } echo implode($this->separator, $links); echo CHtml::closeTag($this->tagName); }
/** * Initializes the widget. */ public function init() { if (isset($this->htmlOptions['top'])) { $this->top = $this->htmlOptions['top']; unset($this->htmlOptions['top']); } if (isset($this->htmlOptions['parentClass'])) { $this->parentClass = $this->htmlOptions['parentClass']; unset($this->htmlOptions['parentClass']); } if (isset($this->htmlOptions['offsetBottom'])) { $this->offsetBottom = $this->htmlOptions['offsetBottom']; unset($this->htmlOptions['offsetBottom']); } if (isset($this->htmlOptions['offsetTop'])) { $this->offsetTop = $this->htmlOptions['offsetTop']; unset($this->htmlOptions['offsetTop']); } if (isset($this->htmlOptions['offtop'])) { $this->offtop = $this->htmlOptions['offtop']; unset($this->htmlOptions['offtop']); } isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] .= $this->parentClass : ($this->htmlOptions['class'] = $this->parentClass); $this->htmlOptions['role'] = "complementary"; echo CHtml::openTag($this->tagName, $this->htmlOptions); }
protected function renderContent() { $criteria = new CDbCriteria(); $criteria->addCondition('status=1'); $criteria->order = 'create_time DESC'; $criteria->limit = 20; $hopam = Hopam::model()->findAll($criteria); /*$dataProvider = new CActiveDataProvider('Song', array( 'pagination' => array( 'pageSize' => Yii::app()->params['postsPerPage'], ), 'criteria' => $criteria, )); $this->render('newest_song',array('songs'=>$dataProvider));*/ echo CHtml::openTag("div", array('class' => 'title')); echo "Hợp Âm Mới"; echo CHtml::closeTag("div"); if ($hopam) { echo CHtml::openTag("ul"); foreach ($hopam as $hp) { echo CHtml::openTag('li'); echo CHtml::link($hp->title, array('/hopam/view', 'id' => $hp->id, "title" => Lnt::safeTitle($hp->title))) . " <span style='color:#a7a7a7'>({$hp->view})</span>"; echo CHtml::closeTag('li'); } echo CHtml::closeTag("ul"); } }
public function renderItems() { echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n"; $data = $this->dataProvider->getData(); if (($n = count($data)) > 0) { $owner = $this->getOwner(); $render = $owner instanceof CController ? 'renderPartial' : 'render'; $j = 0; $bandera = true; foreach ($data as $i => $item) { $data = $this->viewData; $data['index'] = $i; $data['data'] = $item; $data['widget'] = $this; if ($bandera == true) { $owner->{$render}($this->headersview, $data); $bandera = false; } $owner->{$render}($this->itemView, $data); if ($j++ < $n - 1) { echo $this->separator; } } $owner->{$render}($this->footersview, $data); } else { $this->renderEmptyText(); } echo CHtml::closeTag($this->itemsTagName); }
/** * Renders the input file field */ public function renderField() { list($name, $id) = $this->resolveNameID(); TbArray::defaultValue('id', $id, $this->htmlOptions); TbArray::defaultValue('name', $name, $this->htmlOptions); echo CHtml::openTag('div', $this->htmlOptions); echo CHtml::openTag('div', array('class' => 'input-prepend bfh-timepicker-toggle', 'data-toggle' => 'bfh-timepicker')); echo CHtml::tag('span', array('class' => 'add-on'), TbHtml::icon(TbHtml::ICON_TIME)); if ($this->hasModel()) { echo CHtml::activeTextField($this->model, $this->attribute, $this->inputOptions); } else { echo CHtml::textField($name, $this->value, $this->inputOptions); } echo CHtml::closeTag('div'); echo '<div class="bfh-timepicker-popover"> <table class="table"> <tbody> <tr> <td class="hour"> <a class="next" href="#"><i class="icon-chevron-up"></i></a><br> <input type="text" class="input-mini" readonly><br> <a class="previous" href="#"><i class="icon-chevron-down"></i></a> </td> <td class="separator">:</td> <td class="minute"> <a class="next" href="#"><i class="icon-chevron-up"></i></a><br> <input type="text" class="input-mini" readonly><br> <a class="previous" href="#"><i class="icon-chevron-down"></i></a> </td> </tr> </tbody> </table> </div>'; echo CHtml::closeTag('div'); }
/** * Renders the header cell. */ public function renderHeaderCell() { $this->headerHtmlOptions['id'] = $this->id; echo CHtml::openTag('th', $this->headerHtmlOptions); $this->renderHeaderCellContent(); echo '</th>'; }
/** * Renders the input file field */ public function renderField() { list($name, $id) = $this->resolveNameID(); TbArray::defaultValue('id', $id, $this->htmlOptions); TbArray::defaultValue('name', $name, $this->htmlOptions); TbHtml::addCssClass('bfh-selectbox', $this->wrapperOptions); echo CHtml::openTag('div', $this->wrapperOptions); if ($this->hasModel()) { echo CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions); $value = $this->model->{$this->attribute}; $valueText = $value && isset($this->data[$value]) ? $this->data[$value] : ' '; } else { echo CHtml::hiddenField($name, $this->value, $this->htmlOptions); $value = $this->value; $valueText = $value && isset($this->data[$value]) ? $this->data[$value] : ' '; } echo CHtml::openTag('a', array('class' => 'bfh-selectbox-toggle', 'role' => 'button', 'data-toggle' => 'bfh-selectbox', 'href' => '#')); echo CHtml::tag('span', array('class' => 'bfh-selectbox-option ' . $this->size, 'data-option' => $value), $valueText); echo CHtml::tag('b', array('class' => 'caret'), ' '); echo CHtml::closeTag('a'); echo CHtml::openTag('div', array('class' => 'bfh-selectbox-options')); if ($this->displayFilter) { echo '<input type="text" class="bfh-selectbox-filter">'; } $items = array(); foreach ($this->data as $key => $item) { $items[] = CHtml::tag('a', array('tabindex' => '-1', 'href' => '#', 'data-option' => $key), $item); } echo CHtml::tag('ul', array('role' => 'options'), '<li>' . implode('</li><li>', $items) . '</li>'); echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); }
public function layout($model) { echo CHtml::openTag('div', array('class' => 'widget categories content-inner widget_post_category')); if ($this->data('title') != '') { echo CHtml::openTag('h3', array('class' => 'main-color widget_header')); echo $this->data('title'); echo CHtml::closeTag('h3'); } echo CHtml::openTag('div', array('class' => 'row')); echo CHtml::openTag('div', array('class' => 'col-xs-12')); $first = true; $end = CHtml::listData($model, 'ID', 'ID'); foreach ($model as $post) { if ($this->data('showThumbPost')) { echo CHtml::openTag('div', array('class' => 'single_comments')); echo "<span>"; if ($post->post_image != '') { echo CHtml::image(Helper::getThumb('content', $post->post_image)); } echo "</span>"; $this->getLink($post, true, $this->data('showExcerpt'), 20); echo CHtml::closeTag('div'); } else { echo CHtml::openTag('div', array('class' => 'single_comments')); $this->getLink($post, true, $this->data('showExcerpt'), $this->data('batasJudul')); echo CHtml::closeTag('div'); } } if ($this->data('showIndexLink')) { echo CHtml::Link('<i class="glyphicon glyphicon-plus"></i> Indeks ', array('indeks/populer'), array('class' => 'indeks')); } echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); }
/** * init the widget */ public function init() { $this->registerClientScript(); $this->getCalendarId(); echo CHtml::openTag('div', $this->htmlOptions); //Yii::app()->clientScript->registerScript(__CLASS__.'#'.$this->getId(), "var calendar = $('#$this->id').fullCalendar($this->calendarOptions);"); }
protected function renderItems($items) { foreach ($items as $i => $item) { if (!is_array($item)) { continue; } if (isset($item['visible']) && $item['visible'] === false) { continue; } if (!isset($item['itemOptions'])) { $item['itemOptions'] = array(); } $classes = array('item'); if ($i === 0) { $classes[] = 'active'; } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($item['itemOptions']['class'])) { $item['itemOptions']['class'] .= ' ' . $classes; } else { $item['itemOptions']['class'] = $classes; } } echo CHtml::openTag('div', $item['itemOptions']); if (isset($item['image'])) { if (!isset($item['alt'])) { $item['alt'] = ''; } if (!isset($item['imageOptions'])) { $item['imageOptions'] = array(); } $image = CHtml::image($item['image'], $item['alt'], $item['imageOptions']); if (isset($item['link'])) { echo CHtml::link($image, $item['link']); } else { echo $image; } } if (!empty($item['caption']) && (isset($item['label']) || isset($item['caption']))) { if (!isset($item['captionOptions'])) { $item['captionOptions'] = array(); } if (isset($item['captionOptions']['class'])) { $item['captionOptions']['class'] .= ' carousel-caption'; } else { $item['captionOptions']['class'] = 'carousel-caption'; } echo CHtml::openTag('div', $item['captionOptions']); if (isset($item['label'])) { echo '<h4>' . $item['label'] . '</h4>'; } if (isset($item['caption'])) { echo '<p>' . $item['caption'] . '</p>'; } echo '</div>'; } echo '</div>'; } }
/** * Run this widget. * This method registers necessary javascript and renders the needed HTML code. */ public function run() { $id = $this->getId(); $this->htmlOptions['id'] = $id; echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n"; $tabsOut = ""; $contentOut = ""; $tabCount = 0; foreach ($this->tabs as $title => $content) { $tabId = is_array($content) && isset($content['id']) ? $content['id'] : $id . '_tab_' . $tabCount++; if (!is_array($content)) { $tabsOut .= strtr($this->headerTemplate, array('{title}' => $title, '{url}' => '#' . $tabId)) . "\n"; $contentOut .= strtr($this->contentTemplate, array('{content}' => $content, '{id}' => $tabId)) . "\n"; } elseif (isset($content['content'])) { $tabsOut .= strtr($this->headerTemplate, array('{title}' => $title, '{url}' => '#' . $tabId)) . "\n"; $contentOut .= strtr($this->contentTemplate, array('{content}' => $content['content'], '{id}' => $tabId)) . "\n"; } elseif (isset($content['ajax'])) { $tabsOut .= strtr($this->headerTemplate, array('{title}' => $title, '{url}' => CHtml::normalizeUrl($content['ajax']))) . "\n"; } } echo "<ul>\n" . $tabsOut . "</ul>\n"; echo $contentOut; echo CHtml::closeTag($this->tagName) . "\n"; $options = empty($this->options) ? '' : CJavaScript::encode($this->options); Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').tabs({$options});"); }
public function init() { $this->defaultOptions = CMap::mergeArray($this->defaultOptions, array('delegate' => $this->delegate)); $this->target = '#' . $this->id; echo CHtml::openTag($this->tagName, array('id' => $this->id), $this->htmlOptions); parent::init(); }
public function run() { if (empty($this->links)) { return; } if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] .= ' breadcrumb'; } else { $this->htmlOptions['class'] = 'breadcrumb'; } echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n"; $links = array(); if ($this->homeLink === null) { $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl); } else { if ($this->homeLink !== false) { $links[] = $this->homeLink; } } foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url); } else { $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>'; } } $separator = CHtml::tag('span', array('class' => 'divider'), $this->separator) . CHtml::closeTag('li') . ' ' . CHtml::openTag('li'); echo CHtml::openTag('li') . implode($separator, $links) . CHtml::closeTag('li'); echo CHtml::closeTag($this->tagName); }
/** * Renders the items in this menu. * @param array $items the menu items */ public function renderItems($items) { foreach ($items as $item) { if (!is_array($item)) { echo '<li class="divider"></li>'; } else { if (!isset($item['itemOptions'])) { $item['itemOptions'] = array(); } $class = array(); if (!isset($item['url'])) { $item['header'] = true; $class[] = 'nav-header'; } if ($item['active']) { $class[] = 'active'; } $cssClass = implode(' ', $class); if (isset($item['itemOptions']['class'])) { $item['itemOptions']['class'] .= $cssClass; } else { $item['itemOptions']['class'] = $cssClass; } echo CHtml::openTag('li', $item['itemOptions']); $menu = $this->renderItem($item); if (isset($this->itemTemplate) || isset($item['template'])) { $template = isset($item['template']) ? $item['template'] : $this->itemTemplate; echo strtr($template, array('{menu}' => $menu)); } else { echo $menu; } echo '</li>'; } } }
/** * Retrieves all cards in a particular category * @param string $id The category id */ public function actionGetCardsByCategory($id = NULL) { if ($id === NULL) { throw new CHttpException(400, Yii::t('Dashboard.main', 'Missing category id')); } $categories = Yii::app()->cache->get('cards_in_category'); if ($categories === false) { $this->getCards(); $categories = Yii::app()->cache->get('cards_in_category'); } $cards = $categories[$id]; $elements = $elementOptions = array(); // TODO: Fix multiple select //$elementOptions['multiple'] = 'multiple'; foreach ($cards as $k => $card) { $asset = Yii::app()->assetManager->publish(YiiBase::getPathOfAlias($card['path']), true, -1, YII_DEBUG); $elements[] = $k; $elementOptions['options'][] = array('value' => $k, 'data-img-src' => Yii::app()->getBaseUrl(true) . $asset . '/default.png'); } $form = $this->beginWidget('ext.cii.widgets.CiiActiveForm', array('htmlOptions' => array('class' => 'pure-form pure-form-aligned item-selection-form'))); echo CHtml::openTag('div', array('class' => 'pure-form-group', 'style' => 'padding-bottom: 20px')); echo CHtml::link(Yii::t('Dashboard.main', 'Add to Dashboard'), '#', array('id' => 'add-cards-button', 'class' => 'pure-button pure-button-link pure-button-primary pull-right pure-button-small', 'style' => 'position: absolute; top: 15px; right: 3%;')); echo CHtml::tag('legend', array(), $id); echo CHtml::dropDownList('card', NULL, $elements, $elementOptions); echo CHtml::closeTag('div'); $this->endWidget(); }
public function run() { if (empty($this->links)) { return; } $this->activeLinkTemplate = '<a href="{url}" title="{title}" rel="v:url" property="v:title">{label}</a>'; echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n"; $links = array(); if ($this->homeLink === null) { $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl); } elseif ($this->homeLink !== false) { $links[] = $this->homeLink; } foreach ($this->links as $label => $url) { if (is_string($label) || is_array($url)) { $links[] = strtr($this->activeLinkTemplate, array('{url}' => CHtml::normalizeUrl($url), '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label, '{title}' => $this->encodeLabel ? CHtml::encode($label) : $label)); } else { $links[] = str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $this->inactiveLinkTemplate); } } echo "<div xmlns:v='http://rdf.data-vocabulary.org/#'>"; $i = 0; foreach ($links as $link) { if ($i > 0) { echo ' <i class="icon icon_mt"></i> '; } echo '<span typeof="v:Breadcrumb">' . $link . '</span>'; $i++; } echo "</div>"; //echo implode($this->separator,$links); echo CHtml::closeTag($this->tagName); }
/** * * @returns well formatted xml element * @param EFeedTag $tag */ private function getElement(EFeedTag $tag) { $element = ''; if (is_array($tag->content)) { $tag->attributes['rdf:parseType'] = "Resource"; } if (in_array($tag->name, $this->CDATAEncoded)) { $element .= CHtml::openTag($tag->name, $tag->attributes); $element .= '<![CDATA['; } else { $element .= CHtml::openTag($tag->name, $tag->attributes); } $element .= PHP_EOL; if (is_array($tag->content)) { foreach ($tag->content as $tag => $content) { $tmpTag = new EFeedTag($tag, $content); $element .= $this->getElement($tmpTag); } } else { $element .= in_array($tag->name, $this->CDATAEncoded) ? $tag->content : CHtml::encode($tag->content); } $element .= in_array($tag->name, $this->CDATAEncoded) ? PHP_EOL . ']]>' : ""; $element .= CHtml::closeTag($tag->name) . PHP_EOL; return $element; }
/** * Runs the widget. */ public function run() { list($name) = $this->resolveNameID(); // TODO: what is this? // Add a class of no-user-select to widget $this->htmlOptions['class'] = empty($this->htmlOptions['class']) ? 'no-user-select' : 'no-user-select ' . $this->htmlOptions['class']; // We are overriding the result of $this->resolveNameID() here, because $id which it emits is not unique through the page. if (empty($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $this->id; } // Adding essential class for timepicker to work. $this->wrapperHtmlOptions = $this->injectClass($this->wrapperHtmlOptions, 'bootstrap-timepicker'); if (!$this->noAppend) { $this->wrapperHtmlOptions = $this->injectClass($this->wrapperHtmlOptions, 'input-group'); } echo CHtml::openTag('div', $this->wrapperHtmlOptions); if ($this->hasModel()) { if ($this->form) { echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions); } } else { echo CHtml::textField($name, $this->value, $this->htmlOptions); } if (!$this->noAppend) { $this->echoAppend(); } echo CHtml::closeTag('div'); $this->registerClientScript($this->id); }
/** * Run this widget. */ public function run() { $id = $this->id; $content = array(); $items = $this->normalizeTabs($this->tabs, $content); ob_start(); $this->controller->widget('bootstrap.widgets.BootMenu', array('type' => $this->type, 'encodeLabel' => $this->encodeLabel, 'items' => $items)); $tabs = ob_get_clean(); ob_start(); echo '<div class="tab-content">'; echo implode('', $content); echo '</div>'; $content = ob_get_clean(); echo CHtml::openTag('div', $this->htmlOptions); echo $this->placement === self::PLACEMENT_BELOW ? $content . $tabs : $tabs . $content; echo '</div>'; /** @var CClientScript $cs */ $cs = Yii::app()->getClientScript(); $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').tab('show');"); // Register the "show" event-handler. if (isset($this->events['show'])) { $fn = CJavaScript::encode($this->events['show']); $cs->registerScript(__CLASS__ . '#' . $id . '.show', "jQuery('#{$id} a[data-toggle=\"tab\"]').on('show', {$fn});"); } // Register the "shown" event-handler. if (isset($this->events['shown'])) { $fn = CJavaScript::encode($this->events['shown']); $cs->registerScript(__CLASS__ . '#' . $id . '.shown', "jQuery('#{$id} a[data-toggle=\"tab\"]').on('shown', {$fn});"); } }
/** * @see CMenu::renderMenuRecursive */ protected function renderMenuRecursive($items) { foreach ($items as $item) { echo CHtml::openTag('li', isset($item['htmlOptions']) ? $item['htmlOptions'] : array()); if (isset($item['encodeLabel']) ? $item['encodeLabel'] : $this->encodeLabel) { $item['label'] = CHtml::encode($item['label']); } if (isset($item['url']) && !($this->activeLinkDisable && $item['active'])) { $menu = CHtml::link($item['label'], $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array()); } else { $menu = CHtml::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']); } if (isset($this->itemTemplate) || isset($item['template'])) { $template = isset($item['template']) ? $item['template'] : $this->itemTemplate; echo strtr($template, array('{menu}' => $menu)); } else { echo $menu; } if (isset($item['items']) && count($item['items'])) { echo "\n" . CHtml::openTag('ul', CMap::mergeArray($this->submenuHtmlOptions, $item['submenuHtmlOptions'] ? $item['submenuHtmlOptions'] : array())) . "\n"; $this->renderMenuRecursive($item['items']); echo CHtml::closeTag('ul') . "\n"; } echo CHtml::closeTag('li') . "\n"; } }