blob: 2ff62ad8058c9035f931dd344cceeb11324acf98 (
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
|
<?php
# Lifter010: TODO
/*
* CourseNavigation.php - navigation for course / institute 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
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
*/
class CourseNavigation extends Navigation
{
/**
* Initialize a new Navigation instance.
*/
public function __construct()
{
global $user, $perm;
// check if logged in
if (is_object($user) && $user->id != 'nobody') {
$coursetext = _('Veranstaltungen');
$courseinfo = _('Meine Veranstaltungen & Einrichtungen');
$courselink = 'dispatch.php/my_courses';
} else {
$coursetext = _('Freie');
$courseinfo = _('Freie Veranstaltungen');
$courselink = 'dispatch.php/public_courses';
}
parent::__construct($coursetext, $courselink);
if (is_object($user)) {
$this->setImage(Icon::create('seminar', 'navigation', ["title" => $courseinfo]));
}
}
/**
* Initialize the subnavigation of this item. This method
* is called once before the first item is added or removed.
*/
public function initSubNavigation()
{
parent::initSubNavigation();
$context = Context::get();
if (!$context) {
return;
}
foreach ($context->tools as $tool) {
if (Context::isInstitute() || Seminar_Perm::get()->have_studip_perm($tool->getVisibilityPermission(), $context->id)) {
$studip_module = $tool->getStudipModule();
if ($studip_module instanceof StudipModule) {
$tool_nav = $studip_module->getTabNavigation($context->id) ?: [];
foreach ($tool_nav as $nav_name => $navigation) {
if ($nav_name && is_a($navigation, "Navigation")) {
if ($tool->metadata['displayname']) {
$navigation->setTitle($tool->getDisplayname());
}
$this->addSubNavigation($nav_name, $navigation);
}
}
}
}
}
}
}
|