commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / CRM / Event / DAO / Participant.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/Event/Participant.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_Event_DAO_Participant extends CRM_Core_DAO {
37 /**
38 * static instance to hold the table name
39 *
40 * @var string
41 */
42 static $_tableName = 'civicrm_participant';
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 * Participant Id
84 *
85 * @var int unsigned
86 */
87 public $id;
88 /**
89 * FK to Contact ID
90 *
91 * @var int unsigned
92 */
93 public $contact_id;
94 /**
95 * FK to Event ID
96 *
97 * @var int unsigned
98 */
99 public $event_id;
100 /**
101 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status =
102 Registered.
103 *
104 * @var int unsigned
105 */
106 public $status_id;
107 /**
108 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
109 *
110 * @var string
111 */
112 public $role_id;
113 /**
114 * When did contact register for event?
115 *
116 * @var datetime
117 */
118 public $register_date;
119 /**
120 * Source of this event registration.
121 *
122 * @var string
123 */
124 public $source;
125 /**
126 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
127 we store the label value and not the key
128 *
129 * @var text
130 */
131 public $fee_level;
132 /**
133 *
134 * @var boolean
135 */
136 public $is_test;
137 /**
138 *
139 * @var boolean
140 */
141 public $is_pay_later;
142 /**
143 * actual processor fee if known - may be 0.
144 *
145 * @var float
146 */
147 public $fee_amount;
148 /**
149 * FK to Participant ID
150 *
151 * @var int unsigned
152 */
153 public $registered_by_id;
154 /**
155 * FK to Discount ID
156 *
157 * @var int unsigned
158 */
159 public $discount_id;
160 /**
161 * 3 character string, value derived from config setting.
162 *
163 * @var string
164 */
165 public $fee_currency;
166 /**
167 * The campaign for which this participant has been registered.
168 *
169 * @var int unsigned
170 */
171 public $campaign_id;
172 /**
173 * Discount Amount
174 *
175 * @var int unsigned
176 */
177 public $discount_amount;
178 /**
179 * FK to civicrm_event_carts
180 *
181 * @var int unsigned
182 */
183 public $cart_id;
184 /**
185 * On Waiting List
186 *
187 * @var int
188 */
189 public $must_wait;
190 /**
191 * class constructor
192 *
193 * @return civicrm_participant
194 */
195 function __construct() {
196 $this->__table = 'civicrm_participant';
197 parent::__construct();
198 }
199 /**
200 * Returns foreign keys and entity references
201 *
202 * @return array
203 * [CRM_Core_Reference_Interface]
204 */
205 static function getReferenceColumns() {
206 if (!self::$_links) {
207 self::$_links = static ::createReferenceColumns(__CLASS__);
208 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
209 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_id', 'civicrm_event', 'id');
210 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_participant_status_type', 'id');
211 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'registered_by_id', 'civicrm_participant', 'id');
212 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'discount_id', 'civicrm_discount', 'id');
213 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
214 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'cart_id', 'civicrm_event_carts', 'id');
215 }
216 return self::$_links;
217 }
218 /**
219 * Returns all the column names of this table
220 *
221 * @return array
222 */
223 static function &fields() {
224 if (!(self::$_fields)) {
225 self::$_fields = array(
226 'participant_id' => array(
227 'name' => 'id',
228 'type' => CRM_Utils_Type::T_INT,
229 'title' => ts('Participant ID') ,
230 'description' => 'Participant Id',
231 'required' => true,
232 'import' => true,
233 'where' => 'civicrm_participant.id',
234 'headerPattern' => '/(^(participant(.)?)?id$)/i',
235 'dataPattern' => '',
236 'export' => true,
237 ) ,
238 'participant_contact_id' => array(
239 'name' => 'contact_id',
240 'type' => CRM_Utils_Type::T_INT,
241 'title' => ts('Contact ID') ,
242 'description' => 'FK to Contact ID',
243 'required' => true,
244 'import' => true,
245 'where' => 'civicrm_participant.contact_id',
246 'headerPattern' => '/contact(.?id)?/i',
247 'dataPattern' => '',
248 'export' => true,
249 'FKClassName' => 'CRM_Contact_DAO_Contact',
250 ) ,
251 'event_id' => array(
252 'name' => 'event_id',
253 'type' => CRM_Utils_Type::T_INT,
254 'title' => ts('Event') ,
255 'description' => 'FK to Event ID',
256 'required' => true,
257 'import' => true,
258 'where' => 'civicrm_participant.event_id',
259 'headerPattern' => '/event id$/i',
260 'dataPattern' => '',
261 'export' => true,
262 'FKClassName' => 'CRM_Event_DAO_Event',
263 ) ,
264 'participant_status_id' => array(
265 'name' => 'status_id',
266 'type' => CRM_Utils_Type::T_INT,
267 'title' => ts('Participant Status ID') ,
268 'description' => 'Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status =
269 Registered.
270 ',
271 'required' => true,
272 'import' => true,
273 'where' => 'civicrm_participant.status_id',
274 'headerPattern' => '/(participant.)?(status)$/i',
275 'dataPattern' => '',
276 'export' => true,
277 'default' => '1',
278 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
279 'html' => array(
280 'type' => 'Select',
281 ) ,
282 'pseudoconstant' => array(
283 'table' => 'civicrm_participant_status_type',
284 'keyColumn' => 'id',
285 'labelColumn' => 'label',
286 )
287 ) ,
288 'participant_role_id' => array(
289 'name' => 'role_id',
290 'type' => CRM_Utils_Type::T_STRING,
291 'title' => ts('Participant Role ID') ,
292 'description' => 'Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.',
293 'maxlength' => 128,
294 'size' => CRM_Utils_Type::HUGE,
295 'import' => true,
296 'where' => 'civicrm_participant.role_id',
297 'headerPattern' => '/(participant.)?(role)$/i',
298 'dataPattern' => '',
299 'export' => true,
300 'default' => 'NULL',
301 'html' => array(
302 'type' => 'Select',
303 ) ,
304 'pseudoconstant' => array(
305 'optionGroupName' => 'participant_role',
306 'optionEditPath' => 'civicrm/admin/options/participant_role',
307 )
308 ) ,
309 'participant_register_date' => array(
310 'name' => 'register_date',
311 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
312 'title' => ts('Register date') ,
313 'description' => 'When did contact register for event?',
314 'import' => true,
315 'where' => 'civicrm_participant.register_date',
316 'headerPattern' => '/^(r(egister\s)?date)$/i',
317 'dataPattern' => '',
318 'export' => true,
319 ) ,
320 'participant_source' => array(
321 'name' => 'source',
322 'type' => CRM_Utils_Type::T_STRING,
323 'title' => ts('Participant Source') ,
324 'description' => 'Source of this event registration.',
325 'maxlength' => 128,
326 'size' => CRM_Utils_Type::HUGE,
327 'import' => true,
328 'where' => 'civicrm_participant.source',
329 'headerPattern' => '/(participant.)?(source)$/i',
330 'dataPattern' => '',
331 'export' => true,
332 ) ,
333 'participant_fee_level' => array(
334 'name' => 'fee_level',
335 'type' => CRM_Utils_Type::T_TEXT,
336 'title' => ts('Fee level') ,
337 'description' => 'Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
338 we store the label value and not the key
339 ',
340 'import' => true,
341 'where' => 'civicrm_participant.fee_level',
342 'headerPattern' => '/^(f(ee\s)?level)$/i',
343 'dataPattern' => '',
344 'export' => true,
345 ) ,
346 'participant_is_test' => array(
347 'name' => 'is_test',
348 'type' => CRM_Utils_Type::T_BOOLEAN,
349 'title' => ts('Test') ,
350 'import' => true,
351 'where' => 'civicrm_participant.is_test',
352 'headerPattern' => '',
353 'dataPattern' => '',
354 'export' => true,
355 ) ,
356 'participant_is_pay_later' => array(
357 'name' => 'is_pay_later',
358 'type' => CRM_Utils_Type::T_BOOLEAN,
359 'title' => ts('Is Pay Later') ,
360 'import' => true,
361 'where' => 'civicrm_participant.is_pay_later',
362 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
363 'dataPattern' => '',
364 'export' => true,
365 ) ,
366 'participant_fee_amount' => array(
367 'name' => 'fee_amount',
368 'type' => CRM_Utils_Type::T_MONEY,
369 'title' => ts('Fee Amount') ,
370 'description' => 'actual processor fee if known - may be 0.',
371 'precision' => array(
372 20,
373 2
374 ) ,
375 'import' => true,
376 'where' => 'civicrm_participant.fee_amount',
377 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
378 'dataPattern' => '/^\d+(\.\d{2})?$/',
379 'export' => true,
380 ) ,
381 'participant_registered_by_id' => array(
382 'name' => 'registered_by_id',
383 'type' => CRM_Utils_Type::T_INT,
384 'title' => ts('Registered By ID') ,
385 'description' => 'FK to Participant ID',
386 'import' => true,
387 'where' => 'civicrm_participant.registered_by_id',
388 'headerPattern' => '',
389 'dataPattern' => '',
390 'export' => true,
391 'default' => 'NULL',
392 'FKClassName' => 'CRM_Event_DAO_Participant',
393 ) ,
394 'participant_discount_id' => array(
395 'name' => 'discount_id',
396 'type' => CRM_Utils_Type::T_INT,
397 'title' => ts('Discount ID') ,
398 'description' => 'FK to Discount ID',
399 'default' => 'NULL',
400 'FKClassName' => 'CRM_Core_DAO_Discount',
401 ) ,
402 'participant_fee_currency' => array(
403 'name' => 'fee_currency',
404 'type' => CRM_Utils_Type::T_STRING,
405 'title' => ts('Fee Currency') ,
406 'description' => '3 character string, value derived from config setting.',
407 'maxlength' => 3,
408 'size' => CRM_Utils_Type::FOUR,
409 'import' => true,
410 'where' => 'civicrm_participant.fee_currency',
411 'headerPattern' => '/(fee)?.?cur(rency)?/i',
412 'dataPattern' => '/^[A-Z]{3}$/i',
413 'export' => true,
414 'default' => 'NULL',
415 'html' => array(
416 'type' => 'Select',
417 ) ,
418 'pseudoconstant' => array(
419 'table' => 'civicrm_currency',
420 'keyColumn' => 'name',
421 'labelColumn' => 'full_name',
422 'nameColumn' => 'numeric_code',
423 )
424 ) ,
425 'participant_campaign_id' => array(
426 'name' => 'campaign_id',
427 'type' => CRM_Utils_Type::T_INT,
428 'title' => ts('Campaign') ,
429 'description' => 'The campaign for which this participant has been registered.',
430 'import' => true,
431 'where' => 'civicrm_participant.campaign_id',
432 'headerPattern' => '',
433 'dataPattern' => '',
434 'export' => true,
435 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
436 'pseudoconstant' => array(
437 'table' => 'civicrm_campaign',
438 'keyColumn' => 'id',
439 'labelColumn' => 'title',
440 )
441 ) ,
442 'discount_amount' => array(
443 'name' => 'discount_amount',
444 'type' => CRM_Utils_Type::T_INT,
445 'title' => ts('Discount Amount') ,
446 'description' => 'Discount Amount',
447 ) ,
448 'cart_id' => array(
449 'name' => 'cart_id',
450 'type' => CRM_Utils_Type::T_INT,
451 'title' => ts('Event Cart ID') ,
452 'description' => 'FK to civicrm_event_carts',
453 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
454 ) ,
455 'must_wait' => array(
456 'name' => 'must_wait',
457 'type' => CRM_Utils_Type::T_INT,
458 'title' => ts('Must Wait on List') ,
459 'description' => 'On Waiting List',
460 ) ,
461 );
462 }
463 return self::$_fields;
464 }
465 /**
466 * Returns an array containing, for each field, the arary key used for that
467 * field in self::$_fields.
468 *
469 * @return array
470 */
471 static function &fieldKeys() {
472 if (!(self::$_fieldKeys)) {
473 self::$_fieldKeys = array(
474 'id' => 'participant_id',
475 'contact_id' => 'participant_contact_id',
476 'event_id' => 'event_id',
477 'status_id' => 'participant_status_id',
478 'role_id' => 'participant_role_id',
479 'register_date' => 'participant_register_date',
480 'source' => 'participant_source',
481 'fee_level' => 'participant_fee_level',
482 'is_test' => 'participant_is_test',
483 'is_pay_later' => 'participant_is_pay_later',
484 'fee_amount' => 'participant_fee_amount',
485 'registered_by_id' => 'participant_registered_by_id',
486 'discount_id' => 'participant_discount_id',
487 'fee_currency' => 'participant_fee_currency',
488 'campaign_id' => 'participant_campaign_id',
489 'discount_amount' => 'discount_amount',
490 'cart_id' => 'cart_id',
491 'must_wait' => 'must_wait',
492 );
493 }
494 return self::$_fieldKeys;
495 }
496 /**
497 * Returns the names of this table
498 *
499 * @return string
500 */
501 static function getTableName() {
502 return self::$_tableName;
503 }
504 /**
505 * Returns if this table needs to be logged
506 *
507 * @return boolean
508 */
509 function getLog() {
510 return self::$_log;
511 }
512 /**
513 * Returns the list of fields that can be imported
514 *
515 * @param bool $prefix
516 *
517 * @return array
518 */
519 static function &import($prefix = false) {
520 if (!(self::$_import)) {
521 self::$_import = array();
522 $fields = self::fields();
523 foreach($fields as $name => $field) {
524 if (CRM_Utils_Array::value('import', $field)) {
525 if ($prefix) {
526 self::$_import['participant'] = & $fields[$name];
527 } else {
528 self::$_import[$name] = & $fields[$name];
529 }
530 }
531 }
532 }
533 return self::$_import;
534 }
535 /**
536 * Returns the list of fields that can be exported
537 *
538 * @param bool $prefix
539 *
540 * @return array
541 */
542 static function &export($prefix = false) {
543 if (!(self::$_export)) {
544 self::$_export = array();
545 $fields = self::fields();
546 foreach($fields as $name => $field) {
547 if (CRM_Utils_Array::value('export', $field)) {
548 if ($prefix) {
549 self::$_export['participant'] = & $fields[$name];
550 } else {
551 self::$_export[$name] = & $fields[$name];
552 }
553 }
554 }
555 }
556 return self::$_export;
557 }
558 }