/** * Method to save an element. * * @access public * @return void */ public function save() { CkJSession::checkToken() or CkJSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN')); //Check the ACLs $model = $this->getModel(); $item = $model->getItem(); $result = false; if ($model->canEdit($item, true)) { $result = parent::save(); //Get the model through postSaveHook() if ($this->model) { $model = $this->model; $item = $model->getItem(); } } else { JError::raiseWarning(403, JText::sprintf('ACL_UNAUTORIZED_TASK', JText::_('RTIPRINT_JTOOLBAR_SAVE'))); } $this->_result = $result; //Define the redirections switch ($this->getLayout() . '.' . $this->getTask()) { case 'changelog.apply': $this->applyRedirection($result, array('stay', 'com_rtiprint.changelog.rochangelog'), array('cid[]' => $model->getState('changelog.id'))); break; case 'changelog.save': $this->applyRedirection($result, array('stay', 'com_rtiprint.changelogs.changelogs'), array('cid[]' => null)); break; case 'changelog.save2new': $this->applyRedirection($result, array('stay', 'com_rtiprint.changelog.rochangelog'), array('cid[]' => null)); break; case 'changelog.save2copy': $this->applyRedirection($result, array('stay', 'com_rtiprint.changelog.rochangelog'), array('cid[]' => $model->getState('changelog.id'))); break; default: $this->applyRedirection($result, array('stay', 'com_rtiprint.changelogs.default')); break; } }