/** * Method to run batch operations. * * @param JModel $model The model of the component being processed. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 11.1 */ public function batch($model) { // Initialise variables. $input = JFactory::getApplication()->input; $vars = $input->post->get('batch', array(), 'array'); $cid = $input->post->get('cid', array(), 'array'); // Build an array of item contexts to check $contexts = array(); foreach ($cid as $id) { // If we're coming from com_categories, we need to use extension vs. option if (isset($this->extension)) { $option = $this->extension; } else { $option = $this->option; } $contexts[$id] = $option . '.' . $this->context . '.' . $id; } // Attempt to run the batch operation. if ($model->batch($vars, $cid, $contexts)) { $this->setMessage(JText::_('JLIB_APPLICATION_SUCCESS_BATCH')); return true; } else { $this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_FAILED', $model->getError())); return false; } }