Blame view

protected/components/SiteMenu.php 800 Bytes
a1684257   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  <?php
  
  Yii::import('zii.widgets.CMenu');
  
  class SiteMenu extends CMenu
  {
      public function init()
      {
          $this->htmlOptions['id'] = $this->getId();
          $route = $this->getController()->getRoute();
          $items = array();
          $mainMenu = SiteMenuHelper::getItems();
          foreach ($this->items as $k)
          if(isset($mainMenu[$k])){
              $item = $mainMenu[$k];
              $items[] = array(
                  'url' => $item['url'],
                  'label' => $item['label'],
                  'active' => $this->evaluateExpression($item['active'],array('controller'=>$this->getController())),
              );
          }
          $this->items = $items;
          $hasActiveChild = false;
          $this->items = $this->normalizeItems($this->items, $route, $hasActiveChild);
      }
  }