aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/evaluation/pool.php
blob: 6b25e324ae492d46b70ce6e2da304ecce6666b85 (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
<?php
class Evaluation_PoolController extends AuthenticatedController
{
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);
        $current_user = User::findCurrent();
        if (!($current_user->hasPermissionLevel('root') ||
            $current_user->hasRole('Zentraler Evaluationsadmin'))) {
            throw new AccessDeniedException();
        }
    }

    public function index_action()
    {
        Navigation::activateItem('/evaluation/pool');
        $this->templates = Questionnaire::findBySQL("`is_template` = 1");
    }

    public function template_enable_action(Questionnaire $template)
    {
        $template->template_is_enabled = (int)!$template->template_is_enabled;
        $template->store();
        $this->redirect('evaluation/pool');
    }
}