aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/institute/extern.php
blob: 66329902c59480d3df072d2f2120637aeae4df4a (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
 * extern.php - administration controller for external pages for institutes
 *
 * 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.
 *
 * @author      Peter Thienel <thienel@data-quest.de>
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
 * @category    Stud.IP
 * @package     extern
 * @since       5.4
 */

require_once 'app/controllers/admin/extern.php';

class Institute_ExternController extends Admin_ExternController
{

    /**
     * @see PluginController::before_filter()
     */
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);

        if (!Institute::findCurrent()) {
            require_once 'lib/admin_search.inc.php';

            // TODO: We don't seem to need this since admin_search will stop the script
            PageLayout::postInfo(_('Sie müssen zunächst eine Einrichtung auswählen'));
            $this->redirect('institute/basicdata/index?list=TRUE');
            return;
        }
    }

    /**
     * Initialize the controller.
     */
    protected function init()
    {
        $this->range = Context::getId();
        $this->template_path = 'institute/extern/extern_config/';
        $nav = Navigation::getItem('admin/institute/external');
        if ($nav) {
            $nav->setActive(true);
        }

        $this->getSystemWideConfigTypes();
        $this->config_types['Persons'] = [
            'name'        => _('Personen'),
            'description' => _('Liste der Personen an einer Einrichtung'),
            'icon'        => 'persons2',
            'template'    => 'institute/extern/extern_config/persons',
        ];
        $this->config_types['Download'] = [
            'name'        => _('Dateien'),
            'description' => _('Liste der Dateien zum Download'),
            'icon'        => 'files',
            'template'    => 'institute/extern/extern_config/download',
        ];

        $this->fetchPlugins(false);

        PageLayout::setTitle(_('Externe Seiten (Einrichtung)'));
    }

    protected function checkPerm()
    {
        if (Context::getId() && !$GLOBALS['perm']->have_studip_perm('admin', Context::getId())) {
            throw new AccessDeniedException();
        }
    }

}