blob: 2c792f85ee77f9de9d5fbe96126416088f9883aa (
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
60
|
<?php
namespace bdrem;
class Renderer_HtmlTable extends Renderer
{
protected $httpContentType = 'text/html; charset=utf-8';
public function render($arEvents)
{
$s = <<<HTM
<table>
<thead>
<tr>
<th colspan="2">Days</th>
<th>Age</th>
<th>Event</th>
<th>Name</th>
<th>Date</th>
<th>Day</th>
</tr>
</thead>
<tbody>
HTM;
foreach ($arEvents as $event) {
$class = 'd' . $event->days;
if ($event->days < 0) {
$class .= ' prev';
} else if ($event->days == 0) {
$class .= ' today';
} else {
$class .= ' next';
}
$s .= sprintf(
'<tr class="' . trim($class) . '">'
. '<td class="icon"></td>'
. '<td class="r">%d</td>'
. '<td class="r">%s</td>'
. '<td>%s</td>'
. '<td>%s</td>'
. '<td>%s</td>'
. '<td>%s</td>'
. "</tr>\n",
$event->days,
$event->age,
htmlspecialchars($event->title),
htmlspecialchars($event->type),
$this->getLocalDate($event->date),
strftime('%a', strtotime($event->localDate))
);
}
$s .= <<<HTM
</tbody>
</table>
HTM;
return $s;
}
}
?>
|