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/OptionValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:cfa37dbb4bcb24f01ea8c59d2e2705e3)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_OptionValue
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_option_value';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
90 * Group which this option belongs to.
94 public $option_group_id;
96 * Option string as displayed to users - e.g. the label in an HTML OPTION tag.
102 * 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.
108 * Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.
114 * 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.
120 * Bitwise logic can be used to create subsets of options within an option_group for different uses.
126 * Is this the default option for the group?
132 * Controls display sort order.
138 * Optional description.
144 * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?
150 * Is this a predefined system object?
156 * Is this option active?
162 * Component that this option value belongs/caters to.
166 public $component_id;
168 * Which Domain is this option value for
177 public $visibility_id;
181 * @return civicrm_option_value
183 function __construct() {
184 $this->__table
= 'civicrm_option_value';
185 parent
::__construct();
188 * Returns foreign keys and entity references
191 * [CRM_Core_Reference_Interface]
193 static function getReferenceColumns() {
194 if (!self
::$_links) {
195 self
::$_links = static ::createReferenceColumns(__CLASS__
);
196 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'option_group_id', 'civicrm_option_group', 'id');
197 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'component_id', 'civicrm_component', 'id');
198 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'domain_id', 'civicrm_domain', 'id');
200 return self
::$_links;
203 * Returns all the column names of this table
207 static function &fields() {
208 if (!(self
::$_fields)) {
209 self
::$_fields = array(
212 'type' => CRM_Utils_Type
::T_INT
,
213 'title' => ts('Option Value ID') ,
214 'description' => 'Option ID',
217 'option_group_id' => array(
218 'name' => 'option_group_id',
219 'type' => CRM_Utils_Type
::T_INT
,
220 'title' => ts('Option Group ID') ,
221 'description' => 'Group which this option belongs to.',
223 'FKClassName' => 'CRM_Core_DAO_OptionGroup',
227 'pseudoconstant' => array(
228 'table' => 'civicrm_option_group',
230 'labelColumn' => 'name',
235 'type' => CRM_Utils_Type
::T_STRING
,
236 'title' => ts('Option Label') ,
237 'description' => 'Option string as displayed to users - e.g. the label in an HTML OPTION tag.',
240 'size' => CRM_Utils_Type
::HUGE
,
244 'type' => CRM_Utils_Type
::T_STRING
,
245 'title' => ts('Option Value') ,
246 '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.',
249 'size' => CRM_Utils_Type
::HUGE
,
253 'type' => CRM_Utils_Type
::T_STRING
,
254 'title' => ts('Option Name') ,
255 '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.',
257 'size' => CRM_Utils_Type
::HUGE
,
259 'where' => 'civicrm_option_value.name',
260 'headerPattern' => '',
265 'name' => 'grouping',
266 'type' => CRM_Utils_Type
::T_STRING
,
267 'title' => ts('Option Grouping Name') ,
268 '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.',
270 'size' => CRM_Utils_Type
::HUGE
,
274 'type' => CRM_Utils_Type
::T_INT
,
275 'title' => ts('Filter') ,
276 'description' => 'Bitwise logic can be used to create subsets of options within an option_group for different uses.',
278 'is_default' => array(
279 'name' => 'is_default',
280 'type' => CRM_Utils_Type
::T_BOOLEAN
,
281 'title' => ts('Option is Default?') ,
282 'description' => 'Is this the default option for the group?',
286 'type' => CRM_Utils_Type
::T_INT
,
287 'title' => ts('Order') ,
288 'description' => 'Controls display sort order.',
291 'description' => array(
292 'name' => 'description',
293 'type' => CRM_Utils_Type
::T_TEXT
,
294 'title' => ts('Option Description') ,
295 'description' => 'Optional description.',
299 'type' => 'TextArea',
302 'is_optgroup' => array(
303 'name' => 'is_optgroup',
304 'type' => CRM_Utils_Type
::T_BOOLEAN
,
305 'title' => ts('Option is Header?') ,
306 'description' => 'Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?',
308 'is_reserved' => array(
309 'name' => 'is_reserved',
310 'type' => CRM_Utils_Type
::T_BOOLEAN
,
311 'title' => ts('Option Is Reserved?') ,
312 'description' => 'Is this a predefined system object?',
314 'is_active' => array(
315 'name' => 'is_active',
316 'type' => CRM_Utils_Type
::T_BOOLEAN
,
317 'title' => ts('Option Is Active') ,
318 'description' => 'Is this option active?',
321 'component_id' => array(
322 'name' => 'component_id',
323 'type' => CRM_Utils_Type
::T_INT
,
324 'title' => ts('Option Component') ,
325 'description' => 'Component that this option value belongs/caters to.',
326 'FKClassName' => 'CRM_Core_DAO_Component',
330 'pseudoconstant' => array(
331 'table' => 'civicrm_component',
333 'labelColumn' => 'name',
336 'domain_id' => array(
337 'name' => 'domain_id',
338 'type' => CRM_Utils_Type
::T_INT
,
339 'title' => ts('Option Domain') ,
340 'description' => 'Which Domain is this option value for',
341 'FKClassName' => 'CRM_Core_DAO_Domain',
342 'pseudoconstant' => array(
343 'table' => 'civicrm_domain',
345 'labelColumn' => 'name',
348 'visibility_id' => array(
349 'name' => 'visibility_id',
350 'type' => CRM_Utils_Type
::T_INT
,
351 'title' => ts('Option Visibility') ,
356 return self
::$_fields;
359 * Returns an array containing, for each field, the arary key used for that
360 * field in self::$_fields.
364 static function &fieldKeys() {
365 if (!(self
::$_fieldKeys)) {
366 self
::$_fieldKeys = array(
368 'option_group_id' => 'option_group_id',
372 'grouping' => 'grouping',
373 'filter' => 'filter',
374 'is_default' => 'is_default',
375 'weight' => 'weight',
376 'description' => 'description',
377 'is_optgroup' => 'is_optgroup',
378 'is_reserved' => 'is_reserved',
379 'is_active' => 'is_active',
380 'component_id' => 'component_id',
381 'domain_id' => 'domain_id',
382 'visibility_id' => 'visibility_id',
385 return self
::$_fieldKeys;
388 * Returns the names of this table
392 static function getTableName() {
393 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
396 * Returns if this table needs to be logged
404 * Returns the list of fields that can be imported
406 * @param bool $prefix
410 static function &import($prefix = false) {
411 if (!(self
::$_import)) {
412 self
::$_import = array();
413 $fields = self
::fields();
414 foreach($fields as $name => $field) {
415 if (CRM_Utils_Array
::value('import', $field)) {
417 self
::$_import['option_value'] = & $fields[$name];
419 self
::$_import[$name] = & $fields[$name];
424 return self
::$_import;
427 * Returns the list of fields that can be exported
429 * @param bool $prefix
433 static function &export($prefix = false) {
434 if (!(self
::$_export)) {
435 self
::$_export = array();
436 $fields = self
::fields();
437 foreach($fields as $name => $field) {
438 if (CRM_Utils_Array
::value('export', $field)) {
440 self
::$_export['option_value'] = & $fields[$name];
442 self
::$_export[$name] = & $fields[$name];
447 return self
::$_export;