1 | <?php |
||
36 | class Ticket extends DataObject |
||
37 | { |
||
38 | /** |
||
39 | * The default sale start date |
||
40 | * This defaults to the event start date '-1 week' |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | private static $sale_start_threshold = '-1 week'; |
||
|
|||
45 | |||
46 | private static $db = array( |
||
47 | 'Title' => 'Varchar(255)', |
||
48 | 'Price' => 'Currency', |
||
49 | 'AvailableFromDate' => 'Date', |
||
50 | 'AvailableTillDate' => 'Date', |
||
51 | 'Sort' => 'Int' |
||
52 | ); |
||
53 | |||
54 | private static $default_sort = 'Sort ASC, AvailableFromDate DESC'; |
||
55 | |||
56 | private static $has_one = array( |
||
57 | 'Event' => 'CalendarEvent' |
||
58 | ); |
||
59 | |||
60 | private static $summary_fields = array( |
||
61 | 'Title' => 'Title', |
||
62 | 'Price.NiceDecimalPoint' => 'Price', |
||
63 | 'AvailableFrom' => 'Available from', |
||
64 | 'AvailableTill' => 'Available till', |
||
65 | 'AvailableSummary' => 'Available' |
||
66 | ); |
||
67 | |||
68 | private static $translate = array(); |
||
69 | |||
70 | public function getCMSFields() |
||
99 | |||
100 | public function singular_name() |
||
105 | |||
106 | /** |
||
107 | * Get the formatted price |
||
108 | * @deprecated Use the "Price.NiceDecimalPoint" method instead |
||
109 | * |
||
110 | * @return string |
||
111 | * / |
||
112 | public function getPriceNice() |
||
113 | { |
||
114 | return $this->dbObject('Price')->NiceDecimalPoint(); |
||
115 | }*/ |
||
116 | |||
117 | /** |
||
118 | * Get the available form date if it is set, |
||
119 | * otherwise get it from the parent |
||
120 | * |
||
121 | * @return \SS_DateTime|Date|\DBField|null |
||
122 | */ |
||
123 | public function getAvailableFrom() |
||
135 | |||
136 | /** |
||
137 | * Get the available till date if it is set, |
||
138 | * otherwise get it from the parent |
||
139 | * Use the event start date as last sale possibility |
||
140 | * |
||
141 | * @return \SS_DateTime|Date|\DBField|null |
||
142 | */ |
||
143 | public function getAvailableTill() |
||
153 | |||
154 | /** |
||
155 | * Validate if the start and end date are in the past and the future |
||
156 | * |
||
157 | * @return bool |
||
158 | */ |
||
159 | private function validateDate() |
||
169 | |||
170 | /** |
||
171 | * Validate the available capacity |
||
172 | * |
||
173 | * @return bool |
||
174 | */ |
||
175 | private function validateAvailability() |
||
179 | |||
180 | /** |
||
181 | * Return if the ticket is available or not |
||
182 | * |
||
183 | * @return bool |
||
184 | */ |
||
185 | public function getAvailable() |
||
195 | |||
196 | /** |
||
197 | * Return availability for use in grid fields |
||
198 | * |
||
199 | * @return LiteralField |
||
200 | */ |
||
201 | public function getAvailableSummary() |
||
209 | |||
210 | /** |
||
211 | * Get the event start date |
||
212 | * |
||
213 | * @return Date |
||
214 | */ |
||
215 | private function getEventStartDate() |
||
223 | |||
224 | public function canView($member = null) |
||
228 | |||
229 | public function canEdit($member = null) |
||
233 | |||
234 | public function canDelete($member = null) |
||
238 | |||
239 | public function canCreate($member = null) |
||
243 | } |
||
244 |
This check marks private properties in classes that are never used. Those properties can be removed.