Skip to content
Snippets Groups Projects
Select Git revision
  • e4fc6d026969a5a161711495b612d1ee4b9b5e5f
  • 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

file.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.
    overview.php 4.06 KiB
    <?php
    require_once __DIR__ . '/consultation_controller.php';
    
    /**
     * Overview/Student controller for the consultation app.
     *
     * @author  Jan-Hendrik Willms <tleilax+studip@gmail.com>
     * @license GPL2 or any later version
     * @since   Stud.IP 4.3
     */
    class Consultation_OverviewController extends ConsultationController
    {
        public function before_filter(&$action, &$args)
        {
            parent::before_filter($action, $args);
    
            if (!$this->range) {
                return;
            }
    
            if ($this->range->isEditableByUser()) {
                $this->redirect('consultation/admin');
                return;
            }
    
            PageLayout::setTitle(sprintf(
                '%s: %s',
                $this->getConsultationTitle(),
                $this->range->getFullName()
            ));
        }
    
        public function index_action($page = 0)
        {
            $this->activateNavigation('overview');
            $this->setupSidebar();
    
            $this->count = ConsultationBlock::countByRange($this->range);
            $this->limit = Config::get()->ENTRIES_PER_PAGE;
    
            if ($page >= ceil($this->count / $this->limit)) {
                $page = 0;
            }
    
            $this->page   = max($page, 0);
            $this->blocks = ConsultationBlock::findbyRange(
                $this->range,
                "ORDER BY start ASC LIMIT " . ($this->page * $this->limit) . ", {$this->limit}"
            );
    
            $action = $GLOBALS['user']->cfg->CONSULTATION_SHOW_GROUPED ? 'index' : 'ungrouped';
            $this->render_action($action);
        }
    
        public function booked_action($page = 0)
        {
            $this->activateNavigation('booked');
    
            $this->slots = ConsultationSlot::findOccupiedSlotsByUserAndRange(
                $GLOBALS['user']->id,
                $this->range
            );
        }
    
        public function book_action($block_id, $slot_id)
        {
            $this->slot = $this->loadSlot($block_id, $slot_id);
    
            if (Request::isPost()) {
                CSRFProtection::verifyUnsafeRequest();