Пример #1
0
 /**
  * Save quota class
  *
  * @param   integer  $redirect  Whether or not to redirect after save
  * @return  void
  */
 public function saveClassTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming fields
     $fields = Request::getVar('fields', array(), 'post');
     // Load the profile
     $row = new Tables\QuotasClasses($this->database);
     // Try to save
     if (!$row->save($fields)) {
         $this->view->task = 'editClass';
         $this->setError($row->getError());
         $this->editClassTask($row->id);
         return;
     }
     // Save class/access-group association
     if (!isset($fields['groups'])) {
         $fields['groups'] = array();
     }
     if (!$row->setGroupIds($fields['groups'])) {
         $this->view->task = 'editClass';
         $this->setError($row->getError());
         $this->editClassTask($row->id);
         return;
     }
     Notify::success(Lang::txt('COM_MEMBERS_QUOTA_CLASS_SAVE_SUCCESSFUL'));
     // Redirect
     if ($this->_task == 'applyClass') {
         return $this->editClassTask($row->id);
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=displayClasses', false));
 }