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


PHP CRM_Utils_String::stripAlternatives方法代码示例

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


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

示例1: array


//.........这里部分代码省略.........
         $client = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'display_name');
         // add Client SortName as well as Display to the strings to be redacted across the case session
         // suffixed with a randomly generated 4-digit number
         if (!array_key_exists($client, $this->_redactionStringRules)) {
             $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, array($client => 'name_' . rand(10000, 100000)));
             $clientSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $clientID, 'sort_name');
             if (!array_key_exists($clientSortName, $this->_redactionStringRules)) {
                 $this->_redactionStringRules[$clientSortName] = $this->_redactionStringRules[$client];
             }
         }
         $activity['fields'][] = array('label' => 'Client', 'value' => $this->redact($client), 'type' => 'String');
     }
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
     if (!empty($activityDAO->targetID)) {
         // Re-lookup the target ID since the DAO only has the first recipient if there are multiple.
         // Maybe not the best solution.
         $targetNames = CRM_Activity_BAO_ActivityContact::getNames($activityDAO->id, $targetID);
         $processTarget = FALSE;
         $label = ts('With Contact(s)');
         if (in_array($activityTypeInfo['name'], array('Email', 'Inbound Email'))) {
             $processTarget = TRUE;
             $label = ts('Recipient');
         }
         if (!$processTarget) {
             foreach ($targetNames as $targetID => $targetName) {
                 if ($targetID != $clientID) {
                     $processTarget = TRUE;
                     break;
                 }
             }
         }
         if ($processTarget) {
             $targetRedacted = array();
             foreach ($targetNames as $targetID => $target) {
                 // add Recipient SortName as well as Display to the strings to be redacted across the case session
                 // suffixed with a randomly generated 4-digit number
                 if (!array_key_exists($target, $this->_redactionStringRules)) {
                     $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, array($target => 'name_' . rand(10000, 100000)));
                     $targetSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $targetID, 'sort_name');
                     if (!array_key_exists($targetSortName, $this->_redactionStringRules)) {
                         $this->_redactionStringRules[$targetSortName] = $this->_redactionStringRules[$target];
                     }
                 }
                 $targetRedacted[] = $this->redact($target);
             }
             $activity['fields'][] = array('label' => $label, 'value' => implode('; ', $targetRedacted), 'type' => 'String');
         }
     }
     // Activity Type info is a special field
     $activity['fields'][] = array('label' => ts('Activity Type'), 'value' => $activityTypeInfo['label'], 'type' => 'String');
     $activity['fields'][] = array('label' => ts('Subject'), 'value' => htmlspecialchars($this->redact($activityDAO->subject)), 'type' => 'Memo');
     $creator = $this->getCreatedBy($activityDAO->id);
     // add Creator to the strings to be redacted across the case session
     if (!array_key_exists($creator, $this->_redactionStringRules)) {
         $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, array($creator => 'name_' . rand(10000, 100000)));
     }
     $activity['fields'][] = array('label' => ts('Created By'), 'value' => $this->redact($creator), 'type' => 'String');
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
     $source_contact_id = CRM_Activity_BAO_Activity::getActivityContact($activityDAO->id, $sourceID);
     $reporter = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $source_contact_id, 'display_name');
     // add Reporter SortName as well as Display to the strings to be redacted across the case session
     // suffixed with a randomly generated 4-digit number
     if (!array_key_exists($reporter, $this->_redactionStringRules)) {
         $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, array($reporter => 'name_' . rand(10000, 100000)));
         $reporterSortName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $source_contact_id, 'sort_name');
         if (!array_key_exists($reporterSortName, $this->_redactionStringRules)) {
             $this->_redactionStringRules[$reporterSortName] = $this->_redactionStringRules[$reporter];
         }
     }
     $activity['fields'][] = array('label' => ts('Reported By'), 'value' => $this->redact($reporter), 'type' => 'String');
     if (!empty($activityDAO->assigneeID)) {
         //allow multiple assignee contacts.CRM-4503.
         $assignee_contact_names = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(array($activityDAO->id), TRUE);
         foreach ($assignee_contact_names as &$assignee) {
             // add Assignee to the strings to be redacted across the case session
             $this->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($this->_redactionStringRules, array($assignee => 'name_' . rand(10000, 100000)));
             $assignee = $this->redact($assignee);
         }
         $assigneeContacts = implode(', ', $assignee_contact_names);
         $activity['fields'][] = array('label' => ts('Assigned To'), 'value' => $assigneeContacts, 'type' => 'String');
     }
     if ($activityDAO->medium_id) {
         $activity['fields'][] = array('label' => ts('Medium'), 'value' => CRM_Core_OptionGroup::getLabel('encounter_medium', $activityDAO->medium_id, FALSE), 'type' => 'String');
     }
     $activity['fields'][] = array('label' => ts('Location'), 'value' => $activityDAO->location, 'type' => 'String');
     $activity['fields'][] = array('label' => ts('Date and Time'), 'value' => $activityDAO->activity_date_time, 'type' => 'Date');
     $activity['fields'][] = array('label' => ts('Details'), 'value' => $this->redact(CRM_Utils_String::stripAlternatives($activityDAO->details)), 'type' => 'Memo');
     // Skip Duration field if empty (to avoid " minutes" output). Might want to do this for all fields at some point. dgg
     if ($activityDAO->duration) {
         $activity['fields'][] = array('label' => ts('Duration'), 'value' => $activityDAO->duration . ' ' . ts('minutes'), 'type' => 'Int');
     }
     $activity['fields'][] = array('label' => ts('Status'), 'value' => CRM_Core_OptionGroup::getLabel('activity_status', $activityDAO->status_id), 'type' => 'String');
     $activity['fields'][] = array('label' => ts('Priority'), 'value' => CRM_Core_OptionGroup::getLabel('priority', $activityDAO->priority_id), 'type' => 'String');
     //for now empty custom groups
     $activity['customGroups'] = $this->getCustomData($clientID, $activityDAO, $activityTypeInfo);
     return $activity;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:101,代码来源:Report.php

示例2: smarty_modifier_crmStripAlternatives

/**
 * Given an ezComponents-parsed representation of
 * a text with alternatives return only the first one
 *
 * @param string $full
 *   All alternatives as a long string (or some other text).
 *
 * @return string
 *   only the first alternative found (or the text without alternatives)
 */
function smarty_modifier_crmStripAlternatives($full)
{
    return CRM_Utils_String::stripAlternatives($full);
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:14,代码来源:modifier.crmStripAlternatives.php

示例3: smarty_modifier_crmStripAlternatives

/**
 * Given an ezComponents-parsed representation of
 * a text with alternatives return only the first one
 *
 * @param string $full  all alternatives as a long string (or some other text)
 *
 * @return string       only the first alternative found (or the text without alternatives)
 */
function smarty_modifier_crmStripAlternatives($full)
{
    require_once 'CRM/Utils/String.php';
    return CRM_Utils_String::stripAlternatives($full);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:13,代码来源:modifier.crmStripAlternatives.php


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