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


PHP CRM_Activity_BAO_Activity::getActivityContact方法代码示例

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


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

示例1: array

 function &getActivity($clientID, $activityDAO, &$activityTypeInfo)
 {
     if (empty($this->_redactionStringRules)) {
         $this->_redactionStringRules = array();
     }
     $activity = array();
     $activity['fields'] = array();
     if ($clientID) {
         $clientID = CRM_Utils_Type::escape($clientID, 'Integer');
         if (!in_array($activityTypeInfo['name'], array('Email', 'Inbound Email'))) {
             $activity['editURL'] = CRM_Utils_System::url('civicrm/case/activity', "reset=1&cid={$clientID}&caseid={$activityDAO->caseID}&action=update&atype={$activityDAO->activity_type_id}&id={$activityDAO->id}");
         } else {
             $activity['editURL'] = '';
         }
         $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');
//.........这里部分代码省略.........
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:101,代码来源:Report.php


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