當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TBGSettings::getDefaultScopeID方法代碼示例

本文整理匯總了PHP中TBGSettings::getDefaultScopeID方法的典型用法代碼示例。如果您正苦於以下問題:PHP TBGSettings::getDefaultScopeID方法的具體用法?PHP TBGSettings::getDefaultScopeID怎麽用?PHP TBGSettings::getDefaultScopeID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TBGSettings的用法示例。


在下文中一共展示了TBGSettings::getDefaultScopeID方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: clearUserScopes

 public function clearUserScopes($user_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, TBGSettings::getDefaultScopeID(), Criteria::DB_NOT_EQUALS);
     $crit->addWhere(self::USER_ID, $user_id);
     $this->doDelete($crit);
 }
開發者ID:oparoz,項目名稱:thebuggenie,代碼行數:7,代碼來源:TBGUserScopesTable.class.php

示例2: loadFixtures

 public static function loadFixtures(TBGScope $scope)
 {
     $scope_id = $scope->getID();
     $admin_group = new TBGGroup();
     $admin_group->setName('Administrators');
     $admin_group->setScope($scope);
     $admin_group->save();
     TBGSettings::saveSetting('admingroup', $admin_group->getID(), 'core', $scope_id);
     $user_group = new TBGGroup();
     $user_group->setName('Regular users');
     $user_group->setScope($scope);
     $user_group->save();
     TBGSettings::saveSetting('defaultgroup', $user_group->getID(), 'core', $scope_id);
     $guest_group = new TBGGroup();
     $guest_group->setName('Guests');
     $guest_group->setScope($scope);
     $guest_group->save();
     // Set up initial users, and their permissions
     if ($scope->isDefault()) {
         list($guestuser_id, $adminuser_id) = TBGUser::loadFixtures($scope, $admin_group, $user_group, $guest_group);
         TBGUserScopesTable::getTable()->addUserToScope($guestuser_id, $scope->getID(), $guest_group->getID(), true);
         TBGUserScopesTable::getTable()->addUserToScope($adminuser_id, $scope->getID(), $admin_group->getID(), true);
     } else {
         $default_scope_id = TBGSettings::getDefaultScopeID();
         $default_user_id = (int) TBGSettings::get(TBGSettings::SETTING_DEFAULT_USER_ID, 'core', $default_scope_id);
         TBGUserScopesTable::getTable()->addUserToScope($default_user_id, $scope->getID(), $user_group->getID(), true);
         TBGUserScopesTable::getTable()->addUserToScope(1, $scope->getID(), $admin_group->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_USER_ID, $default_user_id, 'core', $scope->getID());
     }
     TBGPermissionsTable::getTable()->loadFixtures($scope, $admin_group->getID(), $guest_group->getID());
 }
開發者ID:oparoz,項目名稱:thebuggenie,代碼行數:31,代碼來源:TBGGroup.class.php

示例3: runUpdateUserScopes

 public function runUpdateUserScopes(TBGRequest $request)
 {
     try {
         if (!TBGContext::getScope()->isDefault()) {
             throw new Exception('This operation is not allowed');
         }
         $user = TBGContext::factory()->TBGUser($request['user_id']);
         if ($user instanceof TBGUser) {
             $return_options = array('message' => $this->getI18n()->__("The user's scope access was successfully updated"));
             $scopes = $request->getParameter('scopes', array());
             if (count($scopes) && !(count($scopes) == 1 && array_key_exists(TBGSettings::getDefaultScopeID(), $scopes))) {
                 foreach ($user->getScopes() as $scope_id => $scope) {
                     if (!$scope->isDefault() && !array_key_exists($scope_id, $scopes)) {
                         $user->removeScope($scope_id);
                     }
                 }
                 foreach ($scopes as $scope_id => $scope) {
                     try {
                         $scope = new TBGScope((int) $scope_id);
                         if ($user->isMemberOfScope($scope)) {
                             continue;
                         }
                         $user->addScope($scope);
                     } catch (Exception $e) {
                     }
                 }
             }
             return $this->renderJSON($return_options);
         }
     } catch (Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $this->getI18n()->__('This user could not be updated: %message', array('%message' => $e->getMessage()))));
     }
     $this->getResponse()->setHttpStatus(400);
     return $this->renderJSON(array('error' => $this->getI18n()->__('This user could not be updated')));
 }
開發者ID:oparoz,項目名稱:thebuggenie,代碼行數:36,代碼來源:actions.class.php

示例4: _postSave

 /**
  * 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
         TBGDashboardViewsTable::getTable()->setDefaultViews($this->getID(), TBGDashboardViewsTable::TYPE_USER);
         $scope = TBGContext::factory()->TBGScope((int) TBGSettings::getDefaultScopeID());
         $this->addScope($scope, false);
         $this->confirmScope($scope->getID());
         if (!TBGContext::getScope()->isDefault()) {
             $scope = TBGContext::getScope();
             $this->addScope($scope, false);
             $this->confirmScope($scope->getID());
         }
         $event = TBGEvent::createNew('core', 'TBGUser::_postSave', $this);
         $event->trigger();
     }
     if ($this->_group_id !== null) {
         TBGUserScopesTable::getTable()->updateUserScopeGroup($this->getID(), TBGContext::getScope()->getID(), $this->_group_id);
     }
 }
開發者ID:oparoz,項目名稱:thebuggenie,代碼行數:29,代碼來源:TBGUser.class.php


注:本文中的TBGSettings::getDefaultScopeID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。