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
|
<?php
# Lifter002: TODO
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO
use Studip\Button, Studip\LinkButton;
/**
* class to generate links to ILIAS 3
*
* This class contains methods to generate links to ILIAS 3.
*
* @author Arne Schröder <schroeder@data-quest.de>
* @access public
* @modulegroup elearning_interface_modules
* @module Ilias3ConnectedLink
* @package ELearning-Interface
*/
class Ilias3ConnectedLink extends ConnectedLink
{
/**
* constructor
*
* init class.
* @access
* @param string $cms system-type
*/
function __construct($cms)
{
parent::__construct($cms);
$this->cms_link = "ilias3_referrer.php";
}
/**
* get user module links
*
* returns content module links for user
* @return string html-code
*/
public function getUserModuleLinks()
{
global $connected_cms, $current_module;
$output = '';
if ($connected_cms[$this->cms_type]->isAuthNecessary() && !$connected_cms[$this->cms_type]->user->isConnected()) {
$output .= $this->getNewAccountLink();
} elseif (!$connected_cms[$this->cms_type]->content_module[$current_module]->isDummy()) {
if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_READ)) {
$output .= LinkButton::create(
_('Starten'),
URLHelper::getURL($this->cms_link, [
'client_id' => $connected_cms[$this->cms_type]->getClientId(),
'cms_select' => $this->cms_type,
// 'sess_id' => $connected_cms[$this->cms_type]->user->getSessionId(),
'ref_id' => $connected_cms[$this->cms_type]->content_module[$current_module]->getId(),
'type' => $connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType(),
'target' => 'start',
]),
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
]
);
$output .= " ";
}
if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
$output .= LinkButton::create(
_('Bearbeiten'),
URLHelper::getURL($this->cms_link, [
'client_id' => $connected_cms[$this->cms_type]->getClientId(),
'cms_select' => $this->cms_type,
// 'sess_id' => $connected_cms[$this->cms_type]->user->getSessionId(),
'ref_id' => $connected_cms[$this->cms_type]->content_module[$current_module]->getId(),
'type' => $connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType(),
'target' => 'edit',
]),
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
]
);
$output .= " ";
}
}
return $output;
}
/**
* get admin module links
*
* returns links add or remove a module from course
* @return string returns html-code
*/
public function getAdminModuleLinks()
{
global $connected_cms, $view, $search_key, $cms_select, $current_module;
$output = "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
$output .= CSRFProtection::tokenTag();
$output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
$output .= " " . Button::create(_('Entfernen'), 'remove');
} elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
$output .= "<div align=\"left\"><input type=\"CHECKBOX\" value=\"1\" name=\"write_permission\" style=\"vertical-align:middle\">";
$output .= _("Mit Schreibrechten für alle Lehrenden/Tutoren und Tutorinnen dieser Veranstaltung") . "<br>";
$output .= "<input type=\"CHECKBOX\" value=\"1\" style=\"vertical-align:middle\" name=\"write_permission_autor\">";
$output .= _("Mit Schreibrechten für alle Teilnehmenden dieser Veranstaltung") . "</div>";
$output .= Button::create(_('Hinzufügen'), 'add') . "<br>";
} else {
$output .= " " . Button::create(_('Hinzufügen'), 'add');
}
$output .= "</form>";
return $output;
}
/**
* get new module link
*
* returns link to create a new module if allowed
* @return string|false returns html-code or false
*/
public function getNewModuleLink()
{
global $connected_cms, $auth;
$output = "\n";
if (Request::get("module_type_" . $this->cms_type)) {
if (!$connected_cms[$this->cms_type]->user->category) {
$connected_cms[$this->cms_type]->user->newUserCategory();
if ($connected_cms[$this->cms_type]->user->category == false) {
return $output;
}
}
$output = " ";
$output .= LinkButton::create(
_('Neu anlegen'),
URLHelper::getURL($this->cms_link, [
'client_id' => $connected_cms[$this->cms_type]->getClientId(),
'cms_select' => $this->cms_type,
// 'sess_id' => $connected_cms[$this->cms_type]->user->getSessionId(),
'ref_id' => $connected_cms[$this->cms_type]->user->category,
'type' => Request::option("module_type_" . $this->cms_type),
'target' => 'new',
]),
[
'target' => '_blank',
'rel' => 'noopener noreferrer',
]
);
}
$user_crs_role = $connected_cms[$this->cms_type]->crs_roles[$auth->auth['perm']];
if ($user_crs_role === 'admin') {
return $output;
}
return false;
}
/**
* get start page link
*
* returns link to ilias start-page
* @access public
* @return string returns url or false
*/
function getStartpageLink()
{
global $connected_cms;
if ($connected_cms[$this->cms_type]->user->isConnected()) {
$output = $this->cms_link . "?"
. "client_id=" . $connected_cms[$this->cms_type]->getClientId()
. "&cms_select=" . $this->cms_type
. "&target=login";
}
return $output;
}
}
?>
|