/** * Displays a selection list for menu item types */ public static function addMenuItem(&$cid, $menutype, $option, $types_content, $types_component, $types_link, $types_other, $types_submit) { mosCommonHTML::loadOverlib(); ?> <style type="text/css"> fieldset { border: 1px solid #777; } legend { font-weight: bold; } </style> <form action="index2.php" method="post" name="adminForm"> <table class="adminheading"> <tr> <th class="menus"> New Menu Item </th> <td valign="bottom" nowrap="nowrap" style="color: red;"> <?php //echo _MENU_GROUP; ?> * Note that some menu types appear in more than one grouping, but they are still the same menu type. </td> </tr> </table> <table class="adminform"> <tr> <td width="50%" valign="top"> <fieldset> <legend>Content</legend> <table class="adminform"> <?php $k = 0; $count = count($types_content); for ($i = 0; $i < $count; $i++) { $row =& $types_content[$i]; $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=edit&type=' . $row->type . '&hidemainmenu=1'; HTML_menusections::htmlOptions($row, $link, $k, $i); $k = 1 - $k; } ?> </table> </fieldset> <fieldset> <legend>Miscellaneous</legend> <table class="adminform"> <?php $k = 0; $count = count($types_other); for ($i = 0; $i < $count; $i++) { $row =& $types_other[$i]; $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=edit&type=' . $row->type . '&hidemainmenu=1'; HTML_menusections::htmlOptions($row, $link, $k, $i); $k = 1 - $k; } ?> </table> </fieldset> <fieldset> <legend>Submit</legend> <table class="adminform"> <?php $k = 0; $count = count($types_submit); for ($i = 0; $i < $count; $i++) { $row =& $types_submit[$i]; $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=edit&type=' . $row->type . '&hidemainmenu=1'; HTML_menusections::htmlOptions($row, $link, $k, $i); $k = 1 - $k; } ?> </table> </fieldset> </td> <td width="50%" valign="top"> <fieldset> <legend>Components</legend> <table class="adminform"> <?php $k = 0; $count = count($types_component); for ($i = 0; $i < $count; $i++) { $row =& $types_component[$i]; $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=edit&type=' . $row->type . '&hidemainmenu=1'; HTML_menusections::htmlOptions($row, $link, $k, $i); $k = 1 - $k; } ?> </table> </fieldset> <fieldset> <legend>Links</legend> <table class="adminform"> <?php $k = 0; $count = count($types_link); for ($i = 0; $i < $count; $i++) { $row =& $types_link[$i]; $link = 'index2.php?option=com_menus&menutype=' . $menutype . '&task=edit&type=' . $row->type . '&hidemainmenu=1'; HTML_menusections::htmlOptions($row, $link, $k, $i); $k = 1 - $k; } ?> </table> </fieldset> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="menutype" value="<?php echo $menutype; ?> " /> <input type="hidden" name="task" value="edit" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="hidemainmenu" value="0" /> <input type="hidden" name="<?php echo josSpoofValue(); ?> " value="1" /> </form> <?php }
/** * Form for copying item(s) to a specific menu */ function copyMenu($option, $cid, $menutype) { global $database; if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('" . T_('Select an item to move') . "'); window.history.go(-1);</script>\n"; exit; } ## query to list selected menu items $cids = implode(',', $cid); $query = "SELECT a.name FROM #__menu AS a WHERE a.id IN ( " . $cids . " )"; $database->setQuery($query); $items = $database->loadObjectList(); $menuTypes = mosAdminMenus::menutypes(); foreach ($menuTypes as $menuType) { $menu[] = mosHTML::makeOption($menuType, $menuType); } // build the html select list $MenuList = mosHTML::selectList($menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null); HTML_menusections::copyMenu($option, $cid, $MenuList, $items, $menutype); }
/** * Form for copying item(s) to a specific menu */ function copyMenu($option, $cid, $menutype) { global $database, $adminLanguage; if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('" . $adminLanguage->A_COMP_CATEG_ITEM_MOVE . "'); window.history.go(-1);</script>\n"; exit; } ## query to list selected menu items $cids = implode(',', $cid); $query = "SELECT a.name FROM #__menu AS a WHERE a.id IN ( " . $cids . " )"; $database->setQuery($query); $items = $database->loadObjectList(); ## query to choose menu $query = "SELECT a.params FROM #__modules AS a WHERE a.module = 'mod_mainmenu' ORDER BY a.title"; $database->setQuery($query); $modules = $database->loadObjectList(); foreach ($modules as $module) { $params = mosParseParams($module->params); // adds menutype to array $type = trim(@$params->menutype); $menu[] = mosHTML::makeOption($type, $type); } // build the html select list $MenuList = mosHTML::selectList($menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null); HTML_menusections::copyMenu($option, $cid, $MenuList, $items, $menutype); }
/** * Form for copying item(s) to a specific menu */ function copyMenu($option, $cid, $menutype) { global $database; if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Selecione um item para mover'); window.history.go(-1);</script>\n"; exit; } ## query to list selected menu items mosArrayToInts($cid); $cids = 'a.id=' . implode(' OR a.id=', $cid); $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE ( {$cids} )"; $database->setQuery($query); $items = $database->loadObjectList(); $menuTypes = mosAdminMenus::menutypes(); foreach ($menuTypes as $menuType) { $menu[] = mosHTML::makeOption($menuType, $menuType); } // build the html select list $MenuList = mosHTML::selectList($menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null); HTML_menusections::copyMenu($option, $cid, $MenuList, $items, $menutype); }