1 | <?php |
||
57 | class Attendee extends DataObject |
||
58 | { |
||
59 | /** |
||
60 | * Set this to true when you want to have a QR code that opens the check in page and validates the code. |
||
61 | * The validation is only done with proper authorisation so guest cannot check themselves in by mistake. |
||
62 | * By default only the ticket number is translated to an QR code. (for use with USB QR scanners) |
||
63 | * |
||
64 | * @var bool |
||
65 | */ |
||
66 | private static $qr_as_link = false; |
||
1 ignored issue
–
show
|
|||
67 | |||
68 | private static $savable_fields = array( |
||
69 | 'FirstName' => 'TextField', |
||
70 | 'Surname' => 'TextField', |
||
71 | 'Email' => 'EmailField', |
||
72 | ); |
||
73 | |||
74 | private static $table_fields = array( |
||
1 ignored issue
–
show
|
|||
75 | 'Title', |
||
76 | 'Email' |
||
77 | ); |
||
78 | |||
79 | private static $db = array( |
||
1 ignored issue
–
show
|
|||
80 | 'Title' => 'Varchar(255)', |
||
81 | 'FirstName' => 'Varchar(255)', |
||
82 | 'Surname' => 'Varchar(255)', |
||
83 | 'Email' => 'Varchar(255)', |
||
84 | 'TicketReceiver' => 'Boolean', |
||
85 | 'TicketCode' => 'Varchar(255)', |
||
86 | 'CheckedIn' => 'Boolean' |
||
87 | ); |
||
88 | |||
89 | private static $indexes = array( |
||
90 | 'TicketCode' => 'unique("TicketCode")' |
||
91 | ); |
||
92 | |||
93 | private static $has_one = array( |
||
2 ignored issues
–
show
|
|||
94 | 'Reservation' => 'Broarm\EventTickets\Reservation', |
||
95 | 'Ticket' => 'Broarm\EventTickets\Ticket', |
||
96 | 'Event' => 'CalendarEvent', |
||
97 | 'Member' => 'Member', |
||
98 | 'TicketQRCode' => 'Image', |
||
99 | 'TicketFile' => 'File' |
||
100 | ); |
||
101 | |||
102 | private static $summary_fields = array( |
||
1 ignored issue
–
show
|
|||
103 | 'Title' => 'Name', |
||
104 | 'Email' => 'Email', |
||
105 | 'TicketCode' => 'Ticket', |
||
106 | 'CheckedInSummary' => 'Checked in', |
||
107 | ); |
||
108 | |||
109 | public function getCMSFields() |
||
128 | |||
129 | /** |
||
130 | * Set the title and ticket code before writing |
||
131 | */ |
||
132 | public function onBeforeWrite() |
||
144 | |||
145 | /** |
||
146 | * Delete any stray files before deleting the object |
||
147 | */ |
||
148 | public function onBeforeDelete() |
||
163 | |||
164 | /** |
||
165 | * Get the table fields for this attendee |
||
166 | * |
||
167 | * @return ArrayList |
||
168 | */ |
||
169 | public function getTableFields() |
||
180 | |||
181 | /** |
||
182 | * Get the unnamespaced singular name for display in the CMS |
||
183 | * |
||
184 | * @return string |
||
185 | */ |
||
186 | public function singular_name() |
||
191 | |||
192 | /** |
||
193 | * Get the combined first and last nave for dispay on the ticket and attendee list |
||
194 | * |
||
195 | * @return string |
||
196 | */ |
||
197 | public function getName() |
||
207 | |||
208 | /** |
||
209 | * Return the checked in state for use in grid fields |
||
210 | * |
||
211 | * @return LiteralField |
||
212 | */ |
||
213 | public function getCheckedInSummary() |
||
222 | |||
223 | /** |
||
224 | * Generate a unique ticket id |
||
225 | * Serves as the base for the QR code and ticket file |
||
226 | * |
||
227 | * @return string |
||
228 | */ |
||
229 | public function generateTicketCode() |
||
233 | |||
234 | /** |
||
235 | * Create a QRCode for the attendee based on the Ticket code |
||
236 | * |
||
237 | * @param Folder $folder |
||
238 | * |
||
239 | * @return Image |
||
240 | */ |
||
241 | public function createQRCode(Folder $folder) |
||
273 | |||
274 | /** |
||
275 | * Creates a printable ticket for the attendee |
||
276 | * |
||
277 | * @param Folder $folder |
||
278 | * |
||
279 | * @return File |
||
280 | */ |
||
281 | public function createTicketFile(Folder $folder) |
||
316 | |||
317 | public function canView($member = null) |
||
321 | |||
322 | public function canEdit($member = null) |
||
326 | |||
327 | public function canDelete($member = null) |
||
331 | |||
332 | public function canCreate($member = null) |
||
336 | } |
||
337 |
This check marks private properties in classes that are never used. Those properties can be removed.