From ac6ddd390b165914d0db3832b8015b291a8cf2b5 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Mon, 24 Oct 2022 18:20:55 +0000 Subject: [PATCH] allow changing of many options for consultation blocks, fixes #1707 Closes #1707 Merge request studip/studip!1113 --- app/controllers/consultation/admin.php | 5 +++ app/views/consultation/admin/edit.php | 57 ++++++++++++++++++++++++++ lib/models/ConsultationBlock.php | 38 +++++++++-------- 3 files changed, 84 insertions(+), 16 deletions(-) diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php index 3c1cb473ce1..c1b891f21ba 100644 --- a/app/controllers/consultation/admin.php +++ b/app/controllers/consultation/admin.php @@ -372,6 +372,11 @@ class Consultation_AdminController extends ConsultationController $this->block = $this->loadBlock($block_id); $this->block->room = trim(Request::get('room')); $this->block->note = trim(Request::get('note')); + $this->block->size = Request::int('size'); + $this->block->calendar_events = Request::bool('calender-events', false); + $this->block->show_participants = Request::bool('show-participants', false); + $this->block->require_reason = Request::option('require-reason'); + $this->block->confirmation_text = trim(Request::get('confirmation-text')); foreach ($this->block->slots as $slot) { $slot->note = ''; diff --git a/app/views/consultation/admin/edit.php b/app/views/consultation/admin/edit.php index 6f1911a1e1a..5f0aec9f18d 100644 --- a/app/views/consultation/admin/edit.php +++ b/app/views/consultation/admin/edit.php @@ -1,3 +1,11 @@ +<?php +/** + * @var Consultation_AdminController $controller + * @var ConsultationBlock $block + * @var int $page + * @var array|null $responsible + */ +?> <form action="<?= $controller->store_edited($block, $page) ?>" method="post" class="default"> <?= CSRFProtection::tokenTag() ?> @@ -22,6 +30,55 @@ <? if ($responsible): ?> <?= $this->render_partial('consultation/admin/block-responsibilities.php', compact('responsible', 'block')) ?> <? endif; ?> + + <label> + <?= _('Maximale Teilnehmerzahl') ?> + <?= tooltipIcon(_('Falls Sie mehrere Personen zulassen wollen (wie z.B. zu einer Klausureinsicht), so geben Sie hier die maximale Anzahl an Personen an, die sich anmelden dürfen.')) ?> + <input required type="text" name="size" id="size" + min="1" max="50" value="<?= $block->size ?>"> + </label> + + <label> + <input type="checkbox" name="calender-events" value="1" + <? if ($block->calendar_events) echo 'checked'; ?>> + <?= _('Die freien Termine auch im Kalender markieren') ?> + </label> + + <label> + <input type="checkbox" name="show-participants" value="1" + <? if ($block->show_participants) echo 'checked'; ?>> + <?= _('Namen der buchenden Personen sind öffentlich sichtbar') ?> + </label> + + <label> + <?= _('Grund der Buchung abfragen') ?> + </label> + <div class="hgroup"> + <label> + <input type="radio" name="require-reason" value="yes" + <? if ($block->require_reason === 'yes') echo 'checked'; ?>> + <?= _('Ja, zwingend erforderlich') ?> + </label> + + <label> + <input type="radio" name="require-reason" value="optional" + <? if ($block->require_reason === 'optional') echo 'checked'; ?>> + <?= _('Ja, optional') ?> + </label> + + <label> + <input type="radio" name="require-reason" value="no" + <? if ($block->require_reason === 'no') echo 'checked'; ?>> + <?= _('Nein') ?> + </label> + </div> + + <label> + <?= _('Bestätigung für folgenden Text einholen') ?> + (<?= _('optional') ?>) + <?= tooltipIcon(_('Wird hier ein Text eingegeben, so müssen Buchende bestätigen, dass sie diesen Text gelesen haben.')) ?> + <textarea name="confirmation-text"><?= htmlReady($block->confirmation_text) ?></textarea> + </label> </fieldset> <footer data-dialog-button> diff --git a/lib/models/ConsultationBlock.php b/lib/models/ConsultationBlock.php index 7ae2bfe46ab..ef56cd99ba0 100644 --- a/lib/models/ConsultationBlock.php +++ b/lib/models/ConsultationBlock.php @@ -10,22 +10,28 @@ * method when the dev board finally fully supports PHP7 since that * required "yield from". * - * @property string block_id database column - * @property string id alias column for block_id - * @property string range_id database column - * @property string range_type database column - * @property string teacher_id database column - * @property string start database column - * @property string end database column - * @property string room database column - * @property string calendar_events database column - * @property string note database column - * @property string size database column - * @property bool has_bookings computed column - * @property Range range computed column - * @property SimpleORMapCollection slots has_many ConsultationSlot - * @property ConsultationResponsibility[]|SimpleCollection responsibilities has_many ConsultationResponsibility - * @property User[] responsible_persons + * @property string $id alias column for block_id + * @property string $block_id database column + * @property string $range_id database column + * @property string $range_type database column + * @property string $teacher_id database column + * @property int $start database column + * @property int $end database column + * @property string $room database column + * @property bool $calendar_events database column + * @property bool $show_participants database column + * @property bool $require_reason database column + * @property string $confirmation_text database column + * @property string $note database column + * @property string $size database column + * @property int $mkdate database column + * @property int $chdate database column + * + * @property bool $has_bookings computed column + * @property Range $range computed column + * @property ConsultationSlot[]|SimpleORMapCollection $slots has_many ConsultationSlot + * @property ConsultationResponsibility[]|SimpleCollection $responsibilities has_many ConsultationResponsibility + * @property User[] $responsible_persons */ class ConsultationBlock extends SimpleORMap implements PrivacyObject { -- GitLab