/** * Save blog settings * * @return void */ private function _savesettings() { // Login check if (User::isGuest()) { return $this->_login(); } if ($this->authorized != 'manager' && $this->authorized != 'admin') { $this->setError(Lang::txt('PLG_GROUPS_COLLECTIONS_NOT_AUTH')); return $this->_collections(); } // Check for request forgeries Request::checkToken(); $settings = Request::getVar('settings', array(), 'post'); $row = \Hubzero\Plugin\Params::oneByPlugin($this->group->get('gidNumber'), $this->_type, $this->_name); $row->set('object_id', $this->group->get('gidNumber')); $row->set('folder', $this->_type); $row->set('element', $this->_name); // Get parameters $prms = Request::getVar('params', array(), 'post'); $params = new \Hubzero\Config\Registry($prms); $row->set('params', $params->toString()); // Store new content if (!$row->save()) { $this->setError($row->getError()); return $this->_settings(); } // Record the activity $recipients = array(['group', $this->group->get('gidNumber')]); foreach ($this->group->get('managers') as $recipient) { $recipients[] = ['user', $recipient]; } Event::trigger('system.logActivity', ['activity' => ['action' => 'updated', 'scope' => 'collections.settings', 'scope_id' => $row->get('id'), 'description' => Lang::txt('PLG_GROUPS_COLLECTIONS_ACTIVITY_SETTINGS_UPDATED')], 'recipients' => $recipients]); App::redirect(Route::url('index.php?option=com_groups&cn=' . $this->group->get('cn') . '&active=' . $this->_name), Lang::txt('PLG_GROUPS_COLLECTIONS_SETTINGS_SAVED'), 'passed'); }
/** * Display blog settings * * @return string */ private function _settings() { if (User::isGuest()) { $this->setError(Lang::txt('GROUPS_LOGIN_NOTICE')); return; } if ($this->authorized != 'manager' && $this->authorized != 'admin') { $this->setError(Lang::txt('PLG_GROUPS_BLOG_NOT_AUTHORIZED')); return $this->_browse(); } $settings = \Hubzero\Plugin\Params::oneByPlugin($this->group->gidNumber, $this->_type, $this->_name); // Output HTML $view = $this->view('default', 'settings')->set('option', $this->option)->set('group', $this->group)->set('task', $this->action)->set('config', $this->params)->set('settings', $settings)->set('model', $this->model)->set('authorized', $this->authorized)->setErrors($this->getErrors()); return $view->loadTemplate(); }
/** * Display blog settings * * @return string */ private function _settings() { if (User::isGuest()) { return $this->_login(); } if (User::get('id') != $this->member->get('id')) { $this->setError(Lang::txt('PLG_MEMBERS_BLOG_NOT_AUTHORIZED')); return $this->_browse(); } $settings = \Hubzero\Plugin\Params::oneByPlugin($this->member->get('id'), 'members', $this->_name); // Output HTML $view = $this->view('default', 'settings')->set('option', $this->option)->set('member', $this->member)->set('task', $this->task)->set('config', $this->params)->set('settings', $settings)->setErrors($this->getErrors()); return $view->loadTemplate(); }