10 Yii::import(
'zii.widgets.CMenu');
55 echo CHtml::openTag(
'ul', $this->htmlOptions) .
"\n";
58 foreach ($items as $item) {
61 if (isset($item[
'divider'])) {
62 echo
"<li class=\"{$this->getDividerCssClass()}\"></li>\n";
64 $options = isset($item[
'itemOptions']) ? $item[
'itemOptions'] : array();
67 if ($item[
'active'] && $this->activeCssClass !=
'') {
68 $classes[] = $this->activeCssClass;
71 if (
$count === 1 && $this->firstItemCssClass !== null) {
72 $classes[] = $this->firstItemCssClass;
75 if (
$count === $n && $this->lastItemCssClass !== null) {
76 $classes[] = $this->lastItemCssClass;
79 if ($this->itemCssClass !== null) {
80 $classes[] = $this->itemCssClass;
83 if (isset($item[
'items'])) {
87 if (isset($item[
'disabled'])) {
88 $classes[] =
'disabled';
91 if (!empty($classes)) {
92 $classes = implode(
' ', $classes);
93 if (!empty($options[
'class'])) {
94 $options[
'class'] .=
' ' . $classes;
96 $options[
'class'] = $classes;
100 echo CHtml::openTag(
'li', $options) .
"\n";
104 if (isset($this->itemTemplate) || isset($item[
'template'])) {
105 $template = isset($item[
'template']) ? $item[
'template'] : $this->itemTemplate;
106 echo strtr($template, array(
'{menu}' => $menu));
111 if (isset($item[
'items']) && !empty($item[
'items'])) {
112 $dropdownOptions = array(
113 'encodeLabel' => $this->encodeLabel,
114 'htmlOptions' => isset($item[
'submenuOptions']) ? $item[
'submenuOptions']
115 : $this->submenuHtmlOptions,
116 'items' => $item[
'items'],
118 $dropdownOptions[
'id'] = isset($dropdownOptions[
'htmlOptions'][
'id']) ?
119 $dropdownOptions[
'htmlOptions'][
'id'] : null;
120 $this->controller->widget(
'booster.widgets.TbDropdown', $dropdownOptions);
143 if (isset($item[
'icon'])) {
144 if (strpos($item[
'icon'],
'icon') ===
false && strpos($item[
'icon'],
'fa') ===
false) {
145 $item[
'icon'] =
'glyphicon glyphicon-' . implode(
' glyphicon-', explode(
' ', $item[
'icon']));
146 $item[
'label'] =
"<span class='" . $item[
'icon'] .
"'></span>\r\n" . $item[
'label'];
148 $item[
'label'] =
"<i class='" . $item[
'icon'] .
"'></i>\r\n" . $item[
'label'];
152 if (!isset($item[
'linkOptions'])) {
153 $item[
'linkOptions'] = array();
156 if (isset($item[
'items']) && !empty($item[
'items'])) {
157 if (empty($item[
'url'])) {
161 if (isset($item[
'linkOptions'][
'class'])) {
162 $item[
'linkOptions'][
'class'] .=
' dropdown-toggle';
164 $item[
'linkOptions'][
'class'] =
'dropdown-toggle';
167 $item[
'linkOptions'][
'data-toggle'] =
'dropdown';
168 $item[
'label'] .=
' <span class="caret"></span>';
171 if (isset($item[
'url'])) {
172 return CHtml::link($item[
'label'], $item[
'url'], $item[
'linkOptions']);
174 return $item[
'label'];
191 foreach ($items as
$i => $item) {
192 if (!is_array($item)) {
193 $item = array(
'divider' =>
true);
195 if (!isset($item[
'itemOptions'])) {
196 $item[
'itemOptions'] = array();
201 if (!isset($item[
'url']) && !isset($item[
'items']) && $this->
isVertical()) {
202 $item[
'header'] =
true;
203 $classes[] =
'nav-header';
206 if (!empty($classes)) {
207 $classes = implode($classes,
' ');
208 if (isset($item[
'itemOptions'][
'class'])) {
209 $item[
'itemOptions'][
'class'] .=
' ' . $classes;
211 $item[
'itemOptions'][
'class'] = $classes;