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


PHP CRM_Case_BAO_Case::accessCase方法代码示例

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


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

示例1: relationship

 /**
  * @throws \CiviCRM_API3_Exception
  */
 public static function relationship()
 {
     $relType = CRM_Utils_Request::retrieve('rel_type', 'String', CRM_Core_DAO::$_nullObject, TRUE);
     $relContactID = CRM_Utils_Request::retrieve('rel_contact', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
     $originalCid = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject);
     $relationshipID = CRM_Utils_Request::retrieve('rel_id', 'Positive', CRM_Core_DAO::$_nullObject);
     $caseID = CRM_Utils_Request::retrieve('case_id', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
     if (!CRM_Case_BAO_Case::accessCase($caseID)) {
         CRM_Utils_System::permissionDenied();
     }
     $ret = array('is_error' => 0);
     list($relTypeId, $b, $a) = explode('_', $relType);
     if ($relationshipID && $originalCid) {
         CRM_Case_BAO_Case::endCaseRole($caseID, $a, $originalCid, $relTypeId);
     }
     $clientList = CRM_Case_BAO_Case::getCaseClients($caseID);
     // Loop through multiple case clients
     foreach ($clientList as $i => $sourceContactID) {
         $result = civicrm_api3('relationship', 'create', array('case_id' => $caseID, 'relationship_type_id' => $relTypeId, "contact_id_{$a}" => $relContactID, "contact_id_{$b}" => $sourceContactID, 'start_date' => 'now'));
         // Save activity only for the primary (first) client
         if ($i == 0 && empty($result['is_error'])) {
             CRM_Case_BAO_Case::createCaseRoleActivity($caseID, $result['id'], $relContactID);
         }
     }
     CRM_Utils_JSON::output($ret);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:29,代码来源:AJAX.php

示例2: deleteCaseRoles

 /**
  * Delete relationships specific to case and relationship type.
  */
 public static function deleteCaseRoles()
 {
     $caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');
     $relType = CRM_Utils_Type::escape($_POST['rel_type'], 'Positive');
     if (!$relType || !CRM_Case_BAO_Case::accessCase($caseId)) {
         CRM_Utils_System::permissionDenied();
     }
     $sql = "DELETE FROM civicrm_relationship WHERE case_id={$caseId} AND relationship_type_id={$relType}";
     CRM_Core_DAO::executeQuery($sql);
     CRM_Utils_System::civiExit();
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:14,代码来源:AJAX.php

示例3: deleteCaseRoles

 /**
  * Delete relationships specific to case and relationship type.
  */
 public static function deleteCaseRoles()
 {
     $caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');
     $cid = CRM_Utils_Type::escape($_POST['cid'], 'Positive');
     $relType = CRM_Utils_Request::retrieve('rel_type', 'String', CRM_Core_DAO::$_nullObject, TRUE);
     if (!$cid || !CRM_Case_BAO_Case::accessCase($caseId)) {
         CRM_Utils_System::permissionDenied();
     }
     list($relTypeId, $a, $b) = explode('_', $relType);
     CRM_Case_BAO_Case::endCaseRole($caseId, $b, $cid, $relTypeId);
     CRM_Utils_System::civiExit();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:15,代码来源:AJAX.php

示例4: preProcess

 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     $this->_showRelatedCases = CRM_Utils_Array::value('relatedCases', $_GET);
     $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);
         CRM_Utils_System::setTitle(ts('Related Cases'));
         return;
     }
     $this->_hasAccessToAllCases = CRM_Core_Permission::check('access all cases and activities');
     $this->assign('hasAccessToAllCases', $this->_hasAccessToAllCases);
     $this->assign('contactID', $this->_contactID = (int) $this->get('cid'));
     $this->assign('caseID', $this->_caseID = (int) $this->get('id'));
     // Access check.
     if (!CRM_Case_BAO_Case::accessCase($this->_caseID, FALSE)) {
         CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
     }
     $fulltext = CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject);
     if ($fulltext == 'fulltext') {
         $this->assign('fulltext', $fulltext);
     }
     $this->assign('contactType', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
     $this->assign('userID', CRM_Core_Session::getLoggedInContactID());
     //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);
     $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' => CRM_Utils_Array::value($values['case_status_id'], $statuses), 'case_subject' => CRM_Utils_Array::value('subject', $values), 'case_start_date' => $values['case_start_date']);
     $this->_caseType = $caseTypeName;
     $this->assign('caseDetails', $this->_caseDetails);
     $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
     $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);
     CRM_Utils_System::setTitle($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 viewed 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', (bool) $relatedCases);
     if ($relatedCases) {
         $this->assign('relatedCaseLabel', ts('%1 Related Case', array('count' => count($relatedCases), 'plural' => '%1 Related Cases')));
         $this->assign('relatedCaseUrl', CRM_Utils_System::url('civicrm/contact/view/case', array('id' => $this->_caseID, 'cid' => $this->_contactID, 'relatedCases' => 1, 'action' => 'view')));
     }
     $entitySubType = !empty($values['case_type_id']) ? $values['case_type_id'] : NULL;
     $this->assign('caseTypeID', $entitySubType);
     $groupTree = CRM_Core_BAO_CustomGroup::getTree('Case', $this, $this->_caseID, NULL, $entitySubType);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_caseID);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:77,代码来源:CaseView.php


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