Source for file menumaint-defs.php

Documentation is available at menumaint-defs.php

  1. <?php
  2. /* ******************************************************************** */
  3. /* CATALYST PHP Source Code */
  4. /* -------------------------------------------------------------------- */
  5. /* This program is free software; you can redistribute it and/or modify */
  6. /* it under the terms of the GNU General Public License as published by */
  7. /* the Free Software Foundation; either version 2 of the License, or */
  8. /* (at your option) any later version. */
  9. /* */
  10. /* This program is distributed in the hope that it will be useful, */
  11. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  12. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  13. /* GNU General Public License for more details. */
  14. /* */
  15. /* You should have received a copy of the GNU General Public License */
  16. /* along with this program; if not, write to: */
  17. /* The Free Software Foundation, Inc., 59 Temple Place, Suite 330, */
  18. /* Boston, MA 02111-1307 USA */
  19. /* -------------------------------------------------------------------- */
  20. /* */
  21. /* Filename: menumaint-defs.php */
  22. /* Author: Paul Waite */
  23. /* Description: Definitions for maintenance of menus. Menu structure is */
  24. /* stored in the Axyl database in the ax_menu and the */
  25. /* ax_menuoption tables. This module contains classes */
  26. /* which allow this to be maintained via web forms. */
  27. /* */
  28. /* ******************************************************************** */
  29. /** @package menu */
  30. include_once("menu-defs.php");
  31.  
  32. // ......................................................................
  33. /** Create new menuoption */
  34. ("NEW_MENUOPTION", -1);
  35.  
  36. // ......................................................................
  37. /**
  38. * Menu Maintainer
  39. * @package menu
  40. */
  41. class menumaintainer extends HTMLObject {
  42. // Public
  43. /** The name of the menu */
  44.  
  45. var $menu_name = "";
  46. /** The language of the menu (0 = default) */
  47.  
  48. var $language = 0;
  49. /** The name of the language of the menu */
  50.  
  51. var $lang_desc = "default";
  52. /** The description of the menu */
  53.  
  54. var $menu_desc = "";
  55.  
  56. // Private
  57. /** The ID of the menu
  58. @access private */
  59. var $menu_id = false;
  60. /** Array of groups allowed to access menu
  61. @access private */
  62. var $user_groups = array();
  63. /** Menu active flag
  64. @access private */
  65. var $active = true;
  66. /** The parent ID of the menu-options being edited
  67. @access private */
  68. var $edit_parent_id = 0;
  69. /** The ID of the current menuoption being edited, if any
  70. @access private */
  71. var $edit_menuop_id;
  72. /** The level of the menu-options
  73. @access private */
  74. var $menu_level = 0;
  75. /** Whether this menu exists in the database
  76. @access private */
  77. var $exists = false;
  78. /** The array of menu options
  79. @access private */
  80. var $menuoptions = array();
  81. /** The name of our form
  82. @access private */
  83. var $formname = "";
  84. // ....................................................................
  85. /**
  86. * Constructor
  87. * Create a new menumaintainer.
  88. * @param string $id The unique name/identity of the menu.
  89. * @param integer $pid The optional id of a parent menuoption.
  90. * @param boolean $multilang If true, offer multi-language options
  91. */
  92. function menumaintainer($menuname="", $pid=0, $multilang=MULTILANG_DISABLED) {
  93. global $edit_parent_id, $sel_menu_id, $edit_menu_id, $menuopid;
  94. global $menumode, $menu_name, $language;
  95. global $RESPONSE;
  96.  
  97. // Mode
  98. if (isset($menumode)) $this->mode = $menumode;
  99. else $this->mode = "viewing";
  100.  
  101. // Initialise..
  102. $this->multilang = $multilang;
  103. $this->formname = "menufm";
  104.  
  105. // When you have one of these, you need this script..
  106. $RESPONSE->add_script(
  107. "function menugo(mode) {\n"
  108. . " var rc=true;\n"
  109. . " if(mode=='delete') {\n"
  110. . " var msg = \"WARNING:\\n\\n\";\n"
  111. . " msg+=\"Do you really want to delete this menu?\\n\\n\";\n"
  112. . " rc = confirm(msg);\n"
  113. . " }\n"
  114. . " if(rc) {\n"
  115. . " document.forms." . $this->formname . ".menumode.value=mode;\n"
  116. . " document.forms." . $this->formname . ".submit();\n"
  117. . " }\n"
  118. . "}\n"
  119. );
  120.  
  121. // Set up menu name..
  122. if ($menuname != "") {
  123. $this->menu_name = $menuname;
  124. }
  125. elseif (isset($menu_name)) {
  126. $this->menu_name = $menu_name;
  127. }
  128.  
  129. // Set up menu language..
  130. if ($this->multilang && isset($language)) {
  131. $this->language = $language;
  132. }
  133.  
  134. if ($this->mode != "createnew") {
  135. // Obtain a menu ID to work with..
  136. // A menu we are selecting..
  137. if (isset($sel_menu_id)) {
  138. $this->menu_id = $sel_menu_id;
  139. }
  140. // A menu we are editing currently..
  141. elseif (isset($edit_menu_id)) {
  142. $this->menu_id = $edit_menu_id;
  143. }
  144.  
  145. // A language we are selecting..
  146. // Save parent ID..
  147. if (isset($edit_parent_id)) {
  148. $this->edit_parent_id = $edit_parent_id;
  149. }
  150. else {
  151. $this->edit_parent_id = $pid;
  152. }
  153.  
  154. // Edit request overrides parent ID..
  155. if ($this->mode == "edit" && isset($menuopid)) {
  156. $m = new menuoption($menuopid);
  157. if ($m->exists) {
  158. $this->edit_parent_id = $m->parent_id;
  159. $this->edit_menuop_id = $menuopid;
  160. $this->mode = "editing";
  161. }
  162. }
  163. }
  164. // Process anything POSTed via form..
  165. $this->POSTprocess();
  166.  
  167. // Edit new, or get the existing menu..
  168. if ($this->mode != "createnew") {
  169. $this->get();
  170. }
  171.  
  172. } // menumaintainer
  173. // ....................................................................
  174. /**
  175. * Get the menu
  176. * Retrieves the specified menu from database. If it doesn't exist
  177. * then we create a new one.
  178. * @return boolean True if the record was acquired successfully
  179. */
  180. function get() {
  181. debug_trace($this);
  182. $this->exists = false;
  183.  
  184. // Two method of finding the menu - by ID and by Name/language..
  185. $qByName = "SELECT * FROM ax_menu m, ax_language l";
  186. $qByName .= " WHERE m.lang_id=$this->language";
  187. $qByName .= " AND l.lang_id=m.lang_id";
  188. if ($this->menu_name != "") {
  189. $qByName .= " AND menu_name='" . addslashes($this->menu_name) . "'";
  190. }
  191. $qByID = "SELECT * FROM ax_menu m, ax_language l";
  192. $qByID .= " WHERE m.menu_id=$this->menu_id";
  193. $qByID .= " AND l.lang_id=m.lang_id";
  194.  
  195. // Try and find it..
  196. $found = false;
  197. if ($this->menu_id != false) {
  198. $mnuQ = dbrecordset($qByID);
  199. $found = $mnuQ->hasdata;
  200. }
  201. // Fallback procedure..
  202. if (!$found) {
  203. $mnuQ = dbrecordset($qByName);
  204. }
  205. if ($mnuQ->hasdata) {
  206. $this->menu_id = $mnuQ->field("menu_id");
  207. $this->menu_name = $mnuQ->field("menu_name");
  208. $this->language = $mnuQ->field("lang_id");
  209. $this->lang_desc = $mnuQ->field("lang_desc");
  210. $this->menu_desc = $mnuQ->field("menu_desc");
  211. $this->user_groups = explode(",", $mnuQ->field("menu_user_groups"));
  212. $this->active = $mnuQ->istrue("active");
  213. $this->exists = true;
  214. $this->menu_level = 0;
  215.  
  216. // Get menuoptions as required..
  217. $q = "SELECT *";
  218. $q .= " FROM ax_menuoption";
  219. $q .= " WHERE menu_id=$this->menu_id";
  220. if ($this->edit_parent_id > 0) {
  221. $q .= " AND parent_id=$this->edit_parent_id";
  222. }
  223. else {
  224. $q .= " AND menu_level=0";
  225. }
  226. $q .= " ORDER BY display_order";
  227. $mnuQ = dbrecordset($q);
  228. if ($mnuQ->hasdata) {
  229. do {
  230. $menuoptionid = $mnuQ->field("menuoption_id");
  231. $menuoption = new menuoption();
  232. $menuoption->menu_id = $this->menu_id;
  233. $menuoption->menuoptionid = $menuoptionid;
  234. $menuoption->parent_id = $mnuQ->field("parent_id");
  235. $menuoption->user_groups = explode(",", $mnuQ->field("user_groups"));
  236. $menuoption->user_type = $mnuQ->field("user_type");
  237. $menuoption->menu_level = $mnuQ->field("menu_level");
  238. $menuoption->label = $mnuQ->field("label");
  239. $menuoption->description = $mnuQ->field("description");
  240. $menuoption->display_order = $mnuQ->field("display_order");
  241. $menuoption->action = $mnuQ->field("action");
  242. $menuoption->sitepage = $mnuQ->field("sitepage");
  243. $menuoption->sitepage_parms = $mnuQ->field("sitepage_parms");
  244. $menuoption->auth_code = $mnuQ->istrue("auth_code");
  245. $menuoption->active = $mnuQ->istrue("active");
  246. $menuoption->last_modified = $mnuQ->field("last_modified");
  247. $menuoption->width = $mnuQ->field("width");
  248. $menuoption->height = $mnuQ->field("height");
  249. $menuoption->is_parent = $mnuQ->istrue("is_parent");
  250. $menuoption->exists = true;
  251. $menuoption->syncparms();
  252. // Stash menuoption..
  253. $this->menuoptions[$menuoptionid] = $menuoption;
  254. } while ($mnuQ->get_next());
  255. $this->menu_level = $menuoption->menu_level;
  256. }
  257. }
  258. debug_trace();
  259. // Return true if at least the menu exists..
  260. return $this->exists;
  261. } // get
  262. // ....................................................................
  263. /**
  264. * Save this menu to the database. Create a new one if it doesn't
  265. * already exist.
  266. */
  267. function put() {
  268. debug_trace($this);
  269. // Deal with brand new menu..
  270. if ($this->exists) {
  271. $mnuQ = new dbupdate("ax_menu");
  272. $mnuQ->where("menu_id=$this->menu_id");
  273. }
  274. else {
  275. $mnuQ = new dbinsert("ax_menu");
  276. $this->menu_id = get_next_sequencevalue("seq_menu_id", "ax_menu", "menu_id");
  277. $mnuQ->set("menu_id", $this->menu_id);
  278. }
  279. $mnuQ->set("menu_name", $this->menu_name);
  280. $mnuQ->set("menu_desc", $this->menu_desc);
  281. $mnuQ->set("menu_user_groups", implode(",", $this->user_groups));
  282. $mnuQ->set("active", $this->active);
  283. $mnuQ->set("last_modified", 'now()');
  284. $this->exists = $mnuQ->execute();
  285.  
  286. // Save any menuoptions..
  287. if (isset($this->menuoptions) && count($this->menuoptions) > 0) {
  288. foreach ($this->menuoptions as $menuoption) {
  289. $menuoption->put();
  290. } // foreach
  291. }
  292. debug_trace();
  293. } // put
  294. // ....................................................................
  295. /**
  296. * This adds a new menuoption to the list, but does not add any records
  297. * to the database.
  298. */
  299. function add_menuoption() {
  300. debug_trace($this);
  301. $menuoption = new menuoption();
  302. $menuoption->menu_id = $this->menu_id;
  303. $menuoption->menu_level = $this->menu_level;
  304. $menuoption->display_order = 999;
  305. $this->menuoptions[$menuoption->menuoptionid] = $menuoption;
  306. debug_trace();
  307. } // add_menuoption
  308. // ....................................................................
  309. /**
  310. * Remove menuoption from the menu. Just removes the given menuoption
  311. * from the list in this object - no database changes are made.
  312. * @param integer $id The id of the menuoption to remove
  313. */
  314. function remove_menuoption($id) {
  315. debug_trace($this);
  316. if (isset($this->menuoptions[$id])) {
  317. $menuoption->delete();
  318. unset($this->menuoptions[$id]);
  319. }
  320. debug_trace();
  321. } // remove_menuoption
  322. // ....................................................................
  323. /**
  324. * Delete this menu from the database.
  325. */
  326. function delete() {
  327. debug_trace($this);
  328. if ($this->exists) {
  329. // RI will delete the menuoptions of this menu..
  330. $del = new dbdelete("ax_menu");
  331. $del->where("menu_id=$this->menu_id");
  332. $del->execute();
  333. $this->menuoptions = array();
  334. }
  335. debug_trace();
  336. } // delete
  337. // ....................................................................
  338. /**
  339. * Render the menu editing suite.
  340. * @return string The HTML for the editing suite form etc.
  341. * @access private
  342. */
  343. function editform() {
  344. debug_trace($this);
  345. global $LIBDIR;
  346. global $RESPONSE;
  347.  
  348. // Width of large form elements..
  349. $ewidth = "220px";
  350. $pwidth = "110px";
  351.  
  352. // Generic combo for user groups..
  353. $cboGroups = new form_combofield();
  354. $cboGroups->multiselect = true;
  355. $cboGroups->setclass("axlistbox");
  356. $cboGroups->setstyle("width:$ewidth;");
  357. $cboGroups->set_size(4);
  358. $cboGroups->additem("", "Any");
  359. $gQ = dbrecordset("SELECT * FROM ax_group ORDER BY group_desc");
  360. $cboGroups->add_querydata($gQ, "group_desc", "group_desc");
  361.  
  362. // Generic combo for site pages..
  363. $cboWebPages = new form_combofield();
  364. $cboWebPages->setclass("axcombo");
  365. $cboWebPages->additem(MENU_ITEM_SUBMENU);
  366. $cboWebPages->additem(MENU_ITEM_SPACER);
  367. $cboWebPages->additem(MENU_ITEM_SEPARATOR);
  368. $gQ = dbrecordset("SELECT * FROM ax_sitepage WHERE enabled=TRUE ORDER BY page_title");
  369. if ($gQ->hasdata) {
  370. do {
  371. $pgtitle = $gQ->field("page_title");
  372. $pgpath = $gQ->field("page_path");
  373. $pgfile = basename($pgpath);
  374. $cboWebPages->additem($pgpath, "$pgtitle ($pgfile)");
  375. } while ($gQ->get_next());
  376. }
  377.  
  378. // Initialise content..
  379. $s = "";
  380.  
  381. // ..................................................................
  382. // KEYFIELD and RECORD MAINTAINER
  383. // Menuoption listbox
  384. // Declared here so we can create the maintainer and register buttons
  385. // before they are used in the form.
  386. //
  387. // This is the keyfield listbox which controls the maintainance
  388. // process. It lists all records being maintained..
  389. $menuoption_listbox = new form_combofield("menuoption_id");
  390. $menuoption_listbox->setclass("axlistbox");
  391. // Make a new record maintainer, and attach the buttons..
  392. $maintainer = new recmaintainer($this->formname, $menuoption_listbox);
  393.  
  394. // Create buttons..
  395. $bup = new form_imagebutton("_up", "", "", "$LIBDIR/img/_up.gif", "Move up", 57, 15);
  396. $bdown = new form_imagebutton("_down", "", "", "$LIBDIR/img/_down.gif", "Move down", 57, 15);
  397. $bdel = new form_imagebutton("_del", "", "", "$LIBDIR/img/_delete.gif", "Delete menu option", 57, 15);
  398. $badd = new form_imagebutton("_add", "", "", "$LIBDIR/img/_add.gif", "Add new menu option", 57, 15);
  399. $bsave = new form_imagebutton("_save", "", "", "$LIBDIR/img/_save.gif", "Save menu settings", 57, 15);
  400. $bdone = new form_imagebutton("_done", "", "", "$LIBDIR/img/_done.gif", "Done with editing", 57, 15);
  401. $breset = new form_imagebutton("_reset", "", "", "$LIBDIR/img/_reset.gif", "Reset form", 57, 15);
  402. $btop = new form_imagebutton("_top", "", "", "$LIBDIR/img/_top.gif", "Top of menu tree", 57, 15);
  403. $bprev = new form_imagebutton("_prev", "", "", "$LIBDIR/img/_prev.gif", "Previous menu level", 57, 15);
  404. $bnext = new form_imagebutton("_next", "", "", "$LIBDIR/img/_next.gif", "Next sub-menu level", 57, 15);
  405. $bnewpg = new form_imagebutton("_newpg", "", "", "$LIBDIR/img/_create.gif", "Create new webpage", 57, 15);
  406. $breset->set_onclick("document.forms.$this->formname.reset()");
  407.  
  408. // Special handling for Next button
  409. $RESPONSE->add_script(
  410. "var rc=false;\n"
  411. . "function checkforsubmenu() {\n"
  412. . " fm = document.forms.$this->formname;\n"
  413. . " if (fm.menuoption_id != null && fm.menuoption_id.options.length != 0) {\n"
  414. . " if (fm.sitepage.value != '') {\n"
  415. . " alert('The current item is not a sub-menu.');\n"
  416. . " rc= false;\n"
  417. . " }\n"
  418. . " else rc = true;\n"
  419. . " }\n"
  420. . "}\n"
  421. );
  422. $bnext->set_onclick("checkforsubmenu();return rc;");
  423.  
  424. // Register all relevant buttons to the maintainer..
  425. $maintainer->register_button("up" , $bup);
  426. $maintainer->register_button("down", $bdown);
  427. $maintainer->register_button("add", $badd);
  428. $maintainer->register_button("save", $bsave);
  429. $maintainer->register_button("del", $bdel);
  430. $maintainer->register_button("reset", $breset);
  431.  
  432. // Control table..
  433. $Ted = new table("menu_$this->menu_id");
  434. $Ted->setpadding(2);
  435.  
  436. // ..................................................................
  437. // Toolbar..
  438. $toolbar[] = $bdone;
  439. $toolbar[] = $bsave;
  440. $Tbar = new table("toolbar");
  441. $Tbar->tr("axtitle");
  442. $Tbar->th("<b>EDITING</b> [$this->menu_id]", "axtitle");
  443. $tools = "";
  444. foreach ($toolbar as $button) {
  445. $tools .= $button->render();
  446. }
  447. $Tbar->th($tools, "text-align:right");
  448. $Ted->thead();
  449. $Ted->tr();
  450. $Ted->td( $Tbar->render() );
  451. $Ted->td_colspan(3);
  452.  
  453. // ..................................................................
  454. // Global Menu Properties..
  455. $Ted->tr("axhdg");
  456. $Ted->td("<b>MENU PROPERTIES</b>", "axhdg");
  457. $Ted->td_colspan(3);
  458.  
  459. // ..................................................................
  460. // Menu name & Active flag
  461. $menu_name = new form_textfield("menu_name", "", $this->menu_name);
  462. $menu_name->setstyle("width:$ewidth;");
  463. $menu_name->setclass("axtxtbox");
  464. $menu_active = new form_checkbox("menu_active");
  465. $menu_active->setclass("axchkbox");
  466. $menu_active->checked = $this->active;
  467. $Ted->tr("axbglite");
  468. $Ted->td("Menu name:", "axfg");
  469. $Ted->td( $menu_name->render() . "&nbsp;&nbsp;" . "Active:&nbsp;" . $menu_active->render(), "axfg" );
  470. $Ted->td_colspan(2);
  471.  
  472. // Multi-language selector..
  473. if ($this->multilang) {
  474. $cboLangs = new form_combofield("language");
  475. $cboLangs->setclass("axcombo");
  476. $cboLangs->setstyle("width:$ewidth;");
  477. $LQ = dbrecordset("SELECT * FROM ax_language ORDER BY display_order");
  478. $cboLangs->add_querydata($LQ, "lang_id", "lang_desc");
  479. $cboLangs->setvalue($this->language);
  480. // Insert this combo..
  481. $Ted->tr("axbglite");
  482. $Ted->td("Menu language:", "axfg");
  483. $Ted->td( $cboLangs->render() );
  484. $Ted->td_colspan(2);
  485. }
  486. else {
  487. $hidLang = new form_hiddenfield("language", $this->language);
  488. $Ted->tr("axbglite");
  489. $Ted->td( $hidLang->render() );
  490. $Ted->td_colspan(3);
  491. }
  492.  
  493. // Menu description
  494. $menu_desc = new form_textfield("menu_desc", "", $this->menu_desc);
  495. $menu_desc->setstyle("width:$ewidth;");
  496. $menu_desc->setclass("axtxtbox");
  497. $Ted->tr("axbgdark");
  498. $Ted->td("Description:", "axfg");
  499. $Ted->td( $menu_desc->render() );
  500. $Ted->td_colspan(2);
  501.  
  502. // Menu group access
  503. $menu_user_groups = $cboGroups;
  504. $menu_user_groups->name = "menu_user_groups";
  505. $menu_user_groups->setvalue($this->user_groups);
  506. $Ted->tr("axbglite");
  507. $Ted->td("Group access:", "axfg");
  508. $Ted->td_alignment("", "top");
  509. $Ted->td( $menu_user_groups->render() );
  510. $Ted->td( "&nbsp;" );
  511.  
  512. // ..................................................................
  513. // Menu Options Editing Fields..
  514. $Ted->tr("axhdg");
  515. $Ted->td("<b>MENU ITEMS</b>", "axhdg");
  516. $Ted->td_colspan(3);
  517.  
  518. // Continue defining listbox..
  519. $menuoption_listbox->setstyle("width:$ewidth;");
  520. $menuoption_listbox->size = 10;
  521. $default_parent_id = 0;
  522. foreach ($this->menuoptions as $m) {
  523. // Populate listbox..
  524. $menuoption_listbox->additem($m->menuoptionid, $m->label);
  525.  
  526. // Populate maintainer data. The maintainer add_record method
  527. // requires an associative array keyed on listbox key id..
  528. $rec = array(
  529. "parent_id" => $m->parent_id,
  530. "label" => $m->label,
  531. "description" => $m->description,
  532. "sitepage" => $m->sitepage,
  533. "sitepage_parms" => $m->sitepage_parms,
  534. "is_parent" => (($m->is_parent) ? "t" : "f"),
  535. "user_groups" => implode(",", $m->user_groups),
  536. "user_type" => $m->user_type,
  537. "auth_code" => (($m->auth_code) ? "t" : "f"),
  538. "width" => $m->width,
  539. "height" => $m->height,
  540. "active" => (($m->active) ? "t" : "f")
  541. );
  542. $maintainer->add_record($m->menuoptionid, $rec);
  543.  
  544. // If this is the menuoption being edited, make sure
  545. // that it gets focussed..
  546. if (isset($this->edit_menuop_id) && $m->menuoptionid == $this->edit_menuop_id) {
  547. $maintainer->initial_record($m->menuoptionid);
  548. }
  549. // Save default as the last value..
  550. $default_parent_id = $m->parent_id;
  551. }
  552. // Now set the defaults for each of the fields. These are
  553. // necessary for when a new record is created..
  554. $defaults = array(
  555. "parent_id" => $default_parent_id,
  556. "label" => MENU_ITEM_SUBMENU,
  557. "description" => "",
  558. "sitepage" => MENU_ITEM_SUBMENU,
  559. "sitepage_parms" => "",
  560. "is_parent" => "f",
  561. "user_groups" => "",
  562. "user_type" => "",
  563. "auth_code" => "f",
  564. "width" => 100,
  565. "height" => 18,
  566. "active" => "t"
  567. );
  568. $maintainer->add_defaults($defaults);
  569.  
  570. // The listbox field..
  571. $menuoption_listbox->setvalue($m->menuoptionid);
  572. $Ted->tr("axbgdark");
  573. $Ted->td(
  574. $btop->render() . "<br>"
  575. . $bnext->render() . "<br>"
  576. . $bprev->render()
  577. );
  578. $Ted->td_alignment("", "top");
  579. $Ted->td( $menuoption_listbox->render() );
  580. $Ted->td(
  581. $bup->render() . "<br>"
  582. . $bdown->render() . "<br>"
  583. . $bdel->render() . "<br>"
  584. . $badd->render()
  585. );
  586. $Ted->td_alignment("right", "top");
  587.  
  588. // ..................................................................
  589. $Ted->tr("axhdg");
  590. $Ted->td("<b>MENU ITEM SETTINGS</b>", "axhdg");
  591. $Ted->td_colspan(3);
  592.  
  593. // ..................................................................
  594. // Parent field..
  595. $menuop_parents = new form_combofield("parent_id", "", $m->parent_id);
  596. $maintainer->register_field($menuop_parents);
  597. $menuop_parents->setstyle("width:$ewidth;");
  598. $menuop_parents->setclass("axcombo");
  599. $menuop_parents->additem("0", "TOP LEVEL");
  600. if ($this->exists) {
  601. $q = "SELECT * FROM ax_menuoption";
  602. $q .= " WHERE menu_id=$this->menu_id";
  603. $q .= " AND is_parent";
  604. $q .= " ORDER BY label";
  605. $moQ = dbrecordset($q);
  606. if ($moQ->hasdata) {
  607. do {
  608. $mid = $moQ->field("menuoption_id");
  609. $mlabel = $moQ->field("label");
  610. $menuop_parents->additem($mid, $mlabel);
  611. } while ($moQ->get_next());
  612. }
  613. }
  614. $Ted->tr("axbglite");
  615. $Ted->td( "Child of:", "axfg" );
  616. $Ted->td( $menuop_parents->render() );
  617. $Ted->td( "&nbsp;" );
  618.  
  619. // ..................................................................
  620. // Menuoption label field..
  621. $menuop_label = new form_textfield("label", "", $m->label);
  622. $maintainer->register_field($menuop_label);
  623. $menuop_label->setstyle("width:$ewidth;");
  624. $menuop_label->setclass("axtxtbox");
  625. $Ted->tr("axbglite");
  626. $Ted->td( "Label:", "axfg" );
  627. $Ted->td( $menuop_label->render() );
  628. $Ted->td( "&nbsp;" );
  629.  
  630. // ..................................................................
  631. // Menuoption description field..
  632. $menuop_desc = new form_textfield("description", "", $m->description);
  633. $maintainer->register_field($menuop_desc);
  634. $menuop_desc->setstyle("width:$ewidth;");
  635. $menuop_desc->setclass("axtxtbox");
  636. $Ted->tr("axbgdark");
  637. $Ted->td( "Description:", "axfg" );
  638. $Ted->td( $menuop_desc->render() );
  639. $Ted->td( "&nbsp;" );
  640.  
  641. // ..................................................................
  642. // Menuoption is parent field..
  643. $menuop_is_parent = new form_checkbox("is_parent");
  644. $maintainer->register_field($menuop_is_parent);
  645. $menuop_is_parent->checked = $m->is_parent;
  646. $menuop_is_parent->setclass("axchkbox");
  647. $Ted->tr("axbgdark");
  648. $Ted->td( "Is parent of sub-menu:", "axfg" );
  649. $Ted->td( $menuop_is_parent->render() );
  650. $Ted->td( "&nbsp;" );
  651.  
  652. // ..................................................................
  653. // Menuoption sitepage and sitepage parms fields..
  654. $menuop_spage = $cboWebPages;
  655. $menuop_spage->name = "sitepage";
  656. $maintainer->register_field($menuop_spage);
  657. $menuop_spage->setvalue($m->sitepage);
  658. $menuop_spage->setstyle("width:$ewidth;");
  659.  
  660. $menuop_spage_parms = new form_textfield("sitepage_parms", "", $m->sitepage_parms);
  661. $maintainer->register_field($menuop_spage_parms);
  662. $menuop_spage_parms->setstyle("width:$ewidth;");
  663. $menuop_spage_parms->setclass("axtxtbox");
  664. $Ted->tr("axbglite");
  665. $Ted->td( "Target webpage:", "axfg" );
  666. $Ted->td( $menuop_spage->render() );
  667. $Ted->td( "&nbsp;" );
  668. $Ted->tr("axbgdark");
  669. $Ted->td( "URL Parameters:", "axfg" );
  670. $Ted->td( $menuop_spage_parms->render() );
  671. $Ted->td( "&nbsp;" );
  672.  
  673. // ..................................................................
  674. // Menuoption user groups field..
  675. $menuop_ugroups = $cboGroups;
  676. $menuop_ugroups->name = "user_groups";
  677. $maintainer->register_field($menuop_ugroups);
  678. $menuop_ugroups->setvalue($m->user_groups);
  679. $Ted->tr("axbgdark");
  680. $Ted->td( "Permitted groups:", "axfg" );
  681. $Ted->td_alignment("", "top");
  682. $Ted->td( $menuop_ugroups->render() );
  683. $Ted->td_alignment("", "top");
  684. $Ted->td( "&nbsp;" );
  685.  
  686. // ..................................................................
  687. // User type and authorisation code
  688. $menuop_utype = new form_combofield("user_type", "", $m->user_type);
  689. $menuop_utype->setclass("axcombo");
  690. $maintainer->register_field($menuop_utype);
  691. $menuop_utype->setstyle("width:$ewidth;");
  692. $menuop_utype->additem("", "Anyone");
  693. $menuop_utype->additem("sys", "System engineer only");
  694. $menuop_auth = new form_checkbox("auth_code");
  695. $menuop_auth->setclass("axchkbox");
  696. $menuop_auth->checked = $m->auth_code;
  697. $maintainer->register_field($menuop_auth);
  698. $Ted->tr("axbglite");
  699. $Ted->td( "Permitted user type:", "axfg" );
  700. $Ted->td( $menuop_utype->render() );
  701. $Ted->td( "Auth code reqd:&nbsp;" . $menuop_auth->render(), "axfg" );
  702. $Ted->td_alignment("right");
  703.  
  704. // ..................................................................
  705. // Width, height and active
  706. $menuop_width = new form_textfield("width", "", $m->width);
  707. $maintainer->register_field($menuop_width);
  708. $menuop_width->setstyle("width:60px;");
  709. $menuop_width->setclass("axtxtbox");
  710. $menuop_height = new form_textfield("height", "", $m->height);
  711. $maintainer->register_field($menuop_height);
  712. $menuop_height->setstyle("width:60px;");
  713. $menuop_height->setclass("axtxtbox");
  714. $menuop_active = new form_checkbox("active");
  715. $menuop_active->checked = $m->active;
  716. $maintainer->register_field($menuop_active);
  717. $Ted->tr("axbgdark");
  718. $Ted->td( "HVmenu sizing:", "axfg" );
  719. $Tin = new table("size");
  720. $Tin->tr();
  721. $Tin->td( $menuop_width->render() . " wide", "axfg" );
  722. $Tin->td( " x ", "axfg" );
  723. $Tin->td_alignment("center");
  724. $Tin->td( $menuop_height->render() . " high", "axfg" );
  725. $Ted->td( $Tin->render() );
  726. $Ted->td("Active:&nbsp;" . $menuop_active->render(), "axfg" );
  727. $Ted->td_alignment("right");
  728.  
  729. // ..................................................................
  730. // Render the whole form..
  731. $Ted->tr("axtitle");
  732. $Ted->td("&nbsp;", "axtitle");
  733. $Ted->td_colspan(3);
  734.  
  735. $Ted->set_width_profile("25%,55%,20%");
  736. $Ted->inherit_attributes($this);
  737. $s .= $Ted->render();
  738.  
  739. // Render the maintainer. This adds the Javascript data structures
  740. // and renders the hidden fields for submitting changed field data..
  741. $s .= $maintainer->render();
  742.  
  743. // ....................................................................
  744. debug_trace();
  745. // Return the html..
  746. return $s;
  747. } // editform
  748. // ....................................................................
  749. /** Renders a menu entry for the hierarchical list of options being
  750. * generated recursively.
  751. * @access private
  752. */
  753. function menu_entry($rendermode, $prefix, $mopid, $mno_children, $mno_details) {
  754. global $RESPONSE;
  755. $childcount = 0;
  756. $submnu = new table();
  757. $submnu->setstyle("margin-left:40px;");
  758.  
  759. // Store current menu option..
  760. $details = explode("|", $mno_details[$mopid]);
  761. $menu_level = $details[0];
  762. $label = $details[1];
  763. $action = $details[3];
  764. if ($menu_level == 0) $label = "<b>$label</b>";
  765. switch ($rendermode) {
  766. case "editmap":
  767. $maintainer_href = "$RESPONSE->requested?edit_menu_id=" . rawurlencode($this->menu_id);
  768. $maintainer_href .= "&menuopid=$mopid";
  769. $maintainer_href .= "&menumode=edit";
  770. break;
  771. case "sitemap":
  772. $maintainer_href = $action;
  773. break;
  774. }
  775. $submnu->tr();
  776. $submnu->td("<a href=\"$maintainer_href\">$label</a>");
  777.  
  778. // And children..
  779. if (isset($mno_children[$mopid]) && $mno_children[$mopid] != "") {
  780. $childoptions = explode("|", $mno_children[$mopid]);
  781. $childcount = count($childoptions);
  782. $pfxcount = 1;
  783. foreach ($childoptions as $childmopid) {
  784. $childprefix = $prefix . "|" . $pfxcount;
  785. $submnu->tr();
  786. $submnu->td( $this->menu_entry($rendermode, $childprefix, $childmopid, $mno_children, $mno_details) );
  787. $pfxcount += 1;
  788. }
  789. }
  790. return $submnu->render();
  791. } // menu_entry
  792. // ....................................................................
  793. /**
  794. * Render the whole menu layout hierarchy as a sitemap, which simply
  795. * gives links to each menu page.
  796. * @return string The HTML
  797. */
  798. function sitemap() {
  799. return $this->menulayout("sitemap");
  800. } // sitemap
  801. // ....................................................................
  802. /**
  803. * Render the whole menu layout content. We have two modes of operation,
  804. * one to return the hierarchy as a sitemap, which simply gives links
  805. * to each menu page, and one which acts as a navigator to go and edit
  806. * the menu options at any point in the menu.
  807. * @param string $rendermode Mode of display: 'editmap' or 'sitemap'
  808. * @return string The HTML
  809. * @access private
  810. */
  811. function menulayout($rendermode="editmap") {
  812. debug_trace($this);
  813. global $LIBDIR;
  814. global $RESPONSE;
  815. global $edit_menu_id;
  816.  
  817. // Initialise content..
  818. $s = "";
  819.  
  820. // Render dropdown menu if more than one menu..
  821. $menucombo = false;
  822. if ($rendermode == "editmap") {
  823. $menus = dbrecordset("SELECT * FROM ax_menu m, ax_language l WHERE l.lang_id=m.lang_id ORDER BY menu_name");
  824. if ($menus->rowcount > 0) {
  825. $menucombo = new form_combofield("sel_menu_id");
  826. do {
  827. $menu_id = $menus->field("menu_id");
  828. $menuname = $menus->field("menu_name");
  829. $menudesc = $menus->field("menu_desc");
  830. $menulang = $menus->field("lang_desc");
  831. $menucombo->additem($menu_id, "$menuname ($menulang)");
  832. } while ($menus->get_next());
  833. $menucombo->setvalue($this->menu_id);
  834. $menucombo->set_onchange("menugo('viewing')");
  835. }
  836. }
  837.  
  838. // Create buttons..
  839. $bed = new form_imagebutton("_edit", "", "", "$LIBDIR/img/_edit.gif", "Edit this menu", 42, 15);
  840. $bnew = new form_imagebutton("_new", "", "", "$LIBDIR/img/_new.gif", "Create new menu", 42, 15);
  841. $bdel = new form_imagebutton("_del", "", "", "$LIBDIR/img/_delete.gif", "Delete this menu", 57, 15);
  842. $bed->set_onclick("menugo('editing')");
  843. $bnew->set_onclick("menugo('createnew')");
  844. $bdel->set_onclick("menugo('delete')");
  845.  
  846. // Menu layout table..
  847. $Tvw = new table();
  848. if ($rendermode == "editmap") {
  849. $Tvw->tr("axtitle");
  850. $Tvw->td("Menu Layout", "axtitle");
  851. // Select, new, delete toolbar..
  852. $Toolbar = new table("toolbar");
  853. $Toolbar->setpadding(2);
  854. $Toolbar->setwidth("");
  855. if ($menucombo) {
  856. $Toolbar->td( $menucombo->render() );
  857. }
  858. $Toolbar->td( $bed->render() );
  859. $Toolbar->td( $bnew->render() );
  860. $Toolbar->td( $bdel->render() );
  861. $Tvw->td( $Toolbar->render() );
  862. $Tvw->td_alignment("right");
  863. }
  864.  
  865. // MENU ITEM DETAIL..
  866. if ($this->exists) {
  867. $q = "SELECT *";
  868. $q .= " FROM ax_menu m, ax_menuoption mo";
  869. $q .= " WHERE m.menu_id=$this->menu_id";
  870. $q .= " AND mo.menu_id=m.menu_id";
  871. $q .= " AND mo.active=TRUE";
  872. $q .= " ORDER BY mo.menu_level,mo.parent_id,mo.display_order";
  873. $item = dbrecordset($q);
  874. if ($item->hasdata) {
  875. $topcount = 0;
  876. do {
  877. $mopid = $item->field("menuoption_id");
  878. $mnu_ugroups = $item->field("user_groups");
  879. $mnu_usertype = $item->field("user_type");
  880. if ($mnu_ugroups == "" || $RESPONSE->ismemberof_group_in($mnu_ugroups)) {
  881. if ($mnu_usertype == "" || ($RESPONSE->user_type == $mnu_usertype)) {
  882. $parent_id = $item->field("parent_id");
  883. $menu_level = $item->field("menu_level");
  884. $label = $item->field("label");
  885. $description = $item->field("description");
  886. $action = $item->field("action");
  887. $authcode = $item->field("auth_code");
  888. if ($menu_level == 0) {
  889. $topcount += 1;
  890. $mno_top[$topcount] = $mopid;
  891. }
  892. $mno_details[$mopid] = "$menu_level|$label|$description|$action|$authcode";
  893. $mno_level[$mopid] = $menu_level;
  894. $mno_parent[$mopid] = $parent_id;
  895. if ($parent_id != "") {
  896. if (isset($mno_children[$parent_id])) {
  897. $mno_children[$parent_id] .= "|";
  898. }
  899. $mno_children[$parent_id] .= $mopid;
  900. }
  901. } // user type check
  902. } // memberof
  903. } while ($item->get_next());
  904.  
  905. // Store each row..
  906. $toplevels = new table();
  907. $toplevels->setpadding(4);
  908. while (list($item_no, $mopid) = each($mno_top)) {
  909. $prefix = "$item_no";
  910. $toplevels->tr();
  911. $toplevels->td( $this->menu_entry($rendermode, $prefix, $mopid, $mno_children, $mno_details) );
  912. }
  913. $Tvw->tr();
  914. $Tvw->td( $toplevels->render() );
  915. $Tvw->td_colspan(2);
  916. }
  917. else {
  918. $Tvw->tr();
  919. $Tvw->td( "No menu items defined.", "axfg" );
  920. $Tvw->td_colspan(2);
  921. }
  922. }
  923. else {
  924. $Tvw->tr();
  925. $Tvw->td( "Empty menu.", "axfg" );
  926. $Tvw->td_colspan(2);
  927. }
  928.  
  929. // Render the menu viewer table..
  930. $s .= $Tvw->render();
  931. return $s;
  932. } // menulayout
  933. // ....................................................................
  934. /**
  935. * Render the block content according to the mode of operation
  936. * we are in. Possible modes: 'viewing', 'editing', 'saving'.
  937. * @return string The HTML
  938. */
  939. function html() {
  940. debug_trace($this);
  941. global $LIBDIR;
  942. global $RESPONSE;
  943. global $edit_menu_id;
  944.  
  945. $s = "";
  946.  
  947. // Start form for editing..
  948. if ($RESPONSE->ismemberof_group_in("Editor,Admin")) {
  949. $s .= "<form name=\"$this->formname\" method=\"post\">\n";
  950. }
  951. switch($this->mode) {
  952. case "editing":
  953. $this->mode = "saving";
  954. $s .= $this->editform();
  955. break;
  956. case "createnew":
  957. $this->mode = "savingnew";
  958. $s .= $this->editform();
  959. break;
  960. default:
  961. $this->mode = "viewing";
  962. $s .= $this->menulayout();
  963. } // switch
  964.  
  965. // Finish the form..
  966. if ($RESPONSE->ismemberof_group_in("Editor,Admin")) {
  967. // Include action hidden field, and block ID
  968. $mode = new form_hiddenfield("menumode", $this->mode);
  969. $mid = new form_hiddenfield("edit_menu_id", $this->menu_id);
  970. $mlevel = new form_hiddenfield("menulevel", $this->menu_level);
  971. $pid = new form_hiddenfield("edit_parent_id", $this->edit_parent_id);
  972. $s .= $mode->render() . $mid->render() . $pid->render() . $mlevel->render();
  973. $s .= "</form>\n";
  974. }
  975. return $s;
  976. } // html
  977. // ....................................................................
  978. /**
  979. * Process a block edit form POST.
  980. * Assume that the fields have been submitted in a form as named
  981. * in the config, and grab the POSTed values. This method is executed
  982. * from the constructor usually, before anything is read in from
  983. * the database. We get first shot to change data here.
  984. * @access private
  985. */
  986. function POSTprocess() {
  987. debug_trace($this);
  988. global $HTTP_POST_VARS, $RESPONSE;
  989. if (isset($HTTP_POST_VARS["menumode"])) {
  990. global $_done_x, $_edit_x;
  991. global $edit_menu_id, $edit_parent_id, $menuoption_id, $menulevel;
  992. $this->mode = $HTTP_POST_VARS["menumode"];
  993. debugbr("POSTprocess: mode: $this->mode");
  994. switch ($this->mode) {
  995. case "viewing":
  996. if (isset($_edit_x)) {
  997. $this->mode = "editing";
  998. }
  999. break;
  1000.  
  1001. case "delete":
  1002. if ($this->menu_id != false) {
  1003. $mdel = new dbdelete("ax_menu");
  1004. $mdel->where("menu_id=$this->menu_id");
  1005. $mdel->execute();
  1006. }
  1007. break;
  1008.  
  1009. case "createnew":
  1010. $this->menu_id = false;
  1011. $this->menu_name = "(new menu name)";
  1012. $this->menu_desc = "(new menu description)";
  1013. break;
  1014.  
  1015. case "savingnew":
  1016. $this->put();
  1017. $this->get();
  1018. $edit_menu_id = $this->menu_id;
  1019. case "saving":
  1020. if ($edit_menu_id == $this->menu_id) {
  1021. global $_save_x, $_cancel_x, $_done_x;
  1022. global $_prev_x, $_next_x, $_top_x, $_newpg_x;
  1023. global $_recmaintpost_form;
  1024. global $_recmaintpost_data;
  1025. global $_recmaintpost_flds;
  1026. global $_recmaintpost_dels;
  1027. global $_recmaintpost_order;
  1028.  
  1029. // Let me out of here..
  1030. if (isset($_done_x) || isset($_cancel_x)) {
  1031. // Drop through to viewing..
  1032. $this->mode = "viewing";
  1033. }
  1034. // Go to top level of menu..
  1035. elseif ( isset($_top_x)) {
  1036. $this->edit_parent_id = 0;
  1037. $this->mode = "editing";
  1038. }
  1039. // Go to previous menu level..
  1040. elseif ( isset($_prev_x)) {
  1041. if ($edit_parent_id > 0) {
  1042. $mo = new menuoption($edit_parent_id);
  1043. if ($mo->exists) {
  1044. $edit_parent_id = $mo->parent_id;
  1045. $this->edit_parent_id = $mo->parent_id;
  1046. }
  1047. }
  1048. $this->mode = "editing";
  1049. }
  1050. // Go to to next menu level..
  1051. elseif ( isset($_next_x)) {
  1052. if (isset($menuoption_id) && $menuoption_id != 0) {
  1053. $this->edit_parent_id = $menuoption_id;
  1054. $edit_parent_id = $menuoption_id;
  1055. }
  1056. $this->mode = "editing";
  1057. }
  1058. // Posted record maintenance data..
  1059. elseif ( isset($_recmaintpost_form)
  1060. && $_recmaintpost_form == $this->formname) {
  1061. // Deal with deletes..
  1062. if (isset($_recmaintpost_dels) && $_recmaintpost_dels != "") {
  1063. $menuoption_delids = explode(FIELD_DELIM, $_recmaintpost_dels);
  1064. foreach ($menuoption_delids as $delmenuoptionid) {
  1065. dbcommand("DELETE FROM ax_menuoption WHERE menuoption_id=$delmenuoptionid");
  1066. }
  1067. }
  1068. // Menu option adds and saves..
  1069. if (isset($_recmaintpost_data) && $_recmaintpost_data != "") {
  1070. $menuoptionrecs = explode(RECORD_DELIM, $_recmaintpost_data);
  1071. $menuoption_fields = explode(",", $_recmaintpost_flds);
  1072. foreach ($menuoptionrecs as $menuoptionrec) {
  1073. $menuoption_values = explode(FIELD_DELIM, $menuoptionrec);
  1074. $menuoptionid = array_shift($menuoption_values);
  1075. // Cater for new creations..
  1076. if (strstr($menuoptionid, "NEW_")) {
  1077. $savedid = $menuoptionid;
  1078. $menuoptionid = get_next_sequencevalue(
  1079. "seq_menuoption_id",
  1080. "ax_menuoption",
  1081. "menuoption_id"
  1082. );
  1083. $im = new dbinsert("ax_menuoption");
  1084. $im->set("menuoption_id", $menuoptionid);
  1085. $im->set("menu_id", $this->menu_id);
  1086. $im->set("parent_id", $this->edit_parent_id);
  1087. $im->set("menu_level", $menulevel);
  1088. $im->set("display_order", 999);
  1089. $im->execute();
  1090. // Fix up potential re-ordering id..
  1091. if (isset($_recmaintpost_order)) {
  1092. $_recmaintpost_order = str_replace($savedid, $menuoptionid, $_recmaintpost_order);
  1093. }
  1094. }
  1095. // Update the menuoption data..
  1096. $um = new dbupdate("ax_menuoption");
  1097. $um->where("menuoption_id=$menuoptionid");
  1098. $pos = 0; $sitepage = ""; $sitepage_parms = "";
  1099. foreach ($menuoption_fields as $menuoption_field) {
  1100. if ($menuoption_field == "sitepage") {
  1101. $sitepage = $menuoption_values[$pos];
  1102. }
  1103. elseif ($menuoption_field == "sitepage_parms") {
  1104. $sitepage_parms = $menuoption_values[$pos];
  1105. }
  1106. elseif ($menuoption_field == "parent_id") {
  1107. $new_parid = $menuoption_values[$pos];
  1108. if ($new_parid != $this->edit_parent_id) {
  1109. if ($new_parid == 0) {
  1110. $menulevel = 0;
  1111. }
  1112. else {
  1113. $q = "SELECT menu_level FROM ax_menuoption";
  1114. $q .= " WHERE menuoption_id=$new_parid";
  1115. $lq = dbrecordset($q);
  1116. if ($lq->hasdata) {
  1117. $menulevel = $lq->field("menu_level") + 1;
  1118. }
  1119. }
  1120. $um->set("menu_level", $menulevel);
  1121. }
  1122. }
  1123. // Set the current value assignment..
  1124. $um->set($menuoption_field, $menuoption_values[$pos++]);
  1125. } // foreach
  1126.  
  1127. // Post-processing for label and menu action etc..
  1128. switch ($sitepage) {
  1129. // Special-function menu items first..
  1130. case MENU_ITEM_SPACER:
  1131. $um->set("label", MENU_ITEM_SPACER);
  1132. $um->set("action", "");
  1133. break;
  1134. case MENU_ITEM_SEPARATOR:
  1135. $um->set("label", MENU_ITEM_SEPARATOR);
  1136. $um->set("action", "");
  1137. break;
  1138. case MENU_ITEM_SUBMENU:
  1139. $um->set("action", "");
  1140. break;
  1141. // Normal menu items last..
  1142. default:
  1143. $menuaction = $sitepage;
  1144. if ($menuaction != "") {
  1145. if (substr($menuaction, 0, 1) != "/") {
  1146. $menuaction = "/$menuaction";
  1147. }
  1148. if ($sitepage_parms != "") {
  1149. $menuaction .= "?" . $sitepage_parms;
  1150. }
  1151. }
  1152. $um->set("action", $menuaction);
  1153. } // switch
  1154.  
  1155. // Set lastmodified, and fire it off..
  1156. $um->set("last_modified", 'now()');
  1157. $um->execute();
  1158. } // foreach menuoptionrecs
  1159. }
  1160. // Save menu properties..
  1161. global $menu_name, $language, $menu_desc, $menu_user_groups, $menu_active;
  1162. $mu = new dbupdate("ax_menu");
  1163. $mu->where("menu_id='" . addslashes($this->menu_id) . "'");
  1164. $mu->set("menu_name", $menu_name);
  1165. $mu->set("lang_id", $language);
  1166. $mu->set("menu_name", $menu_name);
  1167. $mu->set("active", isset($menu_active));
  1168. $mu->set("last_modified", 'now()');
  1169. $mu->execute();
  1170.  
  1171. // Check/save menuoption ordering..
  1172. if (isset($_recmaintpost_order) && $_recmaintpost_order != "") {
  1173. $ord = 1;
  1174. $idlist = explode(FIELD_DELIM, $_recmaintpost_order);
  1175. foreach ($idlist as $menuoptionid) {
  1176. $upd = new dbupdate("ax_menuoption");
  1177. $upd->where("menuoption_id=$menuoptionid");
  1178. $upd->set("display_order", $ord);
  1179. $upd->set("last_modified", 'now()');
  1180. $upd->execute();
  1181. $ord += 1;
  1182. }
  1183. }
  1184. // Drop through to viewing..
  1185. $this->mode = "viewing";
  1186. } // if our menu being saved
  1187. }
  1188. break;
  1189. } // switch
  1190. }
  1191. debug_trace();
  1192. } // POSTprocess
  1193.  
  1194.  
  1195.  
  1196. } // menumaintainer class
  1197. // ----------------------------------------------------------------------
  1198.  
  1199. ?>

Documentation generated by phpDocumentor 1.3.0RC3