$data['menus'] = Menus::getId($_GET['itemid']); $data['parent'] = Menus::isHadParent('', $menuid); Theme::admin('header', $data); System::inc('menus_form_edit', $data); Theme::admin('footer'); break; case 'del': if (isset($_GET['itemid'])) { if (!isset($_GET['token']) || !Token::isExist($_GET['token'])) { // VALIDATE ALL $alertred[] = TOKEN_NOT_EXIST; } if (isset($alertred)) { $data['alertred'] = $alertred; } else { Menus::delete($_GET['itemid']); $data['alertgreen'][] = 'Menu Deleted'; } if (isset($_GET['token'])) { Token::remove($_GET['token']); } } else { $data['alertred'][] = 'No ID Selected.'; } $data['menus'] = Options::get('menus'); Theme::admin('header', $data); System::inc('menus', $data); Theme::admin('footer'); break; case 'remove': if (isset($_GET['menuid'])) {
public function eliminarAction() { $this->view->subtitle = $this->info->sitio->menus->eliminar->titulo; $menu = new Menus(); if ($this->_request->isPost()) { Zend_Loader::loadClass('Zend_Filter_Alpha'); $filter = new Zend_Filter_Alpha(); $id = (int) $this->_request->getPost('id'); $del = $filter->filter($this->_request->getPost('del')); if ($del == 'Si' && $id > 0) { // Eliminamos el menu $where = 'id = ' . $id; $rows_affected = $menu->delete($where); // Eliminamos items del menu Zend_Loader::loadClass('MenusItems'); $items = new MenusItems(); $where = 'id_menu = ' . $id; $items->delete($where); } } else { $id = $this->_request->getParam('id'); if ($id > 0) { $this->view->menu = $menu->fetchRow('id=' . $id); if ($this->view->menu->id > 0) { $this->render(); return; } } } $this->_redirect('/admin/menus/'); }