Skip to content
Snippets Groups Projects
Commit 2d984771 authored by André Noack's avatar André Noack Committed by Jan-Hendrik Willms
Browse files

Revert wromng commits aad38b53 e7f0e311 0d99c65b c8bcec4b e8d60870...

Revert wromng commits aad38b53 e7f0e311 0d99c65b c8bcec4b e8d60870 b70bc19f 5797405d to main re #1327"

Merge request studip/studip!952
parent a0f070ad
No related branches found
No related tags found
No related merge requests found
Showing
with 15 additions and 829 deletions
......@@ -1070,7 +1070,6 @@ class Admin_CoursesController extends AuthenticatedController
'attributes' => ['data-dialog' => 'size=big'],
];
}
ksort($actions);
foreach (PluginManager::getInstance()->getPlugins('AdminCourseAction') as $plugin) {
......
......@@ -48,10 +48,6 @@ class Course_RoomRequestsController extends AuthenticatedController
$pagetitle .= Course::find($this->course_id)->getFullname() . ' - ';
$pagetitle .= _('Verwalten von Raumanfragen');
PageLayout::setTitle($pagetitle);
$this->available_room_categories = ResourceCategory::findByClass_name('Room');
$this->step = 0;
}
/**
......@@ -249,240 +245,6 @@ class Course_RoomRequestsController extends AuthenticatedController
}
/*
* Start point to creating a new request
*/
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.')
);
// create a new request
$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')) ? RoomRequest::find(Request::get('request_id')) : new RoomRequest($this->request_id);
// time ranges (start date, end date)
$this->request->setRangeFields('course', [Context::getId()]);
$this->request_time_intervals = $this->request->getTimeIntervals();
}
/*
* Step 1: Either selecting a room category or searching for a room name
*/
public function request_first_step_action($request_id)
{
$this->request_id = $request_id;
$this->step = 1;
$_SESSION[$request_id]['search_by'] = '';
if (Request::isPost()) {
CSRFProtection::verifyUnsafeRequest();
// either search by room name or room category, then go to next step
$this->room_name = Request::get('room_name');
$_SESSION[$request_id]['room_name'] = $this->room_name;
$this->search_by_roomname = Request::submitted('search_by_name');
$this->category_id = Request::get('category_id');
$_SESSION[$request_id]['room_category'] = $this->category_id;
$this->search_by_category = Request::submitted('search_by_category');
// user looks for a special room OR for room within a selected category
if ($this->room_name != null && $this->search_by_roomname != null) {
$_SESSION[$request_id]['search_by'] = 'roomname';
$this->redirect(
'course/room_requests/find_by_roomname/' . $this->request_id . '/' . $this->step
);
} else if ($this->category_id != null && $this->search_by_category != null ) {
$_SESSION[$request_id]['search_by'] = 'category';
$this->redirect(
'course/room_requests/find_by_category/' . $this->request_id . '/' . $this->step
);
} else {
$this->redirect(
'course/room_requests/new_request/' . $this->request_id
);
}
}
}
public function find_by_roomname_action($request_id, $step)
{
$this->request_id = $request_id;
$this->step = $step;
$this->room_name = $_SESSION[$request_id]['room_name'];
$this->available_rooms = RoomManager::findRooms(
$this->room_name,
null,
null,
null,
[],
'name ASC, mkdate ASC'
);
// small icons before room name to show whether they are bookable or not
$this->available_room_icons = $this->getRoomBookingIcons($this->available_rooms, $this->request_id);
$this->selected_room = Resource::find($_SESSION[$request_id]['room_id']);
$this->selected_room_category_id = $this->selected_room->category_id;
$_SESSION[$request_id]['room_category'] = $this->selected_room_category_id;
// for step 2 after choosing a room
if ($step == 2) {
$this->category = ResourceCategory::find($this->selected_room_category_id);
$this->available_properties = $this->category->getRequestableProperties();
}
// after selecting a room, go to next step
if ((Request::submitted('request_second_step'))) {
$this->selected_room_id = Request::get('selected_room_id');
$_SESSION[$request_id]['room_id'] = $this->selected_room_id;
$this->redirect(
'course/room_requests/request_second_step/' . $this->request_id
);
}
// we might also search for new rooms and stay within step 1
if (Request::get('room_name') && Request::submitted('search_by_name')) {
$_SESSION[$request_id]['room_name'] = Request::get('room_name');
$this->redirect(
'course/room_requests/find_by_roomname/' . $this->request_id . '/' . $this->step
);
}
$this->selected_properties = Request::getArray('selected_properties');
$_SESSION[$request_id]['seats'] = $this->selected_properties['seats'];
if (Request::submitted('save_request')) {
// we need the seats property with at least one seat, else we get an error
if ($_SESSION[$request_id]['seats'] < 1) {
PageLayout::postError(
_('Es wurde keine Anzahl an gewünschten Sitzplätzen angegeben!')
);
$this->redirect(
'course/room_requests/find_by_roomname/' . $this->request_id . '/' . $this->step
);
} else {
// TODO actually save the request
PageLayout::postSuccess(_('Die Anfrage wurde gespeichert!'));
$this->relocate('course/timesrooms/');
}
}
}
public function find_by_category_action($request_id, $step)
{
$this->request_id = $request_id;
$this->step = $step;
$this->room_category_id = $_SESSION[$request_id]['room_category'];
$this->category = ResourceCategory::find($this->room_category_id);
$this->request = RoomRequest::find($this->request_id) ? RoomRequest::find($this->request_id) : new RoomRequest($this->request_id);
RoomManager::findRoomsByRequest($this->request);
$this->available_properties = $this->category->getRequestableProperties();
}
/*
* Step 2: After choosing a category or a room, check the properties
*/
public function request_second_step_action($request_id)
{
$this->request_id = $request_id;
$this->step = 2;
$this->redirect(
'course/room_requests/find_by_roomname/' . $this->request_id . '/' . $this->step
);
}
public function save_request_action($request_id) {
$this->request_id = $request_id;
}
private function getRoomBookingIcons($available_rooms, $request_id)
{
$this->request_id = $request_id;
$this->available_room_icons = [];
$this->request = RoomRequest::find($this->request_id) ? RoomRequest::find($this->request_id) : new RoomRequest($this->request_id);
// TODO set range fields for other
$this->request->setRangeFields('course', [Context::getId()]);
$request_time_intervals = $this->request->getTimeIntervals();
foreach ($available_rooms as $room) {
$request_dates_booked = 0;
foreach ($request_time_intervals as $interval) {
$booked = ResourceBookingInterval::countBySql(
'resource_id = :room_id AND begin < :end AND end > :begin',
[
'room_id' => $room->id,
'begin' => $interval['begin'],
'end' => $interval['end']
]
) > 0;
if ($booked) {
$request_dates_booked++;
}
}
if ($request_dates_booked == 0) {
$this->available_room_icons[$room->id] =
Icon::create('check-circle', Icon::ROLE_STATUS_GREEN)->asImg(
[
'class' => 'text-bottom',
'title' => _('freier Raum')
]
);
$available_rooms[] = $room;
} elseif ($request_dates_booked < $request_time_intervals) {
$this->available_room_icons[$room->id] =
Icon::create('exclaim-circle', Icon::ROLE_STATUS_YELLOW)->asImg(
[
'class' => 'text-bottom',
'title' => _('teilweise belegter Raum')
]
);
$available_rooms[] = $room;
}
}
return $this->available_room_icons;
}
/************ OLD STUFF *******/
/**
* This action is the entry point for adding properties to a room request.
*/
......@@ -573,6 +335,7 @@ class Course_RoomRequestsController extends AuthenticatedController
);
return;
}
if (Request::isPost()) {
CSRFProtection::verifyUnsafeRequest();
$this->room_name = Request::get('room_name');
......@@ -861,7 +624,6 @@ class Course_RoomRequestsController extends AuthenticatedController
);
}
$this->available_room_icons = [];
$request_time_intervals = $this->request->getTimeIntervals();
$request_date_amount = count($request_time_intervals);
foreach ($this->matching_rooms as $room) {
......
......@@ -187,23 +187,7 @@ class Course_TimesroomsController extends AuthenticatedController
$dates = $this->course->getDatesWithExdates();
$this->current_user = User::findCurrent();
$this->user_has_permissions = ResourceManager::userHasGlobalPermission($this->current_user, 'admin');
$check_room_requests = Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS;
$this->room_requests = RoomRequest::findBySQL(
'course_id = :course_id
ORDER BY course_id, metadate_id, termin_id',
[
'course_id' => $this->course->id
]
);
$this->global_requests = $this->course->room_requests->filter(function (RoomRequest $request) {
return $request->closed < 2 && !$request->termin_id;
});
$single_dates = [];
$this->single_date_room_request_c = 0;
foreach ($dates as $val) {
......
<footer data-dialog-button>
<? if ($step >= 1) : ?>
<?= \Studip\LinkButton::create(
_('Zurück'),
$controller->link_for('course/room_requests/new_request/' . $request_id),
['data-dialog' => 'size=big']
) ?>
<? endif ?>
<? if ($step == 1 && $_SESSION[$request_id]['search_by'] == 'roomname') : ?>
<?= \Studip\Button::create(_('Weiter'), 'request_second_step') ?>
<? elseif (($step == 1 && $_SESSION[$request_id]['search_by'] == 'category') || ($step == 2 && $_SESSION[$request_id]['search_by'] == 'roomname')) : ?>
<?= \Studip\Button::create(_('Speichern'), 'save_request') ?>
<? endif ?>
<?= \Studip\LinkButton::createCancel(
_('Abbrechen'),
$controller->link_for('course/room_requests/index/' . $course_id),
[
'title' => _('Abbrechen')
]
) ?>
</footer>
</form>
Step: <?= $step ?>
<?= 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!')]
)?>
<section class="resources-grid">
<section class="contentbox">
<header><h1><?= _('Anfrage') ?></h1></header>
<section>
<?= htmlready($request->getTypeString(), 1, 1) ?>
<? if ($request->getType() == 'course'): ?>
<?
$dates = $request->getDateString(true);
?>
<?= tooltipHtmlIcon(implode('<br>', $dates)) ?>
<? endif ?>
</section>
</section>
<section class="contentbox">
<header><h1><?= _('Bearbeitungsstatus') ?></h1></header>
<section></section>
</section>
</section>
<label><?= _('Ausgewählter Raum') ?></label>
<? if ($selected_room): ?>
<input type="hidden" name="selected_room_id"
value="<?= htmlReady($selected_room->id) ?>">
<?= htmlReady($selected_room->name) ?>
<? endif ?>
<form method="post" name="room_request" class="default"
action="<?= $this->controller->link_for('course/room_requests/request_second_step/' . $request_id . '/' . $this->step) ?>"
<?= 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') ?>
<?= 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) ?>"
<?= ($_SESSION[$request_id]['room_category'] == $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 ?>
<!-- ROOM CATEGORY PROPERTIES -->
<? if ($available_properties) : ?>
<? foreach ($available_properties as $property) : ?>
<?= var_dump($property) ?>
<?= $property->toHtmlInput(
$selected_properties[$property->name],
'selected_properties[' . htmlReady($property->name) . ']',
true,
false
) ?>
<? endforeach ?>
<? endif ?>
<label>
<?= _('Rüstzeit (in Minuten)') ?>
<input type="number" name="preparation_time"
value="<?= htmlReady($preparation_time) ?>"
min="0" max="<?= htmlReady($max_preparation_time) ?>">
</label>
<? if ($user_is_global_resource_admin) : ?>
<label>
<input type="checkbox" name="reply_lecturers" value="1"
<?= $reply_lecturers
? 'checked="checked"'
: ''
?>>
<?= _('Benachrichtigung bei Ablehnung der Raumanfrage auch an alle Lehrenden der Veranstaltung senden') ?>
</label>
<? endif ?>
<label>
<?= _('Nachricht an die Raumvergabe') ?>
<textarea name="comment" cols="58" rows="4"
placeholder="<?= _('Weitere Wünsche oder Bemerkungen zur angefragten Raumbelegung') ?>"><?= htmlReady($comment) ?></textarea>
</label>
</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/_new_request_form_footer', ['step' => $step]) ?>
<form method="post" name="room_request" class="default"
action="<?= $this->controller->link_for('course/room_requests/find_by_roomname/' . $request_id . '/' . $this->step) ?>"
<?= 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') ?>
<?= var_dump($_SESSION[$request_id]) ?>
<section class="resources-grid">
<div>
<fieldset>
<legend><?= _('Wünschbare Eigenschaften') ?></legend>
<? if ($step == 2) : ?>
<?= $this->render_partial('course/room_requests/_room_with_properties') ?>
<? endif ?>
<? 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) ?>"
<?= ($selected_room->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 ($step == 2) : ?>
<!-- After choosing a category or room -->
<? if ($available_properties) : ?>
<? foreach ($available_properties as $property) : ?>
<?= $property->toHtmlInput(
$selected_properties[$property->name],
'selected_properties[' . htmlReady($property->name) . ']',
true,
false
) ?>
<? endforeach ?>
<? endif ?>
<label>
<?= _('Rüstzeit (in Minuten)') ?>
<input type="number" name="preparation_time"
value="<?= htmlReady($preparation_time) ?>"
min="0" max="<?= htmlReady($max_preparation_time) ?>">
</label>
<? if ($user_is_global_resource_admin) : ?>
<label>
<input type="checkbox" name="reply_lecturers" value="1"
<?= $reply_lecturers
? 'checked="checked"'
: ''
?>>
<?= _('Benachrichtigung bei Ablehnung der Raumanfrage auch an alle Lehrenden der Veranstaltung senden') ?>
</label>
<? endif ?>
<label>
<?= _('Nachricht an die Raumvergabe') ?>
<textarea name="comment" cols="58" rows="4"
placeholder="<?= _('Weitere Wünsche oder Bemerkungen zur angefragten Raumbelegung') ?>"><?= htmlReady($comment) ?></textarea>
</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($_SESSION[$request_id]['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 ($_SESSION[$request_id]['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>
<? if ($available_rooms) : ?>
<label><?= _('Passende Räume') ?>
<section class="selectbox">
<? foreach ($available_rooms as $room): ?>
<div class="flex-row">
<label class="horizontal">
<?= $available_room_icons[$room->id] ?>
<input type="radio" name="selected_room_id"
data-activates="button[type='submit'][name='select_room']"
value="<?= htmlReady($room->id) ?>"
<? if ($_SESSION[$request_id]['room_id'] == $room->id) echo 'checked' ?>>
>
<?= htmlReady(mb_substr($room->name, 0, 50)); ?>
<? if ($room->properties): ?>
<? $property_names = $room->getInfolabelPrperties()
->pluck('fullname') ?>
<?= tooltipIcon(implode("\n", $property_names)) ?>
<? endif ?>
</label>
</div>
<? endforeach ?>
</section>
</label>
<? else : ?>
<?= MessageBox::info(_('Es wurden keine passenden Räume gefunden!')) ?>
<? endif ?>
</fieldset>
</div>
</section>
<?= $this->render_partial('course/room_requests/_new_request_form_footer', ['step' => $step]) ?>
<? 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') ?>
<?= var_dump($_SESSION[$request_id]) ?>
<br/>
<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) ?>"
<?= ($_SESSION[$request_id]['room_category'] == $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' => 'search_by_category',
'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($_SESSION[$request_id]['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_name',
'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
]
) ?>
<? endif?>
</span>
</label>
</fieldset>
</div>
</section>
<?= $this->render_partial('course/room_requests/_new_request_form_footer', ['step' => $step]) ?>
<? endif ?>
......@@ -26,8 +26,7 @@
<div>
<? if ($available_rooms) : ?>
<section class="contentbox">
<header><h1><?= _('Passende Räume') ?> <?= count($available_rooms) ?>
</h1></header>
<header><h1><?= _('Passende Räume') ?></h1></header>
<section class="selectbox">
<fieldset>
<? foreach ($available_rooms as $room): ?>
......
<?php
$global_requests = $course->room_requests->filter(function (RoomRequest $request) {
return $request->closed < 2 && !$request->termin_id;
});
?>
<section class="contentbox">
<header>
<h1>
......@@ -9,7 +14,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/new_request',
<a class="link-add" href="<?= $controller->url_for('course/room_requests/request_start',
[
'cid' => $course->id,
'range_str' => 'course',
......@@ -24,133 +29,13 @@
</nav>
</header>
<?php
echo $flash['message'];
?>
<? if (count($room_requests)) : ?>
<section>
<table class="default">
<colgroup>
<col style="width: 40%">
<col style="width: 20%">
<col>
<col style="width: 50px">
</colgroup>
<thead>
<tr>
<th><?= _('Art der Anfrage') ?></th>
<th><?= _('Anfragender') ?></th>
<th><?= _('Bearbeitungsstatus') ?></th>
<th></th>
</tr>
</thead>
<tbody>
<? foreach ($room_requests as $rr): ?>
<tr>
<td>
<?= htmlReady($rr->getTypeString(), 1, 1) ?>
</td>
<td>
<?= htmlReady($rr->user ? $rr->user->getFullName() : '') ?>
</td>
<td>
<?= htmlReady($rr->getStatusText()) ?>
</td>
<td class="actions">
<a class="load-in-new-row"
href="<?= $controller->link_for('course/room_requests/info/' . $rr->id) ?>">
<?= Icon::create(
'info',
Icon::ROLE_CLICKABLE,
[
'title' => _('Weitere Informationen einblenden')
]
) ?>
</a>
<? $params = [] ?>
<? $dialog = []; ?>
<? if (Request::isXhr()) : ?>
<? $params['asDialog'] = true; ?>
<? $dialog['data-dialog'] = 'size=big' ?>
<? endif ?>
<? $actionMenu = ActionMenu::get()->setContext($rr->getTypeString()) ?>
<? $actionMenu->addLink(
$controller->url_for('course/room_requests/request_summary/' . $rr->id, ['clear_cache' => 1]),
_('Diese Anfrage bearbeiten'),
Icon::create(
'edit',
Icon::ROLE_CLICKABLE,
[
'title' => _('Diese Anfrage bearbeiten')
]
),
$dialog
) ?>
<?php
if ($rr->room && !$user_has_permissions) {
$user_has_permissions = $rr->room->userHasPermission($current_user, 'admin');
}
?>
<? if ($user_has_permissions && (int)$rr->closed === 0): ?>
<? $actionMenu->addLink(
URLHelper::getURL(
'dispatch.php/resources/room_request/resolve/' . $rr->id,
[
'reload-on-close' => 1,
'single-request' => 1
]
),
_('Diese Anfrage selbst auflösen'),
Icon::create(
'admin',
Icon::ROLE_CLICKABLE,
[
'title' => _('Diese Anfrage selbst auflösen')
]
),
['data-dialog' => '1']
) ?>
<? endif ?>
<? $actionMenu->addLink(
$controller->url_for('course/room_requests/delete/' . $rr->id),
_('Diese Anfrage löschen'),
Icon::create(
'trash',
Icon::ROLE_CLICKABLE,
[
'title' => _('Diese Anfrage löschen')
]
)
) ?>
<?= $actionMenu->render() ?>
</td>
</tr>
<? endforeach ?>
<? if ($request_id == $rr->id) : ?>
<tr>
<td colspan="4">
<?= $this->render_partial('course/room_requests/_request.php', ['request' => $rr]); ?>
</td>
</tr>
<? endif ?>
</tbody>
</table>
<? if (count($global_requests) > 0): ?>
<p><?= _('Für diese Veranstaltung liegt eine offene Raumanfrage vor') ?></p>
<?= Studip\LinkButton::create(_('Raumanfragen anzeigen'),
URLHelper::getURL('dispatch.php/course/room_requests/index/' . $course->getId())) ?>
<? else: ?>
<p><?= _('Keine Raumanfrage vorhanden') ?></p>
<? endif ?>
</section>
<? else : ?>
<?= MessageBox::info(_('Zu dieser Veranstaltung sind noch keine Raumanfragen vorhanden.')) ?>
<? endif ?>
<? if (Request::isXhr()) : ?>
<div data-dialog-button>
<?= \Studip\LinkButton::createEdit(
_('Neue Raumanfrage erstellen'),
$controller->url_for('course/room_requests/new/' . $course_id, $url_params),
['data-dialog' => 'size=big']
) ?>
</div>
<? endif ?>
</section>
......@@ -63,15 +63,12 @@ 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