当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_Setting::retrieve方法代码示例

本文整理汇总了PHP中CRM_Core_BAO_Setting::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Setting::retrieve方法的具体用法?PHP CRM_Core_BAO_Setting::retrieve怎么用?PHP CRM_Core_BAO_Setting::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_BAO_Setting的用法示例。


在下文中一共展示了CRM_Core_BAO_Setting::retrieve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setDefaultValues

 /**
  * This function sets the default values for the form.
  * default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     if (!$this->_defaults) {
         $this->_defaults = array();
         $formArray = array('Component', 'Localization');
         $formMode = false;
         if (in_array($this->_name, $formArray)) {
             $formMode = true;
         }
         require_once "CRM/Core/BAO/Setting.php";
         CRM_Core_BAO_Setting::retrieve($this->_defaults);
         require_once "CRM/Core/Config/Defaults.php";
         CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
         require_once "CRM/Core/OptionGroup.php";
         $list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', false, false, true, null, 'name'));
         require_once "CRM/Core/BAO/Preferences.php";
         $listEnabled = CRM_Core_BAO_Preferences::valueOptions('contact_autocomplete_options');
         $autoSearchFields = array();
         if (!empty($list) && !empty($listEnabled)) {
             $autoSearchFields = array_combine($list, $listEnabled);
         }
         //Set sort_name for default
         $this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
     }
     return $this->_defaults;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:33,代码来源:Setting.php

示例2: _initVariables

 /**
  * initialize the config variables
  *
  * @return void
  * @access private
  */
 private function _initVariables()
 {
     // initialize component registry early to avoid "race"
     // between CRM_Core_Config and CRM_Core_Component (they
     // are co-dependant)
     require_once 'CRM/Core/Component.php';
     $this->componentRegistry = new CRM_Core_Component();
     // retrieve serialised settings
     require_once "CRM/Core/BAO/Setting.php";
     $variables = array();
     CRM_Core_BAO_Setting::retrieve($variables);
     // if settings are not available, go down the full path
     if (empty($variables)) {
         // Step 1. get system variables with their hardcoded defaults
         $variables = get_object_vars($this);
         // Step 2. get default values (with settings file overrides if
         // available - handled in CRM_Core_Config_Defaults)
         require_once 'CRM/Core/Config/Defaults.php';
         CRM_Core_Config_Defaults::setValues($variables);
         // add component specific settings
         $this->componentRegistry->addConfig($this);
         // serialise settings
         CRM_Core_BAO_Setting::add($variables);
     }
     $urlArray = array('userFrameworkResourceURL', 'imageUploadURL');
     $dirArray = array('uploadDir', 'customFileUploadDir');
     foreach ($variables as $key => $value) {
         if (in_array($key, $urlArray)) {
             $value = CRM_Utils_File::addTrailingSlash($value, '/');
         } else {
             if (in_array($key, $dirArray)) {
                 $value = CRM_Utils_File::addTrailingSlash($value);
                 if (CRM_Utils_File::createDir($value, false) === false) {
                     // seems like we could not create the directories
                     // settings might have changed, lets suppress a message for now
                     // so we can make some more progress and let the user fix their settings
                     // for now we assign it to a know value
                     // CRM-4949
                     $value = $this->templateCompileDir;
                 }
             } else {
                 if ($key == 'lcMessages') {
                     // reset the templateCompileDir to locale-specific and make sure it exists
                     $this->templateCompileDir .= CRM_Utils_File::addTrailingSlash($value);
                     CRM_Utils_File::createDir($this->templateCompileDir);
                 }
             }
         }
         $this->{$key} = $value;
     }
     if ($this->userFrameworkResourceURL) {
         // we need to do this here so all blocks also load from an ssl server
         if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') {
             CRM_Utils_System::mapConfigToSSL();
         }
         $rrb = parse_url($this->userFrameworkResourceURL);
         // dont use absolute path if resources are stored on a different server
         // CRM-4642
         $this->resourceBase = $this->userFrameworkResourceURL;
         if (isset($_SERVER['HTTP_HOST'])) {
             $this->resourceBase = $rrb['host'] == $_SERVER['HTTP_HOST'] ? $rrb['path'] : $this->userFrameworkResourceURL;
         }
     }
     if (!$this->customFileUploadDir) {
         $this->customFileUploadDir = $this->uploadDir;
     }
     if ($this->mapProvider) {
         $this->geocodeMethod = 'CRM_Utils_Geocode_' . $this->mapProvider;
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:76,代码来源:Config.php

示例3: _initVariables

 /**
  * initialize the config variables
  *
  * @return void
  * @access private
  */
 private function _initVariables()
 {
     // retrieve serialised settings
     require_once "CRM/Core/BAO/Setting.php";
     $variables = array();
     CRM_Core_BAO_Setting::retrieve($variables);
     // if settings are not available, go down the full path
     if (empty($variables)) {
         // Step 1. get system variables with their hardcoded defaults
         $variables = get_object_vars($this);
         // Step 2. get default values (with settings file overrides if
         // available - handled in CRM_Core_Config_Defaults)
         require_once 'CRM/Core/Config/Defaults.php';
         CRM_Core_Config_Defaults::setValues($variables);
         // retrieve directory and url preferences also
         require_once 'CRM/Core/BAO/Preferences.php';
         CRM_Core_BAO_Preferences::retrieveDirectoryAndURLPreferences($defaults);
         // add component specific settings
         $this->componentRegistry->addConfig($this);
         // serialise settings
         CRM_Core_BAO_Setting::add($variables);
     }
     $urlArray = array('userFrameworkResourceURL', 'imageUploadURL');
     $dirArray = array('uploadDir', 'customFileUploadDir');
     foreach ($variables as $key => $value) {
         if (in_array($key, $urlArray)) {
             $value = CRM_Utils_File::addTrailingSlash($value, '/');
         } else {
             if (in_array($key, $dirArray)) {
                 $value = CRM_Utils_File::addTrailingSlash($value);
                 if (CRM_Utils_File::createDir($value, false) === false) {
                     // seems like we could not create the directories
                     // settings might have changed, lets suppress a message for now
                     // so we can make some more progress and let the user fix their settings
                     // for now we assign it to a know value
                     // CRM-4949
                     $value = $this->templateCompileDir;
                     $url = CRM_Utils_System::url('civicrm/admin/setting/path', 'reset=1');
                     CRM_Core_Session::setStatus(ts('%1 has an incorrect directory path. Please go to the <a href="%2">path setting page</a> and correct it.', array(1 => $key, 2 => $url)) . '<br/>');
                 }
             } else {
                 if ($key == 'lcMessages') {
                     // reset the templateCompileDir to locale-specific and make sure it exists
                     if (substr($this->templateCompileDir, -1 * strlen($value) - 1, -1) != $value) {
                         $this->templateCompileDir .= CRM_Utils_File::addTrailingSlash($value);
                         CRM_Utils_File::createDir($this->templateCompileDir);
                     }
                 }
             }
         }
         $this->{$key} = $value;
     }
     if ($this->userFrameworkResourceURL) {
         // we need to do this here so all blocks also load from an ssl server
         if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') {
             CRM_Utils_System::mapConfigToSSL();
         }
         $rrb = parse_url($this->userFrameworkResourceURL);
         // dont use absolute path if resources are stored on a different server
         // CRM-4642
         $this->resourceBase = $this->userFrameworkResourceURL;
         if (isset($_SERVER['HTTP_HOST'])) {
             $this->resourceBase = $rrb['host'] == $_SERVER['HTTP_HOST'] ? $rrb['path'] : $this->userFrameworkResourceURL;
         }
     }
     if (!$this->customFileUploadDir) {
         $this->customFileUploadDir = $this->uploadDir;
     }
     if ($this->mapProvider) {
         $this->geocodeMethod = 'CRM_Utils_Geocode_' . $this->mapProvider;
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:78,代码来源:Config.php


注:本文中的CRM_Core_BAO_Setting::retrieve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。