Commit | Line | Data |
---|---|---|
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 | |
6a7e5e5d | 33 | * (GenCodeChecksum:55945830861723b23a20699aa3d3deef) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_UFField constructor. | |
39 | */ | |
e501603b TO |
40 | class 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', | |
6a7e5e5d | 206 | 'localizable' => 0, |
e501603b TO |
207 | ) , |
208 | 'uf_group_id' => array( | |
209 | 'name' => 'uf_group_id', | |
210 | 'type' => CRM_Utils_Type::T_INT, | |
211 | 'title' => ts('Profile ID') , | |
212 | 'description' => 'Which form does this field belong to.', | |
213 | 'required' => true, | |
522a26c9 | 214 | 'table_name' => 'civicrm_uf_field', |
215 | 'entity' => 'UFField', | |
216 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 217 | 'localizable' => 0, |
e501603b TO |
218 | 'FKClassName' => 'CRM_Core_DAO_UFGroup', |
219 | 'html' => array( | |
220 | 'type' => 'Select', | |
221 | ) , | |
222 | 'pseudoconstant' => array( | |
223 | 'table' => 'civicrm_uf_group', | |
224 | 'keyColumn' => 'id', | |
225 | 'labelColumn' => 'title', | |
226 | ) | |
227 | ) , | |
228 | 'field_name' => array( | |
229 | 'name' => 'field_name', | |
230 | 'type' => CRM_Utils_Type::T_STRING, | |
231 | 'title' => ts('Profile Field Name') , | |
232 | 'description' => 'Name for CiviCRM field which is being exposed for sharing.', | |
233 | 'required' => true, | |
234 | 'maxlength' => 64, | |
235 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 236 | 'table_name' => 'civicrm_uf_field', |
237 | 'entity' => 'UFField', | |
238 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 239 | 'localizable' => 0, |
e501603b TO |
240 | ) , |
241 | 'is_active' => array( | |
242 | 'name' => 'is_active', | |
243 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
244 | 'title' => ts('Profile Field Is Active') , | |
245 | 'description' => 'Is this field currently shareable? If false, hide the field for all sharing contexts.', | |
246 | 'default' => '1', | |
522a26c9 | 247 | 'table_name' => 'civicrm_uf_field', |
248 | 'entity' => 'UFField', | |
249 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 250 | 'localizable' => 0, |
e501603b TO |
251 | ) , |
252 | 'is_view' => array( | |
253 | 'name' => 'is_view', | |
254 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
255 | 'title' => ts('Profile Is View Only') , | |
256 | 'description' => 'the field is view only and not editable in user forms.', | |
522a26c9 | 257 | 'table_name' => 'civicrm_uf_field', |
258 | 'entity' => 'UFField', | |
259 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 260 | 'localizable' => 0, |
e501603b TO |
261 | ) , |
262 | 'is_required' => array( | |
263 | 'name' => 'is_required', | |
264 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
265 | 'title' => ts('Profile Field Is Required') , | |
266 | 'description' => 'Is this field required when included in a user or registration form?', | |
522a26c9 | 267 | 'table_name' => 'civicrm_uf_field', |
268 | 'entity' => 'UFField', | |
269 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 270 | 'localizable' => 0, |
e501603b TO |
271 | ) , |
272 | 'weight' => array( | |
273 | 'name' => 'weight', | |
274 | 'type' => CRM_Utils_Type::T_INT, | |
275 | 'title' => ts('Order') , | |
276 | 'description' => 'Controls field display order when user framework fields are displayed in registration and account editing forms.', | |
277 | 'required' => true, | |
278 | 'default' => '1', | |
522a26c9 | 279 | 'table_name' => 'civicrm_uf_field', |
280 | 'entity' => 'UFField', | |
281 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 282 | 'localizable' => 0, |
e501603b TO |
283 | ) , |
284 | 'help_post' => array( | |
285 | 'name' => 'help_post', | |
286 | 'type' => CRM_Utils_Type::T_TEXT, | |
287 | 'title' => ts('Profile Field Post Help') , | |
288 | 'description' => 'Description and/or help text to display after this field.', | |
522a26c9 | 289 | 'table_name' => 'civicrm_uf_field', |
290 | 'entity' => 'UFField', | |
291 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 292 | 'localizable' => 1, |
e501603b TO |
293 | ) , |
294 | 'help_pre' => array( | |
295 | 'name' => 'help_pre', | |
296 | 'type' => CRM_Utils_Type::T_TEXT, | |
297 | 'title' => ts('Profile Field Pre Help') , | |
298 | 'description' => 'Description and/or help text to display before this field.', | |
522a26c9 | 299 | 'table_name' => 'civicrm_uf_field', |
300 | 'entity' => 'UFField', | |
301 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 302 | 'localizable' => 1, |
e501603b TO |
303 | ) , |
304 | 'visibility' => array( | |
305 | 'name' => 'visibility', | |
306 | 'type' => CRM_Utils_Type::T_STRING, | |
307 | 'title' => ts('Profile Field Visibility') , | |
308 | 'description' => 'In what context(s) is this field visible.', | |
309 | 'maxlength' => 32, | |
310 | 'size' => CRM_Utils_Type::MEDIUM, | |
311 | 'default' => 'User and User Admin Only', | |
522a26c9 | 312 | 'table_name' => 'civicrm_uf_field', |
313 | 'entity' => 'UFField', | |
314 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 315 | 'localizable' => 0, |
e501603b TO |
316 | 'html' => array( |
317 | 'type' => 'Select', | |
318 | ) , | |
319 | 'pseudoconstant' => array( | |
320 | 'callback' => 'CRM_Core_SelectValues::ufVisibility', | |
321 | ) | |
322 | ) , | |
323 | 'in_selector' => array( | |
324 | 'name' => 'in_selector', | |
325 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
326 | 'title' => ts('Profile Field Is a Filter') , | |
327 | 'description' => 'Is this field included as a column in the selector table?', | |
522a26c9 | 328 | 'table_name' => 'civicrm_uf_field', |
329 | 'entity' => 'UFField', | |
330 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 331 | 'localizable' => 0, |
e501603b TO |
332 | ) , |
333 | 'is_searchable' => array( | |
334 | 'name' => 'is_searchable', | |
335 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
336 | 'title' => ts('Profile Field Is Searchable') , | |
337 | 'description' => 'Is this field included search form of profile?', | |
522a26c9 | 338 | 'table_name' => 'civicrm_uf_field', |
339 | 'entity' => 'UFField', | |
340 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 341 | 'localizable' => 0, |
e501603b TO |
342 | ) , |
343 | 'location_type_id' => array( | |
344 | 'name' => 'location_type_id', | |
345 | 'type' => CRM_Utils_Type::T_INT, | |
346 | 'title' => ts('Profile Field Location Type') , | |
347 | 'description' => 'Location type of this mapping, if required', | |
522a26c9 | 348 | 'table_name' => 'civicrm_uf_field', |
349 | 'entity' => 'UFField', | |
350 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 351 | 'localizable' => 0, |
e501603b TO |
352 | 'FKClassName' => 'CRM_Core_DAO_LocationType', |
353 | ) , | |
354 | 'phone_type_id' => array( | |
355 | 'name' => 'phone_type_id', | |
356 | 'type' => CRM_Utils_Type::T_INT, | |
357 | 'title' => ts('Profile Field Phone Type') , | |
358 | 'description' => 'Phone Type Id, if required', | |
522a26c9 | 359 | 'table_name' => 'civicrm_uf_field', |
360 | 'entity' => 'UFField', | |
361 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 362 | 'localizable' => 0, |
e501603b TO |
363 | ) , |
364 | 'website_type_id' => array( | |
365 | 'name' => 'website_type_id', | |
366 | 'type' => CRM_Utils_Type::T_INT, | |
367 | 'title' => ts('Profile Field Website Type') , | |
368 | 'description' => 'Website Type Id, if required', | |
522a26c9 | 369 | 'table_name' => 'civicrm_uf_field', |
370 | 'entity' => 'UFField', | |
371 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 372 | 'localizable' => 0, |
e501603b TO |
373 | ) , |
374 | 'label' => array( | |
375 | 'name' => 'label', | |
376 | 'type' => CRM_Utils_Type::T_STRING, | |
377 | 'title' => ts('Profile Field Label') , | |
378 | 'description' => 'To save label for fields.', | |
379 | 'required' => true, | |
380 | 'maxlength' => 255, | |
381 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 382 | 'table_name' => 'civicrm_uf_field', |
383 | 'entity' => 'UFField', | |
384 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 385 | 'localizable' => 1, |
e501603b TO |
386 | ) , |
387 | 'field_type' => array( | |
388 | 'name' => 'field_type', | |
389 | 'type' => CRM_Utils_Type::T_STRING, | |
390 | 'title' => ts('Profile Field Type') , | |
391 | 'description' => 'This field saves field type (ie individual,household.. field etc).', | |
392 | 'maxlength' => 255, | |
393 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 394 | 'table_name' => 'civicrm_uf_field', |
395 | 'entity' => 'UFField', | |
396 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 397 | 'localizable' => 0, |
e501603b TO |
398 | ) , |
399 | 'is_reserved' => array( | |
400 | 'name' => 'is_reserved', | |
401 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
402 | 'title' => ts('Profile Field Is Reserved') , | |
403 | 'description' => 'Is this field reserved for use by some other CiviCRM functionality?', | |
522a26c9 | 404 | 'table_name' => 'civicrm_uf_field', |
405 | 'entity' => 'UFField', | |
406 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 407 | 'localizable' => 0, |
e501603b TO |
408 | ) , |
409 | 'is_multi_summary' => array( | |
410 | 'name' => 'is_multi_summary', | |
411 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
412 | 'title' => ts('Profile Field Supports Multiple') , | |
413 | 'description' => 'Include in multi-record listing?', | |
522a26c9 | 414 | 'table_name' => 'civicrm_uf_field', |
415 | 'entity' => 'UFField', | |
416 | 'bao' => 'CRM_Core_BAO_UFField', | |
6a7e5e5d | 417 | 'localizable' => 0, |
e501603b TO |
418 | ) , |
419 | ); | |
346aaaba | 420 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 421 | } |
346aaaba | 422 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
423 | } |
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 TO |
429 | */ |
430 | 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 TO |
435 | } |
436 | /** | |
437 | * Returns the names of this table | |
438 | * | |
439 | * @return string | |
440 | */ | |
441 | static function getTableName() { | |
442 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
443 | } | |
444 | /** | |
445 | * Returns if this table needs to be logged | |
446 | * | |
447 | * @return boolean | |
448 | */ | |
449 | function getLog() { | |
450 | return self::$_log; | |
451 | } | |
452 | /** | |
453 | * Returns the list of fields that can be imported | |
454 | * | |
455 | * @param bool $prefix | |
456 | * | |
457 | * @return array | |
458 | */ | |
459 | static function &import($prefix = false) { | |
60808919 TO |
460 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, array()); |
461 | return $r; | |
e501603b TO |
462 | } |
463 | /** | |
464 | * Returns the list of fields that can be exported | |
465 | * | |
466 | * @param bool $prefix | |
467 | * | |
468 | * @return array | |
469 | */ | |
470 | static function &export($prefix = false) { | |
60808919 TO |
471 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, array()); |
472 | return $r; | |
e501603b TO |
473 | } |
474 | } |