/** * Update one menu * */ public function update() { $id_menu = $this->input->post('id_menu'); if ($id_menu) { $this->menu_model->update($id_menu, $this->input->post()); if (Authority::can('access', 'admin/menu/permissions/backend')) { $resource = 'backend/menu/' . $id_menu; $this->rule_model->save_element_roles_rules($resource, $this->input->post('backend_rule')); } } // UI update panels $this->_update_panels(); $this->success(lang('ionize_message_menu_updated')); }
/** * Register Edit / New Menu form data * * @access private * @param array $_post _POST array * @return void */ private function editing($id, $_post) { $msg = null; // check permission if ($_post['id']) { $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'menus', $_post['id'], 2); } else { $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], '_menu_creation', 0, 4); } if (is_null($msg)) { // handle _post $post = array('id_theme' => $_post['id_theme'], 'name' => $_post['name'], 'description' => $_post['description']); $mod = new Menu_model(); // update or insert if ($_post['id']) { $result = $mod->update($_post['id'], $post); } else { $result = $mod->insert($post); // add pemission if ($result[1]) { $perm = new Permission_model(); $array[] = array('action' => 'insert', 'id_what' => $result[0], 'id_user' => $_SESSION['xuid'], 'level' => 4); $result = $perm->pexec('menus', $array, 1); } } // set message $msg = AdmUtils_helper::set_msg($result); if ($result[1]) { $theme = $mod->get_var($post['id_theme'], 'themes', 'name'); $msg->update[] = array('element' => 'tdown', 'url' => BASE_URL . 'menus/index/' . $post['id_theme'] . '/' . $theme, 'title' => null); } } $this->response($msg); }