Пример #1
0
 /**
  * Delete a handler
  *
  * @return void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming (expecting an array)
     $ids = Request::getVar('id', array());
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     // Make sure we have IDs to work with
     if (count($ids) > 0) {
         // Loop through the array of ID's and delete
         foreach ($ids as $id) {
             $handler = Handler::oneOrFail($id);
             // Delete the rules first, then the handler itself
             if (!$handler->rules->destroyAll() || !$handler->destroy()) {
                 App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_TOOLS_HANDLERS_DELETE_FAILED'));
                 return;
             }
         }
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_TOOLS_HANDLERS_SUCCESSFULLY_DELETED', count($ids)));
 }