Skip to content
Snippets Groups Projects
Commit b70bc19f authored by Michaela Brückner's avatar Michaela Brückner :unicorn:
Browse files

first step: looking for room, re #1327

parent 5797405d
No related branches found
No related tags found
No related merge requests found
......@@ -1070,6 +1070,7 @@ class Admin_CoursesController extends AuthenticatedController
'attributes' => ['data-dialog' => 'size=big'],
];
}
ksort($actions);
foreach (PluginManager::getInstance()->getPlugins('AdminCourseAction') as $plugin) {
......
......@@ -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.
*/
......
<?= 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!')]
)?>
<?php
<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 ?>
<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 ?>
<?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',
......
......@@ -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'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment