本文整理汇总了PHP中CRM_Case_PseudoConstant::caseTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_PseudoConstant::caseTypeName方法的具体用法?PHP CRM_Case_PseudoConstant::caseTypeName怎么用?PHP CRM_Case_PseudoConstant::caseTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Case_PseudoConstant::caseTypeName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactID = $this->get('cid');
$this->_caseID = $this->get('id');
$this->assign('caseID', $this->_caseID);
$this->assign('contactID', $this->_contactID);
//retrieve details about case
$params = array('id' => $this->_caseID);
$returnProperties = array('case_type_id', 'subject', 'status_id', 'start_date');
CRM_Core_DAO::commonRetrieve('CRM_Case_BAO_Case', $params, $values, $returnProperties);
$values['case_type_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('case_type_id', $values));
$statuses = CRM_Case_PseudoConstant::caseStatus();
$caseTypeName = CRM_Case_PseudoConstant::caseTypeName($this->_caseID);
$caseType = CRM_Core_OptionGroup::getLabel('case_type', $caseTypeName['id']);
$this->_caseDetails = array('case_type' => $caseType, 'case_status' => $statuses[$values['case_status_id']], 'case_subject' => CRM_Utils_Array::value('subject', $values), 'case_start_date' => $values['case_start_date']);
$this->_caseType = $caseTypeName['name'];
$this->assign('caseDetails', $this->_caseDetails);
$newActivityUrl = CRM_Utils_System::url('civicrm/case/activity', "action=add&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=", false, null, false);
$this->assign('newActivityUrl', $newActivityUrl);
$reportUrl = CRM_Utils_System::url('civicrm/case/report', "reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&asn=", false, null, false);
$this->assign('reportUrl', $reportUrl);
// add to recently viewed
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contact/BAO/Contact.php';
$url = CRM_Utils_System::url('civicrm/contact/view/case', "action=view&reset=1&id={$this->_caseID}&cid={$this->_contactID}&context=home");
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactID);
$this->assign('displayName', $displayName);
$title = $displayName . ' - ' . $caseType;
// add the recently created case
CRM_Utils_Recent::add($title, $url, $this->_caseID, 'Case', $this->_contactID, null);
}
示例2: setDefaultValues
/**
* This function sets the default values for the form. For edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues(&$form)
{
$defaults = array();
$defaults['is_reset_timeline'] = 1;
$defaults['reset_date_time'] = array();
list($defaults['reset_date_time'], $defaults['reset_date_time_time']) = CRM_Utils_Date::setDateDefaults(null, 'activityDateTime');
$caseType = CRM_Case_PseudoConstant::caseTypeName($form->_caseId);
$defaults['case_type_id'] = $caseType['id'];
return $defaults;
}
示例3: setDefaultValues
/**
* This function sets the default values for the form. For edit/view mode
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues(&$form)
{
$defaults = array();
$defaults['is_reset_timeline'] = 1;
$defaults['reset_date_time'] = array();
CRM_Utils_Date::getAllDefaultValues($defaults['reset_date_time']);
$defaults['reset_date_time']['i'] = (int) ($defaults['reset_date_time']['i'] / 15) * 15;
$caseType = CRM_Case_PseudoConstant::caseTypeName($form->_caseId);
$defaults['case_type_id'] = $caseType['id'];
return $defaults;
}
示例4: addCaseToContact
/**
* Create case contact record
*
* @param array case_id, contact_id
*
* @return object
* @access public
*/
function addCaseToContact($params)
{
require_once 'CRM/Case/DAO/CaseContact.php';
$caseContact =& new CRM_Case_DAO_CaseContact();
$caseContact->case_id = $params['case_id'];
$caseContact->contact_id = $params['contact_id'];
$caseContact->find(true);
$caseContact->save();
// add to recently viewed
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Case/PseudoConstant.php';
require_once 'CRM/Contact/BAO/Contact.php';
$caseType = CRM_Case_PseudoConstant::caseTypeName($caseContact->case_id, 'label');
$url = CRM_Utils_System::url('civicrm/contact/view/case', "action=view&reset=1&id={$caseContact->case_id}&cid={$caseContact->contact_id}&context=home");
$title = CRM_Contact_BAO_Contact::displayName($caseContact->contact_id) . ' - ' . $caseType['name'];
// add the recently created case
CRM_Utils_Recent::add($title, $url, $caseContact->case_id, 'Case', $params['contact_id'], null);
return $caseContact;
}
示例5: addCaseToContact
/**
* Create case contact record
*
* @param array case_id, contact_id
*
* @return object
* @access public
*/
static function addCaseToContact($params)
{
$caseContact = new CRM_Case_DAO_CaseContact();
$caseContact->case_id = $params['case_id'];
$caseContact->contact_id = $params['contact_id'];
$caseContact->find(TRUE);
$caseContact->save();
// add to recently viewed
$caseType = CRM_Case_PseudoConstant::caseTypeName($caseContact->case_id, 'label');
$url = CRM_Utils_System::url('civicrm/contact/view/case', "action=view&reset=1&id={$caseContact->case_id}&cid={$caseContact->contact_id}&context=home");
$title = CRM_Contact_BAO_Contact::displayName($caseContact->contact_id) . ' - ' . $caseType['name'];
$recentOther = array();
if (CRM_Core_Permission::checkActionPermission('CiviCase', CRM_Core_Action::DELETE)) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/case', "action=delete&reset=1&id={$caseContact->case_id}&cid={$caseContact->contact_id}&context=home");
}
// add the recently created case
CRM_Utils_Recent::add($title, $url, $caseContact->case_id, 'Case', $params['contact_id'], NULL, $recentOther);
return $caseContact;
}
示例6: isActivityPresent
function isActivityPresent(&$params)
{
$query = "\nSELECT count(a.id)\nFROM civicrm_activity a\nINNER JOIN civicrm_activity_target t ON t.activity_id = a.id\nINNER JOIN civicrm_case_activity ca on ca.activity_id = a.id\nWHERE t.target_contact_id = %1\nAND a.activity_type_id = %2\nAND ca.case_id = %3\n";
$sqlParams = array(1 => array($params['clientID'], 'Integer'), 2 => array($params['activityTypeID'], 'Integer'), 3 => array($params['caseID'], 'Integer'));
$count = CRM_Core_DAO::singleValueQuery($query, $sqlParams);
// check for max instance
$caseType = CRM_Case_PseudoConstant::caseTypeName($params['caseID']);
$maxInstance = self::getMaxInstance($caseType['name'], $params['activityTypeName']);
return $maxInstance ? $count < $maxInstance ? false : true : false;
}
示例7: printCaseReport
function printCaseReport()
{
$caseID = CRM_Utils_Request::retrieve('caseID', 'Positive', CRM_Core_DAO::$_nullObject);
$clientID = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject);
$activitySetName = CRM_Utils_Request::retrieve('asn', 'String', CRM_Core_DAO::$_nullObject);
$isRedact = CRM_Utils_Request::retrieve('redact', 'Boolean', CRM_Core_DAO::$_nullObject);
$includeActivities = CRM_Utils_Request::retrieve('all', 'Positive', CRM_Core_DAO::$_nullObject);
$params = $otherRelationships = $globalGroupInfo = array();
$report = new CRM_Case_XMLProcessor_Report($isRedact);
if ($includeActivities) {
$params['include_activities'] = 1;
}
if ($isRedact) {
$params['is_redact'] = 1;
$report->_redactionStringRules = array();
}
$template = CRM_Core_Smarty::singleton();
//get case related relationships (Case Role)
require_once 'CRM/Case/BAO/Case.php';
$caseRelationships = CRM_Case_BAO_Case::getCaseRoles($clientID, $caseID);
$caseType = CRM_Case_PseudoConstant::caseTypeName($caseID);
require_once 'CRM/Case/XMLProcessor/Process.php';
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$caseRoles = $xmlProcessor->get($caseType['name'], 'CaseRoles');
foreach ($caseRelationships as $key => &$value) {
if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) {
unset($caseRoles[$value['relation_type']]);
}
if ($isRedact) {
if (!array_key_exists($value['name'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($value['name'] => 'name_' . rand(10000, 100000)));
}
$value['name'] = self::redact($value['name'], true, $report->_redactionStringRules);
if (CRM_Utils_Array::value('email', $value) && !array_key_exists($value['email'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($value['email'] => 'email_' . rand(10000, 100000)));
}
$value['email'] = self::redact($value['email'], true, $report->_redactionStringRules);
if (CRM_Utils_Array::value('phone', $value) && !array_key_exists($value['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($value['phone'] => 'phone_' . rand(10000, 100000)));
}
$value['phone'] = self::redact($value['phone'], true, $report->_redactionStringRules);
}
}
$caseRoles['client'] = CRM_Case_BAO_Case::getcontactNames($caseID);
if ($isRedact) {
if (!array_key_exists($caseRoles['client']['sort_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($caseRoles['client']['sort_name'] => 'name_' . rand(10000, 100000)));
}
if (!array_key_exists($caseRoles['client']['display_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules[$caseRoles['client']['display_name']] = $report->_redactionStringRules[$caseRoles['client']['sort_name']];
}
$caseRoles['client']['sort_name'] = self::redact($caseRoles['client']['sort_name'], true, $report->_redactionStringRules);
if (CRM_Utils_Array::value('email', $caseRoles['client']) && !array_key_exists($caseRoles['client']['email'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($caseRoles['client']['email'] => 'email_' . rand(10000, 100000)));
}
$caseRoles['client']['email'] = self::redact($caseRoles['client']['email'], true, $report->_redactionStringRules);
if (CRM_Utils_Array::value('phone', $caseRoles['client']) && !array_key_exists($caseRoles['client']['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($caseRoles['client']['phone'] => 'phone_' . rand(10000, 100000)));
}
$caseRoles['client']['phone'] = self::redact($caseRoles['client']['phone'], true, $report->_redactionStringRules);
}
// Retrieve ALL client relationships
require_once 'CRM/Contact/BAO/Relationship.php';
$relClient = CRM_Contact_BAO_Relationship::getRelationship($clientID, CRM_Contact_BAO_Relationship::CURRENT, 0, 0, 0, null, null, false);
foreach ($relClient as $r) {
if ($isRedact) {
if (!array_key_exists($r['name'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['name'] => 'name_' . rand(10000, 100000)));
}
if (!array_key_exists($r['display_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules[$r['display_name']] = $report->_redactionStringRules[$r['name']];
}
$r['name'] = self::redact($r['name'], true, $report->_redactionStringRules);
if (CRM_Utils_Array::value('phone', $r) && !array_key_exists($r['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['phone'] => 'phone_' . rand(10000, 100000)));
}
$r['phone'] = self::redact($r['phone'], true, $report->_redactionStringRules);
if (CRM_Utils_Array::value('email', $r) && !array_key_exists($r['email'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['email'] => 'email_' . rand(10000, 100000)));
}
$r['email'] = self::redact($r['email'], true, $report->_redactionStringRules);
}
if (!array_key_exists($r['id'], $caseRelationships)) {
$otherRelationships[] = $r;
}
}
// Now global contact list that appears on all cases.
$relGlobal = CRM_Case_BAO_Case::getGlobalContacts($globalGroupInfo);
foreach ($relGlobal as &$r) {
if ($isRedact) {
if (!array_key_exists($r['sort_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['sort_name'] => 'name_' . rand(10000, 100000)));
}
if (!array_key_exists($r['display_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules[$r['display_name']] = $report->_redactionStringRules[$r['sort_name']];
}
$r['sort_name'] = self::redact($r['sort_name'], true, $report->_redactionStringRules);
if (CRM_Utils_Array::value('phone', $r) && !array_key_exists($r['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['phone'] => 'phone_' . rand(10000, 100000)));
}
//.........这里部分代码省略.........
示例8: preProcess
/**
* Function to build the form
*
* @return None
* @access public
*/
function preProcess()
{
$this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this);
$this->_context = 'caseActivity';
$this->_crmDir = 'Case';
$this->assign('context', $this->_context);
$result = parent::preProcess();
$scheduleStatusId = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
$this->assign('scheduleStatusId', $scheduleStatusId);
if ($this->_cdType || $this->_addAssigneeContact || $this->_addTargetContact) {
return $result;
}
if (!$this->_caseId && $this->_activityId) {
$this->_caseId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseActivity', $this->_activityId, 'case_id', 'activity_id');
}
if ($this->_caseId) {
$this->assign('caseId', $this->_caseId);
}
if (!$this->_caseId || !$this->_activityId && !$this->_activityTypeId) {
CRM_Core_Error::fatal('required params missing.');
}
$caseType = CRM_Case_PseudoConstant::caseTypeName($this->_caseId);
$this->_caseType = $caseType['name'];
$this->assign('caseType', $this->_caseType);
$clientName = $this->_getDisplayNameById($this->_currentlyViewedContactId);
$this->assign('client_name', $clientName);
// set context for pushUserContext and for statusBounce
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1");
if (!$this->_activityId) {
// check if activity count is within the limit
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$activityInst = $xmlProcessor->getMaxInstance($this->_caseType);
// If not bounce back and also provide activity edit link
if (isset($activityInst[$this->_activityTypeName])) {
$activityCount = CRM_Case_BAO_Case::getCaseActivityCount($this->_caseId, $this->_activityTypeId);
if ($activityCount >= $activityInst[$this->_activityTypeName]) {
if ($activityInst[$this->_activityTypeName] == 1) {
$atArray = array('activity_type_id' => $this->_activityTypeId);
$activities = CRM_Case_BAO_Case::getCaseActivity($this->_caseId, $atArray, $this->_currentUserId);
$activities = array_keys($activities);
$activities = $activities[0];
$editUrl = CRM_Utils_System::url('civicrm/case/activity', "reset=1&cid={$this->_currentlyViewedContactId}&caseid={$this->_caseId}&action=update&id={$activities}");
}
CRM_Core_Error::statusBounce(ts("You can not add another '%1' activity to this case. %2", array(1 => $this->_activityTypeName, 2 => "Do you want to <a href='{$editUrl}'>edit the existing activity</a> ?")), $url);
}
}
}
CRM_Utils_System::setTitle($this->_activityTypeName);
$session =& CRM_Core_Session::singleton();
$session->pushUserContext($url);
}