本文整理汇总了PHP中CRM_Core_BAO_CustomField::displayValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomField::displayValue方法的具体用法?PHP CRM_Core_BAO_CustomField::displayValue怎么用?PHP CRM_Core_BAO_CustomField::displayValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomField
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomField::displayValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetDisplayedValues
public function testGetDisplayedValues()
{
$customGroup = Custom::createGroup(array(), 'Individual');
$fieldsToCreate = array(array('data_type' => 'Country', 'html_type' => 'Select Country', 'tests' => array('UNITED STATES' => 1228, '' => NULL)), array('data_type' => 'StateProvince', 'html_type' => 'Multi-Select State/Province', 'tests' => array('' => 0, 'Alabama' => 1000, 'Alabama, Alaska' => array(1000, 1001))), array('data_type' => 'String', 'html_type' => 'Radio', 'option_values' => array('key' => 'KeyLabel'), 'tests' => array('KeyLabel' => 'key')), array('data_type' => 'String', 'html_type' => 'CheckBox', 'option_values' => array('key1' => 'Label1', 'key2' => 'Label2', 'key3' => 'Label3', 'key4' => 'Label4'), 'tests' => array('Label1' => array('key1'), 'Label2' => 'key2', 'Label2, Label3' => array('key2', 'key3'), 'Label3, Label4' => CRM_Utils_Array::implodePadded(array('key3', 'key4')), 'Label1, Label4' => array('key1' => 1, 'key4' => 1))), array('data_type' => 'Date', 'html_type' => 'Select Date', 'date_format' => 'd M yy', 'time_format' => 1, 'tests' => array('1 Jun 1999 1:30PM' => '1999-06-01 13:30', '' => '')));
foreach ($fieldsToCreate as $num => $field) {
$params = $field + array('label' => 'test field ' . $num, 'custom_group_id' => $customGroup->id);
unset($params['tests']);
$createdField = $this->callAPISuccess('customField', 'create', $params);
foreach ($field['tests'] as $expected => $input) {
$this->assertEquals($expected, CRM_Core_BAO_CustomField::displayValue($input, $createdField['id']));
}
}
Custom::deleteGroup($customGroup);
}
示例2: buildCustomDataView
/**
* Build custom data view.
*
* @param CRM_Core_Form $form
* Page object.
* @param array $groupTree
* @param bool $returnCount
* True if customValue count needs to be returned.
* @param int $gID
* @param null $prefix
* @param int $customValueId
* @param int $entityId
*
* @return array|int
*/
public static function buildCustomDataView(&$form, &$groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL, $entityId = NULL)
{
$details = array();
foreach ($groupTree as $key => $group) {
if ($key === 'info') {
continue;
}
foreach ($group['fields'] as $k => $properties) {
$groupID = $group['id'];
if (!empty($properties['customValue'])) {
foreach ($properties['customValue'] as $values) {
if (!empty($customValueId) && $customValueId != $values['id']) {
continue;
}
$details[$groupID][$values['id']]['title'] = CRM_Utils_Array::value('title', $group);
$details[$groupID][$values['id']]['name'] = CRM_Utils_Array::value('name', $group);
$details[$groupID][$values['id']]['help_pre'] = CRM_Utils_Array::value('help_pre', $group);
$details[$groupID][$values['id']]['help_post'] = CRM_Utils_Array::value('help_post', $group);
$details[$groupID][$values['id']]['collapse_display'] = CRM_Utils_Array::value('collapse_display', $group);
$details[$groupID][$values['id']]['collapse_adv_display'] = CRM_Utils_Array::value('collapse_adv_display', $group);
$details[$groupID][$values['id']]['fields'][$k] = array('field_title' => CRM_Utils_Array::value('label', $properties), 'field_type' => CRM_Utils_Array::value('html_type', $properties), 'field_data_type' => CRM_Utils_Array::value('data_type', $properties), 'field_value' => CRM_Core_BAO_CustomField::displayValue($values['data'], $properties['id'], $entityId), 'options_per_line' => CRM_Utils_Array::value('options_per_line', $properties));
// also return contact reference contact id if user has view all or edit all contacts perm
if ((CRM_Core_Permission::check('view all contacts') || CRM_Core_Permission::check('edit all contacts')) && $details[$groupID][$values['id']]['fields'][$k]['field_data_type'] == 'ContactReference') {
$details[$groupID][$values['id']]['fields'][$k]['contact_ref_id'] = CRM_Utils_Array::value('data', $values);
}
}
} else {
$details[$groupID][0]['title'] = CRM_Utils_Array::value('title', $group);
$details[$groupID][0]['name'] = CRM_Utils_Array::value('name', $group);
$details[$groupID][0]['help_pre'] = CRM_Utils_Array::value('help_pre', $group);
$details[$groupID][0]['help_post'] = CRM_Utils_Array::value('help_post', $group);
$details[$groupID][0]['collapse_display'] = CRM_Utils_Array::value('collapse_display', $group);
$details[$groupID][0]['collapse_adv_display'] = CRM_Utils_Array::value('collapse_adv_display', $group);
$details[$groupID][0]['fields'][$k] = array('field_title' => CRM_Utils_Array::value('label', $properties));
}
}
}
if ($returnCount) {
//return a single value count if group id is passed to function
//else return a groupId and count mapped array
if (!empty($gID)) {
return count($details[$gID]);
} else {
$countValue = array();
foreach ($details as $key => $value) {
$countValue[$key] = count($details[$key]);
}
return $countValue;
}
} else {
$form->assign_by_ref("{$prefix}viewCustomData", $details);
return $details;
}
}
示例3: array
//.........这里部分代码省略.........
}
} elseif ($field['name'] == 'id') {
$names[] = 'contact_id';
} else {
$names[] = $field['name'];
}
}
}
$multipleSelectFields = array('preferred_communication_method' => 1);
$multiRecordTableId = NULL;
if ($this->_multiRecordTableName) {
$multiRecordTableId = "{$this->_multiRecordTableName}_id";
}
// we need to determine of overlay profile should be shown
$showProfileOverlay = CRM_Core_BAO_UFGroup::showOverlayProfile();
while ($result->fetch()) {
$this->_query->convertToPseudoNames($result);
if (isset($result->country)) {
// the query returns the untranslated country name
$i18n = CRM_Core_I18n::singleton();
$result->country = $i18n->translate($result->country);
}
$row = array();
$empty = TRUE;
$row[] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id, $showProfileOverlay);
if ($result->sort_name) {
$row[] = $result->sort_name;
$empty = FALSE;
} else {
continue;
}
foreach ($names as $name) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$row[] = CRM_Core_BAO_CustomField::displayValue($result->{$name}, $cfID, $result->contact_id);
} elseif (substr($name, -4) == '-url' && !empty($result->{$name})) {
$url = CRM_Utils_System::fixURL($result->{$name});
$typeId = substr($name, 0, -4) . "-website_type_id";
$typeName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_Website', 'website_type_id', $result->{$typeId});
if ($typeName) {
$row[] = "<a href=\"{$url}\">{$result->{$name}} ({$typeName})</a>";
} else {
$row[] = "<a href=\"{$url}\">{$result->{$name}}</a>";
}
} elseif ($name == 'preferred_language') {
$row[] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'preferred_language', $result->{$name});
} elseif ($multipleSelectFields && array_key_exists($name, $multipleSelectFields)) {
$paramsNew = array($name => $result->{$name});
$name = array($name => array('newName' => $name, 'groupName' => $name));
CRM_Core_OptionGroup::lookupValues($paramsNew, $name, FALSE);
$row[] = $paramsNew[$key];
} elseif (strpos($name, '-im')) {
if (!empty($result->{$name})) {
$providerId = $name . "-provider_id";
$providerName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_IM', 'provider_id', $result->{$providerId});
$row[] = $result->{$name} . " ({$providerName})";
} else {
$row[] = '';
}
} elseif (strpos($name, '-phone-')) {
$phoneExtField = str_replace('phone', 'phone_ext', $name);
if (isset($result->{$phoneExtField})) {
$row[] = $result->{$name} . " (" . $result->{$phoneExtField} . ")";
} else {
$row[] = $result->{$name};
}
} elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting'))) {
示例4: _formatSurveyResponseData
/**
* @param $rows
*/
private function _formatSurveyResponseData(&$rows)
{
$surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) {
return;
}
$surveyResponseFields = array();
$surveyResponseFieldIds = array();
foreach ($this->_columns as $tableName => $values) {
if (!is_array($values['fields'])) {
continue;
}
foreach ($values['fields'] as $name => $field) {
if (!empty($field['isSurveyResponseField'])) {
$fldId = substr($name, 7);
$surveyResponseFields[$name] = "{$tableName}_{$name}";
$surveyResponseFieldIds[$fldId] = $fldId;
}
}
}
if (empty($surveyResponseFieldIds)) {
return;
}
$hasResponseData = FALSE;
foreach ($surveyResponseFields as $fldName) {
foreach ($rows as $row) {
if (!empty($row[$fldName])) {
$hasResponseData = TRUE;
break;
}
}
}
//do check respondent status.
$statusId = CRM_Utils_Array::value('status_id_value', $this->_params);
$respondentStatus = CRM_Utils_Array::value($statusId, self::$_surveyRespondentStatus);
if (!$hasResponseData && $respondentStatus != 'Reserved') {
return;
}
//start response data formatting.
$query = '
SELECT cf.id,
cf.data_type,
cf.html_type,
cg.table_name,
cf.column_name,
ov.value, ov.label,
cf.option_group_id
FROM civicrm_custom_field cf
INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id )
LEFT JOIN civicrm_option_value ov ON ( cf.option_group_id = ov.option_group_id )
WHERE cf.id IN ( ' . implode(' , ', $surveyResponseFieldIds) . ' )
Order By ov.weight';
$responseFields = array();
$fieldValueMap = array();
$properties = array('id', 'data_type', 'html_type', 'column_name', 'option_group_id');
$responseField = CRM_Core_DAO::executeQuery($query);
while ($responseField->fetch()) {
$reponseFldName = $responseField->table_name . '_custom_' . $responseField->id;
foreach ($properties as $prop) {
$responseFields[$reponseFldName][$prop] = $responseField->{$prop};
}
if ($responseField->option_group_id) {
//show value for print and pdf.
$value = $responseField->label;
if (in_array($this->_outputMode, array('print', 'pdf'))) {
$value = $responseField->value;
}
$fieldValueMap[$responseField->option_group_id][$responseField->value] = $value;
}
}
$responseField->free();
//actual data formatting.
$hasData = FALSE;
foreach ($rows as &$row) {
if (!is_array($row)) {
continue;
}
foreach ($row as $name => &$value) {
if (!array_key_exists($name, $responseFields)) {
continue;
}
$hasData = TRUE;
if ($respondentStatus == 'Reserved' && in_array($this->_outputMode, array('print', 'pdf'))) {
$optGrpId = CRM_Utils_Array::value('option_group_id', $responseFields[$name]);
$options = CRM_Utils_Array::value($optGrpId, $fieldValueMap, array());
$value = implode(' | ', array_keys($options));
} else {
$value = CRM_Core_BAO_CustomField::displayValue($value, $responseFields[$name]['id']);
}
}
if (!$hasData) {
break;
}
}
}
示例5: moveAllBelongings
//.........这里部分代码省略.........
CRM_Core_OptionGroup::lookupValues($submitted, $names, TRUE);
// fix custom fields so they're edible by createProfileContact()
static $treeCache = array();
if (!array_key_exists($migrationInfo['main_details']['contact_type'], $treeCache)) {
$treeCache[$migrationInfo['main_details']['contact_type']] = CRM_Core_BAO_CustomGroup::getTree($migrationInfo['main_details']['contact_type'], CRM_Core_DAO::$_nullObject, NULL, -1);
}
$cgTree =& $treeCache[$migrationInfo['main_details']['contact_type']];
$cFields = array();
foreach ($cgTree as $key => $group) {
if (!isset($group['fields'])) {
continue;
}
foreach ($group['fields'] as $fid => $field) {
$cFields[$fid]['attributes'] = $field;
}
}
if (!isset($submitted)) {
$submitted = array();
}
foreach ($submitted as $key => $value) {
if (substr($key, 0, 7) == 'custom_') {
$fid = (int) substr($key, 7);
if (empty($cFields[$fid])) {
continue;
}
$htmlType = $cFields[$fid]['attributes']['html_type'];
switch ($htmlType) {
case 'File':
$customFiles[] = $fid;
unset($submitted["custom_{$fid}"]);
break;
case 'Select Country':
case 'Select State/Province':
$submitted[$key] = CRM_Core_BAO_CustomField::displayValue($value, $fid);
break;
case 'CheckBox':
case 'AdvMulti-Select':
case 'Multi-Select':
case 'Multi-Select Country':
case 'Multi-Select State/Province':
// Merge values from both contacts for multivalue fields, CRM-4385
// get the existing custom values from db.
$customParams = array('entityID' => $mainId, $key => TRUE);
$customfieldValues = CRM_Core_BAO_CustomValueTable::getValues($customParams);
if (!empty($customfieldValues[$key])) {
$existingValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customfieldValues[$key]);
if (is_array($existingValue) && !empty($existingValue)) {
$mergeValue = $submmtedCustomValue = array();
if ($value) {
$submmtedCustomValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
}
//hack to remove null and duplicate values from array.
foreach (array_merge($submmtedCustomValue, $existingValue) as $k => $v) {
if ($v != '' && !in_array($v, $mergeValue)) {
$mergeValue[] = $v;
}
}
//keep state and country as array format.
//for checkbox and m-select format w/ VALUE_SEPARATOR
if (in_array($htmlType, array('CheckBox', 'Multi-Select', 'AdvMulti-Select'))) {
$submitted[$key] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $mergeValue) . CRM_Core_DAO::VALUE_SEPARATOR;
} else {
$submitted[$key] = $mergeValue;
}
}
} elseif (in_array($htmlType, array('Multi-Select Country', 'Multi-Select State/Province'))) {
示例6: exportComponents
//.........这里部分代码省略.........
}
if (is_object($relDAO) && $relationField == 'id') {
$row[$field . $relationField] = $relDAO->contact_id;
} elseif (is_array($relationValue) && $relationField == 'location') {
foreach ($relationValue as $ltype => $val) {
foreach (array_keys($val) as $fld) {
$type = explode('-', $fld);
$fldValue = "{$ltype}-" . $type[0];
if (!empty($type[1])) {
$fldValue .= "-" . $type[1];
}
// CRM-3157: localise country, region (both have ‘country’ context)
// and state_province (‘province’ context)
switch (TRUE) {
case !is_object($relDAO):
$row[$field . '_' . $fldValue] = '';
break;
case in_array('country', $type):
case in_array('world_region', $type):
$row[$field . '_' . $fldValue] = $i18n->crm_translate($relDAO->{$fldValue}, array('context' => 'country'));
break;
case in_array('state_province', $type):
$row[$field . '_' . $fldValue] = $i18n->crm_translate($relDAO->{$fldValue}, array('context' => 'province'));
break;
default:
$row[$field . '_' . $fldValue] = $relDAO->{$fldValue};
break;
}
}
}
} elseif (isset($fieldValue) && $fieldValue != '') {
//check for custom data
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($relationField)) {
$row[$field . $relationField] = CRM_Core_BAO_CustomField::displayValue($fieldValue, $cfID);
} else {
//normal relationship fields
// CRM-3157: localise country, region (both have ‘country’ context) and state_province (‘province’ context)
switch ($relationField) {
case 'country':
case 'world_region':
$row[$field . $relationField] = $i18n->crm_translate($fieldValue, array('context' => 'country'));
break;
case 'state_province':
$row[$field . $relationField] = $i18n->crm_translate($fieldValue, array('context' => 'province'));
break;
default:
$row[$field . $relationField] = $fieldValue;
break;
}
}
} else {
// if relation field is empty or null
$row[$field . $relationField] = '';
}
}
} elseif (isset($fieldValue) && $fieldValue != '') {
//check for custom data
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($field)) {
$row[$field] = CRM_Core_BAO_CustomField::displayValue($fieldValue, $cfID);
} elseif (array_key_exists($field, $multipleSelectFields)) {
//option group fixes
$paramsNew = array($field => $fieldValue);
if ($field == 'test_tutoring') {
$name = array($field => array('newName' => $field, 'groupName' => 'test'));
// for readers group
} elseif (substr($field, 0, 4) == 'cmr_') {
示例7: moveAllBelongings
/**
* Based on the provided two contact_ids and a set of tables, move the belongings of the
* other contact to the main one - be it Location / CustomFields or Contact .. related info.
* A superset of moveContactBelongings() function.
*
* @param int $mainId
* Main contact with whom merge has to happen.
* @param int $otherId
* Duplicate contact which would be deleted after merge operation.
*
* @param $migrationInfo
*
* @param bool $checkPermissions
* Respect logged in user permissions.
*
* @return bool
*/
public static function moveAllBelongings($mainId, $otherId, $migrationInfo, $checkPermissions = TRUE)
{
if (empty($migrationInfo)) {
return FALSE;
}
$qfZeroBug = 'e8cddb72-a257-11dc-b9cc-0016d3330ee9';
$relTables = CRM_Dedupe_Merger::relTables();
$moveTables = $locationMigrationInfo = $tableOperations = array();
foreach ($migrationInfo as $key => $value) {
if ($value == $qfZeroBug) {
$value = '0';
}
if ((in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) || substr($key, 0, 12) == 'move_custom_') && $value != NULL) {
$submitted[substr($key, 5)] = $value;
} elseif (substr($key, 0, 14) == 'move_location_' and $value != NULL) {
$locationMigrationInfo[$key] = $value;
} elseif (substr($key, 0, 15) == 'move_rel_table_' and $value == '1') {
$moveTables = array_merge($moveTables, $relTables[substr($key, 5)]['tables']);
if (array_key_exists('operation', $migrationInfo)) {
foreach ($relTables[substr($key, 5)]['tables'] as $table) {
if (array_key_exists($key, $migrationInfo['operation'])) {
$tableOperations[$table] = $migrationInfo['operation'][$key];
}
}
}
}
}
self::mergeLocations($mainId, $otherId, $locationMigrationInfo, $migrationInfo);
// **** Do tables related migrations
if (!empty($moveTables)) {
CRM_Dedupe_Merger::moveContactBelongings($mainId, $otherId, $moveTables, $tableOperations);
unset($moveTables, $tableOperations);
}
// **** Do contact related migrations
CRM_Dedupe_Merger::moveContactBelongings($mainId, $otherId);
// FIXME: fix gender, prefix and postfix, so they're edible by createProfileContact()
$names['gender'] = array('newName' => 'gender_id', 'groupName' => 'gender');
$names['individual_prefix'] = array('newName' => 'prefix_id', 'groupName' => 'individual_prefix');
$names['individual_suffix'] = array('newName' => 'suffix_id', 'groupName' => 'individual_suffix');
$names['communication_style'] = array('newName' => 'communication_style_id', 'groupName' => 'communication_style');
$names['addressee'] = array('newName' => 'addressee_id', 'groupName' => 'addressee');
$names['email_greeting'] = array('newName' => 'email_greeting_id', 'groupName' => 'email_greeting');
$names['postal_greeting'] = array('newName' => 'postal_greeting_id', 'groupName' => 'postal_greeting');
CRM_Core_OptionGroup::lookupValues($submitted, $names, TRUE);
// fix custom fields so they're edible by createProfileContact()
static $treeCache = array();
if (!array_key_exists($migrationInfo['main_details']['contact_type'], $treeCache)) {
$treeCache[$migrationInfo['main_details']['contact_type']] = CRM_Core_BAO_CustomGroup::getTree($migrationInfo['main_details']['contact_type'], CRM_Core_DAO::$_nullObject, NULL, -1);
}
$cgTree =& $treeCache[$migrationInfo['main_details']['contact_type']];
$cFields = array();
foreach ($cgTree as $key => $group) {
if (!isset($group['fields'])) {
continue;
}
foreach ($group['fields'] as $fid => $field) {
$cFields[$fid]['attributes'] = $field;
}
}
if (!isset($submitted)) {
$submitted = array();
}
foreach ($submitted as $key => $value) {
if (substr($key, 0, 7) == 'custom_') {
$fid = (int) substr($key, 7);
if (empty($cFields[$fid])) {
continue;
}
$htmlType = $cFields[$fid]['attributes']['html_type'];
switch ($htmlType) {
case 'File':
$customFiles[] = $fid;
unset($submitted["custom_{$fid}"]);
break;
case 'Select Country':
case 'Select State/Province':
$submitted[$key] = CRM_Core_BAO_CustomField::displayValue($value, $fid);
break;
case 'Select Date':
if ($cFields[$fid]['attributes']['is_view']) {
$submitted[$key] = date('YmdHis', strtotime($submitted[$key]));
}
break;
//.........这里部分代码省略.........
示例8: where
/**
* Generate the where clause and also the english language equivalent.
*/
public function where()
{
foreach ($this->_ids as $id => $values) {
// Fixed for Issue CRM 607
if (CRM_Utils_Array::value($id, $this->_fields) === NULL || !$values) {
continue;
}
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
foreach ($values as $tuple) {
list($name, $op, $value, $grouping, $wildcard) = $tuple;
$field = $this->_fields[$id];
$fieldName = "{$field['table_name']}.{$field['column_name']}";
$isSerialized = CRM_Core_BAO_CustomField::isSerialized($field);
// fix $value here to escape sql injection attacks
$qillValue = NULL;
if (!is_array($value)) {
$value = CRM_Core_DAO::escapeString(trim($value));
$qillValue = CRM_Core_BAO_CustomField::displayValue($value, $id);
} elseif (count($value) && in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
$op = key($value);
$qillValue = strstr($op, 'NULL') ? NULL : CRM_Core_BAO_CustomField::displayValue($value[$op], $id);
} else {
$op = strstr($op, 'IN') ? $op : 'IN';
$qillValue = CRM_Core_BAO_CustomField::displayValue($value, $id);
}
$qillOp = CRM_Utils_Array::value($op, CRM_Core_SelectValues::getSearchBuilderOperators(), $op);
switch ($field['data_type']) {
case 'String':
case 'StateProvince':
case 'Country':
if ($field['is_search_range'] && is_array($value)) {
//didn't found any field under any of these three data-types as searchable by range
} else {
// fix $value here to escape sql injection attacks
if (!is_array($value)) {
if ($field['data_type'] == 'String') {
$value = CRM_Utils_Type::escape($strtolower($value), 'String');
} else {
$value = CRM_Utils_Type::escape($value, 'Integer');
}
} elseif ($isSerialized) {
if (in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
$op = key($value);
$value = $value[$op];
}
$value = implode(',', (array) $value);
}
// CRM-14563,CRM-16575 : Special handling of multi-select custom fields
if ($isSerialized && !empty($value) && !strstr($op, 'NULL') && !strstr($op, 'LIKE')) {
$sp = CRM_Core_DAO::VALUE_SEPARATOR;
if (strstr($op, 'IN')) {
$value = str_replace(",", "{$sp}|{$sp}", $value);
$value = str_replace('(', '[[.left-parenthesis.]]', $value);
$value = str_replace(')', '[[.right-parenthesis.]]', $value);
}
$op = strstr($op, '!') || strstr($op, 'NOT') ? 'NOT RLIKE' : 'RLIKE';
$value = $sp . $value . $sp;
if (!$wildcard) {
foreach (explode("|", $value) as $val) {
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $val, 'String');
}
} else {
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'String');
}
} else {
//FIX for custom data query fired against no value(NULL/NOT NULL)
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'String');
}
$this->_qill[$grouping][] = $field['label'] . " {$qillOp} {$qillValue}";
}
break;
case 'ContactReference':
$label = $value ? CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $value, 'sort_name') : '';
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'String');
$this->_qill[$grouping][] = $field['label'] . " {$qillOp} {$label}";
break;
case 'Int':
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'Integer');
$this->_qill[$grouping][] = ts("%1 %2 %3", array(1 => $field['label'], 2 => $qillOp, 3 => $qillValue));
break;
case 'Boolean':
if (!is_array($value)) {
if (strtolower($value) == 'yes' || strtolower($value) == strtolower(ts('Yes'))) {
$value = 1;
} else {
$value = (int) $value;
}
$value = $value == 1 ? 1 : 0;
$qillValue = $value ? 'Yes' : 'No';
}
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'Integer');
$this->_qill[$grouping][] = ts("%1 %2 %3", array(1 => $field['label'], 2 => $qillOp, 3 => $qillValue));
break;
case 'Link':
case 'Memo':
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'String');
$this->_qill[$grouping][] = ts("%1 %2 %3", array(1 => $field['label'], 2 => $qillOp, 3 => $qillValue));
//.........这里部分代码省略.........
示例9: buildBadges
/**
* Build badges parameters before actually creating badges.
*
* @param array $params
* Associated array of submitted values.
* @param CRM_Core_Form $form
*/
public static function buildBadges(&$params, &$form)
{
// get name badge layout info
$layoutInfo = CRM_Badge_BAO_Layout::buildLayout($params);
// split/get actual field names from token and individual contact image URLs
$returnProperties = array();
if (!empty($layoutInfo['data']['token'])) {
foreach ($layoutInfo['data']['token'] as $index => $value) {
$element = '';
if ($value) {
$token = CRM_Utils_Token::getTokens($value);
if (key($token) == 'contact') {
$element = $token['contact'][0];
} elseif (key($token) == 'event') {
$element = $token['event'][0];
//FIX ME - we need to standardize event token names
if (substr($element, 0, 6) != 'event_') {
$element = 'event_' . $element;
}
} elseif (key($token) == 'participant') {
$element = $token['participant'][0];
}
// build returnproperties for query
$returnProperties[$element] = 1;
}
// add actual field name to row element
$layoutInfo['data']['rowElements'][$index] = $element;
}
}
// add additional required fields for query execution
$additionalFields = array('participant_register_date', 'participant_id', 'event_id', 'contact_id', 'image_URL');
foreach ($additionalFields as $field) {
$returnProperties[$field] = 1;
}
if ($form->_single) {
$queryParams = NULL;
} else {
$queryParams = $form->get('queryParams');
}
$query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_EVENT);
list($select, $from, $where, $having) = $query->query();
if (empty($where)) {
$where = "WHERE {$form->_componentClause}";
} else {
$where .= " AND {$form->_componentClause}";
}
$sortOrder = NULL;
if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
$sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
if (!empty($sortOrder)) {
$sortOrder = " ORDER BY {$sortOrder}";
}
}
$queryString = "{$select} {$from} {$where} {$having} {$sortOrder}";
$dao = CRM_Core_DAO::executeQuery($queryString);
$rows = array();
while ($dao->fetch()) {
$query->convertToPseudoNames($dao);
$rows[$dao->participant_id] = array();
foreach ($returnProperties as $key => $dontCare) {
$value = isset($dao->{$key}) ? $dao->{$key} : NULL;
// Format custom fields
if (strstr($key, 'custom_') && isset($value)) {
$value = CRM_Core_BAO_CustomField::displayValue($value, substr($key, 7), $dao->contact_id);
}
$rows[$dao->participant_id][$key] = $value;
}
}
$eventBadgeClass = new CRM_Badge_BAO_Badge();
$eventBadgeClass->createLabels($rows, $layoutInfo);
}
示例10: displayProfile
//.........这里部分代码省略.........
$values[$index] = $roles[$params[$name]];
} elseif ('participant_status_id' == $name or 'participant_status' == $name) {
$status = CRM_Event_PseudoConstant::participantStatus();
$values[$index] = $status[$params[$name]];
} elseif (substr($name, -11) == 'campaign_id') {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($params[$name]);
$values[$index] = CRM_Utils_Array::value($params[$name], $campaigns);
} elseif (strpos($name, '-') !== FALSE) {
list($fieldName, $id) = CRM_Utils_System::explode('-', $name, 2);
$detailName = str_replace(' ', '_', $name);
if (in_array($fieldName, array('state_province', 'country', 'county'))) {
$values[$index] = $params[$detailName];
$idx = $detailName . '_id';
$values[$index] = $params[$idx];
} elseif ($fieldName == 'im') {
$providerName = NULL;
if ($providerId = $detailName . '-provider_id') {
$providerName = CRM_Utils_Array::value($params[$providerId], $imProviders);
}
if ($providerName) {
$values[$index] = $params[$detailName] . " (" . $providerName . ")";
} else {
$values[$index] = $params[$detailName];
}
} elseif ($fieldName == 'phone') {
$phoneExtField = str_replace('phone', 'phone_ext', $detailName);
if (isset($params[$phoneExtField])) {
$values[$index] = $params[$detailName] . " (" . $params[$phoneExtField] . ")";
} else {
$values[$index] = $params[$detailName];
}
} else {
$values[$index] = $params[$detailName];
}
} else {
if (substr($name, 0, 7) === 'do_not_' or substr($name, 0, 3) === 'is_') {
if ($params[$name]) {
$values[$index] = '[ x ]';
}
} else {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$query = "\nSELECT html_type, data_type\nFROM civicrm_custom_field\nWHERE id = {$cfID}\n";
$dao = CRM_Core_DAO::executeQuery($query);
$dao->fetch();
$htmlType = $dao->html_type;
if ($htmlType == 'File') {
$values[$index] = $params[$index];
} else {
if ($dao->data_type == 'Int' || $dao->data_type == 'Boolean') {
$v = $params[$name];
if (!CRM_Utils_System::isNull($v)) {
$customVal = (int) $v;
}
} elseif ($dao->data_type == 'Float') {
$customVal = (double) $params[$name];
} elseif ($dao->data_type == 'Date') {
//@todo note the currently we are using default date time formatting. Since you can select/set
// different date and time format specific to custom field we should consider fixing this
// sometime in the future
$customVal = $displayValue = CRM_Utils_Date::customFormat(CRM_Utils_Date::processDate($params[$name]), $config->dateformatFull);
if (!empty($params[$name . '_time'])) {
$customVal = $displayValue = CRM_Utils_Date::customFormat(CRM_Utils_Date::processDate($params[$name], $params[$name . '_time']), $config->dateformatDatetime);
}
$skip = TRUE;
} else {
$customVal = $params[$name];
}
//take the custom field options
$returnProperties = array($name => 1);
$query = new CRM_Contact_BAO_Query($params, $returnProperties, $fields);
if (!$skip) {
$displayValue = CRM_Core_BAO_CustomField::displayValue($customVal, $cfID);
}
//Hack since we dont have function to check empty.
//FIXME in 2.3 using crmIsEmptyArray()
$customValue = TRUE;
if (is_array($customVal) && is_array($displayValue)) {
$customValue = array_diff($customVal, $displayValue);
}
//use difference of arrays
if (empty($customValue) || !$customValue) {
$values[$index] = '';
} else {
$values[$index] = $displayValue;
}
}
} elseif ($name == 'home_URL' && !empty($params[$name])) {
$url = CRM_Utils_System::fixURL($params[$name]);
$values[$index] = "<a href=\"{$url}\">{$params[$name]}</a>";
} elseif (in_array($name, array('birth_date', 'deceased_date', 'participant_register_date'))) {
$values[$index] = CRM_Utils_Date::customFormat(CRM_Utils_Date::format($params[$name]));
} else {
$values[$index] = CRM_Utils_Array::value($name, $params);
}
}
}
$profileFields[$name] = $field;
}
}
}
示例11: array
//.........这里部分代码省略.........
} else {
$names[] = "{$locationTypeName}-{$fieldName}";
}
} else {
$names[] = $field['name'];
}
}
}
$names[] = "status";
} elseif (!empty($this->_returnProperties)) {
$names = self::makeProperties($this->_returnProperties);
} else {
$names = self::$_properties;
}
$multipleSelectFields = array('preferred_communication_method' => 1);
$links = self::links($this->_context, $this->_contextMenu, $this->_key);
//check explicitly added contact to a Smart Group.
$groupID = CRM_Utils_Array::value('group', $this->_formValues);
$pseudoconstants = array();
// for CRM-3157 purposes
if (in_array('world_region', $names)) {
$pseudoconstants['world_region'] = array('dbName' => 'worldregion_id', 'values' => CRM_Core_PseudoConstant::worldRegion());
}
$seenIDs = array();
while ($result->fetch()) {
$row = array();
$this->_query->convertToPseudoNames($result);
// the columns we are interested in
foreach ($names as $property) {
if ($property == 'status') {
continue;
}
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($property)) {
$row[$property] = CRM_Core_BAO_CustomField::displayValue($result->{$property}, $cfID, $result->contact_id);
} elseif ($multipleSelectFields && array_key_exists($property, $multipleSelectFields)) {
$key = $property;
$paramsNew = array($key => $result->{$property});
$name = array($key => array('newName' => $key, 'groupName' => $key));
CRM_Core_OptionGroup::lookupValues($paramsNew, $name, FALSE);
$row[$key] = $paramsNew[$key];
} elseif (strpos($property, '-im')) {
$row[$property] = $result->{$property};
if (!empty($result->{$property})) {
$imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
$providerId = $property . "-provider_id";
$providerName = $imProviders[$result->{$providerId}];
$row[$property] = $result->{$property} . " ({$providerName})";
}
} elseif (in_array($property, array('addressee', 'email_greeting', 'postal_greeting'))) {
$greeting = $property . '_display';
$row[$property] = $result->{$greeting};
} elseif (isset($pseudoconstants[$property])) {
$row[$property] = CRM_Utils_Array::value($result->{$pseudoconstants[$property]['dbName']}, $pseudoconstants[$property]['values']);
} elseif (strpos($property, '-url') !== FALSE) {
$websiteUrl = '';
$websiteKey = str_replace('-url', '', $property);
$propertyArray = explode('-', $property);
$websiteFld = $websiteKey . '-' . array_pop($propertyArray);
if (!empty($result->{$websiteFld})) {
$websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
$websiteType = $websiteTypes[$result->{"{$websiteKey}-website_type_id"}];
$websiteValue = $result->{$websiteFld};
$websiteUrl = "<a href=\"{$websiteValue}\">{$websiteValue} ({$websiteType})</a>";
}
$row[$property] = $websiteUrl;
} else {
示例12: browse
//.........这里部分代码省略.........
$fieldInput = $singleField;
}
$customGroupInfo = CRM_Core_BAO_CustomGroup::getGroupTitles($fieldInput);
$this->_customGroupTitle = $customGroupInfo[$fieldIdInput]['groupTitle'];
}
// $cgcount is defined before 'if' condition as enitiy may have no record
// and $cgcount is used to build new record url
$cgcount = 1;
if ($result && !empty($result)) {
$links = self::links();
if ($this->_pageViewType == 'profileDataView') {
$pageCheckSum = $this->get('pageCheckSum');
if ($pageCheckSum) {
foreach ($links as $key => $link) {
$links[$key] = $link['qs'] . "&cs=%%cs%%";
}
}
}
$linkAction = array_sum(array_keys($this->links()));
if ($reached) {
unset($links[CRM_Core_Action::COPY]);
}
$newCgCount = !$reached ? $resultCount + 1 : NULL;
if (!empty($DTparams)) {
$this->_total = $resultCount;
$cgcount = $DTparams['offset'] + 1;
}
foreach ($result as $recId => &$value) {
foreach ($value as $fieldId => &$val) {
if (is_numeric($fieldId)) {
$customValue =& $val;
if (!empty($dateFields) && array_key_exists($fieldId, $dateFields)) {
// formatted date capture value capture
$dateFieldsVals[$fieldId][$recId] = CRM_Core_BAO_CustomField::displayValue($customValue, $fieldId);
//set date and time format
switch ($timeFormat) {
case 1:
$dateFormat[1] = 'g:iA';
break;
case 2:
$dateFormat[1] = 'G:i';
break;
default:
// if time is not selected remove time from value
$result[$recId][$fieldId] = substr($result[$recId][$fieldId], 0, 10);
}
$result[$recId][$fieldId] = CRM_Utils_Date::processDate($result[$recId][$fieldId], NULL, FALSE, implode(" ", $dateFormat));
} else {
// assign to $result
$customValue = CRM_Core_BAO_CustomField::displayValue($customValue, $fieldId);
}
// Set field attributes to support crmEditable
// Note that $fieldAttributes[data-type] actually refers to the html type not the sql data type
// TODO: Not all widget types and validation rules are supported by crmEditable so some fields will not be in-place editable
$fieldAttributes = array('class' => "crmf-custom_{$fieldId}_{$recId}");
$editable = FALSE;
if (!$options[$fieldId]['attributes']['is_view'] && $linkAction & CRM_Core_Action::UPDATE) {
$spec = $options[$fieldId]['attributes'];
switch ($spec['html_type']) {
case 'Text':
// Other data types like money would require some extra validation
// FIXME: crmEditable currently does not support any validation rules :(
$supportedDataTypes = array('Float', 'String', 'Int');
$editable = in_array($spec['data_type'], $supportedDataTypes);
break;
case 'TextArea':
示例13: postProcess
//.........这里部分代码省略.........
$params[] = array(CRM_Core_Form::CB_PREFIX . $contactID, '=', 1, 0, 0);
}
// fix for CRM-2651
if (!empty($fv['do_not_mail'])) {
$params[] = array('do_not_mail', '=', 0, 0, 0);
}
// fix for CRM-2613
$params[] = array('is_deceased', '=', 0, 0, 0);
$custom = array();
foreach ($returnProperties as $name => $dontCare) {
$cfID = CRM_Core_BAO_CustomField::getKeyID($name);
if ($cfID) {
$custom[] = $cfID;
}
}
//get the total number of contacts to fetch from database.
$numberofContacts = count($this->_contactIds);
$query = new CRM_Contact_BAO_Query($params, $returnProperties);
$details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
$messageToken = CRM_Utils_Token::getTokens($mailingFormat);
// also get all token values
CRM_Utils_Hook::tokenValues($details[0], $this->_contactIds, NULL, $messageToken, 'CRM_Contact_Form_Task_Label');
$tokens = array();
CRM_Utils_Hook::tokens($tokens);
$tokenFields = array();
foreach ($tokens as $category => $catTokens) {
foreach ($catTokens as $token => $tokenName) {
$tokenFields[] = $token;
}
}
foreach ($this->_contactIds as $value) {
foreach ($custom as $cfID) {
if (isset($details[0][$value]["custom_{$cfID}"])) {
$details[0][$value]["custom_{$cfID}"] = CRM_Core_BAO_CustomField::displayValue($details[0][$value]["custom_{$cfID}"], $cfID);
}
}
$contact = CRM_Utils_Array::value($value, $details['0']);
if (is_a($contact, 'CRM_Core_Error')) {
return NULL;
}
// we need to remove all the "_id"
unset($contact['contact_id']);
if ($locName && !empty($contact[$locName])) {
// If location type is not primary, $contact contains
// one more array as "$contact[$locName] = array( values... )"
if (!self::tokenIsFound($contact, $mailingFormatProperties, $tokenFields)) {
continue;
}
$contact = array_merge($contact, $contact[$locName]);
unset($contact[$locName]);
if (!empty($contact['county_id'])) {
unset($contact['county_id']);
}
foreach ($contact as $field => $fieldValue) {
$rows[$value][$field] = $fieldValue;
}
$valuesothers = array();
$paramsothers = array('contact_id' => $value);
$valuesothers = CRM_Core_BAO_Location::getValues($paramsothers, $valuesothers);
if (!empty($fv['location_type_id'])) {
foreach ($valuesothers as $vals) {
if (CRM_Utils_Array::value('location_type_id', $vals) == CRM_Utils_Array::value('location_type_id', $fv)) {
foreach ($vals as $k => $v) {
if (in_array($k, array('email', 'phone', 'im', 'openid'))) {
if ($k == 'im') {
$rows[$value][$k] = $v['1']['name'];
示例14: getRows
/**
* Get the rows for the labels.
*
* @param $contactIDs
* @param int $locationTypeID
* @param bool $respectDoNotMail
* @param $mergeSameAddress
* @param bool $mergeSameHousehold
* UNUSED.
*
* @return array
* Array of rows for labels
*/
public static function getRows($contactIDs, $locationTypeID, $respectDoNotMail, $mergeSameAddress, $mergeSameHousehold)
{
$locName = NULL;
//get the address format sequence from the config file
$addressReturnProperties = CRM_Contact_Form_Task_LabelCommon::getAddressReturnProperties();
//build the return properties
$returnProperties = array('display_name' => 1, 'contact_type' => 1, 'prefix_id' => 1);
$mailingFormat = Civi::settings()->get('mailing_format');
$mailingFormatProperties = array();
if ($mailingFormat) {
$mailingFormatProperties = CRM_Utils_Token::getReturnProperties($mailingFormat);
$returnProperties = array_merge($returnProperties, $mailingFormatProperties);
}
$customFormatProperties = array();
if (stristr($mailingFormat, 'custom_')) {
foreach ($mailingFormatProperties as $token => $true) {
if (substr($token, 0, 7) == 'custom_') {
if (empty($customFormatProperties[$token])) {
$customFormatProperties[$token] = $mailingFormatProperties[$token];
}
}
}
}
$returnProperties = array_merge($returnProperties, $customFormatProperties);
if ($mergeSameAddress) {
// we need first name/last name for summarising to avoid spillage
$returnProperties['first_name'] = 1;
$returnProperties['last_name'] = 1;
}
//get the contacts information
$params = $custom = array();
foreach ($contactIDs as $key => $contactID) {
$params[] = array(CRM_Core_Form::CB_PREFIX . $contactID, '=', 1, 0, 0);
}
// fix for CRM-2651
if (!empty($respectDoNotMail['do_not_mail'])) {
$params[] = array('do_not_mail', '=', 0, 0, 0);
}
// fix for CRM-2613
$params[] = array('is_deceased', '=', 0, 0, 0);
if ($locationTypeID) {
$locType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$locName = $locType[$locationTypeID];
$location = array('location' => array("{$locName}" => $addressReturnProperties));
$returnProperties = array_merge($returnProperties, $location);
$params[] = array('location_type', '=', array($locationTypeID => 1), 0, 0);
} else {
$returnProperties = array_merge($returnProperties, $addressReturnProperties);
}
foreach ($returnProperties as $name) {
$cfID = CRM_Core_BAO_CustomField::getKeyID($name);
if ($cfID) {
$custom[] = $cfID;
}
}
//get the total number of contacts to fetch from database.
$numberofContacts = count($contactIDs);
//this does the same as calling civicrm_api3('contact, get, array('id' => array('IN' => $this->_contactIds)
// except it also handles multiple locations
$query = new CRM_Contact_BAO_Query($params, $returnProperties);
$details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
$messageToken = CRM_Utils_Token::getTokens($mailingFormat);
$details = $details[0];
$tokenFields = CRM_Contact_Form_Task_LabelCommon::getTokenData($details);
foreach ($contactIDs as $value) {
foreach ($custom as $cfID) {
if (isset($details[$value]["custom_{$cfID}"])) {
$details[$value]["custom_{$cfID}"] = CRM_Core_BAO_CustomField::displayValue($details[$value]["custom_{$cfID}"], $cfID);
}
}
$contact = CRM_Utils_Array::value($value, $details);
if (is_a($contact, 'CRM_Core_Error')) {
return NULL;
}
// we need to remove all the "_id"
unset($contact['contact_id']);
if ($locName && !empty($contact[$locName])) {
// If location type is not primary, $contact contains
// one more array as "$contact[$locName] = array( values... )"
if (!CRM_Contact_Form_Task_Label::tokenIsFound($contact, $mailingFormatProperties, $tokenFields)) {
continue;
}
unset($contact[$locName]);
if (!empty($contact['county_id'])) {
unset($contact['county_id']);
}
foreach ($contact as $field => $fieldValue) {
//.........这里部分代码省略.........
示例15: getValues
//.........这里部分代码省略.........
} else {
if (substr($name, 0, 7) === 'do_not_' || substr($name, 0, 3) === 'is_') {
if ($details->{$name}) {
$values[$index] = '[ x ]';
}
} else {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$htmlType = $field['html_type'];
// field_type is only set when we are retrieving profile values
// when sending email, we call the same function to get custom field
// values etc, i.e. emulating a profile
$fieldType = CRM_Utils_Array::value('field_type', $field);
if ($htmlType == 'File') {
$entityId = $cid;
if (!$cid && $fieldType == 'Activity' && !empty($componentWhere[0][2])) {
$entityId = $componentWhere[0][2];
}
$fileURL = CRM_Core_BAO_CustomField::getFileURL($entityId, $cfID, NULL, $absolute, $additionalWhereClause);
$params[$index] = $values[$index] = $fileURL['file_url'];
} else {
$customVal = NULL;
if (isset($dao) && property_exists($dao, 'data_type') && ($dao->data_type == 'Int' || $dao->data_type == 'Boolean')) {
$customVal = (int) $details->{$name};
} elseif (isset($dao) && property_exists($dao, 'data_type') && $dao->data_type == 'Float') {
$customVal = (double) $details->{$name};
} elseif (!CRM_Utils_System::isNull(explode(CRM_Core_DAO::VALUE_SEPARATOR, $details->{$name}))) {
$customVal = $details->{$name};
}
//CRM-4582
if (CRM_Utils_System::isNull($customVal)) {
continue;
}
$params[$index] = $customVal;
$values[$index] = CRM_Core_BAO_CustomField::displayValue($customVal, $cfID);
if ($field['data_type'] == 'ContactReference') {
$params[$index] = $values[$index];
}
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $cfID, 'is_search_range')) {
$customFieldName = "{$name}_from";
}
}
} elseif ($name == 'image_URL') {
list($width, $height) = getimagesize(CRM_Utils_String::unstupifyUrl($details->{$name}));
list($thumbWidth, $thumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($width, $height);
$image_URL = '<img src="' . $details->{$name} . '" height= ' . $thumbHeight . ' width= ' . $thumbWidth . ' />';
$values[$index] = "<a href='#' onclick='contactImagePopUp(\"{$details->{$name}}\", {$width}, {$height});'>{$image_URL}</a>";
} elseif (in_array($name, array('birth_date', 'deceased_date', 'membership_start_date', 'membership_end_date', 'join_date'))) {
$values[$index] = CRM_Utils_Date::customFormat($details->{$name});
$params[$index] = CRM_Utils_Date::isoToMysql($details->{$name});
} else {
$dao = '';
if ($index == 'Campaign') {
$dao = 'CRM_Campaign_DAO_Campaign';
} elseif ($index == 'Contribution Page') {
$dao = 'CRM_Contribute_DAO_ContributionPage';
}
if ($dao) {
$value = CRM_Core_DAO::getFieldValue($dao, $details->{$name}, 'title');
} else {
$value = $details->{$name};
}
$values[$index] = $value;
}
}
}
} elseif (strpos($name, '-') !== FALSE) {