Skip to content
Snippets Groups Projects
Select Git revision
  • 327bac3d6030f06dc5cba08b47d545cf84bbd5a9
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

SchemaProvider.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    room_request.php 105.08 KiB
    <?php
    
    /**
     * request.php - contains Resources_RequestController
     *
     * 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-2019
     * @category    Stud.IP
     * @since       4.5
     */
    
    
    /**
     * Resources_RequestController contains resource request functionality.
     */
    class Resources_RoomRequestController extends AuthenticatedController
    {
        protected $filter;
    
        public function before_filter(&$action, &$args)
        {
            parent::before_filter($action, $args);
    
            $this->current_user = User::findCurrent();
    
            $default_filters = [];
            if (in_array($action, ['resolve', 'decline'])) {
                $default_filters['get_only_request_ids'] = true;
                $default_filters['filter_request_id'] = $args[0];
            } elseif ($action === 'planning') {
                $default_filters['request_periods'] ='periodic';
            }
    
            $this->filter = $this->getFilters($default_filters);
            $this->available_rooms = [];
            if (in_array($action, ['overview', 'planning', 'export_list', 'resolve', 'decline'])) {
                $user_is_global_resource_autor = ResourceManager::userHasGlobalPermission($this->current_user, 'autor');
                if (!RoomManager::userHasRooms($this->current_user, 'autor', true) && !$user_is_global_resource_autor) {
                    throw new AccessDeniedException(_('Ihre Berechtigungen an Räumen reichen nicht aus, um die Anfrageliste anzeigen zu können!'));
                }
    
                $this->available_rooms = RoomManager::getUserRooms($this->current_user, 'autor', true);
                $this->selected_room_ids = [];
    
                if (!Semester::find($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE)) {
                    $GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE = Semester::findCurrent()->id;
                }
            }
    
            $this->selected_room_ids = [];
            if (isset($this->filter['room_id'])) {
                $room = Resource::find($this->filter['room_id']);
                if (!$room) {
                    PageLayout::postError(
                        _('Der gewählte Raum wurde nicht gefunden!')
                    );
                    return;
                }
                $room = $room->getDerivedClassInstance();
                if (!($room instanceof Room)) {
                    PageLayout::postError(
                        _('Es wurde kein Raum ausgewählt!')
                    );
                    return;