本文整理汇总了PHP中CRM_Case_BAO_Case::getContactCases方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_BAO_Case::getContactCases方法的具体用法?PHP CRM_Case_BAO_Case::getContactCases怎么用?PHP CRM_Case_BAO_Case::getContactCases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_BAO_Case
的用法示例。
在下文中一共展示了CRM_Case_BAO_Case::getContactCases方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetContactCases
public function testGetContactCases()
{
$cases = CRM_Case_BAO_Case::getContactCases(3);
$this->assertEquals('Housing Support', $cases[1]['case_type']);
}
示例2: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
//this call is for show related cases.
if ($this->_showRelatedCases) {
return;
}
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js')->addScriptFile('civicrm', 'templates/CRM/Case/Form/CaseView.js');
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$caseRoles = $xmlProcessor->get($this->_caseType, 'CaseRoles');
$reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
//adding case manager.CRM-4510.
$managerRoleId = $xmlProcessor->getCaseManagerRoleId($this->_caseType);
if (!empty($managerRoleId)) {
$caseRoles[$managerRoleId] = $caseRoles[$managerRoleId] . '<br />' . '(' . ts('Case Manager') . ')';
}
$aTypes = $xmlProcessor->get($this->_caseType, 'ActivityTypes', TRUE);
$allActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name');
$emailActivityType = array_search('Email', $allActTypes);
$pdfActivityType = array_search('Print PDF Letter', $allActTypes);
// remove Open Case activity type since we're inside an existing case
if ($openActTypeId = array_search('Open Case', $allActTypes)) {
unset($aTypes[$openActTypeId]);
}
//check for link cases.
$unclosedCases = CRM_Case_BAO_Case::getUnclosedCases(NULL, array($this->_caseID));
if (empty($unclosedCases) && ($linkActTypeId = array_search('Link Cases', $allActTypes))) {
unset($aTypes[$linkActTypeId]);
}
if (!$xmlProcessor->getNaturalActivityTypeSort()) {
asort($aTypes);
}
$activityLinks = array('' => ts('Add Activity'));
foreach ($aTypes as $type => $label) {
if ($type == $emailActivityType) {
$url = CRM_Utils_System::url('civicrm/activity/email/add', "action=add&context=standalone&reset=1&caseid={$this->_caseID}&atype={$type}", FALSE, NULL, FALSE);
} else {
if ($type == $pdfActivityType) {
$url = CRM_Utils_System::url('civicrm/activity/pdf/add', "action=add&context=standalone&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype={$type}", FALSE, NULL, FALSE);
} else {
$url = CRM_Utils_System::url('civicrm/case/activity', "action=add&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype={$type}", FALSE, NULL, FALSE);
}
}
$activityLinks[$url] = $label;
}
$this->add('select', 'add_activity_type_id', '', $activityLinks, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-plus twenty'));
if ($this->_hasAccessToAllCases) {
$this->add('select', 'report_id', '', array('' => ts('Activity Audit')) + $reports, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-clipboard'));
$this->add('select', 'timeline_id', '', array('' => ts('Add Timeline')) + $reports, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-play'));
}
$this->addElement('submit', $this->getButtonName('next'), ' ', array('class' => 'hiddenElement'));
if ($this->_mergeCases) {
$allCases = CRM_Case_BAO_Case::getContactCases($this->_contactID);
$otherCases = array();
foreach ($allCases as $caseId => $details) {
//filter current and own cases.
if ($caseId == $this->_caseID || !$this->_hasAccessToAllCases && !array_key_exists($caseId, $this->_userCases)) {
continue;
}
$otherCases[$caseId] = 'Case ID: ' . $caseId . ' Type: ' . $details['case_type'] . ' Start: ' . $details['case_start_date'];
}
if (empty($otherCases)) {
$this->_mergeCases = FALSE;
$this->assign('mergeCases', $this->_mergeCases);
} else {
$this->add('select', 'merge_case_id', ts('Select Case for Merge'), array('' => ts('- select case -')) + $otherCases, FALSE, array('class' => 'crm-select2 huge'));
$this->addElement('submit', $this->getButtonName('next', 'merge_case'), ts('Merge'), array('class' => 'crm-form-submit-inline hiddenElement'));
}
}
//call activity form
self::activityForm($this);
//get case related relationships (Case Role)
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($this->_contactID, $this->_caseID);
//save special label because we unset it in the loop
$managerLabel = empty($managerRoleId) ? '' : $caseRoles[$managerRoleId];
foreach ($caseRelationships as $key => &$value) {
if (!empty($managerRoleId)) {
if ($managerRoleId == $value['relation_type']) {
$value['relation'] = $managerLabel;
}
}
//calculate roles that don't have relationships
if (!empty($caseRoles[$value['relation_type']])) {
unset($caseRoles[$value['relation_type']]);
}
}
$this->assign('caseRelationships', $caseRelationships);
//also add client as role. CRM-4438
$caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($this->_caseID);
$this->assign('caseRoles', $caseRoles);
// Retrieve ALL client relationships
$relClient = CRM_Contact_BAO_Relationship::getRelationship($this->_contactID, CRM_Contact_BAO_Relationship::CURRENT, 0, 0, 0, NULL, NULL, FALSE);
// Now build 'Other Relationships' array by removing relationships that are already listed under Case Roles
// so they don't show up twice.
$clientRelationships = array();
//.........这里部分代码省略.........
示例3: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
//this call is for show related cases.
if ($this->_showRelatedCases) {
return;
}
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$caseRoles = $xmlProcessor->get($this->_caseType, 'CaseRoles');
$reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
//adding case manager.CRM-4510.
$managerRoleId = $xmlProcessor->getCaseManagerRoleId($this->_caseType);
if (!empty($managerRoleId)) {
$caseRoles[$managerRoleId] = $caseRoles[$managerRoleId] . '<br />' . '(' . ts('Case Manager') . ')';
}
$aTypes = $xmlProcessor->get($this->_caseType, 'ActivityTypes', true);
require_once 'CRM/Core/PseudoConstant.php';
$allActTypes = CRM_Core_PseudoConstant::activityType(true, true, false, 'name');
// remove Open Case activity type since we're inside an existing case
if (($openActTypeId = array_search('Open Case', $allActTypes)) && array_key_exists($openActTypeId, $aTypes)) {
unset($aTypes[$openActTypeId]);
}
//check for link cases.
$unclosedCases = CRM_Case_BAO_Case::getUnclosedCases(null, array($this->_caseID));
if (empty($unclosedCases) && ($linkActTypeId = array_search('Link Cases', $allActTypes)) && array_key_exists($linkActTypeId, $aTypes)) {
unset($aTypes[$linkActTypeId]);
}
asort($aTypes);
$this->add('select', 'activity_type_id', ts('New Activity'), array('' => ts('- select activity type -')) + $aTypes);
if ($this->_hasAccessToAllCases) {
$this->add('select', 'report_id', ts('Run QA Audit / Redact'), array('' => ts('- select activity set -')) + $reports);
$this->add('select', 'timeline_id', ts('Add Timeline'), array('' => ts('- select activity set -')) + $reports);
}
$this->addElement('submit', $this->getButtonName('next'), ts('Go'), array('class' => 'form-submit-inline', 'onclick' => "return checkSelection( this );"));
if ($this->_mergeCases) {
$allCases = CRM_Case_BAO_Case::getContactCases($this->_contactID);
$otherCases = array();
foreach ($allCases as $caseId => $details) {
//filter current and own cases.
if ($caseId == $this->_caseID || !$this->_hasAccessToAllCases && !array_key_exists($caseId, $this->_userCases)) {
continue;
}
$otherCases[$caseId] = 'Case ID: ' . $caseId . ' Type: ' . $details['case_type'] . ' Start: ' . $details['case_start_date'];
}
if (empty($otherCases)) {
$this->_mergeCases = false;
$this->assign('mergeCases', $this->_mergeCases);
} else {
$this->add('select', 'merge_case_id', ts('Select Case for Merge'), array('' => ts('- select case -')) + $otherCases);
$this->addElement('submit', $this->getButtonName('next', 'merge_case'), ts('Merge'), array('class' => 'form-submit-inline', 'onclick' => "return checkSelection( this );"));
}
}
$this->add('text', 'change_client_id', ts('Assign to another Client'));
$this->add('hidden', 'contact_id', '', array('id' => 'contact_id'));
$this->addElement('submit', $this->getButtonName('next', 'edit_client'), ts('Reassign Case'), array('class' => 'form-submit-inline', 'onclick' => "return checkSelection( this );"));
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
$this->add('select', 'status_id', ts('Status'), array("" => ts(' - any status - ')) + $activityStatus);
// activity dates
$this->addDate('activity_date_low', ts('Activity Dates - From'), false, array('formatType' => 'searchDate'));
$this->addDate('activity_date_high', ts('To'), false, array('formatType' => 'searchDate'));
require_once "CRM/Core/Permission.php";
if (CRM_Core_Permission::check('administer CiviCRM')) {
$this->add('checkbox', 'activity_deleted', ts('Deleted Activities'));
}
//get case related relationships (Case Role)
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($this->_contactID, $this->_caseID);
//build reporter select
$reporters = array("" => ts(' - any reporter - '));
foreach ($caseRelationships as $key => &$value) {
$reporters[$value['cid']] = $value['name'] . " ( {$value['relation']} )";
if ($managerRoleId == $value['relation_type']) {
$value['relation'] = $caseRoles[$managerRoleId];
}
//calculate roles that don't have relationships
if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) {
unset($caseRoles[$value['relation_type']]);
}
}
// take all case activity types for search filter, CRM-7187
$aTypesFilter = array();
$allCaseActTypes = CRM_Case_PseudoConstant::activityType();
foreach ($allCaseActTypes as $typeDetails) {
if (!in_array($typeDetails['name'], array('Open Case'))) {
$aTypesFilter[$typeDetails['id']] = CRM_Utils_Array::value('label', $typeDetails);
}
}
asort($aTypesFilter);
$this->add('select', 'activity_type_filter_id', ts('Activity Type'), array('' => ts('- select activity type -')) + $aTypesFilter);
$this->assign('caseRelationships', $caseRelationships);
//also add client as role. CRM-4438
$caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($this->_caseID);
$this->assign('caseRoles', $caseRoles);
$this->add('select', 'reporter_id', ts('Reporter/Role'), $reporters);
// Retrieve ALL client relationships
$relClient = CRM_Contact_BAO_Relationship::getRelationship($this->_contactID, CRM_Contact_BAO_Relationship::CURRENT, 0, 0, 0, null, null, false);
//.........这里部分代码省略.........