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

CalendarNavigation.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.
    CalendarNavigation.php 1.77 KiB
    <?php
    # Lifter010: TODO
    /*
     * CalendarNavigation.php - navigation for calendar
     *
     * 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      Elmar Ludwig
     * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
     * @category    Stud.IP
     */
    
    class CalendarNavigation extends Navigation
    {
        /**
         * Initialize a new Navigation instance.
         */
        public function __construct()
        {
            $title = _('Planer');
            $main_url = URLHelper::getURL('dispatch.php/calendar/calendar', ['defaultDate' => date('Y-m-d')]);
            if (!$GLOBALS['perm']->have_perm('admin') && Config::get()->SCHEDULE_ENABLE) {
                $main_url = URLHelper::getURL('dispatch.php/calendar/schedule/index');
            }
            parent::__construct($title, $main_url);
    
            $this->setImage(Icon::create('schedule', 'navigation', ['title' => $title]));
        }
    
        /**
         * Initialize the sub-navigation of this item. This method
         * is called once before the first item is added or removed.
         */
        public function initSubNavigation()
        {
            parent::initSubNavigation();
    
            if (!$GLOBALS['perm']->have_perm('admin') && Config::get()->SCHEDULE_ENABLE) {
                $navigation = new Navigation(_('Stundenplan'), 'dispatch.php/calendar/schedule/index');
                $this->addSubNavigation('schedule', $navigation);
            }
    
            if (Config::get()->CALENDAR_ENABLE) {
                $navigation = new Navigation(_('Kalender'), 'dispatch.php/calendar/calendar', ['defaultDate' => date('Y-m-d')]);
                $this->addSubNavigation('calendar', $navigation);
            }
        }
    }