diff --git a/app/controllers/admin/courses.php b/app/controllers/admin/courses.php index 711494a4ed0db26d2fae8335c63bc5a15d347172..5a89dbaea87e7e305d89d4d91cbb5008104cbb36 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 8747e9b4ab59e4ea6fbf9adb4a525a3c7653cbc1..3b8d4c272cedf1382349defecf8d888b84acf6b6 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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 0000000000000000000000000000000000000000..757578635abf659d991559a277aeabd22a6b6ac5 --- /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 0000000000000000000000000000000000000000..b3d9bbc7f3711e882119cd6b3af051245d859d04 --- /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 0000000000000000000000000000000000000000..a28cc3c539bffd0a8d71a8e5829a42d8bd338629 --- /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 0000000000000000000000000000000000000000..e1b554d730e2635484bfcd3a24d80aea5c9ad570 --- /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 0000000000000000000000000000000000000000..b3d9bbc7f3711e882119cd6b3af051245d859d04 --- /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 e8ee82984c97f5bf4b15395c4bc91aa4c9979ece..f83e47e3a2fa3b2696d6f6543203654d58bf3c14 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 b307b6f21bfc6dde4c7a10a01962baa9840d32f1..46d797cf5963ac40bbeae51301e3be2ea8a44aff 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'));