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