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


PHP CRM_Core_BAO_Domain::setDomain方法代碼示例

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


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

示例1: updateSettingsFromMetaData

 /**
  * Look for any missing settings and convert them from config or load default as appropriate.
  * This should be run from GenCode & also from upgrades to add any new defaults.
  *
  * Multisites have often been overlooked in upgrade scripts so can be expected to be missing
  * a number of settings
  */
 public static function updateSettingsFromMetaData()
 {
     $apiParams = array('version' => 3, 'domain_id' => 'all', 'filters' => array('prefetch' => 0));
     $existing = civicrm_api('setting', 'get', $apiParams);
     if (!empty($existing['values'])) {
         $allSettings = civicrm_api('setting', 'getfields', array('version' => 3));
         foreach ($existing['values'] as $domainID => $domainSettings) {
             CRM_Core_BAO_Domain::setDomain($domainID);
             $missing = array_diff_key($allSettings['values'], $domainSettings);
             foreach ($missing as $name => $settings) {
                 self::convertConfigToSetting($name, $domainID);
             }
             CRM_Core_BAO_Domain::resetDomain();
         }
     }
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:23,代碼來源:Setting.php

示例2: getItems

 /**
  * Store multiple items in the setting table.
  *
  * @param array $params
  *   (required) An api formatted array of keys and values.
  * @param array $domains Array of domains to get settings for. Default is the current domain
  * @param $settingsToReturn
  *
  * @return array
  */
 public static function getItems(&$params, $domains = NULL, $settingsToReturn)
 {
     $originalDomain = CRM_Core_Config::domainID();
     if (empty($domains)) {
         $domains[] = $originalDomain;
     }
     if (!empty($settingsToReturn) && !is_array($settingsToReturn)) {
         $settingsToReturn = array($settingsToReturn);
     }
     $reloadConfig = FALSE;
     $fields = $result = array();
     $fieldsToGet = self::validateSettingsInput(array_flip($settingsToReturn), $fields, FALSE);
     foreach ($domains as $domainID) {
         if ($domainID != CRM_Core_Config::domainID()) {
             $reloadConfig = TRUE;
             CRM_Core_BAO_Domain::setDomain($domainID);
         }
         $config = CRM_Core_Config::singleton($reloadConfig, $reloadConfig);
         $result[$domainID] = array();
         foreach ($fieldsToGet as $name => $value) {
             $contactID = CRM_Utils_Array::value('contact_id', $params);
             $setting = CRM_Core_BAO_Setting::getItem(NULL, $name, NULL, NULL, $contactID, $domainID);
             if (!is_null($setting)) {
                 // we won't return if not set - helps in return all scenario - otherwise we can't indentify the missing ones
                 // e.g for revert of fill actions
                 $result[$domainID][$name] = $setting;
             }
         }
         CRM_Core_BAO_Domain::resetDomain();
     }
     return $result;
 }
開發者ID:saurabhbatra96,項目名稱:civicrm-core,代碼行數:42,代碼來源:Setting.php

示例3: testSetConfigSetting

 /**
  * Setting api should set & fetch settings stored in config as well as those in settings table
  */
 public function testSetConfigSetting()
 {
     $config = CRM_Core_Config::singleton();
     $this->assertFalse($config->debug == 1);
     $params = array('domain_id' => $this->_domainID2, 'debug_enabled' => 1);
     $result = $this->callAPISuccess('setting', 'create', $params);
     CRM_Core_BAO_Domain::setDomain($this->_domainID2);
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     CRM_Core_BAO_Domain::resetDomain();
     $this->assertTrue($config->debug == 1);
     // this should NOT be stored in the settings table now - only in config
     $sql = " SELECT count(*) as c FROM civicrm_setting WHERE name LIKE '%maxFileSize%'";
     $dao = CRM_Core_DAO::executeQuery($sql);
     $dao->fetch();
     $this->assertEquals($dao->c, 0);
 }
開發者ID:nganivet,項目名稱:civicrm-core,代碼行數:19,代碼來源:SettingTest.php

示例4: testSetConfigSetting

 /**
  * Setting api should set & fetch settings stored in config as well as those in settings table
  */
 public function testSetConfigSetting()
 {
     $config = CRM_Core_Config::singleton();
     $this->assertFalse($config->debug == 1);
     $params = array('domain_id' => $this->_domainID2, 'debug_enabled' => 1);
     $result = $this->callAPISuccess('setting', 'create', $params);
     $this->assertEquals(1, Civi::settings($this->_domainID2)->get('debug_enabled'));
     CRM_Core_BAO_Domain::setDomain($this->_domainID2);
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
     CRM_Core_BAO_Domain::resetDomain();
     $this->assertEquals(1, $config->debug);
 }
開發者ID:sdekok,項目名稱:civicrm-core,代碼行數:15,代碼來源:SettingTest.php


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