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:6c4ced0a0ac204cde5c048d37aee6057)
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',
273 'custom_group_id' => array(
274 'name' => 'custom_group_id',
275 'type' => CRM_Utils_Type
::T_INT
,
276 'title' => ts('Custom Group') ,
277 'description' => 'FK to civicrm_custom_group.',
279 'table_name' => 'civicrm_custom_field',
280 'entity' => 'CustomField',
281 'bao' => 'CRM_Core_BAO_CustomField',
283 'FKClassName' => 'CRM_Core_DAO_CustomGroup',
287 'pseudoconstant' => array(
288 'table' => 'civicrm_custom_group',
290 'labelColumn' => 'title',
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('Custom Field Name') ,
297 'description' => 'Variable name/programmatic handle for this group.',
299 'size' => CRM_Utils_Type
::BIG
,
300 'table_name' => 'civicrm_custom_field',
301 'entity' => 'CustomField',
302 'bao' => 'CRM_Core_BAO_CustomField',
307 'type' => CRM_Utils_Type
::T_STRING
,
308 'title' => ts('Custom Field Label') ,
309 'description' => 'Text for form field label (also friendly name for administering this custom property).',
312 'size' => CRM_Utils_Type
::HUGE
,
313 'table_name' => 'civicrm_custom_field',
314 'entity' => 'CustomField',
315 'bao' => 'CRM_Core_BAO_CustomField',
318 'data_type' => array(
319 'name' => 'data_type',
320 'type' => CRM_Utils_Type
::T_STRING
,
321 'title' => ts('Custom Field Data Type') ,
322 'description' => 'Controls location of data storage in extended_data table.',
325 'size' => CRM_Utils_Type
::TWELVE
,
326 'table_name' => 'civicrm_custom_field',
327 'entity' => 'CustomField',
328 'bao' => 'CRM_Core_BAO_CustomField',
333 'pseudoconstant' => array(
334 'callback' => 'CRM_Core_BAO_CustomField::dataType',
337 'html_type' => array(
338 'name' => 'html_type',
339 'type' => CRM_Utils_Type
::T_STRING
,
340 'title' => ts('Custom Field HTML Type') ,
341 'description' => 'HTML types plus several built-in extended types.',
344 'size' => CRM_Utils_Type
::MEDIUM
,
345 'table_name' => 'civicrm_custom_field',
346 'entity' => 'CustomField',
347 'bao' => 'CRM_Core_BAO_CustomField',
349 'pseudoconstant' => array(
350 'callback' => 'CRM_Core_SelectValues::customHtmlType',
353 'default_value' => array(
354 'name' => 'default_value',
355 'type' => CRM_Utils_Type
::T_STRING
,
356 'title' => ts('Custom Field Default') ,
357 'description' => 'Use form_options.is_default for field_types which use options.',
359 'size' => CRM_Utils_Type
::HUGE
,
360 'table_name' => 'civicrm_custom_field',
361 'entity' => 'CustomField',
362 'bao' => 'CRM_Core_BAO_CustomField',
365 'is_required' => array(
366 'name' => 'is_required',
367 'type' => CRM_Utils_Type
::T_BOOLEAN
,
368 'title' => ts('Custom Field Is Required?') ,
369 'description' => 'Is a value required for this property.',
370 'table_name' => 'civicrm_custom_field',
371 'entity' => 'CustomField',
372 'bao' => 'CRM_Core_BAO_CustomField',
375 'is_searchable' => array(
376 'name' => 'is_searchable',
377 'type' => CRM_Utils_Type
::T_BOOLEAN
,
378 'title' => ts('Allow Searching on Field?') ,
379 'description' => 'Is this property searchable.',
380 'table_name' => 'civicrm_custom_field',
381 'entity' => 'CustomField',
382 'bao' => 'CRM_Core_BAO_CustomField',
385 'is_search_range' => array(
386 'name' => 'is_search_range',
387 'type' => CRM_Utils_Type
::T_BOOLEAN
,
388 'title' => ts('Search as a Range') ,
389 'description' => 'Is this property range searchable.',
390 'table_name' => 'civicrm_custom_field',
391 'entity' => 'CustomField',
392 'bao' => 'CRM_Core_BAO_CustomField',
397 'type' => CRM_Utils_Type
::T_INT
,
398 'title' => ts('Order') ,
399 'description' => 'Controls field display order within an extended property group.',
402 'table_name' => 'civicrm_custom_field',
403 'entity' => 'CustomField',
404 'bao' => 'CRM_Core_BAO_CustomField',
408 'name' => 'help_pre',
409 'type' => CRM_Utils_Type
::T_TEXT
,
410 'title' => ts('Custom Field Pre Text') ,
411 'description' => 'Description and/or help text to display before this field.',
412 'table_name' => 'civicrm_custom_field',
413 'entity' => 'CustomField',
414 'bao' => 'CRM_Core_BAO_CustomField',
417 'help_post' => array(
418 'name' => 'help_post',
419 'type' => CRM_Utils_Type
::T_TEXT
,
420 'title' => ts('Custom Field Post Text') ,
421 'description' => 'Description and/or help text to display after this field.',
422 'table_name' => 'civicrm_custom_field',
423 'entity' => 'CustomField',
424 'bao' => 'CRM_Core_BAO_CustomField',
429 'type' => CRM_Utils_Type
::T_STRING
,
430 'title' => ts('Custom Field Formatting') ,
431 'description' => 'Optional format instructions for specific field types, like date types.',
433 'size' => CRM_Utils_Type
::BIG
,
434 'table_name' => 'civicrm_custom_field',
435 'entity' => 'CustomField',
436 'bao' => 'CRM_Core_BAO_CustomField',
439 'attributes' => array(
440 'name' => 'attributes',
441 'type' => CRM_Utils_Type
::T_STRING
,
442 'title' => ts('Custom Field Attributes') ,
443 'description' => 'Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes',
445 'size' => CRM_Utils_Type
::HUGE
,
446 'table_name' => 'civicrm_custom_field',
447 'entity' => 'CustomField',
448 'bao' => 'CRM_Core_BAO_CustomField',
451 'javascript' => array(
452 'name' => 'javascript',
453 'type' => CRM_Utils_Type
::T_STRING
,
454 'title' => ts('Custom Field Javascript') ,
455 'description' => 'Optional scripting attributes for field.',
457 'size' => CRM_Utils_Type
::HUGE
,
458 'table_name' => 'civicrm_custom_field',
459 'entity' => 'CustomField',
460 'bao' => 'CRM_Core_BAO_CustomField',
463 'is_active' => array(
464 'name' => 'is_active',
465 'type' => CRM_Utils_Type
::T_BOOLEAN
,
466 'title' => ts('Custom Field Is Active?') ,
467 'description' => 'Is this property active?',
468 'table_name' => 'civicrm_custom_field',
469 'entity' => 'CustomField',
470 'bao' => 'CRM_Core_BAO_CustomField',
475 'type' => CRM_Utils_Type
::T_BOOLEAN
,
476 'title' => ts('Field is Viewable') ,
477 'description' => 'Is this property set by PHP Code? A code field is viewable but not editable',
478 'table_name' => 'civicrm_custom_field',
479 'entity' => 'CustomField',
480 'bao' => 'CRM_Core_BAO_CustomField',
483 'options_per_line' => array(
484 'name' => 'options_per_line',
485 'type' => CRM_Utils_Type
::T_INT
,
486 'title' => ts('Field Options Per Line') ,
487 'description' => 'number of options per line for checkbox and radio',
488 'table_name' => 'civicrm_custom_field',
489 'entity' => 'CustomField',
490 'bao' => 'CRM_Core_BAO_CustomField',
493 'text_length' => array(
494 'name' => 'text_length',
495 'type' => CRM_Utils_Type
::T_INT
,
496 'title' => ts('Field Length') ,
497 'description' => 'field length if alphanumeric',
498 'table_name' => 'civicrm_custom_field',
499 'entity' => 'CustomField',
500 'bao' => 'CRM_Core_BAO_CustomField',
503 'start_date_years' => array(
504 'name' => 'start_date_years',
505 'type' => CRM_Utils_Type
::T_INT
,
506 'title' => ts('Field Start Date') ,
507 'description' => 'Date may be up to start_date_years years prior to the current date.',
508 'table_name' => 'civicrm_custom_field',
509 'entity' => 'CustomField',
510 'bao' => 'CRM_Core_BAO_CustomField',
513 'end_date_years' => array(
514 'name' => 'end_date_years',
515 'type' => CRM_Utils_Type
::T_INT
,
516 'title' => ts('Field End Date') ,
517 'description' => 'Date may be up to end_date_years years after the current date.',
518 'table_name' => 'civicrm_custom_field',
519 'entity' => 'CustomField',
520 'bao' => 'CRM_Core_BAO_CustomField',
523 'date_format' => array(
524 'name' => 'date_format',
525 'type' => CRM_Utils_Type
::T_STRING
,
526 'title' => ts('Field Data Format') ,
527 'description' => 'date format for custom date',
529 'size' => CRM_Utils_Type
::BIG
,
530 'table_name' => 'civicrm_custom_field',
531 'entity' => 'CustomField',
532 'bao' => 'CRM_Core_BAO_CustomField',
535 'time_format' => array(
536 'name' => 'time_format',
537 'type' => CRM_Utils_Type
::T_INT
,
538 'title' => ts('Field Time Format') ,
539 'description' => 'time format for custom date',
540 'table_name' => 'civicrm_custom_field',
541 'entity' => 'CustomField',
542 'bao' => 'CRM_Core_BAO_CustomField',
545 'note_columns' => array(
546 'name' => 'note_columns',
547 'type' => CRM_Utils_Type
::T_INT
,
548 'title' => ts('Field Note Columns') ,
549 'description' => ' Number of columns in Note Field ',
550 'table_name' => 'civicrm_custom_field',
551 'entity' => 'CustomField',
552 'bao' => 'CRM_Core_BAO_CustomField',
555 'note_rows' => array(
556 'name' => 'note_rows',
557 'type' => CRM_Utils_Type
::T_INT
,
558 'title' => ts('Field Note Rows') ,
559 'description' => ' Number of rows in Note Field ',
560 'table_name' => 'civicrm_custom_field',
561 'entity' => 'CustomField',
562 'bao' => 'CRM_Core_BAO_CustomField',
565 'column_name' => array(
566 'name' => 'column_name',
567 'type' => CRM_Utils_Type
::T_STRING
,
568 'title' => ts('Field Column Name') ,
569 'description' => 'Name of the column that holds the values for this field.',
571 'size' => CRM_Utils_Type
::HUGE
,
572 'table_name' => 'civicrm_custom_field',
573 'entity' => 'CustomField',
574 'bao' => 'CRM_Core_BAO_CustomField',
577 'option_group_id' => array(
578 'name' => 'option_group_id',
579 'type' => CRM_Utils_Type
::T_INT
,
580 'title' => ts('Field Option Group') ,
581 'description' => 'For elements with options, the option group id that is used',
582 'table_name' => 'civicrm_custom_field',
583 'entity' => 'CustomField',
584 'bao' => 'CRM_Core_BAO_CustomField',
589 'type' => CRM_Utils_Type
::T_STRING
,
590 'title' => ts('Field Filter') ,
591 'description' => 'Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.',
593 'size' => CRM_Utils_Type
::HUGE
,
594 'table_name' => 'civicrm_custom_field',
595 'entity' => 'CustomField',
596 'bao' => 'CRM_Core_BAO_CustomField',
599 'in_selector' => array(
600 'name' => 'in_selector',
601 'type' => CRM_Utils_Type
::T_BOOLEAN
,
602 'title' => ts('Field Display') ,
603 'description' => 'Should the multi-record custom field values be displayed in tab table listing',
604 'table_name' => 'civicrm_custom_field',
605 'entity' => 'CustomField',
606 'bao' => 'CRM_Core_BAO_CustomField',
610 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
612 return Civi
::$statics[__CLASS__
]['fields'];
615 * Return a mapping from field-name to the corresponding key (as used in fields()).
618 * Array(string $name => string $uniqueName).
620 static function &fieldKeys() {
621 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
622 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
624 return Civi
::$statics[__CLASS__
]['fieldKeys'];
627 * Returns the names of this table
631 static function getTableName() {
632 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
635 * Returns if this table needs to be logged
643 * Returns the list of fields that can be imported
645 * @param bool $prefix
649 static function &import($prefix = false) {
650 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'custom_field', $prefix, array());
654 * Returns the list of fields that can be exported
656 * @param bool $prefix
660 static function &export($prefix = false) {
661 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'custom_field', $prefix, array());
665 * Returns the list of indices
667 public static function indices($localize = TRUE) {
669 'UI_label_custom_group_id' => array(
670 'name' => 'UI_label_custom_group_id',
673 1 => 'custom_group_id',
675 'localizable' => true,
677 'sig' => 'civicrm_custom_field::1::label::custom_group_id',
679 'UI_name_custom_group_id' => array(
680 'name' => 'UI_name_custom_group_id',
683 1 => 'custom_group_id',
685 'localizable' => false,
687 'sig' => 'civicrm_custom_field::1::name::custom_group_id',
690 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;