Merge pull request #12056 from eileenmcnaughton/pcp
[civicrm-core.git] / CRM / Core / DAO / UFField.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 9 * (GenCodeChecksum:4777c5b97760d4bd4b7138468d18ded5)
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 */
22 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 */
c3fc2621
CW
29 static $_log = TRUE;
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
TO
179 if (!isset(Civi::$statics[__CLASS__]['links'])) {
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'),
e501603b 200 'description' => 'Unique table ID',
c3fc2621 201 'required' => TRUE,
522a26c9 202 'table_name' => 'civicrm_uf_field',
203 'entity' => 'UFField',
204 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 205 'localizable' => 0,
c3fc2621
CW
206 ],
207 'uf_group_id' => [
e501603b
TO
208 'name' => 'uf_group_id',
209 'type' => CRM_Utils_Type::T_INT,
c3fc2621 210 'title' => ts('Profile ID'),
e501603b 211 'description' => 'Which form does this field belong to.',
c3fc2621 212 'required' => TRUE,
522a26c9 213 'table_name' => 'civicrm_uf_field',
214 'entity' => 'UFField',
215 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 216 'localizable' => 0,
e501603b 217 'FKClassName' => 'CRM_Core_DAO_UFGroup',
c3fc2621 218 'html' => [
e501603b 219 'type' => 'Select',
c3fc2621
CW
220 ],
221 'pseudoconstant' => [
e501603b
TO
222 'table' => 'civicrm_uf_group',
223 'keyColumn' => 'id',
224 'labelColumn' => 'title',
c3fc2621
CW
225 ]
226 ],
227 'field_name' => [
e501603b
TO
228 'name' => 'field_name',
229 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 230 'title' => ts('Profile Field Name'),
e501603b 231 'description' => 'Name for CiviCRM field which is being exposed for sharing.',
c3fc2621 232 'required' => TRUE,
e501603b
TO
233 'maxlength' => 64,
234 'size' => CRM_Utils_Type::BIG,
522a26c9 235 'table_name' => 'civicrm_uf_field',
236 'entity' => 'UFField',
237 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 238 'localizable' => 0,
c3fc2621
CW
239 ],
240 'is_active' => [
e501603b
TO
241 'name' => 'is_active',
242 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 243 'title' => ts('Profile Field Is Active'),
e501603b
TO
244 'description' => 'Is this field currently shareable? If false, hide the field for all sharing contexts.',
245 'default' => '1',
522a26c9 246 'table_name' => 'civicrm_uf_field',
247 'entity' => 'UFField',
248 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 249 'localizable' => 0,
c3fc2621
CW
250 ],
251 'is_view' => [
e501603b
TO
252 'name' => 'is_view',
253 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 254 'title' => ts('Profile Is View Only'),
e501603b 255 'description' => 'the field is view only and not editable in user forms.',
522a26c9 256 'table_name' => 'civicrm_uf_field',
257 'entity' => 'UFField',
258 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 259 'localizable' => 0,
c3fc2621
CW
260 ],
261 'is_required' => [
e501603b
TO
262 'name' => 'is_required',
263 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 264 'title' => ts('Profile Field Is Required'),
e501603b 265 'description' => 'Is this field required when included in a user or registration form?',
522a26c9 266 'table_name' => 'civicrm_uf_field',
267 'entity' => 'UFField',
268 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 269 'localizable' => 0,
c3fc2621
CW
270 ],
271 'weight' => [
e501603b
TO
272 'name' => 'weight',
273 'type' => CRM_Utils_Type::T_INT,
c3fc2621 274 'title' => ts('Order'),
e501603b 275 'description' => 'Controls field display order when user framework fields are displayed in registration and account editing forms.',
c3fc2621 276 'required' => TRUE,
e501603b 277 'default' => '1',
522a26c9 278 'table_name' => 'civicrm_uf_field',
279 'entity' => 'UFField',
280 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 281 'localizable' => 0,
c3fc2621
CW
282 ],
283 'help_post' => [
e501603b
TO
284 'name' => 'help_post',
285 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 286 'title' => ts('Profile Field Post Help'),
e501603b 287 'description' => 'Description and/or help text to display after this field.',
522a26c9 288 'table_name' => 'civicrm_uf_field',
289 'entity' => 'UFField',
290 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 291 'localizable' => 1,
c3fc2621
CW
292 ],
293 'help_pre' => [
e501603b
TO
294 'name' => 'help_pre',
295 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 296 'title' => ts('Profile Field Pre Help'),
e501603b 297 'description' => 'Description and/or help text to display before this field.',
522a26c9 298 'table_name' => 'civicrm_uf_field',
299 'entity' => 'UFField',
300 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 301 'localizable' => 1,
c3fc2621
CW
302 ],
303 'visibility' => [
e501603b
TO
304 'name' => 'visibility',
305 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 306 'title' => ts('Profile Field Visibility'),
e501603b
TO
307 'description' => 'In what context(s) is this field visible.',
308 'maxlength' => 32,
309 'size' => CRM_Utils_Type::MEDIUM,
310 'default' => 'User and User Admin Only',
522a26c9 311 'table_name' => 'civicrm_uf_field',
312 'entity' => 'UFField',
313 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 314 'localizable' => 0,
c3fc2621 315 'html' => [
e501603b 316 'type' => 'Select',
c3fc2621
CW
317 ],
318 'pseudoconstant' => [
e501603b 319 'callback' => 'CRM_Core_SelectValues::ufVisibility',
c3fc2621
CW
320 ]
321 ],
322 'in_selector' => [
e501603b
TO
323 'name' => 'in_selector',
324 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 325 'title' => ts('Profile Field Is a Filter'),
e501603b 326 'description' => 'Is this field included as a column in the selector table?',
522a26c9 327 'table_name' => 'civicrm_uf_field',
328 'entity' => 'UFField',
329 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 330 'localizable' => 0,
c3fc2621
CW
331 ],
332 'is_searchable' => [
e501603b
TO
333 'name' => 'is_searchable',
334 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 335 'title' => ts('Profile Field Is Searchable'),
e501603b 336 'description' => 'Is this field included search form of profile?',
522a26c9 337 'table_name' => 'civicrm_uf_field',
338 'entity' => 'UFField',
339 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 340 'localizable' => 0,
c3fc2621
CW
341 ],
342 'location_type_id' => [
e501603b
TO
343 'name' => 'location_type_id',
344 'type' => CRM_Utils_Type::T_INT,
c3fc2621 345 'title' => ts('Profile Field Location Type'),
e501603b 346 'description' => 'Location type of this mapping, if required',
522a26c9 347 'table_name' => 'civicrm_uf_field',
348 'entity' => 'UFField',
349 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 350 'localizable' => 0,
e501603b 351 'FKClassName' => 'CRM_Core_DAO_LocationType',
c3fc2621
CW
352 ],
353 'phone_type_id' => [
e501603b
TO
354 'name' => 'phone_type_id',
355 'type' => CRM_Utils_Type::T_INT,
c3fc2621 356 'title' => ts('Profile Field Phone Type'),
e501603b 357 'description' => 'Phone Type Id, if required',
522a26c9 358 'table_name' => 'civicrm_uf_field',
359 'entity' => 'UFField',
360 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 361 'localizable' => 0,
c3fc2621
CW
362 ],
363 'website_type_id' => [
e501603b
TO
364 'name' => 'website_type_id',
365 'type' => CRM_Utils_Type::T_INT,
c3fc2621 366 'title' => ts('Profile Field Website Type'),
e501603b 367 'description' => 'Website Type Id, if required',
522a26c9 368 'table_name' => 'civicrm_uf_field',
369 'entity' => 'UFField',
370 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 371 'localizable' => 0,
c3fc2621
CW
372 ],
373 'label' => [
e501603b
TO
374 'name' => 'label',
375 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 376 'title' => ts('Profile Field Label'),
e501603b 377 'description' => 'To save label for fields.',
c3fc2621 378 'required' => TRUE,
e501603b
TO
379 'maxlength' => 255,
380 'size' => CRM_Utils_Type::HUGE,
522a26c9 381 'table_name' => 'civicrm_uf_field',
382 'entity' => 'UFField',
383 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 384 'localizable' => 1,
c3fc2621
CW
385 ],
386 'field_type' => [
e501603b
TO
387 'name' => 'field_type',
388 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 389 'title' => ts('Profile Field Type'),
e501603b
TO
390 'description' => 'This field saves field type (ie individual,household.. field etc).',
391 'maxlength' => 255,
392 'size' => CRM_Utils_Type::HUGE,
522a26c9 393 'table_name' => 'civicrm_uf_field',
394 'entity' => 'UFField',
395 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 396 'localizable' => 0,
c3fc2621
CW
397 ],
398 'is_reserved' => [
e501603b
TO
399 'name' => 'is_reserved',
400 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 401 'title' => ts('Profile Field Is Reserved'),
e501603b 402 'description' => 'Is this field reserved for use by some other CiviCRM functionality?',
522a26c9 403 'table_name' => 'civicrm_uf_field',
404 'entity' => 'UFField',
405 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 406 'localizable' => 0,
c3fc2621
CW
407 ],
408 'is_multi_summary' => [
e501603b
TO
409 'name' => 'is_multi_summary',
410 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 411 'title' => ts('Profile Field Supports Multiple'),
e501603b 412 'description' => 'Include in multi-record listing?',
522a26c9 413 'table_name' => 'civicrm_uf_field',
414 'entity' => 'UFField',
415 'bao' => 'CRM_Core_BAO_UFField',
6a7e5e5d 416 'localizable' => 0,
c3fc2621
CW
417 ],
418 ];
346aaaba 419 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 420 }
346aaaba 421 return Civi::$statics[__CLASS__]['fields'];
e501603b 422 }
c3fc2621 423
e501603b 424 /**
bd8e0b14 425 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
426 *
427 * @return array
bd8e0b14 428 * Array(string $name => string $uniqueName).
e501603b 429 */
c3fc2621 430 public static function &fieldKeys() {
bd8e0b14
TO
431 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
432 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 433 }
bd8e0b14 434 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 435 }
c3fc2621 436
e501603b
TO
437 /**
438 * Returns the names of this table
439 *
440 * @return string
441 */
c3fc2621 442 public static function getTableName() {
e501603b
TO
443 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
444 }
c3fc2621 445
e501603b
TO
446 /**
447 * Returns if this table needs to be logged
448 *
c3fc2621 449 * @return bool
e501603b 450 */
c3fc2621 451 public function getLog() {
e501603b
TO
452 return self::$_log;
453 }
c3fc2621 454
e501603b
TO
455 /**
456 * Returns the list of fields that can be imported
457 *
458 * @param bool $prefix
459 *
460 * @return array
461 */
c3fc2621
CW
462 public static function &import($prefix = FALSE) {
463 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []);
60808919 464 return $r;
e501603b 465 }
c3fc2621 466
e501603b
TO
467 /**
468 * Returns the list of fields that can be exported
469 *
470 * @param bool $prefix
471 *
472 * @return array
473 */
c3fc2621
CW
474 public static function &export($prefix = FALSE) {
475 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []);
60808919 476 return $r;
e501603b 477 }
c3fc2621 478
e7a6b91a
AS
479 /**
480 * Returns the list of indices
c3fc2621
CW
481 *
482 * @param bool $localize
483 *
484 * @return array
e7a6b91a
AS
485 */
486 public static function indices($localize = TRUE) {
c3fc2621
CW
487 $indices = [
488 'IX_website_type_id' => [
e7a6b91a 489 'name' => 'IX_website_type_id',
c3fc2621 490 'field' => [
e7a6b91a 491 0 => 'website_type_id',
c3fc2621
CW
492 ],
493 'localizable' => FALSE,
e7a6b91a 494 'sig' => 'civicrm_uf_field::0::website_type_id',
c3fc2621
CW
495 ],
496 ];
e7a6b91a
AS
497 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
498 }
c3fc2621 499
e501603b 500}