aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/consultation
diff options
context:
space:
mode:
authorPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
committerPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
commit4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch)
tree5c07151ae61276d334e88f6309c30d439a85c12e /app/controllers/consultation
parentda0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff)
parent97a188592c679890a25c37ab78463add76a52ff7 (diff)
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'app/controllers/consultation')
-rw-r--r--app/controllers/consultation/admin.php11
-rw-r--r--app/controllers/consultation/consultation_controller.php11
-rw-r--r--app/controllers/consultation/overview.php2
3 files changed, 16 insertions, 8 deletions
diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php
index bc63a1a..8ee7575 100644
--- a/app/controllers/consultation/admin.php
+++ b/app/controllers/consultation/admin.php
@@ -138,6 +138,7 @@ class Consultation_AdminController extends ConsultationController
$this->room = '';
$this->responsible = false;
+ $this->slot_count_threshold = self::SLOT_COUNT_THRESHOLD;
// TODO: inst_default?
if ($this->range instanceof User) {
@@ -155,6 +156,8 @@ class Consultation_AdminController extends ConsultationController
$block->range = $this->range;
$this->responsible = $block->getPossibleResponsibilites();
}
+
+ $this->response->add_header('X-No-Buttons', '');
}
public function store_action()
@@ -186,7 +189,7 @@ class Consultation_AdminController extends ConsultationController
$end,
Request::int('day-of-week'),
Request::int('interval'),
- Request::int('duration'),
+ $duration,
$pause_time,
$pause_duration
);
@@ -214,6 +217,7 @@ class Consultation_AdminController extends ConsultationController
$block->note = Request::get('note');
$block->size = Request::int('size', 1);
$block->lock_time = Request::int('lock_time');
+ $block->consecutive = Request::bool('consecutive', false);
$slots = $block->createSlots(Request::int('duration'), $pause_time, $pause_duration);
if (count($slots) === 0) {
@@ -403,6 +407,7 @@ class Consultation_AdminController extends ConsultationController
$this->block->mail_to_tutors = Request::bool('mail-to-tutors', false);
$this->block->confirmation_text = trim(Request::get('confirmation-text'));
$this->block->lock_time = Request::int('lock_time');
+ $this->block->consecutive = Request::bool('consecutive', false);
foreach ($this->block->slots as $slot) {
$slot->note = '';
@@ -535,7 +540,7 @@ class Consultation_AdminController extends ConsultationController
public function toggle_action($what, $state, $expired = false)
{
if ($what === 'messages') {
- // TODO: Applicable everywhere?
+ // TODO: Applicable everywhere?
$this->getUserConfig()->store(
'CONSULTATION_SEND_MESSAGES',
(bool) $state
@@ -808,7 +813,7 @@ class Consultation_AdminController extends ConsultationController
_('Terminblöcke anlegen'),
$this->createURL(),
Icon::create('add')
- )->asDialog('size=auto');
+ )->asDialog('size=big');
$actions->addLink(
_('Namen des Reiters ändern'),
$this->tabURL($action === 'expired'),
diff --git a/app/controllers/consultation/consultation_controller.php b/app/controllers/consultation/consultation_controller.php
index d6927af..00e10ad 100644
--- a/app/controllers/consultation/consultation_controller.php
+++ b/app/controllers/consultation/consultation_controller.php
@@ -19,7 +19,7 @@ abstract class ConsultationController extends AuthenticatedController
$this->range = Context::get();
$type = 'object';
} else {
- $this->range = $GLOBALS['user']->getAuthenticatedUser();
+ $this->range = User::findCurrent();
}
if (!$this->range) {
@@ -60,7 +60,7 @@ abstract class ConsultationController extends AuthenticatedController
$this->render_template('consultation/not_found', $this->layout);
}
- protected function activateNavigation($path)
+ protected function activateNavigation($path): void
{
$path = ltrim($path, '/');
@@ -73,7 +73,7 @@ abstract class ConsultationController extends AuthenticatedController
}
}
- protected function getConsultationTitle()
+ protected function getConsultationTitle(): string
{
return $this->range->getConfiguration()->CONSULTATION_TAB_TITLE;
}
@@ -103,7 +103,8 @@ abstract class ConsultationController extends AuthenticatedController
return $block;
}
- protected function loadSlot($block_id, $slot_id)
+
+ protected function loadSlot($block_id, $slot_id): ConsultationSlot
{
$block = $this->loadBlock($block_id);
$slot = $block->slots->find($slot_id);
@@ -115,7 +116,7 @@ abstract class ConsultationController extends AuthenticatedController
return $slot;
}
- protected function loadBooking($block_id, $slot_id, $booking_id)
+ protected function loadBooking($block_id, $slot_id, $booking_id): ConsultationBooking
{
$slot = $this->loadSlot($block_id, $slot_id);
$booking = $slot->bookings->find($booking_id);
diff --git a/app/controllers/consultation/overview.php b/app/controllers/consultation/overview.php
index ce6cd31..2afb710 100644
--- a/app/controllers/consultation/overview.php
+++ b/app/controllers/consultation/overview.php
@@ -71,6 +71,8 @@ class Consultation_OverviewController extends ConsultationController
if ($this->slot->isOccupied()) {
PageLayout::postError(_('Dieser Termin ist bereits belegt.'));
+ } elseif (!$this->slot->isBookable()) {
+ PageLayout::postError(_('Dieser Termin ist für Buchungen gesperrt.'));
} else {
$booking = new ConsultationBooking();
$booking->slot_id = $this->slot->id;