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