3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
31 * Generated from xml/schema/CRM/Core/CustomField.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:dc13acb1a31d4ed4837ebb0a167da9e9)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_CustomField
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_custom_field';
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
52 * Unique Custom Field ID
58 * FK to civicrm_custom_group.
62 public $custom_group_id;
64 * Variable name/programmatic handle for this group.
70 * Text for form field label (also friendly name for administering this custom property).
76 * Controls location of data storage in extended_data table.
82 * HTML types plus several built-in extended types.
88 * Use form_options.is_default for field_types which use options.
92 public $default_value;
94 * Is a value required for this property.
100 * Is this property searchable.
104 public $is_searchable;
106 * Is this property range searchable.
110 public $is_search_range;
112 * Controls field display order within an extended property group.
118 * Description and/or help text to display before this field.
124 * Description and/or help text to display after this field.
130 * Optional format instructions for specific field types, like date types.
136 * Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes
142 * Optional scripting attributes for field.
148 * Is this property active?
154 * Is this property set by PHP Code? A code field is viewable but not editable
160 * number of options per line for checkbox and radio
164 public $options_per_line;
166 * field length if alphanumeric
172 * Date may be up to start_date_years years prior to the current date.
176 public $start_date_years;
178 * Date may be up to end_date_years years after the current date.
182 public $end_date_years;
184 * date format for custom date
190 * time format for custom date
196 * Number of columns in Note Field
200 public $note_columns;
202 * Number of rows in Note Field
208 * Name of the column that holds the values for this field.
214 * For elements with options, the option group id that is used
218 public $option_group_id;
220 * Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.
226 * Should the multi-record custom field values be displayed in tab table listing
234 * @return civicrm_custom_field
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',
269 'custom_group_id' => array(
270 'name' => 'custom_group_id',
271 'type' => CRM_Utils_Type
::T_INT
,
272 'title' => ts('Custom Group') ,
273 'description' => 'FK to civicrm_custom_group.',
275 'FKClassName' => 'CRM_Core_DAO_CustomGroup',
279 'pseudoconstant' => array(
280 'table' => 'civicrm_custom_group',
282 'labelColumn' => 'title',
287 'type' => CRM_Utils_Type
::T_STRING
,
288 'title' => ts('Custom Field Name') ,
289 'description' => 'Variable name/programmatic handle for this group.',
291 'size' => CRM_Utils_Type
::BIG
,
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('Custom Field Label') ,
297 'description' => 'Text for form field label (also friendly name for administering this custom property).',
300 'size' => CRM_Utils_Type
::HUGE
,
302 'data_type' => array(
303 'name' => 'data_type',
304 'type' => CRM_Utils_Type
::T_STRING
,
305 'title' => ts('Custom Field Data Type') ,
306 'description' => 'Controls location of data storage in extended_data table.',
309 'size' => CRM_Utils_Type
::TWELVE
,
313 'pseudoconstant' => array(
314 'callback' => 'CRM_Core_BAO_CustomField::dataType',
317 'html_type' => array(
318 'name' => 'html_type',
319 'type' => CRM_Utils_Type
::T_STRING
,
320 'title' => ts('Custom Field HTML Type') ,
321 'description' => 'HTML types plus several built-in extended types.',
324 'size' => CRM_Utils_Type
::MEDIUM
,
325 'pseudoconstant' => array(
326 'callback' => 'CRM_Core_SelectValues::customHtmlType',
329 'default_value' => array(
330 'name' => 'default_value',
331 'type' => CRM_Utils_Type
::T_STRING
,
332 'title' => ts('Custom Field Default') ,
333 'description' => 'Use form_options.is_default for field_types which use options.',
335 'size' => CRM_Utils_Type
::HUGE
,
337 'is_required' => array(
338 'name' => 'is_required',
339 'type' => CRM_Utils_Type
::T_BOOLEAN
,
340 'title' => ts('Custom Field Is Required?') ,
341 'description' => 'Is a value required for this property.',
343 'is_searchable' => array(
344 'name' => 'is_searchable',
345 'type' => CRM_Utils_Type
::T_BOOLEAN
,
346 'title' => ts('Allow Searching on Field?') ,
347 'description' => 'Is this property searchable.',
349 'is_search_range' => array(
350 'name' => 'is_search_range',
351 'type' => CRM_Utils_Type
::T_BOOLEAN
,
352 'title' => ts('Search as a Range') ,
353 'description' => 'Is this property range searchable.',
357 'type' => CRM_Utils_Type
::T_INT
,
358 'title' => ts('Order') ,
359 'description' => 'Controls field display order within an extended property group.',
364 'name' => 'help_pre',
365 'type' => CRM_Utils_Type
::T_TEXT
,
366 'title' => ts('Custom Field Pre Text') ,
367 'description' => 'Description and/or help text to display before this field.',
369 'help_post' => array(
370 'name' => 'help_post',
371 'type' => CRM_Utils_Type
::T_TEXT
,
372 'title' => ts('Custom Field Post Text') ,
373 'description' => 'Description and/or help text to display after this field.',
377 'type' => CRM_Utils_Type
::T_STRING
,
378 'title' => ts('Custom Field Formatting') ,
379 'description' => 'Optional format instructions for specific field types, like date types.',
381 'size' => CRM_Utils_Type
::BIG
,
383 'attributes' => array(
384 'name' => 'attributes',
385 'type' => CRM_Utils_Type
::T_STRING
,
386 'title' => ts('Custom Field Attributes') ,
387 'description' => 'Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes',
389 'size' => CRM_Utils_Type
::HUGE
,
391 'javascript' => array(
392 'name' => 'javascript',
393 'type' => CRM_Utils_Type
::T_STRING
,
394 'title' => ts('Custom Field Javascript') ,
395 'description' => 'Optional scripting attributes for field.',
397 'size' => CRM_Utils_Type
::HUGE
,
399 'is_active' => array(
400 'name' => 'is_active',
401 'type' => CRM_Utils_Type
::T_BOOLEAN
,
402 'title' => ts('Custom Field Is Active?') ,
403 'description' => 'Is this property active?',
407 'type' => CRM_Utils_Type
::T_BOOLEAN
,
408 'title' => ts('Field is Viewable') ,
409 'description' => 'Is this property set by PHP Code? A code field is viewable but not editable',
411 'options_per_line' => array(
412 'name' => 'options_per_line',
413 'type' => CRM_Utils_Type
::T_INT
,
414 'title' => ts('Field Options Per Line') ,
415 'description' => 'number of options per line for checkbox and radio',
417 'text_length' => array(
418 'name' => 'text_length',
419 'type' => CRM_Utils_Type
::T_INT
,
420 'title' => ts('Field Length') ,
421 'description' => 'field length if alphanumeric',
423 'start_date_years' => array(
424 'name' => 'start_date_years',
425 'type' => CRM_Utils_Type
::T_INT
,
426 'title' => ts('Field Start Date') ,
427 'description' => 'Date may be up to start_date_years years prior to the current date.',
429 'end_date_years' => array(
430 'name' => 'end_date_years',
431 'type' => CRM_Utils_Type
::T_INT
,
432 'title' => ts('Field End Date') ,
433 'description' => 'Date may be up to end_date_years years after the current date.',
435 'date_format' => array(
436 'name' => 'date_format',
437 'type' => CRM_Utils_Type
::T_STRING
,
438 'title' => ts('Field Data Format') ,
439 'description' => 'date format for custom date',
441 'size' => CRM_Utils_Type
::BIG
,
443 'time_format' => array(
444 'name' => 'time_format',
445 'type' => CRM_Utils_Type
::T_INT
,
446 'title' => ts('Field Time Format') ,
447 'description' => 'time format for custom date',
449 'note_columns' => array(
450 'name' => 'note_columns',
451 'type' => CRM_Utils_Type
::T_INT
,
452 'title' => ts('Field Note Columns') ,
453 'description' => ' Number of columns in Note Field ',
455 'note_rows' => array(
456 'name' => 'note_rows',
457 'type' => CRM_Utils_Type
::T_INT
,
458 'title' => ts('Field Note Rows') ,
459 'description' => ' Number of rows in Note Field ',
461 'column_name' => array(
462 'name' => 'column_name',
463 'type' => CRM_Utils_Type
::T_STRING
,
464 'title' => ts('Field Column Name') ,
465 'description' => 'Name of the column that holds the values for this field.',
467 'size' => CRM_Utils_Type
::HUGE
,
469 'option_group_id' => array(
470 'name' => 'option_group_id',
471 'type' => CRM_Utils_Type
::T_INT
,
472 'title' => ts('Field Option Group') ,
473 'description' => 'For elements with options, the option group id that is used',
477 'type' => CRM_Utils_Type
::T_STRING
,
478 'title' => ts('Field Filter') ,
479 'description' => 'Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.',
481 'size' => CRM_Utils_Type
::HUGE
,
483 'in_selector' => array(
484 'name' => 'in_selector',
485 'type' => CRM_Utils_Type
::T_BOOLEAN
,
486 'title' => ts('Field Display') ,
487 'description' => 'Should the multi-record custom field values be displayed in tab table listing',
490 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
492 return Civi
::$statics[__CLASS__
]['fields'];
495 * Return a mapping from field-name to the corresponding key (as used in fields()).
498 * Array(string $name => string $uniqueName).
500 static function &fieldKeys() {
501 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
502 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
504 return Civi
::$statics[__CLASS__
]['fieldKeys'];
507 * Returns the names of this table
511 static function getTableName() {
512 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
515 * Returns if this table needs to be logged
523 * Returns the list of fields that can be imported
525 * @param bool $prefix
529 static function &import($prefix = false) {
530 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'custom_field', $prefix, array());
534 * Returns the list of fields that can be exported
536 * @param bool $prefix
540 static function &export($prefix = false) {
541 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'custom_field', $prefix, array());