aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/course/forum/configs.php
blob: 209799f822ad12acf8ff51d6613c02ea958e22c2 (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
<?php
require_once 'BaseController.php';

class Course_Forum_ConfigsController extends Forum\BaseController
{
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);

        if (! $this->is_admin) {
            throw new AccessDeniedException();
        }
    }

    public function edit_action()
    {
        $this->config = Context::get()->getConfiguration();
    }

    public function save_action()
    {
        CSRFProtection::verifyUnsafeRequest();

        $this->config = Context::get()->getConfiguration();

        $this->config->store('FORUM_MODERATION_PERMISSION', trim(Request::option('forum_moderation_permission')));

        $this->config->store('FORUM_HIDE_CATEGORIES_NAVIGATION', Request::bool('forum_hide_categories_navigation'));

        PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.'));

        $this->relocate('course/forum/topics');
    }
}