示例#1
0
 protected function _populateScopeDetails()
 {
     if ($this->_unconfirmed_scopes === null || $this->_confirmed_scopes === null) {
         $this->_unconfirmed_scopes = array();
         $this->_confirmed_scopes = array();
         if ($this->_scopes === null) {
             $this->_scopes = array();
         }
         $scopes = tables\UserScopes::getTable()->getScopeDetailsByUser($this->getID());
         foreach ($scopes as $scope_id => $details) {
             $scope = \thebuggenie\core\entities\Scope::getB2DBTable()->selectById($scope_id);
             if (!$details['confirmed']) {
                 $this->_unconfirmed_scopes[$scope_id] = $scope;
             } else {
                 $this->_confirmed_scopes[$scope_id] = $scope;
             }
             if (!array_key_exists($scope_id, $this->_scopes)) {
                 $this->_scopes[$scope_id] = $scope;
             }
         }
     }
 }
示例#2
0
 /**
  * Performs post-save actions on user objects
  *
  * This includes firing off events for modules to listen to (e.g. so
  * activation emails can be sent out), and setting up a default
  * dashboard for the new user.
  *
  * @param boolean $is_new Whether this is a new object or not (automatically passed to the function from B2DB)
  */
 protected function _postSave($is_new)
 {
     if ($is_new) {
         // Set up a default dashboard for the user
         $dashboard = new \thebuggenie\core\entities\Dashboard();
         $dashboard->setUser($this);
         $dashboard->save();
         $scope = \thebuggenie\core\entities\Scope::getB2DBTable()->selectById((int) framework\Settings::getDefaultScopeID());
         $this->addScope($scope, false);
         $this->confirmScope($scope->getID());
         if (!framework\Context::getScope()->isDefault()) {
             $scope = framework\Context::getScope();
             $this->addScope($scope, false);
             $this->confirmScope($scope->getID());
         }
         $event = \thebuggenie\core\framework\Event::createNew('core', 'self::_postSave', $this);
         $event->trigger();
     }
     if ($this->_group_id !== null) {
         tables\UserScopes::getTable()->updateUserScopeGroup($this->getID(), framework\Context::getScope()->getID(), $this->_group_id);
     }
 }