1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WaitingListRegistration.php |
4
|
|
|
* |
5
|
|
|
* @author Bram de Leeuw |
6
|
|
|
* Date: 09/05/17 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Broarm\EventTickets; |
10
|
|
|
|
11
|
|
|
use DataObject; |
12
|
|
|
use FieldList; |
13
|
|
|
use ReadonlyField; |
14
|
|
|
use Tab; |
15
|
|
|
use TabSet; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class WaitingListRegistration |
19
|
|
|
* |
20
|
|
|
* @package Broarm\EventTickets |
21
|
|
|
* |
22
|
|
|
* @property string Title |
23
|
|
|
* @property string Email |
24
|
|
|
* @property string Telephone |
25
|
|
|
* |
26
|
|
|
* @method \CalendarEvent Event |
27
|
|
|
*/ |
28
|
|
|
class WaitingListRegistration extends DataObject |
29
|
|
|
{ |
30
|
|
|
private static $db = array( |
|
|
|
|
31
|
|
|
'Title' => 'Varchar(255)', |
32
|
|
|
'Email' => 'Varchar(255)', |
33
|
|
|
'Telephone' => 'Varchar(255)' |
34
|
|
|
); |
35
|
|
|
|
36
|
|
|
private static $has_one = array( |
|
|
|
|
37
|
|
|
'Event' => 'CalendarEvent' |
38
|
|
|
); |
39
|
|
|
|
40
|
|
|
private static $summary_fields = array( |
|
|
|
|
41
|
|
|
'Title' => 'Name', |
42
|
|
|
'Email' => 'Email', |
43
|
|
|
'Telephone' => 'Telephone' |
44
|
|
|
); |
45
|
|
|
|
46
|
|
|
public function getCMSFields() |
47
|
|
|
{ |
48
|
|
|
$fields = new FieldList(new TabSet('Root', $mainTab = new Tab('Main'))); |
49
|
|
|
$fields->addFieldsToTab('Root.Main', array( |
50
|
|
|
ReadonlyField::create('Title', _t('WaitingListRegistration.Name', 'Name')), |
51
|
|
|
ReadonlyField::create('Email', _t('WaitingListRegistration.Email', 'Email')), |
52
|
|
|
ReadonlyField::create('Telephone', _t('WaitingListRegistration.Telephone', 'Telephone')) |
53
|
|
|
)); |
54
|
|
|
|
55
|
|
|
$fields->addFieldsToTab('Root.Main', array()); |
56
|
|
|
$this->extend('updateCMSFields', $fields); |
57
|
|
|
return $fields; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Returns the singular name without the namespaces |
62
|
|
|
* |
63
|
|
|
* @return string |
64
|
|
|
*/ |
65
|
|
|
public function singular_name() |
66
|
|
|
{ |
67
|
|
|
$name = explode('\\', parent::singular_name()); |
68
|
|
|
return trim(end($name)); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function canView($member = null) |
|
|
|
|
72
|
|
|
{ |
73
|
|
|
return $this->Event()->canView($member); |
|
|
|
|
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function canEdit($member = null) |
|
|
|
|
77
|
|
|
{ |
78
|
|
|
return $this->Event()->canEdit($member); |
|
|
|
|
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function canDelete($member = null) |
|
|
|
|
82
|
|
|
{ |
83
|
|
|
return $this->Event()->canDelete($member); |
|
|
|
|
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function canCreate($member = null) |
|
|
|
|
87
|
|
|
{ |
88
|
|
|
return $this->Event()->canCreate($member); |
|
|
|
|
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|