/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editSection($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for section $lists['componentid'] = mosAdminMenus::Section($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_section_menu_html::editSection($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ public static function editSection($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for section $lists['componentid'] = mosAdminMenus::Section($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_section_menu_html::editSection($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editCategory($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'content_archive_category'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build the html select list for category $lists['componentid'] = mosAdminMenus::Category($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_archive_category_menu_html::editCategory($menu, $lists, $params, $option); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'content_typed'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('id=', $menu->link); $query = "SELECT a.title, a.title_alias, a.id" . "\n FROM #__content AS a" . "\n WHERE a.id = '" . $temp[1] . "'"; $database->setQuery($query); $content = $database->loadObjectlist(); // outputs item name, category & section instead of the select list if ($content[0]->title_alias) { $alias = ' (<i>' . $content[0]->title_alias . '</i>)'; } else { $alias = ''; } $contents = ''; $link = 'javascript:submitbutton( \'redirect\' );'; $lists['content'] = '<input type="hidden" name="content_typed" value="' . $temp[1] . '" />'; $lists['content'] .= '<a href="' . $link . '" title="Edit Static Content Item">' . $content[0]->title . $alias . '</a>'; } else { $query = "SELECT a.id AS value, CONCAT( a.title, '(', a.title_alias, ')' ) AS text" . "\n FROM #__content AS a" . "\n WHERE a.state = '1'" . "\n AND a.sectionid = '0'" . "\n AND a.catid = '0'" . "\n ORDER BY a.id, a.title"; $database->setQuery($query); $contents = $database->loadObjectList(); // Create a list of links $lists['content'] = mosHTML::selectList($contents, 'content_typed', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_menu_html::edit($menu, $lists, $params, $option, $contents); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator"); } if ($uid) { $menu->checkout($my->id); // get previously selected Categories $params = new mosParameters($menu->params); $catids = $params->def('categoryid', ''); if ($catids) { $catidsArray = explode(',', $catids); mosArrayToInts($catidsArray); $catids = 'c.id=' . implode(' OR c.id=', $catidsArray); $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n AND ( {$catids} )" . "\n ORDER BY s.name,c.name"; $database->setQuery($query); $lookup = $database->loadObjectList(); } else { $lookup = ''; } } else { $menu->type = 'content_blog_category'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; $lookup = ''; } // build the html select list for category $rows[] = mosHTML::makeOption('', 'All Categories'); $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name,c.name"; $database->setQuery($query); $rows = array_merge($rows, $database->loadObjectList()); $category = mosHTML::selectList($rows, 'catid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup); $lists['categoryid'] = $category; // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); /* chipjack: passing $sectCatList (categories) instead of $slist (sections) */ content_blog_category_html::edit($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the section to edit (0 if new) */ function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('The module {$menu->title} is currently being edited by another administrator'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); // get previously selected Categories $params =& new mosParameters($menu->params); $secids = $params->def('sectionid', ''); if ($secids) { $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND s.id IN ( " . $secids . ")" . "\n ORDER BY s.name"; $database->setQuery($query); $lookup = $database->loadObjectList(); } else { $lookup = ''; } } else { $menu->type = 'content_blog_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; $lookup = ''; } // build the html select list for section $rows[] = mosHTML::makeOption('', 'All Sections'); $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name"; $database->setQuery($query); $rows = array_merge($rows, $database->loadObjectList()); $section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup); $lists['sectionid'] = $section; // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component'); /* chipjack: passing $sectCatList (categories) instead of $slist (sections) */ content_blog_section_html::edit($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the section to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); // get previously selected Categories $params = new mosParameters($menu->params); $secids = $params->def('sectionid', ''); if ($secids) { $secidsArray = explode(',', $secids); mosArrayToInts($secidsArray); $secids = 's.id=' . implode(' OR s.id=', $secidsArray); $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND ( {$secids} )" . "\n ORDER BY s.name"; $database->setQuery($query); $lookup = $database->loadObjectList(); } else { $lookup = ''; } } else { $menu->type = 'content_blog_section'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; $lookup = ''; } // build the html select list for section $rows[] = mosHTML::makeOption('', 'Todas as Seções'); $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name"; $database->setQuery($query); $rows = array_merge($rows, $database->loadObjectList()); $section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup); $lists['sectionid'] = $section; // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_blog_section_html::edit($menu, $lists, $params, $option); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module %s is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'component_item_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('&Itemid=', $menu->link); $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE a.link = '" . $temp[0] . "'"; $database->setQuery($query); $components = $database->loadResult(); $lists['components'] = $components; $lists['components'] .= '<input type="hidden" name="link" value="' . $menu->link . '" />'; } else { $query = "SELECT CONCAT( a.link, '&Itemid=', a.id ) AS value, a.name AS text" . "\n FROM #__menu AS a" . "\n WHERE a.published = '1'" . "\n AND a.type = 'components'" . "\n ORDER BY a.menutype, a.name"; $database->setQuery($query); $components = $database->loadObjectList(); // Create a list of links $lists['components'] = mosHTML::selectList($components, 'link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid, 1); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); component_item_link_menu_html::edit($menu, $lists, $params, $option); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'component_item_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('&Itemid=', $menu->link); $query = "SELECT a.name" . "\n FROM #__menu AS a" . "\n WHERE a.link = " . $database->Quote($temp[0]); $database->setQuery($query); $components = $database->loadResult(); $lists['components'] = $components; $lists['components'] .= '<input type="hidden" name="link" value="' . $menu->link . '" />'; } else { $query = "SELECT CONCAT( a.link, '&Itemid=', a.id ) AS value, a.name AS text" . "\n FROM #__menu AS a" . "\n WHERE a.published = 1" . "\n AND a.type = 'components'" . "\n ORDER BY a.menutype, a.name"; $database->setQuery($query); $components = $database->loadObjectList(); // Create a list of links $lists['components'] = mosHTML::selectList($components, 'link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid, 1); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); component_item_link_menu_html::edit($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); $row = new mosComponent($database); // load the row from the db table $row->load($menu->componentid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('"The module %s is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'components'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } $query = "SELECT c.id AS value, c.name AS text, c.link" . "\n FROM #__components AS c" . "\n WHERE c.link <> ''" . "\n ORDER BY c.name"; $database->setQuery($query); $components = $database->loadObjectList(); // build the html select list for section $lists['componentid'] = mosAdminMenus::Component($menu, $uid); // componentname $lists['componentname'] = mosAdminMenus::ComponentName($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('com_xml', $row->option), 'component'); components_menu_html::edit($menu, $components, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); $row = new mosComponent($database); // load the row from the db table $row->load((int) $menu->componentid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'components'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } $query = "SELECT c.id AS value, c.name AS text, c.link" . "\n FROM #__components AS c" . "\n WHERE c.link != ''" . "\n ORDER BY c.name"; $database->setQuery($query); $components = $database->loadObjectList(); // build the html select list for section $lists['componentid'] = mosAdminMenus::Component($menu, $uid); // componentname $lists['componentname'] = mosAdminMenus::ComponentName($menu, $uid); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('com_xml', $row->option), 'component'); components_menu_html::edit($menu, $components, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editCategory($uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'weblink_category_table'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build list of categories $lists['componentid'] = mosAdminMenus::ComponentCategory('componentid', 'com_weblinks', intval($menu->componentid), NULL, 'ordering', 5, 0); if ($uid) { $query = "SELECT name" . "\n FROM #__categories" . "\n WHERE section = 'com_weblinks'" . "\n AND published = '1'" . "\n AND id = " . $menu->componentid; $database->setQuery($query); $category = $database->loadResult(); $lists['componentid'] = '<input type="hidden" name="componentid" value="' . $menu->componentid . '" />' . $category; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); weblink_category_table_menu_html::editCategory($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function editCategory($uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { $menu->type = 'newsfeed_category_table'; $menu->menutype = $menutype; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } // build list of categories $lists['componentid'] = mosAdminMenus::ComponentCategory('componentid', 'com_newsfeeds', intval($menu->componentid), NULL, 'name', 10, 0); if ($uid) { $query = "SELECT name" . "\n FROM #__categories" . "\n WHERE section = 'com_newsfeeds'" . "\n AND published = 1" . "\n AND id = " . (int) $menu->componentid; $database->setQuery($query); $category = $database->loadResult(); $lists['componentid'] = '<input type="hidden" name="componentid" value="' . $menu->componentid . '" />' . $category; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); newsfeed_category_table_menu_html::editCategory($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('The module {$menu->title} is currently being edited by another administrator'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'separator'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if (empty($menu->name)) { $menu->name = '- - - - - - -'; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // get params definitions $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component'); separator_menu_html::edit($menu, $lists, $params, $option); }
/** * @param database A database connector object * @param integer The unique id of the category to edit (0 if new) */ function edit($uid, $menutype, $option) { global $database, $my, $mainframe; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { // do stuff for existing item $menu->checkout($my->id); } else { // do stuff for new item $menu->type = 'separator'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if (empty($menu->name)) { $menu->name = '- - - - - - -'; } // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); separator_menu_html::edit($menu, $lists, $params, $option); }
/** Print component heading, etc. Then call getHtmlList() to print list */ function startOutput(&$menus, &$config) { global $database, $Itemid; $sitemap =& $this->sitemap; $menu = new mosMenu($database); $menu->load($Itemid); // Load params for the Xmap menu-item $title = $menu->name; $exlink[0] = $sitemap->exlinks; // image to mark popup links $exlink[1] = $sitemap->ext_image; if ($sitemap->columns > 1) { // calculate column widths $total = count($menus); $columns = $total < $sitemap->columns ? $total : $sitemap->columns; $this->_width = 100 / $columns - 1; } echo '<div class="' . $sitemap->classname . '">'; echo '<div class="componentheading">' . $title . '</div>'; echo '<div class="contentpaneopen"' . ($sitemap->columns > 1 ? ' style="float:left;width:100%;"' : '') . '>'; }
/** * Restores items selected to normal - restores to an unpublished state */ function restoreTrash($cid, $option) { global $database; josSpoofCheck(); $type = mosGetParam($_POST, 'type', array(0)); $total = count($cid); // restores to an unpublished state $state = 0; $ordering = 9999; if ($type == 'content') { // query to restore content items mosArrayToInts($cid); $cids = 'id=' . implode(' OR id=', $cid); $query = "UPDATE #__content" . "\n SET state = " . (int) $state . ", ordering = " . (int) $ordering . "\n WHERE ( {$cids} )"; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } } else { if ($type == 'menu') { sort($cid); foreach ($cid as $id) { $check = 1; $row = new mosMenu($database); $row->load($id); // check if menu item is a child item if ($row->parent != 0) { $query = "SELECT id" . "\n FROM #__menu" . "\n WHERE id = " . (int) $row->parent . "\n AND ( published = 0 OR published = 1 )"; $database->setQuery($query); $check = $database->loadResult(); if (!$check) { // if menu items parent is not found that are published/unpublished make it a root menu item $query = "UPDATE #__menu" . "\n SET parent = 0, published = " . (int) $state . ", ordering = 9999" . "\n WHERE id = " . (int) $id; } } if ($check) { // query to restore menu items $query = "UPDATE #__menu" . "\n SET published = " . (int) $state . ", ordering = 9999" . "\n WHERE id = " . (int) $id; } $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } } } } $msg = $total . " Iten(s) restaurados com sucesso!"; mosRedirect("index2.php?option={$option}&mosmsg=" . $msg . ""); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'content_item_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $link = 'javascript:submitbutton( \'redirect\' );'; $temp = explode('id=', $menu->link); $query = "SELECT a.title, c.name AS category, s.name AS section" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS c ON a.catid = c.id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n WHERE a.id = '" . $temp[1] . "'"; $database->setQuery($query); $content = $database->loadObjectlist(); // outputs item name, category & section instead of the select list $lists['content'] = ' <table width="100%"> <tr> <td width="10%"> Item: </td> <td> <a href="' . $link . '" title="' . T_('Edit Content Item') . '"> ' . $content[0]->title . ' </a> </td> </tr> <tr> <td width="10%"> ' . T_('Category:') . ' </td> <td> ' . $content[0]->category . ' </td> </tr> <tr> <td width="10%"> ' . T_('Section:') . ' </td> <td> ' . $content[0]->section . ' </td> </tr> </table>'; $contents = ''; $lists['content'] .= '<input type="hidden" name="content_item_link" value="' . $temp[1] . '" />'; } else { $query = "SELECT a.id AS value, a.title AS text, a.sectionid, a.catid " . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n INNER JOIN #__sections AS s ON a.sectionid = s.id" . "\n WHERE a.state = '1'" . "\n ORDER BY a.sectionid, a.catid, a.title"; $database->setQuery($query); $contents = $database->loadObjectList(); foreach ($contents as $content) { $database->setQuery("SELECT s.title" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND s.id = '" . $content->sectionid . "'"); $section = $database->loadResult(); $database->setQuery("SELECT c.title" . "\n FROM #__categories AS c" . "\n WHERE c.id = '" . $content->catid . "'"); $category = $database->loadResult(); $value = $content->value; $text = $section . " - " . $category . " / " . $content->text . " "; $temp[] = mosHTML::makeOption($value, $text); $contents = $temp; } // Create a list of links $lists['content'] = mosHTML::selectList($contents, 'content_item_link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_item_link_menu_html::edit($menu, $lists, $params, $option, $contents); }
/** * Save the item(s) to the menu selected */ function copyMenuSave($option, $cid, $menu, $menutype) { global $database, $my; $total = count($cid); $copy = new mosMenu($database); $original = new mosMenu($database); foreach ($cid as $id) { $original->load($id); $copy = $original; $copy->id = NULL; $copy->ordering = '9999'; $copy->menutype = $menu; if (!$copy->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $copy->updateOrder("menutype='" . $copy->menutype . "' AND parent='" . $copy->parent . "'"); } $msg = $total . $adminLanguage->A_COMP_MENUS_COPIED_TO . $menu; mosRedirect('index2.php?option=' . $option . '&menutype=' . $menutype . '&mosmsg=' . $msg); }
function saveOrder(&$cid) { global $database; $order = mosGetParam($_POST, 'order', array(0)); $row = new mosMenu($database); $folders = array(); // update ordering values foreach ($cid as $i => $ciditem) { $row->load($ciditem); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $folders[$row->folder][$row->client_id] = $row->id; } } // execute updateOrder for each group foreach ($folders as $folder => $clients) { foreach ($clients as $client => $rowid) { $row->updateOrder("folder = '{$folder}' AND ordering > -10000 AND ordering < 10000 AND client_id = '{$client}'"); } } // foreach $msg = T_('New ordering saved'); mosRedirect('index2.php?option=com_mambots', $msg); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador"); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'newsfeed_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('feedid=', $menu->link); $query = "SELECT *, c.title AS category" . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.id = " . (int) $temp[1]; $database->setQuery($query); $newsfeed = $database->loadObjectlist(); // outputs item name, category & section instead of the select list $lists['newsfeed'] = ' <table width="100%"> <tr> <td width="10%"> Item: </td> <td> ' . $newsfeed[0]->name . ' </td> </tr> <tr> <td width="10%"> Position: </td> <td> ' . $newsfeed[0]->category . ' </td> </tr> </table>'; $lists['newsfeed'] .= '<input type="hidden" name="newsfeed_link" value="' . $temp[1] . '" />'; $newsfeeds = ''; } else { $query = "SELECT a.id AS value, CONCAT( c.title, ' - ', a.name ) AS text, a.catid " . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.published = 1" . "\n ORDER BY a.catid, a.name"; $database->setQuery($query); $newsfeeds = $database->loadObjectList(); // Create a list of links $lists['newsfeed'] = mosHTML::selectList($newsfeeds, 'newsfeed_link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); newsfeed_link_menu_html::edit($menu, $lists, $params, $option, $newsfeeds); }
function showArchiveCategory($id = 0, $gid, &$access, $pop, $option, $now) { global $database, $mainframe, $mosConfig_offset; global $Itemid; // Parameters $noauth = !$mainframe->getCfg('shownoauth'); $year = mosGetParam($_REQUEST, 'year', date('Y')); $month = mosGetParam($_REQUEST, 'month', date('m')); $module = trim(mosGetParam($_REQUEST, 'module', '')); // used by archive module if ($module) { $check = ''; } else { $check = 'AND a.catid = ' . $id; } if ($Itemid) { $menu = new mosMenu($database); $menu->load($Itemid); $params =& new mosParameters($menu->params); } else { $menu = ""; $params =& new mosParameters(''); } $params->set('year', $year); $params->set('month', $month); // Ordering control $orderby_sec = $params->def('orderby', 'rdate'); $order_sec = _orderby_sec($orderby_sec); // used in query $where = _where(-2, $access, $noauth, $gid, $id, NULL, $year, $month); // query to determine if there are any archived entries for the category $query = "SELECT a.id" . "\n FROM #__content as a" . "\n WHERE a.state = '-1'" . "\n " . $check; $database->setQuery($query); $items = $database->loadObjectList(); $archives = count($items); $query = "SELECT a.*, ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count, u.name AS author, u.usertype, s.name AS section, g.name AS groups" . "\n FROM #__content AS a" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . (count($where) ? "\n WHERE " . implode("\n AND ", $where) : '') . "\n AND s.access <= " . $gid . "\n ORDER BY " . $order_sec; $database->setQuery($query); $rows = $database->loadObjectList(); // initiate form echo '<form action="' . sefRelToAbs('index.php?option=' . $option . '&task=archivecategory&id=' . $id . '&Itemid=' . $Itemid) . '" method="post">'; // Page Title $mainframe->SetPageTitle($menu->name); if (!$archives) { // if no archives for category, hides search and outputs empty message echo '<br /><div align="center">' . _CATEGORY_ARCHIVE_EMPTY . '</div>'; } else { BlogOutput($rows, $params, $gid, $access, $pop, $menu, 1); } echo '</form>'; }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load((int) $uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator"); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'content_item_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $link = 'javascript:submitbutton( \'redirect\' );'; $temp = explode('id=', $menu->link); $query = "SELECT a.title, c.name AS category, s.name AS section" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS c ON a.catid = c.id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n WHERE a.id = " . (int) $temp[1]; $database->setQuery($query); $content = $database->loadObjectlist(); // outputs item name, category & section instead of the select list $lists['content'] = ' <table width="100%"> <tr> <td width="10%"> Item: </td> <td> <a href="' . $link . '" title="Edit Content Item"> ' . $content[0]->title . ' </a> </td> </tr> <tr> <td width="10%"> Category: </td> <td> ' . $content[0]->category . ' </td> </tr> <tr> <td width="10%"> Section: </td> <td> ' . $content[0]->section . ' </td> </tr> </table>'; $contents = ''; $lists['content'] .= '<input type="hidden" name="content_item_link" value="' . $temp[1] . '" />'; } else { $query = "SELECT a.id AS value," . "\n CONCAT(s.title, ' - ',c.title,' / ',a.title, ' ') AS text" . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n INNER JOIN #__sections AS s ON a.sectionid = s.id AND s.scope = 'content'" . "\n WHERE a.state = 1" . "\n ORDER BY a.sectionid, a.catid, a.title"; $database->setQuery($query); $contents = $database->loadObjectList(); // Create a list of links $lists['content'] = mosHTML::selectList($contents, 'content_item_link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); content_item_link_menu_html::edit($menu, $lists, $params, $option, $contents); }
} else { require_once $LangPath . 'english.php'; } require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapConfig.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapSitemap.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapPlugins.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_xmap/classes/XmapCache.php'; global $xSitemap, $xConfig; $xConfig = new XmapConfig(); $xConfig->load(); $Itemid = intval(mosGetParam($_REQUEST, 'Itemid', '')); $sitemapid = ''; // Firts lets try to get the sitemap's id from the menu's params if ($Itemid) { $menu = new mosMenu($database); $menu->load($Itemid); $params = new mosParameters($menu->params); $sitemapid = intval($params->get('sitemap', '')); } if (!$sitemapid) { //If the is no sitemap id specificated $sitemapid = intval(mosGetParam($_REQUEST, 'sitemap', '')); } if (!$sitemapid && $xConfig->sitemap_default) { $sitemapid = $xConfig->sitemap_default; } $xSitemap = new XmapSitemap(); $xSitemap->load($sitemapid); if (!$xSitemap->id) { echo _XMAP_MSG_NO_SITEMAP; return;
/** * Copies a complete menu, all its items and creates a new module, using the name speified */ function copyMenu($option, $cid, $menu_name, $type) { global $database, $adminLanguage; $mids = mosGetParam($_POST, 'mids', ''); // create the module copy foreach ($cid as $id) { $row = new mosModule($database); $row->load($id); $row->title = $menu_name; $row->iscore = 0; $row->published = 0; $row->position = "left"; $row->module = "mod_mainmenu"; $row->params = "menutype=" . $menu_name . ""; if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $row->checkin(); $row->updateOrder("position='" . $row->position . "'"); } $total = count($mids); $copy = new mosMenu($database); $original = new mosMenu($database); foreach ($mids as $mid) { $original->load($mid); $copy = $original; $copy->id = NULL; $copy->menutype = $menu_name; if (!$copy->check()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } if (!$copy->store()) { echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n"; exit; } } $msg = $adminLanguage->A_COMP_MENU_COPY_OF . " `" . $type . "` " . $adminLanguage->A_COMP_MENU_CONSIST . " " . $total . " " . $adminLanguage->A_COMP_ITEMS; mosRedirect("index2.php?option=com_menumanager&mosmsg=" . $msg . ""); }
function saveOrder(&$cid) { global $database; $order = mosGetParam($_POST, 'order', array(0)); $row = new mosMenu($database); $categories = array(); // update ordering values foreach ($cid as $i => $ciditem) { $row->load($ciditem); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $categories[$row->catid] = $row->id; } } // execute updateOrder for each group foreach ($categories as $catid => $rowid) { $row->updateOrder("catid = {$catid} AND state >= 0"); } // foreach $msg = T_('New ordering saved'); mosRedirect('index2.php?option=com_typedcontent', $msg); }
function saveOrder(&$cid, $menutype) { global $database; $order = mosGetParam($_POST, 'order', array(0)); $row = new mosMenu($database); $parents = array(); // update ordering values foreach ($cid as $i => $ciditem) { $row->load($ciditem); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $parents[$row->parent] = $row->id; } } // execute updateOrder for each group foreach ($parents as $parent => $rowid) { $row->updateOrder("menutype = '{$menutype}' AND parent = '{$parent}' AND published >= 0"); } // foreach $msg = T_('New ordering saved'); mosRedirect('index2.php?option=com_menus&menutype=' . $menutype, $msg); }
function edit(&$uid, $menutype, $option) { global $database, $my, $mainframe; global $mosConfig_absolute_path; $menu = new mosMenu($database); $menu->load($uid); // fail if checked out not by 'me' if ($menu->checked_out && $menu->checked_out != $my->id) { echo "<script>alert('" . sprintf(T_('The module % is currently being edited by another administrator'), $menu->title) . "'); document.location.href='index2.php?option={$option}'</script>\n"; exit(0); } if ($uid) { $menu->checkout($my->id); } else { // load values for new entry $menu->type = 'contact_item_link'; $menu->menutype = $menutype; $menu->browserNav = 0; $menu->ordering = 9999; $menu->parent = intval(mosGetParam($_POST, 'parent', 0)); $menu->published = 1; } if ($uid) { $temp = explode('contact_id=', $menu->link); $query = "SELECT *" . "\n FROM #__contact_details AS a" . "\n WHERE a.id = '" . $temp[1] . "'"; $database->setQuery($query); $contact = $database->loadObjectlist(); // outputs item name, category & section instead of the select list $lists['contact'] = ' <table width="100%"> <tr> <td width="10%"> ' . T_('Name:') . ' </td> <td> ' . $contact[0]->name . ' </td> </tr> <tr> <td width="10%"> ' . T_('Position:') . ' </td> <td> ' . $contact[0]->con_position . ' </td> </tr> </table>'; $lists['contact'] .= '<input type="hidden" name="contact_item_link" value="' . $temp[1] . '" />'; $contacts = ''; } else { $query = "SELECT a.id AS value, CONCAT( a.name, ' - ',a.con_position ) AS text, a.catid " . "\n FROM #__contact_details AS a" . "\n INNER JOIN #__categories AS c ON a.catid = c.id" . "\n WHERE a.published = '1'" . "\n ORDER BY a.catid, a.name"; $database->setQuery($query); $contacts = $database->loadObjectList(); // Create a list of links $lists['contact'] = mosHTML::selectList($contacts, 'contact_item_link', 'class="inputbox" size="10"', 'value', 'text', ''); } // build html select list for target window $lists['target'] = mosAdminMenus::Target($menu); // build the html select list for ordering $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($menu); // build the html select list for paraent item $lists['parent'] = mosAdminMenus::Parent($menu); // build published button option $lists['published'] = mosAdminMenus::Published($menu); // build the url link output $lists['link'] = mosAdminMenus::Link($menu, $uid); // get params definitions $params =& new mosAdminParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu'); contact_item_link_menu_html::edit($menu, $lists, $params, $option, $contacts); }
static function ownersList($option) { global $database, $my, $Itemid, $mainframe, $booklibrary_configuration, $acl, $mosConfig_list_limit, $limit, $limitstart; PHP_booklibrary::addTitleAndMetaTags(); $symbol = mosGetParam($_REQUEST, 'letindex', ''); $symbol_str = ''; if ($symbol) { $symbol_str = " AND (LOWER(u.name) LIKE '{$symbol}%' ) "; } //getting groups of user $s = getWhereUsergroupsString("c"); // $menu = new JTableMenu( $database ); // $menu->load( $Itemid ); // $params = new mosParameters( $menu->params ); if (version_compare(JVERSION, '3.0', 'ge')) { $menu = new JTableMenu($database); $menu->load($Itemid); $params = new JRegistry(); $params->loadString($menu->params); } else { $menu = new mosMenu($database); $menu->load($Itemid); $params = new mosParameters($menu->params); } $database->setQuery("SELECT id FROM #__menu WHERE link='index.php?option=com_booklibrary'"); if ($database->loadResult() != $Itemid) { $params->def('wrongitemid', '1'); } $params->def('header', _BOOKLIBRARY_LABEL_TITLE_OWNERSLIST); if (!$params->get('wrongitemid')) { $pathway = sefRelToAbs('index.php?option=' . $option . '&task=owners_list&Itemid=' . $Itemid); $pathway_name = _BOOKLIBRARY_LABEL_TITLE_OWNERSLIST; $mainframe->appendPathWay($pathway_name, $pathway); } if (checkAccessBL($booklibrary_configuration['ownerslist']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl) && $booklibrary_configuration['ownerslist']['show']) { $params->def('ownerslist_show', 1); } $db = JFactory::getDBO(); $query = "SELECT COUNT(DISTINCT u.email)\n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1\n AND ({$s}) {$symbol_str};\n "; $database->setQuery($query); $total = $database->loadResult(); $pageNav = new JPagination($total, $limitstart, $limit); // for J 1.6 $query = "SELECT u.name, COUNT(DISTINCT mc.bookid) AS books\n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1 AND bl.owneremail!=''\n AND ({$s}) {$symbol_str}\n \nGROUP BY u.name\n \nORDER BY u.name\n \nLIMIT {$pageNav->limitstart},{$pageNav->limit};"; $database->setQuery($query); $ownerslist = $database->loadObjectList(); if (!empty($ownerslist[0]->books) && !isset($ownerslist[0]->name)) { $ownerslist[0]->name = 'anonymous'; } $query = "SELECT DISTINCT UPPER(SUBSTRING(u.name, 1,1)) AS symb \n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1 AND bl.owneremail!=''\n AND ({$s})\n \nORDER BY u.name ;"; $database->setQuery($query); $symb = $database->loadObjectList(); if (count($symb) > 0) { $symb_list_str = '<div style="display:inline; margin-left:auto;margin-right:auto;">'; foreach ($symb as $symbol) { $symb_list_str .= '<span style="padding:5px; ">' . '<a href="index.php?option=' . $option . '&task=owners_list' . '&letindex=' . $symbol->symb . '&Itemid=' . $Itemid . '">' . $symbol->symb . '</a></span>'; } $symb_list_str .= "</div>"; $params->def('symb_list_str', $symb_list_str); } $params->def('ownerlist01', "{loadposition com_booklibrary_owner_list_01}"); $params->def('ownerlist02', "{loadposition com_booklibrary_owner_list_02}"); $params->def('ownerlist03', "{loadposition com_booklibrary_owner_list_03}"); //print_r($ownerslist); HTML_booklibrary::showOwnersList($params, $ownerslist, $pageNav); }
function saveOrder(&$cid, $menutype) { global $database; josSpoofCheck(); $total = count($cid); $order = josGetArrayInts('order'); $row = new mosMenu($database); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } // remember to updateOrder this group $condition = "menutype = " . $database->Quote($menutype) . " AND parent = " . (int) $row->parent . " AND published >= 0"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } if (!$found) { $conditions[] = array($row->id, $condition); } } } // execute updateOrder for each group foreach ($conditions as $cond) { $row->load($cond[0]); $row->updateOrder($cond[1]); } // clean any existing cache files mosCache::cleanCache('com_content'); $msg = 'Nova ordenação salva'; mosRedirect('index2.php?option=com_menus&menutype=' . $menutype, $msg); }