|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* CheckInForm.php |
|
4
|
|
|
* |
|
5
|
|
|
* @author Bram de Leeuw |
|
6
|
|
|
* Date: 07/04/17 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Broarm\EventTickets; |
|
10
|
|
|
|
|
11
|
|
|
use FieldList; |
|
12
|
|
|
use Form; |
|
13
|
|
|
use FormAction; |
|
14
|
|
|
use RequiredFields; |
|
15
|
|
|
use TextField; |
|
16
|
|
|
|
|
17
|
|
|
class WaitingListRegistrationForm extends Form |
|
18
|
|
|
{ |
|
19
|
|
|
public function __construct($controller, $name = 'CheckInForm') |
|
20
|
|
|
{ |
|
21
|
|
|
$fields = FieldList::create( |
|
22
|
|
|
TextField::create('Title', _t('WaitingListRegistration.Name', 'Name')), |
|
23
|
|
|
TextField::create('Email', _t('WaitingListRegistration.Email', 'Email')), |
|
24
|
|
|
TextField::create('Telephone', _t('WaitingListRegistration.Telephone', 'Telephone')) |
|
25
|
|
|
); |
|
26
|
|
|
|
|
27
|
|
|
$actions = FieldList::create( |
|
28
|
|
|
FormAction::create('doRegister', _t('WaitingListRegistrationForm.REGISTER', 'Register')) |
|
29
|
|
|
); |
|
30
|
|
|
|
|
31
|
|
|
$required = new RequiredFields(array('Title', 'Email')); |
|
32
|
|
|
|
|
33
|
|
|
parent::__construct($controller, $name, $fields, $actions, $required); |
|
34
|
|
|
$this->extend('updateWaitingListRegistrationForm'); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Sets the person on the waiting list |
|
39
|
|
|
* |
|
40
|
|
|
* @param $data |
|
41
|
|
|
* @param WaitingListRegistrationForm $form |
|
42
|
|
|
*/ |
|
43
|
|
|
public function doRegister($data, WaitingListRegistrationForm $form) |
|
|
|
|
|
|
44
|
|
|
{ |
|
45
|
|
|
$form->saveInto($registration = WaitingListRegistration::create()); |
|
46
|
|
|
$registration->EventID = $this->getController()->ID; |
|
|
|
|
|
|
47
|
|
|
$this->getController()->WaitingList()->add($registration); |
|
48
|
|
|
$this->getController()->redirect($this->getController()->Link('?waitinglist=1')); |
|
|
|
|
|
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
} |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.