PATH:
home
/
letacommog
/
letaweb
/
admin
/
modules
/
menu
<?php class CWidgetMenu extends CWidgetModule { public $menu_items; public $rtl; public $dynamic; public $vertical; public $class; protected function decodeData() { $this->dynamic = getIndex($this->module_data, 'dynamic', false, 'boolean'); $this->rtl = getIndex($this->module_data, 'rtl', false, 'boolean'); $this->vertical = getIndex($this->module_data, 'vertical', false, 'boolean'); if (!$this->dynamic) { $this->menu_items = $this->module_data['menu_items']; } $this->class = ''; if ($this->rtl) { $this->class = ' sm-rtl'; } if ($this->vertical) { $this->class = ' sm-vertical'; } } public function createUrl($item) { $link = trim($item['link']); settype($link, 'integer'); $page = BPages::model()->findByPk($link);//$db->query('select name from pages where id='.(int)$link)->fetchAllRows(); if (isset($page)) { return URL::createPageURL($page['name'], isset($item['parameters']) ? $item['parameters'] : ''); } return ''; } public function getChildPages($id) { $pages = BPages::model()->findAll(array('order' => 'priority asc', 'condition' => 'no_display = 0 and parent_id=:parent_id', 'params' => array(':parent_id' => $id))); return $pages; } public function hasChildPages($id) { $rs = BPages::model()->exists('no_display = 0 and parent_id=:parent_id', array(':parent_id' => $id)); return $rs; } public function renderSystemMenu($id) { $menu_param = 'm'; $s = '<ul class="sm'.$this->class.'">'; $pagename = ''; $i = 0; $j = 0; $pages = $this->getChildPages($id); foreach ($pages as $page) { $active = ''; if (isset($pagename)) { if ($page->name == $pagename) { $active = 'current active'; } } $s = $s.'<li class="top-menu-item menu-item menu-item-'.$i.' '.$active.'">'; $lnk = Yii::app()->createUrl(strtolower($page->name)); $s = $s.'<a rel='.$page['name'].' href="'.$lnk.'" alt="">'.$page['display_name'].'</a>'; $s = $s.$this->renderSystemMenuItem($page['id'], $i); $s = $s.'</li>'; ++$i; ++$j; } $s = $s.'</ul>'; return $s; } public function renderMenu($item) { $menu_param = 'm'; $s = '<ul class="sm'.$this->class.'">'; $pagename = '';// Yii::app()->context->page->name; $i = 0; $j = 0; foreach ($item as $im) { $active = ''; if (isset($pagename)) { if ($im['link'] == $pagename) { $active = 'current active'; } } $s = $s.'<li class="top-menu-item menu-item menu-item-'.$i.' '.$active.'">'; $lnk = $this->createUrl($im); $s = $s.'<a rel='.$im['link'].' href="'.$lnk.'" alt="">'.$im['name'].'</a>'; $items = getIndex($im, 'items', array()); if (is_array($items) && sizeof($items)) { $s = $s.$this->renderMenuItem($items, $i, $j); } $s = $s.'</li>'; ++$i; ++$j; } $s = $s.'</ul>'; return $s; } public function renderSystemMenuItem($id, $iindex) { $pages = $this->getChildPages($id); if (sizeof($pages) == 0) { return ''; } $s = '<ul>'; $index = $iindex; ++$index; foreach ($pages as $page) { $s = $s.'<li class="menu-item menu-item-'.$index.'">'; $lnk = Yii::app()->createUrl($page->name); $s = $s.'<a href="'.$lnk.'" alt="">'.$page['display_name'].'</a>'; $s = $s.$this->renderSystemMenuItem($page['id'], $index); $s = $s.'</li>'; ++$index; } $s = $s.'</ul>'; return $s; } public function renderMenuItem($item, &$index, $root) { $s = '<ul>'; ++$index; foreach ($item as $im) { $s = $s.'<li class="menu-item menu-item-'.$index.'">'; $lnk = $this->createUrl($im); $s = $s.'<a href="'.$lnk.'" alt="">'.$im['name'].'</a>'; if (isset($im['items']) && sizeof($im['items'])) { $s = $s.$this->renderMenuItem($im['items'], $index, $root); } $s = $s.'</li>'; ++$index; } $s = $s.'</ul>'; return $s; } }
[+]
..
[-] frontend_script.php
[edit]
[-] backend.php
[edit]
[-] backend.js
[edit]
[-] frontend_view.php
[edit]
[-] frontend_class.php
[edit]