aboutsummaryrefslogtreecommitdiff
path: root/app/views/consultation/export/print.php
blob: 71cb1ab9cd0ba9ada87259d45da038f6416417dd (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title><?= _('Terminliste') ?></title>
    <style>
    body {
        padding: 0;
        font-family: Arial, Helvetica, sans-serif;
    }
    body:not(.extended) .reason {
        display: none;
    }
    h1 {
        font-weight: bold;
        font-size: 20pt;
        padding-bottom: 3pt;
        border-bottom: 1pt solid #000000;
        margin-bottom: 1em;
    }
    h1::after {
        clear: right;
    }
    a {
        text-decoration: none;
        color: #000000;
    }
    table {
        border: 1px solid #000000;
        border-collapse: collapse;
        border-spacing: 0;
        width: 100%;
    }
    caption {
        text-align: left;
    }
    td, th {
        border: 1px solid #000000;
        padding: 0.5em 1em;
    }
    th, td:nth-child(1), td:nth-child(2) {
        text-align: center;
        white-space: nowrap;
    }
    ul {
        margin: 0;
        padding: 0;
    }
    ul li:only-child {
        list-style: none;
    }
    #toggle {
        float: right;
    }
    </style>
    <style media="print">
    #toggle {
        display: none;
    }
    </style>
</head>
<body id="body">
    <h1>
        <button id="toggle">
            <?= _('Grund anzeigen / verbergen') ?>
        </button>

        <?= sprintf(
            _('Terminliste von %s'),
            htmlReady($range->getFullName())
        ) ?>
    </h1>
<? foreach ($blocks as $block): ?>
    <table>
        <caption>
            <h2>
                <?= _('Termin') ?>:
                <?= strftime('%A, %x', $block->start) ?>
                (<?= htmlReady($block->room) ?>)
            </h2>
        </caption>
        <colgroup>
            <col width="20%">
            <col>
            <col width="50%" class="reason">
        </colgroup>
        <thead>
            <tr>
                <th><?= _('Zeit') ?></th>
                <th>
                <? if ($block->size > 1): ?>
                    <?= _('Person(en)') ?>
                <? else: ?>
                    <?= _('Person') ?>
                <? endif; ?>
                </th>
                <th class="reason"><?= _('Grund') ?></th>
            </tr>
        </thead>
        <tbody>
        <? foreach ($block->slots as $slot): ?>
            <tr>
                <td>
                    <?= implode(' - ', [
                        date('H:i', $slot->start_time),
                        date('H:i', $slot->end_time)
                    ]) ?>
                </td>
                <td>
                <? if (count($slot->bookings) > 0): ?>
                    <ul>
                    <? foreach ($slot->bookings as $booking): ?>
                        <? if ($booking->user): ?>
                            <li><?= htmlReady($booking->user->getFullName()) ?></li>
                        <? endif; ?>
                    <? endforeach; ?>
                    </ul>
                <? else: ?>
                    &ndash;
                <? endif; ?>
                </td>
                <td class="reason">
                <? if (count($slot->bookings) > 0): ?>
                    <ul>
                    <? foreach ($slot->bookings as $booking): ?>
                        <li><?= htmlReady($booking->reason) ?></li>
                    <? endforeach; ?>
                    </ul>
                <? else: ?>
                    &ndash;
                <? endif; ?>
                </td>
            </tr>
        <? endforeach; ?>
        </tbody>
    </table>
<? endforeach; ?>

    <script>
    document.getElementById('toggle').addEventListener('click', function (event) {
        document.getElementById('body').classList.toggle('extended');
        event.preventDefault();
    }, false);
    </script>
</body>
</html>