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/OptionValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:fdf2f62ba69b54da0567362493827448)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Core_DAO_OptionValue constructor.
40 class CRM_Core_DAO_OptionValue
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_option_value';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * Group which this option belongs to.
64 public $option_group_id;
66 * Option string as displayed to users - e.g. the label in an HTML OPTION tag.
72 * The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key.
78 * Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.
84 * Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners.
90 * Bitwise logic can be used to create subsets of options within an option_group for different uses.
96 * Is this the default option for the group?
102 * Controls display sort order.
108 * Optional description.
114 * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?
120 * Is this a predefined system object?
126 * Is this option active?
132 * Component that this option value belongs/caters to.
136 public $component_id;
138 * Which Domain is this option value for
147 public $visibility_id;
155 * Hex color value e.g. #ffffff
163 function __construct() {
164 $this->__table
= 'civicrm_option_value';
165 parent
::__construct();
168 * Returns foreign keys and entity references.
171 * [CRM_Core_Reference_Interface]
173 static function getReferenceColumns() {
174 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
175 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
176 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'option_group_id', 'civicrm_option_group', 'id');
177 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'component_id', 'civicrm_component', 'id');
178 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'domain_id', 'civicrm_domain', 'id');
179 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
181 return Civi
::$statics[__CLASS__
]['links'];
184 * Returns all the column names of this table
188 static function &fields() {
189 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
190 Civi
::$statics[__CLASS__
]['fields'] = array(
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Option Value ID') ,
195 'description' => 'Option ID',
198 'option_group_id' => array(
199 'name' => 'option_group_id',
200 'type' => CRM_Utils_Type
::T_INT
,
201 'title' => ts('Option Group ID') ,
202 'description' => 'Group which this option belongs to.',
204 'FKClassName' => 'CRM_Core_DAO_OptionGroup',
208 'pseudoconstant' => array(
209 'table' => 'civicrm_option_group',
211 'labelColumn' => 'name',
216 'type' => CRM_Utils_Type
::T_STRING
,
217 'title' => ts('Option Label') ,
218 'description' => 'Option string as displayed to users - e.g. the label in an HTML OPTION tag.',
221 'size' => CRM_Utils_Type
::HUGE
,
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Option Value') ,
227 'description' => 'The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key.',
230 'size' => CRM_Utils_Type
::HUGE
,
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Option Name') ,
236 'description' => 'Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.',
238 'size' => CRM_Utils_Type
::HUGE
,
240 'where' => 'civicrm_option_value.name',
241 'headerPattern' => '',
246 'name' => 'grouping',
247 'type' => CRM_Utils_Type
::T_STRING
,
248 'title' => ts('Option Grouping Name') ,
249 'description' => 'Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners.',
251 'size' => CRM_Utils_Type
::HUGE
,
255 'type' => CRM_Utils_Type
::T_INT
,
256 'title' => ts('Filter') ,
257 'description' => 'Bitwise logic can be used to create subsets of options within an option_group for different uses.',
259 'is_default' => array(
260 'name' => 'is_default',
261 'type' => CRM_Utils_Type
::T_BOOLEAN
,
262 'title' => ts('Option is Default?') ,
263 'description' => 'Is this the default option for the group?',
267 'type' => CRM_Utils_Type
::T_INT
,
268 'title' => ts('Order') ,
269 'description' => 'Controls display sort order.',
272 'description' => array(
273 'name' => 'description',
274 'type' => CRM_Utils_Type
::T_TEXT
,
275 'title' => ts('Option Description') ,
276 'description' => 'Optional description.',
280 'type' => 'TextArea',
283 'is_optgroup' => array(
284 'name' => 'is_optgroup',
285 'type' => CRM_Utils_Type
::T_BOOLEAN
,
286 'title' => ts('Option is Header?') ,
287 'description' => 'Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?',
289 'is_reserved' => array(
290 'name' => 'is_reserved',
291 'type' => CRM_Utils_Type
::T_BOOLEAN
,
292 'title' => ts('Option Is Reserved?') ,
293 'description' => 'Is this a predefined system object?',
295 'is_active' => array(
296 'name' => 'is_active',
297 'type' => CRM_Utils_Type
::T_BOOLEAN
,
298 'title' => ts('Option Is Active') ,
299 'description' => 'Is this option active?',
302 'component_id' => array(
303 'name' => 'component_id',
304 'type' => CRM_Utils_Type
::T_INT
,
305 'title' => ts('Option Component') ,
306 'description' => 'Component that this option value belongs/caters to.',
307 'FKClassName' => 'CRM_Core_DAO_Component',
311 'pseudoconstant' => array(
312 'table' => 'civicrm_component',
314 'labelColumn' => 'name',
317 'domain_id' => array(
318 'name' => 'domain_id',
319 'type' => CRM_Utils_Type
::T_INT
,
320 'title' => ts('Option Domain') ,
321 'description' => 'Which Domain is this option value for',
322 'FKClassName' => 'CRM_Core_DAO_Domain',
323 'pseudoconstant' => array(
324 'table' => 'civicrm_domain',
326 'labelColumn' => 'name',
329 'visibility_id' => array(
330 'name' => 'visibility_id',
331 'type' => CRM_Utils_Type
::T_INT
,
332 'title' => ts('Option Visibility') ,
337 'type' => CRM_Utils_Type
::T_STRING
,
338 'title' => ts('Icon') ,
339 'description' => 'crm-i icon class',
341 'size' => CRM_Utils_Type
::HUGE
,
346 'type' => CRM_Utils_Type
::T_STRING
,
347 'title' => ts('Color') ,
348 'description' => 'Hex color value e.g. #ffffff',
350 'size' => CRM_Utils_Type
::HUGE
,
354 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
356 return Civi
::$statics[__CLASS__
]['fields'];
359 * Return a mapping from field-name to the corresponding key (as used in fields()).
362 * Array(string $name => string $uniqueName).
364 static function &fieldKeys() {
365 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
366 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
368 return Civi
::$statics[__CLASS__
]['fieldKeys'];
371 * Returns the names of this table
375 static function getTableName() {
376 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
379 * Returns if this table needs to be logged
387 * Returns the list of fields that can be imported
389 * @param bool $prefix
393 static function &import($prefix = false) {
394 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_value', $prefix, array());
398 * Returns the list of fields that can be exported
400 * @param bool $prefix
404 static function &export($prefix = false) {
405 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_value', $prefix, array());