23 include_once __DIR__ .
'/header.php';
29 $xoops->header(
'admin:menus/menus_admin_menu.tpl');
32 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
35 $op = Request::getCmd(
'op',
'list');
36 $id = Request::getInt(
'id', 0);
37 $pid = Request::getInt(
'pid', 0);
54 if (isset($_REQUEST[
'menu_id']) && in_array($_REQUEST[
'menu_id'], array_keys(
$menus_list))) {
72 $obj =
$helper->getHandlerMenu()->create();
73 $obj->setVar(
'pid',
$pid);
83 $id = Request::getInt(
'id', 0);
90 if (!
$xoops->security()->check()) {
91 $xoops->redirect(
'admin_menu.php', 3, implode(
'<br />',
$xoops->security()->getErrors()));
96 $id = Request::getInt(
'id', 0);
97 if (isset(
$id) &&
$id !=0) {
100 $obj =
$helper->getHandlerMenu()->create();
103 $this_handler =
$helper->getHandlerMenu();
108 $menus = $this_handler->getObjects(
$criteria);
110 if (isset($menus[0]) && is_object($menus[0])) {
111 $weight = $menus[0]->getVar(
'weight') + 1;
114 if (!isset($_POST[
'hooks'])) {
115 $_POST[
'hooks'] = array();
117 $obj->setVars($_POST);
118 $obj->setVar(
'weight',
$weight);
120 if (
$helper->getHandlerMenu()->insert($obj)) {
121 $this_handler->update_weights($obj);
122 $xoops->redirect(
'admin_menu.php?op=list&menu_id=' . $obj->getVar(
'mid'), 2, implode(
'<br />',
$msg));
124 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
130 $ok = Request::getInt(
'ok', 0);
134 if (!
$xoops->security()->check()) {
135 $xoops->redirect(
'admin_menu.php', 3, implode(
',',
$xoops->security()->getErrors()));
137 if (
$helper->getHandlerMenu()->delete($obj)) {
140 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
144 array(
'ok' => 1,
'id' =>
$id,
'op' =>
'del',
'menu_id' =>
$menu_id),
145 $helper->url(
'admin/admin_menu.php'),
153 $obj = $this_handler->get(
$id);
154 $obj->setVar(
'weight',
$weight);
155 $this_handler->insert($obj);
156 $this_handler->update_weights($obj);
157 $xoops->redirect(
'admin_menu.php?op=list&menu_id=' . $obj->getVar(
'mid'), 2,
_AM_MENUS_SAVE);
163 $obj = $this_handler->get(
$id);
165 $this_handler->insert($obj);
166 $xoops->redirect(
'admin_menu.php?op=list&menu_id=' . $obj->getVar(
'mid'), 2,
_AM_MENUS_SAVE);
174 $this_handler =
$helper->getHandlerMenu();
179 $xoops->tpl()->assign(
'select',
true);
185 $menus = $this_handler->getObjects(
$criteria);
187 foreach ($menus as
$menu) {
188 $array[] = $menu->getValues();
191 $menusArray = $builder->render();
192 $xoops->tpl()->assign(
'menus', $menusArray);
if(!is_object($module)||!$module->getVar('isactive')) $msg