Пример #1
0
 /**
  * Removes class(es)
  *
  * @return  void
  */
 public function deleteClassTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Do we have any IDs?
     if (!empty($ids)) {
         // Loop through each ID and delete the necessary items
         foreach ($ids as $id) {
             $id = intval($id);
             $row = new Tables\QuotasClasses($this->database);
             $row->load($id);
             if ($row->alias == 'default') {
                 // Output message and redirect
                 App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=displayClasses', false), Lang::txt('COM_MEMBERS_QUOTA_CLASS_DONT_DELETE_DEFAULT'), 'warning');
                 return;
             }
             // Remove the record
             $row->delete($id);
             // Restore all members of this class to default
             $quota = new Tables\UsersQuotas($this->database);
             $quota->restoreDefaultClass($id);
         }
     } else {
         // Output message and redirect
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=displayClasses', false), Lang::txt('COM_MEMBERS_QUOTA_DELETE_NO_ROWS'), 'warning');
     }
     // Output messsage and redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=displayClasses', false), Lang::txt('COM_MEMBERS_QUOTA_DELETE_SUCCESSFUL'));
 }