예제 #1
0
 /**
  * Save changes to a record
  *
  * @return  void
  */
 public function saveTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Trim and addslashes all posted items
     $fields = Request::getVar('fields', array(), 'post');
     // Initiate class and bind posted items to database fields
     $row = new Category($this->database);
     if (!$row->bind($fields)) {
         $this->setError($row->getError());
         $this->editTask($row);
         return;
     }
     // Check content
     if (!$row->check()) {
         $this->setError($row->getError());
         $this->editTask($row);
         return;
     }
     // Store new content
     if (!$row->store()) {
         $this->setError($row->getError());
         $this->editTask($row);
         return;
     }
     if ($this->_task == 'apply') {
         return $this->editTask($row);
     }
     // Output messsage and redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_SUPPORT_CATEGORY_SUCCESSFULLY_SAVED'));
 }