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


PHP CRM_Case_XMLProcessor_Process::getRedactActivityEmail方法代码示例

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


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

示例1: sendActivityCopy

 /**
  * Function that sends e-mail copy of activity
  *
  * @param $clientId
  * @param int $activityId activity Id
  * @param array $contacts array of related contact
  *
  * @param null $attachments
  * @param $caseId
  *
  * @return void
  * @access public
  */
 static function sendActivityCopy($clientId, $activityId, $contacts, $attachments = NULL, $caseId)
 {
     if (!$activityId) {
         return;
     }
     $tplParams = $activityInfo = array();
     //if its a case activity
     if ($caseId) {
         $activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityId, 'activity_type_id');
         $nonCaseActivityTypes = CRM_Core_PseudoConstant::activityType();
         if (!empty($nonCaseActivityTypes[$activityTypeId])) {
             $anyActivity = TRUE;
         } else {
             $anyActivity = FALSE;
         }
         $tplParams['isCaseActivity'] = 1;
         $tplParams['client_id'] = $clientId;
     } else {
         $anyActivity = TRUE;
     }
     $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
     $isRedact = $xmlProcessorProcess->getRedactActivityEmail();
     $xmlProcessorReport = new CRM_Case_XMLProcessor_Report();
     $activityInfo = $xmlProcessorReport->getActivityInfo($clientId, $activityId, $anyActivity, $isRedact);
     if ($caseId) {
         $activityInfo['fields'][] = array('label' => 'Case ID', 'type' => 'String', 'value' => $caseId);
     }
     $tplParams['activity'] = $activityInfo;
     foreach ($tplParams['activity']['fields'] as $k => $val) {
         if (CRM_Utils_Array::value('label', $val) == ts('Subject')) {
             $activitySubject = $val['value'];
             break;
         }
     }
     $session = CRM_Core_Session::singleton();
     // CRM-8926 If user is not logged in, use the activity creator as userID
     if (!($userID = $session->get('userID'))) {
         $userID = CRM_Activity_BAO_Activity::getSourceContactID($activityId);
     }
     //also create activities simultaneously of this copy.
     $activityParams = array();
     $activityParams['source_record_id'] = $activityId;
     $activityParams['source_contact_id'] = $userID;
     $activityParams['activity_type_id'] = CRM_Core_OptionGroup::getValue('activity_type', 'Email', 'name');
     $activityParams['activity_date_time'] = date('YmdHis');
     $activityParams['status_id'] = CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
     $activityParams['medium_id'] = CRM_Core_OptionGroup::getValue('encounter_medium', 'email', 'name');
     $activityParams['case_id'] = $caseId;
     $activityParams['is_auto'] = 0;
     $activityParams['target_id'] = $clientId;
     $tplParams['activitySubject'] = $activitySubject;
     // if it’s a case activity, add hashed id to the template (CRM-5916)
     if ($caseId) {
         $tplParams['idHash'] = substr(sha1(CIVICRM_SITE_KEY . $caseId), 0, 7);
     }
     $result = array();
     list($name, $address) = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
     $receiptFrom = "{$name} <{$address}>";
     $recordedActivityParams = array();
     foreach ($contacts as $mail => $info) {
         $tplParams['contact'] = $info;
         self::buildPermissionLinks($tplParams, $activityParams);
         $displayName = CRM_Utils_Array::value('display_name', $info);
         list($result[CRM_Utils_Array::value('contact_id', $info)], $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(array('groupName' => 'msg_tpl_workflow_case', 'valueName' => 'case_activity', 'contactId' => CRM_Utils_Array::value('contact_id', $info), 'tplParams' => $tplParams, 'from' => $receiptFrom, 'toName' => $displayName, 'toEmail' => $mail, 'attachments' => $attachments));
         $activityParams['subject'] = $activitySubject . ' - copy sent to ' . $displayName;
         $activityParams['details'] = $message;
         if (!empty($result[$info['contact_id']])) {
             /*
              * Really only need to record one activity with all the targets combined.
              * Originally the template was going to possibly have different content, e.g. depending on permissions,
              * but it's always the same content at the moment.
              */
             if (empty($recordedActivityParams)) {
                 $recordedActivityParams = $activityParams;
             } else {
                 $recordedActivityParams['subject'] .= "; {$displayName}";
             }
             $recordedActivityParams['target_contact_id'][] = $info['contact_id'];
         } else {
             unset($result[CRM_Utils_Array::value('contact_id', $info)]);
         }
     }
     if (!empty($recordedActivityParams)) {
         $activity = CRM_Activity_BAO_Activity::create($recordedActivityParams);
         //create case_activity record if its case activity.
         if ($caseId) {
             $caseParams = array('activity_id' => $activity->id, 'case_id' => $caseId);
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:Case.php


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