本文整理汇总了PHP中CRM_Core_BAO_Setting::setItem方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Setting::setItem方法的具体用法?PHP CRM_Core_BAO_Setting::setItem怎么用?PHP CRM_Core_BAO_Setting::setItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Setting
的用法示例。
在下文中一共展示了CRM_Core_BAO_Setting::setItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Form submission of new/edit api is processed.
*
* @access public
*
* @return None
*/
public function postProcess()
{
//get the submitted values in an array
$params = $this->controller->exportValues($this->_name);
// Save the API Key & Save the Security Key
if (CRM_Utils_Array::value('api_key', $params)) {
CRM_Core_BAO_Setting::setItem($params['api_key'], self::MC_SETTING_GROUP, 'api_key');
}
$session = CRM_Core_Session::singleton();
$message = "Api Key has been Saved!";
$session->setStatus($message, ts('Api Key Saved'), 'success');
$urlParams = null;
$session->replaceUserContext(CRM_Utils_System::url('civicrm/mailchimp/apikeyregister', $urlParams));
try {
$mcClient = new Mailchimp($params['api_key']);
$mcHelper = new Mailchimp_Helper($mcClient);
$details = $mcHelper->accountDetails();
} catch (Mailchimp_Invalid_ApiKey $e) {
CRM_Core_Session::setStatus($e->getMessage());
return FALSE;
} catch (Mailchimp_HttpError $e) {
CRM_Core_Session::setStatus($e->getMessage());
return FALSE;
}
$message = "Following is the account information received from API callback:<br/>\n <table class='mailchimp-table'>\n <tr><td>Company:</td><td>{$details['contact']['company']}</td></tr>\n <tr><td>First Name:</td><td>{$details['contact']['fname']}</td></tr>\n <tr><td>Last Name:</td><td>{$details['contact']['lname']}</td></tr>\n </table>";
CRM_Core_Session::setStatus($message);
}
示例2: run
function run()
{
// title
CRM_Utils_System::setTitle(ts('WindowSill'));
// config
// https://github.com/kreynen/civicrm-min/blob/master/CRM/Core/Extensions.php
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Drupal') {
$error = "<div class='messages status no-popup'><div class='icon inform-icon'></div>Not a Drupal installation</div>";
} else {
$error = "<div class='messages status no-popup'><div class='icon inform-icon'></div>Drupal installation</div>";
}
// error
$this->assign('error', $error);
// on form action update settings
if (isset($_REQUEST['settings'])) {
// set
CRM_Core_BAO_Setting::setItem($_REQUEST['settings'], 'windowsill', 'settings');
// notice
CRM_Core_Session::setStatus(ts('Windowsill settings changed'), ts('Saved'), 'success');
}
// url
$url = CRM_Utils_System::url() . "civicrm/ctrl/windowsill";
$this->assign('url', $url);
// render
parent::run();
}
示例3: overrides_civicrm_install
/**
* Implements hook_civicrm_install().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function overrides_civicrm_install()
{
CRM_Core_DAO::executeQuery("\n CREATE TABLE `klangsoft_overrides` (\n `snapshot` text NOT NULL\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
CRM_Core_DAO::executeQuery("INSERT INTO `klangsoft_overrides` VALUES ('a:0:{}');");
CRM_Core_BAO_Setting::setItem('', 'com.klangsoft_overrides', 'last_snapshot');
_overrides_civix_civicrm_install();
}
示例4: checkAllHouseholds
/**
* Identify all the households to check and do it
*
* If max_count is set, it will stop after that amount,
* saving the last household id for the next call
*/
public function checkAllHouseholds($max_count = NULL)
{
$max_count = (int) $max_count;
$activity_type_id = CRM_Householdmerge_Logic_Configuration::getCheckHouseholdActivityTypeID();
$activity_status_ids = CRM_Householdmerge_Logic_Configuration::getLiveActivityStatusIDs();
if ($max_count) {
$contact_id_minimum = CRM_Core_BAO_Setting::getItem(CRM_Householdmerge_Logic_Configuration::$HHMERGE_SETTING_DOMAIN, 'hh_check_last_id');
if (!$contact_id_minimum) {
$contact_id_minimum = 0;
}
$limit_clause = "LIMIT {$max_count}";
} else {
$contact_id_minimum = 0;
$limit_clause = '';
}
$last_contact_id_processed = 0;
$selector_sql = "SELECT civicrm_contact.id AS contact_id\n FROM civicrm_contact\n LEFT JOIN civicrm_activity_contact ON civicrm_activity_contact.contact_id = civicrm_contact.id\n LEFT JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_activity.id AND civicrm_activity.activity_type_id = {$activity_type_id} AND civicrm_activity.status_id IN ({$activity_status_ids})\n WHERE contact_type = 'Household'\n AND civicrm_activity.id IS NULL \n AND (civicrm_contact.is_deleted IS NULL or civicrm_contact.is_deleted = 0)\n AND civicrm_contact.id > {$contact_id_minimum}\n GROUP BY civicrm_contact.id\n ORDER BY civicrm_contact.id ASC\n {$limit_clause}";
$query = CRM_Core_DAO::executeQuery($selector_sql);
while ($query->fetch()) {
$last_contact_id_processed = $query->contact_id;
$this->checkHousehold($last_contact_id_processed);
$max_count--;
}
// done
if ($max_count > 0) {
// we're through the whole list, reset marker
CRM_Core_BAO_Setting::setItem('0', CRM_Householdmerge_Logic_Configuration::$HHMERGE_SETTING_DOMAIN, 'hh_check_last_id');
} else {
CRM_Core_BAO_Setting::setItem($last_contact_id_processed, CRM_Householdmerge_Logic_Configuration::$HHMERGE_SETTING_DOMAIN, 'hh_check_last_id');
}
return;
}
示例5: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
// Store the submitted values in an array.
$params = $this->controller->exportValues($this->_name);
if (CRM_Utils_Array::value('activity_type', $params)) {
CRM_Core_BAO_Setting::setItem($params['activity_type'], self::OUTLOOK_SETTING_GROUP, 'activity_type');
}
CRM_Core_Session::setStatus(ts('Changes saved!'), ts('Outlook Settings'), 'success');
}
示例6: windowsill_civicrm_disable
/**
* Implementation of hook_civicrm_disable
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable
*/
function windowsill_civicrm_disable()
{
// log
watchdog('be.ctrl.windowsill', 'disabled windowsill');
// assign
CRM_Core_BAO_Setting::setItem('', 'windowsill', 'settings');
// continue
_windowsill_civix_civicrm_disable();
}
示例7: postProcess
/**
* {@inheritdoc}
*/
public function postProcess()
{
$values = $this->exportValues();
$settings = new stdClass();
$settings->globally_enabled = empty($values['globally_enabled']) ? 0 : 1;
$settings->financial_types_enabled = $values['financial_types_enabled'];
CRM_Core_BAO_Setting::setItem($settings, 'Extension', 'uk.co.compucorp.civicrm.giftaid:settings');
CRM_Core_Session::setStatus(ts('Settings saved'), '', 'success');
parent::postProcess();
}
示例8: postProcess
function postProcess()
{
$values = $this->exportValues();
foreach (array('qfKey', '_qf_default', '_qf_IatsSettings_submit', 'entryURL') as $key) {
if (isset($values[$key])) {
unset($values[$key]);
}
}
CRM_Core_BAO_Setting::setItem($values, 'iATS Payments Extension', 'iats_settings');
parent::postProcess();
}
示例9: postProcess
function postProcess()
{
$values = $this->exportValues();
// process menu entry
$old_menu_position = (int) CRM_Core_BAO_Setting::getItem('CiviBanking', 'menu_position');
$new_menu_position = (int) $values['menu_position'];
if ($old_menu_position != $new_menu_position) {
CRM_Core_BAO_Setting::setItem($new_menu_position, 'CiviBanking', 'menu_position');
CRM_Core_Invoke::rebuildMenuAndCaches();
}
parent::postProcess();
}
示例10: postProcess
function postProcess()
{
$values = $this->exportValues();
CRM_Core_BAO_Setting::setItem($values['metrics_reporting_url'], "metrics", "metrics_reporting_url");
CRM_Core_BAO_Setting::setItem($values['metrics_site_name'], "metrics", "metrics_site_name");
CRM_Core_BAO_Setting::setItem($values['metrics_ca_path'], "metrics", "metrics_ca_path");
$peer = array_key_exists("metrics_ignore_verify_peer", $values) ? $values['metrics_ignore_verify_peer'] : 0;
CRM_Core_BAO_Setting::setItem($peer, "metrics", "metrics_ignore_verify_peer");
$host = array_key_exists("metrics_ignore_verify_host", $values) ? $values['metrics_ignore_verify_host'] : 0;
CRM_Core_BAO_Setting::setItem($host, "metrics", "metrics_ignore_verify_host");
CRM_Core_Session::setStatus(ts("Changed Saved"), "Saved", "success");
parent::postProcess();
}
示例11: postProcess
function postProcess()
{
$group = "CiviCRM Mobile";
$values = $this->controller->exportValues($this->_name);
$keys = array('ind_profile_id', 'org_profile_id', 'house_profile_id');
while (list(, $key) = each($keys)) {
if (array_key_exists($key, $values)) {
CRM_Core_BAO_Setting::setItem($values[$key], $group, $key);
}
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/setting/mobile'));
}
示例12: postProcess
/**
* Handle the data submitted
*/
function postProcess()
{
$values = $this->exportValues();
if ($values['securefiles_backend_service'] != $this->backend_service_class) {
CRM_Core_BAO_Setting::setItem($values['securefiles_backend_service'], "securefiles", "securefiles_backend_service");
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/securefiles/settings'));
return;
}
if ($this->backend_service) {
$this->backend_service->saveSettings($values);
}
parent::postProcess();
CRM_Core_Session::setStatus(ts("Settings Saved"), '', 'success');
}
示例13: postProcess
function postProcess()
{
$values = $this->exportValues();
// process menu entry
$old_menu_position = (int) CRM_Core_BAO_Setting::getItem('CiviBanking', 'menu_position');
$new_menu_position = (int) $values['menu_position'];
if ($old_menu_position != $new_menu_position) {
CRM_Core_BAO_Setting::setItem($new_menu_position, 'CiviBanking', 'menu_position');
CRM_Core_Invoke::rebuildMenuAndCaches();
}
// process reference normalisation / validation
CRM_Core_BAO_Setting::setItem(!empty($values['reference_normalisation']), 'CiviBanking', 'reference_normalisation');
CRM_Core_BAO_Setting::setItem(!empty($values['reference_validation']), 'CiviBanking', 'reference_validation');
parent::postProcess();
}
示例14: run
function run()
{
// title
CRM_Utils_System::setTitle(ts('SuperStyler'));
// variables
$url = CRM_Utils_System::baseURL() . 'civicrm/ctrl/superstyler';
$this->assign('url', $url);
// get settings
$settings = CRM_Core_BAO_Setting::getItem('superstyler', 'settings');
$decode = json_decode(utf8_decode($settings), true);
// on form action
if (isset($_REQUEST['color'])) {
// clear
foreach ($decode['superstyler'] as $key => $value) {
if ($value['name'] == $_REQUEST['color']) {
$decode['superstyler'][$key]['active'] = 1;
} else {
$decode['superstyler'][$key]['active'] = 0;
}
}
// set
$encode = json_encode($decode);
CRM_Core_BAO_Setting::setItem($encode, 'superstyler', 'settings');
// notice
CRM_Core_Session::setStatus(ts('Superstyler settings changed'), ts('Saved'), 'success');
}
// form
$form = "";
$form .= "<form action=" . $url . " method='post'>";
$form .= "<label>Select stylesheet</label>";
$form .= "<div class='listing-box'>";
// loop
foreach ($decode['superstyler'] as $key => $value) {
$v = $value['name'];
if ($value['active'] == 1) {
$form .= "<input type='radio' id='css_{$v}' name='color' value='{$v}' checked><label for='css_{$v}' >{$v}</label><br>";
} else {
$form .= "<input type='radio' id='css_{$v}' name='color' value='{$v}'><label for='css_{$v}' >{$v}</label><br>";
}
}
$form .= "</div>";
$form .= "<div class='crm-submit-buttons'><span class='crm-button'><input class='crm-form-submit default' type='submit' value='Submit'></span></div>";
$form .= "</form>";
// assign form
$this->assign('content', $form);
// render
parent::run();
}
示例15: postProcess
public function postProcess()
{
// check if mailing tab is enabled, if not prompt user to enable the tab if "write_activity_record" is disabled
$params = $this->controller->exportValues($this->_name);
if (empty($params['write_activity_record'])) {
$existingViewOptions = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options');
$displayValue = CRM_Core_OptionGroup::getValue('contact_view_options', 'CiviMail', 'name');
$viewOptions = explode(CRM_Core_DAO::VALUE_SEPARATOR, $existingViewOptions);
if (!in_array($displayValue, $viewOptions)) {
$existingViewOptions .= $displayValue . CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($existingViewOptions, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options');
CRM_Core_Session::setStatus(ts('We have automatically enabled the Mailings tab for the Contact Summary screens
so that you can view mailings sent to each contact.'), ts('Saved'), 'success');
}
}
parent::postProcess();
}