Example #1
0
 /**
  * Update an existing record
  *
  * @return  void
  */
 public function updateTask()
 {
     // Check for request forgeries
     //Request::checkToken('get');
     $id = Request::getInt('id', 0);
     $action = Request::getVar('action', '');
     $value = Request::getInt('value', 0);
     $row = new AroAco($this->database);
     $row->load($id);
     switch ($action) {
         case 'create':
             $row->action_create = $value;
             break;
         case 'read':
             $row->action_read = $value;
             break;
         case 'update':
             $row->action_update = $value;
             break;
         case 'delete':
             $row->action_delete = $value;
             break;
     }
     // Check content
     if (!$row->check()) {
         App::abort(500, $row->getError());
     }
     // Store new content
     if (!$row->store()) {
         App::abort(500, $row->getError());
     }
     // Output messsage and redirect
     Notify::success(Lang::txt('COM_SUPPORT_ACL_SAVED'));
     $this->cancelTask();
 }
Example #2
0
 /**
  * Update an existing record
  *
  * @return  void
  */
 public function updateTask()
 {
     // Check for request forgeries
     //Request::checkToken('get');
     $id = Request::getInt('id', 0);
     $action = Request::getVar('action', '');
     $value = Request::getInt('value', 0);
     $row = new AroAco($this->database);
     $row->load($id);
     switch ($action) {
         case 'create':
             $row->action_create = $value;
             break;
         case 'read':
             $row->action_read = $value;
             break;
         case 'update':
             $row->action_update = $value;
             break;
         case 'delete':
             $row->action_delete = $value;
             break;
     }
     // Check content
     if (!$row->check()) {
         throw new Exception($row->getError(), 500);
     }
     // Store new content
     if (!$row->store()) {
         throw new Exception($row->getError(), 500);
     }
     // Output messsage and redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_SUPPORT_ACL_SAVED'));
 }