Merge pull request #12056 from eileenmcnaughton/pcp
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Core/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4b960c311aed67174e9c55901ba3993b)
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 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 static $_log = TRUE;
30
31 /**
32 * Unique Custom Group ID
33 *
34 * @var int unsigned
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 unsigned
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 int unsigned
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 boolean
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 boolean
126 */
127 public $is_multiple;
128
129 /**
130 * minimum number of multiple records (typically 0?)
131 *
132 * @var int unsigned
133 */
134 public $min_multiple;
135
136 /**
137 * maximum number of multiple records, if 0 - no max
138 *
139 * @var int unsigned
140 */
141 public $max_multiple;
142
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;
149
150 /**
151 * FK to civicrm_contact, who created this custom group
152 *
153 * @var int unsigned
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 boolean
168 */
169 public $is_reserved;
170
171 /**
172 * Is this property public?
173 *
174 * @var boolean
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 foreign keys and entity references.
188 *
189 * @return array
190 * [CRM_Core_Reference_Interface]
191 */
192 public static function getReferenceColumns() {
193 if (!isset(Civi::$statics[__CLASS__]['links'])) {
194 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
195 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
196 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
197 }
198 return Civi::$statics[__CLASS__]['links'];
199 }
200
201 /**
202 * Returns all the column names of this table
203 *
204 * @return array
205 */
206 public static function &fields() {
207 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
208 Civi::$statics[__CLASS__]['fields'] = [
209 'id' => [
210 'name' => 'id',
211 'type' => CRM_Utils_Type::T_INT,
212 'title' => ts('Custom Group ID'),
213 'description' => 'Unique Custom Group ID',
214 'required' => TRUE,
215 'table_name' => 'civicrm_custom_group',
216 'entity' => 'CustomGroup',
217 'bao' => 'CRM_Core_BAO_CustomGroup',
218 'localizable' => 0,
219 ],
220 'name' => [
221 'name' => 'name',
222 'type' => CRM_Utils_Type::T_STRING,
223 'title' => ts('Custom Group Name'),
224 'description' => 'Variable name/programmatic handle for this group.',
225 'maxlength' => 64,
226 'size' => CRM_Utils_Type::BIG,
227 'table_name' => 'civicrm_custom_group',
228 'entity' => 'CustomGroup',
229 'bao' => 'CRM_Core_BAO_CustomGroup',
230 'localizable' => 0,
231 ],
232 'title' => [
233 'name' => 'title',
234 'type' => CRM_Utils_Type::T_STRING,
235 'title' => ts('Custom Group Title'),
236 'description' => 'Friendly Name.',
237 'required' => TRUE,
238 'maxlength' => 64,
239 'size' => CRM_Utils_Type::BIG,
240 'table_name' => 'civicrm_custom_group',
241 'entity' => 'CustomGroup',
242 'bao' => 'CRM_Core_BAO_CustomGroup',
243 'localizable' => 1,
244 ],
245 'extends' => [
246 'name' => 'extends',
247 'type' => CRM_Utils_Type::T_STRING,
248 'title' => ts('Custom Group Extends'),
249 'description' => 'Type of object this group extends (can add other options later e.g. contact_address, etc.).',
250 'maxlength' => 255,
251 'size' => CRM_Utils_Type::HUGE,
252 'default' => 'Contact',
253 'table_name' => 'civicrm_custom_group',
254 'entity' => 'CustomGroup',
255 'bao' => 'CRM_Core_BAO_CustomGroup',
256 'localizable' => 0,
257 ],
258 'extends_entity_column_id' => [
259 'name' => 'extends_entity_column_id',
260 'type' => CRM_Utils_Type::T_INT,
261 'title' => ts('Custom Group Subtype List'),
262 'description' => 'FK to civicrm_option_value.id (for option group custom_data_type.)',
263 'default' => 'NULL',
264 'table_name' => 'civicrm_custom_group',
265 'entity' => 'CustomGroup',
266 'bao' => 'CRM_Core_BAO_CustomGroup',
267 'localizable' => 0,
268 ],
269 'extends_entity_column_value' => [
270 'name' => 'extends_entity_column_value',
271 'type' => CRM_Utils_Type::T_STRING,
272 'title' => ts('Custom Group Subtype'),
273 'description' => 'linking custom group for dynamic object',
274 'maxlength' => 255,
275 'size' => CRM_Utils_Type::HUGE,
276 'table_name' => 'civicrm_custom_group',
277 'entity' => 'CustomGroup',
278 'bao' => 'CRM_Core_BAO_CustomGroup',
279 'localizable' => 0,
280 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
281 ],
282 'style' => [
283 'name' => 'style',
284 'type' => CRM_Utils_Type::T_STRING,
285 'title' => ts('Custom Group Style'),
286 'description' => 'Visual relationship between this form and its parent.',
287 'maxlength' => 15,
288 'size' => CRM_Utils_Type::TWELVE,
289 'table_name' => 'civicrm_custom_group',
290 'entity' => 'CustomGroup',
291 'bao' => 'CRM_Core_BAO_CustomGroup',
292 'localizable' => 0,
293 'html' => [
294 'type' => 'Select',
295 ],
296 'pseudoconstant' => [
297 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
298 ]
299 ],
300 'collapse_display' => [
301 'name' => 'collapse_display',
302 'type' => CRM_Utils_Type::T_INT,
303 'title' => ts('Collapse Custom Group?'),
304 'description' => 'Will this group be in collapsed or expanded mode on initial display ?',
305 'table_name' => 'civicrm_custom_group',
306 'entity' => 'CustomGroup',
307 'bao' => 'CRM_Core_BAO_CustomGroup',
308 'localizable' => 0,
309 ],
310 'help_pre' => [
311 'name' => 'help_pre',
312 'type' => CRM_Utils_Type::T_TEXT,
313 'title' => ts('Custom Group Pre Text'),
314 'description' => 'Description and/or help text to display before fields in form.',
315 'rows' => 4,
316 'cols' => 80,
317 'table_name' => 'civicrm_custom_group',
318 'entity' => 'CustomGroup',
319 'bao' => 'CRM_Core_BAO_CustomGroup',
320 'localizable' => 1,
321 'html' => [
322 'type' => 'TextArea',
323 ],
324 ],
325 'help_post' => [
326 'name' => 'help_post',
327 'type' => CRM_Utils_Type::T_TEXT,
328 'title' => ts('Custom Group Post Text'),
329 'description' => 'Description and/or help text to display after fields in form.',
330 'rows' => 4,
331 'cols' => 80,
332 'table_name' => 'civicrm_custom_group',
333 'entity' => 'CustomGroup',
334 'bao' => 'CRM_Core_BAO_CustomGroup',
335 'localizable' => 1,
336 'html' => [
337 'type' => 'TextArea',
338 ],
339 ],
340 'weight' => [
341 'name' => 'weight',
342 'type' => CRM_Utils_Type::T_INT,
343 'title' => ts('Order'),
344 'description' => 'Controls display order when multiple extended property groups are setup for the same class.',
345 'required' => TRUE,
346 'default' => '1',
347 'table_name' => 'civicrm_custom_group',
348 'entity' => 'CustomGroup',
349 'bao' => 'CRM_Core_BAO_CustomGroup',
350 'localizable' => 0,
351 ],
352 'is_active' => [
353 'name' => 'is_active',
354 'type' => CRM_Utils_Type::T_BOOLEAN,
355 'title' => ts('Custom Group Is Active?'),
356 'description' => 'Is this property active?',
357 'table_name' => 'civicrm_custom_group',
358 'entity' => 'CustomGroup',
359 'bao' => 'CRM_Core_BAO_CustomGroup',
360 'localizable' => 0,
361 ],
362 'table_name' => [
363 'name' => 'table_name',
364 'type' => CRM_Utils_Type::T_STRING,
365 'title' => ts('Table Name'),
366 'description' => 'Name of the table that holds the values for this group.',
367 'maxlength' => 255,
368 'size' => CRM_Utils_Type::HUGE,
369 'table_name' => 'civicrm_custom_group',
370 'entity' => 'CustomGroup',
371 'bao' => 'CRM_Core_BAO_CustomGroup',
372 'localizable' => 0,
373 ],
374 'is_multiple' => [
375 'name' => 'is_multiple',
376 'type' => CRM_Utils_Type::T_BOOLEAN,
377 'title' => ts('Supports Multiple Records'),
378 'description' => 'Does this group hold multiple values?',
379 'table_name' => 'civicrm_custom_group',
380 'entity' => 'CustomGroup',
381 'bao' => 'CRM_Core_BAO_CustomGroup',
382 'localizable' => 0,
383 ],
384 'min_multiple' => [
385 'name' => 'min_multiple',
386 'type' => CRM_Utils_Type::T_INT,
387 'title' => ts('Minimum Multiple Records'),
388 'description' => 'minimum number of multiple records (typically 0?)',
389 'table_name' => 'civicrm_custom_group',
390 'entity' => 'CustomGroup',
391 'bao' => 'CRM_Core_BAO_CustomGroup',
392 'localizable' => 0,
393 ],
394 'max_multiple' => [
395 'name' => 'max_multiple',
396 'type' => CRM_Utils_Type::T_INT,
397 'title' => ts('Maximum Multiple Records'),
398 'description' => 'maximum number of multiple records, if 0 - no max',
399 'table_name' => 'civicrm_custom_group',
400 'entity' => 'CustomGroup',
401 'bao' => 'CRM_Core_BAO_CustomGroup',
402 'localizable' => 0,
403 ],
404 'collapse_adv_display' => [
405 'name' => 'collapse_adv_display',
406 'type' => CRM_Utils_Type::T_INT,
407 'title' => ts('Collapse Group Display'),
408 'description' => 'Will this group be in collapsed or expanded mode on advanced search display ?',
409 'table_name' => 'civicrm_custom_group',
410 'entity' => 'CustomGroup',
411 'bao' => 'CRM_Core_BAO_CustomGroup',
412 'localizable' => 0,
413 ],
414 'created_id' => [
415 'name' => 'created_id',
416 'type' => CRM_Utils_Type::T_INT,
417 'title' => ts('Custom Group Created By'),
418 'description' => 'FK to civicrm_contact, who created this custom group',
419 'table_name' => 'civicrm_custom_group',
420 'entity' => 'CustomGroup',
421 'bao' => 'CRM_Core_BAO_CustomGroup',
422 'localizable' => 0,
423 'FKClassName' => 'CRM_Contact_DAO_Contact',
424 ],
425 'created_date' => [
426 'name' => 'created_date',
427 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
428 'title' => ts('Custom Group Created Date'),
429 'description' => 'Date and time this custom group was created.',
430 'table_name' => 'civicrm_custom_group',
431 'entity' => 'CustomGroup',
432 'bao' => 'CRM_Core_BAO_CustomGroup',
433 'localizable' => 0,
434 ],
435 'is_reserved' => [
436 'name' => 'is_reserved',
437 'type' => CRM_Utils_Type::T_BOOLEAN,
438 'title' => ts('Reserved Group?'),
439 'description' => 'Is this a reserved Custom Group?',
440 'table_name' => 'civicrm_custom_group',
441 'entity' => 'CustomGroup',
442 'bao' => 'CRM_Core_BAO_CustomGroup',
443 'localizable' => 0,
444 ],
445 'is_public' => [
446 'name' => 'is_public',
447 'type' => CRM_Utils_Type::T_BOOLEAN,
448 'title' => ts('Custom Group Is Public?'),
449 'description' => 'Is this property public?',
450 'default' => '1',
451 'table_name' => 'civicrm_custom_group',
452 'entity' => 'CustomGroup',
453 'bao' => 'CRM_Core_BAO_CustomGroup',
454 'localizable' => 0,
455 ],
456 ];
457 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
458 }
459 return Civi::$statics[__CLASS__]['fields'];
460 }
461
462 /**
463 * Return a mapping from field-name to the corresponding key (as used in fields()).
464 *
465 * @return array
466 * Array(string $name => string $uniqueName).
467 */
468 public static function &fieldKeys() {
469 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
470 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
471 }
472 return Civi::$statics[__CLASS__]['fieldKeys'];
473 }
474
475 /**
476 * Returns the names of this table
477 *
478 * @return string
479 */
480 public static function getTableName() {
481 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
482 }
483
484 /**
485 * Returns if this table needs to be logged
486 *
487 * @return bool
488 */
489 public function getLog() {
490 return self::$_log;
491 }
492
493 /**
494 * Returns the list of fields that can be imported
495 *
496 * @param bool $prefix
497 *
498 * @return array
499 */
500 public static function &import($prefix = FALSE) {
501 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
502 return $r;
503 }
504
505 /**
506 * Returns the list of fields that can be exported
507 *
508 * @param bool $prefix
509 *
510 * @return array
511 */
512 public static function &export($prefix = FALSE) {
513 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
514 return $r;
515 }
516
517 /**
518 * Returns the list of indices
519 *
520 * @param bool $localize
521 *
522 * @return array
523 */
524 public static function indices($localize = TRUE) {
525 $indices = [
526 'UI_title_extends' => [
527 'name' => 'UI_title_extends',
528 'field' => [
529 0 => 'title',
530 1 => 'extends',
531 ],
532 'localizable' => TRUE,
533 'unique' => TRUE,
534 'sig' => 'civicrm_custom_group::1::title::extends',
535 ],
536 'UI_name_extends' => [
537 'name' => 'UI_name_extends',
538 'field' => [
539 0 => 'name',
540 1 => 'extends',
541 ],
542 'localizable' => FALSE,
543 'unique' => TRUE,
544 'sig' => 'civicrm_custom_group::1::name::extends',
545 ],
546 ];
547 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
548 }
549
550 }