| 1 | <?php |
||
| 58 | class Attendee extends DataObject |
||
| 59 | { |
||
| 60 | /** |
||
| 61 | * Set this to true when you want to have a QR code that opens the check in page and validates the code. |
||
| 62 | * The validation is only done with proper authorisation so guest cannot check themselves in by mistake. |
||
| 63 | * By default only the ticket number is translated to an QR code. (for use with USB QR scanners) |
||
| 64 | * |
||
| 65 | * @var bool |
||
| 66 | */ |
||
| 67 | private static $qr_as_link = false; |
||
|
1 ignored issue
–
show
|
|||
| 68 | |||
| 69 | private static $default_fields = array( |
||
|
1 ignored issue
–
show
|
|||
| 70 | 'FirstName' => array( |
||
| 71 | 'Title' => 'First name', |
||
| 72 | 'FieldType' => 'UserTextField', |
||
| 73 | 'Required' => true, |
||
| 74 | 'Editable' => false |
||
| 75 | ), |
||
| 76 | 'Surname' => array( |
||
| 77 | 'Title' => 'Surname', |
||
| 78 | 'FieldType' => 'UserTextField', |
||
| 79 | 'Required' => true, |
||
| 80 | 'Editable' => false |
||
| 81 | ), |
||
| 82 | 'Email' => array( |
||
| 83 | 'Title' => 'Email', |
||
| 84 | 'FieldType' => 'UserEmailField', |
||
| 85 | 'Required' => true, |
||
| 86 | 'Editable' => false |
||
| 87 | ) |
||
| 88 | ); |
||
| 89 | |||
| 90 | private static $table_fields = array( |
||
|
1 ignored issue
–
show
|
|||
| 91 | 'Title', |
||
| 92 | 'Email' |
||
| 93 | ); |
||
| 94 | |||
| 95 | private static $db = array( |
||
|
2 ignored issues
–
show
|
|||
| 96 | 'Title' => 'Varchar(255)', |
||
| 97 | 'TicketReceiver' => 'Boolean', |
||
| 98 | 'TicketCode' => 'Varchar(255)', |
||
| 99 | 'CheckedIn' => 'Boolean' |
||
| 100 | ); |
||
| 101 | |||
| 102 | private static $indexes = array( |
||
| 103 | 'TicketCode' => 'unique("TicketCode")' |
||
| 104 | ); |
||
| 105 | |||
| 106 | private static $has_one = array( |
||
|
2 ignored issues
–
show
|
|||
| 107 | 'Reservation' => 'Broarm\EventTickets\Reservation', |
||
| 108 | 'Ticket' => 'Broarm\EventTickets\Ticket', |
||
| 109 | 'Event' => 'CalendarEvent', |
||
| 110 | 'Member' => 'Member', |
||
| 111 | 'TicketQRCode' => 'Image', |
||
| 112 | 'TicketFile' => 'File' |
||
| 113 | ); |
||
| 114 | |||
| 115 | private static $many_many = array( |
||
|
2 ignored issues
–
show
|
|||
| 116 | 'Fields' => 'Broarm\EventTickets\UserField' |
||
| 117 | ); |
||
| 118 | |||
| 119 | private static $many_many_extraFields = array( |
||
|
2 ignored issues
–
show
|
|||
| 120 | 'Fields' => array( |
||
| 121 | 'Value' => 'Varchar(255)' |
||
| 122 | ) |
||
| 123 | ); |
||
| 124 | |||
| 125 | private static $summary_fields = array( |
||
|
2 ignored issues
–
show
|
|||
| 126 | 'Title' => 'Name', |
||
| 127 | 'Ticket.Title' => 'Ticket', |
||
| 128 | 'TicketCode' => 'Ticket #', |
||
| 129 | 'CheckedIn.Nice' => 'Checked in', |
||
| 130 | ); |
||
| 131 | |||
| 132 | public function getCMSFields() |
||
| 161 | |||
| 162 | /** |
||
| 163 | * Utility method for fetching the default field, FirstName, value |
||
| 164 | * |
||
| 165 | * @return string |
||
| 166 | */ |
||
| 167 | public function getFirstName() |
||
| 175 | |||
| 176 | /** |
||
| 177 | * Utility method for fetching the default field, Surname, value |
||
| 178 | * |
||
| 179 | * @return string |
||
| 180 | */ |
||
| 181 | public function getSurname() |
||
| 189 | |||
| 190 | /** |
||
| 191 | * Get the combined first and last nave for display on the ticket and attendee list |
||
| 192 | * |
||
| 193 | * @return string |
||
| 194 | */ |
||
| 195 | public function getName() |
||
| 206 | |||
| 207 | /** |
||
| 208 | * Utility method for fetching the default field, Email, value |
||
| 209 | * |
||
| 210 | * @return string |
||
| 211 | */ |
||
| 212 | public function getEmail() |
||
| 220 | |||
| 221 | /** |
||
| 222 | * Set the title and ticket code before writing |
||
| 223 | */ |
||
| 224 | public function onBeforeWrite() |
||
| 236 | |||
| 237 | /** |
||
| 238 | * Delete any stray files before deleting the object |
||
| 239 | */ |
||
| 240 | public function onBeforeDelete() |
||
| 255 | |||
| 256 | /** |
||
| 257 | * Get the table fields for this attendee |
||
| 258 | * |
||
| 259 | * @return ArrayList |
||
| 260 | */ |
||
| 261 | public function getTableFields() |
||
| 272 | |||
| 273 | /** |
||
| 274 | * Get the unnamespaced singular name for display in the CMS |
||
| 275 | * |
||
| 276 | * @return string |
||
| 277 | */ |
||
| 278 | public function singular_name() |
||
| 283 | |||
| 284 | /** |
||
| 285 | * Generate a unique ticket id |
||
| 286 | * Serves as the base for the QR code and ticket file |
||
| 287 | * |
||
| 288 | * @return string |
||
| 289 | */ |
||
| 290 | public function generateTicketCode() |
||
| 294 | |||
| 295 | /** |
||
| 296 | * Create a QRCode for the attendee based on the Ticket code |
||
| 297 | * |
||
| 298 | * @param Folder $folder |
||
| 299 | * |
||
| 300 | * @return Image |
||
| 301 | */ |
||
| 302 | public function createQRCode(Folder $folder) |
||
| 334 | |||
| 335 | /** |
||
| 336 | * Creates a printable ticket for the attendee |
||
| 337 | * |
||
| 338 | * @param Folder $folder |
||
| 339 | * |
||
| 340 | * @return File |
||
| 341 | */ |
||
| 342 | public function createTicketFile(Folder $folder) |
||
| 377 | |||
| 378 | /** |
||
| 379 | * Get the checkin link |
||
| 380 | * |
||
| 381 | * @return string |
||
| 382 | */ |
||
| 383 | public function getCheckInLink() |
||
| 387 | |||
| 388 | /** |
||
| 389 | * Check the attendee out |
||
| 390 | */ |
||
| 391 | public function checkIn() |
||
| 396 | |||
| 397 | public function canCheckOut() |
||
| 401 | |||
| 402 | /** |
||
| 403 | * Check the attendee in |
||
| 404 | */ |
||
| 405 | public function checkOut() |
||
| 412 | |||
| 413 | public function canView($member = null) |
||
| 417 | |||
| 418 | public function canEdit($member = null) |
||
| 422 | |||
| 423 | public function canDelete($member = null) |
||
| 427 | |||
| 428 | public function canCreate($member = null) |
||
| 432 | } |
||
| 433 |
This check marks private properties in classes that are never used. Those properties can be removed.