aboutsummaryrefslogtreecommitdiff
path: root/lib/navigation/AdminNavigation.php
blob: 019355924f2c406d090ef4c8b46bdc3f5a4d50b5 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php
# Lifter010: TODO
/*
 * AdminNavigation.php - navigation for admin area
 *
 * 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      Elmar Ludwig
 * @author      Michael Riehemann <michael.riehemann@uni-oldenburg.de>
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
 * @category    Stud.IP
 */

class AdminNavigation extends Navigation
{
    /**
     * Initialize a new Navigation instance.
     */
    public function __construct()
    {
        parent::__construct(_('Admin'));

        $this->setImage(Icon::create('admin', 'navigation', ["title" => _('Zu Ihrer Administrationsseite')]));
    }

    /**
     * Initialize the subnavigation of this item. This method
     * is called once before the first item is added or removed.
     */
    public function initSubNavigation()
    {
        global $SessionSeminar, $archive_kill, $perm;

        parent::initSubNavigation();

        if (Context::isInstitute()) {
            if (isset($_SESSION['links_admin_data']['referred_from']) && $_SESSION['links_admin_data']['referred_from'] == 'inst') {
                $back_jump = _('zurück zur ausgewählten Einrichtung');
            } else {
                $back_jump = _('zur ausgewählten Einrichtung');
            }
        } else if (Context::isCourse()) {
            if (isset($_SESSION['links_admin_data']['referred_from']) && $_SESSION['links_admin_data']['referred_from'] == 'sem' && !$archive_kill && !(isset($_SESSION['links_admin_data']['assi']) && $_SESSION['links_admin_data']['assi'])) {
                $back_jump = _('zurück zur ausgewählten Veranstaltung');
            } else if (isset($_SESSION['links_admin_data']['referred_from']) && $_SESSION['links_admin_data']['referred_from'] == 'assi' && !$archive_kill) {
                $back_jump = _('zur neu angelegten Veranstaltung');
            } else if (!(isset($_SESSION['links_admin_data']['assi']) && $_SESSION['links_admin_data']['assi'])) {
                $back_jump = _('zur ausgewählten Veranstaltung');
            }
        }

        $sem_create_perm = in_array(Config::get()->SEM_CREATE_PERM, ['root', 'admin', 'dozent']) ? Config::get()->SEM_CREATE_PERM : 'dozent';

        // global config / user administration
        if (!Config::get()->RESTRICTED_USER_MANAGEMENT || $perm->have_perm('root')) {
            $navigation = new Navigation(_('Benutzer'));
            $navigation->setURL('dispatch.php/admin/user/');
            $navigation->addSubNavigation('index', new Navigation(_('Benutzer'), 'dispatch.php/admin/user'));

            if ($perm->have_perm('root')) {
                $navigation->addSubNavigation('user_domains', new Navigation(_('Nutzerdomänen'), 'dispatch.php/admin/domain'));
                $navigation->addSubNavigation('auto_insert', new Navigation(_('Automatisiertes Eintragen'), 'dispatch.php/admin/autoinsert'));
            }
            $this->addSubNavigation('user', $navigation);
        }

        // institute administration
        $navigation = new Navigation(_('Einrichtungen'));

        $navigation->setURL('dispatch.php/institute/basicdata/index?cid=');
        $navigation->addSubNavigation('details', new Navigation(_('Grunddaten'), 'dispatch.php/institute/basicdata/index'));
        $navigation->addSubNavigation('faculty', new Navigation(_('Mitarbeiter'), 'dispatch.php/institute/members?admin_view=1'));
        $navigation->addSubNavigation('groups', new Navigation(_('Funktionen / Gruppen'), 'dispatch.php/admin/statusgroups?type=inst'));

        if (Config::get()->EVAL_ENABLE) {
            $navigation->addSubNavigation('evaluation', new Navigation(_('Evaluationen'), 'admin_evaluation.php?view=eval_inst'));
        }

        if (Config::get()->EXTERN_ENABLE) {
            $navigation->addSubNavigation('external', new Navigation(_('Externe Seiten'), 'admin_extern.php?view=extern_inst'));
        }

        if ($perm->have_perm("root") || ($perm->is_fak_admin() && Config::get()->INST_FAK_ADMIN_PERMS != 'none')) {
            $navigation->addSubNavigation('create', new Navigation(_('Neue Einrichtung anlegen'), 'dispatch.php/institute/basicdata/index?cid=&i_view=new'));
        }

        $this->addSubNavigation('institute', $navigation);
        $navigation = new Navigation(_('Standort'));

        if ($perm->have_perm('root')) {
            $navigation->addSubNavigation('range_tree', new Navigation(_('Einrichtungshierarchie'), 'dispatch.php/admin/tree/rangetree'));
            $navigation->addSubNavigation('sem_tree', new Navigation(_('Veranstaltungshierarchie'), 'dispatch.php/admin/tree/semtree'));
        }

        if ($perm->have_perm(Config::get()->LOCK_RULE_ADMIN_PERM ? Config::get()->LOCK_RULE_ADMIN_PERM : 'admin')) {
            $navigation->addSubNavigation('lock_rules', new Navigation(_('Sperrebenen'), 'dispatch.php/admin/lockrules'));
        }

        if ($perm->have_perm('root')) {
            if (Config::get()->SEMESTER_ADMINISTRATION_ENABLE) {
                $navigation->addSubNavigation('semester', new Navigation(_('Semester'), 'dispatch.php/admin/semester'));
                $navigation->addSubNavigation('holidays', new Navigation(_('Ferien'), 'dispatch.php/admin/holidays'));
            }

            if (Config::get()->EXTERN_ENABLE) {
                $navigation->addSubNavigation('external', new Navigation(_('Externe Seiten'), 'admin_extern.php?list=TRUE&view=extern_global'));
            }

            $navigation->addSubNavigation('sem_classes', new Navigation(_('Veranstaltungskategorien'), 'dispatch.php/admin/sem_classes/overview'));
            $navigation->addSubNavigation('loginstyle', new Navigation(_('Startbildschirm'), 'dispatch.php/admin/loginstyle'));
            $navigation->addSubNavigation(
                'content_terms_of_use',
                new Navigation(
                    _('Inhalts-Nutzungsbedingungen'),
                    'dispatch.php/admin/content_terms_of_use/index'
                )
            );
            $navigation->addSubNavigation(
                'licenses',
                new Navigation(
                    _('Lizenzen'),
                    'dispatch.php/admin/licenses/index'
                )
            );

            if (Config::get()->BANNER_ADS_ENABLE) {
                $navigation->addSubNavigation('banner', new Navigation(_('Werbebanner'), 'dispatch.php/admin/banner'));
            }

            if (PluginManager::getInstance()->getPlugin('CoursewareModule')) {
                $navigation->addSubNavigation(
                    'courseware',
                    new Navigation(
                        _('Courseware'),
                        'dispatch.php/admin/courseware/index'
                    )
                );
            }

            if (Config::get()->OERCAMPUS_ENABLED) {
                $navigation->addSubNavigation(
                    'oer',
                    new Navigation(
                        _('OER Campus'),
                        URLHelper::getURL("dispatch.php/oer/admin/hosts")
                    )
                );
            }

            $navigation->addSubNavigation(
                'accessibility_info_text',
                new Navigation(
                    _('Infotext zu barrierefreien Dateien'),
                    'dispatch.php/admin/accessibility_info_text/index'
                )
            );

        }

        if ($GLOBALS['perm']->have_perm('admin')) {
            $pool = new Navigation(_('Bilder-Pool'), 'dispatch.php/stock_images', []);
            $navigation->addSubNavigation('stock_images', $pool);
        }

        $this->addSubNavigation('locations', $navigation);

        // global config / user administration
        $navigation = new Navigation(_('System'));


        if ($perm->have_perm('root')) {
            $navigation->addSubNavigation('plugins', new Navigation(_('Plugins'), 'dispatch.php/admin/plugin'));
            $navigation->addSubNavigation('roles', new Navigation(_('Rollen'), 'dispatch.php/admin/role'));
            $navigation->addSubNavigation('datafields', new Navigation(_('Datenfelder'), 'dispatch.php/admin/datafields'));
            $navigation->addSubNavigation('configuration', new Navigation(_('Konfiguration'), 'dispatch.php/admin/configuration/configuration'));

            $navigation->addSubNavigation('coursewizardsteps',
                new Navigation(_('Anlegeassistent'), 'dispatch.php/admin/coursewizardsteps'));
            $navigation->addSubNavigation('studygroup', new Navigation(_('Studiengruppen'), 'dispatch.php/course/studygroup/globalmodules'));

            if (Config::get()->TOURS_ENABLE) {
                $navigation->addSubNavigation('tour', new Navigation(_('Touren'), 'dispatch.php/tour/admin_overview'));
            }
            $navigation->addSubNavigation('help_content', new Navigation(_('Hilfe-Texte'), 'dispatch.php/help_content/admin_overview'));

            if (Config::get()->ELEARNING_INTERFACE_ENABLE) {
                $navigation->addSubNavigation('elearning', new Navigation(_('Lernmodule'), 'admin_elearning_interface.php'));
            }

            if (Config::get()->WEBSERVICES_ENABLE) {
                $navigation->addSubNavigation('webservice_access', new Navigation(_('Webservices'), 'dispatch.php/admin/webservice_access'));
            }

            if (Config::get()->CRONJOBS_ENABLE) {
                $navigation->addSubNavigation('cronjobs', new Navigation(_('Cronjobs'), 'dispatch.php/admin/cronjobs/schedules'));
            }

            if (Config::get()->PERSONALDOCUMENT_ENABLE) {
                $navigation->addSubNavigation('document_area', new Navigation(_('Pers. Dateibereich'), 'dispatch.php/document/administration'));
            }


            $navigation->addSubNavigation('admissionrules', new Navigation(_('Anmelderegeln'), 'dispatch.php/admission/ruleadministration'));

            if (Config::get()->API_ENABLED) {
                $navigation->addSubNavigation('api', new Navigation(_('API'), 'dispatch.php/admin/api'));
            }

            $navigation->addSubNavigation('oauth2', new Navigation(_('OAuth2'), 'dispatch.php/admin/oauth2/index'));

            $navigation->addSubNavigation('globalsearch', new Navigation(_('Globale Suche'), 'dispatch.php/globalsearch/settings'));
            $navigation->addSubNavigation('cache', new Navigation(_('Cache'), 'dispatch.php/admin/cache/settings'));
        }
        if ($perm->have_perm(Config::get()->AUX_RULE_ADMIN_PERM ? Config::get()->AUX_RULE_ADMIN_PERM : 'admin')) {
            $navigation->addSubNavigation('specification', new Navigation(_('Zusatzangaben'), 'dispatch.php/admin/specification'));
        }

        $this->addSubNavigation('config', $navigation);

        // log view
        if ($perm->have_perm('root') && Config::get()->LOG_ENABLE) {
            $navigation = new Navigation(_('Log'));
            $navigation->addSubNavigation('show', new Navigation(_('Log'), 'dispatch.php/event_log/show'));
            $navigation->addSubNavigation('admin', new Navigation(_('Einstellungen'), 'dispatch.php/event_log/admin'));
            $this->addSubNavigation('log', $navigation);
        }

        // link to course
        if (Context::isInstitute()) {
            $navigation = new Navigation($back_jump, 'dispatch.php/institute/overview?auswahl=' . Context::getId());
            $this->addSubNavigation('back_jump', $navigation);
        } else if (Context::isCourse() && !$archive_kill && !(isset($_SESSION['links_admin_data']['assi']) && $_SESSION['links_admin_data']['assi'])) {
            $navigation = new Navigation($back_jump, 'seminar_main.php?auswahl=' . Context::getId());
            $this->addSubNavigation('back_jump', $navigation);
        }

        // admin plugins
        $navigation = new Navigation(_('Admin-Plugins'));
        $this->addSubNavigation('plugins', $navigation);
    }
}