customTemplateDir) && $config->customTemplateDir ) { // check if the file exists in the custom templates directory $fileName = implode(DIRECTORY_SEPARATOR, array( $config->customTemplateDir, 'CRM', 'Case', 'xml', 'configuration', "$caseType.xml", ) ); } if (!$fileName || !file_exists($fileName) ) { // check if file exists locally $fileName = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'xml', 'configuration', "$caseType.xml", ) ); if (!file_exists($fileName)) { // check if file exists locally $fileName = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'xml', 'configuration.sample', "$caseType.xml", ) ); } if (!file_exists($fileName)) { if (self::$_hookCache === NULL) { self::$_hookCache = array(); CRM_Utils_Hook::caseTypes(self::$_hookCache); } if (isset(self::$_hookCache[$caseType], self::$_hookCache[$caseType]['file'])) { $fileName = self::$_hookCache[$caseType]['file']; } } if (!file_exists($fileName)) { return FALSE; } } // read xml file $dom = new DomDocument(); $dom->load($fileName); $dom->xinclude(); self::$_xml[$caseType] = simplexml_import_dom($dom); } return self::$_xml[$caseType]; } public static function mungeCaseType($caseType) { // trim all spaces from $caseType $caseType = str_replace('_', ' ', $caseType); $caseType = CRM_Utils_String::munge(ucwords($caseType), '', 0); return $caseType; } function &allActivityTypes($indexName = TRUE, $all = FALSE) { static $activityTypes = NULL; if (!$activityTypes) { $activityTypes = CRM_Case_PseudoConstant::caseActivityType($indexName, $all); } return $activityTypes; } function &allRelationshipTypes() { static $relationshipTypes = array(); if (!$relationshipTypes) { $relationshipInfo = CRM_Core_PseudoConstant::relationshipType(); $relationshipTypes = array(); foreach ($relationshipInfo as $id => $info) { $relationshipTypes[$id] = $info['label_b_a']; } } return $relationshipTypes; } }