protected function postSaveHook(JModelLegacy $model, $validData = array()) { $item = $model->getItem(); $id = $item->get('id'); if ($id) { if ($validData['saveresult'] == 1) { //Create a new datatable if it doesn't allready exist if (!$model->createDataTables($id)) { $this->setMessage($model->getError()); } } } }
/** * Method to run batch operations. * * @param JModelLegacy $model The model of the component being processed. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 12.2 */ public function batch($model) { // Initialise variables. $vars = $this->input->post->get('batch', array(), 'array'); $cid = $this->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; } }