コード例 #1
0
ファイル: sessions.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Removes class(es)
  *
  * @return  void
  */
 public function deleteTask()
 {
     // 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\SessionClass($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=classes', false), Lang::txt('COM_TOOLS_SESSION_CLASS_DONT_DELETE_DEFAULT'), 'warning');
                 return;
             }
             // Remove the record
             $row->delete($id);
             $prefs = new Tables\Preferences($this->database);
             $prefs->restoreDefaultClass($id);
         }
     } else {
         // Output message and redirect
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=classes', false), Lang::txt('COM_TOOLS_SESSION_CLASS_DELETE_NO_ROWS'), 'warning');
     }
     // Output messsage and redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=classes', false), Lang::txt('COM_TOOLS_SESSION_CLASS_DELETE_SUCCESSFUL'));
 }
コード例 #2
0
 /**
  * Get class values
  *
  * @return  void
  */
 public function getClassValuesTask()
 {
     $class_id = Request::getInt('class_id');
     $class = new Tables\SessionClass($this->database);
     $class->load($class_id);
     $return = array('jobs' => $class->jobs);
     echo json_encode($return);
     exit;
 }