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