Merge pull request #14014 from MegaphoneJon/reporting-14
[civicrm-core.git] / CRM / Core / DAO / UFField.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/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a36434b9 9 * (GenCodeChecksum:3acfd1d2bd5f1e54f8aee7f96328cb58)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the UFField entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_UFField extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_uf_field';
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 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * Unique table ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Which form does this field belong to.
40 *
41 * @var int unsigned
42 */
43 public $uf_group_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Name for CiviCRM field which is being exposed for sharing.
47 *
48 * @var string
49 */
50 public $field_name;
c3fc2621 51
e501603b
TO
52 /**
53 * Is this field currently shareable? If false, hide the field for all sharing contexts.
54 *
55 * @var boolean
56 */
57 public $is_active;
c3fc2621 58
e501603b
TO
59 /**
60 * the field is view only and not editable in user forms.
61 *
62 * @var boolean
63 */
64 public $is_view;
c3fc2621 65
e501603b
TO
66 /**
67 * Is this field required when included in a user or registration form?
68 *
69 * @var boolean
70 */
71 public $is_required;
c3fc2621 72
e501603b
TO
73 /**
74 * Controls field display order when user framework fields are displayed in registration and account editing forms.
75 *
76 * @var int
77 */
78 public $weight;
c3fc2621 79
e501603b
TO
80 /**
81 * Description and/or help text to display after this field.
82 *
83 * @var text
84 */
85 public $help_post;
c3fc2621 86
e501603b
TO
87 /**
88 * Description and/or help text to display before this field.
89 *
90 * @var text
91 */
92 public $help_pre;
c3fc2621 93
e501603b
TO
94 /**
95 * In what context(s) is this field visible.
96 *
97 * @var string
98 */
99 public $visibility;
c3fc2621 100
e501603b
TO
101 /**
102 * Is this field included as a column in the selector table?
103 *
104 * @var boolean
105 */
106 public $in_selector;
c3fc2621 107
e501603b
TO
108 /**
109 * Is this field included search form of profile?
110 *
111 * @var boolean
112 */
113 public $is_searchable;
c3fc2621 114
e501603b
TO
115 /**
116 * Location type of this mapping, if required
117 *
118 * @var int unsigned
119 */
120 public $location_type_id;
c3fc2621 121
e501603b
TO
122 /**
123 * Phone Type Id, if required
124 *
125 * @var int unsigned
126 */
127 public $phone_type_id;
c3fc2621 128
e501603b
TO
129 /**
130 * Website Type Id, if required
131 *
132 * @var int unsigned
133 */
134 public $website_type_id;
c3fc2621 135
e501603b
TO
136 /**
137 * To save label for fields.
138 *
139 * @var string
140 */
141 public $label;
c3fc2621 142
e501603b
TO
143 /**
144 * This field saves field type (ie individual,household.. field etc).
145 *
146 * @var string
147 */
148 public $field_type;
c3fc2621 149
e501603b
TO
150 /**
151 * Is this field reserved for use by some other CiviCRM functionality?
152 *
153 * @var boolean
154 */
155 public $is_reserved;
c3fc2621 156
e501603b
TO
157 /**
158 * Include in multi-record listing?
159 *
160 * @var boolean
161 */
162 public $is_multi_summary;
c3fc2621 163
e501603b 164 /**
f41f0342 165 * Class constructor.
e501603b 166 */
c3fc2621 167 public function __construct() {
e501603b
TO
168 $this->__table = 'civicrm_uf_field';
169 parent::__construct();
170 }
c3fc2621 171
e501603b 172 /**
f41f0342 173 * Returns foreign keys and entity references.
e501603b
TO
174 *
175 * @return array
176 * [CRM_Core_Reference_Interface]
177 */
c3fc2621 178 public static function getReferenceColumns() {
346aaaba 179 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 180 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
181 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id');
182 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
346aaaba 183 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 184 }
346aaaba 185 return Civi::$statics[__CLASS__]['links'];
e501603b 186 }
c3fc2621 187
e501603b
TO
188 /**
189 * Returns all the column names of this table
190 *
191 * @return array
192 */
c3fc2621 193 public static function &fields() {
346aaaba 194 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
195 Civi::$statics[__CLASS__]['fields'] = [
196 'id' => [
e501603b
TO
197 'name' => 'id',
198 'type' => CRM_Utils_Type::T_INT,
c3fc2621 199 'title' => ts('Profile Field ID'),
215b423e 200 'description' => ts('Unique table ID'),
c3fc2621 201 'required' => TRUE,
a36434b9 202 'where' => 'civicrm_uf_field.id',
522a26c9 203 'table_name' => 'civicrm_uf_field',
204 'entity' => 'UFField',
205 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 206 'localizable' => 0,
c3fc2621
CW
207 ],
208 'uf_group_id' => [
e501603b
TO
209 'name' => 'uf_group_id',
210 'type' => CRM_Utils_Type::T_INT,
c3fc2621 211 'title' => ts('Profile ID'),
215b423e 212 'description' => ts('Which form does this field belong to.'),
c3fc2621 213 'required' => TRUE,
a36434b9 214 'where' => 'civicrm_uf_field.uf_group_id',
522a26c9 215 'table_name' => 'civicrm_uf_field',
216 'entity' => 'UFField',
217 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 218 'localizable' => 0,
e501603b 219 'FKClassName' => 'CRM_Core_DAO_UFGroup',
c3fc2621 220 'html' => [
e501603b 221 'type' => 'Select',
c3fc2621
CW
222 ],
223 'pseudoconstant' => [
e501603b
TO
224 'table' => 'civicrm_uf_group',
225 'keyColumn' => 'id',
226 'labelColumn' => 'title',
c3fc2621
CW
227 ]
228 ],
229 'field_name' => [
e501603b
TO
230 'name' => 'field_name',
231 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 232 'title' => ts('Profile Field Name'),
215b423e 233 'description' => ts('Name for CiviCRM field which is being exposed for sharing.'),
c3fc2621 234 'required' => TRUE,
e501603b
TO
235 'maxlength' => 64,
236 'size' => CRM_Utils_Type::BIG,
a36434b9 237 'where' => 'civicrm_uf_field.field_name',
522a26c9 238 'table_name' => 'civicrm_uf_field',
239 'entity' => 'UFField',
240 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 241 'localizable' => 0,
ffb9cdec
CW
242 'pseudoconstant' => [
243 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
244 ]
c3fc2621
CW
245 ],
246 'is_active' => [
e501603b
TO
247 'name' => 'is_active',
248 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 249 'title' => ts('Profile Field Is Active'),
215b423e 250 'description' => ts('Is this field currently shareable? If false, hide the field for all sharing contexts.'),
a36434b9 251 'where' => 'civicrm_uf_field.is_active',
e501603b 252 'default' => '1',
522a26c9 253 'table_name' => 'civicrm_uf_field',
254 'entity' => 'UFField',
255 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 256 'localizable' => 0,
c3fc2621
CW
257 ],
258 'is_view' => [
e501603b
TO
259 'name' => 'is_view',
260 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 261 'title' => ts('Profile Is View Only'),
215b423e 262 'description' => ts('the field is view only and not editable in user forms.'),
a36434b9 263 'where' => 'civicrm_uf_field.is_view',
45a83e42 264 'default' => '0',
522a26c9 265 'table_name' => 'civicrm_uf_field',
266 'entity' => 'UFField',
267 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 268 'localizable' => 0,
c3fc2621
CW
269 ],
270 'is_required' => [
e501603b
TO
271 'name' => 'is_required',
272 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 273 'title' => ts('Profile Field Is Required'),
215b423e 274 'description' => ts('Is this field required when included in a user or registration form?'),
a36434b9 275 'where' => 'civicrm_uf_field.is_required',
45a83e42 276 'default' => '0',
522a26c9 277 'table_name' => 'civicrm_uf_field',
278 'entity' => 'UFField',
279 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 280 'localizable' => 0,
c3fc2621
CW
281 ],
282 'weight' => [
e501603b
TO
283 'name' => 'weight',
284 'type' => CRM_Utils_Type::T_INT,
c3fc2621 285 'title' => ts('Order'),
215b423e 286 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
c3fc2621 287 'required' => TRUE,
a36434b9 288 'where' => 'civicrm_uf_field.weight',
e501603b 289 'default' => '1',
522a26c9 290 'table_name' => 'civicrm_uf_field',
291 'entity' => 'UFField',
292 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 293 'localizable' => 0,
c3fc2621
CW
294 ],
295 'help_post' => [
e501603b
TO
296 'name' => 'help_post',
297 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 298 'title' => ts('Profile Field Post Help'),
215b423e 299 'description' => ts('Description and/or help text to display after this field.'),
a36434b9 300 'where' => 'civicrm_uf_field.help_post',
522a26c9 301 'table_name' => 'civicrm_uf_field',
302 'entity' => 'UFField',
303 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 304 'localizable' => 1,
c3fc2621
CW
305 ],
306 'help_pre' => [
e501603b
TO
307 'name' => 'help_pre',
308 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 309 'title' => ts('Profile Field Pre Help'),
215b423e 310 'description' => ts('Description and/or help text to display before this field.'),
a36434b9 311 'where' => 'civicrm_uf_field.help_pre',
522a26c9 312 'table_name' => 'civicrm_uf_field',
313 'entity' => 'UFField',
314 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 315 'localizable' => 1,
c3fc2621
CW
316 ],
317 'visibility' => [
e501603b
TO
318 'name' => 'visibility',
319 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 320 'title' => ts('Profile Field Visibility'),
215b423e 321 'description' => ts('In what context(s) is this field visible.'),
e501603b
TO
322 'maxlength' => 32,
323 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 324 'where' => 'civicrm_uf_field.visibility',
e501603b 325 'default' => 'User and User Admin Only',
522a26c9 326 'table_name' => 'civicrm_uf_field',
327 'entity' => 'UFField',
328 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 329 'localizable' => 0,
c3fc2621 330 'html' => [
e501603b 331 'type' => 'Select',
c3fc2621
CW
332 ],
333 'pseudoconstant' => [
e501603b 334 'callback' => 'CRM_Core_SelectValues::ufVisibility',
c3fc2621
CW
335 ]
336 ],
337 'in_selector' => [
e501603b
TO
338 'name' => 'in_selector',
339 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 340 'title' => ts('Profile Field Is a Filter'),
215b423e 341 'description' => ts('Is this field included as a column in the selector table?'),
a36434b9 342 'where' => 'civicrm_uf_field.in_selector',
45a83e42 343 'default' => '0',
522a26c9 344 'table_name' => 'civicrm_uf_field',
345 'entity' => 'UFField',
346 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 347 'localizable' => 0,
c3fc2621
CW
348 ],
349 'is_searchable' => [
e501603b
TO
350 'name' => 'is_searchable',
351 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 352 'title' => ts('Profile Field Is Searchable'),
215b423e 353 'description' => ts('Is this field included search form of profile?'),
a36434b9 354 'where' => 'civicrm_uf_field.is_searchable',
45a83e42 355 'default' => '0',
522a26c9 356 'table_name' => 'civicrm_uf_field',
357 'entity' => 'UFField',
358 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 359 'localizable' => 0,
c3fc2621
CW
360 ],
361 'location_type_id' => [
e501603b
TO
362 'name' => 'location_type_id',
363 'type' => CRM_Utils_Type::T_INT,
c3fc2621 364 'title' => ts('Profile Field Location Type'),
215b423e 365 'description' => ts('Location type of this mapping, if required'),
a36434b9 366 'where' => 'civicrm_uf_field.location_type_id',
522a26c9 367 'table_name' => 'civicrm_uf_field',
368 'entity' => 'UFField',
369 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 370 'localizable' => 0,
e501603b 371 'FKClassName' => 'CRM_Core_DAO_LocationType',
c3fc2621
CW
372 ],
373 'phone_type_id' => [
e501603b
TO
374 'name' => 'phone_type_id',
375 'type' => CRM_Utils_Type::T_INT,
c3fc2621 376 'title' => ts('Profile Field Phone Type'),
215b423e 377 'description' => ts('Phone Type Id, if required'),
a36434b9 378 'where' => 'civicrm_uf_field.phone_type_id',
522a26c9 379 'table_name' => 'civicrm_uf_field',
380 'entity' => 'UFField',
381 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 382 'localizable' => 0,
b9bf5852
PN
383 'pseudoconstant' => [
384 'optionGroupName' => 'phone_type',
385 'optionEditPath' => 'civicrm/admin/options/phone_type',
386 ]
c3fc2621
CW
387 ],
388 'website_type_id' => [
e501603b
TO
389 'name' => 'website_type_id',
390 'type' => CRM_Utils_Type::T_INT,
c3fc2621 391 'title' => ts('Profile Field Website Type'),
215b423e 392 'description' => ts('Website Type Id, if required'),
a36434b9 393 'where' => 'civicrm_uf_field.website_type_id',
522a26c9 394 'table_name' => 'civicrm_uf_field',
395 'entity' => 'UFField',
396 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 397 'localizable' => 0,
b9bf5852
PN
398 'pseudoconstant' => [
399 'optionGroupName' => 'website_type',
400 'optionEditPath' => 'civicrm/admin/options/website_type',
401 ]
c3fc2621
CW
402 ],
403 'label' => [
e501603b
TO
404 'name' => 'label',
405 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 406 'title' => ts('Profile Field Label'),
215b423e 407 'description' => ts('To save label for fields.'),
c3fc2621 408 'required' => TRUE,
e501603b
TO
409 'maxlength' => 255,
410 'size' => CRM_Utils_Type::HUGE,
a36434b9 411 'where' => 'civicrm_uf_field.label',
522a26c9 412 'table_name' => 'civicrm_uf_field',
413 'entity' => 'UFField',
414 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 415 'localizable' => 1,
c3fc2621
CW
416 ],
417 'field_type' => [
e501603b
TO
418 'name' => 'field_type',
419 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 420 'title' => ts('Profile Field Type'),
215b423e 421 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
e501603b
TO
422 'maxlength' => 255,
423 'size' => CRM_Utils_Type::HUGE,
a36434b9 424 'where' => 'civicrm_uf_field.field_type',
522a26c9 425 'table_name' => 'civicrm_uf_field',
426 'entity' => 'UFField',
427 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 428 'localizable' => 0,
c3fc2621
CW
429 ],
430 'is_reserved' => [
e501603b
TO
431 'name' => 'is_reserved',
432 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 433 'title' => ts('Profile Field Is Reserved'),
215b423e 434 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
a36434b9 435 'where' => 'civicrm_uf_field.is_reserved',
522a26c9 436 'table_name' => 'civicrm_uf_field',
437 'entity' => 'UFField',
438 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 439 'localizable' => 0,
c3fc2621
CW
440 ],
441 'is_multi_summary' => [
e501603b
TO
442 'name' => 'is_multi_summary',
443 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 444 'title' => ts('Profile Field Supports Multiple'),
215b423e 445 'description' => ts('Include in multi-record listing?'),
a36434b9 446 'where' => 'civicrm_uf_field.is_multi_summary',
45a83e42 447 'default' => '0',
522a26c9 448 'table_name' => 'civicrm_uf_field',
449 'entity' => 'UFField',
450 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 451 'localizable' => 0,
c3fc2621
CW
452 ],
453 ];
346aaaba 454 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 455 }
346aaaba 456 return Civi::$statics[__CLASS__]['fields'];
e501603b 457 }
c3fc2621 458
e501603b 459 /**
bd8e0b14 460 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
461 *
462 * @return array
bd8e0b14 463 * Array(string $name => string $uniqueName).
e501603b 464 */
c3fc2621 465 public static function &fieldKeys() {
bd8e0b14
TO
466 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
467 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 468 }
bd8e0b14 469 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 470 }
c3fc2621 471
e501603b
TO
472 /**
473 * Returns the names of this table
474 *
475 * @return string
476 */
c3fc2621 477 public static function getTableName() {
e501603b
TO
478 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
479 }
c3fc2621 480
e501603b
TO
481 /**
482 * Returns if this table needs to be logged
483 *
c3fc2621 484 * @return bool
e501603b 485 */
c3fc2621 486 public function getLog() {
e501603b
TO
487 return self::$_log;
488 }
c3fc2621 489
e501603b
TO
490 /**
491 * Returns the list of fields that can be imported
492 *
493 * @param bool $prefix
494 *
495 * @return array
496 */
c3fc2621
CW
497 public static function &import($prefix = FALSE) {
498 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []);
60808919 499 return $r;
e501603b 500 }
c3fc2621 501
e501603b
TO
502 /**
503 * Returns the list of fields that can be exported
504 *
505 * @param bool $prefix
506 *
507 * @return array
508 */
c3fc2621
CW
509 public static function &export($prefix = FALSE) {
510 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []);
60808919 511 return $r;
e501603b 512 }
c3fc2621 513
e7a6b91a
AS
514 /**
515 * Returns the list of indices
c3fc2621
CW
516 *
517 * @param bool $localize
518 *
519 * @return array
e7a6b91a
AS
520 */
521 public static function indices($localize = TRUE) {
c3fc2621
CW
522 $indices = [
523 'IX_website_type_id' => [
e7a6b91a 524 'name' => 'IX_website_type_id',
c3fc2621 525 'field' => [
e7a6b91a 526 0 => 'website_type_id',
c3fc2621
CW
527 ],
528 'localizable' => FALSE,
e7a6b91a 529 'sig' => 'civicrm_uf_field::0::website_type_id',
c3fc2621
CW
530 ],
531 ];
e7a6b91a
AS
532 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
533 }
c3fc2621 534
e501603b 535}