Skip to content
Snippets Groups Projects
Commit 6faf87e8 authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

prevent warnings in resource-bookings, fixes #4612

Closes #4612

Merge request studip/studip!3425
parent 8a25c3f1
No related branches found
No related tags found
No related merge requests found
<? if ($booking): ?> <?php
<? if ($user_has_user_perms): ?> /**
* @var ResourceBooking $booking
* @var bool $user_has_user_perms
* @var bool $user_may_see_course_data
* @var bool $make_comment_editable
* @var bool $show_internal_comment
* @var bool $hide_buttons
* @var User $current_user
* @var Resources_BookingController $controller
*/
?>
<? if (!empty($booking)): ?>
<? if (!empty($user_has_user_perms)): ?>
<p> <p>
<?= sprintf( <?= sprintf(
_('Letzte Änderung am %s'), _('Letzte Änderung am %s'),
...@@ -19,9 +31,9 @@ ...@@ -19,9 +31,9 @@
<? <?
$cycle_date = $booking->assigned_course_date->cycle; $cycle_date = $booking->assigned_course_date->cycle;
$booking_has_metadate = ($cycle_date instanceof SeminarCycleDate); $booking_has_metadate = ($cycle_date instanceof SeminarCycleDate);
$intervals = $booking->getTimeIntervals()
?> ?>
<? $intervals = $booking->getTimeIntervals() ?> <? if (count($intervals) === 1) : ?>
<? if (count($intervals) == 1) : ?>
<div> <div>
<?= $intervals[0] ?> <?= $intervals[0] ?>
</div> </div>
...@@ -29,7 +41,7 @@ ...@@ -29,7 +41,7 @@
<div><?= _('Diese Buchung ist Teil der folgenden Terminserie:') ?></div> <div><?= _('Diese Buchung ist Teil der folgenden Terminserie:') ?></div>
<?= htmlReady($cycle_date->toString('full')) ?> <?= htmlReady($cycle_date->toString('full')) ?>
<? endif ?> <? endif ?>
<? elseif ($intervals): ?> <? elseif (!empty($intervals)): ?>
<ul> <ul>
<? foreach ($intervals as $interval): ?> <? foreach ($intervals as $interval): ?>
<li> <li>
...@@ -41,8 +53,8 @@ ...@@ -41,8 +53,8 @@
<?= _('Nicht verfügbar') ?> <?= _('Nicht verfügbar') ?>
<? endif ?> <? endif ?>
<? if ($booking->booking_type == ResourceBooking::TYPE_LOCK): ?> <? if ($booking->booking_type === ResourceBooking::TYPE_LOCK): ?>
<? if ($user_has_user_perms): ?> <? if (!empty($user_has_user_perms)): ?>
<h3><?= _('Gesperrt für:') ?></h3> <h3><?= _('Gesperrt für:') ?></h3>
<?= htmlReady($booking->getAssignedUserName()) ?> <?= htmlReady($booking->getAssignedUserName()) ?>
<? endif ?> <? endif ?>
...@@ -51,7 +63,7 @@ ...@@ -51,7 +63,7 @@
? htmlReady($booking->booking_user->getFullName()) ? htmlReady($booking->booking_user->getFullName())
: _('unbekannt') ?> : _('unbekannt') ?>
<? elseif ($booking->booking_type == ResourceBooking::TYPE_RESERVATION): ?> <? elseif ($booking->booking_type == ResourceBooking::TYPE_RESERVATION): ?>
<? if ($user_has_user_perms): ?> <? if (!empty($user_has_user_perms)): ?>
<h3><?= _('Reserviert für:') ?></h3> <h3><?= _('Reserviert für:') ?></h3>
<?= htmlReady($booking->getAssignedUserName()) ?> <?= htmlReady($booking->getAssignedUserName()) ?>
<? endif ?> <? endif ?>
...@@ -60,7 +72,7 @@ ...@@ -60,7 +72,7 @@
? htmlReady($booking->booking_user->getFullName()) ? htmlReady($booking->booking_user->getFullName())
: _('unbekannt') ?> : _('unbekannt') ?>
<? else: ?> <? else: ?>
<? if ($user_has_user_perms): ?> <? if (!empty($user_has_user_perms)): ?>
<h3><?= _('Gebucht von:') ?></h3> <h3><?= _('Gebucht von:') ?></h3>
<? if ($booking->booking_user) :?> <? if ($booking->booking_user) :?>
<a href="<?= URLHelper::getScriptLink( <a href="<?= URLHelper::getScriptLink(
...@@ -73,19 +85,16 @@ ...@@ -73,19 +85,16 @@
'dispatch.php/messages/write', 'dispatch.php/messages/write',
['rec_uname' => $booking->booking_user->username] ['rec_uname' => $booking->booking_user->username]
) ?>" data-dialog="size=auto"> ) ?>" data-dialog="size=auto">
<?= Icon::create('mail')->asImg(20, ['class' => 'text-bottom']) ?> <?= Icon::create('mail')->asImg(['class' => 'text-bottom']) ?>
</a> </a>
<? else :?> <? else :?>
<?= _('unbekannt') ?> <?= _('unbekannt') ?>
<? endif ?> <? endif ?>
<? endif ?> <? endif ?>
<? endif ?> <? endif ?>
<? if ($user_may_see_course_data): ?> <? if (!empty($user_may_see_course_data)): ?>
<h3><?= _('Gebucht für:') ?></h3> <h3><?= _('Gebucht für:') ?></h3>
<a href="<?= URLHelper::getLink( <a href="<?= URLHelper::getLink('dispatch.php/course/details/index/' . $booking->getAssignedUser()->id) ?>" target="_blank">
'dispatch.php/course/details/index/'
. $booking->getAssignedUser()->id
) ?>" target="_blank">
<?= htmlReady($booking->getAssignedUserName(), true, true) ?> <?= htmlReady($booking->getAssignedUserName(), true, true) ?>
<?= Icon::create( <?= Icon::create(
'link-intern', 'link-intern',
...@@ -111,8 +120,8 @@ ...@@ -111,8 +120,8 @@
</div> </div>
<? endif ?> <? endif ?>
<? elseif ($booking->getAssignedUserType() === 'user') : ?> <? elseif ($booking->getAssignedUserType() === 'user') : ?>
<? if (($booking->assigned_user->visible == 'yes') || <? if (($booking->assigned_user->visible === 'yes') ||
($booking->assigned_user->id == $GLOBALS['user']->id) || ($booking->assigned_user->id === $GLOBALS['user']->id) ||
$user_has_user_perms) : ?> $user_has_user_perms) : ?>
<h3><?= _('Gebucht für:') ?></h3> <h3><?= _('Gebucht für:') ?></h3>
<a href="<?= URLHelper::getScriptLink( <a href="<?= URLHelper::getScriptLink(
...@@ -125,30 +134,30 @@ ...@@ -125,30 +134,30 @@
'dispatch.php/messages/write', 'dispatch.php/messages/write',
['rec_uname' => $booking->assigned_user->username] ['rec_uname' => $booking->assigned_user->username]
) ?>" data-dialog="size=auto"> ) ?>" data-dialog="size=auto">
<?= Icon::create('mail')->asImg(20, ['class' => 'text-bottom']) ?> <?= Icon::create('mail')->asImg(['class' => 'text-bottom']) ?>
</a> </a>
<? endif ?> <? endif ?>
<? else : ?> <? else : ?>
<?= htmlReady($booking->description) ?> <?= htmlReady($booking->description) ?>
<? endif ?> <? endif ?>
<? if ($make_comment_editable): ?> <? if (!empty($make_comment_editable)): ?>
<form class="default" method="post" <form class="default" method="post"
action="<?= htmlReady( action="<?= htmlReady(
$controller->link_for('resources/booking/index/' . $booking->id) $controller->link_for('resources/booking/index/' . $booking->id)
) ?>" data-dialog="reload-on-close"> ) ?>" data-dialog="reload-on-close">
<?= CSRFProtection::tokenTag() ?> <?= CSRFProtection::tokenTag() ?>
<? endif ?> <? endif ?>
<? if ($show_internal_comment): ?> <? if (!empty($show_internal_comment)): ?>
<h3><?= _('Interner Kommentar zur Buchung') ?>:</h3> <h3><?= _('Interner Kommentar zur Buchung') ?>:</h3>
<? if ($make_comment_editable): ?> <? if (!empty($make_comment_editable)): ?>
<textarea name="internal_comment"><?= htmlReady($booking->internal_comment) ?></textarea> <textarea name="internal_comment"><?= htmlReady($booking->internal_comment) ?></textarea>
<? else: ?> <? else: ?>
<?= htmlReady($booking->internal_comment) ?> <?= htmlReady($booking->internal_comment) ?>
<? endif ?> <? endif ?>
<? endif ?> <? endif ?>
<? if ((Request::isDialog() || $make_comment_editable) && !$hide_buttons): ?> <? if ((Request::isDialog() || !empty($make_comment_editable)) && empty($hide_buttons)): ?>
<div data-dialog-button> <div data-dialog-button>
<? if ($make_comment_editable): ?> <? if (isset($make_comment_editable)): ?>
<?= \Studip\Button::create(_('Speichern'), 'save') ?> <?= \Studip\Button::create(_('Speichern'), 'save') ?>
<? if (!$booking->isReadOnlyForUser($current_user)): ?> <? if (!$booking->isReadOnlyForUser($current_user)): ?>
<?= \Studip\LinkButton::create( <?= \Studip\LinkButton::create(
...@@ -169,7 +178,7 @@ ...@@ -169,7 +178,7 @@
<? endif ?> <? endif ?>
</div> </div>
<? endif ?> <? endif ?>
<? if ($make_comment_editable): ?> <? if (!empty($make_comment_editable)): ?>
</form> </form>
<? endif ?> <? endif ?>
<? endif ?> <? endif ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment