コード例 #1
0
ファイル: sessions.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Display quota classes
  *
  * @return  void
  */
 public function classesTask()
 {
     // Incoming
     $this->view->filters = array('limit' => Request::getState($this->_option . '.classes.limit', 'limit', Config::get('list_limit'), 'int'), 'start' => Request::getState($this->_option . '.classes.limitstart', 'limitstart', 0, 'int'));
     $obj = new Tables\SessionClass($this->database);
     // Get a record count
     $this->view->total = $obj->find('count', $this->view->filters);
     $this->view->rows = $obj->find('list', $this->view->filters);
     if (!$this->view->total) {
         $obj->createDefault();
         $this->view->total = $obj->find('count', $this->view->filters);
         $this->view->rows = $obj->find('list', $this->view->filters);
     }
     $this->view->config = $this->config;
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->setLayout('classes')->display();
 }
コード例 #2
0
 /**
  * Edit a member quota
  *
  * @param   integer  $id  ID of user to edit
  * @return  void
  */
 public function editTask($row = null)
 {
     Request::setVar('hidemainmenu', 1);
     if (!is_object($row)) {
         // Incoming
         $id = Request::getVar('id', array(0));
         // Get the single ID we're working with
         if (is_array($id)) {
             $id = !empty($id) ? $id[0] : 0;
         }
         $row = new Tables\Preferences($this->database);
         $row->load($id);
     }
     $this->view->row = $row;
     // Build classes select option
     $quotaClass = new Tables\SessionClass($this->database);
     $classes = $quotaClass->find('list');
     $selected = '';
     $options[] = Html::select('option', '0', Lang::txt('COM_TOOLS_USER_PREFS_CUSTOM'), 'value', 'text');
     foreach ($classes as $class) {
         $options[] = Html::select('option', $class->id, $class->alias, 'value', 'text');
         if ($class->id == $this->view->row->class_id) {
             $selected = $class->id;
         }
     }
     $this->view->classes = Html::select('genericlist', $options, 'fields[class_id]', '', 'value', 'text', $selected, 'class_id', false, false);
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }