CRM-20312 add field localisation data to DAO.
[civicrm-core.git] / CRM / Core / DAO / UFField.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/UFField.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:d2130248046efdb387d19bc28fab23b4)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_UFField constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_UFField extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_uf_field';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Unique table ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Which form does this field belong to.
61 *
62 * @var int unsigned
63 */
64 public $uf_group_id;
65 /**
66 * Name for CiviCRM field which is being exposed for sharing.
67 *
68 * @var string
69 */
70 public $field_name;
71 /**
72 * Is this field currently shareable? If false, hide the field for all sharing contexts.
73 *
74 * @var boolean
75 */
76 public $is_active;
77 /**
78 * the field is view only and not editable in user forms.
79 *
80 * @var boolean
81 */
82 public $is_view;
83 /**
84 * Is this field required when included in a user or registration form?
85 *
86 * @var boolean
87 */
88 public $is_required;
89 /**
90 * Controls field display order when user framework fields are displayed in registration and account editing forms.
91 *
92 * @var int
93 */
94 public $weight;
95 /**
96 * Description and/or help text to display after this field.
97 *
98 * @var text
99 */
100 public $help_post;
101 /**
102 * Description and/or help text to display before this field.
103 *
104 * @var text
105 */
106 public $help_pre;
107 /**
108 * In what context(s) is this field visible.
109 *
110 * @var string
111 */
112 public $visibility;
113 /**
114 * Is this field included as a column in the selector table?
115 *
116 * @var boolean
117 */
118 public $in_selector;
119 /**
120 * Is this field included search form of profile?
121 *
122 * @var boolean
123 */
124 public $is_searchable;
125 /**
126 * Location type of this mapping, if required
127 *
128 * @var int unsigned
129 */
130 public $location_type_id;
131 /**
132 * Phone Type Id, if required
133 *
134 * @var int unsigned
135 */
136 public $phone_type_id;
137 /**
138 * Website Type Id, if required
139 *
140 * @var int unsigned
141 */
142 public $website_type_id;
143 /**
144 * To save label for fields.
145 *
146 * @var string
147 */
148 public $label;
149 /**
150 * This field saves field type (ie individual,household.. field etc).
151 *
152 * @var string
153 */
154 public $field_type;
155 /**
156 * Is this field reserved for use by some other CiviCRM functionality?
157 *
158 * @var boolean
159 */
160 public $is_reserved;
161 /**
162 * Include in multi-record listing?
163 *
164 * @var boolean
165 */
166 public $is_multi_summary;
167 /**
f41f0342 168 * Class constructor.
e501603b
TO
169 */
170 function __construct() {
171 $this->__table = 'civicrm_uf_field';
172 parent::__construct();
173 }
174 /**
f41f0342 175 * Returns foreign keys and entity references.
e501603b
TO
176 *
177 * @return array
178 * [CRM_Core_Reference_Interface]
179 */
180 static function getReferenceColumns() {
346aaaba
TO
181 if (!isset(Civi::$statics[__CLASS__]['links'])) {
182 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
183 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'uf_group_id', 'civicrm_uf_group', 'id');
184 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id');
185 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 186 }
346aaaba 187 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
188 }
189 /**
190 * Returns all the column names of this table
191 *
192 * @return array
193 */
194 static function &fields() {
346aaaba
TO
195 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
196 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
197 'id' => array(
198 'name' => 'id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Profile Field ID') ,
201 'description' => 'Unique table ID',
202 'required' => true,
522a26c9 203 'table_name' => 'civicrm_uf_field',
204 'entity' => 'UFField',
205 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
206 ) ,
207 'uf_group_id' => array(
208 'name' => 'uf_group_id',
209 'type' => CRM_Utils_Type::T_INT,
210 'title' => ts('Profile ID') ,
211 'description' => 'Which form does this field belong to.',
212 'required' => true,
522a26c9 213 'table_name' => 'civicrm_uf_field',
214 'entity' => 'UFField',
215 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
216 'FKClassName' => 'CRM_Core_DAO_UFGroup',
217 'html' => array(
218 'type' => 'Select',
219 ) ,
220 'pseudoconstant' => array(
221 'table' => 'civicrm_uf_group',
222 'keyColumn' => 'id',
223 'labelColumn' => 'title',
224 )
225 ) ,
226 'field_name' => array(
227 'name' => 'field_name',
228 'type' => CRM_Utils_Type::T_STRING,
229 'title' => ts('Profile Field Name') ,
230 'description' => 'Name for CiviCRM field which is being exposed for sharing.',
231 'required' => true,
232 'maxlength' => 64,
233 'size' => CRM_Utils_Type::BIG,
522a26c9 234 'table_name' => 'civicrm_uf_field',
235 'entity' => 'UFField',
236 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
237 ) ,
238 'is_active' => array(
239 'name' => 'is_active',
240 'type' => CRM_Utils_Type::T_BOOLEAN,
241 'title' => ts('Profile Field Is Active') ,
242 'description' => 'Is this field currently shareable? If false, hide the field for all sharing contexts.',
243 'default' => '1',
522a26c9 244 'table_name' => 'civicrm_uf_field',
245 'entity' => 'UFField',
246 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
247 ) ,
248 'is_view' => array(
249 'name' => 'is_view',
250 'type' => CRM_Utils_Type::T_BOOLEAN,
251 'title' => ts('Profile Is View Only') ,
252 'description' => 'the field is view only and not editable in user forms.',
522a26c9 253 'table_name' => 'civicrm_uf_field',
254 'entity' => 'UFField',
255 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
256 ) ,
257 'is_required' => array(
258 'name' => 'is_required',
259 'type' => CRM_Utils_Type::T_BOOLEAN,
260 'title' => ts('Profile Field Is Required') ,
261 'description' => 'Is this field required when included in a user or registration form?',
522a26c9 262 'table_name' => 'civicrm_uf_field',
263 'entity' => 'UFField',
264 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
265 ) ,
266 'weight' => array(
267 'name' => 'weight',
268 'type' => CRM_Utils_Type::T_INT,
269 'title' => ts('Order') ,
270 'description' => 'Controls field display order when user framework fields are displayed in registration and account editing forms.',
271 'required' => true,
272 'default' => '1',
522a26c9 273 'table_name' => 'civicrm_uf_field',
274 'entity' => 'UFField',
275 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
276 ) ,
277 'help_post' => array(
278 'name' => 'help_post',
279 'type' => CRM_Utils_Type::T_TEXT,
280 'title' => ts('Profile Field Post Help') ,
281 'description' => 'Description and/or help text to display after this field.',
522a26c9 282 'table_name' => 'civicrm_uf_field',
283 'entity' => 'UFField',
284 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
285 ) ,
286 'help_pre' => array(
287 'name' => 'help_pre',
288 'type' => CRM_Utils_Type::T_TEXT,
289 'title' => ts('Profile Field Pre Help') ,
290 'description' => 'Description and/or help text to display before this field.',
522a26c9 291 'table_name' => 'civicrm_uf_field',
292 'entity' => 'UFField',
293 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
294 ) ,
295 'visibility' => array(
296 'name' => 'visibility',
297 'type' => CRM_Utils_Type::T_STRING,
298 'title' => ts('Profile Field Visibility') ,
299 'description' => 'In what context(s) is this field visible.',
300 'maxlength' => 32,
301 'size' => CRM_Utils_Type::MEDIUM,
302 'default' => 'User and User Admin Only',
522a26c9 303 'table_name' => 'civicrm_uf_field',
304 'entity' => 'UFField',
305 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
306 'html' => array(
307 'type' => 'Select',
308 ) ,
309 'pseudoconstant' => array(
310 'callback' => 'CRM_Core_SelectValues::ufVisibility',
311 )
312 ) ,
313 'in_selector' => array(
314 'name' => 'in_selector',
315 'type' => CRM_Utils_Type::T_BOOLEAN,
316 'title' => ts('Profile Field Is a Filter') ,
317 'description' => 'Is this field included as a column in the selector table?',
522a26c9 318 'table_name' => 'civicrm_uf_field',
319 'entity' => 'UFField',
320 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
321 ) ,
322 'is_searchable' => array(
323 'name' => 'is_searchable',
324 'type' => CRM_Utils_Type::T_BOOLEAN,
325 'title' => ts('Profile Field Is Searchable') ,
326 'description' => 'Is this field included search form of profile?',
522a26c9 327 'table_name' => 'civicrm_uf_field',
328 'entity' => 'UFField',
329 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
330 ) ,
331 'location_type_id' => array(
332 'name' => 'location_type_id',
333 'type' => CRM_Utils_Type::T_INT,
334 'title' => ts('Profile Field Location Type') ,
335 'description' => 'Location type of this mapping, if required',
522a26c9 336 'table_name' => 'civicrm_uf_field',
337 'entity' => 'UFField',
338 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
339 'FKClassName' => 'CRM_Core_DAO_LocationType',
340 ) ,
341 'phone_type_id' => array(
342 'name' => 'phone_type_id',
343 'type' => CRM_Utils_Type::T_INT,
344 'title' => ts('Profile Field Phone Type') ,
345 'description' => 'Phone Type Id, if required',
522a26c9 346 'table_name' => 'civicrm_uf_field',
347 'entity' => 'UFField',
348 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
349 ) ,
350 'website_type_id' => array(
351 'name' => 'website_type_id',
352 'type' => CRM_Utils_Type::T_INT,
353 'title' => ts('Profile Field Website Type') ,
354 'description' => 'Website Type Id, if required',
522a26c9 355 'table_name' => 'civicrm_uf_field',
356 'entity' => 'UFField',
357 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
358 ) ,
359 'label' => array(
360 'name' => 'label',
361 'type' => CRM_Utils_Type::T_STRING,
362 'title' => ts('Profile Field Label') ,
363 'description' => 'To save label for fields.',
364 'required' => true,
365 'maxlength' => 255,
366 'size' => CRM_Utils_Type::HUGE,
522a26c9 367 'table_name' => 'civicrm_uf_field',
368 'entity' => 'UFField',
369 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
370 ) ,
371 'field_type' => array(
372 'name' => 'field_type',
373 'type' => CRM_Utils_Type::T_STRING,
374 'title' => ts('Profile Field Type') ,
375 'description' => 'This field saves field type (ie individual,household.. field etc).',
376 'maxlength' => 255,
377 'size' => CRM_Utils_Type::HUGE,
522a26c9 378 'table_name' => 'civicrm_uf_field',
379 'entity' => 'UFField',
380 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
381 ) ,
382 'is_reserved' => array(
383 'name' => 'is_reserved',
384 'type' => CRM_Utils_Type::T_BOOLEAN,
385 'title' => ts('Profile Field Is Reserved') ,
386 'description' => 'Is this field reserved for use by some other CiviCRM functionality?',
522a26c9 387 'table_name' => 'civicrm_uf_field',
388 'entity' => 'UFField',
389 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
390 ) ,
391 'is_multi_summary' => array(
392 'name' => 'is_multi_summary',
393 'type' => CRM_Utils_Type::T_BOOLEAN,
394 'title' => ts('Profile Field Supports Multiple') ,
395 'description' => 'Include in multi-record listing?',
522a26c9 396 'table_name' => 'civicrm_uf_field',
397 'entity' => 'UFField',
398 'bao' => 'CRM_Core_BAO_UFField',
e501603b
TO
399 ) ,
400 );
346aaaba 401 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 402 }
346aaaba 403 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
404 }
405 /**
bd8e0b14 406 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
407 *
408 * @return array
bd8e0b14 409 * Array(string $name => string $uniqueName).
e501603b
TO
410 */
411 static function &fieldKeys() {
bd8e0b14
TO
412 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
413 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 414 }
bd8e0b14 415 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
416 }
417 /**
418 * Returns the names of this table
419 *
420 * @return string
421 */
422 static function getTableName() {
423 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
424 }
425 /**
426 * Returns if this table needs to be logged
427 *
428 * @return boolean
429 */
430 function getLog() {
431 return self::$_log;
432 }
433 /**
434 * Returns the list of fields that can be imported
435 *
436 * @param bool $prefix
437 *
438 * @return array
439 */
440 static function &import($prefix = false) {
60808919
TO
441 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, array());
442 return $r;
e501603b
TO
443 }
444 /**
445 * Returns the list of fields that can be exported
446 *
447 * @param bool $prefix
448 *
449 * @return array
450 */
451 static function &export($prefix = false) {
60808919
TO
452 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, array());
453 return $r;
e501603b
TO
454 }
455}