From 80722a312263ce8841cda000de2b41487626e678 Mon Sep 17 00:00:00 2001 From: David Siegfried <david.siegfried@uni-vechta.de> Date: Wed, 15 Mar 2023 09:28:21 +0000 Subject: [PATCH] prevent php-warnings, closes #2307 Closes #2307 Merge request studip/studip!1558 --- app/controllers/tour.php | 12 +++++++ app/views/tour/admin_details.php | 54 +++++++------------------------- 2 files changed, 24 insertions(+), 42 deletions(-) diff --git a/app/controllers/tour.php b/app/controllers/tour.php index 3ff6eaa4220..5150c6c503d 100644 --- a/app/controllers/tour.php +++ b/app/controllers/tour.php @@ -656,6 +656,18 @@ class TourController extends AuthenticatedController $this->tour->roles = implode(',', Request::getArray('tour_roles')); $this->tour_startpage = Request::get('tour_startpage'); } + if (count($this->tour->steps) > 0) { + $sidebar = Sidebar::get(); + + $widget = new ActionsWidget(); + $widget->addLink( + _('Schritt hinzufügen'), + $this->url_for('tour/edit_step/' . $this->tour->tour_id . '/' . (count($this->tour->steps) + 1) . '/new'), + Icon::create('add'), + ['data-dialog' => 'size=auto;reload-on-close'] + ); + $sidebar->addWidget($widget); + } } /** diff --git a/app/views/tour/admin_details.php b/app/views/tour/admin_details.php index 3bbd1fa8560..e0a0a9e1485 100644 --- a/app/views/tour/admin_details.php +++ b/app/views/tour/admin_details.php @@ -89,32 +89,16 @@ use Studip\Button, Studip\LinkButton; <? endif ?> - <section> - <?= _('Geltungsbereich (Nutzendenstatus)') ?>: - <? foreach (['autor', 'tutor', 'dozent', 'admin', 'root'] as $role) : ?> - <label> - <input type="checkbox" name="tour_roles[]" value="<?= $role ?>" - <? if (mb_strpos($tour->roles, $role) !== false) echo 'checked'; ?>> - <?=$role ?> - </label> - <? endforeach ?> - </section> - - <!--label for="tour_audience" class="caption"> - <?= _('Bedingung') ?> - </label> - <select name="tour_audience_type"> - <option value=""></option> - <option value="sem"<?= ($audience->type == 'sem') ? ' selected' : '' ?>><?= _('Teilnehmende der Veranstaltung') ?></option> - <option value="inst"<?= ($audience->type == 'inst') ? ' selected' : '' ?>><?= _('Mitglied der Einrichtung') ?></option> - <option value="studiengang"<?= ($audience->type == 'studiengang') ? ' selected' : '' ?>><?= _('Eingeschrieben in Studiengang') ?></option> - <option value="abschluss"<?= ($audience->type == 'abschluss') ? ' selected' : '' ?>><?= _('Angestrebter Abschluss') ?></option> - <option value="userdomain"<?= ($audience->type == 'userdomain') ? ' selected' : '' ?>><?= _('Zugeordnet zur Nutzerdomäne') ?></option> - </select> - <input type="text" size="60" maxlength="255" name="tour_audience_range_id" - value="<?= $audience ? htmlReady($audience->range_id) : '' ?>" - placeholder="<?= _('interne ID des Objekts') ?>"/--> - + <section> + <?= _('Geltungsbereich (Nutzendenstatus)') ?>: + <? foreach (['autor', 'tutor', 'dozent', 'admin', 'root'] as $role) : ?> + <label> + <input type="checkbox" name="tour_roles[]" value="<?= $role ?>" + <? if (mb_strpos($tour->roles, $role) !== false) echo 'checked'; ?>> + <?= $role ?> + </label> + <? endforeach ?> + </section> </fieldset> <footer> <?= CSRFProtection::tokenTag() ?> @@ -142,9 +126,9 @@ use Studip\Button, Studip\LinkButton; </tr> </thead> <tbody> - <? if (count($tour->steps)) : ?> + <? if (count($tour->steps) > 0) : ?> <? foreach ($tour->steps as $step) : ?> - <tr id="<?= $tour_id . '_' . $step->step ?>"> + <tr id="<?= htmlReady("{$tour->id}_{$step->step}") ?>"> <td><?= $step->step ?></td> <td><?= htmlReady($step->title) ?></td> <td><?= htmlReady($step->tip) ?></td> @@ -185,17 +169,3 @@ use Studip\Button, Studip\LinkButton; </table> </form> <? endif ?> - -<? -if (count($tour->steps)) { - $sidebar = Sidebar::get(); - - $widget = new ActionsWidget(); - $widget->addLink( - _('Schritt hinzufügen'), - $controller->url_for('tour/edit_step/' . $tour->tour_id . '/' . (count($tour->steps) + 1) . '/new'), - Icon::create('add'), - ['data-dialog' => 'size=auto;reload-on-close'] - ); - $sidebar->addWidget($widget); -} -- GitLab