1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class CalendarDayView extends CalendarAbstractTimeView |
|
|
|
|
4
|
|
|
{ |
5
|
|
|
|
6
|
|
|
// Abstract Functions Implemented |
7
|
|
|
|
8
|
|
|
public function init() |
9
|
|
|
{ |
10
|
|
|
parent::init(); |
11
|
|
|
$this->containerClass = 'dayView'; |
12
|
|
|
$this->innerClass = 'day'; |
13
|
|
|
$this->viewTitle = 'return date(\'l jS F Y\', $date);'; |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
public function prevLinkParams(Calendar $calendar) |
17
|
|
|
{ |
18
|
|
|
$date = mktime(0, 0, 0, $calendar->getMonth(), $calendar->getDay() - $this->number, $calendar->getYear()); |
19
|
|
|
return $this->getLinkParams($date); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function nextLinkParams(Calendar $calendar) |
23
|
|
|
{ |
24
|
|
|
$date = mktime(0, 0, 0, $calendar->getMonth(), $calendar->getDay() + $this->number, $calendar->getYear()); |
25
|
|
|
return $this->getLinkParams($date); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function title() |
|
|
|
|
29
|
|
|
{ |
30
|
|
|
return $this->number == 1 ? 'day' : "$this->number days"; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function Dates(Calendar $calendar) |
34
|
|
|
{ |
35
|
|
|
$year = $calendar->getYear(); |
36
|
|
|
$month = $calendar->getMonth(); |
37
|
|
|
$day = $calendar->getDay(); |
38
|
|
|
|
39
|
|
|
for ($i = 0; $i < $this->number; $i++) { |
40
|
|
|
if ($i == 0) { |
41
|
|
|
$lastDate = mktime(0, 0, 0, $month, $day, $year); |
42
|
|
|
} else { |
43
|
|
|
$lastDate = mktime(0, 0, 0, date('n', $lastDate), date('j', $lastDate) + 1, date('Y', $lastDate)); |
|
|
|
|
44
|
|
|
} |
45
|
|
|
$datesGroups[] = array($lastDate); |
|
|
|
|
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
return $datesGroups; |
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getCustomisedTitle($day, $month, $year) |
|
|
|
|
52
|
|
|
{ |
53
|
|
|
$date = mktime(0, 0, 0, $month, $day, $year); |
|
|
|
|
54
|
|
|
$result = eval($this->viewTitle); |
|
|
|
|
55
|
|
|
if ($this->number > 1) { |
56
|
|
|
$date = mktime(0, 0, 0, $month, $day + $this->number - 1, $year); |
|
|
|
|
57
|
|
|
$result .= $this->viewTitleDelimiter . eval($this->viewTitle); |
|
|
|
|
58
|
|
|
} |
59
|
|
|
return $result; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.