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

index.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.
    index.php 29.14 KiB
    <?php
    
    /*
     * Copyright (C) 2011 - Till Glöggler     <tgloeggl@uos.de>
     *
     * 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.
     */
    
    require_once 'forum_controller.php';
    
    class Course_Forum_IndexController extends ForumController
    {
        /* * * * * * * * * * * * * * * * * * * * * * * * * */
        /*  V   I   E   W   -   A   C   T   I   O   N   S  */
        /* * * * * * * * * * * * * * * * * * * * * * * * * */
    
        /**
         * redirect to correct page (overview or newest entries),
         * depending on whether there are any entries.
         */
        function enter_seminar_action() {
            if (ForumPerm::has('fav_entry', $this->getId())
                && ForumVisit::getCount($this->getId(), ForumVisit::getVisit($this->getId())) > 0) {
                $this->redirect('course/forum/index/newest');
            } else {
                $this->redirect('course/forum/index/index');
            }
        }
    
        /**
         * the main action for the forum. May be called with a topic_id to be displayed
         * and optionally the page to display
         *
         * @param type $topic_id the topic to display, defaults to the main
         *                       view of the current seminar
         * @param type $page the page to be displayed (for thread-view)
         */
        function index_action($topic_id = null, $page = null)
        {
            $nav = Navigation::getItem('course/forum2');
            $nav->setImage(Icon::create('forum', 'info'));
            Navigation::activateItem('course/forum2/index');
    
            // check, if the root entry is present
            ForumEntry::checkRootEntry($this->getId());
    
            /* * * * * * * * * * * * * * * * * * *
             * V A R I A B L E N   F U E L L E N *
             * * * * * * * * * * * * * * * * * * */
    
            $this->section   = 'index';
    
            $this->topic_id   = $topic_id ? $topic_id : $this->getId();
            $this->constraint = ForumEntry::getConstraints($this->topic_id);
    
            // check if there has been submitted an invalid id and use seminar_id in case
            if (!$this->constraint) {
                $this->topic_id   = $this->getId();
                $this->constraint = ForumEntry::getConstraints($this->topic_id);
            }
    
            $this->highlight_topic = Request::option('highlight_topic', null);
    
            // set page to which we shall jump
            if ($page) {
                ForumHelpers::setPage($page);
            }