Merge pull request #22228 from colemanw/managedGroup
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:27a1b80ba9d2696e97dd1df33468caff)
10 */
11
12 /**
13 * Database access object for the CustomGroup entity.
14 */
15 class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_custom_group';
25
26 /**
27 * Field to show when displaying a record.
28 *
29 * @var string
30 */
31 public static $_labelField = 'title';
32
33 /**
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
35 *
36 * @var bool
37 */
38 public static $_log = TRUE;
39
40 /**
41 * Unique Custom Group ID
42 *
43 * @var int
44 */
45 public $id;
46
47 /**
48 * Variable name/programmatic handle for this group.
49 *
50 * @var string
51 */
52 public $name;
53
54 /**
55 * Friendly Name.
56 *
57 * @var string
58 */
59 public $title;
60
61 /**
62 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
63 *
64 * @var string
65 */
66 public $extends;
67
68 /**
69 * FK to civicrm_option_value.id (for option group custom_data_type.)
70 *
71 * @var int
72 */
73 public $extends_entity_column_id;
74
75 /**
76 * linking custom group for dynamic object
77 *
78 * @var string
79 */
80 public $extends_entity_column_value;
81
82 /**
83 * Visual relationship between this form and its parent.
84 *
85 * @var string
86 */
87 public $style;
88
89 /**
90 * Will this group be in collapsed or expanded mode on initial display ?
91 *
92 * @var bool
93 */
94 public $collapse_display;
95
96 /**
97 * Description and/or help text to display before fields in form.
98 *
99 * @var text
100 */
101 public $help_pre;
102
103 /**
104 * Description and/or help text to display after fields in form.
105 *
106 * @var text
107 */
108 public $help_post;
109
110 /**
111 * Controls display order when multiple extended property groups are setup for the same class.
112 *
113 * @var int
114 */
115 public $weight;
116
117 /**
118 * Is this property active?
119 *
120 * @var bool
121 */
122 public $is_active;
123
124 /**
125 * Name of the table that holds the values for this group.
126 *
127 * @var string
128 */
129 public $table_name;
130
131 /**
132 * Does this group hold multiple values?
133 *
134 * @var bool
135 */
136 public $is_multiple;
137
138 /**
139 * minimum number of multiple records (typically 0?)
140 *
141 * @var int
142 */
143 public $min_multiple;
144
145 /**
146 * maximum number of multiple records, if 0 - no max
147 *
148 * @var int
149 */
150 public $max_multiple;
151
152 /**
153 * Will this group be in collapsed or expanded mode on advanced search display ?
154 *
155 * @var bool
156 */
157 public $collapse_adv_display;
158
159 /**
160 * FK to civicrm_contact, who created this custom group
161 *
162 * @var int
163 */
164 public $created_id;
165
166 /**
167 * Date and time this custom group was created.
168 *
169 * @var datetime
170 */
171 public $created_date;
172
173 /**
174 * Is this a reserved Custom Group?
175 *
176 * @var bool
177 */
178 public $is_reserved;
179
180 /**
181 * Is this property public?
182 *
183 * @var bool
184 */
185 public $is_public;
186
187 /**
188 * crm-i icon class
189 *
190 * @var string
191 */
192 public $icon;
193
194 /**
195 * Class constructor.
196 */
197 public function __construct() {
198 $this->__table = 'civicrm_custom_group';
199 parent::__construct();
200 }
201
202 /**
203 * Returns localized title of this entity.
204 *
205 * @param bool $plural
206 * Whether to return the plural version of the title.
207 */
208 public static function getEntityTitle($plural = FALSE) {
209 return $plural ? ts('Custom Field Groups') : ts('Custom Field Group');
210 }
211
212 /**
213 * Returns foreign keys and entity references.
214 *
215 * @return array
216 * [CRM_Core_Reference_Interface]
217 */
218 public static function getReferenceColumns() {
219 if (!isset(Civi::$statics[__CLASS__]['links'])) {
220 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
221 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
222 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
223 }
224 return Civi::$statics[__CLASS__]['links'];
225 }
226
227 /**
228 * Returns all the column names of this table
229 *
230 * @return array
231 */
232 public static function &fields() {
233 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
234 Civi::$statics[__CLASS__]['fields'] = [
235 'id' => [
236 'name' => 'id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Custom Group ID'),
239 'description' => ts('Unique Custom Group ID'),
240 'required' => TRUE,
241 'where' => 'civicrm_custom_group.id',
242 'table_name' => 'civicrm_custom_group',
243 'entity' => 'CustomGroup',
244 'bao' => 'CRM_Core_BAO_CustomGroup',
245 'localizable' => 0,
246 'html' => [
247 'type' => 'Number',
248 ],
249 'readonly' => TRUE,
250 'add' => '1.1',
251 ],
252 'name' => [
253 'name' => 'name',
254 'type' => CRM_Utils_Type::T_STRING,
255 'title' => ts('Custom Group Name'),
256 'description' => ts('Variable name/programmatic handle for this group.'),
257 'maxlength' => 64,
258 'size' => CRM_Utils_Type::BIG,
259 'where' => 'civicrm_custom_group.name',
260 'table_name' => 'civicrm_custom_group',
261 'entity' => 'CustomGroup',
262 'bao' => 'CRM_Core_BAO_CustomGroup',
263 'localizable' => 0,
264 'add' => '1.1',
265 ],
266 'title' => [
267 'name' => 'title',
268 'type' => CRM_Utils_Type::T_STRING,
269 'title' => ts('Custom Group Title'),
270 'description' => ts('Friendly Name.'),
271 'required' => TRUE,
272 'maxlength' => 64,
273 'size' => CRM_Utils_Type::BIG,
274 'where' => 'civicrm_custom_group.title',
275 'table_name' => 'civicrm_custom_group',
276 'entity' => 'CustomGroup',
277 'bao' => 'CRM_Core_BAO_CustomGroup',
278 'localizable' => 1,
279 'add' => '1.1',
280 ],
281 'extends' => [
282 'name' => 'extends',
283 'type' => CRM_Utils_Type::T_STRING,
284 'title' => ts('Custom Group Extends'),
285 'description' => ts('Type of object this group extends (can add other options later e.g. contact_address, etc.).'),
286 'maxlength' => 255,
287 'size' => CRM_Utils_Type::HUGE,
288 'where' => 'civicrm_custom_group.extends',
289 'default' => 'Contact',
290 'table_name' => 'civicrm_custom_group',
291 'entity' => 'CustomGroup',
292 'bao' => 'CRM_Core_BAO_CustomGroup',
293 'localizable' => 0,
294 'pseudoconstant' => [
295 'callback' => 'CRM_Core_SelectValues::customGroupExtends',
296 ],
297 'add' => '1.1',
298 ],
299 'extends_entity_column_id' => [
300 'name' => 'extends_entity_column_id',
301 'type' => CRM_Utils_Type::T_INT,
302 'title' => ts('Custom Group Subtype List'),
303 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
304 'where' => 'civicrm_custom_group.extends_entity_column_id',
305 'default' => NULL,
306 'table_name' => 'civicrm_custom_group',
307 'entity' => 'CustomGroup',
308 'bao' => 'CRM_Core_BAO_CustomGroup',
309 'localizable' => 0,
310 'html' => [
311 'type' => 'Select',
312 ],
313 'pseudoconstant' => [
314 'optionGroupName' => 'custom_data_type',
315 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
316 ],
317 'add' => '2.2',
318 ],
319 'extends_entity_column_value' => [
320 'name' => 'extends_entity_column_value',
321 'type' => CRM_Utils_Type::T_STRING,
322 'title' => ts('Custom Group Subtype'),
323 'description' => ts('linking custom group for dynamic object'),
324 'maxlength' => 255,
325 'size' => CRM_Utils_Type::HUGE,
326 'where' => 'civicrm_custom_group.extends_entity_column_value',
327 'table_name' => 'civicrm_custom_group',
328 'entity' => 'CustomGroup',
329 'bao' => 'CRM_Core_BAO_CustomGroup',
330 'localizable' => 0,
331 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
332 'add' => '1.6',
333 ],
334 'style' => [
335 'name' => 'style',
336 'type' => CRM_Utils_Type::T_STRING,
337 'title' => ts('Custom Group Style'),
338 'description' => ts('Visual relationship between this form and its parent.'),
339 'maxlength' => 15,
340 'size' => CRM_Utils_Type::TWELVE,
341 'where' => 'civicrm_custom_group.style',
342 'table_name' => 'civicrm_custom_group',
343 'entity' => 'CustomGroup',
344 'bao' => 'CRM_Core_BAO_CustomGroup',
345 'localizable' => 0,
346 'html' => [
347 'type' => 'Select',
348 ],
349 'pseudoconstant' => [
350 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
351 ],
352 'add' => '1.1',
353 ],
354 'collapse_display' => [
355 'name' => 'collapse_display',
356 'type' => CRM_Utils_Type::T_BOOLEAN,
357 'title' => ts('Collapse Custom Group?'),
358 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
359 'where' => 'civicrm_custom_group.collapse_display',
360 'default' => '0',
361 'table_name' => 'civicrm_custom_group',
362 'entity' => 'CustomGroup',
363 'bao' => 'CRM_Core_BAO_CustomGroup',
364 'localizable' => 0,
365 'add' => '1.1',
366 ],
367 'help_pre' => [
368 'name' => 'help_pre',
369 'type' => CRM_Utils_Type::T_TEXT,
370 'title' => ts('Custom Group Pre Text'),
371 'description' => ts('Description and/or help text to display before fields in form.'),
372 'rows' => 4,
373 'cols' => 80,
374 'where' => 'civicrm_custom_group.help_pre',
375 'table_name' => 'civicrm_custom_group',
376 'entity' => 'CustomGroup',
377 'bao' => 'CRM_Core_BAO_CustomGroup',
378 'localizable' => 1,
379 'html' => [
380 'type' => 'TextArea',
381 ],
382 'add' => '1.1',
383 ],
384 'help_post' => [
385 'name' => 'help_post',
386 'type' => CRM_Utils_Type::T_TEXT,
387 'title' => ts('Custom Group Post Text'),
388 'description' => ts('Description and/or help text to display after fields in form.'),
389 'rows' => 4,
390 'cols' => 80,
391 'where' => 'civicrm_custom_group.help_post',
392 'table_name' => 'civicrm_custom_group',
393 'entity' => 'CustomGroup',
394 'bao' => 'CRM_Core_BAO_CustomGroup',
395 'localizable' => 1,
396 'html' => [
397 'type' => 'TextArea',
398 ],
399 'add' => '1.1',
400 ],
401 'weight' => [
402 'name' => 'weight',
403 'type' => CRM_Utils_Type::T_INT,
404 'title' => ts('Order'),
405 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
406 'required' => TRUE,
407 'where' => 'civicrm_custom_group.weight',
408 'default' => '1',
409 'table_name' => 'civicrm_custom_group',
410 'entity' => 'CustomGroup',
411 'bao' => 'CRM_Core_BAO_CustomGroup',
412 'localizable' => 0,
413 'add' => '1.1',
414 ],
415 'is_active' => [
416 'name' => 'is_active',
417 'type' => CRM_Utils_Type::T_BOOLEAN,
418 'title' => ts('Custom Group Is Active?'),
419 'description' => ts('Is this property active?'),
420 'where' => 'civicrm_custom_group.is_active',
421 'default' => '1',
422 'table_name' => 'civicrm_custom_group',
423 'entity' => 'CustomGroup',
424 'bao' => 'CRM_Core_BAO_CustomGroup',
425 'localizable' => 0,
426 'add' => '1.1',
427 ],
428 'table_name' => [
429 'name' => 'table_name',
430 'type' => CRM_Utils_Type::T_STRING,
431 'title' => ts('Table Name'),
432 'description' => ts('Name of the table that holds the values for this group.'),
433 'maxlength' => 255,
434 'size' => CRM_Utils_Type::HUGE,
435 'where' => 'civicrm_custom_group.table_name',
436 'table_name' => 'civicrm_custom_group',
437 'entity' => 'CustomGroup',
438 'bao' => 'CRM_Core_BAO_CustomGroup',
439 'localizable' => 0,
440 'html' => [
441 'label' => ts("Table Name"),
442 ],
443 'readonly' => TRUE,
444 'add' => '2.0',
445 ],
446 'is_multiple' => [
447 'name' => 'is_multiple',
448 'type' => CRM_Utils_Type::T_BOOLEAN,
449 'title' => ts('Supports Multiple Records'),
450 'description' => ts('Does this group hold multiple values?'),
451 'where' => 'civicrm_custom_group.is_multiple',
452 'default' => '0',
453 'table_name' => 'civicrm_custom_group',
454 'entity' => 'CustomGroup',
455 'bao' => 'CRM_Core_BAO_CustomGroup',
456 'localizable' => 0,
457 'add' => '2.0',
458 ],
459 'min_multiple' => [
460 'name' => 'min_multiple',
461 'type' => CRM_Utils_Type::T_INT,
462 'title' => ts('Minimum Multiple Records'),
463 'description' => ts('minimum number of multiple records (typically 0?)'),
464 'where' => 'civicrm_custom_group.min_multiple',
465 'table_name' => 'civicrm_custom_group',
466 'entity' => 'CustomGroup',
467 'bao' => 'CRM_Core_BAO_CustomGroup',
468 'localizable' => 0,
469 'add' => '2.2',
470 ],
471 'max_multiple' => [
472 'name' => 'max_multiple',
473 'type' => CRM_Utils_Type::T_INT,
474 'title' => ts('Maximum Multiple Records'),
475 'description' => ts('maximum number of multiple records, if 0 - no max'),
476 'where' => 'civicrm_custom_group.max_multiple',
477 'table_name' => 'civicrm_custom_group',
478 'entity' => 'CustomGroup',
479 'bao' => 'CRM_Core_BAO_CustomGroup',
480 'localizable' => 0,
481 'add' => '2.2',
482 ],
483 'collapse_adv_display' => [
484 'name' => 'collapse_adv_display',
485 'type' => CRM_Utils_Type::T_BOOLEAN,
486 'title' => ts('Collapse Group Display'),
487 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
488 'where' => 'civicrm_custom_group.collapse_adv_display',
489 'default' => '0',
490 'table_name' => 'civicrm_custom_group',
491 'entity' => 'CustomGroup',
492 'bao' => 'CRM_Core_BAO_CustomGroup',
493 'localizable' => 0,
494 'add' => '3.0',
495 ],
496 'created_id' => [
497 'name' => 'created_id',
498 'type' => CRM_Utils_Type::T_INT,
499 'title' => ts('Created By Contact ID'),
500 'description' => ts('FK to civicrm_contact, who created this custom group'),
501 'where' => 'civicrm_custom_group.created_id',
502 'table_name' => 'civicrm_custom_group',
503 'entity' => 'CustomGroup',
504 'bao' => 'CRM_Core_BAO_CustomGroup',
505 'localizable' => 0,
506 'FKClassName' => 'CRM_Contact_DAO_Contact',
507 'html' => [
508 'label' => ts("Created By"),
509 ],
510 'add' => '3.0',
511 ],
512 'created_date' => [
513 'name' => 'created_date',
514 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
515 'title' => ts('Custom Group Created Date'),
516 'description' => ts('Date and time this custom group was created.'),
517 'where' => 'civicrm_custom_group.created_date',
518 'table_name' => 'civicrm_custom_group',
519 'entity' => 'CustomGroup',
520 'bao' => 'CRM_Core_BAO_CustomGroup',
521 'localizable' => 0,
522 'add' => '3.0',
523 ],
524 'is_reserved' => [
525 'name' => 'is_reserved',
526 'type' => CRM_Utils_Type::T_BOOLEAN,
527 'title' => ts('Reserved Group?'),
528 'description' => ts('Is this a reserved Custom Group?'),
529 'where' => 'civicrm_custom_group.is_reserved',
530 'default' => '0',
531 'table_name' => 'civicrm_custom_group',
532 'entity' => 'CustomGroup',
533 'bao' => 'CRM_Core_BAO_CustomGroup',
534 'localizable' => 0,
535 'add' => '4.4',
536 ],
537 'is_public' => [
538 'name' => 'is_public',
539 'type' => CRM_Utils_Type::T_BOOLEAN,
540 'title' => ts('Custom Group Is Public?'),
541 'description' => ts('Is this property public?'),
542 'where' => 'civicrm_custom_group.is_public',
543 'default' => '1',
544 'table_name' => 'civicrm_custom_group',
545 'entity' => 'CustomGroup',
546 'bao' => 'CRM_Core_BAO_CustomGroup',
547 'localizable' => 0,
548 'add' => '4.7',
549 ],
550 'icon' => [
551 'name' => 'icon',
552 'type' => CRM_Utils_Type::T_STRING,
553 'title' => ts('Icon'),
554 'description' => ts('crm-i icon class'),
555 'maxlength' => 255,
556 'size' => CRM_Utils_Type::HUGE,
557 'where' => 'civicrm_custom_group.icon',
558 'default' => NULL,
559 'table_name' => 'civicrm_custom_group',
560 'entity' => 'CustomGroup',
561 'bao' => 'CRM_Core_BAO_CustomGroup',
562 'localizable' => 0,
563 'add' => '5.28',
564 ],
565 ];
566 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
567 }
568 return Civi::$statics[__CLASS__]['fields'];
569 }
570
571 /**
572 * Return a mapping from field-name to the corresponding key (as used in fields()).
573 *
574 * @return array
575 * Array(string $name => string $uniqueName).
576 */
577 public static function &fieldKeys() {
578 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
579 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
580 }
581 return Civi::$statics[__CLASS__]['fieldKeys'];
582 }
583
584 /**
585 * Returns the names of this table
586 *
587 * @return string
588 */
589 public static function getTableName() {
590 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
591 }
592
593 /**
594 * Returns if this table needs to be logged
595 *
596 * @return bool
597 */
598 public function getLog() {
599 return self::$_log;
600 }
601
602 /**
603 * Returns the list of fields that can be imported
604 *
605 * @param bool $prefix
606 *
607 * @return array
608 */
609 public static function &import($prefix = FALSE) {
610 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
611 return $r;
612 }
613
614 /**
615 * Returns the list of fields that can be exported
616 *
617 * @param bool $prefix
618 *
619 * @return array
620 */
621 public static function &export($prefix = FALSE) {
622 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
623 return $r;
624 }
625
626 /**
627 * Returns the list of indices
628 *
629 * @param bool $localize
630 *
631 * @return array
632 */
633 public static function indices($localize = TRUE) {
634 $indices = [
635 'UI_title_extends' => [
636 'name' => 'UI_title_extends',
637 'field' => [
638 0 => 'title',
639 1 => 'extends',
640 ],
641 'localizable' => TRUE,
642 'unique' => TRUE,
643 'sig' => 'civicrm_custom_group::1::title::extends',
644 ],
645 'UI_name_extends' => [
646 'name' => 'UI_name_extends',
647 'field' => [
648 0 => 'name',
649 1 => 'extends',
650 ],
651 'localizable' => FALSE,
652 'unique' => TRUE,
653 'sig' => 'civicrm_custom_group::1::name::extends',
654 ],
655 ];
656 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
657 }
658
659 }