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


PHP CRM_Case_BAO_Case::getCaseType方法代码示例

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


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

示例1: create

 /**
  * Create case contact record.
  *
  * @param array $params
  *   case_id, contact_id
  *
  * @return CRM_Case_BAO_CaseContact
  */
 public static function create($params)
 {
     $caseContact = new self();
     $caseContact->copyValues($params);
     $caseContact->save();
     // add to recently viewed
     $caseType = CRM_Case_BAO_Case::getCaseType($caseContact->case_id);
     $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;
     $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', $caseContact->contact_id, NULL, $recentOther);
     return $caseContact;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:25,代码来源:CaseContact.php

示例2: preProcess

 /**
  * @param CRM_Core_Form $form
  *
  * @throws Exception
  */
 public static function preProcess(&$form)
 {
     if (empty($form->_caseId)) {
         CRM_Core_Error::fatal(ts('Case Id not found.'));
     }
     if (count($form->_caseId) != 1) {
         CRM_Core_Resources::fatal(ts('Expected one case-type'));
     }
     $caseId = CRM_Utils_Array::first($form->_caseId);
     $form->assign('clientID', $form->_currentlyViewedContactId);
     $form->assign('sortName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $form->_currentlyViewedContactId, 'sort_name'));
     $form->assign('caseTypeLabel', CRM_Case_BAO_Case::getCaseType($caseId));
     // get the related cases for given case.
     $relatedCases = $form->get('relatedCases');
     if (!isset($relatedCases)) {
         $relatedCases = CRM_Case_BAO_Case::getRelatedCases($caseId, $form->_currentlyViewedContactId);
         $form->set('relatedCases', empty($relatedCases) ? FALSE : $relatedCases);
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:24,代码来源:LinkCases.php

示例3: preProcess

 static function preProcess(&$form)
 {
     if (!isset($form->_caseId)) {
         CRM_Core_Error::fatal(ts('Case Id not found.'));
     }
     $form->assign('clientID', $form->_currentlyViewedContactId);
     $form->assign('caseTypeLabel', CRM_Case_BAO_Case::getCaseType($form->_caseId));
     // get the related cases for given case.
     $relatedCases = $form->get('relatedCases');
     if (!isset($relatedCases)) {
         $relatedCases = CRM_Case_BAO_Case::getRelatedCases($form->_caseId, $form->_currentlyViewedContactId);
         $form->set('relatedCases', empty($relatedCases) ? FALSE : $relatedCases);
     }
     $excludeCaseIds = array($form->_caseId);
     if (is_array($relatedCases) && !empty($relatedCases)) {
         $excludeCaseIds = array_merge($excludeCaseIds, array_keys($relatedCases));
     }
     $form->assign('excludeCaseIds', implode(',', $excludeCaseIds));
 }
开发者ID:hguru,项目名称:224Civi,代码行数:19,代码来源:LinkCases.php

示例4: array

 /**
  * Returns all the rows in the given offset and rowCount.
  *
  * @param string $action
  *   The action being performed.
  * @param int $offset
  *   The row number to start from.
  * @param int $rowCount
  *   The number of rows to return.
  * @param string $sort
  *   The sql string that describes the sort order.
  * @param string $output
  *   What should the result set include (web/email/csv).
  *
  * @return int
  *   the total number of rows for this action
  */
 public function &getRows($action, $offset, $rowCount, $sort, $output = NULL)
 {
     $result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, FALSE, FALSE, FALSE, FALSE, $this->_additionalClause);
     // process the result of the query
     $rows = array();
     //CRM-4418 check for view, edit, delete
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('access all cases and activities') || CRM_Core_Permission::check('access my cases and activities')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviCase')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $caseStatus = CRM_Core_OptionGroup::values('case_status', FALSE, FALSE, FALSE, " AND v.name = 'Urgent' ");
     $scheduledInfo = array();
     while ($result->fetch()) {
         $row = array();
         // the columns we are interested in
         foreach (self::$_properties as $property) {
             if (isset($result->{$property})) {
                 $row[$property] = $result->{$property};
             }
         }
         $isDeleted = FALSE;
         if ($result->case_deleted) {
             $isDeleted = TRUE;
             $row['case_status_id'] = empty($row['case_status_id']) ? "" : $row['case_status_id'] . '<br />(deleted)';
         }
         $scheduledInfo['case_id'][] = $result->case_id;
         $scheduledInfo['contact_id'][] = $result->contact_id;
         $scheduledInfo['case_deleted'] = $result->case_deleted;
         $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->case_id;
         $links = self::links($isDeleted, $this->_key);
         $row['action'] = CRM_Core_Action::formLink($links['primaryActions'], $mask, array('id' => $result->case_id, 'cid' => $result->contact_id, 'cxt' => $this->_context), ts('more'), FALSE, 'case.selector.actions', 'Case', $result->case_id);
         $row['moreActions'] = CRM_Core_Action::formLink(CRM_Utils_Array::value('moreActions', $links), $mask, array('id' => $result->case_id, 'cid' => $result->contact_id, 'cxt' => $this->_context), ts('more'), TRUE, 'case.selector.moreActions', 'Case', $result->case_id);
         $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type);
         //adding case manager to case selector.CRM-4510.
         $caseType = CRM_Case_BAO_Case::getCaseType($result->case_id, 'name');
         $caseManagerContact = CRM_Case_BAO_Case::getCaseManagerContact($caseType, $result->case_id);
         if (!empty($caseManagerContact)) {
             $row['casemanager_id'] = CRM_Utils_Array::value('casemanager_id', $caseManagerContact);
             $row['casemanager'] = CRM_Utils_Array::value('casemanager', $caseManagerContact);
         }
         if (isset($result->case_status_id) && array_key_exists($result->case_status_id, $caseStatus)) {
             $row['class'] = "status-urgent";
         } else {
             $row['class'] = "status-normal";
         }
         $rows[$result->case_id] = $row;
     }
     //retrive the scheduled & recent Activity type and date for selector
     if (!empty($scheduledInfo)) {
         $schdeduledActivity = CRM_Case_BAO_Case::getNextScheduledActivity($scheduledInfo, 'upcoming');
         foreach ($schdeduledActivity as $key => $value) {
             $rows[$key]['case_scheduled_activity_date'] = $value['date'];
             $rows[$key]['case_scheduled_activity_type'] = $value['type'];
         }
         $recentActivity = CRM_Case_BAO_Case::getNextScheduledActivity($scheduledInfo, 'recent');
         foreach ($recentActivity as $key => $value) {
             $rows[$key]['case_recent_activity_date'] = $value['date'];
             $rows[$key]['case_recent_activity_type'] = $value['type'];
         }
     }
     return $rows;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:83,代码来源:Search.php

示例5: 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)
     $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($clientID, $caseID);
     $caseType = CRM_Case_BAO_Case::getCaseType($caseID, 'name');
     $xmlProcessor = new CRM_Case_XMLProcessor_Process();
     $caseRoles = $xmlProcessor->get($caseType, 'CaseRoles');
     foreach ($caseRelationships as $key => &$value) {
         if (!empty($caseRoles[$value['relation_type']])) {
             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 (!empty($value['email']) && !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 (!empty($value['phone']) && !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 (!empty($caseRoles['client']['email']) && !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 (!empty($caseRoles['client']['phone']) && !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
     $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 (!empty($r['phone']) && !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 (!empty($r['email']) && !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 (!empty($r['phone']) && !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 (!empty($r['email']) && !array_key_exists($r['email'], $report->_redactionStringRules)) {
                 $report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['email'] => 'email_' . rand(10000, 100000)));
//.........这里部分代码省略.........
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:101,代码来源:Report.php

示例6: getCaseRoles

 public static function getCaseRoles()
 {
     $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
     $contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
     $params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
     $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($contactID, $caseID);
     $caseTypeName = CRM_Case_BAO_Case::getCaseType($caseID, 'name');
     $xmlProcessor = new CRM_Case_XMLProcessor_Process();
     $caseRoles = $xmlProcessor->get($caseTypeName, 'CaseRoles');
     $hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
     $managerRoleId = $xmlProcessor->getCaseManagerRoleId($caseTypeName);
     foreach ($caseRelationships as $key => $value) {
         // This role has been filled
         unset($caseRoles[$value['relation_type']]);
         // mark original case relationships record to use on setting edit links below
         $caseRelationships[$key]['source'] = 'caseRel';
     }
     $caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($caseID);
     // move/transform caseRoles array data to caseRelationships
     // for sorting and display
     // CRM-14466 added cid to the non-client array to avoid php notice
     foreach ($caseRoles as $id => $value) {
         if ($id != "client") {
             $rel = array();
             $rel['relation'] = $value;
             $rel['relation_type'] = $id;
             $rel['name'] = '(not assigned)';
             $rel['phone'] = '';
             $rel['email'] = '';
             $rel['source'] = 'caseRoles';
             $caseRelationships[] = $rel;
         } else {
             foreach ($value as $clientRole) {
                 $relClient = array();
                 $relClient['relation'] = 'Client';
                 $relClient['name'] = $clientRole['sort_name'];
                 $relClient['phone'] = $clientRole['phone'];
                 $relClient['email'] = $clientRole['email'];
                 $relClient['cid'] = $clientRole['contact_id'];
                 $relClient['source'] = 'contact';
                 $caseRelationships[] = $relClient;
             }
         }
     }
     // sort clientRelationships array using jquery call params
     foreach ($caseRelationships as $key => $row) {
         $sortArray[$key] = $row[$params['_raw_values']['sort'][0]];
     }
     $sort_type = "SORT_" . strtoupper($params['_raw_values']['order'][0]);
     array_multisort($sortArray, constant($sort_type), $caseRelationships);
     $relationships = array();
     // set user name, email and edit columns links
     foreach ($caseRelationships as $key => &$row) {
         $typeLabel = $row['relation'];
         // Add "<br />(Case Manager)" to label
         if ($row['relation_type'] == $managerRoleId) {
             $row['relation'] .= '<br />' . '(' . ts('Case Manager') . ')';
         }
         // view user links
         if (!empty($row['cid'])) {
             $row['name'] = '<a class="view-contact" title="' . ts('View Contact') . '" href=' . CRM_Utils_System::url('civicrm/contact/view', 'action=view&reset=1&cid=' . $row['cid']) . '>' . $row['name'] . '</a>';
         }
         // email column links/icon
         if ($row['email']) {
             $row['email'] = '<a class="crm-hover-button crm-popup" href="' . CRM_Utils_System::url('civicrm/activity/email/add', 'reset=1&action=add&atype=3&cid=' . $row['cid']) . '&caseid=' . $caseID . '" title="' . ts('Send an Email') . '"><i class="crm-i fa-envelope"></i></a>';
         }
         // edit links
         $row['actions'] = '';
         if ($hasAccessToAllCases) {
             $contactType = empty($row['relation_type']) ? '' : (string) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $row['relation_type'], 'contact_type_b');
             $contactType = $contactType == 'Contact' ? '' : $contactType;
             switch ($row['source']) {
                 case 'caseRel':
                     $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_' . $row['relationship_direction'] . '" data-cid="' . $row['cid'] . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<i class="crm-i fa-pencil"></i>' . '</a>' . '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_' . $row['relationship_direction'] . '" data-cid="' . $row['cid'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' . '<span class="icon delete-icon"></span>' . '</a>';
                     break;
                 case 'caseRoles':
                     $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '_b_a" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<i class="crm-i fa-pencil"></i>' . '</a>';
                     break;
             }
         }
         unset($row['cid']);
         unset($row['relation_type']);
         unset($row['rel_id']);
         unset($row['client_id']);
         unset($row['source']);
         array_push($relationships, $row);
     }
     $params['total'] = count($relationships);
     $caseRelationshipsDT = array();
     $caseRelationshipsDT['data'] = $relationships;
     $caseRelationshipsDT['recordsTotal'] = $params['total'];
     $caseRelationshipsDT['recordsFiltered'] = $params['total'];
     CRM_Utils_JSON::output($caseRelationshipsDT);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:94,代码来源:AJAX.php

示例7: preProcess

 /**
  * Build the form object.
  *
  * @return void
  */
 public function preProcess()
 {
     $caseIds = CRM_Utils_Request::retrieve('caseid', 'String', $this);
     $this->_caseId = explode(',', $caseIds);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     if (!$this->_context) {
         $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->_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);
         $this->assign('countId', count($this->_caseId));
         $this->assign('caseID', CRM_Utils_Array::first($this->_caseId));
     }
     if (!$this->_caseId || !$this->_activityId && !$this->_activityTypeId) {
         CRM_Core_Error::fatal('required params missing.');
     }
     //check for case activity access.
     if (!CRM_Case_BAO_Case::accessCiviCase()) {
         CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
     }
     //validate case id.
     if ($this->_caseId && !CRM_Core_Permission::check('access all cases and activities')) {
         $session = CRM_Core_Session::singleton();
         $allCases = CRM_Case_BAO_Case::getCases(TRUE, $session->get('userID'), 'any');
         if (!array_key_exists($this->_caseId, $allCases)) {
             CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
         }
     }
     //validate case activity id.
     if ($this->_activityId && $this->_action & CRM_Core_Action::UPDATE) {
         $valid = CRM_Case_BAO_Case::checkPermission($this->_activityId, 'edit', $this->_activityTypeId);
         if (!$valid) {
             CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
         }
     }
     foreach ($this->_caseId as $casePos => $caseId) {
         $this->_caseType[$casePos] = CRM_Case_BAO_Case::getCaseType($caseId, 'name');
     }
     $this->assign('caseType', $this->_caseType);
     $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
     $isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients();
     $this->assign('multiClient', $isMultiClient);
     foreach ($this->_caseId as $casePos => $caseId) {
         $clients[] = CRM_Case_BAO_Case::getContactNames($caseId);
     }
     $this->assign('client_names', $clients);
     $caseIds = implode(',', $this->_caseId);
     // set context for pushUserContext and for statusBounce
     if ($this->_context == 'fulltext') {
         if ($this->_action == CRM_Core_Action::UPDATE || $this->_action == CRM_Core_Action::DELETE) {
             $url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1&context={$this->_context}");
         } else {
             $url = CRM_Utils_System::url('civicrm/contact/search/custom', 'force=1');
         }
     } else {
         $url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1");
     }
     if (!$this->_activityId) {
         $caseTypes = CRM_Case_PseudoConstant::caseType();
         if (empty($caseTypes) && $this->_activityTypeName == 'Change Case Type' && !$this->_caseId) {
             $url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1");
             $session = CRM_Core_Session::singleton();
             $session->pushUserContext($url);
             CRM_Core_Error::statusBounce(ts("You do not have any active Case Types"));
         }
         // check if activity count is within the limit
         $xmlProcessor = new CRM_Case_XMLProcessor_Process();
         foreach ($this->_caseId as $casePos => $caseId) {
             $caseType = $this->_caseType[$casePos];
             $activityInst = $xmlProcessor->getMaxInstance($caseType);
             // If not bounce back and also provide activity edit link
             if (isset($activityInst[$this->_activityTypeName])) {
                 $activityCount = CRM_Case_BAO_Case::getCaseActivityCount($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($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={$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 => ts("Do you want to <a %1>edit the existing activity</a>?", array(1 => "href='{$editUrl}'")))), $url);
                 }
             }
         }
     }
     $session = CRM_Core_Session::singleton();
//.........这里部分代码省略.........
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:101,代码来源:Activity.php

示例8: testGetCaseType

 public function testGetCaseType()
 {
     $caseTypeLabel = CRM_Case_BAO_Case::getCaseType(1);
     $this->assertEquals('Housing Support', $caseTypeLabel);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:5,代码来源:CaseTest.php

示例9: endPostProcess

 /**
  * Process the form submission.
  *
  *
  * @param CRM_Core_Form $form
  * @param array $params
  * @param $activity
  */
 public static function endPostProcess(&$form, &$params, $activity)
 {
     if (!empty($params['start_date'])) {
         $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
     }
     $caseType = CRM_Utils_Array::first($form->_caseType);
     $caseId = CRM_Utils_Array::first($form->_caseId);
     if (!$caseType && $caseId) {
         $caseType = CRM_Case_BAO_Case::getCaseType($caseId, 'title');
     }
     if (!$form->_currentlyViewedContactId || !$form->_currentUserId || !$caseId || !$caseType) {
         CRM_Core_Error::fatal('Required parameter missing for ChangeCaseType - end post processing');
     }
     $config = CRM_Core_Config::singleton();
     $params['status_id'] = CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
     $activity->status_id = $params['status_id'];
     $params['priority_id'] = CRM_Core_OptionGroup::getValue('priority', 'Normal', 'name');
     $activity->priority_id = $params['priority_id'];
     // 1. save activity subject with new start date
     $currentStartDate = CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseId, 'start_date'), $config->dateformatFull);
     $newStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Date::mysqlToIso($params['start_date']), $config->dateformatFull);
     $subject = 'Change Case Start Date from ' . $currentStartDate . ' to ' . $newStartDate;
     $activity->subject = $subject;
     $activity->save();
     // 2. initiate xml processor
     $xmlProcessor = new CRM_Case_XMLProcessor_Process();
     $xmlProcessorParams = array('clientID' => $form->_currentlyViewedContactId, 'creatorID' => $form->_currentUserId, 'standardTimeline' => 0, 'activity_date_time' => $params['start_date'], 'caseID' => $caseId, 'caseType' => $caseType, 'activityTypeName' => 'Change Case Start Date', 'activitySetName' => 'standard_timeline', 'resetTimeline' => 1);
     $xmlProcessor->run($caseType, $xmlProcessorParams);
     // 2.5 Update open case activity date
     // Multiple steps since revisioned
     if ($form->openCaseActivityId) {
         $abao = new CRM_Activity_BAO_Activity();
         $oldParams = array('id' => $form->openCaseActivityId);
         $oldActivityDefaults = array();
         $oldActivity = $abao->retrieve($oldParams, $oldActivityDefaults);
         // save the old values
         require_once 'api/v3/utils.php';
         $openCaseParams = array();
         //@todo calling api functions directly is not supported
         _civicrm_api3_object_to_array($oldActivity, $openCaseParams);
         // update existing revision
         $oldParams = array('id' => $form->openCaseActivityId, 'is_current_revision' => 0);
         $oldActivity = new CRM_Activity_DAO_Activity();
         $oldActivity->copyValues($oldParams);
         $oldActivity->save();
         // change some params for the new one
         unset($openCaseParams['id']);
         $openCaseParams['activity_date_time'] = $params['start_date'];
         $openCaseParams['target_contact_id'] = $oldActivityDefaults['target_contact'];
         $openCaseParams['assignee_contact_id'] = $oldActivityDefaults['assignee_contact'];
         $session = CRM_Core_Session::singleton();
         $openCaseParams['source_contact_id'] = $session->get('userID');
         // original_id always refers to the first activity, so only update if null (i.e. this is the second revision)
         $openCaseParams['original_id'] = $openCaseParams['original_id'] ? $openCaseParams['original_id'] : $form->openCaseActivityId;
         $newActivity = CRM_Activity_BAO_Activity::create($openCaseParams);
         if (is_a($newActivity, 'CRM_Core_Error')) {
             CRM_Core_Error::fatal('Unable to update Open Case activity');
         } else {
             // Create linkage to case
             $caseActivityParams = array('activity_id' => $newActivity->id, 'case_id' => $caseId);
             CRM_Case_BAO_Case::processCaseActivity($caseActivityParams);
             $caseActivityParams = array('activityID' => $form->openCaseActivityId, 'mainActivityId' => $newActivity->id);
             CRM_Activity_BAO_Activity::copyExtendedActivityData($caseActivityParams);
         }
     }
     // 3.status msg
     $params['statusMsg'] = ts('Case Start Date changed successfully.');
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:76,代码来源:ChangeCaseStartDate.php

示例10: caseDetails

 function caseDetails()
 {
     $caseId = CRM_Utils_Type::escape($_GET['caseId'], 'Integer');
     $contactId = CRM_Utils_Type::escape($_GET['contactId'], 'Integer');
     require_once 'CRM/Case/BAO/Case.php';
     $sql = "SELECT * FROM civicrm_case where id = %1";
     $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($caseId, 'Integer')));
     while ($dao->fetch()) {
         $caseType = CRM_Case_BAO_Case::getCaseType(str_replace(CRM_Case_BAO_Case::VALUE_SEPERATOR, "", $dao->case_type_id));
         $caseStatuses = CRM_Case_PseudoConstant::caseStatus();
         $cs = $caseStatuses[$dao->status_id];
         $caseDetails = "<html><table><tr><td>Case Subject</td><td>{$dao->subject}</td></tr>\n                                          <tr><td>Case Type</td><td>{$caseType}</td></tr> \n                                          <tr><td> Case Status</td><td>{$cs}</td></tr>\n                                          <tr><td>Case Start Date</td><td>{$dao->start_date}</td></tr>\n                                          <tr><td>Case End Date</td><td></td></tr>{$dao->end_date}</table></html>";
         echo $caseDetails;
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:15,代码来源:AJAX.php

示例11: isActivityPresent

 /**
  * @param array $params
  *
  * @return bool
  */
 public function isActivityPresent(&$params)
 {
     $query = "\nSELECT     count(a.id)\nFROM       civicrm_activity a\nINNER JOIN civicrm_case_activity ca on ca.activity_id = a.id\nWHERE      a.activity_type_id  = %1\nAND        ca.case_id = %2\nAND        a.is_deleted = 0\n";
     $sqlParams = array(1 => array($params['activityTypeID'], 'Integer'), 2 => array($params['caseID'], 'Integer'));
     $count = CRM_Core_DAO::singleValueQuery($query, $sqlParams);
     // check for max instance
     $caseType = CRM_Case_BAO_Case::getCaseType($params['caseID'], 'name');
     $maxInstance = self::getMaxInstance($caseType, $params['activityTypeName']);
     return $maxInstance ? $count < $maxInstance ? FALSE : TRUE : FALSE;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:15,代码来源:Process.php

示例12: caseDetails

 function caseDetails()
 {
     $caseId = CRM_Utils_Type::escape($_GET['caseId'], 'Positive');
     if (!CRM_Case_BAO_Case::accessCase($caseId, FALSE)) {
         CRM_Utils_System::permissionDenied();
     }
     $sql = "SELECT * FROM civicrm_case where id = %1";
     $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($caseId, 'Integer')));
     if ($dao->fetch()) {
         $caseType = CRM_Case_BAO_Case::getCaseType(str_replace(CRM_Core_DAO::VALUE_SEPARATOR, "", $dao->case_type_id));
         $caseStatuses = CRM_Case_PseudoConstant::caseStatus();
         $cs = $caseStatuses[$dao->status_id];
         $caseDetails = "<table><tr><td>" . ts('Case Subject') . "</td><td>{$dao->subject}</td></tr>\n                                    <tr><td>" . ts('Case Type') . "</td><td>{$caseType}</td></tr>\n                                    <tr><td>" . ts('Case Status') . "</td><td>{$cs}</td></tr>\n                                    <tr><td>" . ts('Case Start Date') . "</td><td>" . CRM_Utils_Date::customFormat($dao->start_date) . "</td></tr>\n                                    <tr><td>" . ts('Case End Date') . "</td><td></td></tr>" . CRM_Utils_Date::customFormat($dao->end_date) . "</table>";
         echo $caseDetails;
     } else {
         echo ts('Could not find valid Case!');
     }
     CRM_Utils_System::civiExit();
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:19,代码来源:AJAX.php

示例13: getCaseRoles

 public static function getCaseRoles()
 {
     $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
     $contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
     $sortMapper = array(0 => 'relation', 1 => 'name', 2 => 'phone', 3 => 'email', 4 => 'actions');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : 'relation';
     $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $params = $_POST;
     if ($sort && $sortOrder) {
         $sortSQL = $sort . ' ' . $sortOrder;
     }
     $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($contactID, $caseID);
     $caseTypeName = CRM_Case_BAO_Case::getCaseType($caseID, 'name');
     $xmlProcessor = new CRM_Case_XMLProcessor_Process();
     $caseRoles = $xmlProcessor->get($caseTypeName, 'CaseRoles');
     $hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
     $managerRoleId = $xmlProcessor->getCaseManagerRoleId($caseTypeName);
     if (!empty($managerRoleId)) {
         $caseRoles[$managerRoleId] = $caseRoles[$managerRoleId] . '<br />' . '(' . ts('Case Manager') . ')';
     }
     foreach ($caseRelationships as $key => $value) {
         //calculate roles that don't have relationships
         if (!empty($caseRoles[$value['relation_type']])) {
             //keep naming from careRoles array
             $caseRelationships[$key]['relation'] = $caseRoles[$value['relation_type']];
             unset($caseRoles[$value['relation_type']]);
         }
         // mark orginal case relationships record to use on setting edit links below
         $caseRelationships[$key]['source'] = 'caseRel';
     }
     $caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($caseID);
     // move/transform caseRoles array data to caseRelationships
     // for sorting and display
     // CRM-14466 added cid to the non-client array to avoid php notice
     foreach ($caseRoles as $id => $value) {
         if ($id != "client") {
             $rel = array();
             $rel['relation'] = $value;
             $rel['relation_type'] = $id;
             $rel['name'] = '(not assigned)';
             $rel['phone'] = '';
             $rel['email'] = '';
             $rel['source'] = 'caseRoles';
             $caseRelationships[] = $rel;
         } else {
             foreach ($value as $clientRole) {
                 $relClient = array();
                 $relClient['relation'] = 'Client';
                 $relClient['name'] = $clientRole['sort_name'];
                 $relClient['phone'] = $clientRole['phone'];
                 $relClient['email'] = $clientRole['email'];
                 $relClient['cid'] = $clientRole['contact_id'];
                 $relClient['source'] = 'contact';
                 $caseRelationships[] = $relClient;
             }
         }
     }
     // sort clientRelationships array using jquery call params
     foreach ($caseRelationships as $key => $row) {
         $sortArray[$key] = $row[$sort];
     }
     $sort_type = "SORT_" . strtoupper($sortOrder);
     array_multisort($sortArray, constant($sort_type), $caseRelationships);
     //limit rows display
     $allCaseRelationships = $caseRelationships;
     $caseRelationships = array_slice($allCaseRelationships, $offset, $rowCount, TRUE);
     // set user name, email and edit columns links
     // idx will count number of current row / needed by edit links
     $idx = 1;
     foreach ($caseRelationships as &$row) {
         // Get rid of the "<br />(Case Manager)" from label
         list($typeLabel) = explode('<', $row['relation']);
         // view user links
         if (!empty($row['cid'])) {
             $row['name'] = '<a class="view-contact" title="' . ts('View Contact') . '" href=' . CRM_Utils_System::url('civicrm/contact/view', 'action=view&reset=1&cid=' . $row['cid']) . '>' . $row['name'] . '</a>';
         }
         // email column links/icon
         if ($row['email']) {
             $row['email'] = '<a class="crm-hover-button crm-popup" href="' . CRM_Utils_System::url('civicrm/activity/email/add', 'reset=1&action=add&atype=3&cid=' . $row['cid']) . '&caseid=' . $caseID . '" title="' . ts('Send an Email') . '"><span class="icon ui-icon-mail-closed"></span></a>';
         }
         // edit links
         $row['actions'] = '';
         if ($hasAccessToAllCases) {
             $contactType = empty($row['relation_type']) ? '' : (string) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $row['relation_type'], 'contact_type_b');
             $contactType = $contactType == 'Contact' ? '' : $contactType;
             switch ($row['source']) {
                 case 'caseRel':
                     $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Reassign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-rel_id="' . $row['rel_id'] . '"data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<span class="icon ui-icon-pencil"></span>' . '</a>' . '<a href="#deleteCaseRoleDialog" title="' . ts('Remove %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/delcaserole') . '">' . '<span class="icon delete-icon"></span>' . '</a>';
                     break;
                 case 'caseRoles':
                     $row['actions'] = '<a href="#editCaseRoleDialog" title="' . ts('Assign %1', array(1 => $typeLabel)) . '" class="crm-hover-button case-miniform" data-contact_type="' . $contactType . '" data-rel_type="' . $row['relation_type'] . '" data-key="' . CRM_Core_Key::get('civicrm/ajax/relation') . '">' . '<span class="icon ui-icon-pencil"></span>' . '</a>';
                     break;
             }
         }
         $idx++;
     }
     $iFilteredTotal = $iTotal = $params['total'] = count($allCaseRelationships);
//.........这里部分代码省略.........
开发者ID:kidaa30,项目名称:yes,代码行数:101,代码来源:AJAX.php

示例14: getCaseRoles

 static function getCaseRoles()
 {
     $caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
     $contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
     $sortMapper = array(0 => 'relation', 1 => 'name', 2 => 'phone', 3 => 'email', 4 => 'actions');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : 'relation';
     $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $params = $_POST;
     if ($sort && $sortOrder) {
         $sortSQL = $sort . ' ' . $sortOrder;
     }
     $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($contactID, $caseID);
     $caseTypeName = CRM_Case_BAO_Case::getCaseType($caseID, 'name');
     $xmlProcessor = new CRM_Case_XMLProcessor_Process();
     $caseRoles = $xmlProcessor->get($caseTypeName, 'CaseRoles');
     $hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
     $managerRoleId = $xmlProcessor->getCaseManagerRoleId($caseTypeName);
     if (!empty($managerRoleId)) {
         $caseRoles[$managerRoleId] = $caseRoles[$managerRoleId] . '<br />' . '(' . ts('Case Manager') . ')';
     }
     foreach ($caseRelationships as $key => $value) {
         //calculate roles that don't have relationships
         if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) {
             //keep naming from careRoles array
             $caseRelationships[$key]['relation'] = $caseRoles[$value['relation_type']];
             unset($caseRoles[$value['relation_type']]);
         }
         // mark orginal case relationships record to use on setting edit links below
         $caseRelationships[$key]['source'] = 'caseRel';
     }
     $caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($caseID);
     // move/transform caseRoles array data to caseRelationships
     // for sorting and display
     foreach ($caseRoles as $id => $value) {
         if ($id != "client") {
             $rel = array();
             $rel['relation'] = $value;
             $rel['relation_type'] = $id;
             $rel['name'] = '(not assigned)';
             $rel['phone'] = '';
             $rel['email'] = '';
             $rel['source'] = 'caseRoles';
             $caseRelationships[] = $rel;
         } else {
             foreach ($value as $clientRole) {
                 $relClient = array();
                 $relClient['relation'] = 'Client';
                 $relClient['name'] = $clientRole['sort_name'];
                 $relClient['phone'] = $clientRole['phone'];
                 $relClient['email'] = $clientRole['email'];
                 $relClient['cid'] = $clientRole['contact_id'];
                 $relClient['source'] = 'contact';
                 $caseRelationships[] = $relClient;
             }
         }
     }
     // sort clientRelationships array using jquery call params
     foreach ($caseRelationships as $key => $row) {
         $sortArray[$key] = $row[$sort];
     }
     $sort_type = "SORT_" . strtoupper($sortOrder);
     array_multisort($sortArray, constant($sort_type), $caseRelationships);
     //limit rows display
     $allCaseRelationships = $caseRelationships;
     $caseRelationships = array_slice($allCaseRelationships, $offset, $rowCount, TRUE);
     // set user name, email and edit columns links
     // idx will count number of current row / needed by edit links
     $idx = 1;
     foreach ($caseRelationships as $key => $row) {
         // view user links
         if ($caseRelationships[$key]['cid']) {
             $caseRelationships[$key]['name'] = '<a href=' . CRM_Utils_System::url('civicrm/contact/view', 'action=view&reset=1&cid=' . $caseRelationships[$key]['cid']) . '>' . $caseRelationships[$key]['name'] . '</a>';
         }
         // email column links/icon
         if ($caseRelationships[$key]['email']) {
             $caseRelationships[$key]['email'] = '<a href="' . CRM_Utils_System::url('civicrm/contact/view/activity', 'action=reset=1&action=add&atype=3&cid=' . $caseRelationships[$key]['cid']) . '&caseid=' . $caseID . '" title="compose and send an email"><div class="icon email-icon" title="compose and send an email"></div>
          </a>';
         }
         // edit links
         if ($hasAccessToAllCases) {
             switch ($caseRelationships[$key]['source']) {
                 case 'caseRel':
                     $caseRelationships[$key]['actions'] = '<a href="#" title="edit case role" onclick="createRelationship( ' . $caseRelationships[$key]['relation_type'] . ', ' . $caseRelationships[$key]['cid'] . ', ' . $caseRelationships[$key]['rel_id'] . ', ' . $idx . ', \'' . $caseRelationships[$key]['relation'] . '\' );return false;"><div class="icon edit-icon" ></div></a>&nbsp;&nbsp;<a href="#" class="case-role-delete" case_id="' . $caseID . '" rel_type="' . $caseRelationships[$key]['relation_type'] . '"><div class="icon delete-icon" title="remove contact from case role"></div></a>';
                     break;
                 case 'caseRoles':
                     $caseRelationships[$key]['actions'] = '<a href="#" title="edit case role" onclick="createRelationship(' . $caseRelationships[$key]['relation_type'] . ', null, null, ' . $idx . ',  \'' . $caseRelationships[$key]['relation'] . '\');return false;"><div class="icon edit-icon"></div></a>';
                     break;
             }
         } else {
             $caseRelationships[$key]['actions'] = '';
         }
         $idx++;
     }
     $iFilteredTotal = $iTotal = $params['total'] = count($allCaseRelationships);
     $selectorElements = array('relation', 'name', 'phone', 'email', 'actions');
     echo CRM_Utils_JSON::encodeDataTableSelector($caseRelationships, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:AJAX.php

示例15: preProcess

 /**  
  * Function to set variables up before form is built  
  *                                                            
  * @return void  
  * @access public  
  */
 public function preProcess()
 {
     $this->_showRelatedCases = CRM_Utils_Array::value('relatedCases', $_GET);
     require_once 'CRM/Case/XMLProcessor/Process.php';
     $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
     $isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients();
     $this->assign('multiClient', $isMultiClient);
     //pull the related cases.
     $this->assign('showRelatedCases', false);
     if ($this->_showRelatedCases) {
         $relatedCases = $this->get('relatedCases');
         if (!isset($relatedCases)) {
             $cId = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
             $caseId = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullObject);
             $relatedCases = CRM_Case_BAO_Case::getRelatedCases($caseId, $cId);
         }
         $this->assign('relatedCases', $relatedCases);
         $this->assign('showRelatedCases', true);
         return;
     }
     //check for civicase access.
     if (!CRM_Case_BAO_Case::accessCiviCase()) {
         CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
     }
     $this->_hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
     $this->assign('hasAccessToAllCases', $this->_hasAccessToAllCases);
     $this->_contactID = $this->get('cid');
     $this->_caseID = $this->get('id');
     $fulltext = CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject);
     if ($fulltext == 'fulltext') {
         $this->assign('fulltext', $fulltext);
     }
     $this->assign('caseID', $this->_caseID);
     $this->assign('contactID', $this->_contactID);
     //validate case id.
     $this->_userCases = array();
     $session = CRM_Core_Session::singleton();
     $userID = $session->get('userID');
     if (!$this->_hasAccessToAllCases) {
         $this->_userCases = CRM_Case_BAO_Case::getCases(false, $userID);
         if (!array_key_exists($this->_caseID, $this->_userCases)) {
             CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
         }
     }
     $this->assign('userID', $userID);
     if (CRM_Case_BAO_Case::caseCount($this->_contactID) >= 2) {
         $this->_mergeCases = true;
     }
     $this->assign('mergeCases', $this->_mergeCases);
     //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));
     require_once 'CRM/Case/PseudoConstant.php';
     $statuses = CRM_Case_PseudoConstant::caseStatus('label', false);
     $caseTypeName = CRM_Case_BAO_Case::getCaseType($this->_caseID, 'name');
     $caseType = CRM_Case_BAO_Case::getCaseType($this->_caseID);
     $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;
     $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);
     // Send Email activity requires a different URL format from all other activities
     $newActivityEmailUrl = CRM_Utils_System::url('civicrm/activity/add', "action=add&context=standalone&reset=1&caseid={$this->_caseID}&atype=", false, null, false);
     $this->assign('newActivityEmailUrl', $newActivityEmailUrl);
     $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;
     $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={$this->_caseID}&cid={$this->_contactID}&context=home");
     }
     // add the recently created case
     CRM_Utils_Recent::add($displayName . ' - ' . $caseType, $url, $this->_caseID, 'Case', $this->_contactID, null, $recentOther);
     //get the related cases for given case.
     $relatedCases = $this->get('relatedCases');
     if (!isset($relatedCases)) {
         $relatedCases = CRM_Case_BAO_Case::getRelatedCases($this->_caseID, $this->_contactID);
         $relatedCases = empty($relatedCases) ? false : $relatedCases;
         $this->set('relatedCases', $relatedCases);
     }
     $this->assign('hasRelatedCases', $relatedCases);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:96,代码来源:CaseView.php


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