1 | <?php |
||
16 | class EEM_Attendee extends EEM_CPT_Base |
||
17 | { |
||
18 | |||
19 | // private instance of the Attendee object |
||
20 | protected static $_instance = null; |
||
21 | |||
22 | /** |
||
23 | * QST_system for questions are strings not integers now, |
||
24 | * so these constants are deprecated. |
||
25 | * Please instead use the EEM_Attendee::system_question_* constants |
||
26 | * |
||
27 | * @deprecated |
||
28 | */ |
||
29 | const fname_question_id = 1; |
||
30 | |||
31 | /** |
||
32 | * @deprecated |
||
33 | */ |
||
34 | const lname_question_id = 2; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * @deprecated |
||
39 | */ |
||
40 | const email_question_id = 3; |
||
41 | |||
42 | |||
43 | /** |
||
44 | * @deprecated |
||
45 | */ |
||
46 | const address_question_id = 4; |
||
47 | |||
48 | |||
49 | /** |
||
50 | * @deprecated |
||
51 | */ |
||
52 | const address2_question_id = 5; |
||
53 | |||
54 | |||
55 | /** |
||
56 | * @deprecated |
||
57 | */ |
||
58 | const city_question_id = 6; |
||
59 | |||
60 | |||
61 | /** |
||
62 | * @deprecated |
||
63 | */ |
||
64 | const state_question_id = 7; |
||
65 | |||
66 | |||
67 | /** |
||
68 | * @deprecated |
||
69 | */ |
||
70 | const country_question_id = 8; |
||
71 | |||
72 | |||
73 | /** |
||
74 | * @deprecated |
||
75 | */ |
||
76 | const zip_question_id = 9; |
||
77 | |||
78 | |||
79 | /** |
||
80 | * @deprecated |
||
81 | */ |
||
82 | const phone_question_id = 10; |
||
83 | |||
84 | /** |
||
85 | * When looking for questions that correspond to attendee fields, |
||
86 | * look for the question with this QST_system value. |
||
87 | * These replace the old constants like EEM_Attendee::*_question_id |
||
88 | */ |
||
89 | const system_question_fname = 'fname'; |
||
90 | |||
91 | const system_question_lname = 'lname'; |
||
92 | |||
93 | const system_question_email = 'email'; |
||
94 | |||
95 | const system_question_address = 'address'; |
||
96 | |||
97 | const system_question_address2 = 'address2'; |
||
98 | |||
99 | const system_question_city = 'city'; |
||
100 | |||
101 | const system_question_state = 'state'; |
||
102 | |||
103 | const system_question_country = 'country'; |
||
104 | |||
105 | const system_question_zip = 'zip'; |
||
106 | |||
107 | const system_question_phone = 'phone'; |
||
108 | |||
109 | /** |
||
110 | * Keys are all the EEM_Attendee::system_question_* constants, which are |
||
111 | * also all the values of QST_system in the questions table, and values |
||
112 | * are their corresponding Attendee field names |
||
113 | * |
||
114 | * @var array |
||
115 | */ |
||
116 | protected $_system_question_to_attendee_field_name = array( |
||
117 | EEM_Attendee::system_question_fname => 'ATT_fname', |
||
118 | EEM_Attendee::system_question_lname => 'ATT_lname', |
||
119 | EEM_Attendee::system_question_email => 'ATT_email', |
||
120 | EEM_Attendee::system_question_address => 'ATT_address', |
||
121 | EEM_Attendee::system_question_address2 => 'ATT_address2', |
||
122 | EEM_Attendee::system_question_city => 'ATT_city', |
||
123 | EEM_Attendee::system_question_state => 'STA_ID', |
||
124 | EEM_Attendee::system_question_country => 'CNT_ISO', |
||
125 | EEM_Attendee::system_question_zip => 'ATT_zip', |
||
126 | EEM_Attendee::system_question_phone => 'ATT_phone', |
||
127 | ); |
||
128 | |||
129 | |||
130 | |||
131 | /** |
||
132 | * EEM_Attendee constructor. |
||
133 | * |
||
134 | * @param null $timezone |
||
135 | * @throws EE_Error |
||
136 | */ |
||
137 | protected function __construct($timezone = null) |
||
297 | |||
298 | |||
299 | |||
300 | /** |
||
301 | * Gets the name of the field on the attendee model corresponding to the system question string |
||
302 | * which should be one of the keys from EEM_Attendee::_system_question_to_attendee_field_name |
||
303 | * |
||
304 | * @param string $system_question_string |
||
305 | * @return string|null if not found |
||
306 | */ |
||
307 | public function get_attendee_field_for_system_question($system_question_string) |
||
313 | |||
314 | |||
315 | |||
316 | /** |
||
317 | * Gets mapping from esp_question.QST_system values to their corresponding attendee field names |
||
318 | * |
||
319 | * @return array |
||
320 | */ |
||
321 | public function system_question_to_attendee_field_mapping() |
||
325 | |||
326 | |||
327 | |||
328 | /** |
||
329 | * Gets all the attendees for a transaction (by using the esp_registration as a join table) |
||
330 | * |
||
331 | * @param EE_Transaction /int $transaction_id_or_obj EE_Transaction or its ID |
||
332 | * @return EE_Attendee[]|EE_Base_Class[] |
||
333 | * @throws EE_Error |
||
334 | */ |
||
335 | public function get_attendees_for_transaction($transaction_id_or_obj) |
||
347 | |||
348 | |||
349 | |||
350 | /** |
||
351 | * retrieve a single attendee from db via their ID |
||
352 | * |
||
353 | * @param $ATT_ID |
||
354 | * @return mixed array on success, FALSE on fail |
||
355 | * @deprecated |
||
356 | */ |
||
357 | public function get_attendee_by_ID($ATT_ID = false) |
||
362 | |||
363 | |||
364 | |||
365 | /** |
||
366 | * retrieve a single attendee from db via their ID |
||
367 | * |
||
368 | * @param array $where_cols_n_values |
||
369 | * @return mixed array on success, FALSE on fail |
||
370 | * @throws EE_Error |
||
371 | */ |
||
372 | public function get_attendee($where_cols_n_values = array()) |
||
383 | |||
384 | |||
385 | |||
386 | /** |
||
387 | * Search for an existing Attendee record in the DB |
||
388 | * |
||
389 | * @param array $where_cols_n_values |
||
390 | * @return bool|mixed |
||
391 | * @throws EE_Error |
||
392 | */ |
||
393 | public function find_existing_attendee($where_cols_n_values = null) |
||
424 | |||
425 | |||
426 | |||
427 | /** |
||
428 | * Takes an incoming array of EE_Registration ids |
||
429 | * and sends back a list of corresponding non duplicate EE_Attendee objects. |
||
430 | * |
||
431 | * @since 4.3.0 |
||
432 | * @param array $ids array of EE_Registration ids |
||
433 | * @return EE_Attendee[]|EE_Base_Class[] |
||
434 | * @throws EE_Error |
||
435 | */ |
||
436 | public function get_array_of_contacts_from_reg_ids($ids) |
||
444 | |||
445 | |||
446 | } |
||
447 | // End of file EEM_Attendee.model.php |
||
449 |