本文整理汇总了PHP中CRM_Core_BAO_ConfigSetting::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_ConfigSetting::retrieve方法的具体用法?PHP CRM_Core_BAO_ConfigSetting::retrieve怎么用?PHP CRM_Core_BAO_ConfigSetting::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_ConfigSetting
的用法示例。
在下文中一共展示了CRM_Core_BAO_ConfigSetting::retrieve方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
CRM_Core_BAO_ConfigSetting::retrieve($this->_defaults);
CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
$list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE, NULL, 'name'));
$cRlist = array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE, NULL, 'name'));
$listEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
$cRlistEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
$autoSearchFields = array();
if (!empty($list) && !empty($listEnabled)) {
$autoSearchFields = array_combine($list, $listEnabled);
}
$cRSearchFields = array();
if (!empty($cRlist) && !empty($cRlistEnabled)) {
$cRSearchFields = array_combine($cRlist, $cRlistEnabled);
}
//Set defaults for autocomplete and contact reference options
$this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
$this->_defaults['autocompleteContactReference'] = array('1' => 1) + $cRSearchFields;
$this->_defaults['enableSSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL', NULL, 0);
$this->_defaults['verifySSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL', NULL, 1);
$sql = "\nSELECT time_format\nFROM civicrm_preferences_date\nWHERE time_format IS NOT NULL\nAND time_format <> ''\nLIMIT 1\n";
$this->_defaults['timeInputFormat'] = CRM_Core_DAO::singleValueQuery($sql);
}
return $this->_defaults;
}
示例2: hrprofile_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function hrprofile_civicrm_install()
{
$groups = CRM_Core_PseudoConstant::get('CRM_Core_BAO_UFField', 'uf_group_id', array('labelColumn' => 'name'));
$profileId = array_search('hrstaffdir_listing', $groups);
$path = array('url' => "civicrm/profile?reset=1&gid={$profileId}&force=1");
$navigationPath = CRM_Core_BAO_Navigation::retrieve($path, $defaultpath);
if ($profileId && $navigationPath) {
$originalUrl = "civicrm/profile?reset=1&gid={$profileId}&force=1";
$updatedUrl = "civicrm/profile/table?reset=1&gid={$profileId}&force=1";
hrprofile_updateNavigation($originalUrl, $updatedUrl);
} elseif ($profileId && !$navigationPath) {
// add to navigation
$navigationParams = array('label' => 'Directory', 'url' => "civicrm/profile/table?reset=1&gid={$profileId}&force=1", 'is_active' => 1);
$navigation = CRM_Core_BAO_Navigation::add($navigationParams);
CRM_Core_BAO_Navigation::resetNavigation();
// set the profile as search view
$params = array();
CRM_Core_BAO_ConfigSetting::retrieve($params);
if (!empty($params)) {
$params['defaultSearchProfileID'] = $profileId;
CRM_Core_BAO_ConfigSetting::create($params);
}
}
return _hrprofile_civix_civicrm_install();
}
示例3: setDefaultValues
/**
* Set default values for the form.
*
* Default values are retrieved from the database.
*/
public function setDefaultValues()
{
if (!$this->_defaults) {
$this->_defaults = array();
$formArray = array('Component', 'Localization');
$formMode = FALSE;
if (in_array($this->_name, $formArray)) {
$formMode = TRUE;
}
CRM_Core_BAO_ConfigSetting::retrieve($this->_defaults);
// we can handle all the ones defined in the metadata here. Others to be converted
foreach ($this->_settings as $setting => $group) {
$this->_defaults[$setting] = civicrm_api('setting', 'getvalue', array('version' => 3, 'name' => $setting, 'group' => $group));
}
$this->_defaults['contact_autocomplete_options'] = self::getAutocompleteContactSearch();
$this->_defaults['contact_reference_options'] = self::getAutocompleteContactReference();
$this->_defaults['enableSSL'] = Civi::settings()->get('enableSSL');
$this->_defaults['verifySSL'] = Civi::settings()->get('verifySSL');
$this->_defaults['enableComponents'] = Civi::settings()->get('enable_components');
}
return $this->_defaults;
}
示例4: setDefaultValues
/**
* Set default values for the form.
*
* Default values are retrieved from the database.
*/
public function setDefaultValues()
{
if (!$this->_defaults) {
$this->_defaults = array();
$formArray = array('Component', 'Localization');
$formMode = FALSE;
if (in_array($this->_name, $formArray)) {
$formMode = TRUE;
}
CRM_Core_BAO_ConfigSetting::retrieve($this->_defaults);
CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
$list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE, NULL, 'name'));
$cRlist = array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE, NULL, 'name'));
$listEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
$cRlistEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
$autoSearchFields = array();
if (!empty($list) && !empty($listEnabled)) {
$autoSearchFields = array_combine($list, $listEnabled);
}
$cRSearchFields = array();
if (!empty($cRlist) && !empty($cRlistEnabled)) {
$cRSearchFields = array_combine($cRlist, $cRlistEnabled);
}
//Set defaults for autocomplete and contact reference options
$this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
$this->_defaults['autocompleteContactReference'] = array('1' => 1) + $cRSearchFields;
// we can handle all the ones defined in the metadata here. Others to be converted
foreach ($this->_settings as $setting => $group) {
$settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting));
$this->_defaults[$setting] = civicrm_api('setting', 'getvalue', array('version' => 3, 'name' => $setting, 'group' => $group, 'default_value' => CRM_Utils_Array::value('default', $settingMetaData['values'][$setting])));
}
$this->_defaults['enableSSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL', NULL, 0);
$this->_defaults['verifySSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL', NULL, 1);
}
return $this->_defaults;
}
示例5: _initVariables
/**
* Initialize the config variables.
*
* @return void
*/
private function _initVariables()
{
// retrieve serialised settings
$variables = array();
CRM_Core_BAO_ConfigSetting::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)
CRM_Core_Config_Defaults::setValues($variables);
// retrieve directory and url preferences also
CRM_Core_BAO_Setting::retrieveDirectoryAndURLPreferences($variables);
// add component specific settings
$this->componentRegistry->addConfig($this);
// serialise settings
$settings = $variables;
CRM_Core_BAO_ConfigSetting::add($settings);
}
$urlArray = array('userFrameworkResourceURL', 'imageUploadURL');
$dirArray = array('uploadDir', 'customFileUploadDir');
foreach ($variables as $key => $value) {
if (in_array($key, $urlArray)) {
$value = CRM_Utils_File::addTrailingSlash($value, '/');
} elseif (in_array($key, $dirArray)) {
if ($value) {
$value = CRM_Utils_File::addTrailingSlash($value);
}
if (empty($value) || 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)), ts('Check Settings'), 'alert');
}
} elseif ($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);
CRM_Utils_File::restrictAccess($this->templateCompileDir);
}
}
$this->{$key} = $value;
}
if ($this->userFrameworkResourceURL) {
// we need to do this here so all blocks also load from an ssl server
if (CRM_Utils_System::isSSL()) {
CRM_Utils_System::mapConfigToSSL();
}
$rrb = parse_url($this->userFrameworkResourceURL);
// don't use absolute path if resources are stored on a different server
// CRM-4642
$this->resourceBase = $this->userFrameworkResourceURL;
if (isset($_SERVER['HTTP_HOST']) && isset($rrb['host'])) {
$this->resourceBase = $rrb['host'] == $_SERVER['HTTP_HOST'] ? $rrb['path'] : $this->userFrameworkResourceURL;
}
}
if (!$this->customFileUploadDir) {
$this->customFileUploadDir = $this->uploadDir;
}
if ($this->geoProvider) {
$this->geocodeMethod = 'CRM_Utils_Geocode_' . $this->geoProvider;
} elseif ($this->mapProvider) {
$this->geocodeMethod = 'CRM_Utils_Geocode_' . $this->mapProvider;
}
require_once str_replace('_', DIRECTORY_SEPARATOR, $this->userFrameworkClass) . '.php';
$class = $this->userFrameworkClass;
// redundant with _setUserFrameworkConfig
$this->userSystem = new $class();
}
示例6: hrstaffdir_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function hrstaffdir_civicrm_install()
{
_hrstaffdir_civix_civicrm_install();
$profileId = hrstaffdir_getUFGroupID();
$path = array('url' => "civicrm/profile/table?reset=1?gid={$profileId}&force=1");
$navigationPath = CRM_Core_BAO_Navigation::retrieve($path, $defaultpath);
if ($profileId && !$navigationPath) {
// add to navigation
$navigationParams = array('label' => 'Directory', 'url' => "civicrm/profile?reset=1&gid={$profileId}&force=1", 'is_active' => 1);
$navigation = CRM_Core_BAO_Navigation::add($navigationParams);
CRM_Core_BAO_Navigation::resetNavigation();
// set the profile as search view
$params = array();
CRM_Core_BAO_ConfigSetting::retrieve($params);
if (!empty($params)) {
$params['defaultSearchProfileID'] = $profileId;
CRM_Core_BAO_ConfigSetting::create($params);
}
}
}