/** * Saves changes to a course or saves a new entry if creating * * @return void */ public function saveTask() { // Check for request forgeries Request::checkToken(); // Incoming $fields = Request::getVar('fields', array(), 'post'); // Instantiate a Course object $model = new \Components\Courses\Models\Assetgroup($fields['id']); if (!$model->bind($fields)) { $this->setError($model->getError()); $this->editTask($model); return; } $p = new \Hubzero\Config\Registry(''); $p->loadArray(Request::getVar('params', array(), 'post')); $model->set('params', $p->toString()); if (!$model->store(true)) { $this->setError($model->getError()); $this->editTask($model); return; } // Output messsage and redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&unit=' . $model->get('unit_id'), false), Lang::txt('COM_COURSES_ASSETGROUP_SAVED')); }