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


PHP CRM_Core_BAO_ConfigSetting::create方法代码示例

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


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

示例1: 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();
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:28,代码来源:hrprofile.php

示例2: setItems

 /**
  * Store multiple items in the setting table. Note that this will also store config keys
  * the storage is determined by the metdata and is affected by
  *  'name' setting's name
  *  'prefetch' = store in config
  *  'config_only' = don't store in settings
  *  'config_key' = the config key is different to the settings key - e.g. debug where there was a conflict
  *  'legacy_key' = rename from config or setting with this name
  *
  * _setItem() is the common logic shared by setItem() and setItems().
  *
  * @param array $params
  *   (required) An api formatted array of keys and values.
  * @param null $domains
  *
  * @throws api_Exception
  * @domains array an array of domains to get settings for. Default is the current domain
  * @return array
  */
 public static function setItems(&$params, $domains = NULL)
 {
     $originalDomain = CRM_Core_Config::domainID();
     if (empty($domains)) {
         $domains[] = $originalDomain;
     }
     $reloadConfig = FALSE;
     $fields = $config_keys = array();
     $fieldsToSet = self::validateSettingsInput($params, $fields);
     foreach ($fieldsToSet as $settingField => &$settingValue) {
         self::validateSetting($settingValue, $fields['values'][$settingField]);
     }
     foreach ($domains as $domainID) {
         if ($domainID != CRM_Core_Config::domainID()) {
             $reloadConfig = TRUE;
             CRM_Core_BAO_Domain::setDomain($domainID);
         }
         $result[$domainID] = array();
         foreach ($fieldsToSet as $name => $value) {
             if (empty($fields['values'][$name]['config_only'])) {
                 CRM_Core_BAO_Setting::_setItem($fields['values'][$name], $value, $fields['values'][$name]['group_name'], $name, CRM_Utils_Array::value('component_id', $params), CRM_Utils_Array::value('contact_id', $params), CRM_Utils_Array::value('created_id', $params), $domainID);
             }
             if (!empty($fields['values'][$name]['prefetch'])) {
                 if (!empty($fields['values'][$name]['config_key'])) {
                     $name = $fields['values'][$name]['config_key'];
                 }
                 $config_keys[$name] = $value;
             }
             $result[$domainID][$name] = $value;
         }
         if ($reloadConfig) {
             CRM_Core_Config::singleton($reloadConfig, $reloadConfig);
         }
         if (!empty($config_keys)) {
             CRM_Core_BAO_ConfigSetting::create($config_keys);
         }
         if ($reloadConfig) {
             CRM_Core_BAO_Domain::resetDomain();
         }
     }
     return $result;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:61,代码来源:Setting.php

示例3: commonProcess

 /**
  * Common Process.
  *
  * @todo Document what I do.
  *
  * @param array $params
  */
 public function commonProcess(&$params)
 {
     // save autocomplete search options
     if (!empty($params['autocompleteContactSearch'])) {
         $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactSearch'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
         unset($params['autocompleteContactSearch']);
     }
     // save autocomplete contact reference options
     if (!empty($params['autocompleteContactReference'])) {
         $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactReference'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
         unset($params['autocompleteContactReference']);
     }
     // save components to be enabled
     if (array_key_exists('enableComponents', $params)) {
         civicrm_api3('setting', 'create', array('enable_components' => $params['enableComponents']));
         unset($params['enableComponents']);
     }
     // save checksum timeout
     if (!empty($params['checksumTimeout'])) {
         CRM_Core_BAO_Setting::setItem($params['checksumTimeout'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'checksum_timeout');
     }
     // update time for date formats when global time is changed
     if (!empty($params['timeInputFormat'])) {
         $query = "\nUPDATE civicrm_preferences_date\nSET    time_format = %1\nWHERE  time_format IS NOT NULL\nAND    time_format <> ''\n";
         $sqlParams = array(1 => array($params['timeInputFormat'], 'String'));
         CRM_Core_DAO::executeQuery($query, $sqlParams);
     }
     // verify ssl peer option
     if (isset($params['verifySSL'])) {
         CRM_Core_BAO_Setting::setItem($params['verifySSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
         unset($params['verifySSL']);
     }
     // force secure URLs
     if (isset($params['enableSSL'])) {
         CRM_Core_BAO_Setting::setItem($params['enableSSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL');
         unset($params['enableSSL']);
     }
     $settings = array_intersect_key($params, $this->_settings);
     $result = civicrm_api('setting', 'create', $settings + array('version' => 3));
     foreach ($settings as $setting => $settingGroup) {
         //@todo array_diff this
         unset($params[$setting]);
     }
     CRM_Core_BAO_ConfigSetting::create($params);
     CRM_Core_Config::clearDBCache();
     CRM_Utils_System::flushCache();
     CRM_Core_Resources::singleton()->resetCacheCode();
     CRM_Core_Session::setStatus(" ", ts('Changes Saved'), "success");
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:58,代码来源:Setting.php

示例4: commonProcess

 /**
  * Common Process.
  *
  * @todo Document what I do.
  *
  * @param array $params
  */
 public function commonProcess(&$params)
 {
     // save autocomplete search options
     if (!empty($params['autocompleteContactSearch'])) {
         $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactSearch'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
         unset($params['autocompleteContactSearch']);
     }
     // save autocomplete contact reference options
     if (!empty($params['autocompleteContactReference'])) {
         $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactReference'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
         unset($params['autocompleteContactReference']);
     }
     // save components to be enabled
     if (array_key_exists('enableComponents', $params)) {
         civicrm_api3('setting', 'create', array('enable_components' => $params['enableComponents']));
         unset($params['enableComponents']);
     }
     // save checksum timeout
     if (!empty($params['checksumTimeout'])) {
         CRM_Core_BAO_Setting::setItem($params['checksumTimeout'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'checksum_timeout');
     }
     // verify ssl peer option
     if (isset($params['verifySSL'])) {
         CRM_Core_BAO_Setting::setItem($params['verifySSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
         unset($params['verifySSL']);
     }
     // force secure URLs
     if (isset($params['enableSSL'])) {
         CRM_Core_BAO_Setting::setItem($params['enableSSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL');
         unset($params['enableSSL']);
     }
     $settings = array_intersect_key($params, $this->_settings);
     $result = civicrm_api('setting', 'create', $settings + array('version' => 3));
     foreach ($settings as $setting => $settingGroup) {
         //@todo array_diff this
         unset($params[$setting]);
     }
     if (!empty($result['error_message'])) {
         CRM_Core_Session::setStatus($result['error_message'], ts('Save Failed'), 'error');
     }
     CRM_Core_BAO_ConfigSetting::create($params);
     CRM_Core_Config::clearDBCache();
     CRM_Utils_System::flushCache();
     CRM_Core_Resources::singleton()->resetCacheCode();
     CRM_Core_Session::setStatus(" ", ts('Changes Saved'), "success");
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:55,代码来源:Setting.php

示例5: setSettings

 /**
  * @param array $params
  *   - mailerBatchLimit
  *   - mailerJobSize
  *   - mailerJobsMax
  *   - mailThrottleTime
  */
 protected function setSettings($params)
 {
     // FIXME: These settings are not available via Setting API.
     // When they become available, use that instead.
     CRM_Core_BAO_ConfigSetting::create($params);
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:13,代码来源:JobProcessMailingTest.php

示例6: postProcess

 /**
 * Function to process the form
 *
 * @access public
 * @return None
 */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $config = CRM_Core_Config::singleton();
     $configParams = array();
     require_once 'CRM/Event/PseudoConstant.php';
     $event_type = CRM_Event_PseudoConstant::eventType();
     $colorevents = $event_type;
     foreach ($event_type as $k => $v) {
         $v = str_replace(" ", "_", $v);
         $evnt_color = 'eventcolor_' . $k;
         $eventname = 'eventtype_' . $k;
         if (!empty($params[$evnt_color]) && !empty($params[$eventname])) {
             $configParams[$v] = $params[$evnt_color];
             $configParams[$eventname] = $params[$eventname];
         } else {
             $configParams[$v] = '3366CC';
             $configParams[$eventname] = 0;
         }
         $event_type[$k] = $v;
     }
     foreach ($event_type as $k => $v) {
         $evnt_key = 'eventtype_' . $k;
         if (!array_key_exists($evnt_key, $params)) {
             unset($event_type[$k]);
         }
     }
     $configParams['civicrm_events_event_types'] = $event_type;
     if (isset($params['event_calendar_title'])) {
         $configParams['civicrm_event_calendar_title'] = $params['event_calendar_title'];
     } else {
         $configParams['civicrm_event_calendar_title'] = 'Event Calendar';
     }
     if (isset($params['show_past_event']) && $params['show_past_event'] == 1) {
         $configParams['civicrm_events_event_past'] = $params['show_past_event'];
     } else {
         $configParams['civicrm_events_event_past'] = 0;
     }
     if (isset($params['show_end_date']) && $params['show_end_date'] == 1) {
         $configParams['civicrm_events_event_end_date'] = $params['show_end_date'];
     } else {
         $configParams['civicrm_events_event_end_date'] = 0;
     }
     if (isset($params['event_is_public']) && $params['event_is_public'] == 1) {
         $configParams['civicrm_events_event_is_public'] = $params['event_is_public'];
     } else {
         $configParams['civicrm_events_event_is_public'] = 0;
     }
     if (isset($params['events_event_month']) && $params['events_event_month'] == 1) {
         $configParams['civicrm_events_event_months'] = $params['show_event_from_month'];
     } else {
         $configParams['civicrm_events_event_months'] = 0;
     }
     if (isset($params['show_event_from_month'])) {
         $configParams['show_event_from_month'] = $params['show_event_from_month'];
     } else {
         $configParams['show_event_from_month'] = '';
     }
     CRM_Core_BAO_ConfigSetting::create($configParams);
     CRM_Core_Session::setStatus(" ", ts('The value has been saved.'), "success");
 }
开发者ID:teamsinger,项目名称:com.osseed.eventcalendar,代码行数:67,代码来源:EventSettings.php

示例7: postProcess

 public function postProcess()
 {
     // store the submitted values in an array
     $config = CRM_Core_Config::singleton();
     $params = $this->controller->exportValues($this->_name);
     // update upload max size in DB
     $params['maxImportFileSize'] = CRM_Core_Config_Defaults::formatUnitSize(ini_get('upload_max_filesize'));
     CRM_Core_BAO_ConfigSetting::create($params);
     // get current logging status
     $values = $this->exportValues();
     parent::postProcess();
     if ($config->logging != $values['logging']) {
         $logging = new CRM_Logging_Schema();
         if ($values['logging']) {
             $logging->enableLogging();
         } else {
             $logging->disableLogging();
         }
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:20,代码来源:Miscellaneous.php

示例8: commonProcess

 /**
  * @param $params
  */
 public function commonProcess(&$params)
 {
     // save autocomplete search options
     if (!empty($params['autocompleteContactSearch'])) {
         $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactSearch'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
         unset($params['autocompleteContactSearch']);
     }
     // save autocomplete contact reference options
     if (!empty($params['autocompleteContactReference'])) {
         $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactReference'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
         unset($params['autocompleteContactReference']);
     }
     // save components to be enabled
     if (array_key_exists('enableComponents', $params)) {
         CRM_Core_BAO_Setting::setItem($params['enableComponents'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components');
         // unset params by emptying the values, so while retrieving we can detect and load from settings table
         // instead of config-backend for backward compatibility. We could use unset() in later releases.
         $params['enableComponents'] = $params['enableComponentIDs'] = array();
     }
     // save checksum timeout
     if (!empty($params['checksumTimeout'])) {
         CRM_Core_BAO_Setting::setItem($params['checksumTimeout'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'checksum_timeout');
     }
     // update time for date formats when global time is changed
     if (!empty($params['timeInputFormat'])) {
         $query = "\nUPDATE civicrm_preferences_date\nSET    time_format = %1\nWHERE  time_format IS NOT NULL\nAND    time_format <> ''\n";
         $sqlParams = array(1 => array($params['timeInputFormat'], 'String'));
         CRM_Core_DAO::executeQuery($query, $sqlParams);
     }
     // verify ssl peer option
     if (isset($params['verifySSL'])) {
         CRM_Core_BAO_Setting::setItem($params['verifySSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL');
         unset($params['verifySSL']);
     }
     // force secure URLs
     if (isset($params['enableSSL'])) {
         CRM_Core_BAO_Setting::setItem($params['enableSSL'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL');
         unset($params['enableSSL']);
     }
     $settings = array_intersect_key($params, $this->_settings);
     $result = civicrm_api('setting', 'create', $settings + array('version' => 3));
     foreach ($settings as $setting => $settingGroup) {
         //@todo array_diff this
         unset($params[$setting]);
     }
     CRM_Core_BAO_ConfigSetting::create($params);
     CRM_Core_Session::setStatus(" ", ts('Changes Saved.'), "success");
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:53,代码来源:Setting.php

示例9: 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);
        }
    }
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:23,代码来源:hrstaffdir.php


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