示例#1
0
 /**
  * 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_COLLECTIONS_BLOG_NOT_AUTH'));
         return $this->_collections();
     }
     // Check for request forgeries
     Request::checkToken();
     $settings = Request::getVar('settings', array(), 'post');
     $row = new \Hubzero\Plugin\Params($this->database);
     $row->loadPlugin($this->group->get('gidNumber'), $this->_type, $this->_name);
     $row->object_id = $this->group->get('gidNumber');
     $row->folder = $this->_type;
     $row->element = $this->_name;
     // Get parameters
     $prms = Request::getVar('params', array(), 'post');
     $params = new \Hubzero\Config\Registry($prms);
     $row->params = $params->toString();
     // Check content
     if (!$row->check()) {
         $this->setError($row->getError());
         return $this->_settings();
     }
     // Store new content
     if (!$row->store()) {
         $this->setError($row->getError());
         return $this->_settings();
     }
     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');
 }