commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / CRM / Core / DAO / OptionValue.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2015
30 *
31 * Generated from xml/schema/CRM/Core/OptionValue.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 */
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
37 /**
38 * static instance to hold the table name
39 *
40 * @var string
41 */
42 static $_tableName = 'civicrm_option_value';
43 /**
44 * static instance to hold the field values
45 *
46 * @var array
47 */
48 static $_fields = null;
49 /**
50 * static instance to hold the keys used in $_fields for each field.
51 *
52 * @var array
53 */
54 static $_fieldKeys = null;
55 /**
56 * static instance to hold the FK relationships
57 *
58 * @var string
59 */
60 static $_links = null;
61 /**
62 * static instance to hold the values that can
63 * be imported
64 *
65 * @var array
66 */
67 static $_import = null;
68 /**
69 * static instance to hold the values that can
70 * be exported
71 *
72 * @var array
73 */
74 static $_export = null;
75 /**
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
78 *
79 * @var boolean
80 */
81 static $_log = true;
82 /**
83 * Option ID
84 *
85 * @var int unsigned
86 */
87 public $id;
88 /**
89 * Group which this option belongs to.
90 *
91 * @var int unsigned
92 */
93 public $option_group_id;
94 /**
95 * Option string as displayed to users - e.g. the label in an HTML OPTION tag.
96 *
97 * @var string
98 */
99 public $label;
100 /**
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.
102 *
103 * @var string
104 */
105 public $value;
106 /**
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.
108 *
109 * @var string
110 */
111 public $name;
112 /**
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.
114 *
115 * @var string
116 */
117 public $grouping;
118 /**
119 * Bitwise logic can be used to create subsets of options within an option_group for different uses.
120 *
121 * @var int unsigned
122 */
123 public $filter;
124 /**
125 * Is this the default option for the group?
126 *
127 * @var boolean
128 */
129 public $is_default;
130 /**
131 * Controls display sort order.
132 *
133 * @var int unsigned
134 */
135 public $weight;
136 /**
137 * Optional description.
138 *
139 * @var text
140 */
141 public $description;
142 /**
143 * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?
144 *
145 * @var boolean
146 */
147 public $is_optgroup;
148 /**
149 * Is this a predefined system object?
150 *
151 * @var boolean
152 */
153 public $is_reserved;
154 /**
155 * Is this option active?
156 *
157 * @var boolean
158 */
159 public $is_active;
160 /**
161 * Component that this option value belongs/caters to.
162 *
163 * @var int unsigned
164 */
165 public $component_id;
166 /**
167 * Which Domain is this option value for
168 *
169 * @var int unsigned
170 */
171 public $domain_id;
172 /**
173 *
174 * @var int unsigned
175 */
176 public $visibility_id;
177 /**
178 * class constructor
179 *
180 * @return civicrm_option_value
181 */
182 function __construct() {
183 $this->__table = 'civicrm_option_value';
184 parent::__construct();
185 }
186 /**
187 * Returns foreign keys and entity references
188 *
189 * @return array
190 * [CRM_Core_Reference_Interface]
191 */
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');
198 }
199 return self::$_links;
200 }
201 /**
202 * Returns all the column names of this table
203 *
204 * @return array
205 */
206 static function &fields() {
207 if (!(self::$_fields)) {
208 self::$_fields = array(
209 'id' => array(
210 'name' => 'id',
211 'type' => CRM_Utils_Type::T_INT,
212 'title' => ts('Option Value ID') ,
213 'description' => 'Option ID',
214 'required' => true,
215 ) ,
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.',
221 'required' => true,
222 'FKClassName' => 'CRM_Core_DAO_OptionGroup',
223 'html' => array(
224 'type' => 'Select',
225 ) ,
226 'pseudoconstant' => array(
227 'table' => 'civicrm_option_group',
228 'keyColumn' => 'id',
229 'labelColumn' => 'name',
230 )
231 ) ,
232 'label' => array(
233 'name' => 'label',
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.',
237 'required' => true,
238 'maxlength' => 255,
239 'size' => CRM_Utils_Type::HUGE,
240 ) ,
241 'value' => array(
242 'name' => 'value',
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.',
246 'required' => true,
247 'maxlength' => 512,
248 'size' => CRM_Utils_Type::HUGE,
249 ) ,
250 'name' => array(
251 'name' => 'name',
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.',
255 'maxlength' => 255,
256 'size' => CRM_Utils_Type::HUGE,
257 'import' => true,
258 'where' => 'civicrm_option_value.name',
259 'headerPattern' => '',
260 'dataPattern' => '',
261 'export' => true,
262 ) ,
263 'grouping' => array(
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.',
268 'maxlength' => 255,
269 'size' => CRM_Utils_Type::HUGE,
270 ) ,
271 'filter' => array(
272 'name' => 'filter',
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.',
276 ) ,
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?',
282 ) ,
283 'weight' => array(
284 'name' => 'weight',
285 'type' => CRM_Utils_Type::T_INT,
286 'title' => ts('Order') ,
287 'description' => 'Controls display sort order.',
288 'required' => true,
289 ) ,
290 'description' => array(
291 'name' => 'description',
292 'type' => CRM_Utils_Type::T_TEXT,
293 'title' => ts('Option Description') ,
294 'description' => 'Optional description.',
295 'rows' => 8,
296 'cols' => 60,
297 'html' => array(
298 'type' => 'TextArea',
299 ) ,
300 ) ,
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?',
306 ) ,
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?',
312 ) ,
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?',
318 'default' => '1',
319 ) ,
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',
326 'html' => array(
327 'type' => 'Select',
328 ) ,
329 'pseudoconstant' => array(
330 'table' => 'civicrm_component',
331 'keyColumn' => 'id',
332 'labelColumn' => 'name',
333 )
334 ) ,
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',
343 'keyColumn' => 'id',
344 'labelColumn' => 'name',
345 )
346 ) ,
347 'visibility_id' => array(
348 'name' => 'visibility_id',
349 'type' => CRM_Utils_Type::T_INT,
350 'title' => ts('Option Visibility') ,
351 'default' => 'NULL',
352 ) ,
353 );
354 }
355 return self::$_fields;
356 }
357 /**
358 * Returns an array containing, for each field, the arary key used for that
359 * field in self::$_fields.
360 *
361 * @return array
362 */
363 static function &fieldKeys() {
364 if (!(self::$_fieldKeys)) {
365 self::$_fieldKeys = array(
366 'id' => 'id',
367 'option_group_id' => 'option_group_id',
368 'label' => 'label',
369 'value' => 'value',
370 'name' => 'name',
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',
382 );
383 }
384 return self::$_fieldKeys;
385 }
386 /**
387 * Returns the names of this table
388 *
389 * @return string
390 */
391 static function getTableName() {
392 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
393 }
394 /**
395 * Returns if this table needs to be logged
396 *
397 * @return boolean
398 */
399 function getLog() {
400 return self::$_log;
401 }
402 /**
403 * Returns the list of fields that can be imported
404 *
405 * @param bool $prefix
406 *
407 * @return array
408 */
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)) {
415 if ($prefix) {
416 self::$_import['option_value'] = & $fields[$name];
417 } else {
418 self::$_import[$name] = & $fields[$name];
419 }
420 }
421 }
422 }
423 return self::$_import;
424 }
425 /**
426 * Returns the list of fields that can be exported
427 *
428 * @param bool $prefix
429 *
430 * @return array
431 */
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)) {
438 if ($prefix) {
439 self::$_export['option_value'] = & $fields[$name];
440 } else {
441 self::$_export[$name] = & $fields[$name];
442 }
443 }
444 }
445 }
446 return self::$_export;
447 }
448 }