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 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.
54 * array reference of all redaction rules
56 public static function redactionRule($filter = NULL) {
59 $condition = " AND (v.filter = 0 OR v.filter IS NULL)";
61 elseif ($filter === 1) {
62 $condition = " AND v.filter = 1";
65 return CRM_Core_OptionGroup
::values('redaction_rule', TRUE, FALSE, FALSE, $condition);
69 * Get all the case type.
72 * @param string $column
73 * @param bool $onlyActive
76 * array reference of all case type
78 public static function caseType($column = 'title', $onlyActive = TRUE) {
80 $condition = " is_active = 1 ";
87 CRM_Core_PseudoConstant
::populate(
89 'CRM_Case_DAO_CaseType',
102 * Get all the Encounter Medium.
105 * @param string $column
106 * @param bool $onlyActive
109 * array reference of all Encounter Medium.
111 public static function encounterMedium($column = 'label', $onlyActive = TRUE) {
112 return CRM_Core_OptionGroup
::values('encounter_medium',
113 FALSE, FALSE, FALSE, NULL,
119 * Get all Activity types for the CiviCase component.
121 * The static array activityType is returned
123 * @param bool $indexName
124 * True return activity name in array.
125 * key else activity id as array key.
131 * array reference of all activity types.
133 public static function &caseActivityType($indexName = TRUE, $all = FALSE) {
134 $cache = (int) $indexName . '_' . (int) $all;
136 if (!isset(Civi
::$statics[__CLASS__
]['activityTypeList'][$cache])) {
137 Civi
::$statics[__CLASS__
]['activityTypeList'][$cache] = [];
140 SELECT v.label as label ,v.value as value, v.name as name, v.description as description, v.icon
141 FROM civicrm_option_value v,
142 civicrm_option_group g
143 WHERE v.option_group_id = g.id
144 AND g.name = 'activity_type'
146 AND g.is_active = 1";
149 $componentId = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_Component',
153 $query .= " AND v.component_id = {$componentId} ";
156 $query .= " ORDER BY v.weight";
158 $dao = CRM_Core_DAO
::executeQuery($query);
161 while ($dao->fetch()) {
166 $index = $dao->value
;
168 $activityTypes[$index] = [];
169 $activityTypes[$index]['id'] = $dao->value
;
170 $activityTypes[$index]['label'] = $dao->label
;
171 $activityTypes[$index]['name'] = $dao->name
;
172 $activityTypes[$index]['icon'] = $dao->icon
;
173 $activityTypes[$index]['description'] = $dao->description
;
175 Civi
::$statics[__CLASS__
]['activityTypeList'][$cache] = $activityTypes;
177 return Civi
::$statics[__CLASS__
]['activityTypeList'][$cache];
181 * Flush given pseudoconstant so it can be reread from db
182 * next time it's requested.
185 * @param bool|string $name pseudoconstant to be flushed
187 public static function flush($name = 'cache') {
188 if (isset(self
::$
$name)) {