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

semester.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.
    semester.php 15.86 KiB
    <?php
    /**
     * semester.php - controller class for the semester administration
     *
     * @author    Jan-Hendrik Willms <tleilax+studip@gmail.com>
     * @author    Hermann Schröder <hermann.schroeder@uni-oldenburg.de>
     * @author    Michael Riehemann <michael.riehemann@uni-oldenburg.de>
     * @license   GPL2 or any later version
     * @category  Stud.IP
     * @package   admin
     * @since     2.1
     */
    
    class Admin_SemesterController extends AuthenticatedController
    {
        /**
         * common tasks for all actions
         *
         * @param String $action Action that has been called
         * @param Array  $args   List of arguments
         */
        public function before_filter (&$action, &$args)
        {
            parent::before_filter($action, $args);
    
            // user must have root permission
            $GLOBALS['perm']->check('root');
    
            //setting title and navigation
            PageLayout::setTitle(_('Verwaltung von Semestern'));
            Navigation::activateItem('/admin/locations/semester');
    
            // Extract and bind filter option
            $this->filter = Request::option('filter');
            if ($this->filter) {
                URLHelper::addLinkParam('filter', $this->filter);
            }
    
            // Setup sidebar
            $this->setSidebar();
        }
    
        /**
         * Display all informations about the semesters
         */
        public function index_action()
        {
            $this->semesters = array_reverse(Semester::getAll());
    
            // Filter data?
            if ($this->filter === 'current') {
                $this->semesters = array_filter($this->semesters, function ($semester) {
                    return !$semester->past;
                });
            } elseif ($this->filter === 'past') {
                $this->semesters = array_filter($this->semesters, function ($semester) {
                    return $semester->past;
                });
            }
        }
    
        /**
         * This method edits an existing semester or creates a new semester.
         *
         * @param mixed $id Id of the semester or null to create a semester.
         */
        public function edit_action($id = null)
        {
            $this->semester = new Semester($id);