/** * Form for copying item(s) to a specific menu */ function copySectionSelect($option, $cid, $section) { global $database; if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Select an item to move'); window.history.go(-1);</script>\n"; exit; } ## query to list selected categories mosArrayToInts($cid); $cids = 'a.section=' . implode(' OR a.section=', $cid); $query = "SELECT a.name, a.id" . "\n FROM #__categories AS a" . "\n WHERE ( {$cids} )"; $database->setQuery($query); $categories = $database->loadObjectList(); ## query to list items from categories //mosArrayToInts( $cid ); // Just done a few lines earlier $cids = 'a.sectionid=' . implode(' OR a.sectionid=', $cid); $query = "SELECT a.title, a.id" . "\n FROM #__content AS a" . "\n WHERE ( {$cids} )" . "\n ORDER BY a.sectionid, a.catid, a.title"; $database->setQuery($query); $contents = $database->loadObjectList(); sections_html::copySectionSelect($option, $cid, $categories, $contents, $section); }
/** * Form for copying item(s) to a specific menu */ function copySectionSelect($option, $cid, $section) { global $mainframe; // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $db =& JFactory::getDBO(); JArrayHelper::toInteger($cid); if (count($cid) < 1) { JError::raiseError(500, JText::_('Select an item to move', true)); } ## query to list selected categories $cids = implode(',', $cid); $query = 'SELECT a.title, a.id' . ' FROM #__categories AS a' . ' WHERE a.section IN ( ' . $cids . ' )'; $db->setQuery($query); $categories = $db->loadObjectList(); ## query to list items from categories $query = 'SELECT a.title, a.id' . ' FROM #__content AS a' . ' WHERE a.sectionid IN ( ' . $cids . ' )' . ' ORDER BY a.sectionid, a.catid, a.title'; $db->setQuery($query); $contents = $db->loadObjectList(); sections_html::copySectionSelect($option, $cid, $categories, $contents, $section); }
/** * Form for copying item(s) to a specific menu */ function copySectionSelect($option, $cid, $section) { 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 categories $cids = implode(',', $cid); $query = "SELECT a.name, a.id" . "\n FROM #__categories AS a" . "\n WHERE a.section IN ( " . $cids . " )"; $database->setQuery($query); $categories = $database->loadObjectList(); ## query to list items from categories $query = "SELECT a.title, a.id" . "\n FROM #__content AS a" . "\n WHERE a.sectionid IN ( " . $cids . " )" . "\n ORDER BY a.sectionid, a.catid, a.title"; $database->setQuery($query); $contents = $database->loadObjectList(); sections_html::copySectionSelect($option, $cid, $categories, $contents, $section); }