aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/course/forum/forum_controller.php
blob: 71d1aa094feec94a3e7b4488f4376a403213647b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

abstract class ForumController extends StudipController {
    protected $with_session = true;

    /* * * * * * * * * * * * * * * * * * * * * * * * * */
    /* * * * * H E L P E R   F U N C T I O N S * * * * */
    /* * * * * * * * * * * * * * * * * * * * * * * * * */
    function getId()
    {
        return ForumHelpers::getSeminarId();
    }

    /**
     * Common code for all actions: set default layout and page title.
     *
     * @param type $action
     * @param type $args
     */
    function before_filter(&$action, &$args)
    {
        $this->validate_args($args, ['option', 'option']);

        parent::before_filter($action, $args);

        $this->flash = Trails_Flash::instance();

        // Set help keyword for Stud.IP's user-documentation and page title
        PageLayout::setHelpKeyword('Basis.Forum');
        PageLayout::setTitle(Context::getHeaderLine() .' - '. _('Forum'));

        // the default for displaying timestamps
        $this->time_format_string = "%a %d. %B %Y, %H:%M";
        $this->time_format_string_short = "%d.%m.%Y, %H:%M";

        //$this->getId() depends on Context::get()
        checkObject();
        ForumVisit::setVisit($this->getId());
        if (Request::int('page')) {
            ForumHelpers::setPage(Request::int('page'));
        }

        $this->seminar_id = $this->getId();

        $this->no_entries = false;
        $this->highlight = [];
        $this->highlight_topic = '';
        $this->edit_posting = '';
        $this->js = '';
    }
}