diff --git a/app/controllers/resources/export.php b/app/controllers/resources/export.php index 6c430094dabbb897299b7a071040819f0d47d060..f0d5905a55e82f04f4aba6b9616c54af48d8d016 100644 --- a/app/controllers/resources/export.php +++ b/app/controllers/resources/export.php @@ -67,6 +67,7 @@ class Resources_ExportController extends AuthenticatedController PageLayout::setTitle(_('Quellen für den Export von Buchungen auswählen')); + $this->weekdays = ['1', '2', '3', '4', '5']; $this->select_rooms = Request::get('select_rooms'); if ($this->select_rooms) { @@ -265,12 +266,21 @@ class Resources_ExportController extends AuthenticatedController 'H:i' ); + //Get the selected weekdays: + $this->weekdays = Request::getArray('weekdays'); + if ($this->begin >= $this->end) { PageLayout::postError( _('Der Startzeitpunkt darf nicht hinter dem Endzeitpunkt liegen!') ); return; } + if (!$this->weekdays) { + PageLayout::postError( + _('Bitte mindestens einen Wochentag auswählen.') + ); + return; + } //Resolve the IDs to clipboards (or rooms) and build a list of rooms. @@ -342,6 +352,13 @@ class Resources_ExportController extends AuthenticatedController //Prepare data for export: foreach ($intervals as $interval) { + //Check the weekday of the interval first to avoid any other computation + //if the weekday is not one of the selected weekdays. + $interval_weekday = date('N', $interval->begin); + if (!in_array($interval_weekday, $this->weekdays)) { + //The interval is not on one of the selected weekdays. + continue; + } $booking = $interval->booking; if (!$booking instanceof ResourceBooking || !in_array($booking->booking_type, $types)) { continue; diff --git a/app/controllers/room_management/planning.php b/app/controllers/room_management/planning.php index 7f01e8647926cff37ba005c829b385bcee681d06..81627e294ae6dae687d71262aa82adc26cd64683 100644 --- a/app/controllers/room_management/planning.php +++ b/app/controllers/room_management/planning.php @@ -46,6 +46,14 @@ class RoomManagement_PlanningController extends AuthenticatedController //Build sidebar: $sidebar = Sidebar::get(); + $actions = new ActionsWidget(); + $actions->addLink( + _('Drucken'), + 'javascript:void(window.print());', + Icon::create('print') + ); + $sidebar->addWidget($actions); + $views = new ViewsWidget(); if ($GLOBALS['user']->id && ($GLOBALS['user']->id !== 'nobody')) { $views->addLink( @@ -291,6 +299,11 @@ class RoomManagement_PlanningController extends AuthenticatedController } $actions = new ActionsWidget(); + $actions->addLink( + _('Drucken'), + 'javascript:void(window.print());', + Icon::create('print') + ); $actions->addLink( _('Buchungen kopieren'), $this->url_for('room_management/planning/copy_bookings'), diff --git a/app/views/resources/export/select_booking_sources.php b/app/views/resources/export/select_booking_sources.php index f24b064cb0c14fe817302a9763dc5095824143a4..a0fe6078ded26476a9319144a237a5922c85d2e4 100644 --- a/app/views/resources/export/select_booking_sources.php +++ b/app/views/resources/export/select_booking_sources.php @@ -19,6 +19,46 @@ value="<?= $end->format('H:i')?>"> </label> </fieldset> + <fieldset> + <legend><?= _('Wochentage auswählen') ?></legend> + <div class="hgroup"> + <label> + <input type="checkbox" name="weekdays[]" value="1" + <?= in_array('1', $weekdays) ? 'checked' : '' ?>> + <?= _('Montag') ?> + </label> + <label> + <input type="checkbox" name="weekdays[]" value="2" + <?= in_array('2', $weekdays) ? 'checked' : '' ?>> + <?= _('Dienstag') ?> + </label> + <label> + <input type="checkbox" name="weekdays[]" value="3" + <?= in_array('3', $weekdays) ? 'checked' : '' ?>> + <?= _('Mittwoch') ?> + </label> + <label> + <input type="checkbox" name="weekdays[]" value="4" + <?= in_array('4', $weekdays) ? 'checked' : '' ?>> + <?= _('Donnerstag') ?> + </label> + <label> + <input type="checkbox" name="weekdays[]" value="5" + <?= in_array('5', $weekdays) ? 'checked' : '' ?>> + <?= _('Freitag') ?> + </label> + <label> + <input type="checkbox" name="weekdays[]" value="6" + <?= in_array('6', $weekdays) ? 'checked' : '' ?>> + <?= _('Samstag') ?> + </label> + <label> + <input type="checkbox" name="weekdays[]" value="7" + <?= in_array('7', $weekdays) ? 'checked' : '' ?>> + <?= _('Sonntag') ?> + </label> + </div> + </fieldset> <? if ($available_rooms): ?> <table class="default"> <caption>