Beispiel #1
0
 /**
  * Delete one or more entries
  *
  * @return  void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Check for an ID
     if (!count($ids)) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_FEEDBACK_SELECT_QUOTE_TO_DELETE'), 'error');
         return;
     }
     foreach ($ids as $id) {
         $row = Quote::oneOrFail(intval($id));
         // Delete the quote
         if (!$row->destroy()) {
             Notify::error($row->getError());
             continue;
         }
     }
     // Output messsage and redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_FEEDBACK_REMOVED'));
 }
Beispiel #2
0
 /**
  * Delete one or more entries
  *
  * @return  void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     if (!User::authorise('core.delete', $this->_option)) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
     }
     // Incoming
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Check for an ID
     if (!count($ids)) {
         Notify::warning(Lang::txt('COM_FEEDBACK_SELECT_QUOTE_TO_DELETE'));
         return $this->cancelTask();
     }
     $i = 0;
     foreach ($ids as $id) {
         $row = Quote::oneOrFail(intval($id));
         // Delete the quote
         if (!$row->destroy()) {
             Notify::error($row->getError());
             continue;
         }
         $i++;
     }
     // Output messsage and redirect
     if ($i) {
         Notify::success(Lang::txt('COM_FEEDBACK_REMOVED'));
     }
     $this->cancelTask();
 }