本文整理汇总了PHP中CRM_Utils_System::fixURL方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::fixURL方法的具体用法?PHP CRM_Utils_System::fixURL怎么用?PHP CRM_Utils_System::fixURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::fixURL方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayProfile
//.........这里部分代码省略.........
if ($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];
}
} 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 {
require_once 'CRM/Core/BAO/CustomField.php';
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, CRM_Core_DAO::$_nullArray);
$dao->fetch();
$htmlType = $dao->html_type;
$dataType = $dao->data_type;
if ($htmlType == 'File') {
//$fileURL = CRM_Core_BAO_CustomField::getFileURL( $contactID, $cfID );
//$params[$index] = $values[$index] = $fileURL['file_url'];
$values[$index] = $params[$index];
} else {
if ($dao->data_type == 'Int' || $dao->data_type == 'Boolean') {
$customVal = (int) $params[$name];
} else {
if ($dao->data_type == 'Float') {
$customVal = (double) $params[$name];
} else {
if ($dao->data_type == 'Date') {
$date = CRM_Utils_Date::format($params[$name], null, 'invalidDate');
if ($date != 'invalidDate') {
$customVal = $date;
}
} else {
$customVal = $params[$name];
}
}
}
//take the custom field options
$returnProperties = array($name => 1);
require_once 'CRM/Contact/BAO/Query.php';
$query = new CRM_Contact_BAO_Query($params, $returnProperties, $fields);
$options =& $query->_options;
$displayValue = CRM_Core_BAO_CustomField::getDisplayValue($customVal, $cfID, $options);
//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;
}
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $cfID, 'is_search_range')) {
$customFieldName = "{$name}_from";
}
}
} else {
if ($name == 'home_URL' && !empty($params[$name])) {
$url = CRM_Utils_System::fixURL($params[$name]);
$values[$index] = "<a href=\"{$url}\">{$params[$name]}</a>";
} else {
if (in_array($name, array('birth_date', 'deceased_date', 'participant_register_date'))) {
require_once 'CRM/Utils/Date.php';
$values[$index] = CRM_Utils_Date::customFormat(CRM_Utils_Date::format($params[$name]));
} else {
$values[$index] = $params[$name];
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
示例2: displayProfile
//.........这里部分代码省略.........
} 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);
$options =& $query->_options;
if (!$skip) {
$displayValue = CRM_Core_BAO_CustomField::getDisplayValue($customVal, $cfID, $options);
}
//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] = $params[$name];
}
}
}
$profileFields[$name] = $field;
}
}
}
示例3: getValues
//.........这里部分代码省略.........
if ($id == 'Primary') {
// fix for CRM-1543
// not sure why we'd every use Primary location type id
// we need to fix the source if we are using it
// $locationTypeName = CRM_Contact_BAO_Contact::getPrimaryLocationType( $cid );
$locationTypeName = 1;
} else {
$locationTypeName = CRM_Utils_Array::value($id, $locationTypes);
}
if (!$locationTypeName) {
continue;
}
$detailName = "{$locationTypeName}-{$fieldName}";
$detailName = str_replace(' ', '_', $detailName);
if (in_array($fieldName, array('phone', 'im', 'email', 'openid'))) {
if ($type) {
$detailName .= "-{$type}";
}
}
if (in_array($fieldName, array('state_province', 'country', 'county'))) {
$values[$index] = $details->{$detailName};
$idx = $detailName . '_id';
$params[$index] = $details->{$idx};
} elseif ($fieldName == 'im') {
$providerId = $detailName . '-provider_id';
if (isset($imProviders[$details->{$providerId}])) {
$values[$index] = $details->{$detailName} . " (" . $imProviders[$details->{$providerId}] . ")";
} else {
$values[$index] = $details->{$detailName};
}
$params[$index] = $details->{$detailName};
} elseif ($fieldName == 'phone') {
$phoneExtField = str_replace('phone', 'phone_ext', $detailName);
if (isset($details->{$phoneExtField})) {
$values[$index] = $details->{$detailName} . " (" . $details->{$phoneExtField} . ")";
} else {
$values[$index] = $details->{$detailName};
}
$params[$index] = $details->{$detailName};
} else {
$values[$index] = $params[$index] = $details->{$detailName};
}
} else {
$detailName = "website-{$id}-{$fieldName}";
$url = CRM_Utils_System::fixURL($details->{$detailName});
if ($details->{$detailName}) {
$websiteTypeId = "website-{$id}-website_type_id";
$websiteType = $websiteTypes[$details->{$websiteTypeId}];
$values[$index] = "<a href=\"{$url}\">{$details->{$detailName}} ( {$websiteType} )</a>";
} else {
$values[$index] = '';
}
}
}
if (CRM_Utils_Array::value('visibility', $field) == 'Public Pages and Listings' && CRM_Core_Permission::check('profile listings and forms')) {
if (CRM_Utils_System::isNull($params[$index])) {
$params[$index] = $values[$index];
}
if (!isset($params[$index])) {
continue;
}
if (!$customFieldName) {
$fieldName = $field['name'];
} else {
$fieldName = $customFieldName;
}
$url = NULL;
if (CRM_Core_BAO_CustomField::getKeyID($field['name'])) {
$htmlType = $field['html_type'];
if ($htmlType == 'Link') {
$url = $params[$index];
} elseif (in_array($htmlType, array('CheckBox', 'Multi-Select', 'AdvMulti-Select', 'Multi-Select State/Province', 'Multi-Select Country'))) {
$valSeperator = CRM_Core_DAO::VALUE_SEPARATOR;
$selectedOptions = explode($valSeperator, $params[$index]);
foreach ($selectedOptions as $key => $multiOption) {
if ($multiOption) {
$url[] = CRM_Utils_System::url('civicrm/profile', 'reset=1&force=1&gid=' . $field['group_id'] . '&' . urlencode($fieldName) . '=' . urlencode($multiOption));
}
}
} else {
$url = CRM_Utils_System::url('civicrm/profile', 'reset=1&force=1&gid=' . $field['group_id'] . '&' . urlencode($fieldName) . '=' . urlencode($params[$index]));
}
} else {
$url = CRM_Utils_System::url('civicrm/profile', 'reset=1&force=1&gid=' . $field['group_id'] . '&' . urlencode($fieldName) . '=' . urlencode($params[$index]));
}
if ($url && !empty($values[$index]) && $searchable) {
if (is_array($url) && !empty($url)) {
$links = array();
$eachMultiValue = explode(', ', $values[$index]);
foreach ($eachMultiValue as $key => $valueLabel) {
$links[] = '<a href="' . $url[$key] . '">' . $valueLabel . '</a>';
}
$values[$index] = implode(', ', $links);
} else {
$values[$index] = '<a href="' . $url . '">' . $values[$index] . '</a>';
}
}
}
}
}
示例4: array
//.........这里部分代码省略.........
$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::getDisplayValue($result->{$name}, $cfID, $this->_options, $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'))) {
$dname = $name . '_display';
$row[] = $result->{$dname};
示例5: getValues
//.........这里部分代码省略.........
$htmlType = $field['html_type'];
$dataType = $field['data_type'];
if ($htmlType == 'File') {
$fileURL = CRM_Core_BAO_CustomField::getFileURL($cid, $cfID);
$params[$index] = $values[$index] = $fileURL['file_url'];
} else {
$customVal = null;
if (isset($dao) && ($dao->data_type == 'Int' || $dao->data_type == 'Boolean')) {
$customVal = (int) $details->{$name};
} else {
if (isset($dao) && $dao->data_type == 'Float') {
$customVal = (double) $details->{$name};
} else {
if (!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::getDisplayValue($customVal, $cfID, $options);
if ($htmlType == 'Autocomplete-Select') {
$params[$index] = $values[$index];
}
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $cfID, 'is_search_range')) {
$customFieldName = "{$name}_from";
}
}
} else {
if ($name == 'home_URL' && !empty($details->{$name})) {
$url = CRM_Utils_System::fixURL($details->{$name});
$values[$index] = "<a href=\"{$url}\">{$details->{$name}}</a>";
} else {
if (in_array($name, array('birth_date', 'deceased_date', 'membership_start_date', 'membership_end_date', 'join_date'))) {
require_once 'CRM/Utils/Date.php';
$values[$index] = CRM_Utils_Date::customFormat($details->{$name});
$params[$index] = CRM_Utils_Date::isoToMysql($details->{$name});
} else {
$values[$index] = $details->{$name};
}
}
}
}
}
}
}
}
}
}
}
}
} else {
if (strpos($name, '-') !== false) {
list($fieldName, $id, $type) = CRM_Utils_System::explode('-', $name, 3);
if ($id == 'Primary') {
// fix for CRM-1543
// not sure why we'd every use Primary location type id
// we need to fix the source if we are using it
// $locationTypeName = CRM_Contact_BAO_Contact::getPrimaryLocationType( $cid );
$locationTypeName = 1;
} else {
$locationTypeName = CRM_Utils_Array::value($id, $locationTypes);
}
示例6: array
//.........这里部分代码省略.........
$names[] = 'contact_id';
} else {
$names[] = $field['name'];
}
}
}
}
require_once "CRM/Core/OptionGroup.php";
$multipleSelectFields = array('preferred_communication_method' => 1);
if (CRM_Core_Permission::access('Quest')) {
require_once 'CRM/Quest/BAO/Student.php';
$multipleSelectFields = CRM_Quest_BAO_Student::$multipleSelectFields;
}
if ($this->_linkToUF) {
require_once 'api/UFGroup.php';
}
require_once 'CRM/Contact/BAO/Contact/Utils.php';
while ($result->fetch()) {
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);
if ($result->sort_name) {
$row['sort_name'] = $result->sort_name;
$empty = false;
} else {
continue;
}
foreach ($names as $name) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$row[] = CRM_Core_BAO_CustomField::getDisplayValue($result->{$name}, $cfID, $this->_options, $result->contact_id);
} else {
if ($name == 'home_URL' && !empty($result->{$name})) {
$url = CRM_Utils_System::fixURL($result->{$name});
$row[] = "<a href=\"{$url}\">{$result->{$name}}</a>";
} else {
if ($multipleSelectFields && array_key_exists($name, $multipleSelectFields)) {
//fix to display student checkboxes
$key = $name;
$paramsNew = array($key => $result->{$name});
if ($key == 'test_tutoring') {
$name = array($key => array('newName' => $key, 'groupName' => 'test'));
} else {
if (substr($key, 0, 4) == 'cmr_') {
//for readers group
$name = array($key => array('newName' => $key, 'groupName' => substr($key, 0, -3)));
} else {
$name = array($key => array('newName' => $key, 'groupName' => $key));
}
}
CRM_Core_OptionGroup::lookupValues($paramsNew, $name, false);
$row[] = $paramsNew[$key];
} else {
if (strpos($name, '-im')) {
if (!empty($result->{$name})) {
$imProviders = CRM_Core_PseudoConstant::IMProvider();
$providerId = $name . "-provider_id";
$providerName = $imProviders[$result->{$providerId}];
$row[] = $result->{$name} . " ({$providerName})";
} else {
$row[] = '';
}
} elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting'))) {
$dname = $name . '_display';
$row[] = $result->{$dname};
} elseif (in_array($name, array('birth_date', 'deceased_date'))) {
$row[] = CRM_Utils_Date::customFormat($result->{$name});
} elseif (isset($result->{$name})) {
$row[] = $result->{$name};
} else {
$row[] = '';
}
}
}
}
if (!empty($result->{$name})) {
$empty = false;
}
}
$newLinks = $links;
$params = array('id' => $result->contact_id, 'gid' => $this->_gid);
if ($this->_linkToUF) {
$ufID = crm_uf_get_uf_id($result->contact_id);
if (!$ufID) {
unset($newLinks[CRM_Core_Action::PROFILE]);
} else {
$params['ufID'] = $ufID;
}
}
$row[] = CRM_Core_Action::formLink($newLinks, $mask, $params);
if (!$empty) {
$rows[] = $row;
}
}
return $rows;
}