Beispiel #1
0
 /**
  * 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;
     }
 }
Beispiel #2
0
 /**
  * Method to cancel an element.
  *
  * @access	public
  * @return	void
  */
 public function cancel()
 {
     $this->_result = $result = parent::cancel();
     $model = $this->getModel();
     //Define the redirections
     switch ($this->getLayout() . '.' . $this->getTask()) {
         case 'printer.cancel':
             $this->applyRedirection($result, array('stay', 'com_rtiprint.printers.default'), array('cid[]' => null));
             break;
         default:
             $this->applyRedirection($result, array('stay', 'com_rtiprint.printers.default'));
             break;
     }
 }
Beispiel #3
0
 /**
  * Method to delete an element.
  *
  * @access	public
  * @return	void
  */
 public function delete()
 {
     CkJSession::checkToken() or CkJSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN'));
     $this->_result = $result = parent::delete();
     $model = $this->getModel();
     //Define the redirections
     switch ($this->getLayout() . '.' . $this->getTask()) {
         case 'default.delete':
             $this->applyRedirection($result, array('stay', 'com_rtiprint.favourites.default'), array('cid[]' => null));
             break;
         default:
             $this->applyRedirection($result, array('stay', 'com_rtiprint.favourites.default'));
             break;
     }
 }
Beispiel #4
0
 /**
  * Override method when the author allowed to edit own.
  *
  * @access	protected
  * @param	array	$data	An array of input data.
  * @param	string	$key	The name of the key for the primary key; default is id..
  *
  * @return	boolean	True on success
  */
 protected function allowEdit($data = array(), $key = id)
 {
     return parent::allowEdit($data, $key, array('key_author' => 'created_by'));
 }
Beispiel #5
0
 /**
  * Function that allows child controller access to model data after the data
  * has been saved.
  *
  * @access	protected
  * @param	JModel	&$model	The data model object.
  * @param	array	$validData	The validated data.
  * @return	void
  */
 protected function postSaveHook(&$model, $validData = array())
 {
     parent::postSaveHook($model, $validData);
     //UPLOAD FILE : Manual
     $model->_upload('manual', array('application/pdf' => 'pdf'));
     //UPLOAD FILE : Image
     $model->_upload('image', array('image/jpeg' => 'jpg,jpeg', 'image/png' => 'png'));
 }