Select Git revision
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Jan-Hendrik Willms authored
Closes #944 Merge request studip/studip!535
Jan-Hendrik Willms authoredCloses #944 Merge request studip/studip!535
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);
}