3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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-2015
31 * Generated from xml/schema/CRM/Core/OptionValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Core_DAO_OptionValue
extends CRM_Core_DAO
{
38 * static instance to hold the table name
42 static $_tableName = 'civicrm_option_value';
44 * static instance to hold the field values
48 static $_fields = null;
50 * static instance to hold the keys used in $_fields for each field.
54 static $_fieldKeys = null;
56 * static instance to hold the FK relationships
60 static $_links = null;
62 * static instance to hold the values that can
67 static $_import = null;
69 * static instance to hold the values that can
74 static $_export = null;
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
89 * Group which this option belongs to.
93 public $option_group_id;
95 * Option string as displayed to users - e.g. the label in an HTML OPTION tag.
101 * 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.
107 * Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.
113 * 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.
119 * Bitwise logic can be used to create subsets of options within an option_group for different uses.
125 * Is this the default option for the group?
131 * Controls display sort order.
137 * Optional description.
143 * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?
149 * Is this a predefined system object?
155 * Is this option active?
161 * Component that this option value belongs/caters to.
165 public $component_id;
167 * Which Domain is this option value for
176 public $visibility_id;
180 * @return civicrm_option_value
182 function __construct() {
183 $this->__table
= 'civicrm_option_value';
184 parent
::__construct();
187 * Returns foreign keys and entity references
190 * [CRM_Core_Reference_Interface]
192 static function getReferenceColumns() {
193 if (!self
::$_links) {
194 self
::$_links = static ::createReferenceColumns(__CLASS__
);
195 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'option_group_id', 'civicrm_option_group', 'id');
196 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'component_id', 'civicrm_component', 'id');
197 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'domain_id', 'civicrm_domain', 'id');
199 return self
::$_links;
202 * Returns all the column names of this table
206 static function &fields() {
207 if (!(self
::$_fields)) {
208 self
::$_fields = array(
211 'type' => CRM_Utils_Type
::T_INT
,
212 'title' => ts('Option Value ID') ,
213 'description' => 'Option ID',
216 'option_group_id' => array(
217 'name' => 'option_group_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Option Group ID') ,
220 'description' => 'Group which this option belongs to.',
222 'FKClassName' => 'CRM_Core_DAO_OptionGroup',
226 'pseudoconstant' => array(
227 'table' => 'civicrm_option_group',
229 'labelColumn' => 'name',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Option Label') ,
236 'description' => 'Option string as displayed to users - e.g. the label in an HTML OPTION tag.',
239 'size' => CRM_Utils_Type
::HUGE
,
243 'type' => CRM_Utils_Type
::T_STRING
,
244 'title' => ts('Option Value') ,
245 '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.',
248 'size' => CRM_Utils_Type
::HUGE
,
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Option Name') ,
254 '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.',
256 'size' => CRM_Utils_Type
::HUGE
,
258 'where' => 'civicrm_option_value.name',
259 'headerPattern' => '',
264 'name' => 'grouping',
265 'type' => CRM_Utils_Type
::T_STRING
,
266 'title' => ts('Option Grouping Name') ,
267 '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.',
269 'size' => CRM_Utils_Type
::HUGE
,
273 'type' => CRM_Utils_Type
::T_INT
,
274 'title' => ts('Filter') ,
275 'description' => 'Bitwise logic can be used to create subsets of options within an option_group for different uses.',
277 'is_default' => array(
278 'name' => 'is_default',
279 'type' => CRM_Utils_Type
::T_BOOLEAN
,
280 'title' => ts('Option is Default?') ,
281 'description' => 'Is this the default option for the group?',
285 'type' => CRM_Utils_Type
::T_INT
,
286 'title' => ts('Order') ,
287 'description' => 'Controls display sort order.',
290 'description' => array(
291 'name' => 'description',
292 'type' => CRM_Utils_Type
::T_TEXT
,
293 'title' => ts('Option Description') ,
294 'description' => 'Optional description.',
298 'type' => 'TextArea',
301 'is_optgroup' => array(
302 'name' => 'is_optgroup',
303 'type' => CRM_Utils_Type
::T_BOOLEAN
,
304 'title' => ts('Option is Header?') ,
305 'description' => 'Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?',
307 'is_reserved' => array(
308 'name' => 'is_reserved',
309 'type' => CRM_Utils_Type
::T_BOOLEAN
,
310 'title' => ts('Option Is Reserved?') ,
311 'description' => 'Is this a predefined system object?',
313 'is_active' => array(
314 'name' => 'is_active',
315 'type' => CRM_Utils_Type
::T_BOOLEAN
,
316 'title' => ts('Option Is Active') ,
317 'description' => 'Is this option active?',
320 'component_id' => array(
321 'name' => 'component_id',
322 'type' => CRM_Utils_Type
::T_INT
,
323 'title' => ts('Option Component') ,
324 'description' => 'Component that this option value belongs/caters to.',
325 'FKClassName' => 'CRM_Core_DAO_Component',
329 'pseudoconstant' => array(
330 'table' => 'civicrm_component',
332 'labelColumn' => 'name',
335 'domain_id' => array(
336 'name' => 'domain_id',
337 'type' => CRM_Utils_Type
::T_INT
,
338 'title' => ts('Option Domain') ,
339 'description' => 'Which Domain is this option value for',
340 'FKClassName' => 'CRM_Core_DAO_Domain',
341 'pseudoconstant' => array(
342 'table' => 'civicrm_domain',
344 'labelColumn' => 'name',
347 'visibility_id' => array(
348 'name' => 'visibility_id',
349 'type' => CRM_Utils_Type
::T_INT
,
350 'title' => ts('Option Visibility') ,
355 return self
::$_fields;
358 * Returns an array containing, for each field, the arary key used for that
359 * field in self::$_fields.
363 static function &fieldKeys() {
364 if (!(self
::$_fieldKeys)) {
365 self
::$_fieldKeys = array(
367 'option_group_id' => 'option_group_id',
371 'grouping' => 'grouping',
372 'filter' => 'filter',
373 'is_default' => 'is_default',
374 'weight' => 'weight',
375 'description' => 'description',
376 'is_optgroup' => 'is_optgroup',
377 'is_reserved' => 'is_reserved',
378 'is_active' => 'is_active',
379 'component_id' => 'component_id',
380 'domain_id' => 'domain_id',
381 'visibility_id' => 'visibility_id',
384 return self
::$_fieldKeys;
387 * Returns the names of this table
391 static function getTableName() {
392 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
395 * Returns if this table needs to be logged
403 * Returns the list of fields that can be imported
405 * @param bool $prefix
409 static function &import($prefix = false) {
410 if (!(self
::$_import)) {
411 self
::$_import = array();
412 $fields = self
::fields();
413 foreach($fields as $name => $field) {
414 if (CRM_Utils_Array
::value('import', $field)) {
416 self
::$_import['option_value'] = & $fields[$name];
418 self
::$_import[$name] = & $fields[$name];
423 return self
::$_import;
426 * Returns the list of fields that can be exported
428 * @param bool $prefix
432 static function &export($prefix = false) {
433 if (!(self
::$_export)) {
434 self
::$_export = array();
435 $fields = self
::fields();
436 foreach($fields as $name => $field) {
437 if (CRM_Utils_Array
::value('export', $field)) {
439 self
::$_export['option_value'] = & $fields[$name];
441 self
::$_export[$name] = & $fields[$name];
446 return self
::$_export;