aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/admin/booking_log.php
blob: 70d3c1d1c48d2846ef02b48c0ec7834cc6f838cb (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
<? if ($bookings): ?>
    <table class="default">
        <caption>
            <? if ($show_all_records): ?>
                <? if ($resource): ?>
                    <?= sprintf(
                        _('%1$s: Alle Buchungen von %2$s'),
                        htmlReady($resource->getFullName()),
                        htmlReady($user->getFullName())
                    ) ?>
                <? else: ?>
                    <?= sprintf(
                        _('Alle Buchungen von %s'),
                        htmlReady($user->getFullName())
                    ) ?>
                <? endif ?>
            <? else: ?>
                <? if ($resource): ?>
                    <?= sprintf(
                        _('%1$s: Aktuelle und zukünftige Buchungen von %2$s'),
                        htmlReady($resource->getFullName()),
                        htmlReady($user->getFullName())
                    ) ?>
                <? else: ?>
                    <?= sprintf(
                        _('Aktuelle und zukünftige Buchungen von %s'),
                        htmlReady($user->getFullName())
                    ) ?>
                <? endif ?>
            <? endif ?>
        </caption>
        <thead>
            <tr>
                <th><?= _('Buchungszeiträume') ?></th>
                <th><?= _('Interner Kommentar') ?></th>
            </tr>
        </thead>
        <tbody>
            <? foreach ($bookings as $booking): ?>
                <tr>
                    <td>
                        <? $intervals = $booking->getTimeIntervals() ?>
                        <? if ($intervals): ?>
                            <ul class="default">
                                <? foreach ($intervals as $interval): ?>
                                    <li>
                                        <?= date('d.m.Y H:i', $interval->begin) ?>
                                        -
                                        <?= date('d.m.Y H:i', $interval->end) ?>
                                    </li>
                                <? endforeach ?>
                            </ul>
                        <? else: ?>
                            <?= date('d.m.Y H:i', $booking->begin) ?>
                            -
                            <?= date('d.m.Y H:i', $booking->end) ?>
                        <? endif ?>
                    </td>
                    <td>
                        <?= htmlReady($booking->internal_comment) ?>
                    </td>
                </tr>
            <? endforeach ?>
        </tbody>
    </table>
<? else: ?>
    <?= MessageBox::info(
        _('Es liegen keine Buchungen vor!')
    ) ?>
<? endif ?>
<div data-dialog-button>
    <? if ($show_all_records): ?>
        <?= \Studip\LinkButton::create(
            _('Nur aktuelle und zukünftige Buchungen anzeigen'),
            URLHelper::getURL(
                'dispatch.php/resources/admin/booking_log/' . $user->id
              . ($resource
               ? '/' . $resource->id
               : ''
              )
            ),
            [
                'data-dialog' => '1'
            ]
        ) ?>
    <? else: ?>
        <?= \Studip\LinkButton::create(
            _('Auch stattgefundene Buchungen anzeigen'),
            URLHelper::getURL(
                'dispatch.php/resources/admin/booking_log/' . $user->id
              . ($resource
               ? '/' . $resource->id
               : ''
              ),
                [
                    'show_all_records' => '1'
                ]
            ),
            [
                'data-dialog' => '1'
            ]
        ) ?>
    <? endif ?>
</div>