本文整理汇总了PHP中thebuggenie\core\framework\Settings::getDefaultScopeID方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::getDefaultScopeID方法的具体用法?PHP Settings::getDefaultScopeID怎么用?PHP Settings::getDefaultScopeID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Settings
的用法示例。
在下文中一共展示了Settings::getDefaultScopeID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFixtures
public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
{
$scope_id = $scope->getID();
$admin_group = new \thebuggenie\core\entities\Group();
$admin_group->setName('Administrators');
$admin_group->setScope($scope);
$admin_group->save();
\thebuggenie\core\framework\Settings::saveSetting('admingroup', $admin_group->getID(), 'core', $scope_id);
$user_group = new \thebuggenie\core\entities\Group();
$user_group->setName('Regular users');
$user_group->setScope($scope);
$user_group->save();
\thebuggenie\core\framework\Settings::saveSetting('defaultgroup', $user_group->getID(), 'core', $scope_id);
$guest_group = new \thebuggenie\core\entities\Group();
$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) = \thebuggenie\core\entities\User::loadFixtures($scope, $admin_group, $user_group, $guest_group);
tables\UserScopes::getTable()->addUserToScope($guestuser_id, $scope->getID(), $guest_group->getID(), true);
tables\UserScopes::getTable()->addUserToScope($adminuser_id, $scope->getID(), $admin_group->getID(), true);
} else {
$default_scope_id = \thebuggenie\core\framework\Settings::getDefaultScopeID();
$default_user_id = (int) \thebuggenie\core\framework\Settings::get(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_ID, 'core', $default_scope_id);
tables\UserScopes::getTable()->addUserToScope($default_user_id, $scope->getID(), $user_group->getID(), true);
tables\UserScopes::getTable()->addUserToScope(1, $scope->getID(), $admin_group->getID());
\thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_ID, $default_user_id, 'core', $scope->getID());
}
tables\Permissions::getTable()->loadFixtures($scope, $admin_group->getID(), $guest_group->getID());
}
示例2: clearUserScopes
public function clearUserScopes($user_id)
{
$crit = $this->getCriteria();
$crit->addWhere(self::SCOPE, \thebuggenie\core\framework\Settings::getDefaultScopeID(), Criteria::DB_NOT_EQUALS);
$crit->addWhere(self::USER_ID, $user_id);
$this->doDelete($crit);
}
示例3: _loadFixtures
protected function _loadFixtures($scope)
{
if ($scope == framework\Settings::getDefaultScopeID()) {
Commits::getTable()->createIndexes();
Files::getTable()->createIndexes();
IssueLinks::getTable()->createIndexes();
}
}
示例4: _install
protected function _install($scope)
{
if ($scope == framework\Settings::getDefaultScopeID()) {
$mobile_css_path = THEBUGGENIE_PATH . THEBUGGENIE_PUBLIC_FOLDER_NAME . DS . 'css' . DS . 'mobile.css';
if (!is_writable(pathinfo($mobile_css_path, PATHINFO_DIRNAME))) {
throw new framework\exceptions\ConfigurationException("Cannot save the file {$mobile_css_path}", framework\exceptions\ConfigurationException::PERMISSION_DENIED);
}
if (file_exists($mobile_css_path)) {
unlink($mobile_css_path);
}
symlink(THEBUGGENIE_MODULES_PATH . 'mobile' . DS . 'css' . DS . 'mobile.css', $mobile_css_path);
}
}
示例5: _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
$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);
}
}
示例6: runUpdateUserScopes
public function runUpdateUserScopes(framework\Request $request)
{
try {
if (!framework\Context::getScope()->isDefault()) {
throw new \Exception('This operation is not allowed');
}
$user = entities\User::getB2DBTable()->selectByID($request['user_id']);
if ($user instanceof entities\User) {
$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(framework\Settings::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 entities\Scope((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')));
}
示例7: _install
protected function _install($scope)
{
if ($scope == framework\Settings::getDefaultScopeID()) {
}
}
示例8: install
public final function install($scope)
{
try {
framework\Context::clearRoutingCache();
framework\Context::clearPermissionsCache();
$this->_install($scope);
$b2db_classpath = THEBUGGENIE_MODULES_PATH . $this->_name . DS . 'entities' . DS . 'tables';
if ($scope == framework\Settings::getDefaultScopeID() && is_dir($b2db_classpath)) {
$b2db_classpath_handle = opendir($b2db_classpath);
while ($table_class_file = readdir($b2db_classpath_handle)) {
if (($tablename = mb_substr($table_class_file, 0, mb_strpos($table_class_file, '.'))) != '') {
\b2db\Core::getTable("\\thebuggenie\\modules\\" . $this->_name . "\\entities\\tables\\" . $tablename)->create();
}
}
}
$this->_loadFixtures($scope);
} catch (\Exception $e) {
throw $e;
}
}