Select Git revision
TimedFolder.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Philipp Schüttlöffel authored
Closes #2954 Merge request studip/studip!1997
Philipp Schüttlöffel authoredCloses #2954 Merge request studip/studip!1997
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
export.php 19.30 KiB
<?php
/**
* requests.php - contains Resources_ExportController
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author Moritz Strohm <strohm@data-quest.de>
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @copyright 2017
* @category Stud.IP
* @since 4.1
*/
/**
* Resources_ExportController contains functionality for data export
* for resources and especially rooms, buildings and locations.
*/
class Resources_ExportController extends AuthenticatedController
{
protected function returnCsvData($data = [], $file_name = '')
{
if (!is_array($data)) {
throw new InvalidArgumentException(
'Resources_ExportController::returnCsvData requires an array as parameter!'
);
}
$this->render_csv(
$data,
$file_name
);
}
protected function returnHtmlData($data = '')
{
$this->set_content_type('text/html');
$this->render_text($data);
}
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$this->export_type = Request::get('export_type', 'default');
$this->export_param = Request::get('export_param', '');
if (Navigation::hasItem('/resources/export')) {
Navigation::activateItem('/resources/export');
}
}
public function select_booking_sources_action($range_with_id = null)
{
if (Navigation::hasItem('/resources/export/select_booking_sources')) {
Navigation::activateItem('/resources/export/select_booking_sources');
}
if (
!ResourceManager::userHasGlobalPermission(User::findCurrent())
&& !ResourceManager::userHasResourcePermissions(User::findCurrent(), 'user')
) {
throw new AccessDeniedException();
}
$this->available_rooms = [];
$this->available_clipboards = [];