Skip to content
Snippets Groups Projects
Select Git revision
  • a790d2e3778d37eec37683336e475b707feee822
  • main default protected
  • step-01354-5.5
  • biest-504
  • issue-3215
  • step-03209-bald-rapunzel
  • tic-3123
  • tic-2720-remove-less-compilation-in-plugins
  • step-1800
  • tic-2532
  • biest-561
  • tic-3225
  • 5.3
  • 5.4
  • step-2472
  • step-2660
  • step-1559
  • tic-3094
  • biest-3206
  • biest-3207
  • 5.0
  • v5.3.1
  • v5.2.3
  • v5.1.4
  • v5.0.6
  • v5.3
  • v5.2.2
  • v5.1.3
  • v5.0.5
  • v5.2.1
  • v5.1.2
  • v5.0.4
  • v5.2
  • v5.1.1
  • v5.0.3
  • v5.1
  • v5.0.2
  • v5.0.1
  • v5.0
39 results

room_request.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 97.64 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
    {
        public function before_filter(&$action, &$args)
        {
            parent::before_filter($action, $args);
    
            $this->current_user = User::findCurrent();
    
            if (in_array($action, ['overview', 'planning', 'export_list', 'resolve', 'decline'])) {
                $this->current_user = User::findCurrent();
                $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 = [];
    
                $this->filter =& $_SESSION[__CLASS__]['filter'];
    
                if (in_array($action, ['resolve', 'decline'])) {
                    $this->filter['get_only_request_ids'] = true;
                    $this->filter['filter_request_id'] = $args[0];
                } else {
                    $this->filter['get_only_request_ids'] = false;
                }
    
                if ($action === 'planning') {
                    $this->filter['request_periods'] ='periodic';
                }
    
                if (Request::get('reset_filter')) {
                    $this->filter = [
                        'marked'       => -1,
                        'own_requests' => 1,
                        'request_status' => 'open'
                    ];
                } else {
                    if (Request::option('institut_id')) {
                        $GLOBALS['user']->cfg->store('MY_INSTITUTES_DEFAULT', Request::option('institut_id'));
                    }
                    if (Request::option('semester_id')) {
                        $GLOBALS['user']->cfg->store('MY_COURSES_SELECTED_CYCLE', Request::option('semester_id'));
                    }
                    if (Request::option('request_status')) {
                        $this->filter['request_status'] = Request::get('request_status');
                    }
                    if (!Semester::find($GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE)) {
                        $GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE = Semester::findCurrent()->id;