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