Exemple #1
0
 public function onCreate()
 {
     parent::onCreate();
     $this->setId('templateMainMenu');
     $actions = Manager::getActions('template');
     foreach ($actions as $i => $group) {
         $baseGroup = new MBaseGroup("menu{$i}", $group[0]);
         $baseGroup->setFieldSet(false);
         $tree = new MTree("tree{$i}");
         $groupActions = $group[ACTION_ACTIONS];
         $array = array();
         $j = 0;
         foreach ($groupActions as $action) {
             $array[$j] = array($j, $action[ACTION_CAPTION], $action[ACTION_PATH], 'root');
             if (is_array($action[ACTION_ACTIONS])) {
                 $k = $j;
                 foreach ($action[ACTION_ACTIONS] as $internalAction) {
                     $j++;
                     $array[$j] = array($j, $internalAction[ACTION_CAPTION], $internalAction[ACTION_PATH], $k);
                 }
             }
             $j++;
         }
         $tree->setItemsFromArray($array);
         $baseGroup->addControl($tree);
         $this->addControl($baseGroup);
     }
 }
Exemple #2
0
 public function onCreate()
 {
     parent::onCreate();
     $this->setId('exemplosMainMenu');
     $actions = Manager::getActions('exemplos');
     foreach ($actions as $i => $group) {
         $baseGroup = new MBaseGroup("menu{$i}", $group[0]);
         $baseGroup->setFieldSet(false);
         $tree = new MTree("tree{$i}");
         $groupActions = $group[5];
         $array = array();
         foreach ($groupActions as $j => $action) {
             $array[] = array($j, $action[0], $action[1], 'root');
         }
         $tree->setItemsFromArray($array);
         $baseGroup->addControl($tree);
         $this->addControl($baseGroup);
     }
 }