/** * Form for copying item(s) **/ function copyItem() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // Initialize variables $db =& JFactory::getDBO(); $cid = JRequest::getVar('cid', array(), 'post', 'array'); $sectionid = JRequest::getVar('sectionid', 0, '', 'int'); $option = JRequest::getCmd('option'); JArrayHelper::toInteger($cid); if (count($cid) < 1) { $msg = JText::_('Select an item to move'); $mainframe->redirect('index.php?option=' . $option, $msg, 'error'); } //seperate contentids $cids = implode(',', $cid); ## Articles query $query = 'SELECT a.title' . ' FROM #__content AS a' . ' WHERE ( a.id IN ( ' . $cids . ' ) )' . ' ORDER BY a.title'; $db->setQuery($query); $items = $db->loadObjectList(); ## Section & Category query $query = 'SELECT CONCAT_WS(",",s.id,c.id) AS `value`, CONCAT_WS(" / ", s.title, c.title) AS `text`' . ' FROM #__sections AS s' . ' INNER JOIN #__categories AS c ON c.section = s.id' . ' WHERE s.scope = "content"' . ' ORDER BY s.title, c.title'; $db->setQuery($query); // Add a row for uncategorized content $uncat = JHTML::_('select.option', '0,0', JText::_('UNCATEGORIZED')); $rows = $db->loadObjectList(); array_unshift($rows, $uncat); // build the html select list $sectCatList = JHTML::_('select.genericlist', $rows, 'sectcat', 'class="inputbox" size="10"', 'value', 'text', NULL); ContentView::copySection($option, $cid, $sectCatList, $sectionid, $items); }