3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class holds all the Pseudo constants that are specific for CiviCase.
21 class CRM_Case_PseudoConstant
extends CRM_Core_PseudoConstant
{
24 * Get all the case statues.
27 * @param string $column
28 * @param bool $onlyActive
29 * @param string|null $condition
33 * array reference of all case statues
35 public static function caseStatus($column = 'label', $onlyActive = TRUE, $condition = NULL, $fresh = FALSE) {
37 $condition = 'AND filter = 0';
40 return CRM_Core_OptionGroup
::values('case_status',
41 FALSE, FALSE, FALSE, $condition,
42 $column, $onlyActive, $fresh
48 * Get all the redaction rules.
53 * array reference of all redaction rules
55 public static function redactionRule($filter = NULL) {
58 $condition = " AND (v.filter = 0 OR v.filter IS NULL)";
60 elseif ($filter === 1) {
61 $condition = " AND v.filter = 1";
64 return CRM_Core_OptionGroup
::values('redaction_rule', TRUE, FALSE, FALSE, $condition);
68 * Get all the case type.
71 * @param string $column
72 * @param bool $onlyActive
75 * array reference of all case type
77 public static function caseType($column = 'title', $onlyActive = TRUE) {
79 $condition = " is_active = 1 ";
86 CRM_Core_PseudoConstant
::populate(
88 'CRM_Case_DAO_CaseType',
101 * Get all the Encounter Medium.
104 * @param string $column
105 * @param bool $onlyActive
108 * array reference of all Encounter Medium.
110 public static function encounterMedium($column = 'label', $onlyActive = TRUE) {
111 return CRM_Core_OptionGroup
::values('encounter_medium',
112 FALSE, FALSE, FALSE, NULL,
118 * Get all Activity types for the CiviCase component.
120 * The static array activityType is returned
122 * @param bool $indexName
123 * True return activity name in array.
124 * key else activity id as array key.
130 * array reference of all activity types.
132 public static function &caseActivityType($indexName = TRUE, $all = FALSE) {
133 $cache = (int) $indexName . '_' . (int) $all;
135 if (!isset(Civi
::$statics[__CLASS__
]['activityTypeList'][$cache])) {
136 Civi
::$statics[__CLASS__
]['activityTypeList'][$cache] = [];
139 SELECT v.label as label ,v.value as value, v.name as name, v.description as description, v.icon
140 FROM civicrm_option_value v,
141 civicrm_option_group g
142 WHERE v.option_group_id = g.id
143 AND g.name = 'activity_type'
145 AND g.is_active = 1";
148 $componentId = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_Component',
152 $query .= " AND v.component_id = {$componentId} ";
155 $query .= " ORDER BY v.weight";
157 $dao = CRM_Core_DAO
::executeQuery($query);
160 while ($dao->fetch()) {
165 $index = $dao->value
;
167 $activityTypes[$index] = [];
168 $activityTypes[$index]['id'] = $dao->value
;
169 $activityTypes[$index]['label'] = $dao->label
;
170 $activityTypes[$index]['name'] = $dao->name
;
171 $activityTypes[$index]['icon'] = $dao->icon
;
172 $activityTypes[$index]['description'] = $dao->description
;
174 Civi
::$statics[__CLASS__
]['activityTypeList'][$cache] = $activityTypes;
176 return Civi
::$statics[__CLASS__
]['activityTypeList'][$cache];
180 * Flush given pseudoconstant so it can be reread from db
181 * next time it's requested.
184 * @param bool|string $name pseudoconstant to be flushed
186 public static function flush($name = 'cache') {
187 if (isset(self
::$
$name)) {