aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/booking/index.php
blob: 3e004ecf2b55d296c0b095033326ec83f2186406 (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<? if ($booking): ?>
    <? if ($user_has_user_perms): ?>
        <p>
            <?= sprintf(
                _('Letzte Änderung am %s'),
                date('d.m.Y', $booking->chdate)
            ) ?>
        </p>
    <? endif ?>
    <h3><?= _('Gebuchte Ressource') ?></h3>
    <? $derived_resource = $booking->resource
                         ? $booking->resource->getDerivedClassInstance()
                         : null ?>
    <?= $derived_resource
      ? $derived_resource->getFullName()
      : _('unbekannt') ?>

    <h3><?= _('Zeiträume') ?></h3>
    <?
    $cycle_date = $booking->assigned_course_date->cycle;
    $booking_has_metadate = ($cycle_date instanceof SeminarCycleDate);
    ?>
    <? $intervals = $booking->getTimeIntervals() ?>
    <? if (count($intervals) == 1) : ?>
        <div>
            <?= $intervals[0] ?>
        </div>
        <? if ($booking_has_metadate) :?>
        <div><?= _('Diese Buchung ist Teil der folgenden Terminserie:') ?></div>
        <?= htmlReady($cycle_date->toString('full')) ?>
        <? endif ?>
    <? elseif ($intervals): ?>
        <ul>
            <? foreach ($intervals as $interval): ?>
                <li>
                    <?= $interval ?>
                </li>
            <? endforeach ?>
        </ul>
    <? else: ?>
        <?= _('Nicht verfügbar') ?>
    <? endif ?>

    <? if ($booking->booking_type == '2'): ?>
        <? if ($user_has_user_perms): ?>
            <h3><?= _('Gesperrt für:') ?></h3>
            <?= htmlReady($booking->getAssignedUserName()) ?>
        <? endif ?>
        <h3><?= _('Sperrung vorgenommen von:') ?></h3>
        <?= $booking->booking_user
          ? htmlReady($booking->booking_user->getFullName())
          : _('unbekannt') ?>
    <? elseif ($booking->booking_type == '1'): ?>
        <? if ($user_has_user_perms): ?>
            <h3><?= _('Reserviert für:') ?></h3>
            <?= htmlReady($booking->getAssignedUserName()) ?>
        <? endif ?>
        <h3><?= _('Reservierung vorgenommen von:') ?></h3>
        <?= $booking->booking_user
          ? htmlReady($booking->booking_user->getFullName())
          : _('unbekannt') ?>
    <? else: ?>
        <? if ($user_has_user_perms): ?>
            <h3><?= _('Gebucht von:') ?></h3>
            <? if ($booking->booking_user) :?>
                <a href="<?= URLHelper::getScriptLink(
                         'dispatch.php/profile',
                         ['username' => $booking->booking_user->username]
                         ) ?>">
                <?= htmlReady($booking->booking_user->getFullName()) ?>
                </a>
                <a href="<?= URLHelper::getScriptLink(
                         'dispatch.php/messages/write',
                         ['rec_uname' => $booking->booking_user->username]
                         ) ?>" data-dialog="size=auto">
                <?= Icon::create('mail')->asImg(20, ['class' => 'text-bottom']) ?>
                </a>
            <? else :?>
                <?= _('unbekannt') ?>
            <? endif ?>
        <? endif ?>
    <? endif ?>
    <? if ($user_may_see_course_data): ?>
        <h3><?= _('Gebucht für:') ?></h3>
        <a href="<?= URLHelper::getLink(
                 'dispatch.php/course/details/index/'
                 . $booking->getAssignedUser()->id
                 ) ?>" target="_blank">
            <?= htmlReady($booking->getAssignedUserName(), true, true) ?>
            <?= Icon::create(
                'link-intern',
                Icon::ROLE_CLICKABLE,
                [
                    'title' => _('Veranstaltungsdetails anzeigen'),
                    'class' => 'text-bottom'
                ]
            ) ?>
        </a>
        <? if (Seminar_Perm::get()->have_studip_perm('dozent', $booking->getAssignedUser()->id)): ?>
            <div>
                <a href="<?= URLHelper::getLink('dispatch.php/course/timesrooms', [ 'cid' => $booking->getAssignedUser()->id]) ?>">
                    <?=_('Verwaltung von Zeiten und Räumen')?>
                    <?= Icon::create(
                        'schedule',
                        Icon::ROLE_CLICKABLE,
                        [
                            'title' => _('Verwaltung von Zeiten und Räumen'),
                            'class' => 'text-bottom'
                        ]) ?>
                </a>
            </div>
        <? endif ?>
    <? elseif ($booking->getAssignedUserType() === 'user') : ?>
        <? if (($booking->assigned_user->visible == 'yes') ||
               ($booking->assigned_user->id == $GLOBALS['user']->id) ||
               $user_has_user_perms) : ?>
            <h3><?= _('Gebucht für:') ?></h3>
            <a href="<?= URLHelper::getScriptLink(
                     'dispatch.php/profile',
                     ['username' => $booking->assigned_user->username]
                     ) ?>">
                <?= htmlReady($booking->assigned_user->getFullName()) ?>
            </a>
            <a href="<?= URLHelper::getScriptLink(
                     'dispatch.php/messages/write',
                     ['rec_uname' => $booking->assigned_user->username]
                     ) ?>" data-dialog="size=auto">
                <?= Icon::create('mail')->asImg(20, ['class' => 'text-bottom']) ?>
            </a>
        <? endif ?>
    <? else : ?>
        <?= htmlReady($booking->description) ?>
    <? endif ?>
    <? if ($make_comment_editable): ?>
        <form class="default" method="post"
              action="<?= htmlReady(
                      $controller->link_for('resources/booking/index/' . $booking->id)
                      ) ?>" data-dialog="reload-on-close">
            <?= CSRFProtection::tokenTag() ?>
    <? endif ?>
    <? if ($show_internal_comment): ?>
        <h3><?= _('Interner Kommentar zur Buchung') ?>:</h3>
        <? if ($make_comment_editable): ?>
            <textarea name="internal_comment"><?= htmlReady($booking->internal_comment) ?></textarea>
        <? else: ?>
            <?= htmlReady($booking->internal_comment) ?>
        <? endif ?>
    <? endif ?>
    <? if ((Request::isDialog() || $make_comment_editable) && !$hide_buttons): ?>
        <div data-dialog-button>
            <? if ($make_comment_editable): ?>
                <?= \Studip\Button::create(_('Speichern'), 'save') ?>
                <? if (!$booking->isReadOnlyForUser($current_user)): ?>
                    <?= \Studip\LinkButton::create(
                        _('Bearbeiten'),
                        $controller->url_for('resources/booking/edit/' . $booking->id),
                        [
                            'data-dialog' => '1'
                        ]
                    ) ?>
                    <?= \Studip\LinkButton::create(
                        _('Löschen'),
                        $controller->url_for('resources/booking/delete/' . $booking->id),
                        [
                            'data-dialog' => '1'
                        ]
                    ) ?>
                <? endif ?>
            <? endif ?>
        </div>
    <? endif ?>
    <? if ($make_comment_editable): ?>
        </form>
    <? endif ?>
<? endif ?>