blob: ea6150ba834b57d72b3858406cfaefccba7c00d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
class EventList extends UrlBasedCalendarControl {
private function _setDate(string $key, string $date) {
$datetime = new DateTime($date, new DateTimeZone('UTC'));
if (!$datetime) {
throw new TInvalidDataValueException(
Prado::localize('Invalid date string: {date}',
['date' => $date])
);
}
$this->setViewState($key, $datetime);
}
public function setDateFrom($date) {
$this->_setDate('DateFrom', TPropertyValue::ensureString($date));
}
public function getDateFrom() {
return $this->getViewState('DateFrom');
}
public function setDateTo($date) {
$this->_setDate('DateTo', TPropertyValue::ensureString($date));
}
public function getDateTo() {
return $this->getViewState('DateTo');
}
public function setHeaderText($text) {
$this->setViewState('HeaderText', TPropertyValue::ensureString($text));
}
public function getHeaderText() {
return $this->getViewState('HeaderText');
}
public function setReverse($value) {
$this->setViewState('Reverse', TPropertyValue::ensureBoolean($value));
}
public function getReverse() {
return $this->getViewState('Reverse');
}
public function getEvents() {
return $this->getFacade()->getEventsForTimeframe(
$this->getCalendar(),
$this->getDateFrom() ?: new DateTime('0000-00-00'),
$this->getDateTo() ?: new DateTime('9999-99-99'),
$this->getReverse() ? 'DESC' : 'ASC'
);
}
}
?>
|