aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaela Brückner <brueckner@data-quest.de>2022-08-15 13:45:42 +0200
committerMichaela Brückner <brueckner@data-quest.de>2022-08-26 08:46:25 +0200
commitb70bc19f88b21da74ff2c780df39b75cfdb8bd67 (patch)
treea2c865075a667e93ea59bc18fce2c58506316148
parent5797405d3033c20d0c5dc3ba9a345f0d0e4cd391 (diff)
first step: looking for room, re #1327
-rw-r--r--app/controllers/admin/courses.php1
-rw-r--r--app/controllers/course/room_requests.php56
-rw-r--r--app/views/course/room_requests/_new_request_form_header.php0
-rw-r--r--app/views/course/room_requests/_new_request_header.php4
-rw-r--r--app/views/course/room_requests/find_by_property.php1
-rw-r--r--app/views/course/room_requests/find_by_roomname.php92
-rw-r--r--app/views/course/room_requests/new_request.php93
-rw-r--r--app/views/course/room_requests/request_first_step.php1
-rw-r--r--app/views/course/timesrooms/_roomRequest.php2
-rw-r--r--lib/modules/CoreAdmin.class.php3
10 files changed, 252 insertions, 1 deletions
diff --git a/app/controllers/admin/courses.php b/app/controllers/admin/courses.php
index 711494a..5a89dba 100644
--- a/app/controllers/admin/courses.php
+++ b/app/controllers/admin/courses.php
@@ -1070,6 +1070,7 @@ class Admin_CoursesController extends AuthenticatedController
'attributes' => ['data-dialog' => 'size=big'],
];
}
+
ksort($actions);
foreach (PluginManager::getInstance()->getPlugins('AdminCourseAction') as $plugin) {
diff --git a/app/controllers/course/room_requests.php b/app/controllers/course/room_requests.php
index 8747e9b..3b8d4c2 100644
--- a/app/controllers/course/room_requests.php
+++ b/app/controllers/course/room_requests.php
@@ -245,6 +245,62 @@ class Course_RoomRequestsController extends AuthenticatedController
}
+
+ public function new_request_action($request_id = '')
+ {
+ if (!Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) {
+ throw new AccessDeniedException(
+ _('Das Erstellen von Raumanfragen ist nicht erlaubt!')
+ );
+ }
+ Helpbar::get()->addPlainText(
+ _('Information'),
+ _('Hier können Sie Angaben zu gewünschten Raumeigenschaften machen.')
+ );
+
+ $this->request_id = $request_id;
+ if (Request::submitted('request_id')) {
+ $this->request_id = Request::get('request_id');
+ }
+ if (!$this->request_id) {
+ $this->request_id = md5(uniqid('RoomRequest'));
+ }
+
+ $this->request = null;
+ $this->request = RoomRequest::find(Request::get('request_id'));
+ $this->available_room_categories = ResourceCategory::findByClass_name(
+ 'Room'
+ );
+
+ }
+
+ public function request_first_step_action($request_id)
+ {
+ $this->request_id = $request_id;
+
+ if (Request::isPost()) {
+ CSRFProtection::verifyUnsafeRequest();
+ $this->room_name = Request::get('room_name');
+ $this->category_id = Request::get('category_id');
+
+ if ($this->room_name != null) {
+ $_SESSION[$request_id]['room_name'] = $this->room_name;
+ $this->redirect(
+ 'course/room_requests/find_by_roomname/' . $this->request_id
+ );
+ }
+ }
+
+ }
+
+ public function find_by_roomname_action($request_id)
+ {
+ $this->request_id = $request_id;
+
+ }
+
+
+ /************ OLD STUFF *******/
/**
* This action is the entry point for adding properties to a room request.
*/
diff --git a/app/views/course/room_requests/_new_request_form_header.php b/app/views/course/room_requests/_new_request_form_header.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/views/course/room_requests/_new_request_form_header.php
diff --git a/app/views/course/room_requests/_new_request_header.php b/app/views/course/room_requests/_new_request_header.php
new file mode 100644
index 0000000..7575786
--- /dev/null
+++ b/app/views/course/room_requests/_new_request_header.php
@@ -0,0 +1,4 @@
+<?= MessageBox::info(
+ _('Geben Sie den gewünschten Raum und/oder Raumeigenschaften an. Ihre Raumanfrage wird von der zuständigen Raumvergabe bearbeitet.'),
+ [_('<strong>Achtung:</strong> Um später einen passenden Raum für Ihre Veranstaltung zu bekommen, geben Sie bitte immer die gewünschten Eigenschaften mit an!')]
+)?>
diff --git a/app/views/course/room_requests/find_by_property.php b/app/views/course/room_requests/find_by_property.php
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/app/views/course/room_requests/find_by_property.php
@@ -0,0 +1 @@
+<?php
diff --git a/app/views/course/room_requests/find_by_roomname.php b/app/views/course/room_requests/find_by_roomname.php
new file mode 100644
index 0000000..a28cc3c
--- /dev/null
+++ b/app/views/course/room_requests/find_by_roomname.php
@@ -0,0 +1,92 @@
+<form method="post" name="room_request" class="default"
+ action="<?= $this->controller->link_for('course/room_requests/request_first_step/' . $request_id) ?>"
+ <?= Request::isXhr() ? 'data-dialog="size=big"' : ''?>>
+ <input type="hidden" name="request_id" value="<?= htmlReady($request_id) ?>">
+ <?= CSRFProtection::tokenTag() ?>
+
+
+ <?= $this->render_partial(
+ 'course/room_requests/_new_request_header') ?>
+
+ <?= $request_id ?>
+ <?= var_dump($_SESSION[$request_id]) ?>
+ <section class="resources-grid">
+ <div>
+ <fieldset>
+ <legend><?= _('Wünschbare Eigenschaften') ?></legend>
+
+ <? if ($available_room_categories): ?>
+ <label>
+ <?= _('Raumkategorie') ?>
+ <span class="flex-row">
+ <select name="category_id" <?= $category ? 'disabled' : '' ?>>
+ <option value=""><?= _('bitte auswählen') ?></option>
+ <? foreach ($available_room_categories as $rc): ?>
+ <option value="<?= htmlReady($rc->id) ?>"
+ <?= ($category_id == $rc->id)
+ ? 'selected="selected"'
+ : '' ?>>
+ <?= htmlReady($rc->name) ?>
+ </option>
+ <? endforeach ?>
+ </select>
+ <? if ($category) : ?>
+ <?= Icon::create('refresh', Icon::ROLE_CLICKABLE, ['title' => _('alle Angaben zurücksetzen')])->asInput(
+ [
+ 'type' => 'image',
+ 'class' => 'text-bottom',
+ 'name' => 'reset_category',
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? else : ?>
+ <?= Icon::create('accept', Icon::ROLE_CLICKABLE, ['title' => _('Raumtyp auswählen')])->asInput(
+ [
+ 'type' => 'image',
+ 'class' => 'text-bottom',
+ 'name' => 'select_properties',
+ 'value' => _('Raumtyp auswählen'),
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? endif ?>
+ </span>
+ </label>
+ <? endif ?>
+ <? if (!$embedded) : ?>
+ </fieldset>
+ </div>
+
+ <div>
+ <fieldset>
+ <legend><?= _('Raumsuche') ?></legend>
+ <label>
+ <?= _('Raumname') ?>
+ <span class="flex-row">
+ <input type="text" name="room_name" value="<?= htmlReady($room_name) ?>">
+ <?= Icon::create('search', Icon::ROLE_CLICKABLE)->asInput(
+ [
+ 'name' => 'search_by_name',
+ 'class' => 'text-bottom',
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? if ($room_name) : ?>
+ <?= Icon::create('refresh', Icon::ROLE_CLICKABLE, ['title' => _('alle Angaben zurücksetzen')])->asInput(
+ [
+ 'type' => 'image',
+ 'class' => 'text-bottom',
+ 'name' => 'reset_category',
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? endif?>
+ </span>
+ </label>
+
+ </fieldset>
+
+ </div>
+ </section>
+<?= $this->render_partial('course/room_requests/_request_form_footer') ?>
+<? endif ?>
diff --git a/app/views/course/room_requests/new_request.php b/app/views/course/room_requests/new_request.php
new file mode 100644
index 0000000..e1b554d
--- /dev/null
+++ b/app/views/course/room_requests/new_request.php
@@ -0,0 +1,93 @@
+<form method="post" name="room_request" class="default"
+ action="<?= $this->controller->link_for('course/room_requests/request_first_step/' . $request_id) ?>"
+ <?= Request::isXhr() ? 'data-dialog="size=big"' : ''?>>
+ <input type="hidden" name="request_id" value="<?= htmlReady($request_id) ?>">
+ <?= CSRFProtection::tokenTag() ?>
+
+
+<?= $this->render_partial(
+ 'course/room_requests/_new_request_header') ?>
+
+<?= $request_id ?>
+<?= var_dump($request) ?>
+<?= $room_name ?>
+<section class="resources-grid">
+ <div>
+ <fieldset>
+ <legend><?= _('Wünschbare Eigenschaften') ?></legend>
+
+ <? if ($available_room_categories): ?>
+ <label>
+ <?= _('Raumkategorie') ?>
+ <span class="flex-row">
+ <select name="category_id" <?= $category ? 'disabled' : '' ?>>
+ <option value=""><?= _('bitte auswählen') ?></option>
+ <? foreach ($available_room_categories as $rc): ?>
+ <option value="<?= htmlReady($rc->id) ?>"
+ <?= ($category_id == $rc->id)
+ ? 'selected="selected"'
+ : '' ?>>
+ <?= htmlReady($rc->name) ?>
+ </option>
+ <? endforeach ?>
+ </select>
+ <? if ($category) : ?>
+ <?= Icon::create('refresh', Icon::ROLE_CLICKABLE, ['title' => _('alle Angaben zurücksetzen')])->asInput(
+ [
+ 'type' => 'image',
+ 'class' => 'text-bottom',
+ 'name' => 'reset_category',
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? else : ?>
+ <?= Icon::create('accept', Icon::ROLE_CLICKABLE, ['title' => _('Raumtyp auswählen')])->asInput(
+ [
+ 'type' => 'image',
+ 'class' => 'text-bottom',
+ 'name' => 'select_properties',
+ 'value' => _('Raumtyp auswählen'),
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? endif ?>
+ </span>
+ </label>
+ <? endif ?>
+ <? if (!$embedded) : ?>
+ </fieldset>
+ </div>
+
+ <div>
+ <fieldset>
+ <legend><?= _('Raumsuche') ?></legend>
+ <label>
+ <?= _('Raumname') ?>
+ <span class="flex-row">
+ <input type="text" name="room_name" value="<?= htmlReady($room_name) ?>">
+ <?= Icon::create('search', Icon::ROLE_CLICKABLE)->asInput(
+ [
+ 'name' => 'search_by_name',
+ 'class' => 'text-bottom',
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? if ($room_name) : ?>
+ <?= Icon::create('refresh', Icon::ROLE_CLICKABLE, ['title' => _('alle Angaben zurücksetzen')])->asInput(
+ [
+ 'type' => 'image',
+ 'class' => 'text-bottom',
+ 'name' => 'reset_category',
+ 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
+ ]
+ ) ?>
+ <? endif?>
+ </span>
+ </label>
+
+ </fieldset>
+
+ </div>
+</section>
+<?= $this->render_partial('course/room_requests/_request_form_footer') ?>
+<? endif ?>
diff --git a/app/views/course/room_requests/request_first_step.php b/app/views/course/room_requests/request_first_step.php
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/app/views/course/room_requests/request_first_step.php
@@ -0,0 +1 @@
+<?php
diff --git a/app/views/course/timesrooms/_roomRequest.php b/app/views/course/timesrooms/_roomRequest.php
index e8ee829..f83e47e 100644
--- a/app/views/course/timesrooms/_roomRequest.php
+++ b/app/views/course/timesrooms/_roomRequest.php
@@ -9,7 +9,7 @@
_('Hier können Sie für die gesamte Veranstaltung, also für alle regelmäßigen und unregelmäßigen Termine, '
. 'eine Raumanfrage erstellen.')
) ?>
- <a class="link-add" href="<?= $controller->url_for('course/room_requests/request_start',
+ <a class="link-add" href="<?= $controller->url_for('course/room_requests/new_request',
[
'cid' => $course->id,
'range_str' => 'course',
diff --git a/lib/modules/CoreAdmin.class.php b/lib/modules/CoreAdmin.class.php
index b307b6f..46d797c 100644
--- a/lib/modules/CoreAdmin.class.php
+++ b/lib/modules/CoreAdmin.class.php
@@ -63,12 +63,15 @@ class CoreAdmin extends CorePlugin implements StudipModule
$item->setDescription(_('Regelmäßige Veranstaltungszeiten, Einzeltermine und Ortsangaben ändern.'));
$navigation->addSubNavigation('dates', $item);
+ // TODO remove whole navigation entry
+ /*
if (Config::get()->RESOURCES_ENABLE && Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) {
$item = new Navigation(_('Raumanfragen'), 'dispatch.php/course/room_requests/index/' . $course_id);
$item->setImage(Icon::create('resources'));
$item->setDescription(_('Raumanfragen zu Veranstaltungszeiten verwalten.'));
$navigation->addSubNavigation('room_requests', $item);
}
+ */
$item = new Navigation(_('Zugangsberechtigungen'), 'dispatch.php/course/admission');
$item->setImage(Icon::create('lock-locked'));