3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Core/CustomField.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:9a71ccf425ce3ba8f5ad59f4fdb8ebf8)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Core_DAO_CustomField constructor.
40 class CRM_Core_DAO_CustomField
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_custom_field';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
54 * Unique Custom Field ID
60 * FK to civicrm_custom_group.
64 public $custom_group_id;
66 * Variable name/programmatic handle for this group.
72 * Text for form field label (also friendly name for administering this custom property).
78 * Controls location of data storage in extended_data table.
84 * HTML types plus several built-in extended types.
90 * Use form_options.is_default for field_types which use options.
94 public $default_value;
96 * Is a value required for this property.
102 * Is this property searchable.
106 public $is_searchable;
108 * Is this property range searchable.
112 public $is_search_range;
114 * Controls field display order within an extended property group.
120 * Description and/or help text to display before this field.
126 * Description and/or help text to display after this field.
132 * Optional format instructions for specific field types, like date types.
138 * Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes
144 * Optional scripting attributes for field.
150 * Is this property active?
156 * Is this property set by PHP Code? A code field is viewable but not editable
162 * number of options per line for checkbox and radio
166 public $options_per_line;
168 * field length if alphanumeric
174 * Date may be up to start_date_years years prior to the current date.
178 public $start_date_years;
180 * Date may be up to end_date_years years after the current date.
184 public $end_date_years;
186 * date format for custom date
192 * time format for custom date
198 * Number of columns in Note Field
202 public $note_columns;
204 * Number of rows in Note Field
210 * Name of the column that holds the values for this field.
216 * For elements with options, the option group id that is used
220 public $option_group_id;
222 * Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.
228 * Should the multi-record custom field values be displayed in tab table listing
236 function __construct() {
237 $this->__table
= 'civicrm_custom_field';
238 parent
::__construct();
241 * Returns foreign keys and entity references.
244 * [CRM_Core_Reference_Interface]
246 static function getReferenceColumns() {
247 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
248 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
249 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'custom_group_id', 'civicrm_custom_group', 'id');
250 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
252 return Civi
::$statics[__CLASS__
]['links'];
255 * Returns all the column names of this table
259 static function &fields() {
260 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
261 Civi
::$statics[__CLASS__
]['fields'] = array(
264 'type' => CRM_Utils_Type
::T_INT
,
265 'title' => ts('Custom Field ID') ,
266 'description' => 'Unique Custom Field ID',
268 'table_name' => 'civicrm_custom_field',
269 'entity' => 'CustomField',
270 'bao' => 'CRM_Core_BAO_CustomField',
272 'custom_group_id' => array(
273 'name' => 'custom_group_id',
274 'type' => CRM_Utils_Type
::T_INT
,
275 'title' => ts('Custom Group') ,
276 'description' => 'FK to civicrm_custom_group.',
278 'table_name' => 'civicrm_custom_field',
279 'entity' => 'CustomField',
280 'bao' => 'CRM_Core_BAO_CustomField',
281 'FKClassName' => 'CRM_Core_DAO_CustomGroup',
285 'pseudoconstant' => array(
286 'table' => 'civicrm_custom_group',
288 'labelColumn' => 'title',
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('Custom Field Name') ,
295 'description' => 'Variable name/programmatic handle for this group.',
297 'size' => CRM_Utils_Type
::BIG
,
298 'table_name' => 'civicrm_custom_field',
299 'entity' => 'CustomField',
300 'bao' => 'CRM_Core_BAO_CustomField',
304 'type' => CRM_Utils_Type
::T_STRING
,
305 'title' => ts('Custom Field Label') ,
306 'description' => 'Text for form field label (also friendly name for administering this custom property).',
309 'size' => CRM_Utils_Type
::HUGE
,
310 'table_name' => 'civicrm_custom_field',
311 'entity' => 'CustomField',
312 'bao' => 'CRM_Core_BAO_CustomField',
314 'data_type' => array(
315 'name' => 'data_type',
316 'type' => CRM_Utils_Type
::T_STRING
,
317 'title' => ts('Custom Field Data Type') ,
318 'description' => 'Controls location of data storage in extended_data table.',
321 'size' => CRM_Utils_Type
::TWELVE
,
322 'table_name' => 'civicrm_custom_field',
323 'entity' => 'CustomField',
324 'bao' => 'CRM_Core_BAO_CustomField',
328 'pseudoconstant' => array(
329 'callback' => 'CRM_Core_BAO_CustomField::dataType',
332 'html_type' => array(
333 'name' => 'html_type',
334 'type' => CRM_Utils_Type
::T_STRING
,
335 'title' => ts('Custom Field HTML Type') ,
336 'description' => 'HTML types plus several built-in extended types.',
339 'size' => CRM_Utils_Type
::MEDIUM
,
340 'table_name' => 'civicrm_custom_field',
341 'entity' => 'CustomField',
342 'bao' => 'CRM_Core_BAO_CustomField',
343 'pseudoconstant' => array(
344 'callback' => 'CRM_Core_SelectValues::customHtmlType',
347 'default_value' => array(
348 'name' => 'default_value',
349 'type' => CRM_Utils_Type
::T_STRING
,
350 'title' => ts('Custom Field Default') ,
351 'description' => 'Use form_options.is_default for field_types which use options.',
353 'size' => CRM_Utils_Type
::HUGE
,
354 'table_name' => 'civicrm_custom_field',
355 'entity' => 'CustomField',
356 'bao' => 'CRM_Core_BAO_CustomField',
358 'is_required' => array(
359 'name' => 'is_required',
360 'type' => CRM_Utils_Type
::T_BOOLEAN
,
361 'title' => ts('Custom Field Is Required?') ,
362 'description' => 'Is a value required for this property.',
363 'table_name' => 'civicrm_custom_field',
364 'entity' => 'CustomField',
365 'bao' => 'CRM_Core_BAO_CustomField',
367 'is_searchable' => array(
368 'name' => 'is_searchable',
369 'type' => CRM_Utils_Type
::T_BOOLEAN
,
370 'title' => ts('Allow Searching on Field?') ,
371 'description' => 'Is this property searchable.',
372 'table_name' => 'civicrm_custom_field',
373 'entity' => 'CustomField',
374 'bao' => 'CRM_Core_BAO_CustomField',
376 'is_search_range' => array(
377 'name' => 'is_search_range',
378 'type' => CRM_Utils_Type
::T_BOOLEAN
,
379 'title' => ts('Search as a Range') ,
380 'description' => 'Is this property range searchable.',
381 'table_name' => 'civicrm_custom_field',
382 'entity' => 'CustomField',
383 'bao' => 'CRM_Core_BAO_CustomField',
387 'type' => CRM_Utils_Type
::T_INT
,
388 'title' => ts('Order') ,
389 'description' => 'Controls field display order within an extended property group.',
392 'table_name' => 'civicrm_custom_field',
393 'entity' => 'CustomField',
394 'bao' => 'CRM_Core_BAO_CustomField',
397 'name' => 'help_pre',
398 'type' => CRM_Utils_Type
::T_TEXT
,
399 'title' => ts('Custom Field Pre Text') ,
400 'description' => 'Description and/or help text to display before this field.',
401 'table_name' => 'civicrm_custom_field',
402 'entity' => 'CustomField',
403 'bao' => 'CRM_Core_BAO_CustomField',
405 'help_post' => array(
406 'name' => 'help_post',
407 'type' => CRM_Utils_Type
::T_TEXT
,
408 'title' => ts('Custom Field Post Text') ,
409 'description' => 'Description and/or help text to display after this field.',
410 'table_name' => 'civicrm_custom_field',
411 'entity' => 'CustomField',
412 'bao' => 'CRM_Core_BAO_CustomField',
416 'type' => CRM_Utils_Type
::T_STRING
,
417 'title' => ts('Custom Field Formatting') ,
418 'description' => 'Optional format instructions for specific field types, like date types.',
420 'size' => CRM_Utils_Type
::BIG
,
421 'table_name' => 'civicrm_custom_field',
422 'entity' => 'CustomField',
423 'bao' => 'CRM_Core_BAO_CustomField',
425 'attributes' => array(
426 'name' => 'attributes',
427 'type' => CRM_Utils_Type
::T_STRING
,
428 'title' => ts('Custom Field Attributes') ,
429 'description' => 'Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes',
431 'size' => CRM_Utils_Type
::HUGE
,
432 'table_name' => 'civicrm_custom_field',
433 'entity' => 'CustomField',
434 'bao' => 'CRM_Core_BAO_CustomField',
436 'javascript' => array(
437 'name' => 'javascript',
438 'type' => CRM_Utils_Type
::T_STRING
,
439 'title' => ts('Custom Field Javascript') ,
440 'description' => 'Optional scripting attributes for field.',
442 'size' => CRM_Utils_Type
::HUGE
,
443 'table_name' => 'civicrm_custom_field',
444 'entity' => 'CustomField',
445 'bao' => 'CRM_Core_BAO_CustomField',
447 'is_active' => array(
448 'name' => 'is_active',
449 'type' => CRM_Utils_Type
::T_BOOLEAN
,
450 'title' => ts('Custom Field Is Active?') ,
451 'description' => 'Is this property active?',
452 'table_name' => 'civicrm_custom_field',
453 'entity' => 'CustomField',
454 'bao' => 'CRM_Core_BAO_CustomField',
458 'type' => CRM_Utils_Type
::T_BOOLEAN
,
459 'title' => ts('Field is Viewable') ,
460 'description' => 'Is this property set by PHP Code? A code field is viewable but not editable',
461 'table_name' => 'civicrm_custom_field',
462 'entity' => 'CustomField',
463 'bao' => 'CRM_Core_BAO_CustomField',
465 'options_per_line' => array(
466 'name' => 'options_per_line',
467 'type' => CRM_Utils_Type
::T_INT
,
468 'title' => ts('Field Options Per Line') ,
469 'description' => 'number of options per line for checkbox and radio',
470 'table_name' => 'civicrm_custom_field',
471 'entity' => 'CustomField',
472 'bao' => 'CRM_Core_BAO_CustomField',
474 'text_length' => array(
475 'name' => 'text_length',
476 'type' => CRM_Utils_Type
::T_INT
,
477 'title' => ts('Field Length') ,
478 'description' => 'field length if alphanumeric',
479 'table_name' => 'civicrm_custom_field',
480 'entity' => 'CustomField',
481 'bao' => 'CRM_Core_BAO_CustomField',
483 'start_date_years' => array(
484 'name' => 'start_date_years',
485 'type' => CRM_Utils_Type
::T_INT
,
486 'title' => ts('Field Start Date') ,
487 'description' => 'Date may be up to start_date_years years prior to the current date.',
488 'table_name' => 'civicrm_custom_field',
489 'entity' => 'CustomField',
490 'bao' => 'CRM_Core_BAO_CustomField',
492 'end_date_years' => array(
493 'name' => 'end_date_years',
494 'type' => CRM_Utils_Type
::T_INT
,
495 'title' => ts('Field End Date') ,
496 'description' => 'Date may be up to end_date_years years after the current date.',
497 'table_name' => 'civicrm_custom_field',
498 'entity' => 'CustomField',
499 'bao' => 'CRM_Core_BAO_CustomField',
501 'date_format' => array(
502 'name' => 'date_format',
503 'type' => CRM_Utils_Type
::T_STRING
,
504 'title' => ts('Field Data Format') ,
505 'description' => 'date format for custom date',
507 'size' => CRM_Utils_Type
::BIG
,
508 'table_name' => 'civicrm_custom_field',
509 'entity' => 'CustomField',
510 'bao' => 'CRM_Core_BAO_CustomField',
512 'time_format' => array(
513 'name' => 'time_format',
514 'type' => CRM_Utils_Type
::T_INT
,
515 'title' => ts('Field Time Format') ,
516 'description' => 'time format for custom date',
517 'table_name' => 'civicrm_custom_field',
518 'entity' => 'CustomField',
519 'bao' => 'CRM_Core_BAO_CustomField',
521 'note_columns' => array(
522 'name' => 'note_columns',
523 'type' => CRM_Utils_Type
::T_INT
,
524 'title' => ts('Field Note Columns') ,
525 'description' => ' Number of columns in Note Field ',
526 'table_name' => 'civicrm_custom_field',
527 'entity' => 'CustomField',
528 'bao' => 'CRM_Core_BAO_CustomField',
530 'note_rows' => array(
531 'name' => 'note_rows',
532 'type' => CRM_Utils_Type
::T_INT
,
533 'title' => ts('Field Note Rows') ,
534 'description' => ' Number of rows in Note Field ',
535 'table_name' => 'civicrm_custom_field',
536 'entity' => 'CustomField',
537 'bao' => 'CRM_Core_BAO_CustomField',
539 'column_name' => array(
540 'name' => 'column_name',
541 'type' => CRM_Utils_Type
::T_STRING
,
542 'title' => ts('Field Column Name') ,
543 'description' => 'Name of the column that holds the values for this field.',
545 'size' => CRM_Utils_Type
::HUGE
,
546 'table_name' => 'civicrm_custom_field',
547 'entity' => 'CustomField',
548 'bao' => 'CRM_Core_BAO_CustomField',
550 'option_group_id' => array(
551 'name' => 'option_group_id',
552 'type' => CRM_Utils_Type
::T_INT
,
553 'title' => ts('Field Option Group') ,
554 'description' => 'For elements with options, the option group id that is used',
555 'table_name' => 'civicrm_custom_field',
556 'entity' => 'CustomField',
557 'bao' => 'CRM_Core_BAO_CustomField',
561 'type' => CRM_Utils_Type
::T_STRING
,
562 'title' => ts('Field Filter') ,
563 'description' => 'Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.',
565 'size' => CRM_Utils_Type
::HUGE
,
566 'table_name' => 'civicrm_custom_field',
567 'entity' => 'CustomField',
568 'bao' => 'CRM_Core_BAO_CustomField',
570 'in_selector' => array(
571 'name' => 'in_selector',
572 'type' => CRM_Utils_Type
::T_BOOLEAN
,
573 'title' => ts('Field Display') ,
574 'description' => 'Should the multi-record custom field values be displayed in tab table listing',
575 'table_name' => 'civicrm_custom_field',
576 'entity' => 'CustomField',
577 'bao' => 'CRM_Core_BAO_CustomField',
580 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
582 return Civi
::$statics[__CLASS__
]['fields'];
585 * Return a mapping from field-name to the corresponding key (as used in fields()).
588 * Array(string $name => string $uniqueName).
590 static function &fieldKeys() {
591 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
592 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
594 return Civi
::$statics[__CLASS__
]['fieldKeys'];
597 * Returns the names of this table
601 static function getTableName() {
602 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
605 * Returns if this table needs to be logged
613 * Returns the list of fields that can be imported
615 * @param bool $prefix
619 static function &import($prefix = false) {
620 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'custom_field', $prefix, array());
624 * Returns the list of fields that can be exported
626 * @param bool $prefix
630 static function &export($prefix = false) {
631 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'custom_field', $prefix, array());