Merge pull request #12328 from civicrm/5.3
[civicrm-core.git] / CRM / Core / DAO / UFGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Core/UFGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a48f9522d0bd2e1d485064ebfc66f9a2)
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 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 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' => 'Unique table ID',
256 'required' => TRUE,
257 'table_name' => 'civicrm_uf_group',
258 'entity' => 'UFGroup',
259 'bao' => 'CRM_Core_BAO_UFGroup',
260 'localizable' => 0,
261 ],
262 'is_active' => [
263 'name' => 'is_active',
264 'type' => CRM_Utils_Type::T_BOOLEAN,
265 'title' => ts('Profile Is Active'),
266 'description' => 'Is this form currently active? If false, hide all related fields for all sharing contexts.',
267 'default' => '1',
268 'table_name' => 'civicrm_uf_group',
269 'entity' => 'UFGroup',
270 'bao' => 'CRM_Core_BAO_UFGroup',
271 'localizable' => 0,
272 ],
273 'group_type' => [
274 'name' => 'group_type',
275 'type' => CRM_Utils_Type::T_STRING,
276 'title' => ts('Profile Group Type'),
277 'description' => 'Comma separated list of the type(s) of profile fields.',
278 'maxlength' => 255,
279 'size' => CRM_Utils_Type::HUGE,
280 'import' => TRUE,
281 'where' => 'civicrm_uf_group.group_type',
282 'headerPattern' => '',
283 'dataPattern' => '',
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('Title'),
295 'description' => 'Form title.',
296 'required' => TRUE,
297 'maxlength' => 64,
298 'size' => CRM_Utils_Type::BIG,
299 'table_name' => 'civicrm_uf_group',
300 'entity' => 'UFGroup',
301 'bao' => 'CRM_Core_BAO_UFGroup',
302 'localizable' => 1,
303 ],
304 'frontend_title' => [
305 'name' => 'frontend_title',
306 'type' => CRM_Utils_Type::T_STRING,
307 'title' => ts('Frontend Title'),
308 'description' => 'Profile Form Public title',
309 'maxlength' => 64,
310 'size' => CRM_Utils_Type::BIG,
311 'table_name' => 'civicrm_uf_group',
312 'entity' => 'UFGroup',
313 'bao' => 'CRM_Core_BAO_UFGroup',
314 'localizable' => 1,
315 ],
316 'description' => [
317 'name' => 'description',
318 'type' => CRM_Utils_Type::T_TEXT,
319 'title' => ts('Profile Description'),
320 'description' => 'Optional verbose description of the profile.',
321 'rows' => 2,
322 'cols' => 60,
323 'table_name' => 'civicrm_uf_group',
324 'entity' => 'UFGroup',
325 'bao' => 'CRM_Core_BAO_UFGroup',
326 'localizable' => 0,
327 'html' => [
328 'type' => 'TextArea',
329 ],
330 ],
331 'help_pre' => [
332 'name' => 'help_pre',
333 'type' => CRM_Utils_Type::T_TEXT,
334 'title' => ts('Help Pre'),
335 'description' => 'Description and/or help text to display before fields in form.',
336 'rows' => 4,
337 'cols' => 80,
338 'table_name' => 'civicrm_uf_group',
339 'entity' => 'UFGroup',
340 'bao' => 'CRM_Core_BAO_UFGroup',
341 'localizable' => 1,
342 'html' => [
343 'type' => 'TextArea',
344 ],
345 ],
346 'help_post' => [
347 'name' => 'help_post',
348 'type' => CRM_Utils_Type::T_TEXT,
349 'title' => ts('Profile Post Text'),
350 'description' => 'Description and/or help text to display after fields in form.',
351 'rows' => 4,
352 'cols' => 80,
353 'table_name' => 'civicrm_uf_group',
354 'entity' => 'UFGroup',
355 'bao' => 'CRM_Core_BAO_UFGroup',
356 'localizable' => 1,
357 'html' => [
358 'type' => 'TextArea',
359 ],
360 ],
361 'limit_listings_group_id' => [
362 'name' => 'limit_listings_group_id',
363 'type' => CRM_Utils_Type::T_INT,
364 'title' => ts('Profile Search Limit Group'),
365 'description' => 'Group id, foreign key from civicrm_group',
366 'table_name' => 'civicrm_uf_group',
367 'entity' => 'UFGroup',
368 'bao' => 'CRM_Core_BAO_UFGroup',
369 'localizable' => 0,
370 'FKClassName' => 'CRM_Contact_DAO_Group',
371 ],
372 'post_URL' => [
373 'name' => 'post_URL',
374 'type' => CRM_Utils_Type::T_STRING,
375 'title' => ts('Post Url'),
376 'description' => 'Redirect to URL.',
377 'maxlength' => 255,
378 'size' => CRM_Utils_Type::HUGE,
379 'table_name' => 'civicrm_uf_group',
380 'entity' => 'UFGroup',
381 'bao' => 'CRM_Core_BAO_UFGroup',
382 'localizable' => 0,
383 ],
384 'add_to_group_id' => [
385 'name' => 'add_to_group_id',
386 'type' => CRM_Utils_Type::T_INT,
387 'title' => ts('Add Contact To Group'),
388 'description' => 'foreign key to civicrm_group_id',
389 'table_name' => 'civicrm_uf_group',
390 'entity' => 'UFGroup',
391 'bao' => 'CRM_Core_BAO_UFGroup',
392 'localizable' => 0,
393 'FKClassName' => 'CRM_Contact_DAO_Group',
394 ],
395 'add_captcha' => [
396 'name' => 'add_captcha',
397 'type' => CRM_Utils_Type::T_BOOLEAN,
398 'title' => ts('Show Captcha On Profile'),
399 'description' => 'Should a CAPTCHA widget be included this Profile form.',
400 'table_name' => 'civicrm_uf_group',
401 'entity' => 'UFGroup',
402 'bao' => 'CRM_Core_BAO_UFGroup',
403 'localizable' => 0,
404 ],
405 'is_map' => [
406 'name' => 'is_map',
407 'type' => CRM_Utils_Type::T_BOOLEAN,
408 'title' => ts('Map Profile'),
409 'description' => 'Do we want to map results from this profile.',
410 'table_name' => 'civicrm_uf_group',
411 'entity' => 'UFGroup',
412 'bao' => 'CRM_Core_BAO_UFGroup',
413 'localizable' => 0,
414 ],
415 'is_edit_link' => [
416 'name' => 'is_edit_link',
417 'type' => CRM_Utils_Type::T_BOOLEAN,
418 'title' => ts('Show Edit Link?'),
419 'description' => 'Should edit link display in profile selector',
420 'table_name' => 'civicrm_uf_group',
421 'entity' => 'UFGroup',
422 'bao' => 'CRM_Core_BAO_UFGroup',
423 'localizable' => 0,
424 ],
425 'is_uf_link' => [
426 'name' => 'is_uf_link',
427 'type' => CRM_Utils_Type::T_BOOLEAN,
428 'title' => ts('Show Link to CMS User'),
429 'description' => 'Should we display a link to the website profile in profile selector',
430 'table_name' => 'civicrm_uf_group',
431 'entity' => 'UFGroup',
432 'bao' => 'CRM_Core_BAO_UFGroup',
433 'localizable' => 0,
434 ],
435 'is_update_dupe' => [
436 'name' => 'is_update_dupe',
437 'type' => CRM_Utils_Type::T_BOOLEAN,
438 'title' => ts('Update on Duplicate'),
439 'description' => 'Should we update the contact record if we find a duplicate',
440 'table_name' => 'civicrm_uf_group',
441 'entity' => 'UFGroup',
442 'bao' => 'CRM_Core_BAO_UFGroup',
443 'localizable' => 0,
444 ],
445 'cancel_URL' => [
446 'name' => 'cancel_URL',
447 'type' => CRM_Utils_Type::T_STRING,
448 'title' => ts('Profile Cancel URL'),
449 'description' => 'Redirect to URL when Cancle button clik .',
450 'maxlength' => 255,
451 'size' => CRM_Utils_Type::HUGE,
452 'table_name' => 'civicrm_uf_group',
453 'entity' => 'UFGroup',
454 'bao' => 'CRM_Core_BAO_UFGroup',
455 'localizable' => 0,
456 ],
457 'is_cms_user' => [
458 'name' => 'is_cms_user',
459 'type' => CRM_Utils_Type::T_BOOLEAN,
460 'title' => ts('Create CMS User?'),
461 'description' => 'Should we create a cms user for this profile ',
462 'table_name' => 'civicrm_uf_group',
463 'entity' => 'UFGroup',
464 'bao' => 'CRM_Core_BAO_UFGroup',
465 'localizable' => 0,
466 ],
467 'notify' => [
468 'name' => 'notify',
469 'type' => CRM_Utils_Type::T_TEXT,
470 'title' => ts('Notify on Profile Submit'),
471 'table_name' => 'civicrm_uf_group',
472 'entity' => 'UFGroup',
473 'bao' => 'CRM_Core_BAO_UFGroup',
474 'localizable' => 0,
475 ],
476 'is_reserved' => [
477 'name' => 'is_reserved',
478 'type' => CRM_Utils_Type::T_BOOLEAN,
479 'title' => ts('Profile Is Reserved'),
480 'description' => 'Is this group reserved for use by some other CiviCRM functionality?',
481 'table_name' => 'civicrm_uf_group',
482 'entity' => 'UFGroup',
483 'bao' => 'CRM_Core_BAO_UFGroup',
484 'localizable' => 0,
485 ],
486 'name' => [
487 'name' => 'name',
488 'type' => CRM_Utils_Type::T_STRING,
489 'title' => ts('Profile Name'),
490 'description' => 'Name of the UF group for directly addressing it in the codebase',
491 'maxlength' => 64,
492 'size' => CRM_Utils_Type::BIG,
493 'table_name' => 'civicrm_uf_group',
494 'entity' => 'UFGroup',
495 'bao' => 'CRM_Core_BAO_UFGroup',
496 'localizable' => 0,
497 ],
498 'created_id' => [
499 'name' => 'created_id',
500 'type' => CRM_Utils_Type::T_INT,
501 'title' => ts('Profile Created By'),
502 'description' => 'FK to civicrm_contact, who created this UF group',
503 'table_name' => 'civicrm_uf_group',
504 'entity' => 'UFGroup',
505 'bao' => 'CRM_Core_BAO_UFGroup',
506 'localizable' => 0,
507 'FKClassName' => 'CRM_Contact_DAO_Contact',
508 ],
509 'created_date' => [
510 'name' => 'created_date',
511 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
512 'title' => ts('UF Group Created Date'),
513 'description' => 'Date and time this UF group was created.',
514 'table_name' => 'civicrm_uf_group',
515 'entity' => 'UFGroup',
516 'bao' => 'CRM_Core_BAO_UFGroup',
517 'localizable' => 0,
518 ],
519 'is_proximity_search' => [
520 'name' => 'is_proximity_search',
521 'type' => CRM_Utils_Type::T_BOOLEAN,
522 'title' => ts('Include Proximity Search?'),
523 'description' => 'Should we include proximity search feature in this profile search form?',
524 'table_name' => 'civicrm_uf_group',
525 'entity' => 'UFGroup',
526 'bao' => 'CRM_Core_BAO_UFGroup',
527 'localizable' => 0,
528 ],
529 'cancel_button_text' => [
530 'name' => 'cancel_button_text',
531 'type' => CRM_Utils_Type::T_STRING,
532 'title' => ts('Cancel Button Text'),
533 'description' => 'Custom Text to display on the Cancel button when used in create or edit mode',
534 'maxlength' => 64,
535 'size' => CRM_Utils_Type::BIG,
536 'default' => 'NULL',
537 'table_name' => 'civicrm_uf_group',
538 'entity' => 'UFGroup',
539 'bao' => 'CRM_Core_BAO_UFGroup',
540 'localizable' => 1,
541 ],
542 'submit_button_text' => [
543 'name' => 'submit_button_text',
544 'type' => CRM_Utils_Type::T_STRING,
545 'title' => ts('Submit Button Text'),
546 'description' => 'Custom Text to display on the submit button on profile edit/create screens',
547 'maxlength' => 64,
548 'size' => CRM_Utils_Type::BIG,
549 'default' => 'NULL',
550 'table_name' => 'civicrm_uf_group',
551 'entity' => 'UFGroup',
552 'bao' => 'CRM_Core_BAO_UFGroup',
553 'localizable' => 1,
554 ],
555 'add_cancel_button' => [
556 'name' => 'add_cancel_button',
557 'type' => CRM_Utils_Type::T_BOOLEAN,
558 'title' => ts('Include Cancel Button'),
559 'description' => 'Should a Cancel button be included in this Profile form.',
560 'default' => '1',
561 'table_name' => 'civicrm_uf_group',
562 'entity' => 'UFGroup',
563 'bao' => 'CRM_Core_BAO_UFGroup',
564 'localizable' => 0,
565 ],
566 ];
567 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
568 }
569 return Civi::$statics[__CLASS__]['fields'];
570 }
571
572 /**
573 * Return a mapping from field-name to the corresponding key (as used in fields()).
574 *
575 * @return array
576 * Array(string $name => string $uniqueName).
577 */
578 public static function &fieldKeys() {
579 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
580 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
581 }
582 return Civi::$statics[__CLASS__]['fieldKeys'];
583 }
584
585 /**
586 * Returns the names of this table
587 *
588 * @return string
589 */
590 public static function getTableName() {
591 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
592 }
593
594 /**
595 * Returns if this table needs to be logged
596 *
597 * @return bool
598 */
599 public function getLog() {
600 return self::$_log;
601 }
602
603 /**
604 * Returns the list of fields that can be imported
605 *
606 * @param bool $prefix
607 *
608 * @return array
609 */
610 public static function &import($prefix = FALSE) {
611 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_group', $prefix, []);
612 return $r;
613 }
614
615 /**
616 * Returns the list of fields that can be exported
617 *
618 * @param bool $prefix
619 *
620 * @return array
621 */
622 public static function &export($prefix = FALSE) {
623 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_group', $prefix, []);
624 return $r;
625 }
626
627 /**
628 * Returns the list of indices
629 *
630 * @param bool $localize
631 *
632 * @return array
633 */
634 public static function indices($localize = TRUE) {
635 $indices = [
636 'UI_name' => [
637 'name' => 'UI_name',
638 'field' => [
639 0 => 'name',
640 ],
641 'localizable' => FALSE,
642 'unique' => TRUE,
643 'sig' => 'civicrm_uf_group::1::name',
644 ],
645 ];
646 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
647 }
648
649 }