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


PHP CRM_Contact_BAO_Relationship::getRelationType方法代码示例

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


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

示例1: buildQuickForm

 /**
  * Function to build the form
  *
  * @access public
  * @return None
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Add Contacts to Organization'));
     $this->addElement('text', 'name', ts('Find Target Organization'));
     $this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getRelationType("Organization"), true);
     $searchRows = $this->get('searchRows');
     $searchCount = $this->get('searchCount');
     if ($searchRows) {
         $checkBoxes = array();
         $chekFlag = 0;
         foreach ($searchRows as $id => $row) {
             if (!$chekFlag) {
                 $chekFlag = $id;
             }
             $checkBoxes[$id] = $this->createElement('radio', null, null, null, $id);
         }
         $this->addGroup($checkBoxes, 'contact_check');
         if ($chekFlag) {
             $checkBoxes[$chekFlag]->setChecked(true);
         }
         $this->assign('searchRows', $searchRows);
     }
     $this->assign('searchCount', $searchCount);
     $this->assign('searchDone', $this->get('searchDone'));
     $this->assign('contact_type_display', ts('Organization'));
     $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), array('class' => 'form-submit'));
     $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'form-submit'));
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Add to Organization'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:35,代码来源:AddToOrganization.php

示例2: buildQuickForm

 /**
  * Function to build the form
  *
  * @access public
  * @return None
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Add Members To Household'));
     $this->addElement('text', 'name', ts('Find Target Household'));
     $this->addElement('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getRelationType("Household"));
     $this->addRule('relationship_type_id', ts('Please select a relationship type.'), 'required');
     $searchRows = $this->get('searchRows');
     $searchCount = $this->get('searchCount');
     if ($searchRows) {
         $checkBoxes = array();
         $chekFlag = 0;
         foreach ($searchRows as $id => $row) {
             $checked = '';
             if (!$chekFlag) {
                 $checked = array('checked' => null);
                 $chekFlag++;
             }
             $checkBoxes[$id] = $this->createElement('radio', null, null, null, $id, $checked);
         }
         $this->addGroup($checkBoxes, 'contact_check');
         $this->assign('searchRows', $searchRows);
     }
     $this->assign('searchCount', $searchCount);
     $this->assign('searchDone', $this->get('searchDone'));
     $this->assign('contact_type_display', ts('Household'));
     $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), array('class' => 'form-submit'));
     $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'form-submit'));
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Add To Household'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:35,代码来源:AddToHousehold.php

示例3: buildQuickForm


//.........这里部分代码省略.........
     $this->add('select', 'add_activity_type_id', '', $activityLinks, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-plus twenty'));
     if ($this->_hasAccessToAllCases) {
         $this->add('select', 'report_id', '', array('' => ts('Activity Audit')) + $reports, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-clipboard'));
         $this->add('select', 'timeline_id', '', array('' => ts('Add Timeline')) + $reports, FALSE, array('class' => 'crm-select2 crm-action-menu action-icon-play'));
     }
     $this->addElement('submit', $this->getButtonName('next'), ' ', array('class' => 'hiddenElement'));
     if ($this->_mergeCases) {
         $allCases = CRM_Case_BAO_Case::getContactCases($this->_contactID);
         $otherCases = array();
         foreach ($allCases as $caseId => $details) {
             //filter current and own cases.
             if ($caseId == $this->_caseID || !$this->_hasAccessToAllCases && !array_key_exists($caseId, $this->_userCases)) {
                 continue;
             }
             $otherCases[$caseId] = 'Case ID: ' . $caseId . ' Type: ' . $details['case_type'] . ' Start: ' . $details['case_start_date'];
         }
         if (empty($otherCases)) {
             $this->_mergeCases = FALSE;
             $this->assign('mergeCases', $this->_mergeCases);
         } else {
             $this->add('select', 'merge_case_id', ts('Select Case for Merge'), array('' => ts('- select case -')) + $otherCases, FALSE, array('class' => 'crm-select2 huge'));
             $this->addElement('submit', $this->getButtonName('next', 'merge_case'), ts('Merge'), array('class' => 'crm-form-submit-inline hiddenElement'));
         }
     }
     //call activity form
     self::activityForm($this);
     //get case related relationships (Case Role)
     $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($this->_contactID, $this->_caseID);
     //save special label because we unset it in the loop
     $managerLabel = empty($managerRoleId) ? '' : $caseRoles[$managerRoleId];
     foreach ($caseRelationships as $key => &$value) {
         if (!empty($managerRoleId)) {
             if ($managerRoleId == $value['relation_type']) {
                 $value['relation'] = $managerLabel;
             }
         }
         //calculate roles that don't have relationships
         if (!empty($caseRoles[$value['relation_type']])) {
             unset($caseRoles[$value['relation_type']]);
         }
     }
     $this->assign('caseRelationships', $caseRelationships);
     //also add client as role. CRM-4438
     $caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($this->_caseID);
     $this->assign('caseRoles', $caseRoles);
     // Retrieve ALL client relationships
     $relClient = CRM_Contact_BAO_Relationship::getRelationship($this->_contactID, CRM_Contact_BAO_Relationship::CURRENT, 0, 0, 0, NULL, NULL, FALSE);
     // Now build 'Other Relationships' array by removing relationships that are already listed under Case Roles
     // so they don't show up twice.
     $clientRelationships = array();
     foreach ($relClient as $r) {
         if (!array_key_exists($r['id'], $caseRelationships)) {
             $clientRelationships[] = $r;
         }
     }
     $this->assign('clientRelationships', $clientRelationships);
     // Now global contact list that appears on all cases.
     $globalGroupInfo = array();
     CRM_Case_BAO_Case::getGlobalContacts($globalGroupInfo);
     $this->assign('globalGroupInfo', $globalGroupInfo);
     // List of relationship types
     $baoRel = new CRM_Contact_BAO_Relationship();
     $relType = $baoRel->getRelationType('Individual');
     $roleTypes = array();
     foreach ($relType as $k => $v) {
         $roleTypes[substr($k, 0, strpos($k, '_'))] = $v;
     }
     $this->add('select', 'role_type', ts('Relationship Type'), array('' => ts('- select type -')) + $roleTypes, FALSE, array('class' => 'crm-select2 twenty'));
     $hookCaseSummary = CRM_Utils_Hook::caseSummary($this->_caseID);
     if (is_array($hookCaseSummary)) {
         $this->assign('hookCaseSummary', $hookCaseSummary);
     }
     $allTags = CRM_Core_BAO_Tag::getTags('civicrm_case');
     if (!empty($allTags)) {
         $this->add('select', 'case_tag', ts('Tags'), $allTags, FALSE, array('id' => 'tags', 'multiple' => 'multiple', 'class' => 'crm-select2'));
         $tags = CRM_Core_BAO_EntityTag::getTag($this->_caseID, 'civicrm_case');
         $this->setDefaults(array('case_tag' => $tags));
         foreach ($tags as $tid) {
             if (isset($allTags[$tid])) {
                 $tags[$tid] = $allTags[$tid];
             } else {
                 unset($tags[$tid]);
             }
         }
         $this->assign('tags', implode(', ', array_filter($tags)));
         $this->assign('showTags', TRUE);
     } else {
         $this->assign('showTags', FALSE);
     }
     // build tagset widget
     // see if we have any tagsets which can be assigned to cases
     $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_case');
     if ($parentNames) {
         $this->assign('showTagsets', TRUE);
     } else {
         $this->assign('showTagsets', FALSE);
     }
     CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_case', $this->_caseID, FALSE, TRUE);
     $this->addButtons(array(array('type' => 'cancel', 'name' => ts('Done'), 'spacing' => '         ', 'isDefault' => TRUE)));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:CaseView.php

示例4: buildQuickForm


//.........这里部分代码省略.........
         }
     }
     $this->add('text', 'change_client_id', ts('Assign to another Client'));
     $this->add('hidden', 'contact_id', '', array('id' => 'contact_id'));
     $this->addElement('submit', $this->getButtonName('next', 'edit_client'), ts('Reassign Case'), array('class' => 'form-submit-inline', 'onclick' => "return checkSelection( this );"));
     $activityStatus = CRM_Core_PseudoConstant::activityStatus();
     $this->add('select', 'status_id', ts('Status'), array("" => ts(' - any status - ')) + $activityStatus);
     // activity dates
     $this->addDate('activity_date_low', ts('Activity Dates - From'), false, array('formatType' => 'searchDate'));
     $this->addDate('activity_date_high', ts('To'), false, array('formatType' => 'searchDate'));
     require_once "CRM/Core/Permission.php";
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $this->add('checkbox', 'activity_deleted', ts('Deleted Activities'));
     }
     //get case related relationships (Case Role)
     $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($this->_contactID, $this->_caseID);
     //build reporter select
     $reporters = array("" => ts(' - any reporter - '));
     foreach ($caseRelationships as $key => &$value) {
         $reporters[$value['cid']] = $value['name'] . " ( {$value['relation']} )";
         if ($managerRoleId == $value['relation_type']) {
             $value['relation'] = $caseRoles[$managerRoleId];
         }
         //calculate roles that don't have relationships
         if (CRM_Utils_Array::value($value['relation_type'], $caseRoles)) {
             unset($caseRoles[$value['relation_type']]);
         }
     }
     // take all case activity types for search filter, CRM-7187
     $aTypesFilter = array();
     $allCaseActTypes = CRM_Case_PseudoConstant::activityType();
     foreach ($allCaseActTypes as $typeDetails) {
         if (!in_array($typeDetails['name'], array('Open Case'))) {
             $aTypesFilter[$typeDetails['id']] = CRM_Utils_Array::value('label', $typeDetails);
         }
     }
     asort($aTypesFilter);
     $this->add('select', 'activity_type_filter_id', ts('Activity Type'), array('' => ts('- select activity type -')) + $aTypesFilter);
     $this->assign('caseRelationships', $caseRelationships);
     //also add client as role. CRM-4438
     $caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($this->_caseID);
     $this->assign('caseRoles', $caseRoles);
     $this->add('select', 'reporter_id', ts('Reporter/Role'), $reporters);
     // Retrieve ALL client relationships
     $relClient = CRM_Contact_BAO_Relationship::getRelationship($this->_contactID, CRM_Contact_BAO_Relationship::CURRENT, 0, 0, 0, null, null, false);
     // Now build 'Other Relationships' array by removing relationships that are already listed under Case Roles
     // so they don't show up twice.
     $clientRelationships = array();
     foreach ($relClient as $r) {
         if (!array_key_exists($r['id'], $caseRelationships)) {
             $clientRelationships[] = $r;
         }
     }
     $this->assign('clientRelationships', $clientRelationships);
     // Now global contact list that appears on all cases.
     $globalGroupInfo = array();
     $relGlobal = CRM_Case_BAO_Case::getGlobalContacts($globalGroupInfo);
     $this->assign('globalRelationships', $relGlobal);
     $this->assign('globalGroupInfo', $globalGroupInfo);
     // List of relationship types
     require_once 'CRM/Contact/BAO/Relationship.php';
     $baoRel = new CRM_Contact_BAO_Relationship();
     $relType = $baoRel->getRelationType('Individual');
     $roleTypes = array();
     foreach ($relType as $k => $v) {
         $roleTypes[substr($k, 0, strpos($k, '_'))] = $v;
     }
     $this->add('select', 'role_type', ts('Relationship Type'), array('' => ts('- select type -')) + $roleTypes);
     require_once 'CRM/Utils/Hook.php';
     $hookCaseSummary = CRM_Utils_Hook::caseSummary($this->_caseID);
     if (is_array($hookCaseSummary)) {
         $this->assign('hookCaseSummary', $hookCaseSummary);
     }
     require_once 'CRM/Core/BAO/EntityTag.php';
     require_once 'CRM/Core/BAO/Tag.php';
     $allTags = CRM_Core_BAO_Tag::getTags('civicrm_case');
     if (!empty($allTags)) {
         $this->add('select', 'case_tag', ts('Tags'), $allTags, false, array('id' => 'tags', 'multiple' => 'multiple', 'title' => ts('- select -')));
         $tags = CRM_Core_BAO_EntityTag::getTag($this->_caseID, 'civicrm_case');
         $this->setDefaults(array('case_tag' => $tags));
         foreach ($tags as $tid) {
             $tags[$tid] = $allTags[$tid];
         }
         $this->assign('tags', implode(', ', array_filter($tags)));
         $this->assign('showTags', true);
     } else {
         $this->assign('showTags', false);
     }
     // build tagset widget
     require_once 'CRM/Core/Form/Tag.php';
     // see if we have any tagsets which can be assigned to cases
     $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_case');
     if ($parentNames) {
         $this->assign('showTagsets', true);
     } else {
         $this->assign('showTagsets', false);
     }
     CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_case', $this->_caseID, false, true);
     $this->addButtons(array(array('type' => 'cancel', 'name' => ts('Done'), 'spacing' => '         ', 'isDefault' => true)));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:CaseView.php


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