本文整理汇总了PHP中CRM_Case_PseudoConstant::caseActivityType方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_PseudoConstant::caseActivityType方法的具体用法?PHP CRM_Case_PseudoConstant::caseActivityType怎么用?PHP CRM_Case_PseudoConstant::caseActivityType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Case_PseudoConstant::caseActivityType方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function &allActivityTypes($indexName = TRUE, $all = FALSE)
{
static $activityTypes = NULL;
if (!$activityTypes) {
$activityTypes = CRM_Case_PseudoConstant::caseActivityType($indexName, $all);
}
return $activityTypes;
}
示例2: __construct
function __construct()
{
$this->case_statuses = CRM_Case_PseudoConstant::caseStatus();
$this->case_types = CRM_Case_PseudoConstant::caseType();
$rels = CRM_Core_PseudoConstant::relationshipType();
foreach ($rels as $relid => $v) {
$this->rel_types[$relid] = $v['label_b_a'];
}
$this->caseActivityTypes = array();
foreach (CRM_Case_PseudoConstant::caseActivityType() as $typeDetail) {
$this->caseActivityTypes[$typeDetail['id']] = $typeDetail['label'];
}
$this->_columns = array('civicrm_case' => array('dao' => 'CRM_Case_DAO_Case', 'fields' => array('id' => array('title' => ts('Case ID'), 'no_display' => TRUE, 'required' => TRUE), 'subject' => array('title' => ts('Subject'), 'required' => TRUE), 'start_date' => array('title' => ts('Start Date'), 'type' => CRM_Utils_Type::T_DATE), 'end_date' => array('title' => ts('End Date'), 'type' => CRM_Utils_Type::T_DATE), 'status_id' => array('title' => ts('Case Status')), 'case_type_id' => array('title' => ts('Case Type'))), 'filters' => array('start_date' => array('title' => ts('Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE), 'end_date' => array('title' => ts('End Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE), 'status_id' => array('title' => ts('Case Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->case_statuses), 'case_type_id' => array('title' => ts('Case Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->case_types))), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('client_sort_name' => array('name' => 'sort_name', 'title' => ts('Client Name'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Client Name')))), 'civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('case_role' => array('name' => 'relationship_type_id', 'title' => ts('Case Role(s)'))), 'filters' => array('case_role' => array('name' => 'relationship_type_id', 'title' => ts('Case Role(s)'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->rel_types))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields', 'filters' => array('country_id' => array('title' => ts('Country'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::country()), 'state_province_id' => array('title' => ts('State/Province'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::stateProvince()))), 'civicrm_worldregion' => array('dao' => 'CRM_Core_DAO_Worldregion', 'filters' => array('worldregion_id' => array('name' => 'id', 'title' => ts('WorldRegion'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::worldRegion()))), 'civicrm_country' => array('dao' => 'CRM_Core_DAO_Country'), 'civicrm_activity_last' => array('dao' => 'CRM_Activity_DAO_Activity', 'filters' => array('last_activity_date_time' => array('name' => 'activity_date_time', 'title' => ts('Last Action Date'), 'operatorType' => CRM_Report_Form::OP_DATE)), 'alias' => 'civireport_activity_last'), 'civicrm_activity_last_completed' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('last_completed_activity_subject' => array('name' => 'subject', 'title' => ts('Subject of the last completed activity in the case')), 'last_completed_activity_type' => array('name' => 'activity_type_id', 'title' => ts('Activity type of the last completed activity')))));
$this->_options = array('my_cases' => array('title' => ts('My Cases'), 'type' => 'checkbox'));
parent::__construct();
}
示例3: preProcess
function preProcess()
{
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
//validate case configuration.
$configured = CRM_Case_BAO_Case::isCaseConfigured($this->_contactId);
$this->assign('notConfigured', !$configured['configured']);
$this->assign('allowToAddNewCase', $configured['allowToAddNewCase']);
$this->assign('redirectToCaseAdmin', $configured['redirectToCaseAdmin']);
if (!$configured['configured'] || $configured['redirectToCaseAdmin']) {
return;
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
if ($this->_contactId) {
$this->assign('contactId', $this->_contactId);
// check logged in user permission
if ($this->_id && $this->_action & CRM_Core_Action::VIEW) {
//user might have special permissions to view this case, CRM-5666
if (!CRM_Core_Permission::check('access all cases and activities')) {
$session = CRM_Core_Session::singleton();
$userCases = CRM_Case_BAO_Case::getCases(FALSE, $session->get('userID'), 'any');
if (!array_key_exists($this->_id, $userCases)) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
}
} else {
CRM_Contact_Page_View::checkUserPermission($this);
}
// set page title
CRM_Contact_Page_View::setTitle($this->_contactId);
} else {
if ($this->_action & CRM_Core_Action::VIEW) {
CRM_Core_Error::fatal('Contact Id is required for view action.');
}
}
$activityTypes = CRM_Case_PseudoConstant::caseActivityType();
$this->assign('openCaseId', $activityTypes['Open Case']['id']);
$this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']);
$this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']);
$this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']);
}
示例4: recordActivityViaEmail
/**
* Create an activity for a case via email
*
* @param int $file email sent
*
* @return array|void $activity object of newly creted activity via email@access public
*/
static function recordActivityViaEmail($file)
{
if (!file_exists($file) || !is_readable($file)) {
return CRM_Core_Error::fatal(ts('File %1 does not exist or is not readable', array(1 => $file)));
}
$result = CRM_Utils_Mail_Incoming::parse($file);
if ($result['is_error']) {
return $result;
}
foreach ($result['to'] as $to) {
$caseId = NULL;
$emailPattern = '/^([A-Z0-9._%+-]+)\\+([\\d]+)@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i';
$replacement = preg_replace($emailPattern, '$2', $to['email']);
if ($replacement !== $to['email']) {
$caseId = $replacement;
//if caseId is invalid, return as error file
if (!CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseId, 'id')) {
return CRM_Core_Error::createAPIError(ts('Invalid case ID ( %1 ) in TO: field.', array(1 => $caseId)));
}
} else {
continue;
}
// TODO: May want to replace this with a call to getRelatedAndGlobalContacts() when this feature is revisited.
// (Or for efficiency call the global one outside the loop and then union with this each time.)
$contactDetails = self::getRelatedContacts($caseId, TRUE);
if (!empty($contactDetails[$result['from']['id']])) {
$params = array();
$params['subject'] = $result['subject'];
$params['activity_date_time'] = $result['date'];
$params['details'] = $result['body'];
$params['source_contact_id'] = $result['from']['id'];
$params['status_id'] = CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
$details = CRM_Case_PseudoConstant::caseActivityType();
$matches = array();
preg_match('/^\\W+([a-zA-Z0-9_ ]+)(\\W+)?\\n/i', $result['body'], $matches);
if (!empty($matches) && isset($matches[1])) {
$activityType = trim($matches[1]);
if (isset($details[$activityType])) {
$params['activity_type_id'] = $details[$activityType]['id'];
}
}
if (!isset($params['activity_type_id'])) {
$params['activity_type_id'] = CRM_Core_OptionGroup::getValue('activity_type', 'Inbound Email', 'name');
}
// create activity
$activity = CRM_Activity_BAO_Activity::create($params);
$caseParams = array('activity_id' => $activity->id, 'case_id' => $caseId);
self::processCaseActivity($caseParams);
} else {
return CRM_Core_Error::createAPIError(ts('FROM email contact %1 doesn\'t have a relationship to the referenced case.', array(1 => $result['from']['email'])));
}
}
}
示例5: getFileForActivityTypeId
/**
* Get Activity specific File according activity type Id.
*
* @param int $activityTypeId
* Activity id.
* @param string $crmDir
*
* @return string|bool
* if file exists returns $activityTypeFile activity filename otherwise false.
*/
public static function getFileForActivityTypeId($activityTypeId, $crmDir = 'Activity')
{
$activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE);
if ($activityTypes[$activityTypeId]['name']) {
$activityTypeFile = CRM_Utils_String::munge(ucwords($activityTypes[$activityTypeId]['name']), '', 0);
} else {
return FALSE;
}
global $civicrm_root;
$config = CRM_Core_Config::singleton();
if (!file_exists(rtrim($civicrm_root, '/') . "/CRM/{$crmDir}/Form/Activity/{$activityTypeFile}.php")) {
if (empty($config->customPHPPathDir)) {
return FALSE;
} elseif (!file_exists(rtrim($config->customPHPPathDir, '/') . "/CRM/{$crmDir}/Form/Activity/{$activityTypeFile}.php")) {
return FALSE;
}
}
return $activityTypeFile;
}
示例6: preProcess
/**
* Function to build the form
*
* @return None
* @access public
*/
function preProcess()
{
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
return CRM_Custom_Form_CustomData::preProcess($this);
}
$this->_caseId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if ($this->_action & CRM_Core_Action::ADD && !$this->_currentlyViewedContactId) {
// check for add contacts permissions
if (!CRM_Core_Permission::check('add contacts')) {
CRM_Utils_System::permissionDenied();
return;
}
}
//CRM-4418
if (!CRM_Core_Permission::checkActionPermission('CiviCase', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
return TRUE;
}
if (!$this->_caseId) {
$caseAttributes = array('case_type' => CRM_Case_PseudoConstant::caseType(), 'case_status' => CRM_Case_PseudoConstant::caseStatus(), 'encounter_medium' => CRM_Case_PseudoConstant::encounterMedium());
foreach ($caseAttributes as $key => $values) {
if (empty($values)) {
CRM_Core_Error::fatal(ts('You do not have any active %1', array(1 => str_replace('_', ' ', $key))));
break;
}
}
}
if ($this->_action & CRM_Core_Action::ADD) {
$this->_activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
if (!$this->_activityTypeId) {
CRM_Core_Error::fatal(ts('The Open Case activity type is missing or disabled. Please have your site administrator check Administer > Option Lists > Activity Types for the CiviCase component.'));
}
}
//check for case permissions.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
if ($this->_action & CRM_Core_Action::ADD && (!CRM_Core_Permission::check('access all cases and activities') && !CRM_Core_Permission::check('add cases'))) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
if ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, 'Case')) {
$this->assign('activityTypeFile', $this->_activityTypeFile);
}
$details = CRM_Case_PseudoConstant::caseActivityType(FALSE);
CRM_Utils_System::setTitle($details[$this->_activityTypeId]['label']);
$this->assign('activityType', $details[$this->_activityTypeId]['label']);
$this->assign('activityTypeDescription', $details[$this->_activityTypeId]['description']);
if (isset($this->_currentlyViewedContactId)) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $this->_currentlyViewedContactId;
if (!$contact->find(TRUE)) {
CRM_Core_Error::statusBounce(ts('Client contact does not exist: %1', array(1 => $this->_currentlyViewedContactId)));
}
$this->assign('clientName', $contact->display_name);
}
$session = CRM_Core_Session::singleton();
$this->_currentUserId = $session->get('userID');
//when custom data is included in this page
CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_activityTypeId, 1, 'Activity');
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
$activityGroupTree = $this->_groupTree;
// for case custom fields to populate with defaults
if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
// so that grouptree is not populated with case fields, since the grouptree is used
// for populating activity custom fields.
$this->_groupTree = $activityGroupTree;
}
示例7: getActivities
function getActivities($clientID, $caseID, $activityTypes, &$activities)
{
// get all activities for this case that in this activityTypes set
foreach ($activityTypes as $aType) {
$map[$aType['id']] = $aType;
}
// get all core activities
$coreActivityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE);
foreach ($coreActivityTypes as $aType) {
$map[$aType['id']] = $aType;
}
$activityTypeIDs = implode(',', array_keys($map));
$query = "\nSELECT a.*, c.id as caseID\nFROM civicrm_activity a,\n civicrm_case c,\n civicrm_case_activity ac\nWHERE a.is_current_revision = 1\nAND a.is_deleted =0\nAND a.activity_type_id IN ( {$activityTypeIDs} )\nAND c.id = ac.case_id\nAND a.id = ac.activity_id\nAND ac.case_id = %1\n";
$params = array(1 => array($caseID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
while ($dao->fetch()) {
$activityTypeInfo = $map[$dao->activity_type_id];
$activities[] = $this->getActivity($clientID, $dao, $activityTypeInfo);
}
}
示例8: activityForm
/**
* Build the activity selector/datatable
* @param CRM_Core_Form $form
*/
static function activityForm($form)
{
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($form->_contactID, $form->_caseID);
//build reporter select
$reporters = array("" => ts(' - any reporter - '));
foreach ($caseRelationships as $key => &$value) {
$reporters[$value['cid']] = $value['name'] . " ( {$value['relation']} )";
}
$form->add('select', 'reporter_id', ts('Reporter/Role'), $reporters, FALSE, array('id' => 'reporter_id_' . $form->_caseID));
// take all case activity types for search filter, CRM-7187
$aTypesFilter = array();
$allCaseActTypes = CRM_Case_PseudoConstant::caseActivityType();
foreach ($allCaseActTypes as $typeDetails) {
if (!in_array($typeDetails['name'], array('Open Case'))) {
$aTypesFilter[$typeDetails['id']] = CRM_Utils_Array::value('label', $typeDetails);
}
}
asort($aTypesFilter);
$form->add('select', 'activity_type_filter_id', ts('Activity Type'), array('' => ts('- select activity type -')) + $aTypesFilter, FALSE, array('id' => 'activity_type_filter_id_' . $form->_caseID));
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
$form->add('select', 'status_id', ts('Status'), array("" => ts(' - any status - ')) + $activityStatus, FALSE, array('id' => 'status_id_' . $form->_caseID));
// activity dates
$form->addDate('activity_date_low_' . $form->_caseID, ts('Activity Dates - From'), FALSE, array('formatType' => 'searchDate'));
$form->addDate('activity_date_high_' . $form->_caseID, ts('To'), FALSE, array('formatType' => 'searchDate'));
if (CRM_Core_Permission::check('administer CiviCRM')) {
$form->add('checkbox', 'activity_deleted', ts('Deleted Activities'), '', FALSE, array('id' => 'activity_deleted_' . $form->_caseID));
}
}
示例9: formRule
/**
* @param $fields
* @param $files
* @param $self
*
* @return array
*/
public static function formRule($fields, $files, $self)
{
$errors = array();
$config = CRM_Core_Config::singleton();
if (in_array("CiviCase", $config->enableComponents)) {
$caseActivityTypes = array_map('current', CRM_Case_PseudoConstant::caseActivityType());
if (!empty($fields['activity_type_id_value']) && is_array($fields['activity_type_id_value']) && empty($fields['include_case_activities_value'])) {
foreach ($fields['activity_type_id_value'] as $activityTypeId) {
if (in_array($activityTypeId, $caseActivityTypes)) {
$errors['fields'] = ts("Please enable 'Include Case Activities' to filter with Case Activity types.");
}
}
}
}
return $errors;
}
示例10: array
/**
* @param int $clientID
* @param int $activityID
* @param bool $anyActivity
* @param int $redact
*
* @return mixed
*/
public function &getActivityInfo($clientID, $activityID, $anyActivity = FALSE, $redact = 0)
{
static $activityInfos = array();
if ($redact) {
$this->_isRedact = 1;
$this->getRedactionRules();
}
$index = $activityID . '_' . (int) $anyActivity;
if ($clientID) {
$index = $index . '_' . $clientID;
}
if (!array_key_exists($index, $activityInfos)) {
$activityInfos[$index] = array();
$selectCaseActivity = "";
$joinCaseActivity = "";
if ($clientID) {
$selectCaseActivity = ", ca.case_id as caseID ";
$joinCaseActivity = " INNER JOIN civicrm_case_activity ca ON a.id = ca.activity_id ";
}
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$query = "\nSELECT a.*, aa.contact_id as assigneeID, at.contact_id as targetID\n{$selectCaseActivity}\nFROM civicrm_activity a\n{$joinCaseActivity}\nLEFT JOIN civicrm_activity_contact at ON a.id = at.activity_id AND at.record_type_id = {$targetID}\nLEFT JOIN civicrm_activity_contact aa ON a.id = aa.activity_id AND aa.record_type_id = {$assigneeID}\nWHERE a.id = %1\n ";
$params = array(1 => array($activityID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
if ($dao->fetch()) {
//if activity type is email get info of all activities.
if ($dao->activity_type_id == CRM_Core_OptionGroup::getValue('activity_type', 'Email', 'name')) {
$anyActivity = TRUE;
}
$activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, $anyActivity);
$activityTypeInfo = NULL;
if (isset($activityTypes[$dao->activity_type_id])) {
$activityTypeInfo = $activityTypes[$dao->activity_type_id];
}
if ($activityTypeInfo) {
$activityInfos[$index] = $this->getActivity($clientID, $dao, $activityTypeInfo);
}
}
}
return $activityInfos[$index];
}
示例11:
/**
* @param bool $indexName
* @param bool $all
*
* @return array
*/
function &allActivityTypes($indexName = TRUE, $all = FALSE)
{
if (self::$activityTypes === NULL) {
self::$activityTypes = CRM_Case_PseudoConstant::caseActivityType($indexName, $all);
}
return self::$activityTypes;
}
示例12: buildQuickForm
/**
* Function to build the form
*
* @return void
* @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);
$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]);
}
if (!$xmlProcessor->getNaturalActivityTypeSort()) {
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'));
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);
//save special label because we unset it in the loop
$managerLabel = empty($managerRoleId) ? '' : $caseRoles[$managerRoleId];
//build reporter select
$reporters = array("" => ts(' - any reporter - '));
foreach ($caseRelationships as $key => &$value) {
$reporters[$value['cid']] = $value['name'] . " ( {$value['relation']} )";
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']]);
}
}
// take all case activity types for search filter, CRM-7187
$aTypesFilter = array();
$allCaseActTypes = CRM_Case_PseudoConstant::caseActivityType();
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);
//.........这里部分代码省略.........
示例13: civicrm_api3_civi_outlook_getcaseactivitytype
function civicrm_api3_civi_outlook_getcaseactivitytype($params)
{
$activityOptions = CRM_Case_PseudoConstant::caseActivityType();
$result = array();
foreach ($activityOptions as $key => $values) {
$result[] = $key;
}
return $result;
}