Merge pull request #14266 from seamuslee001/dev_core_369
[civicrm-core.git] / CRM / Core / DAO / UFGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/UFGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0f78fb49440e1cf5d43fd3db5a43ee7e)
10 */
11
12 /**
13 * Database access object for the UFGroup entity.
14 */
15 class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_uf_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 table ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Is this form currently active? If false, hide all related fields for all sharing contexts.
40 *
41 * @var boolean
42 */
43 public $is_active;
44
45 /**
46 * Comma separated list of the type(s) of profile fields.
47 *
48 * @var string
49 */
50 public $group_type;
51
52 /**
53 * Form title.
54 *
55 * @var string
56 */
57 public $title;
58
59 /**
60 * Profile Form Public title
61 *
62 * @var string
63 */
64 public $frontend_title;
65
66 /**
67 * Optional verbose description of the profile.
68 *
69 * @var text
70 */
71 public $description;
72
73 /**
74 * Description and/or help text to display before fields in form.
75 *
76 * @var text
77 */
78 public $help_pre;
79
80 /**
81 * Description and/or help text to display after fields in form.
82 *
83 * @var text
84 */
85 public $help_post;
86
87 /**
88 * Group id, foreign key from civicrm_group
89 *
90 * @var int unsigned
91 */
92 public $limit_listings_group_id;
93
94 /**
95 * Redirect to URL.
96 *
97 * @var string
98 */
99 public $post_URL;
100
101 /**
102 * foreign key to civicrm_group_id
103 *
104 * @var int unsigned
105 */
106 public $add_to_group_id;
107
108 /**
109 * Should a CAPTCHA widget be included this Profile form.
110 *
111 * @var boolean
112 */
113 public $add_captcha;
114
115 /**
116 * Do we want to map results from this profile.
117 *
118 * @var boolean
119 */
120 public $is_map;
121
122 /**
123 * Should edit link display in profile selector
124 *
125 * @var boolean
126 */
127 public $is_edit_link;
128
129 /**
130 * Should we display a link to the website profile in profile selector
131 *
132 * @var boolean
133 */
134 public $is_uf_link;
135
136 /**
137 * Should we update the contact record if we find a duplicate
138 *
139 * @var boolean
140 */
141 public $is_update_dupe;
142
143 /**
144 * Redirect to URL when Cancle button clik .
145 *
146 * @var string
147 */
148 public $cancel_URL;
149
150 /**
151 * Should we create a cms user for this profile
152 *
153 * @var boolean
154 */
155 public $is_cms_user;
156
157 /**
158 * @var text
159 */
160 public $notify;
161
162 /**
163 * Is this group reserved for use by some other CiviCRM functionality?
164 *
165 * @var boolean
166 */
167 public $is_reserved;
168
169 /**
170 * Name of the UF group for directly addressing it in the codebase
171 *
172 * @var string
173 */
174 public $name;
175
176 /**
177 * FK to civicrm_contact, who created this UF group
178 *
179 * @var int unsigned
180 */
181 public $created_id;
182
183 /**
184 * Date and time this UF group was created.
185 *
186 * @var datetime
187 */
188 public $created_date;
189
190 /**
191 * Should we include proximity search feature in this profile search form?
192 *
193 * @var boolean
194 */
195 public $is_proximity_search;
196
197 /**
198 * Custom Text to display on the Cancel button when used in create or edit mode
199 *
200 * @var string
201 */
202 public $cancel_button_text;
203
204 /**
205 * Custom Text to display on the submit button on profile edit/create screens
206 *
207 * @var string
208 */
209 public $submit_button_text;
210
211 /**
212 * Should a Cancel button be included in this Profile form.
213 *
214 * @var boolean
215 */
216 public $add_cancel_button;
217
218 /**
219 * Class constructor.
220 */
221 public function __construct() {
222 $this->__table = 'civicrm_uf_group';
223 parent::__construct();
224 }
225
226 /**
227 * Returns foreign keys and entity references.
228 *
229 * @return array
230 * [CRM_Core_Reference_Interface]
231 */
232 public static function getReferenceColumns() {
233 if (!isset(Civi::$statics[__CLASS__]['links'])) {
234 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
235 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'limit_listings_group_id', 'civicrm_group', 'id');
236 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'add_to_group_id', 'civicrm_group', 'id');
237 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
238 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
239 }
240 return Civi::$statics[__CLASS__]['links'];
241 }
242
243 /**
244 * Returns all the column names of this table
245 *
246 * @return array
247 */
248 public static function &fields() {
249 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
250 Civi::$statics[__CLASS__]['fields'] = [
251 'id' => [
252 'name' => 'id',
253 'type' => CRM_Utils_Type::T_INT,
254 'title' => ts('Profile ID'),
255 'description' => ts('Unique table ID'),
256 'required' => TRUE,
257 'where' => 'civicrm_uf_group.id',
258 'table_name' => 'civicrm_uf_group',
259 'entity' => 'UFGroup',
260 'bao' => 'CRM_Core_BAO_UFGroup',
261 'localizable' => 0,
262 ],
263 'is_active' => [
264 'name' => 'is_active',
265 'type' => CRM_Utils_Type::T_BOOLEAN,
266 'title' => ts('Profile Is Active'),
267 'description' => ts('Is this form currently active? If false, hide all related fields for all sharing contexts.'),
268 'where' => 'civicrm_uf_group.is_active',
269 'default' => '1',
270 'table_name' => 'civicrm_uf_group',
271 'entity' => 'UFGroup',
272 'bao' => 'CRM_Core_BAO_UFGroup',
273 'localizable' => 0,
274 ],
275 'group_type' => [
276 'name' => 'group_type',
277 'type' => CRM_Utils_Type::T_STRING,
278 'title' => ts('Profile Group Type'),
279 'description' => ts('Comma separated list of the type(s) of profile fields.'),
280 'maxlength' => 255,
281 'size' => CRM_Utils_Type::HUGE,
282 'import' => TRUE,
283 'where' => 'civicrm_uf_group.group_type',
284 'export' => TRUE,
285 'table_name' => 'civicrm_uf_group',
286 'entity' => 'UFGroup',
287 'bao' => 'CRM_Core_BAO_UFGroup',
288 'localizable' => 0,
289 'serialize' => self::SERIALIZE_COMMA,
290 ],
291 'title' => [
292 'name' => 'title',
293 'type' => CRM_Utils_Type::T_STRING,
294 'title' => ts('Profile Name'),
295 'description' => ts('Form title.'),
296 'required' => TRUE,
297 'maxlength' => 64,
298 'size' => CRM_Utils_Type::BIG,
299 'where' => 'civicrm_uf_group.title',
300 'table_name' => 'civicrm_uf_group',
301 'entity' => 'UFGroup',
302 'bao' => 'CRM_Core_BAO_UFGroup',
303 'localizable' => 1,
304 'html' => [
305 'type' => 'Text',
306 ],
307 ],
308 'frontend_title' => [
309 'name' => 'frontend_title',
310 'type' => CRM_Utils_Type::T_STRING,
311 'title' => ts('Public Title'),
312 'description' => ts('Profile Form Public title'),
313 'maxlength' => 64,
314 'size' => CRM_Utils_Type::BIG,
315 'where' => 'civicrm_uf_group.frontend_title',
316 'table_name' => 'civicrm_uf_group',
317 'entity' => 'UFGroup',
318 'bao' => 'CRM_Core_BAO_UFGroup',
319 'localizable' => 1,
320 'html' => [
321 'type' => 'Text',
322 ],
323 ],
324 'description' => [
325 'name' => 'description',
326 'type' => CRM_Utils_Type::T_TEXT,
327 'title' => ts('Profile Description'),
328 'description' => ts('Optional verbose description of the profile.'),
329 'rows' => 2,
330 'cols' => 60,
331 'where' => 'civicrm_uf_group.description',
332 'table_name' => 'civicrm_uf_group',
333 'entity' => 'UFGroup',
334 'bao' => 'CRM_Core_BAO_UFGroup',
335 'localizable' => 0,
336 'html' => [
337 'type' => 'TextArea',
338 ],
339 ],
340 'help_pre' => [
341 'name' => 'help_pre',
342 'type' => CRM_Utils_Type::T_TEXT,
343 'title' => ts('Help Pre'),
344 'description' => ts('Description and/or help text to display before fields in form.'),
345 'rows' => 4,
346 'cols' => 80,
347 'where' => 'civicrm_uf_group.help_pre',
348 'table_name' => 'civicrm_uf_group',
349 'entity' => 'UFGroup',
350 'bao' => 'CRM_Core_BAO_UFGroup',
351 'localizable' => 1,
352 'html' => [
353 'type' => 'TextArea',
354 ],
355 ],
356 'help_post' => [
357 'name' => 'help_post',
358 'type' => CRM_Utils_Type::T_TEXT,
359 'title' => ts('Profile Post Text'),
360 'description' => ts('Description and/or help text to display after fields in form.'),
361 'rows' => 4,
362 'cols' => 80,
363 'where' => 'civicrm_uf_group.help_post',
364 'table_name' => 'civicrm_uf_group',
365 'entity' => 'UFGroup',
366 'bao' => 'CRM_Core_BAO_UFGroup',
367 'localizable' => 1,
368 'html' => [
369 'type' => 'TextArea',
370 ],
371 ],
372 'limit_listings_group_id' => [
373 'name' => 'limit_listings_group_id',
374 'type' => CRM_Utils_Type::T_INT,
375 'title' => ts('Profile Search Limit Group'),
376 'description' => ts('Group id, foreign key from civicrm_group'),
377 'where' => 'civicrm_uf_group.limit_listings_group_id',
378 'table_name' => 'civicrm_uf_group',
379 'entity' => 'UFGroup',
380 'bao' => 'CRM_Core_BAO_UFGroup',
381 'localizable' => 0,
382 'FKClassName' => 'CRM_Contact_DAO_Group',
383 ],
384 'post_URL' => [
385 'name' => 'post_URL',
386 'type' => CRM_Utils_Type::T_STRING,
387 'title' => ts('Post Url'),
388 'description' => ts('Redirect to URL.'),
389 'maxlength' => 255,
390 'size' => CRM_Utils_Type::HUGE,
391 'where' => 'civicrm_uf_group.post_URL',
392 'table_name' => 'civicrm_uf_group',
393 'entity' => 'UFGroup',
394 'bao' => 'CRM_Core_BAO_UFGroup',
395 'localizable' => 0,
396 ],
397 'add_to_group_id' => [
398 'name' => 'add_to_group_id',
399 'type' => CRM_Utils_Type::T_INT,
400 'title' => ts('Add Contact To Group'),
401 'description' => ts('foreign key to civicrm_group_id'),
402 'where' => 'civicrm_uf_group.add_to_group_id',
403 'table_name' => 'civicrm_uf_group',
404 'entity' => 'UFGroup',
405 'bao' => 'CRM_Core_BAO_UFGroup',
406 'localizable' => 0,
407 'FKClassName' => 'CRM_Contact_DAO_Group',
408 ],
409 'add_captcha' => [
410 'name' => 'add_captcha',
411 'type' => CRM_Utils_Type::T_BOOLEAN,
412 'title' => ts('Show Captcha On Profile'),
413 'description' => ts('Should a CAPTCHA widget be included this Profile form.'),
414 'where' => 'civicrm_uf_group.add_captcha',
415 'default' => '0',
416 'table_name' => 'civicrm_uf_group',
417 'entity' => 'UFGroup',
418 'bao' => 'CRM_Core_BAO_UFGroup',
419 'localizable' => 0,
420 ],
421 'is_map' => [
422 'name' => 'is_map',
423 'type' => CRM_Utils_Type::T_BOOLEAN,
424 'title' => ts('Map Profile'),
425 'description' => ts('Do we want to map results from this profile.'),
426 'where' => 'civicrm_uf_group.is_map',
427 'default' => '0',
428 'table_name' => 'civicrm_uf_group',
429 'entity' => 'UFGroup',
430 'bao' => 'CRM_Core_BAO_UFGroup',
431 'localizable' => 0,
432 ],
433 'is_edit_link' => [
434 'name' => 'is_edit_link',
435 'type' => CRM_Utils_Type::T_BOOLEAN,
436 'title' => ts('Show Edit Link?'),
437 'description' => ts('Should edit link display in profile selector'),
438 'where' => 'civicrm_uf_group.is_edit_link',
439 'default' => '0',
440 'table_name' => 'civicrm_uf_group',
441 'entity' => 'UFGroup',
442 'bao' => 'CRM_Core_BAO_UFGroup',
443 'localizable' => 0,
444 ],
445 'is_uf_link' => [
446 'name' => 'is_uf_link',
447 'type' => CRM_Utils_Type::T_BOOLEAN,
448 'title' => ts('Show Link to CMS User'),
449 'description' => ts('Should we display a link to the website profile in profile selector'),
450 'where' => 'civicrm_uf_group.is_uf_link',
451 'default' => '0',
452 'table_name' => 'civicrm_uf_group',
453 'entity' => 'UFGroup',
454 'bao' => 'CRM_Core_BAO_UFGroup',
455 'localizable' => 0,
456 ],
457 'is_update_dupe' => [
458 'name' => 'is_update_dupe',
459 'type' => CRM_Utils_Type::T_BOOLEAN,
460 'title' => ts('Update on Duplicate'),
461 'description' => ts('Should we update the contact record if we find a duplicate'),
462 'where' => 'civicrm_uf_group.is_update_dupe',
463 'default' => '0',
464 'table_name' => 'civicrm_uf_group',
465 'entity' => 'UFGroup',
466 'bao' => 'CRM_Core_BAO_UFGroup',
467 'localizable' => 0,
468 ],
469 'cancel_URL' => [
470 'name' => 'cancel_URL',
471 'type' => CRM_Utils_Type::T_STRING,
472 'title' => ts('Profile Cancel URL'),
473 'description' => ts('Redirect to URL when Cancle button clik .'),
474 'maxlength' => 255,
475 'size' => CRM_Utils_Type::HUGE,
476 'where' => 'civicrm_uf_group.cancel_URL',
477 'table_name' => 'civicrm_uf_group',
478 'entity' => 'UFGroup',
479 'bao' => 'CRM_Core_BAO_UFGroup',
480 'localizable' => 0,
481 ],
482 'is_cms_user' => [
483 'name' => 'is_cms_user',
484 'type' => CRM_Utils_Type::T_BOOLEAN,
485 'title' => ts('Create CMS User?'),
486 'description' => ts('Should we create a cms user for this profile '),
487 'where' => 'civicrm_uf_group.is_cms_user',
488 'default' => '0',
489 'table_name' => 'civicrm_uf_group',
490 'entity' => 'UFGroup',
491 'bao' => 'CRM_Core_BAO_UFGroup',
492 'localizable' => 0,
493 ],
494 'notify' => [
495 'name' => 'notify',
496 'type' => CRM_Utils_Type::T_TEXT,
497 'title' => ts('Notify on Profile Submit'),
498 'where' => 'civicrm_uf_group.notify',
499 'table_name' => 'civicrm_uf_group',
500 'entity' => 'UFGroup',
501 'bao' => 'CRM_Core_BAO_UFGroup',
502 'localizable' => 0,
503 ],
504 'is_reserved' => [
505 'name' => 'is_reserved',
506 'type' => CRM_Utils_Type::T_BOOLEAN,
507 'title' => ts('Profile Is Reserved'),
508 'description' => ts('Is this group reserved for use by some other CiviCRM functionality?'),
509 'where' => 'civicrm_uf_group.is_reserved',
510 'table_name' => 'civicrm_uf_group',
511 'entity' => 'UFGroup',
512 'bao' => 'CRM_Core_BAO_UFGroup',
513 'localizable' => 0,
514 ],
515 'name' => [
516 'name' => 'name',
517 'type' => CRM_Utils_Type::T_STRING,
518 'title' => ts('Profile Name'),
519 'description' => ts('Name of the UF group for directly addressing it in the codebase'),
520 'maxlength' => 64,
521 'size' => CRM_Utils_Type::BIG,
522 'where' => 'civicrm_uf_group.name',
523 'table_name' => 'civicrm_uf_group',
524 'entity' => 'UFGroup',
525 'bao' => 'CRM_Core_BAO_UFGroup',
526 'localizable' => 0,
527 ],
528 'created_id' => [
529 'name' => 'created_id',
530 'type' => CRM_Utils_Type::T_INT,
531 'title' => ts('Profile Created By'),
532 'description' => ts('FK to civicrm_contact, who created this UF group'),
533 'where' => 'civicrm_uf_group.created_id',
534 'table_name' => 'civicrm_uf_group',
535 'entity' => 'UFGroup',
536 'bao' => 'CRM_Core_BAO_UFGroup',
537 'localizable' => 0,
538 'FKClassName' => 'CRM_Contact_DAO_Contact',
539 ],
540 'created_date' => [
541 'name' => 'created_date',
542 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
543 'title' => ts('UF Group Created Date'),
544 'description' => ts('Date and time this UF group was created.'),
545 'where' => 'civicrm_uf_group.created_date',
546 'table_name' => 'civicrm_uf_group',
547 'entity' => 'UFGroup',
548 'bao' => 'CRM_Core_BAO_UFGroup',
549 'localizable' => 0,
550 ],
551 'is_proximity_search' => [
552 'name' => 'is_proximity_search',
553 'type' => CRM_Utils_Type::T_BOOLEAN,
554 'title' => ts('Include Proximity Search?'),
555 'description' => ts('Should we include proximity search feature in this profile search form?'),
556 'where' => 'civicrm_uf_group.is_proximity_search',
557 'default' => '0',
558 'table_name' => 'civicrm_uf_group',
559 'entity' => 'UFGroup',
560 'bao' => 'CRM_Core_BAO_UFGroup',
561 'localizable' => 0,
562 ],
563 'cancel_button_text' => [
564 'name' => 'cancel_button_text',
565 'type' => CRM_Utils_Type::T_STRING,
566 'title' => ts('Cancel Button Text'),
567 'description' => ts('Custom Text to display on the Cancel button when used in create or edit mode'),
568 'maxlength' => 64,
569 'size' => CRM_Utils_Type::BIG,
570 'where' => 'civicrm_uf_group.cancel_button_text',
571 'default' => 'NULL',
572 'table_name' => 'civicrm_uf_group',
573 'entity' => 'UFGroup',
574 'bao' => 'CRM_Core_BAO_UFGroup',
575 'localizable' => 1,
576 'html' => [
577 'type' => 'Text',
578 ],
579 ],
580 'submit_button_text' => [
581 'name' => 'submit_button_text',
582 'type' => CRM_Utils_Type::T_STRING,
583 'title' => ts('Submit Button Text'),
584 'description' => ts('Custom Text to display on the submit button on profile edit/create screens'),
585 'maxlength' => 64,
586 'size' => CRM_Utils_Type::BIG,
587 'where' => 'civicrm_uf_group.submit_button_text',
588 'default' => 'NULL',
589 'table_name' => 'civicrm_uf_group',
590 'entity' => 'UFGroup',
591 'bao' => 'CRM_Core_BAO_UFGroup',
592 'localizable' => 1,
593 'html' => [
594 'type' => 'Text',
595 ],
596 ],
597 'add_cancel_button' => [
598 'name' => 'add_cancel_button',
599 'type' => CRM_Utils_Type::T_BOOLEAN,
600 'title' => ts('Include Cancel Button'),
601 'description' => ts('Should a Cancel button be included in this Profile form.'),
602 'where' => 'civicrm_uf_group.add_cancel_button',
603 'default' => '1',
604 'table_name' => 'civicrm_uf_group',
605 'entity' => 'UFGroup',
606 'bao' => 'CRM_Core_BAO_UFGroup',
607 'localizable' => 0,
608 ],
609 ];
610 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
611 }
612 return Civi::$statics[__CLASS__]['fields'];
613 }
614
615 /**
616 * Return a mapping from field-name to the corresponding key (as used in fields()).
617 *
618 * @return array
619 * Array(string $name => string $uniqueName).
620 */
621 public static function &fieldKeys() {
622 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
623 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
624 }
625 return Civi::$statics[__CLASS__]['fieldKeys'];
626 }
627
628 /**
629 * Returns the names of this table
630 *
631 * @return string
632 */
633 public static function getTableName() {
634 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
635 }
636
637 /**
638 * Returns if this table needs to be logged
639 *
640 * @return bool
641 */
642 public function getLog() {
643 return self::$_log;
644 }
645
646 /**
647 * Returns the list of fields that can be imported
648 *
649 * @param bool $prefix
650 *
651 * @return array
652 */
653 public static function &import($prefix = FALSE) {
654 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_group', $prefix, []);
655 return $r;
656 }
657
658 /**
659 * Returns the list of fields that can be exported
660 *
661 * @param bool $prefix
662 *
663 * @return array
664 */
665 public static function &export($prefix = FALSE) {
666 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_group', $prefix, []);
667 return $r;
668 }
669
670 /**
671 * Returns the list of indices
672 *
673 * @param bool $localize
674 *
675 * @return array
676 */
677 public static function indices($localize = TRUE) {
678 $indices = [
679 'UI_name' => [
680 'name' => 'UI_name',
681 'field' => [
682 0 => 'name',
683 ],
684 'localizable' => FALSE,
685 'unique' => TRUE,
686 'sig' => 'civicrm_uf_group::1::name',
687 ],
688 ];
689 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
690 }
691
692 }