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