Ejemplo n.º 1
0
 public function menuAction()
 {
     $this->view->menu_menu = 'selected';
     $this->view->item = $this->_getParam('item', 'new');
     // 0 якщо рухаємо  меню
     if ($move = $this->_getParam('move', false)) {
         Model_Menu::movemenu($this->view->item, $move);
     }
     //echo "false";
     $this->view->lang = $this->_getParam('lang', 'ua');
     //var_dump(Model_Users::getDefaultAdapter());
     $this->view->mainmenu = Model_Menu::getAll(0);
     $this->view->pages = Model_Page::getAll();
     //перевіряємо на видалення
     $delete = $this->_getParam('delete', false);
     if ($delete && Zend_Validate::is($this->view->item, 'Digits')) {
         Model_Menu::deletemenu($this->view->item);
         $this->_redirect('/admin/menu');
     }
     // якщо треба отримати дані за id меню
     if (Zend_Validate::is($this->view->item, 'Digits')) {
         $this->view->menudata = Model_Menu::getById($this->view->item, $this->view->lang);
         if ($this->view->menudata->parent == 0) {
             $this->view->curmenu = $this->view->menudata->idmenu;
         } else {
             $this->view->curmenu = $this->view->menudata->parent;
         }
         $this->view->submenu = Model_Menu::getAll($this->view->curmenu);
     } else {
         $this->view->menudata = Model_Menu::getById(NULL);
     }
     //var_dump($this->view->submenu);exit;
 }