<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7                                                |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015                                |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM.                                    |
|                                                                    |
| CiviCRM is free software; you can copy, modify, and distribute it  |
| under the terms of the GNU Affero General Public License           |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
|                                                                    |
| CiviCRM is distributed in the hope that it will be useful, but     |
| WITHOUT ANY WARRANTY; without even the implied warranty of         |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
| See the GNU Affero General Public License for more details.        |
|                                                                    |
| You should have received a copy of the GNU Affero General Public   |
| License and the CiviCRM Licensing Exception along                  |
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
/**
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2015
 *
 * Generated from xml/schema/CRM/Core/UFField.xml
 * DO NOT EDIT.  Generated by CRM_Core_CodeGen
 */
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CRM_Core_DAO_UFField extends CRM_Core_DAO
{
  /**
   * static instance to hold the table name
   *
   * @var string
   */
  static $_tableName = 'civicrm_uf_field';
  /**
   * static instance to hold the field values
   *
   * @var array
   */
  static $_fields = null;
  /**
   * static instance to hold the keys used in $_fields for each field.
   *
   * @var array
   */
  static $_fieldKeys = null;
  /**
   * static instance to hold the FK relationships
   *
   * @var string
   */
  static $_links = null;
  /**
   * static instance to hold the values that can
   * be imported
   *
   * @var array
   */
  static $_import = null;
  /**
   * static instance to hold the values that can
   * be exported
   *
   * @var array
   */
  static $_export = null;
  /**
   * static value to see if we should log any modifications to
   * this table in the civicrm_log table
   *
   * @var boolean
   */
  static $_log = true;
  /**
   * Unique table ID
   *
   * @var int unsigned
   */
  public $id;
  /**
   * Which form does this field belong to.
   *
   * @var int unsigned
   */
  public $uf_group_id;
  /**
   * Name for CiviCRM field which is being exposed for sharing.
   *
   * @var string
   */
  public $field_name;
  /**
   * Is this field currently shareable? If false, hide the field for all sharing contexts.
   *
   * @var boolean
   */
  public $is_active;
  /**
   * the field is view only and not editable in user forms.
   *
   * @var boolean
   */
  public $is_view;
  /**
   * Is this field required when included in a user or registration form?
   *
   * @var boolean
   */
  public $is_required;
  /**
   * Controls field display order when user framework fields are displayed in registration and account editing forms.
   *
   * @var int
   */
  public $weight;
  /**
   * Description and/or help text to display after this field.
   *
   * @var text
   */
  public $help_post;
  /**
   * Description and/or help text to display before this field.
   *
   * @var text
   */
  public $help_pre;
  /**
   * In what context(s) is this field visible.
   *
   * @var string
   */
  public $visibility;
  /**
   * Is this field included as a column in the selector table?
   *
   * @var boolean
   */
  public $in_selector;
  /**
   * Is this field included search form of profile?
   *
   * @var boolean
   */
  public $is_searchable;
  /**
   * Location type of this mapping, if required
   *
   * @var int unsigned
   */
  public $location_type_id;
  /**
   * Phone Type Id, if required
   *
   * @var int unsigned
   */
  public $phone_type_id;
  /**
   * Website Type Id, if required
   *
   * @var int unsigned
   */
  public $website_type_id;
  /**
   * To save label for fields.
   *
   * @var string
   */
  public $label;
  /**
   * This field saves field type (ie individual,household.. field etc).
   *
   * @var string
   */
  public $field_type;
  /**
   * Is this field reserved for use by some other CiviCRM functionality?
   *
   * @var boolean
   */
  public $is_reserved;
  /**
   * Include in multi-record listing?
   *
   * @var boolean
   */
  public $is_multi_summary;
  /**
   * class constructor
   *
   * @return civicrm_uf_field
   */
  function __construct()
  {
    $this->__table = 'civicrm_uf_field';
    parent::__construct();
  }
  /**
   * Returns foreign keys and entity references
   *
   * @return array
   *   [CRM_Core_Reference_Interface]
   */
  static function getReferenceColumns()
  {
    if (!self::$_links) {
      self::$_links = static ::createReferenceColumns(__CLASS__);
      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'uf_group_id', 'civicrm_uf_group', 'id');
      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id');
    }
    return self::$_links;
  }
  /**
   * Returns all the column names of this table
   *
   * @return array
   */
  static function &fields()
  {
    if (!(self::$_fields)) {
      self::$_fields = array(
        'id' => array(
          'name' => 'id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Profile Field ID') ,
          'description' => 'Unique table ID',
          'required' => true,
        ) ,
        'uf_group_id' => array(
          'name' => 'uf_group_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Profile ID') ,
          'description' => 'Which form does this field belong to.',
          'required' => true,
          'FKClassName' => 'CRM_Core_DAO_UFGroup',
          'html' => array(
            'type' => 'Select',
          ) ,
          'pseudoconstant' => array(
            'table' => 'civicrm_uf_group',
            'keyColumn' => 'id',
            'labelColumn' => 'title',
          )
        ) ,
        'field_name' => array(
          'name' => 'field_name',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => ts('Profile Field Name') ,
          'description' => 'Name for CiviCRM field which is being exposed for sharing.',
          'required' => true,
          'maxlength' => 64,
          'size' => CRM_Utils_Type::BIG,
        ) ,
        'is_active' => array(
          'name' => 'is_active',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Profile Field Is Active') ,
          'description' => 'Is this field currently shareable? If false, hide the field for all sharing contexts.',
          'default' => '1',
        ) ,
        'is_view' => array(
          'name' => 'is_view',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Profile Is View Only') ,
          'description' => 'the field is view only and not editable in user forms.',
        ) ,
        'is_required' => array(
          'name' => 'is_required',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Profile Field Is Required') ,
          'description' => 'Is this field required when included in a user or registration form?',
        ) ,
        'weight' => array(
          'name' => 'weight',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Order') ,
          'description' => 'Controls field display order when user framework fields are displayed in registration and account editing forms.',
          'required' => true,
          'default' => '1',
        ) ,
        'help_post' => array(
          'name' => 'help_post',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => ts('Profile Field Post Help') ,
          'description' => 'Description and/or help text to display after this field.',
        ) ,
        'help_pre' => array(
          'name' => 'help_pre',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => ts('Profile Field Pre Help') ,
          'description' => 'Description and/or help text to display before this field.',
        ) ,
        'visibility' => array(
          'name' => 'visibility',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => ts('Profile Field Visibility') ,
          'description' => 'In what context(s) is this field visible.',
          'maxlength' => 32,
          'size' => CRM_Utils_Type::MEDIUM,
          'default' => 'User and User Admin Only',
          'html' => array(
            'type' => 'Select',
          ) ,
          'pseudoconstant' => array(
            'callback' => 'CRM_Core_SelectValues::ufVisibility',
          )
        ) ,
        'in_selector' => array(
          'name' => 'in_selector',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Profile Field Is a Filter') ,
          'description' => 'Is this field included as a column in the selector table?',
        ) ,
        'is_searchable' => array(
          'name' => 'is_searchable',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Profile Field Is Searchable') ,
          'description' => 'Is this field included search form of profile?',
        ) ,
        'location_type_id' => array(
          'name' => 'location_type_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Profile Field Location Type') ,
          'description' => 'Location type of this mapping, if required',
          'FKClassName' => 'CRM_Core_DAO_LocationType',
        ) ,
        'phone_type_id' => array(
          'name' => 'phone_type_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Profile Field Phone Type') ,
          'description' => 'Phone Type Id, if required',
        ) ,
        'website_type_id' => array(
          'name' => 'website_type_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Profile Field Website Type') ,
          'description' => 'Website Type Id, if required',
        ) ,
        'label' => array(
          'name' => 'label',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => ts('Profile Field Label') ,
          'description' => 'To save label for fields.',
          'required' => true,
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
        ) ,
        'field_type' => array(
          'name' => 'field_type',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => ts('Profile Field Type') ,
          'description' => 'This field saves field type (ie individual,household.. field etc).',
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
        ) ,
        'is_reserved' => array(
          'name' => 'is_reserved',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Profile Field Is Reserved') ,
          'description' => 'Is this field reserved for use by some other CiviCRM functionality?',
        ) ,
        'is_multi_summary' => array(
          'name' => 'is_multi_summary',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Profile Field Supports Multiple') ,
          'description' => 'Include in multi-record listing?',
        ) ,
      );
    }
    return self::$_fields;
  }
  /**
   * Returns an array containing, for each field, the arary key used for that
   * field in self::$_fields.
   *
   * @return array
   */
  static function &fieldKeys()
  {
    if (!(self::$_fieldKeys)) {
      self::$_fieldKeys = array(
        'id' => 'id',
        'uf_group_id' => 'uf_group_id',
        'field_name' => 'field_name',
        'is_active' => 'is_active',
        'is_view' => 'is_view',
        'is_required' => 'is_required',
        'weight' => 'weight',
        'help_post' => 'help_post',
        'help_pre' => 'help_pre',
        'visibility' => 'visibility',
        'in_selector' => 'in_selector',
        'is_searchable' => 'is_searchable',
        'location_type_id' => 'location_type_id',
        'phone_type_id' => 'phone_type_id',
        'website_type_id' => 'website_type_id',
        'label' => 'label',
        'field_type' => 'field_type',
        'is_reserved' => 'is_reserved',
        'is_multi_summary' => 'is_multi_summary',
      );
    }
    return self::$_fieldKeys;
  }
  /**
   * Returns the names of this table
   *
   * @return string
   */
  static function getTableName()
  {
    return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
  }
  /**
   * Returns if this table needs to be logged
   *
   * @return boolean
   */
  function getLog()
  {
    return self::$_log;
  }
  /**
   * Returns the list of fields that can be imported
   *
   * @param bool $prefix
   *
   * @return array
   */
  static function &import($prefix = false)
  {
    if (!(self::$_import)) {
      self::$_import = array();
      $fields = self::fields();
      foreach($fields as $name => $field) {
        if (CRM_Utils_Array::value('import', $field)) {
          if ($prefix) {
            self::$_import['uf_field'] = & $fields[$name];
          } else {
            self::$_import[$name] = & $fields[$name];
          }
        }
      }
    }
    return self::$_import;
  }
  /**
   * Returns the list of fields that can be exported
   *
   * @param bool $prefix
   *
   * @return array
   */
  static function &export($prefix = false)
  {
    if (!(self::$_export)) {
      self::$_export = array();
      $fields = self::fields();
      foreach($fields as $name => $field) {
        if (CRM_Utils_Array::value('export', $field)) {
          if ($prefix) {
            self::$_export['uf_field'] = & $fields[$name];
          } else {
            self::$_export[$name] = & $fields[$name];
          }
        }
      }
    }
    return self::$_export;
  }
}
