public function init() { parent::init(); $this->activateParents = true; $this->htmlOptions = array('class' => 'nav nav-list'); $this->submenuHtmlOptions = array('class' => 'nav nav-list'); }
public function init() { if (!empty($this->class)) { $this->htmlOptions['class'] = $this->class; } parent::init(); }
public function init() { $assets = Yii::app()->assetManager->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets', false, -1, true); $cs = Yii::app()->getClientScript(); $cs->registerCssFile($assets . '/emenu.css'); parent::init(); }
public function init() { parent::init(); $cs = Yii::app()->clientScript; $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/bootstrap.js', CClientScript::POS_END); Yii::app()->clientScript->registerCoreScript('jquery'); }
protected function renderMenuItem($item) { if (isset($item['icon'])) { $item['label'] .= Theme::img('icons/' . $item['icon'] . '.png'); } return parent::renderMenuItem($item); }
public function init() { // Here we define query conditions. $criteria = new CDbCriteria(); $criteria->limit = 2; $criteria->condition = '`status` = 1'; //$criteria->order = '`position` ASC'; $items = CmsPages::model()->findAll($criteria); //echo "items"."<pre>";print_r($items);die; foreach ($items as $item) { $this->items[] = array('label' => $item->title, 'url' => Yii::app()->createUrl("user/pages", array('id' => $item->id))); } // footer /* $criteria1 = new CDbCriteria; $criteria1->condition = '`status` = 1'; //$criteria->order = '`position` ASC'; $footeritems = CmsPages::model()->findAll($criteria1); //echo "items"."<pre>";print_r($footeritems);die; foreach ($footeritems as $footer) $this->items[] = array('label'=>$footer->title, 'url'=>Yii::app()->createUrl("user/pages",array('id'=>$footer->id))); */ parent::init(); }
function init() { parent::init(); if (!empty($this->htmlOptions['class'])) { $this->htmlOptions['class'] .= ' iconized'; } else { $this->htmlOptions['class'] = 'iconized'; } Yii::app()->clientScript->registerCssFile(Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets/iconizedMenu.css')); if ($this->useSprites) { $domains = array(); foreach ($this->items as $item) { $components = parse_url($item['url']); $domains[] = $components['host']; } $spriteUrl = $this->yandexBaseUrl . implode('/', $domains); $offset = 0; foreach ($this->items as &$item) { $item['linkOptions']['style'] = "background-image: url({$spriteUrl}); background-position: 0 {$offset}px"; $offset -= 16; } } else { foreach ($this->items as &$item) { $components = parse_url($item['url']); $iconUrl = $this->iconizerBaseUrl . $components['host']; $item['linkOptions']['style'] = "background-image: url({$iconUrl})"; } } }
public function init() { $this->htmlOptions = array('class' => 'profile-sidebar-menu'); $this->id = 'profile-sidebar-menu'; $this->activeCssClass = 'active'; parent::init(); }
public function init() { $class = array('dropdown'); $cssFile; if ($this->vertical) { $class[] = 'dropdown-vertical'; if ($this->rtl) { $class[] = 'dropdown-vertical-rtl'; $cssFile = 'dropdown.vertical.rtl.css'; } else { $cssFile = 'dropdown.vertical.css'; } } else { if ($this->upward) { $class[] = 'dropdown-upward'; $cssFile = 'dropdown.upward.css'; } else { $class[] = 'dropdown-horizontal'; $cssFile = 'dropdown.css'; } } $this->htmlOptions['class'] = implode(' ', $class); $basedir = dirname(__FILE__) . '/free-css-drop-down-menu'; $baseUrl = Yii::app()->getAssetManager()->publish($basedir); // echo $baseUrl; // yii::app()->end(); if ($this->themeCssFile == '') { switch ($this->theme) { case 'adobe': $this->themeCssFile = 'adobe.com/default.css'; break; case 'flikr': $this->themeCssFile = 'flikr.com/default.css'; break; case 'lwis': $this->themeCssFile = 'lwis.celebrity/default.css'; break; case 'mtv': $this->themeCssFile = 'mtv.com/default.css'; break; case 'nvidia': $this->themeCssFile = 'nvidia.com/default.css'; break; case 'vimeo': $this->themeCssFile = 'vimeo.com/default.css'; break; case 'default': default: $this->themeCssFile = 'default/default.css'; break; } } Yii::app()->getClientScript()->registerCSSFile($baseUrl . '/css/dropdown/' . $cssFile)->registerCSSFile($baseUrl . '/css/dropdown/themes/' . $this->themeCssFile); // Yii::app()->getClientScript()->registerScriptFile($baseUrl.'/js/jqueryslidemenu.js'); // Yii::app()->getClientScript()->registerCSSFile($baseUrl.'/css/jqueryslidemenu.css'); //ToDo: these should added just for IE7, i don't know how to do this // Yii::app()->getClientScript()->registerCoreScript('jquery') // ->registerScriptFile($baseUrl.'/js/jquery.dropdown.js'); parent::init(); }
/** * */ public function init() { if ($this->cssFile === null) { $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'responsiveCMenu.css'; $this->cssFile = Yii::app()->getAssetManager()->publish($file); } Yii::app()->clientScript->registerCssFile($this->cssFile); parent::init(); }
public function init() { $model = MenuModel::model()->enabled()->findAll(); $result = array(); foreach ($model as $item) { $result[] = array('label' => $item->label, 'url' => $item->url, 'active' => $this->isActive($item->url)); } $this->items = CMap::mergeArray($result, $this->items); parent::init(); }
public function init() { for ($i = 2013; $i <= date("Y"); $i++) { if ($i == $this->id_select) { echo "<option value='" . $i . "' selected>" . $i . "</option>"; } else { echo "<option value='" . $i . "'>" . $i . "</option>"; } } parent::init(); }
public function init() { // Here we define query conditions. $criteria = new CDbCriteria(); //$criteria->condition = '`status` = 1'; $criteria->order = '`id` ASC'; $items = CmsvideoMenu::model()->findAll($criteria); foreach ($items as $item) { $this->items[] = array('label' => $item->menu_text, 'url' => $item->menu_link); } parent::init(); }
public function init() { $items = SideBarMenu::model()->findAll(); foreach ($items as $item) { if ($item->id_parent == 0) { // $categories[(int)$item->id] = array((int)$item->id=>array('name'=>$item->name)) ; // рабочее $this->items[$item->id] = array('label' => ' <i class="' . $item->icon_class . '"></i><span>' . $item->name . '</span>', 'url' => array($item->url)); } else { // $categories[(int)$item->id_parent][(int)$item->id]=array($item->name) ; // рабочее $this->items[$item->id_parent]['items'][] = array('label' => $item->name, 'url' => array($item->url), 'submenuOptions' => array('class' => 'has-child', 'style' => 'display: list-item;')); } } parent::init(); }
public function init() { if (!$this->getId(false)) { $this->setId('nav'); } // add the script $cs = Yii::app()->getClientScript(); $cs->registerCoreScript('jquery'); $this->nljs = "\n"; $this->items = $this->cssParentItems($this->items); $js = $this->createJsCode(); $cs->registerScript('mainmenu_' . $this->getId(), $js, CClientScript::POS_READY); parent::init(); }
public function init() { if ($this->name) { $menu = Menu::model()->findByAttributes(array('name' => $this->name)); } elseif ($this->id) { $menu = Menu::model()->findByPk($this->id); } elseif ($menu = Menu::model()->findByAttributes(array('name' => 'Main'))) { //NOP, assignment done within the codition above } else { //find the first one $menu = Menu::model()->find(); } if (!$menu) { return false; //throw new CHttpException(404, 'The specified menu (id=' . $this->id . ') cannot be found.'); } $class = array('dropdown', $menu->theme . '-theme'); if ($menu->vertical) { $class[] = 'dropdown-vertical'; if ($menu->rtl) { $class[] = 'dropdown-vertical-rtl'; $cssFile = 'dropdown.vertical.rtl.css'; } else { $cssFile = 'dropdown.vertical.css'; } } else { if ($menu->upward) { $class[] = 'dropdown-upward'; $cssFile = 'dropdown.upward.css'; } else { $class[] = 'dropdown-horizontal'; $cssFile = 'dropdown.css'; } } $this->htmlOptions['class'] = implode(' ', $class); //print_r($menu->items); $items = $menu->items; $this->items = array_merge($items, $this->append); // $this->items = $menu->items; //print_r($this->items); $basedir = dirname(__FILE__) . '/../assets/frontend'; $baseUrl = Yii::app()->getAssetManager()->publish($basedir); Yii::app()->getClientScript()->registerCSSFile($baseUrl . '/css/' . $cssFile)->registerCSSFile($baseUrl . '/themes/' . $menu->theme . '/default.css'); //ToDo: these should added just for IE7, i don't know how to do this // Yii::app()->getClientScript()->registerCoreScript('jquery') // ->registerScriptFile($baseUrl.'/js/jquery.dropdown.js'); parent::init(); }
/** * Initialize the widget */ public function init() { if (!$this->getId(false)) { $this->setId('cssmenu'); } $this->nljs = "\n"; $defaultItems = array('system' => array('label' => Yii::t('app', 'SYSTEM'), 'icon' => 'fa-gear'), 'modules' => array('label' => Yii::t('app', 'MODULES'), 'icon' => 'fa-bars')); $cacheID = self::CACHE_ID . '-' . Yii::app()->language; // $items = Yii::app()->cache->get($cacheID); // if ($items === false) { $found = $this->findMenu(); // unset($found['system'],$found['users']); //} $items = CMap::mergeArray($defaultItems, $found); $this->items = $this->cssParentItems($items); parent::init(); }
public function init() { for ($i = 1; $i <= 12; $i++) { if ($i <= 9) { if ($i == $this->id_select) { echo "<option value='0" . $i . "' selected>" . $this->Bulan($i - 1) . "</option>"; } else { echo "<option value='0" . $i . "'>" . $this->Bulan($i - 1) . "</option>"; } } else { if ($i == $this->id_select) { echo "<option value='" . $i . "' selected>" . $this->Bulan($i - 1) . "</option>"; } else { echo "<option value='" . $i . "'>" . $this->Bulan($i - 1) . "</option>"; } } } parent::init(); }
/** * Init widget */ public function init() { parent::init(); EBootstrap::mergeClass($this->htmlOptions, array('nav')); if ($this->pills) { EBootstrap::mergeClass($this->htmlOptions, array('nav-pills')); } else { EBootstrap::mergeClass($this->htmlOptions, array('nav-tabs')); } if ($this->stacked) { EBootstrap::mergeClass($this->htmlOptions, array('nav-stacked')); } Yii::app()->clientScript->registerCoreScript('jquery'); if (is_null($this->jsFile)) { $jsFile = dirname(__FILE__) . '/js/bootstrap.min.js'; $this->jsFile = Yii::app()->getAssetManager()->publish($jsFile); Yii::app()->clientScript->registerScriptFile($this->jsFile); } }
/** * @param array $item * @param string $route * @return bool */ public function isItemActive($item, $route) { if ($item['condition_active'] != '') { return eval($item['condition_active']); } else { return parent::isItemActive($item, $route) || (isset($item['url']) && is_string($item['url']) ? strcasecmp($item['url'], Yii::app()->getRequest()->requestUri) == 0 : false); } /* if(isset($item['url'])) { if($item['url'] != Yii::app()->request->requestUri) { return ($item['condition_active'] != '') ? eval($item['condition_active']) : false; } return true; } return ($item['condition_active'] != '') ? eval($item['condition_active']) : false;; * */ }
public function init() { parent::init(); $this->activateParents = true; Yii::app()->clientScript->registerScript('menutoggle', "\$('.parent').click(function() { \$(this).next().fadeToggle(250);});"); }
/** * Normalizes the {@link items} property so that the 'active' state is properly identified for every menu item. * @param array $items the items to be normalized. * @param string $route the route of the current request. * @param boolean $active whether there is an active child menu item. * @return array the normalized menu items */ protected function normalizeItems($items, $route, &$active) { foreach ($items as $i => $item) { if (!is_array($item)) { $item = array('divider' => true); } else { if (!isset($item['itemOptions'])) { $item['itemOptions'] = array(); } $classes = array(); if (!isset($item['url']) && !isset($item['items']) && $this->isVertical()) { $item['header'] = true; $classes[] = 'nav-header'; } if (!empty($classes)) { $classes = implode($classes, ' '); if (isset($item['itemOptions']['class'])) { $item['itemOptions']['class'] .= ' ' . $classes; } else { $item['itemOptions']['class'] = $classes; } } } $items[$i] = $item; } return parent::normalizeItems($items, $route, $active); }
} } $pageTitle = GetMessage("PAGE_NEW_DEFAULT_TITLE") . ($fileNumber != "" ? " (" . $fileNumber . ")" : ""); $editAfterSave = true; $addToMenu = true; $menuName = ""; $menuType = false; $menuItemPosition = -1; $pageTags = ""; } //Get Menu $arMenu = array(); if (IsModuleInstalled("fileman") && $USER->CanDoOperation("fileman_add_element_to_menu")) { $arMenuTypes = GetMenuTypes($site); foreach ($arMenuTypes as $type => $name) { $menu = new CMenu($type); $menu->Init($path); $actualDir = $menu->MenuDir; $currentDir = rtrim($path, "/") . "/"; if (strlen($actualDir) > 0) { $actualMenuFile = $actualDir . "." . $type . ".menu.php"; $fileOperation = $io->FileExists($documentRoot . $actualMenuFile) ? "fm_edit_existent_file" : "fm_create_new_file"; if (!$USER->CanDoFileOperation("fm_add_to_menu", array($site, $actualMenuFile)) || !$USER->CanDoFileOperation($fileOperation, array($site, $actualMenuFile))) { $actualDir = false; } } else { $actualDir = false; } $currentMenuFile = $currentDir . "." . $type . ".menu.php"; $fileOperation = $io->FileExists($documentRoot . $currentMenuFile) ? "fm_edit_existent_file" : "fm_create_new_file"; if (!$USER->CanDoFileOperation('fm_add_to_menu', array($site, $currentMenuFile)) || !$USER->CanDoFileOperation($fileOperation, array($site, $currentMenuFile))) {
public function run() { $items = $this->items; foreach ($items as $item) { $this->items = $item['items']; if (count($this->items) == 0) { continue; } echo '<div class="panel panel-default"> <a class="panel-heading collapsed" href="#smm-' . $item['id_object'] . '" data-toggle="collapse">' . $item['label'] . '</a> <div id="smm-' . $item['id_object'] . '" class="collapse panel-collapse">'; parent::run(); echo ' </div> </div> '; } }
function __construct($table = 'article', $table_parent = 'categorie') { parent::__construct($table, $table_parent); }
public function init() { parent::init(); }
/** * Run the widget */ public function run() { $this->publishAssets(); $this->registerClientScripts(); $this->registerCssFile($this->cssFile); $htmlOptions['id'] = 'nav-container'; echo CHtml::openTag('div', $htmlOptions) . "\n"; $htmlOptions['id'] = 'nav-bar'; echo CHtml::openTag('div', $htmlOptions) . "\n"; parent::run(); echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); }
function _SetSelectedItems(&$arResult, $bMultiSelect = false) { /** @global CMain $APPLICATION */ global $APPLICATION; $cur_page = $APPLICATION->GetCurPage(true); $cur_page_no_index = $APPLICATION->GetCurPage(false); $cur_selected = -1; $cur_selected_len = -1; foreach ($arResult as $iMenuItem => $MenuItem) { $LINK = $MenuItem['LINK']; $ADDITIONAL_LINKS = $MenuItem['ADDITIONAL_LINKS']; $SELECTED = false; $all_links = array(); if (is_array($ADDITIONAL_LINKS)) { foreach ($ADDITIONAL_LINKS as $link) { $tested_link = trim($link); if (strlen($tested_link) > 0) { $all_links[] = $tested_link; } } } $all_links[] = $LINK; if ($MenuItem['PERMISSION'] != 'Z') { foreach ($all_links as $tested_link) { if ($tested_link == '') { continue; } $SELECTED = CMenu::IsItemSelected($tested_link, $cur_page, $cur_page_no_index); if ($SELECTED) { $arResult[$iMenuItem]['SELECTED'] = true; break; } } } if ($SELECTED && !$bMultiSelect) { /** @noinspection PhpUndefinedVariableInspection */ $new_len = strlen($tested_link); if ($new_len > $cur_selected_len) { if ($cur_selected !== -1) { $arResult[$cur_selected]['SELECTED'] = false; } $cur_selected = $iMenuItem; $cur_selected_len = $new_len; } elseif ($new_len > 1) { $arResult[$iMenuItem]['SELECTED'] = false; } } } }
function GetMenu($type = "left", $bMenuExt = false, $template = false, $sInitDir = false) { $menu = new CMenu($type); if ($sInitDir === false) { $sInitDir = $this->GetCurDir(); } if (!$menu->Init($sInitDir, $bMenuExt, $template)) { $menu->MenuDir = $sInitDir; } return $menu; }
/** * Run the widget */ public function run() { $this->publishAssets(); $this->registerClientScripts(); parent::run(); }