本文整理汇总了PHP中CRM_Case_BAO_Case::getCaseActivityQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_BAO_Case::getCaseActivityQuery方法的具体用法?PHP CRM_Case_BAO_Case::getCaseActivityQuery怎么用?PHP CRM_Case_BAO_Case::getCaseActivityQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_BAO_Case
的用法示例。
在下文中一共展示了CRM_Case_BAO_Case::getCaseActivityQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recentApplicationActivities
static function recentApplicationActivities($limit = 10)
{
$recentActivities = array();
$customTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', 'application_case', 'table_name', 'name');
//Retrieve top $limit(as total activity count) recent activities
$query = CRM_Case_BAO_Case::getCaseActivityQuery($type = 'any', NULL, $condition = "AND c_type.name = 'Application' AND t_act.desired_date <= CURRENT_TIMESTAMP ");
$query .= "LIMIT 0, {$limit}";
$query = str_replace('ORDER BY case_activity_date ASC', 'ORDER BY case_activity_date DESC', $query);
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$query = "SELECT vacancy_id FROM {$customTableName} WHERE entity_id = {$dao->case_id}";
$ctDAO = CRM_Core_DAO::executeQuery($query);
$ctDAO->fetch();
$vacancyDAO = new self();
$vacancyDAO->id = $ctDAO->vacancy_id;
$vacancyDAO->find(TRUE);
//Applicant contact link
$applicant = "<a href='" . CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$dao->contact_id}") . "'>{$dao->sort_name}</a>";
//Position link
$position = "<a href='" . CRM_Utils_System::url('civicrm/case/pipeline', "reset=1&vid={$vacancyDAO->id}") . "'>{$vacancyDAO->position}</a>";
//Case Activity Source link
$sourceID = civicrm_api3('OptionValue', 'getvalue', array('option_group_id' => 'activity_contacts', 'name' => 'Activity Source', 'return' => 'value'));
$sourceContact = CRM_Activity_BAO_ActivityContact::getNames($dao->case_activity_id, $sourceID);
$sourceContactID = key($sourceContact);
$source = "<a href='" . CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$sourceContactID}") . "'>{$sourceContact[$sourceContactID]}</a>";
switch ($dao->case_activity_type_name) {
case 'Open Case':
$recentActivities[] = array('activity' => "{$applicant} applied for {$position}", 'time' => $dao->case_activity_date);
break;
case 'Comment':
$recentActivities[] = array('activity' => "{$source} commented on {$position}", 'time' => $dao->case_activity_date);
break;
case 'Phone Call':
case 'Meeting':
case 'Follow up':
$recentActivities[] = array('activity' => "{$source} had a {$dao->case_activity_type_name} with {$applicant} (vis-a-vis {$position})", 'time' => $dao->case_activity_date);
break;
case 'Email':
$recentActivities[] = array('activity' => "{$source} sent email to {$applicant}", 'time' => $dao->case_activity_date);
break;
case 'Change Case Status':
$subject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $dao->case_activity_id, 'subject');
$subject = str_replace('Assignment status changed', '', $subject);
$recentActivities[] = array('activity' => "{$source} changed the status of {$position} {$subject}", 'time' => $dao->case_activity_date);
break;
case 'Evaluation':
$subject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $dao->case_activity_id, 'subject');
$recentActivities[] = array('activity' => "{$source} evaluated {$applicant} for {$position}", 'time' => $dao->case_activity_date);
break;
default:
$subject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $dao->case_activity_id, 'subject');
$recentActivities[] = array('activity' => "{$position}: {$dao->case_activity_type_name} for {$applicant}", 'time' => $dao->case_activity_date);
break;
}
}
return $recentActivities;
}