aboutsummaryrefslogtreecommitdiff
path: root/lib/elearning
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2022-07-14 07:22:51 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2022-07-14 07:22:51 +0000
commit60080354dcc904e01f4ee88793d0e132afca8227 (patch)
treecfa130035184cb194f1e1f2a1f515c96ce60f9fe /lib/elearning
parent988123d8bf65657907cde0a522e5354b476212d8 (diff)
resurrect lost commit, fixes #1235
Closes #1235 Merge request studip/studip!806
Diffstat (limited to 'lib/elearning')
-rw-r--r--lib/elearning/ConnectedLink.class.php4
-rw-r--r--lib/elearning/ELearningUtils.class.php28
-rw-r--r--lib/elearning/Ilias3ConnectedCMS.class.php39
-rw-r--r--lib/elearning/Ilias3ConnectedLink.class.php147
-rw-r--r--lib/elearning/Ilias3ConnectedPermissions.class.php62
-rw-r--r--lib/elearning/Ilias3ContentModule.class.php26
-rw-r--r--lib/elearning/Ilias4ConnectedCMS.class.php14
-rw-r--r--lib/elearning/Ilias4ConnectedLink.class.php6
-rw-r--r--lib/elearning/Ilias4Soap.class.php4
-rw-r--r--lib/elearning/PmWikiConnectedCMS.class.php32
10 files changed, 171 insertions, 191 deletions
diff --git a/lib/elearning/ConnectedLink.class.php b/lib/elearning/ConnectedLink.class.php
index 2be5a12..80c61d1 100644
--- a/lib/elearning/ConnectedLink.class.php
+++ b/lib/elearning/ConnectedLink.class.php
@@ -47,7 +47,7 @@ class ConnectedLink
{
global $connected_cms, $cms_select, $current_module;
- $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
+ $output = "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
$output .= CSRFProtection::tokenTag();
$output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . Request::option('view') . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"ref_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
@@ -84,7 +84,7 @@ class ConnectedLink
{
global $connected_cms, $view, $search_key, $cms_select, $current_module;
- $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
+ $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";
diff --git a/lib/elearning/ELearningUtils.class.php b/lib/elearning/ELearningUtils.class.php
index ad49569..30c40c4 100644
--- a/lib/elearning/ELearningUtils.class.php
+++ b/lib/elearning/ELearningUtils.class.php
@@ -225,8 +225,6 @@ class ELearningUtils
$template->set_attribute('is_connected', 1);
}
$template->set_attribute('my_account_cms', $my_account_cms);
- $template->set_attribute('search_key', $search_key);
- $template->set_attribute('view', $view);
$template->set_attribute('message', $message);
return $template->render();
}
@@ -318,7 +316,6 @@ class ELearningUtils
}
}
} elseif (!$is_verified) {
- $output .= '<font size="-1">';
if (Request::submitted('start')) {
$messages["info"] = sprintf(_("Sie versuchen zum erstem Mal ein Lernmodul des angebundenen Systems %s zu starten. Bevor Sie das Modul nutzen können, muss Ihrem Stud.IP-Benutzeraccount ein Account im angebundenen System zugeordnet werden."), htmlReady($connected_cms[$new_account_cms]->getName())) . "<br><br>\n\n";
}
@@ -464,7 +461,7 @@ class ELearningUtils
*
* creates output of ilias courses linked to the chosen seminar. also updates object-connections.
*
- * @return boolean successful
+ * @return array
*/
public static function getIliasCourses($sem_id)
{
@@ -475,15 +472,20 @@ class ELearningUtils
FROM object_contentmodules
WHERE module_type = 'crs' AND object_id = " . $db->quote($sem_id))
->fetchAll(PDO::FETCH_ASSOC);
- foreach ($rs as $row) $courses[$row['system_type']] = $row['module_id'];
+ foreach ($rs as $row) {
+ $courses[$row['system_type']] = $row['module_id'];
+ }
+
+ $connected_courses = [
+ 'courses' => [],
+ ];
if (is_array($courses))
- foreach($courses as $system_type => $crs_id)
+ foreach ($courses as $system_type => $crs_id)
if (self::isCMSActive($system_type)) {
self::loadClass($system_type);
$connected_courses['courses'][$system_type] = [
'url' => URLHelper::getLink($connected_cms[$system_type]->link->cms_link . '?client_id=' . $connected_cms[$system_type]->getClientId() . '&cms_select=' . $system_type . '&ref_id=' . $crs_id . '&type=crs&target=start'),
'cms_name' => $connected_cms[$system_type]->getName()];
- $course_output[] = "<a href=\"" . URLHelper::getLink($connected_cms[$system_type]->link->cms_link . "?" . "client_id=" . $connected_cms[$system_type]->getClientId() . "&cms_select=" . $system_type . "&ref_id=" . $crs_id . "&type=crs&target=start") . "\" target=\"_blank\" rel=\"noopener noreferrer\">".sprintf(_("Kurs in %s"), htmlReady($connected_cms[$system_type]->getName()))."</a>";
// gegebenenfalls zugeordnete Module aktualisieren
if (Request::option('update')) {
if ((method_exists($connected_cms[$system_type], "updateConnections"))) {
@@ -496,17 +498,11 @@ class ELearningUtils
}
if ($connected_courses['courses']) {
- if (count($connected_courses['courses']) > 1)
+ if (count($connected_courses['courses']) > 1) {
$connected_courses['text'] = _("Diese Veranstaltung ist mit folgenden Ilias-Kursen verknüpft. Hier gelangen Sie direkt in den jeweiligen Kurs: ");
- else
+ } else {
$connected_courses['text'] = _("Diese Veranstaltung ist mit einem Ilias-Kurs verknüpft. Hier gelangen Sie direkt in den Kurs: ");
- $output["update"] .= _("Hier können Sie die Zuordnungen zu den verknüpften Kursen aktualisieren."). "<br>";
- $output["update"] .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "#anker\">\n";
- $output["update"] .= CSRFProtection::tokenTag();
- $output["update"] .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
- $output["update"] .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
- $output["update"] .= Button::create(_('Aktualisieren'), 'update');
- $output["update"] .= "</form>";
+ }
}
return $connected_courses;
diff --git a/lib/elearning/Ilias3ConnectedCMS.class.php b/lib/elearning/Ilias3ConnectedCMS.class.php
index de8db3f..3e428ff 100644
--- a/lib/elearning/Ilias3ConnectedCMS.class.php
+++ b/lib/elearning/Ilias3ConnectedCMS.class.php
@@ -67,12 +67,9 @@ class Ilias3ConnectedCMS extends ConnectedCMS
* get preferences
*
* shows additional settings.
- * @access public
*/
- function getPreferences()
+ public function getPreferences()
{
- global $connected_cms;
-
$role_template_name = Request::get('role_template_name');
$cat_name = Request::get('cat_name');
$style_setting = Request::option('style_setting');
@@ -80,48 +77,46 @@ class Ilias3ConnectedCMS extends ConnectedCMS
$this->soap_client->setCachingStatus(false);
- if ($cat_name != "")
- {
+ $messages = ['error' => ''];
+
+ if ($cat_name) {
$cat = $this->soap_client->getReferenceByTitle( trim( $cat_name ), "cat");
- if ($cat == false)
+ if (!$cat) {
$messages["error"] .= sprintf(_("Das Objekt mit dem Namen \"%s\" wurde im System %s nicht gefunden."), htmlReady($cat_name), htmlReady($this->getName())) . "<br>\n";
- if ($cat != "")
- {
+ } else {
ELearningUtils::setConfigValue("category_id", $cat, $this->cms_type);
$this->main_category_node_id = $cat;
}
}
- if ($role_template_name != "")
- {
+ if ($role_template_name) {
$role_template = $this->soap_client->getObjectByTitle( trim( $role_template_name ), "rolt" );
- if ($role_template == false)
+ if (!$role_template) {
$messages["error"] .= sprintf(_("Das Rollen-Template mit dem Namen \"%s\" wurde im System %s nicht gefunden."), htmlReady($role_template_name), htmlReady($this->getName())) . "<br>\n";
- if (is_array($role_template))
- {
+ } elseif (is_array($role_template)) {
ELearningUtils::setConfigValue("user_role_template_id", $role_template["obj_id"], $this->cms_type);
ELearningUtils::setConfigValue("user_role_template_name", $role_template["title"], $this->cms_type);
$this->user_role_template_id = $role_template["obj_id"];
}
}
- if (Request::submitted('submit'))
- {
+ if (Request::submitted('submit')) {
ELearningUtils::setConfigValue("user_style", $style_setting, $this->cms_type);
ELearningUtils::setConfigValue("user_skin", $style_setting, $this->cms_type);
ELearningUtils::setConfigValue("encrypt_passwords", $encrypt_passwords, $this->cms_type);
- }
- else
- {
- if (ELearningUtils::getConfigValue("user_style", $this->cms_type) != "")
+ } else {
+ if (ELearningUtils::getConfigValue("user_style", $this->cms_type)) {
$style_setting = ELearningUtils::getConfigValue("user_style", $this->cms_type);
- if (ELearningUtils::getConfigValue("encrypt_passwords", $this->cms_type) != "")
+ }
+ if (ELearningUtils::getConfigValue("encrypt_passwords", $this->cms_type)) {
$encrypt_passwords = ELearningUtils::getConfigValue("encrypt_passwords", $this->cms_type);
+ }
}
- if ($messages["error"] != "")
+ if ($messages['error']) {
echo "<b>" . Icon::create('decline', 'attention')->asImg(['class' => 'text-top', 'title' => _('Fehler')]) . " " . $messages["error"] . "</b><br><br>";
+ }
echo "<table>";
echo "<tr valign=\"top\"><td width=30% align=\"left\"><font size=\"-1\">";
diff --git a/lib/elearning/Ilias3ConnectedLink.class.php b/lib/elearning/Ilias3ConnectedLink.class.php
index 7565cfb..f50fd53 100644
--- a/lib/elearning/Ilias3ConnectedLink.class.php
+++ b/lib/elearning/Ilias3ConnectedLink.class.php
@@ -36,53 +36,52 @@ class Ilias3ConnectedLink extends ConnectedLink
* get user module links
*
* returns content module links for user
- * @access public
* @return string html-code
*/
- function getUserModuleLinks()
+ public function getUserModuleLinks()
{
- global $connected_cms, $view, $search_key, $cms_select, $current_module;
+ global $connected_cms, $current_module;
- if ($connected_cms[$this->cms_type]->isAuthNecessary() AND (! $connected_cms[$this->cms_type]->user->isConnected()))
- {
- $output .= $this->getNewAccountLink();
- }
- else
- {
- if (! $connected_cms[$this->cms_type]->content_module[$current_module]->isDummy() )
- {
- if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_READ))
- {
+ $output = '';
- $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()
- . $auth_data
- . "&target=start"), [
- 'target' => '_blank',
- 'rel' => 'noopener noreferrer',
- ]);
- $output .= "&nbsp;";
- }
- 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()
- . $auth_data
- . "&target=edit"), [
- 'target' => '_blank',
- 'rel' => 'noopener noreferrer',
- ]);
- $output .= "&nbsp;";
-
- }
+ 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 .= "&nbsp;";
+ }
+ 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 .= "&nbsp;";
}
}
@@ -93,14 +92,13 @@ class Ilias3ConnectedLink extends ConnectedLink
* get admin module links
*
* returns links add or remove a module from course
- * @access public
* @return string returns html-code
*/
- function getAdminModuleLinks()
+ public function getAdminModuleLinks()
{
global $connected_cms, $view, $search_key, $cms_select, $current_module;
- $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
+ $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";
@@ -109,63 +107,62 @@ class Ilias3ConnectedLink extends ConnectedLink
$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())
+ if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
$output .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
- elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE))
- {
+ } 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
+ } else {
$output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
+ }
$output .= "</form>";
return $output;
-// $output .= parent::getAdminModuleLinks();
}
/**
* get new module link
*
* returns link to create a new module if allowed
- * @access public
- * @return string returns html-code or false
+ * @return string|false returns html-code or false
*/
- function getNewModuleLink()
+ public function getNewModuleLink()
{
global $connected_cms, $auth;
$output = "\n";
-// echo "NML.";
- if ((Request::get("module_type_" . $this->cms_type) != ""))
- {
-// echo "TYPE.";
- if ($connected_cms[$this->cms_type]->user->category == "")
- {
-// echo "NoCat.";
+ 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)
+ if ($connected_cms[$this->cms_type]->user->category == false) {
return $output;
+ }
}
- $output = "&nbsp;" . 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
- . $auth_data
- . "&type=" . Request::option("module_type_" . $this->cms_type) . "&target=new"), [
+ $output = "&nbsp;";
+ $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',
- ]);
-// echo $output . ".";
+ ]
+ );
}
- $user_crs_role = $connected_cms[$this->cms_type]->crs_roles[$auth->auth["perm"]];
- if ($user_crs_role=="admin")
+ $user_crs_role = $connected_cms[$this->cms_type]->crs_roles[$auth->auth['perm']];
+ if ($user_crs_role === 'admin') {
return $output;
- else
- return false;
+ }
+
+ return false;
}
/**
diff --git a/lib/elearning/Ilias3ConnectedPermissions.class.php b/lib/elearning/Ilias3ConnectedPermissions.class.php
index dcb6615..9bf2fcd 100644
--- a/lib/elearning/Ilias3ConnectedPermissions.class.php
+++ b/lib/elearning/Ilias3ConnectedPermissions.class.php
@@ -84,43 +84,45 @@ class Ilias3ConnectedPermissions extends ConnectedPermissions
* @param string $course_id course-id
* @return boolean returns false on error
*/
- function checkUserPermissions($course_id = "")
+ function checkUserPermissions($course_id)
{
global $connected_cms, $messages;
- if ($course_id == "")
+ if (!$course_id) {
return false;
- if ($connected_cms[$this->cms_type]->user->getId() == "")
+ }
+ if (!$connected_cms[$this->cms_type]->user->getId()) {
return false;
+ }
// get course role folder and local roles
$local_roles = $connected_cms[$this->cms_type]->soap_client->getLocalRoles($course_id);
$active_role = "";
$proper_role = "";
- $user_crs_role = $connected_cms[$this->cms_type]->crs_roles[$perm->get_studip_perm(Context::getId())];
- if (is_array($local_roles))
- foreach ($local_roles as $key => $role_data)
- // check only if local role is il_crs_member, -tutor or -admin
- if (! (mb_strpos($role_data["title"], "_crs_") === false))
- {
- if ( in_array( $role_data["obj_id"], $connected_cms[$this->cms_type]->user->getRoles() ) )
+ $user_crs_role = $connected_cms[$this->cms_type]->crs_roles[$GLOBALS['perm']->get_studip_perm(Context::getId())];
+ if (is_array($local_roles)) {
+ foreach ($local_roles as $key => $role_data) { // check only if local role is il_crs_member, -tutor or -admin
+ if (mb_strpos($role_data["title"], "_crs_") !== false) {
+ if (in_array($role_data["obj_id"], $connected_cms[$this->cms_type]->user->getRoles())) {
$active_role = $role_data["obj_id"];
- if ( mb_strpos( $role_data["title"], $user_crs_role) > 0 )
+ }
+ if (mb_strpos($role_data["title"], $user_crs_role) > 0) {
$proper_role = $role_data["obj_id"];
+ }
}
- // if ($GLOBALS["debug"] == true)
- // echo "P$proper_role A$active_role U" . $user_crs_role . " R" . implode($connected_cms[$this->cms_type]->user->getRoles(), ".")."<br>";
+ }
+// if ($GLOBALS["debug"] == true)
+// echo "P$proper_role A$active_role U" . $user_crs_role . " R" . implode($connected_cms[$this->cms_type]->user->getRoles(), ".")."<br>";
+ }
// is user already course-member? otherwise add member with proper role
$is_member = $connected_cms[$this->cms_type]->soap_client->isMember( $connected_cms[$this->cms_type]->user->getId(), $course_id);
- if (! $is_member)
- {
+ if (!$is_member) {
$member_data["usr_id"] = $connected_cms[$this->cms_type]->user->getId();
$member_data["ref_id"] = $course_id;
$member_data["status"] = CRS_NO_NOTIFICATION;
$type = "";
- switch ($user_crs_role)
- {
+ switch ($user_crs_role) {
case "admin":
$member_data["role"] = CRS_ADMIN_ROLE;
$type = "Admin";
@@ -237,22 +239,20 @@ class Ilias3ConnectedPermissions extends ConnectedPermissions
* get operation-ids
*
* returns an array of operation-ids
- * @access public
- * @param string $operation operation
- * @return array operation-ids
+ * @param array $operation operation
+ * @return array|false operation-ids
*/
- function getOperationArray($operation)
+ public function getOperationArray($operation)
{
- if (is_array($operation))
- {
- foreach ($operation as $key => $operation_name)
- {
- $ops_array[] = $this->operations[$operation_name];
- }
- }
- else
+ if (!is_array($operation)) {
return false;
- return $ops_array;
+ }
+
+ return array_map(
+ function ($operation_name) {
+ return $this->operations[$operation_name];
+ },
+ $operation
+ );
}
}
-?>
diff --git a/lib/elearning/Ilias3ContentModule.class.php b/lib/elearning/Ilias3ContentModule.class.php
index b1c913c..63857bf 100644
--- a/lib/elearning/Ilias3ContentModule.class.php
+++ b/lib/elearning/Ilias3ContentModule.class.php
@@ -86,43 +86,37 @@ class Ilias3ContentModule extends ContentModule
{
global $connected_cms;
- switch ($access_info)
- {
+ switch ($access_info) {
case "granted":
- $this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations );
+ $this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations);
break;
case "no_permission":
- $this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations );
- $this->setDescription($object_data["description"] . "<br><br><i>" . _("Sie haben keine Leseberechtigung für dieses Modul.") . "</i>");
+ $this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations);
+ $this->setDescription("<i>" . _("Sie haben keine Leseberechtigung für dieses Modul.") . "</i>");
return false;
- break;
case "missing_precondition":
$this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations );
- $this->setDescription($object_data["description"] . "<br><br><i>" . _("Sie haben zur Zeit noch keinen Zugriff auf deses Modul (fehlende Vorbedingungen).") . "</i>");
+ $this->setDescription("<i>" . _("Sie haben zur Zeit noch keinen Zugriff auf deses Modul (fehlende Vorbedingungen).") . "</i>");
break;
case "no_object_access":
$this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations );
- $this->setDescription($object_data["description"] . "<br><br><i>" . _("Dieses Modul ist momentan offline oder durch Payment-Regeln gesperrt.") . "</i>");
+ $this->setDescription("<i>" . _("Dieses Modul ist momentan offline oder durch Payment-Regeln gesperrt.") . "</i>");
break;
case "no_parent_access":
$this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations );
- $this->setDescription($object_data["description"] . "<br><br><i>" . _("Sie haben keinen Zugriff auf die übergeordneten Objekte dieses Moduls.") . "</i>");
+ $this->setDescription("<i>" . _("Sie haben keinen Zugriff auf die übergeordneten Objekte dieses Moduls.") . "</i>");
return false;
- break;
case "object_deleted":
$this->createDummyForErrormessage("deleted");
return false;
- break;
}
- if ($connected_cms[$this->cms_type]->isAuthNecessary() AND ($connected_cms[$this->cms_type]->user->isConnected()))
- {
+ if ($connected_cms[$this->cms_type]->isAuthNecessary() && $connected_cms[$this->cms_type]->user->isConnected()) {
// If User has no permission, don't show module data
- if ((! $this->isAllowed(OPERATION_VISIBLE) ) AND (! $this->isDummy()) AND ($connected_cms[$this->cms_type]->user->isConnected()))
+ if (!$this->isAllowed(OPERATION_VISIBLE) && !$this->isDummy() && $connected_cms[$this->cms_type]->user->isConnected()) {
$this->createDummyForErrormessage("no permission");
+ }
}
-// echo "PERM".implode($this->allowed_operations,"-");
-
return true;
}
diff --git a/lib/elearning/Ilias4ConnectedCMS.class.php b/lib/elearning/Ilias4ConnectedCMS.class.php
index b8f0ea3..f569756 100644
--- a/lib/elearning/Ilias4ConnectedCMS.class.php
+++ b/lib/elearning/Ilias4ConnectedCMS.class.php
@@ -191,23 +191,25 @@ class Ilias4ConnectedCMS extends Ilias3ConnectedCMS
$this->soap_client->setCachingStatus(false);
- if ($cat_name != "") {
+ $messages = ['error' => ''];
+
+ if ($cat_name) {
$cat = $this->soap_client->getReferenceByTitle( trim( $cat_name ), "cat");
- if ($cat == false) {
- $messages["error"] .= sprintf(_("Das Objekt mit dem Namen \"%s\" wurde im System %s nicht gefunden."), htmlReady($cat_name), htmlReady($this->getName())) . "<br>\n";
- } elseif ($cat != "") {
+ if (!$cat) {
+ $messages["error"] .= sprintf(_('Das Objekt mit dem Namen "%s" wurde im System %s nicht gefunden.'), htmlReady($cat_name), htmlReady($this->getName())) . "<br>\n";
+ } else {
ELearningUtils::setConfigValue("category_id", $cat, $this->cms_type);
$this->main_category_node_id = $cat;
}
}
if (($this->main_category_node_id != false) AND (ELearningUtils::getConfigValue("user_category_id", $this->cms_type) == "")) {
- $object_data["title"] = sprintf(_("User-Daten"));
+ $object_data["title"] = _("User-Daten");
$object_data["description"] = _("Hier befinden sich die persönlichen Ordner der Stud.IP-User.");
$object_data["type"] = "cat";
$object_data["owner"] = $this->user->getId();
$user_cat = $connected_cms[$this->cms_type]->soap_client->addObject($object_data, $connected_cms[$this->cms_type]->main_category_node_id);
- if ($user_cat != false) {
+ if ($user_cat) {
$this->user_category_node_id = $user_cat;
ELearningUtils::setConfigValue("user_category_id", $user_cat, $this->cms_type);
} else {
diff --git a/lib/elearning/Ilias4ConnectedLink.class.php b/lib/elearning/Ilias4ConnectedLink.class.php
index a66bd8e..a2bdb14 100644
--- a/lib/elearning/Ilias4ConnectedLink.class.php
+++ b/lib/elearning/Ilias4ConnectedLink.class.php
@@ -69,7 +69,10 @@ class Ilias4ConnectedLink extends Ilias3ConnectedLink
{
global $connected_cms, $view, $search_key, $cms_select, $current_module;
- if (! $connected_cms[$this->cms_type]->content_module[$current_module]->isDummy()) {
+ $output = '';
+
+ $result = false;
+ if (!$connected_cms[$this->cms_type]->content_module[$current_module]->isDummy()) {
$result = $connected_cms[$this->cms_type]->soap_client->getPath($connected_cms[$this->cms_type]->content_module[$current_module]->getId());
}
if ($result) {
@@ -119,4 +122,3 @@ class Ilias4ConnectedLink extends Ilias3ConnectedLink
return $output;
}
}
-?>
diff --git a/lib/elearning/Ilias4Soap.class.php b/lib/elearning/Ilias4Soap.class.php
index 7afd738..9172338 100644
--- a/lib/elearning/Ilias4Soap.class.php
+++ b/lib/elearning/Ilias4Soap.class.php
@@ -106,10 +106,6 @@ class Ilias4Soap extends Ilias3Soap
*/
function copyObject($source_id, $target_id)
{
- $type = $object_data["type"];
- $title = $object_data["title"];
- $description = $object_data["description"];
-
$xml = "<Settings source_id=\"$source_id\" target_id=\"$target_id\" default_action=\"COPY\"/>";
$param = [
diff --git a/lib/elearning/PmWikiConnectedCMS.class.php b/lib/elearning/PmWikiConnectedCMS.class.php
index 3cd728e..7de0a78 100644
--- a/lib/elearning/PmWikiConnectedCMS.class.php
+++ b/lib/elearning/PmWikiConnectedCMS.class.php
@@ -58,29 +58,27 @@ class PmWikiConnectedCMS extends ConnectedCMS
* search for content modules
*
* returns found content modules
- * @access public
* @param string $key keyword
* @return array list of content modules
*/
-
- function searchContentModules($key)
+ public function searchContentModules($key)
{
- $fields_found = $this->client->call("search_content_modules", $args = [
- $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'],
- $key]);
+ $fields_found = $this->client->call("search_content_modules", [
+ $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'],
+ $key
+ ]);
$result = [];
-
- foreach($fields_found as $field)
- {
-
- $result[$field['field_id']] = [ 'ref_id' => $field['field_id'],
- 'type' => $field['field_type'],
- 'obj_id' => $field_id,
- 'create_date' => $field['create_date'],
- 'last_update' => $field['change_date'],
- 'title' => $field['field_title'],
- 'description' => $field['field_description']];
+ foreach ($fields_found as $field) {
+ $result[$field['field_id']] = [
+ 'ref_id' => $field['field_id'],
+ 'type' => $field['field_type'],
+ 'obj_id' => null,
+ 'create_date' => $field['create_date'],
+ 'last_update' => $field['change_date'],
+ 'title' => $field['field_title'],
+ 'description' => $field['field_description'],
+ ];
}
return $result;
}