本文整理汇总了PHP中CRM_Core_DAO::singleValueQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO::singleValueQuery方法的具体用法?PHP CRM_Core_DAO::singleValueQuery怎么用?PHP CRM_Core_DAO::singleValueQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO
的用法示例。
在下文中一共展示了CRM_Core_DAO::singleValueQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroupIdByMemberGroupId
protected function getGroupIdByMemberGroupId($member_group_id, $member_group_name)
{
$custom = 'custom_' . $this->group_custom_field;
try {
$group_params = array();
$group_params[1] = array($member_group_id, 'Integer');
$groupId = CRM_Core_DAO::singleValueQuery("SELECT entity_id FROM `civicrm_value_myemma_group` WHERE `{$this->group_custom_field_name}` = %1", $group_params);
} catch (Exception $e) {
//not found do nothing
throw $e;
}
if ($groupId) {
civicrm_api3('Group', 'create', array('id' => $groupId, 'title' => $member_group_name, 'group_type' => CRM_Core_DAO::VALUE_SEPARATOR . '2' . CRM_Core_DAO::VALUE_SEPARATOR));
} else {
$group_params = array();
$group_params[$custom] = $member_group_id;
$group_params['title'] = $member_group_name;
$group_params['group_type'] = CRM_Core_DAO::VALUE_SEPARATOR . '2' . CRM_Core_DAO::VALUE_SEPARATOR;
//mailing list
if ($this->parent_group_id) {
$group_params['parents'] = $this->parent_group_id;
}
$result = civicrm_api3('Group', 'create', $group_params);
$groupId = $result['id'];
}
return $groupId;
}
示例2: tearDown
function tearDown()
{
parent::tearDown();
CRM_Core_DAO::singleValueQuery('DELETE FROM civicrm_managed');
CRM_Core_DAO::singleValueQuery('DELETE FROM civicrm_option_value WHERE name like "CRM_Example_%"');
\Civi\Core\Container::singleton(TRUE);
}
示例3: upgrade_1007
/**
* Upgrades for adding a Bussiness Coordinator in the Business case
* @return bool
*/
public function upgrade_1007()
{
$gid = CRM_Core_DAO::singleValueQuery("SELECT id from civicrm_custom_group where name = 'Add_Keyqualifications'");
CRM_Core_DAO::executeQuery("UPDATE `civicrm_custom_field` SET label = 'Assessment SC/BC' WHERE `name` = 'Assessment_SC' AND custom_group_id = '" . $gid . "'");
CRM_Core_DAO::executeQuery("UPDATE `civicrm_custom_field` SET label = 'Remarks SC/BC' WHERE `name` = 'Remarks' AND custom_group_id = '" . $gid . "'");
CRM_Utils_System::flushCache();
CRM_Core_DAO::executeQuery("UPDATE `civicrm_option_value` SET label = 'Request Approval Business Programme BC' WHERE label = 'Request Approval Business Programme SC' and option_group_id = 2");
CRM_Core_DAO::executeQuery("UPDATE `civicrm_option_value` SET label = 'Business Debriefing BC', name = 'Business Debriefing BC' WHERE name = 'Business Debriefing SC' and option_group_id = 2");
CRM_Utils_System::flushCache();
$this->executeCustomDataFile('xml/request_approval_bc.xml');
CRM_Utils_System::flushCache();
$this->executeCustomDataFile('xml/request_approval_cc.xml');
CRM_Utils_System::flushCache();
$checkQry = 'SELECT COUNT(*) AS relCount FROM civicrm_relationship_type WHERE name_a_b = %1';
$countRelType = CRM_Core_DAO::singleValueQuery($checkQry, array(1 => array('Business Coordinator', 'String')));
if ($countRelType == 0) {
CRM_Core_DAO::executeQuery("INSERT INTO civicrm_relationship_type\n (name_a_b, label_a_b, name_b_a, label_b_a, description, contact_type_a, contact_type_b, contact_sub_type_a, contact_sub_type_b, is_reserved, is_active)\n VALUES\n ('Business Coordinator', 'Business Coordinator', 'Business Coordinator', 'Business Coordinator', 'Business Coordinator relationship', NULL, 'Individual', NULL, NULL, NULL, '1')");
}
CRM_Utils_System::flushCache();
$gid = CRM_Core_DAO::singleValueQuery("SELECT id from civicrm_custom_group where name = 'Business_Data'");
$fid = CRM_Core_DAO::singleValueQuery("SELECT id from civicrm_custom_field where custom_group_id = '" . $gid . "' and name = 'Position_of_Visitors'");
if ($fid) {
civicrm_api3('CustomField', 'delete', array('id' => $fid));
}
return true;
}
示例4: preProcess
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess()
{
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($id) {
$this->_contributionIds = array($id);
$this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
$this->_single = TRUE;
$this->assign('totalSelectedContributions', 1);
} else {
parent::preProcess();
}
// check that all the contribution ids have pending status
$query = "\nSELECT count(*)\nFROM civicrm_contribution\nWHERE contribution_status_id != 1\nAND {$this->_componentClause}";
$count = CRM_Core_DAO::singleValueQuery($query);
if ($count != 0) {
CRM_Core_Error::statusBounce("Please select only online contributions with Completed status.");
}
// we have all the contribution ids, so now we get the contact ids
parent::setContactIDs();
$this->assign('single', $this->_single);
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
$breadCrumb = array(array('url' => $url, 'title' => ts('Search Results')));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
}
示例5: buildForm
public function buildForm($formName, &$form)
{
if ($formName != 'CRM_Contribute_Form_Contribution') {
return;
}
if (!CRM_Core_Permission::check('edit memberships')) {
return;
}
$contact_id = $form->getVar('_contactID');
if (!$contact_id) {
return;
}
$current_membership_id = false;
$contribution_id = $form->getVar('_id');
if ($contribution_id) {
$current_membership_id = CRM_Core_DAO::singleValueQuery("SELECT membership_id FROM civicrm_membership_payment where contribution_id = %1", array(1 => array($contribution_id, 'Integer')));
}
$memberships = array('' => ts('-- None --')) + $this->getMembershipsForContact($contact_id);
$snippet['template'] = 'CRM/Membershippayment/Contribution/Form.tpl';
$snippet['contact_id'] = $contact_id;
$form->add('select', 'membership_id', ts('Membership'), $memberships);
if ($current_membership_id) {
$defaults['membership_id'] = $current_membership_id;
$form->setDefaults($defaults);
}
CRM_Core_Region::instance('page-body')->add($snippet);
}
示例6: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
if ($id) {
$this->_contributionIds = array($id);
$this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
$this->_single = true;
$this->assign('totalSelectedContributions', 1);
} else {
parent::preProcess();
}
// check that all the contribution ids have pending status
$query = "\nSELECT count(*)\nFROM civicrm_contribution\nWHERE contribution_status_id != 2\nAND {$this->_componentClause}";
$count = CRM_Core_DAO::singleValueQuery($query, CRM_Core_DAO::$_nullArray);
if ($count != 0) {
CRM_Core_Error::statusBounce(ts('Please select only online contributions with Pending status.'));
}
// ensure that all contributions are generated online by pay later
$query = "\nSELECT DISTINCT( source ) as source\nFROM civicrm_contribution\nWHERE {$this->_componentClause}";
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
while ($dao->fetch()) {
if (strpos($dao->source, ts('Online Contribution')) === false && strpos($dao->source, ts('Online Event Registration')) === false) {
CRM_Core_Error::statusBounce("<strong>Update Pending Contribution Status</strong> can only be used for pending online contributions (made using the 'Pay Later' option). The Source for these contributions starts with 'Online ...'. Please de-select any offline contributions and try again.");
}
}
// we have all the contribution ids, so now we get the contact ids
parent::setContactIDs();
$this->assign('single', $this->_single);
}
示例7: create
/**
* Creates or updates a participant payment record.
*
* @param array $params
* of values to initialize the record with.
* @param array $ids
* with one values of id for this participantPayment record (for update).
*
* @return object
* the partcipant payment record
*/
public static function create(&$params, &$ids)
{
if (isset($ids['id'])) {
CRM_Utils_Hook::pre('edit', 'ParticipantPayment', $ids['id'], $params);
} else {
CRM_Utils_Hook::pre('create', 'ParticipantPayment', NULL, $params);
}
$participantPayment = new CRM_Event_BAO_ParticipantPayment();
$participantPayment->copyValues($params);
if (isset($ids['id'])) {
$participantPayment->id = CRM_Utils_Array::value('id', $ids);
} else {
$participantPayment->find(TRUE);
}
$participantPayment->save();
if (isset($ids['id'])) {
CRM_Utils_Hook::post('edit', 'ParticipantPayment', $ids['id'], $participantPayment);
} else {
CRM_Utils_Hook::post('create', 'ParticipantPayment', NULL, $participantPayment);
}
//generally if people are creating participant_payments via the api they won't be setting the line item correctly - we can't help them if they are doing complex transactions
// but if they have a single line item for the contribution we can assume it should refer to the participant line
$lineItemCount = CRM_Core_DAO::singleValueQuery("select count(*) FROM civicrm_line_item WHERE contribution_id = %1", array(1 => array($participantPayment->contribution_id, 'Integer')));
if ($lineItemCount == 1) {
$sql = "UPDATE civicrm_line_item li\n SET entity_table = 'civicrm_participant', entity_id = %1\n WHERE contribution_id = %2 AND entity_table = 'civicrm_contribution'";
CRM_Core_DAO::executeQuery($sql, array(1 => array($participantPayment->participant_id, 'Integer'), 2 => array($participantPayment->contribution_id, 'Integer')));
}
return $participantPayment;
}
示例8: jqFinancial
/**
* get financial accounts of required account relationship.
* $financialAccountType array with key account relationship and value financial account type option groups
*
* @param $config
*/
public static function jqFinancial($config)
{
if (!isset($_GET['_value']) || empty($_GET['_value'])) {
CRM_Utils_System::civiExit();
}
$defaultId = NULL;
if ($_GET['_value'] == 'select') {
$result = CRM_Contribute_PseudoConstant::financialAccount();
} else {
$financialAccountType = array('5' => 5, '3' => 1, '1' => 3, '6' => 1, '7' => 4, '8' => 1, '9' => 3, '10' => 2);
$financialAccountType = CRM_Utils_Array::value($_GET['_value'], $financialAccountType);
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
if ($financialAccountType) {
$defaultId = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = {$financialAccountType}");
}
}
$elements = array(array('name' => ts('- select -'), 'value' => 'select'));
if (!empty($result)) {
foreach ($result as $id => $name) {
$selectedArray = array();
if ($id == $defaultId) {
$selectedArray['selected'] = 'Selected';
}
$elements[] = array('name' => $name, 'value' => $id) + $selectedArray;
}
}
CRM_Utils_JSON::output($elements);
}
示例9: postProcess
function postProcess()
{
$values = $this->exportValues();
$title = str_replace("'", "''", $values['title']);
$params = array(1 => array($title, 'String'), 2 => array($values['widget'], 'Integer'));
if (isset($this->_id)) {
$params += array(3 => array($this->_id, 'Integer'));
$sql = "UPDATE civicrm_wci_embed_code SET name = %1, widget_id = %2 where id = %3";
} else {
$sql = "INSERT INTO civicrm_wci_embed_code (name, widget_id)VALUES (%1, %2)";
}
$errorScope = CRM_Core_TemporaryErrorScope::useException();
try {
$transaction = new CRM_Core_Transaction();
CRM_Core_DAO::executeQuery($sql, $params);
$transaction->commit();
CRM_Core_Session::setStatus(ts('Embed code created successfully'), '', 'success');
if (isset($_REQUEST['_qf_NewEmbedCode_next'])) {
isset($this->_id) ? $embed_id = $this->_id : ($embed_id = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()'));
CRM_Utils_System::redirect('?action=update&reset=1&id=' . $embed_id);
} else {
CRM_Utils_System::redirect('embed-code?reset=1');
}
} catch (Exception $e) {
CRM_Core_Session::setStatus(ts('Failed to create embed code'), '', 'error');
$transaction->rollback();
}
parent::postProcess();
}
示例10: eventpermissions_civicrm_navigationMenu
/**
* Implements hook_civicrm_navigationMenu().
*/
function eventpermissions_civicrm_navigationMenu(&$params)
{
$searchParams = array('url' => 'civicrm/eventpermissions?reset=1');
$menuItems = array();
CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
if (!empty($menuItems)) {
return;
}
$searchParams = array('url' => 'civicrm/admin/options/participant_role?reset=1');
$menuItems = array();
CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
$parent = CRM_Utils_Array::value('parent_id', $menuItems);
$navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
if (is_int($navId)) {
$navId++;
}
$basicAttrs = array('label' => ts('Event Permissions', array('domain' => 'com.aghstrategies.eventpermissions')), 'name' => 'Event Permissions', 'url' => 'civicrm/eventpermissions?reset=1', 'permission' => 'administer CiviCRM', 'active' => 1, 'navID' => $navId, 'parentID' => $parent);
$searchParams = array('id' => $parent);
$menuItems = array();
CRM_Core_BAO_Navigation::retrieve($searchParams, $menuItems);
if (empty($menuItems['parent_id'])) {
$params[$parent]['child'][$navId] = $basicAttrs;
} else {
$params[$menuItems['parent_id']]['child'][$parent]['child'][$navId] = array('attributes' => $basicAttrs);
}
}
示例11: DataModelImprovements_preWebformRegSite
function DataModelImprovements_preWebformRegSite()
{
//Improvements that convert data collected on registered site before we had the webform to the same format that would be expected now that the webform is in place.
//These are needed because we are going to ask all registered sites to update via the webform.
//
//Specifically, we want the ensure the following
//
// * All registered sites are all End Users
// * All registered sites have a register your site activitiy recorded for them (at an appropriate time)
// * All registered sites are no longer in the Registered site Organisations group (since we now track this with an activity)
//
//Update the contact sub type for all Organisations in the Register your site Organisations group where the contact subtype is NULL and they areto 'End users'
$query = "UPDATE civicrm_contact AS cc\n JOIN civicrm_group_contact AS cgc ON cgc.contact_id = cc.id AND cgc.group_id=15\n SET contact_sub_type = 'End_user'\n WHERE contact_sub_type IS NULL";
CRM_Core_DAO::singleValueQuery($query);
//Remove all organisations that are service providers from the list of registered sites
//a. Mark all organisations that are tagged as ServiceProvider and EndUsers as just ServiceProvider
$query = "UPDATE civicrm_contact AS cc\n JOIN civicrm_value_civicrm_site_registration_4 AS cd ON cd.entity_id = cc.id\n SET contact_sub_type ='Service_provider'\n WHERE contact_sub_type = 'Service_providerEnd_user'";
$result = CRM_Core_DAO::ExecuteQuery($query);
//b. Remove all service providers from the group 'Register your site Organisations' (id 15)
$query = "DELETE cgc\n FROM civicrm_contact AS cc\n JOIN civicrm_group_contact AS cgc\n ON cc.id=cgc.contact_id\n WHERE group_id=15 AND contact_sub_type LIKE '%Service%'";
$result = CRM_Core_DAO::ExecuteQuery($query);
//Create 'Registered site' (id 12) relationships for all organisations in the group 'Register your site Organisations' (id 15)
// a. For all orgs that have exactly one employee, assume this is the person that entered the site and create the relationship
$query = "\n INSERT INTO civicrm_relationship(\n SELECT\n NULL,\n cr.contact_id_a,\n cr.contact_id_b,\n 12,\n NULL,\n NULL,\n 1,\n NULL,\n 1,\n 0,\n NULL\n FROM civicrm_group_contact AS cgc\n JOIN civicrm_relationship AS cr ON cr.contact_id_b = cgc.contact_id AND group_id=15 AND relationship_type_id=4 AND is_active\n LEFT JOIN civicrm_relationship AS cra ON cr.contact_id_a=cra.contact_id_a AND cr.contact_id_b=cra.contact_id_b AND cra.relationship_type_id=12\n WHERE cra.id IS NULL\n GROUP BY contact_id\n HAVING count(*)=1\n )";
$result = CRM_Core_DAO::ExecuteQuery($query);
// b. For all orgs where there is more than one individual, see if one of those is in the registered sites individuals, find the individual that is in the Register your site Individuals list
$query = "\n SELECT\n cr.contact_id_b as id\n FROM civicrm_group_contact AS cgc\n JOIN civicrm_relationship AS cr\n ON cr.contact_id_b = cgc.contact_id AND group_id=15 AND relationship_type_id=4 AND is_active\n LEFT JOIN civicrm_relationship AS cra ON cr.contact_id_a=cra.contact_id_a AND cr.contact_id_b=cra.contact_id_b AND cra.relationship_type_id=12\n WHERE cra.id IS NULL\n GROUP BY contact_id\n HAVING count( * ) >1\n ";
$org = CRM_Core_DAO::ExecuteQuery($query);
while ($org->fetch()) {
$query = "SELECT cc.id FROM\n civicrm_contact AS cc JOIN\n civicrm_group_contact AS cgc ON cc.id=cgc.contact_id AND group_id=16 AND employer_id={$org->id}\n ";
$ind = CRM_Core_DAO::ExecuteQuery($query);
if ($ind->N > 0) {
$ind->fetch();
} else {
$query = "SELECT cc.id FROM civicrm_contact AS cc WHERE employer_id={$org->id} ";
$ind = CRM_Core_DAO::ExecuteQuery($query);
if ($ind->N > 0) {
$ind->fetch();
}
}
if ($ind->N > 0) {
$params = array('version' => 3, 'sequential' => 1, 'contact_id_a' => $ind->id, 'contact_id_b' => $org->id, 'relationship_type_id' => 12);
$result = civicrm_api('Relationship', 'create', $params);
} else {
print_r($org_id);
}
//print_r($params);
//print_r($result);
}
//ensure all registered by relationships are permissioned
// SELECT
// cc.display_name, count(activity_id)
// FROM civicrm_contact AS cc
// JOIN civicrm_activity_contact AS cac
// ON cc.id=cac.contact_id
// WHERE cc.employer_id=???
// GROUP BY cc.id
// record activities for all organisations in the registered sites group that don't have that type of activity recorded and assign to the individual that registered the site as well
return;
}
示例12: checkPermission
/**
* Lets do permission checking here
* First check for valid mailing, if false return fatal
* Second check for visibility
* Call a hook to see if hook wants to override visibility setting
*/
function checkPermission()
{
if (!$this->_mailing) {
return false;
}
// check for visibility, if visibility is user pages
// return true
if ($this->_mailing->visibility == 'Public Pages') {
return true;
}
// if user is an admin, return true
require_once 'CRM/Core/Permission.php';
if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Core_Permission::check('access CiviMail')) {
return true;
}
// if anon user return false
if (empty($this->_contactID)) {
return false;
}
// if user has recd this mailing return true, else return false
// check in mailing event table for this contact
$sql = "\nSELECT id\nFROM civicrm_mailing_event_queue q\nINNER JOIN civicrm_mailing_job j ON q.job_id = j.id\nWHERE j.mailing_id = %1\nAND q.contact_id = %2\n";
$params = array(1 => array($this->_mailingID, 'Integer'), 2 => array($this->_contactID, 'Integer'));
return CRM_Core_DAO::singleValueQuery($sql, $params) ? true : false;
}
示例13: zombiefinder_civicrm_check
/**
* Implementation of hook_civicrm_check().
*
* Add a check to the status page/System.check results if $snafu is TRUE.
*/
function zombiefinder_civicrm_check(&$messages)
{
// The API should be able to provide this (as below), but there are problems
// in both 4.6 and 4.7 with finding privacy preferences (Do not mail, etc.)
// that are null using the API.
//
// try {
// $result = civicrm_api3('Contact', 'getcount', array(
// 'is_deceased' => array('IS NULL' => 1),
// ));
// }
// catch (CiviCRM_API3_Exception $e) {
// CRM_Core_Error::debug_log_message($e->getMessage());
// }
// Check for zombies.
$fieldsToCheck = CRM_Core_SelectValues::privacy();
$fieldsToCheck['is_deceased'] = ts('Is Deceased');
$fieldsToCheck['is_deleted'] = ts('Deleted');
$found = array();
foreach ($fieldsToCheck as $fieldName => $displayName) {
$sql = "SELECT COUNT(id) FROM civicrm_contact WHERE {$fieldName} IS NULL";
if (CRM_Core_DAO::singleValueQuery($sql)) {
$found[] = $displayName;
}
}
if (count($found)) {
$tsParams = array(1 => implode(', ', $found), 2 => 'http://civicrm.stackexchange.com/a/7396/44', 'domain' => 'com.aghstrategies.zombiefinder');
$details = ts('Zombies found. You have contacts who are undead or have null privacy options. One or more contacts have null values in the following fields: %1. <a href="%2">Read more about how to solve this.</a>', $tsParams);
$messages[] = new CRM_Utils_Check_Message('zombiefinder_found', $details, ts('Gaaargh! Braaaains!', array('domain' => 'com.aghstrategies.zombiefinder')), \Psr\Log\LogLevel::WARNING, 'fa-user-times');
}
}
示例14: getActiveRelTables
/**
* Returns the related tables groups for which a contact has any info entered
*/
static function getActiveRelTables($cid)
{
$cid = (int) $cid;
$groups = array();
$relTables =& self::relTables();
$cidRefs =& self::cidRefs();
$eidRefs =& self::eidRefs();
foreach ($relTables as $group => $params) {
$sqls = array();
foreach ($params['tables'] as $table) {
if (isset($cidRefs[$table])) {
foreach ($cidRefs[$table] as $field) {
$sqls[] = "SELECT COUNT(*) AS count FROM {$table} WHERE {$field} = {$cid}";
}
}
if (isset($eidRefs[$table])) {
foreach ($eidRefs[$table] as $entityTable => $entityId) {
$sqls[] = "SELECT COUNT(*) AS count FROM {$table} WHERE {$entityId} = {$cid} AND {$entityTable} = 'civicrm_contact'";
}
}
foreach ($sqls as $sql) {
if (CRM_Core_DAO::singleValueQuery($sql, CRM_Core_DAO::$_nullArray) > 0) {
$groups[] = $group;
}
}
}
}
return array_unique($groups);
}
示例15: 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;
}