Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06b69b18 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CRM | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | class CRM_Core_OptionGroup { | |
36 | static $_values = array(); | |
37 | static $_cache = array(); | |
38 | ||
39 | /* | |
40 | * $_domainIDGroups array maintains the list of option groups for whom | |
41 | * domainID is to be considered. | |
42 | * | |
43 | */ | |
44 | static $_domainIDGroups = array( | |
45 | 'from_email_address', | |
46 | 'grant_type', | |
47 | ); | |
48 | ||
49 | static function &valuesCommon( | |
50 | $dao, $flip = FALSE, $grouping = FALSE, | |
51 | $localize = FALSE, $valueColumnName = 'label' | |
52 | ) { | |
53 | self::$_values = array(); | |
54 | ||
55 | while ($dao->fetch()) { | |
56 | if ($flip) { | |
57 | if ($grouping) { | |
58 | self::$_values[$dao->value] = $dao->grouping; | |
59 | } | |
60 | else { | |
61 | self::$_values[$dao->{$valueColumnName}] = $dao->value; | |
62 | } | |
63 | } | |
64 | else { | |
65 | if ($grouping) { | |
66 | self::$_values[$dao->{$valueColumnName}] = $dao->grouping; | |
67 | } | |
68 | else { | |
69 | self::$_values[$dao->value] = $dao->{$valueColumnName}; | |
70 | } | |
71 | } | |
72 | } | |
73 | if ($localize) { | |
74 | $i18n = CRM_Core_I18n::singleton(); | |
75 | $i18n->localizeArray(self::$_values); | |
76 | } | |
77 | return self::$_values; | |
78 | } | |
79 | ||
80 | /** | |
81 | * This function retrieves all the values for the specific option group by name | |
82 | * this is primarily used to create various html based form elements | |
83 | * (radio, select, checkbox etc). OptionGroups for most cases have the | |
84 | * 'label' in the label colum and the 'id' or 'name' in the value column | |
85 | * | |
86 | * @param $name string name of the option group | |
87 | * @param $flip boolean results are return in id => label format if false | |
88 | * if true, the results are reversed | |
89 | * @param $grouping boolean if true, return the value in 'grouping' column | |
90 | * @param $localize boolean if true, localize the results before returning | |
91 | * @param $condition string add another condition to the sql query | |
92 | * @param $labelColumnName string the column to use for 'label' | |
93 | * @param $onlyActive boolean return only the action option values | |
94 | * @param $fresh boolean ignore cache entries and go back to DB | |
3f3a3ba0 | 95 | * @param $keyColumnName string the column to use for 'key' |
6a488035 TO |
96 | * |
97 | * @return array the values as specified by the above params | |
98 | * @static | |
99 | * @void | |
100 | */ | |
101 | static function &values( | |
102 | $name, $flip = FALSE, $grouping = FALSE, | |
103 | $localize = FALSE, $condition = NULL, | |
c0c9cd82 | 104 | $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE, $keyColumnName = 'value' |
6a488035 | 105 | ) { |
be80e977 | 106 | $cache = CRM_Utils_Cache::singleton(); |
c0c9cd82 | 107 | $cacheKey = self::createCacheKey($name, $flip, $grouping, $localize, $condition, $labelColumnName, $onlyActive, $keyColumnName); |
6a488035 | 108 | |
c0c9cd82 CW |
109 | if (!$fresh) { |
110 | // Fetch from static var | |
111 | if (array_key_exists($cacheKey, self::$_cache)) { | |
112 | return self::$_cache[$cacheKey]; | |
113 | } | |
114 | // Fetch from main cache | |
c0c9cd82 CW |
115 | $var = $cache->get($cacheKey); |
116 | if ($var) { | |
117 | return $var; | |
118 | } | |
6a488035 TO |
119 | } |
120 | ||
121 | $query = " | |
c0c9cd82 | 122 | SELECT v.{$labelColumnName} as {$labelColumnName} ,v.{$keyColumnName} as value, v.grouping as grouping |
6a488035 TO |
123 | FROM civicrm_option_value v, |
124 | civicrm_option_group g | |
125 | WHERE v.option_group_id = g.id | |
126 | AND g.name = %1 | |
127 | AND g.is_active = 1 "; | |
128 | ||
129 | if ($onlyActive) { | |
130 | $query .= " AND v.is_active = 1 "; | |
131 | } | |
132 | if (in_array($name, self::$_domainIDGroups)) { | |
133 | $query .= " AND v.domain_id = " . CRM_Core_Config::domainID(); | |
134 | } | |
135 | ||
136 | if ($condition) { | |
137 | $query .= $condition; | |
138 | } | |
139 | ||
c0c9cd82 | 140 | $query .= " ORDER BY v.weight"; |
6a488035 TO |
141 | |
142 | $p = array(1 => array($name, 'String')); | |
143 | $dao = CRM_Core_DAO::executeQuery($query, $p); | |
144 | ||
145 | $var = self::valuesCommon($dao, $flip, $grouping, $localize, $labelColumnName); | |
146 | ||
147 | // call option value hook | |
148 | CRM_Utils_Hook::optionValues($var, $name); | |
149 | ||
150 | self::$_cache[$cacheKey] = $var; | |
151 | $cache->set($cacheKey, $var); | |
152 | ||
153 | return $var; | |
154 | } | |
155 | ||
156 | /** | |
157 | * Counterpart to values() which removes the item from the cache | |
158 | * | |
159 | * @param $name | |
160 | * @param $flip | |
161 | * @param $grouping | |
162 | * @param $localize | |
163 | * @param $condition | |
164 | * @param $labelColumnName | |
165 | * @param $onlyActive | |
da6b46f4 | 166 | * @param string $keyColumnName |
6a488035 | 167 | */ |
c0c9cd82 CW |
168 | protected static function flushValues($name, $flip, $grouping, $localize, $condition, $labelColumnName, $onlyActive, $keyColumnName = 'value') { |
169 | $cacheKey = self::createCacheKey($name, $flip, $grouping, $localize, $condition, $labelColumnName, $onlyActive, $keyColumnName); | |
6a488035 TO |
170 | $cache = CRM_Utils_Cache::singleton(); |
171 | $cache->delete($cacheKey); | |
172 | unset(self::$_cache[$cacheKey]); | |
173 | } | |
174 | ||
c0c9cd82 CW |
175 | protected static function createCacheKey() { |
176 | $cacheKey = "CRM_OG_" . serialize(func_get_args()); | |
6a488035 TO |
177 | return $cacheKey; |
178 | } | |
179 | ||
180 | /** | |
181 | * This function retrieves all the values for the specific option group by id | |
182 | * this is primarily used to create various html based form elements | |
183 | * (radio, select, checkbox etc). OptionGroups for most cases have the | |
184 | * 'label' in the label colum and the 'id' or 'name' in the value column | |
185 | * | |
186 | * @param $id integer id of the option group | |
187 | * @param $flip boolean results are return in id => label format if false | |
188 | * if true, the results are reversed | |
189 | * @param $grouping boolean if true, return the value in 'grouping' column | |
190 | * @param $localize boolean if true, localize the results before returning | |
191 | * @param $labelColumnName string the column to use for 'label' | |
192 | * | |
da6b46f4 EM |
193 | * @param bool $onlyActive |
194 | * @param bool $fresh | |
195 | * | |
6a488035 TO |
196 | * @return array the values as specified by the above params |
197 | * @static | |
198 | * @void | |
199 | */ | |
786ad6e1 CW |
200 | static function &valuesByID($id, $flip = FALSE, $grouping = FALSE, $localize = FALSE, $labelColumnName = 'label', $onlyActive = TRUE, $fresh = FALSE) { |
201 | $cacheKey = self::createCacheKey($id, $flip, $grouping, $localize, $labelColumnName, $onlyActive); | |
6a488035 TO |
202 | |
203 | $cache = CRM_Utils_Cache::singleton(); | |
786ad6e1 CW |
204 | if (!$fresh) { |
205 | $var = $cache->get($cacheKey); | |
206 | if ($var) { | |
207 | return $var; | |
208 | } | |
6a488035 TO |
209 | } |
210 | $query = " | |
211 | SELECT v.{$labelColumnName} as {$labelColumnName} ,v.value as value, v.grouping as grouping | |
212 | FROM civicrm_option_value v, | |
213 | civicrm_option_group g | |
214 | WHERE v.option_group_id = g.id | |
215 | AND g.id = %1 | |
6a488035 | 216 | AND g.is_active = 1 |
6a488035 | 217 | "; |
786ad6e1 CW |
218 | if ($onlyActive) { |
219 | $query .= " AND v.is_active = 1 "; | |
220 | } | |
221 | $query .= " ORDER BY v.weight, v.label"; | |
222 | ||
6a488035 TO |
223 | $p = array(1 => array($id, 'Integer')); |
224 | $dao = CRM_Core_DAO::executeQuery($query, $p); | |
225 | ||
226 | $var = self::valuesCommon($dao, $flip, $grouping, $localize, $labelColumnName); | |
227 | $cache->set($cacheKey, $var); | |
228 | ||
229 | return $var; | |
230 | } | |
231 | ||
232 | /** | |
233 | * Function to lookup titles OR ids for a set of option_value populated fields. The retrieved value | |
234 | * is assigned a new fieldname by id or id's by title | |
235 | * (each within a specificied option_group) | |
236 | * | |
237 | * @param array $params Reference array of values submitted by the form. Based on | |
238 | * $flip, creates new elements in $params for each field in | |
239 | * the $names array. | |
240 | * If $flip = false, adds root field name => title | |
241 | * If $flip = true, adds actual field name => id | |
242 | * | |
243 | * @param array $names Reference array of fieldnames we want transformed. | |
244 | * Array key = 'postName' (field name submitted by form in $params). | |
245 | * Array value = array( | |
246 | 'newName' => $newName, 'groupName' => $groupName). | |
247 | * | |
248 | * | |
249 | * @param boolean $flip | |
250 | * | |
251 | * @return void | |
252 | * | |
253 | * @access public | |
254 | * @static | |
255 | */ | |
256 | static function lookupValues(&$params, &$names, $flip = FALSE) { | |
257 | foreach ($names as $postName => $value) { | |
258 | // See if $params field is in $names array (i.e. is a value that we need to lookup) | |
259 | if ($postalName = CRM_Utils_Array::value($postName, $params)) { | |
260 | $postValues = array(); | |
261 | // params[$postName] may be a Ctrl+A separated value list | |
262 | if (is_string($postalName) && | |
263 | strpos($postalName, CRM_Core_DAO::VALUE_SEPARATOR) == FALSE | |
264 | ) { | |
265 | // eliminate the ^A frm the beginning and end if present | |
266 | if (substr($postalName, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR) { | |
267 | $params[$postName] = substr($params[$postName], 1, -1); | |
268 | } | |
269 | $postValues = explode(CRM_Core_DAO::VALUE_SEPARATOR, $params[$postName]); | |
270 | } | |
271 | elseif (is_array($postalName)) { | |
272 | $postValues = $postalName; | |
273 | } | |
274 | $newValue = array(); | |
275 | foreach ($postValues as $postValue) { | |
276 | if (!$postValue) { | |
277 | continue; | |
278 | } | |
279 | ||
280 | if ($flip) { | |
281 | $p = array(1 => array($postValue, 'String')); | |
282 | $lookupBy = 'v.label= %1'; | |
283 | $select = "v.value"; | |
284 | } | |
285 | else { | |
286 | $p = array(1 => array($postValue, 'Integer')); | |
287 | $lookupBy = 'v.value = %1'; | |
288 | $select = "v.label"; | |
289 | } | |
290 | ||
291 | $p[2] = array($value['groupName'], 'String'); | |
292 | $query = " | |
293 | SELECT $select | |
294 | FROM civicrm_option_value v, | |
295 | civicrm_option_group g | |
296 | WHERE v.option_group_id = g.id | |
297 | AND g.name = %2 | |
298 | AND $lookupBy"; | |
299 | ||
300 | $newValue[] = CRM_Core_DAO::singleValueQuery($query, $p); | |
301 | $newValue = str_replace(',', '_', $newValue); | |
302 | } | |
303 | $params[$value['newName']] = implode(', ', $newValue); | |
304 | } | |
305 | } | |
306 | } | |
307 | ||
308 | static function getLabel($groupName, $value, $onlyActiveValue = TRUE) { | |
309 | if (empty($groupName) || | |
310 | empty($value) | |
311 | ) { | |
312 | return NULL; | |
313 | } | |
314 | ||
315 | $query = " | |
316 | SELECT v.label as label ,v.value as value | |
317 | FROM civicrm_option_value v, | |
318 | civicrm_option_group g | |
319 | WHERE v.option_group_id = g.id | |
320 | AND g.name = %1 | |
321 | AND g.is_active = 1 | |
322 | AND v.value = %2 | |
323 | "; | |
324 | if ($onlyActiveValue) { | |
325 | $query .= " AND v.is_active = 1 "; | |
326 | } | |
327 | $p = array(1 => array($groupName, 'String'), | |
328 | 2 => array($value, 'Integer'), | |
329 | ); | |
330 | $dao = CRM_Core_DAO::executeQuery($query, $p); | |
331 | if ($dao->fetch()) { | |
332 | return $dao->label; | |
333 | } | |
334 | return NULL; | |
335 | } | |
336 | ||
337 | static function getValue($groupName, | |
338 | $label, | |
339 | $labelField = 'label', | |
340 | $labelType = 'String', | |
341 | $valueField = 'value' | |
342 | ) { | |
343 | if (empty($label)) { | |
344 | return NULL; | |
345 | } | |
346 | ||
347 | $query = " | |
348 | SELECT v.label as label ,v.{$valueField} as value | |
349 | FROM civicrm_option_value v, | |
350 | civicrm_option_group g | |
351 | WHERE v.option_group_id = g.id | |
352 | AND g.name = %1 | |
353 | AND v.is_active = 1 | |
354 | AND g.is_active = 1 | |
355 | AND v.$labelField = %2 | |
356 | "; | |
357 | ||
358 | $p = array(1 => array($groupName, 'String'), | |
359 | 2 => array($label, $labelType), | |
360 | ); | |
361 | $dao = CRM_Core_DAO::executeQuery($query, $p); | |
362 | if ($dao->fetch()) { | |
363 | $dao->free(); | |
364 | return $dao->value; | |
365 | } | |
366 | $dao->free(); | |
367 | return NULL; | |
368 | } | |
369 | ||
343d84fa DG |
370 | /** |
371 | * Get option_value.value from default option_value row for an option group | |
372 | * | |
373 | * @param string $groupName the name of the option group | |
374 | * | |
375 | * @access public | |
376 | * @static | |
377 | * | |
378 | * @return string the value from the row where is_default = true | |
8ef12e64 | 379 | */ |
343d84fa DG |
380 | static function getDefaultValue($groupName) { |
381 | if (empty($groupName)) { | |
382 | return NULL; | |
383 | } | |
384 | $query = " | |
385 | SELECT v.value | |
386 | FROM civicrm_option_value v, | |
387 | civicrm_option_group g | |
388 | WHERE v.option_group_id = g.id | |
389 | AND g.name = %1 | |
390 | AND v.is_active = 1 | |
391 | AND g.is_active = 1 | |
392 | AND v.is_default = 1 | |
393 | "; | |
394 | if (in_array($groupName, self::$_domainIDGroups)) { | |
395 | $query .= " AND v.domain_id = " . CRM_Core_Config::domainID(); | |
396 | } | |
397 | ||
398 | $p = array(1 => array($groupName, 'String')); | |
399 | return CRM_Core_DAO::singleValueQuery($query, $p); | |
400 | } | |
8ef12e64 | 401 | |
6a488035 TO |
402 | /** |
403 | * Creates a new option group with the passed in values | |
404 | * @TODO: Should update the group if it already exists intelligently, so multi-lingual is | |
405 | * not messed up. Currently deletes the old group | |
406 | * | |
407 | * @param string $groupName the name of the option group - make sure there is no conflict | |
2a6da8d7 | 408 | * @param array $values the associative array that has information on the option values |
6a488035 TO |
409 | * the keys of this array are: |
410 | * string 'title' (required) | |
411 | * string 'value' (required) | |
412 | * string 'name' (optional) | |
413 | * string 'description' (optional) | |
414 | * int 'weight' (optional) - the order in which the value are displayed | |
415 | * bool 'is_default' (optional) - is this the default one to display when rendered in form | |
416 | * bool 'is_active' (optional) - should this element be rendered | |
2a6da8d7 EM |
417 | * @param int $defaultID (reference) - the option value ID of the default element (if set) is returned else 'null' |
418 | * @param null $groupTitle | |
419 | * | |
420 | * @internal param string $groupLabel - the optional label of the option group else set to group name | |
6a488035 TO |
421 | * |
422 | * @access public | |
423 | * @static | |
424 | * | |
425 | * @return int the option group ID | |
6a488035 TO |
426 | */ |
427 | static function createAssoc($groupName, &$values, &$defaultID, $groupTitle = NULL) { | |
428 | self::deleteAssoc($groupName); | |
429 | if (!empty($values)) { | |
430 | $group = new CRM_Core_DAO_OptionGroup(); | |
431 | $group->name = $groupName; | |
432 | $group->title = empty($groupTitle) ? $groupName : $groupTitle; | |
433 | $group->is_reserved = 1; | |
434 | $group->is_active = 1; | |
435 | $group->save(); | |
436 | ||
437 | foreach ($values as $v) { | |
438 | $value = new CRM_Core_DAO_OptionValue(); | |
439 | $value->option_group_id = $group->id; | |
440 | $value->label = $v['label']; | |
441 | $value->value = $v['value']; | |
442 | $value->name = CRM_Utils_Array::value('name', $v); | |
443 | $value->description = CRM_Utils_Array::value('description', $v); | |
444 | $value->weight = CRM_Utils_Array::value('weight', $v); | |
445 | $value->is_default = CRM_Utils_Array::value('is_default', $v); | |
446 | $value->is_active = CRM_Utils_Array::value('is_active', $v); | |
447 | $value->save(); | |
448 | ||
449 | if ($value->is_default) { | |
450 | $defaultID = $value->id; | |
451 | } | |
452 | } | |
453 | } | |
454 | else { | |
455 | return $defaultID = 'null'; | |
456 | } | |
457 | ||
458 | return $group->id; | |
459 | } | |
460 | ||
461 | static function getAssoc($groupName, &$values, $flip = FALSE, $field = 'name') { | |
462 | $query = " | |
463 | SELECT v.id as amount_id, v.value, v.label, v.name, v.description, v.weight | |
464 | FROM civicrm_option_group g, | |
465 | civicrm_option_value v | |
466 | WHERE g.id = v.option_group_id | |
467 | AND g.$field = %1 | |
468 | ORDER BY v.weight | |
469 | "; | |
470 | $params = array(1 => array($groupName, 'String')); | |
471 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
472 | ||
473 | $fields = array('value', 'label', 'name', 'description', 'amount_id', 'weight'); | |
474 | if ($flip) { | |
475 | $values = array(); | |
476 | } | |
477 | else { | |
478 | foreach ($fields as $field) { | |
479 | $values[$field] = array(); | |
480 | } | |
481 | } | |
482 | $index = 1; | |
483 | ||
484 | while ($dao->fetch()) { | |
485 | if ($flip) { | |
486 | $value = array(); | |
487 | foreach ($fields as $field) { | |
488 | $value[$field] = $dao->$field; | |
489 | } | |
490 | $values[$dao->amount_id] = $value; | |
491 | } | |
492 | else { | |
493 | foreach ($fields as $field) { | |
494 | $values[$field][$index] = $dao->$field; | |
495 | } | |
496 | $index++; | |
497 | } | |
498 | } | |
499 | } | |
500 | ||
501 | static function deleteAssoc($groupName, $operator = "=") { | |
502 | $query = " | |
503 | DELETE g, v | |
504 | FROM civicrm_option_group g, | |
505 | civicrm_option_value v | |
506 | WHERE g.id = v.option_group_id | |
507 | AND g.name {$operator} %1"; | |
508 | ||
509 | $params = array(1 => array($groupName, 'String')); | |
510 | ||
511 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
512 | } | |
513 | ||
514 | static function optionLabel($groupName, $value) { | |
515 | $query = " | |
516 | SELECT v.label | |
517 | FROM civicrm_option_group g, | |
518 | civicrm_option_value v | |
519 | WHERE g.id = v.option_group_id | |
520 | AND g.name = %1 | |
521 | AND v.value = %2"; | |
522 | $params = array(1 => array($groupName, 'String'), | |
523 | 2 => array($value, 'String'), | |
524 | ); | |
525 | return CRM_Core_DAO::singleValueQuery($query, $params); | |
526 | } | |
527 | ||
528 | static function getRowValues($groupName, $fieldValue, $field = 'name', | |
529 | $fieldType = 'String', $active = TRUE | |
530 | ) { | |
531 | $query = " | |
532 | SELECT v.id, v.label, v.value, v.name, v.weight, v.description | |
533 | FROM civicrm_option_value v, | |
534 | civicrm_option_group g | |
535 | WHERE v.option_group_id = g.id | |
536 | AND g.name = %1 | |
537 | AND g.is_active = 1 | |
538 | AND v.$field = %2 | |
539 | "; | |
540 | ||
541 | if ($active) { | |
542 | $query .= " AND v.is_active = 1"; | |
543 | } | |
544 | ||
545 | $p = array(1 => array($groupName, 'String'), | |
546 | 2 => array($fieldValue, $fieldType), | |
547 | ); | |
548 | $dao = CRM_Core_DAO::executeQuery($query, $p); | |
549 | $row = array(); | |
550 | ||
551 | if ($dao->fetch()) { | |
552 | foreach (array( | |
553 | 'id', 'name', 'value', 'label', 'weight', 'description') as $fld) { | |
554 | $row[$fld] = $dao->$fld; | |
555 | } | |
556 | } | |
557 | return $row; | |
558 | } | |
559 | ||
560 | /* | |
561 | * Wrapper for calling values with fresh set to true to empty the given value | |
562 | * | |
563 | * Since there appears to be some inconsistency | |
564 | * (@todo remove inconsistency) around the pseudoconstant operations | |
565 | * (for example CRM_Contribution_Pseudoconstant::paymentInstrument doesn't specify isActive | |
566 | * which is part of the cache key | |
567 | * will do a couple of variations & aspire to someone cleaning it up later | |
568 | */ | |
569 | static function flush($name, $params = array()){ | |
570 | $defaults = array( | |
571 | 'flip' => FALSE, | |
572 | 'grouping' => FALSE, | |
573 | 'localize' => FALSE, | |
574 | 'condition' => NULL, | |
575 | 'labelColumnName' => 'label', | |
576 | ); | |
577 | ||
578 | $params = array_merge($defaults, $params); | |
579 | self::flushValues( | |
580 | $name, | |
581 | $params['flip'], | |
582 | $params['grouping'], | |
583 | $params['localize'], | |
584 | $params['condition'], | |
585 | $params['labelColumnName'], | |
586 | TRUE, | |
587 | TRUE | |
588 | ); | |
589 | self::flushValues( | |
590 | $name, | |
591 | $params['flip'], | |
592 | $params['grouping'], | |
593 | $params['localize'], | |
594 | $params['condition'], | |
595 | $params['labelColumnName'], | |
596 | FALSE, | |
597 | TRUE | |
598 | ); | |
599 | } | |
600 | ||
601 | static function flushAll() { | |
602 | self::$_values = array(); | |
603 | self::$_cache = array(); | |
a4a33486 | 604 | CRM_Utils_Cache::singleton()->flush(); |
6a488035 TO |
605 | } |
606 | } | |
607 |