當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Case_XMLProcessor::retrieve方法代碼示例

本文整理匯總了PHP中CRM_Case_XMLProcessor::retrieve方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Case_XMLProcessor::retrieve方法的具體用法?PHP CRM_Case_XMLProcessor::retrieve怎麽用?PHP CRM_Case_XMLProcessor::retrieve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Case_XMLProcessor的用法示例。


在下文中一共展示了CRM_Case_XMLProcessor::retrieve方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getManagedEntities

 public function getManagedEntities()
 {
     // Use hook_civicrm_caseTypes to build a list of OptionValues
     // In the long run, we may want more specialized logic for this, but
     // this design is fairly convenient and will allow us to replace it
     // without changing the hook_civicrm_caseTypes interface.
     $entities = array();
     $caseTypes = array();
     CRM_Utils_Hook::caseTypes($caseTypes);
     $proc = new CRM_Case_XMLProcessor();
     $caseTypesGroupId = civicrm_api3('OptionGroup', 'getvalue', array('name' => 'case_type', 'return' => 'id'));
     if (!is_numeric($caseTypesGroupId)) {
         throw new CRM_Core_Exception("Found invalid ID for OptionGroup (case_type)");
     }
     foreach ($caseTypes as $name => $caseType) {
         $xml = $proc->retrieve($name);
         if (!$xml) {
             throw new CRM_Core_Exception("Failed to load XML for case type (" . $name . ")");
         }
         if (isset($caseType['module'], $caseType['name'], $caseType['file'])) {
             $entities[] = array('module' => $caseType['module'], 'name' => $caseType['name'], 'entity' => 'OptionValue', 'params' => array('version' => 3, 'name' => $caseType['name'], 'label' => (string) $xml->name, 'description' => (string) $xml->description, 'option_group_id' => $caseTypesGroupId, 'is_reserved' => 1));
         } else {
             throw new CRM_Core_Exception("Invalid case type");
         }
     }
     return $entities;
 }
開發者ID:hguru,項目名稱:224Civi,代碼行數:27,代碼來源:Info.php

示例2: createManagedCaseTypes

 /**
  * Get a list of managed-entities representing auto-generated case-types
  * using hook_civicrm_caseTypes.
  *
  * @return array
  * @see CRM_Utils_Hook::managed
  * @throws CRM_Core_Exception
  */
 public static function createManagedCaseTypes()
 {
     $entities = array();
     // Use hook_civicrm_caseTypes to build a list of OptionValues
     // In the long run, we may want more specialized logic for this, but
     // this design is fairly convenient and will allow us to replace it
     // without changing the hook_civicrm_caseTypes interface.
     $caseTypes = array();
     CRM_Utils_Hook::caseTypes($caseTypes);
     $proc = new CRM_Case_XMLProcessor();
     foreach ($caseTypes as $name => $caseType) {
         $xml = $proc->retrieve($name);
         if (!$xml) {
             throw new CRM_Core_Exception("Failed to load XML for case type (" . $name . ")");
         }
         if (isset($caseType['module'], $caseType['name'], $caseType['file'])) {
             $entities[] = array('module' => $caseType['module'], 'name' => $caseType['name'], 'entity' => 'CaseType', 'params' => array('version' => 3, 'name' => $caseType['name'], 'title' => (string) $xml->name, 'description' => (string) $xml->description, 'is_reserved' => 1, 'is_active' => 1, 'weight' => $xml->weight ? $xml->weight : 1));
         } else {
             throw new CRM_Core_Exception("Invalid case type");
         }
     }
     return $entities;
 }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:31,代碼來源:ManagedEntities.php


注:本文中的CRM_Case_XMLProcessor::retrieve方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。