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

my_courses.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.
    my_courses.php 45.43 KiB
    <?php
    /**
     * my_courses.php - Controller for user and seminar related
     * pages under "Meine Veranstaltungen"
     *
     * 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.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     *
     * @author    Jan-Hendrik Willms <tleilax+studip@gmail.com>
     * @author    David Siegfried <david@ds-labs.de>
     * @license   http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 or later
     * @category  Stud.IP
     * @since     3.1
     */
    require_once 'lib/meine_seminare_func.inc.php';
    require_once 'lib/object.inc.php';
    
    class MyCoursesController extends AuthenticatedController
    {
        /**
         * @var Callable
         */
        private $performance_timer = null;
    
        public function before_filter(&$action, &$args)
        {
            parent::before_filter($action, $args);
    
            if ($GLOBALS['perm']->have_perm('admin')) {
                $this->redirect('admin/courses/index');
                return;
            }
    
            // we are defintely not in an lecture or institute
            closeObject();
            $_SESSION['links_admin_data'] = '';
    
            // measure performance of #index_action
            if ($action === 'index') {
                $this->performance_timer = Metrics::startTimer();
            }
        }
    
        public function after_filter($action, $args)
        {
            parent::after_filter($action, $args);
    
            // send performance metric
            if (isset($this->performance_timer)) {
                $timer = $this->performance_timer;
                $timer('core.my_courses_time');
            }
        }
    
        /**
         * Autor / Tutor / Teacher action
         */
        public function index_action()
        {