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
|
<?php
/**
* Ilias Interface - navigation and meta data
*
* @author André Noack <noack@data-quest.de>
* @copyright 2019 Stud.IP Core-Group
* @license GPL version 2 or any later version
* @since 4.3
*/
class IliasInterfaceModule extends CorePlugin implements StudipModule, SystemPlugin
{
public function __construct()
{
parent::__construct();
if (Config::get()->ILIAS_INTERFACE_ENABLE) {
$ilias_interface_config = Config::get()->ILIAS_INTERFACE_BASIC_SETTINGS;
if (Seminar_Perm::get()->have_perm('root')) {
Navigation::addItem('/admin/config/ilias_interface',
new Navigation(_('ILIAS-Schnittstelle'), 'dispatch.php/admin/ilias_interface'));
}
if (Seminar_Perm::get()->have_perm('tutor') || (Seminar_Perm::get()->have_perm('autor') && array_key_exists('show_tools_page', $ilias_interface_config) && $ilias_interface_config['show_tools_page'])) {
$ilias = new Navigation(_('ILIAS'), 'dispatch.php/my_ilias_accounts');
$ilias->setImage(Icon::create('ilias'));
$ilias->setDescription(_('Schnittstelle zu ILIAS'));
Navigation::addItem('/contents/my_ilias_accounts', $ilias);
}
}
}
public function isActivatableForContext(Range $context)
{
return Config::get()->ILIAS_INTERFACE_ENABLE && $context->getRangeType() === 'course';
}
public function getInfoTemplate($course_id)
{
return null;
}
public function getIconNavigation($course_id, $last_visit, $user_id)
{
if (!Config::get()->ILIAS_INTERFACE_ENABLE) {
return;
}
$sql = "SELECT COUNT(IF(a.module_type != 'crs', module_id, NULL)) AS count_modules,
COUNT(IF(a.module_type = 'crs', module_id, NULL)) AS count_courses,
COUNT(IF((chdate > IFNULL(b.visitdate, :threshold) AND a.module_type != 'crs'), module_id, NULL)) AS neue
FROM object_contentmodules AS a
LEFT JOIN object_user_visits AS b
ON b.object_id = a.object_id
AND b.user_id = :user_id
AND b.plugin_id = :plugin_id
WHERE a.object_id = :course_id
GROUP BY a.object_id";
$statement = DBManager::get()->prepare($sql);
$statement->bindValue(':user_id', $user_id);
$statement->bindValue(':course_id', $course_id);
$statement->bindValue(':threshold', $last_visit);
$statement->bindValue(':plugin_id', $this->getPluginId());
$statement->execute();
$result = $statement->fetch(PDO::FETCH_ASSOC);
if (!$result) {
return null;
}
$title = CourseConfig::get($course_id)->getValue('ILIAS_INTERFACE_MODULETITLE');
$nav = new Navigation($title, 'dispatch.php/course/ilias_interface/index');
if ($result['neue']) {
$nav->setImage(Icon::create('learnmodule', Icon::ROLE_ATTENTION, [
'title' => sprintf(
ngettext(
'%1$d Lernobjekt, %2$d neues',
'%1$d Lernobjekte, %2$d neue',
$result['count_modules']
),
$result['count_modules'],
$result['neue']
)
]));
} elseif ($result['count_modules']) {
$nav->setImage(Icon::create('learnmodule', Icon::ROLE_CLICKABLE, [
'title' => sprintf(
ngettext(
'%d Lernobjekt',
'%d Lernobjekte',
$result['count_modules']
),
$result['count_modules']
)
]));
} elseif ($result['count_courses']) {
$nav->setImage(Icon::create('learnmodule', Icon::ROLE_CLICKABLE, [
'title' => sprintf(
ngettext(
'%d ILIAS-Kurs',
'%d ILIAS-Kurse',
$result['count_courses']
),
$result['count_courses']
)
]));
}
return $nav;
}
public function getTabNavigation($course_id)
{
if (!Config::get()->ILIAS_INTERFACE_ENABLE) {
return null;
}
$ilias_interface_config = Config::get()->ILIAS_INTERFACE_BASIC_SETTINGS;
if (count($ilias_interface_config) === 0) {
return null;
}
$moduletitle = Config::get()->ILIAS_INTERFACE_MODULETITLE;
if ($ilias_interface_config['edit_moduletitle']) {
$moduletitle = CourseConfig::get($course_id)->ILIAS_INTERFACE_MODULETITLE;
}
$navigation = new Navigation($moduletitle);
$navigation->setImage(Icon::create('learnmodule', Icon::ROLE_INFO_ALT));
$navigation->setActiveImage(Icon::create('learnmodule', Icon::ROLE_INFO));
if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id) || ($GLOBALS['perm']->have_studip_perm('autor', $course_id) && IliasObjectConnections::isCourseConnected($course_id))) {
if (get_object_type($course_id, ['inst'])) {
$navigation->addSubNavigation('view', new Navigation(_('Lernobjekte dieser Einrichtung'), 'dispatch.php/course/ilias_interface/index/' . $course_id));
} else {
$navigation->addSubNavigation('view', new Navigation(_('Lernobjekte dieser Veranstaltung'), 'dispatch.php/course/ilias_interface/index/' . $course_id));
}
}
return ['ilias_interface' => $navigation];
}
/**
* @see StudipModule::getMetadata()
*/
public function getMetadata()
{
return [
'summary' => _('Zugang zu extern erstellten ILIAS-Lernobjekten'),
'description' => _('Über diese Schnittstelle ist es möglich, Lernobjekte aus ' .
'einer ILIAS-Installation (ILIAS-Version >= 5.3.8) in Stud.IP zur Verfügung ' .
'zu stellen. Lehrende haben die Möglichkeit, in ' .
'ILIAS Selbstlerneinheiten zu erstellen und in Stud.IP bereit zu stellen.'),
'displayname' => _('ILIAS-Schnittstelle'),
'category' => _('Inhalte und Aufgabenstellungen'),
'keywords' => _('Einbindung von ILIAS-Lernobjekten;
Zugang zu ILIAS;
Aufgaben- und Test-Erstellung'),
'icon' => Icon::create('learnmodule', Icon::ROLE_INFO),
'icon_clickable' => Icon::create('learnmodule', Icon::ROLE_CLICKABLE),
'descriptionshort' => _('Zugang zu extern erstellten ILIAS-Lernobjekten'),
'descriptionlong' => _('Über diese Schnittstelle ist es möglich, Lernobjekte aus ' .
'einer ILIAS-Installation (> 5.3.8) in Stud.IP zur Verfügung ' .
'zu stellen. Lehrende haben die Möglichkeit, in ' .
'ILIAS Selbstlerneinheiten zu erstellen und in Stud.IP bereit zu stellen.'),
];
}
}
|