Skip to content
Snippets Groups Projects
Commit ec07c503 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

allow people without user permissions access to the booking plan in a new tab, closes #836

Closes #836

Merge request studip/studip!862
parent 8d83eb80
No related branches found
No related tags found
No related merge requests found
......@@ -296,44 +296,47 @@ class Resources_RoomPlanningController extends AuthenticatedController
Icon::create('add')
)->asDialog('size=auto');
}
if ($this->resource->userHasPermission($this->user)) {
if ($this->resource->bookingPlanVisibleForUser($this->user)) {
$actions->addLink(
_('Belegungsplan drucken'),
'javascript:void(window.print());',
Icon::create('print')
);
if ($this->resource instanceof Room) {
if ($this->resource->userHasPermission($this->user)) {
if ($this->resource instanceof Room) {
$actions->addLink(
_('Individuelle Druckansicht'),
URLHelper::getURL(
'dispatch.php/resources/print/individual_booking_plan/'
. $this->resource->id,
[
'timestamp' => $week_timestamp,
'defaultDate' => date('Y-m-d', $week_timestamp)
]
),
Icon::create('print'),
[
'class' => 'resource-bookings-actions'
]
);
}
$actions->addLink(
_('Individuelle Druckansicht'),
_('Buchungen exportieren'),
URLHelper::getURL(
'dispatch.php/resources/print/individual_booking_plan/'
. $this->resource->id,
'dispatch.php/resources/export/resource_bookings/' . $this->resource->id,
[
'timestamp' => $week_timestamp,
'defaultDate' => date('Y-m-d', $week_timestamp)
]
),
Icon::create('print'),
Icon::create('file-excel'),
[
'class' => 'resource-bookings-actions'
'data-dialog' => 'size=auto',
'class' => 'resource-bookings-actions'
]
);
}
$actions->addLink(
_('Buchungen exportieren'),
URLHelper::getURL(
'dispatch.php/resources/export/resource_bookings/' . $this->resource->id,
[
'timestamp' => $week_timestamp,
'defaultDate' => date('Y-m-d', $week_timestamp)
]
),
Icon::create('file-excel'),
[
'data-dialog' => 'size=auto',
'class' => 'resource-bookings-actions'
]
);
}
if($GLOBALS['perm']->have_perm('admin')) {
if ($this->resource instanceof Room) {
......
......@@ -81,12 +81,12 @@
<? elseif ($room->bookingPlanVisibleForUser(User::findCurrent())) : ?>
<?= \Studip\LinkButton::create(
_('Belegungsplan'),
$room->getActionURL('booking_plan'),
['data-dialog' => 'size=big']) ?>
$room->getActionURL('booking_plan')
) ?>
<?= \Studip\LinkButton::create(
_('Semesterbelegung'),
$room->getActionURL('semester_plan'),
['data-dialog' => 'size=big']) ?>
$room->getActionURL('semester_plan')
) ?>
<? endif ?>
<? if ($geo_coordinates_object instanceof ResourceProperty): ?>
......
......@@ -55,10 +55,15 @@
Icon::create('info-circle'),
['data-dialog' => '']
);
if ($room->userHasPermission($current_user, 'autor')) {
if (($room->booking_plan_is_public && Config::get()->RESOURCES_SHOW_PUBLIC_ROOM_PLANS)
|| ($room->userHasPermission($current_user, 'autor'))) {
$actions->addLink(
$room->getActionURL('booking_plan', $booking_plan_action_params),
_('Wochenbelegung'),
(
$room->userHasPermission($current_user, 'autor')
? _('Wochenbelegung')
: _('Belegungsplan')
),
Icon::create('timetable'),
['target' => '_blank']
);
......@@ -68,21 +73,6 @@
Icon::create('timetable'),
['target' => '_blank']
);
} else {
if ($room->booking_plan_is_public && Config::get()->RESOURCES_SHOW_PUBLIC_ROOM_PLANS) {
$actions->addLink(
$room->getActionURL('booking_plan', $booking_plan_action_params),
_('Belegungsplan'),
Icon::create('timetable'),
['data-dialog' => 'size=big']
);
$actions->addLink(
$room->getActionURL('semester_plan'),
_('Semesterbelegung'),
Icon::create('timetable'),
['data-dialog' => 'size=big']
);
}
}
if ($room->requestable && $room->userHasRequestRights($current_user)) {
$actions->addLink(
......
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