コード例 #1
0
ファイル: pages.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Save a course page
  *
  * @return  void
  */
 public function saveTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // load the request vars
     $fields = Request::getVar('fields', array(), 'post', 'none', 2);
     // instatiate course page object for saving
     $row = new \Components\Courses\Models\Page($fields['id']);
     if (!$row->bind($fields)) {
         $this->setError($row->getError());
         $this->editTask($row);
         return;
     }
     if (!$row->store(true)) {
         $this->setError($row->getError());
         $this->editTask($row);
         return;
     }
     if ($this->_task == 'apply') {
         return $this->editTask($row);
     }
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&course=' . $fields['course_id'] . '&offering=' . $fields['offering_id'], false), Lang::txt('COM_COURSES_ITEM_SAVED'));
 }
コード例 #2
0
ファイル: pages.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Save a record
  *
  * @return  void
  */
 public function _save()
 {
     if (User::isGuest()) {
         $return = Route::url($this->view->offering->link() . '&active=' . $this->_name, false, true);
         App::redirect(Route::url('index.php?option=com_users&view=login&return=' . $return, false));
         return;
     }
     if (!$this->view->offering->access('manage', 'section')) {
         return $this->_list();
     }
     // Check for request forgeries
     Request::checkToken();
     $page = Request::getVar('fields', array(), 'post', 'none', 2);
     $model = new \Components\Courses\Models\Page($page['id']);
     if (!$model->bind($page)) {
         $this->addPluginMessage($model->getError(), 'error');
         return $this->_edit($model);
     }
     // Ensure section managers can only edit section pages
     if (!$model->get('section_id') && !$this->view->offering->access('manage')) {
         return $this->_list();
     }
     if (!$model->store(true)) {
         $this->addPluginMessage($model->getError(), 'error');
         return $this->_edit($model);
     }
     App::redirect(Route::url($this->view->offering->link() . '&active=' . $this->_name . '&unit=' . $model->get('url')));
 }