aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Noack <noack@data-quest.de>2024-09-04 08:01:19 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-09-04 08:01:19 +0000
commit207406981b8a86f3db95ba7d155e49c5ffcce246 (patch)
tree6a95b344ce34711832405067c2fa473726886a2c
parent612bb1c13763e07bd8201b9642af1506f18826ce (diff)
Resolve "Ausbau der Elearning Schnittstelle"
Closes #4109 Merge request studip/studip!3351
-rw-r--r--app/controllers/course/elearning.php365
-rw-r--r--app/controllers/elearning.php174
-rw-r--r--app/controllers/loncapa.php34
-rw-r--r--app/views/elearning/my_accounts.php48
-rw-r--r--config/config_defaults.inc.php82
-rw-r--r--db/migrations/6.0.16_step_4109.php47
-rw-r--r--lib/bootstrap.php5
-rw-r--r--lib/classes/UserManagement.php18
-rw-r--r--lib/elearning/ConnectedCMS.php466
-rw-r--r--lib/elearning/ConnectedLink.php129
-rw-r--r--lib/elearning/ConnectedPermissions.php57
-rw-r--r--lib/elearning/ConnectedUser.php512
-rw-r--r--lib/elearning/ContentModule.php388
-rw-r--r--lib/elearning/ContentModuleView.php189
-rw-r--r--lib/elearning/ELearningUtils.php612
-rw-r--r--lib/elearning/Ilias3ConnectedCMS.php350
-rw-r--r--lib/elearning/Ilias3ConnectedLink.php188
-rw-r--r--lib/elearning/Ilias3ConnectedPermissions.php256
-rw-r--r--lib/elearning/Ilias3ConnectedUser.php345
-rw-r--r--lib/elearning/Ilias3ContentModule.php292
-rw-r--r--lib/elearning/Ilias3ObjectXMLParser.php236
-rw-r--r--lib/elearning/Ilias3SaxParser.php230
-rw-r--r--lib/elearning/Ilias3Soap.php1069
-rw-r--r--lib/elearning/Ilias4ConnectedCMS.php271
-rw-r--r--lib/elearning/Ilias4ConnectedLink.php124
-rw-r--r--lib/elearning/Ilias4ConnectedPermissions.php126
-rw-r--r--lib/elearning/Ilias4ConnectedUser.php168
-rw-r--r--lib/elearning/Ilias4ContentModule.php106
-rw-r--r--lib/elearning/Ilias4Soap.php181
-rw-r--r--lib/elearning/Ilias5ConnectedCMS.php21
-rw-r--r--lib/elearning/Ilias5ConnectedLink.php16
-rw-r--r--lib/elearning/Ilias5ConnectedPermissions.php17
-rw-r--r--lib/elearning/Ilias5ConnectedUser.php40
-rw-r--r--lib/elearning/Ilias5ContentModule.php16
-rw-r--r--lib/elearning/Ilias5Soap.php114
-rw-r--r--lib/elearning/LonCapaConnectedCMS.php67
-rw-r--r--lib/elearning/LonCapaConnectedLink.php67
-rw-r--r--lib/elearning/LonCapaContentModule.php86
-rw-r--r--lib/elearning/LonCapaRequest.php110
-rw-r--r--lib/elearning/ObjectConnections.php254
-rw-r--r--lib/elearning/PmWikiConnectedCMS.php86
-rw-r--r--lib/elearning/PmWikiConnectedLink.php134
-rw-r--r--lib/elearning/PmWikiContentModule.php115
-rw-r--r--lib/elearning/clients/soap_webservice_client.php25
-rw-r--r--lib/elearning/clients/webservice_client.php29
-rw-r--r--lib/elearning/clients/xml_rpc_webservice_client.php33
-rw-r--r--lib/ilias_interface/StudipSoapClient.php (renamed from lib/soap/StudipSoapClient_PHP5.php)0
-rw-r--r--lib/ilias_interface/studip_referrer_7x.php (renamed from lib/elearning/studip_referrer_7x.php)0
-rw-r--r--lib/ilias_interface/studip_referrer_8x.php (renamed from lib/elearning/studip_referrer_8x.php)0
-rw-r--r--lib/models/Course.php12
-rw-r--r--lib/modules/CoreElearningInterface.php143
-rw-r--r--lib/navigation/AdminNavigation.php4
-rw-r--r--lib/navigation/ContentsNavigation.php8
-rw-r--r--lib/navigation/StartNavigation.php5
-rw-r--r--lib/soap/StudipSoapClient.php58
-rw-r--r--public/admin_elearning_interface.php196
-rw-r--r--public/ilias3_referrer.php78
57 files changed, 48 insertions, 8754 deletions
diff --git a/app/controllers/course/elearning.php b/app/controllers/course/elearning.php
deleted file mode 100644
index 6e67b64..0000000
--- a/app/controllers/course/elearning.php
+++ /dev/null
@@ -1,365 +0,0 @@
-<?php
-/**
- * Elearning Interface für Veranstaltungen/ Einrichtungen
- *
- * 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 Arne Schröder <schroeder@data-quest.de>
- * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
- * @category Stud.IP
- * @since 3.1
- */
-
-class Course_ElearningController extends AuthenticatedController
-{
- /**
- * Before filter, set up the page by initializing the session and checking
- * all conditions.
- *
- * @param String $action Name of the action to be invoked
- * @param Array $args Arguments to be passed to the action method
- */
- public function before_filter(&$action, &$args)
- {
- parent::before_filter($action, $args);
-
- if (!Config::Get()->ELEARNING_INTERFACE_ENABLE ) {
- throw new AccessDeniedException(_('Elearning-Interface ist nicht aktiviert.'));
- } else
- $this->elearning_active = true;
-
- PageLayout::setHelpKeyword('Basis.Ilias');
- PageLayout::setTitle(Context::getHeaderLine(). " - " . _("Lernmodule"));
-
- checkObject(); // do we have an open object?
- $module = checkObjectModule('ElearningInterface');
- object_set_visit_module($module->getPluginId());
-
- $this->search_key = Request::get('search_key');
- $GLOBALS['search_key'] = $this->search_key;
- $this->cms_select = Request::quoted('cms_select');
- $GLOBALS['cms_select'] = $this->cms_select;
- $this->open_all = Request::get('open_all');
- $this->close_all = Request::get('close_all');
- $this->new_account_cms = Request::get('new_account_cms');
- $this->module_system_type = Request::get('module_system_type');
- $this->module_id = Request::get('module_id');
- $this->module_type = Request::get('module_type');
- $this->anker_target = Request::get('anker_target');
- $this->seminar_id = Context::getId();
- $this->rechte = $GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id);
- if (!isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->new_account_cms])) {
- unset($this->new_account_cms);
- }
- if (!isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_select])) {
- unset($this->cms_select);
- }
- if (
- isset($_SESSION['elearning_open_close']['id'])
- && $this->seminar_id !== $_SESSION['elearning_open_close']['id']
- ) {
- unset($_SESSION['cache_data']);
- unset($_SESSION['elearning_open_close']);
- }
- if ($this->open_all != "")
- $_SESSION['elearning_open_close']["all open"] = true;
- elseif ($this->close_all != "")
- $_SESSION['elearning_open_close']["all open"] = "";
- $_SESSION['elearning_open_close']["type"] = "seminar";
- $_SESSION['elearning_open_close']["id"] = $this->seminar_id;
- if (Request::get('do_open')) {
- $this->anker_target = Request::get('do_open');
- $_SESSION['elearning_open_close'][Request::get('do_open')] = true;
- } elseif (Request::get('do_close')) {
- $this->anker_target = Request::get('do_close');
- $_SESSION['elearning_open_close'][Request::get('do_close')] = false;
- }
- $this->sidebar = Sidebar::get();
- $this->sidebar->setContextAvatar(CourseAvatar::getAvatar($this->seminar_id));
- }
-
- /**
- * Displays a page.
- */
- public function show_action($id = null)
- {
- global $connected_cms, $current_module;
- Navigation::activateItem('/course/elearning/show');
- $GLOBALS['view'] = 'show';
-
- // Zugeordnete Ilias-Kurse ermitteln und ggf. aktualisieren
- $this->course_output = ELearningUtils::getIliasCourses($this->seminar_id);
- if (!empty($this->new_account_cms)) {
- //Dummy-Instanz der Zuordnungs-Klasse ohne Verbindung zur Veranstaltung
- $object_connections = new ObjectConnections();
- } else {
- //Instanz mit den Zuordnungen von Content-Modulen zur Veranstaltung
- $object_connections = new ObjectConnections($this->seminar_id);
-
- $connected_modules = $object_connections->getConnections();
- }
- $this->module_count = 0;
- $content_modules_list = [];
- if ($object_connections->isConnected()) {
- $caching_active = true;
- $type_tmp = [];
-
- if (!empty($connected_modules)) {
- foreach ($connected_modules as $key => $connection) {
- if (ELearningUtils::isCMSActive($connection["cms"])) {
-
- ELearningUtils::loadClass($connection["cms"]);
-
- $connected_cms[$connection["cms"]]->newContentModule($connection["id"], $connection["type"], true);
- $connected_modules[$key]['title'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getTitle();
- $title_tmp[$key] = str_replace(['ä','ö','ü','ß'],['ae','oe','ue','ss'],mb_strtolower($connected_modules[$key]['title']));
- $type_tmp[$key] = array_search($connection['type'], array_keys($GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]['types']));
- $class_tmp[$key] = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]["CLASS_PREFIX"];
- }
- }
- }
- array_multisort($class_tmp, SORT_ASC, $type_tmp, SORT_ASC, $title_tmp, SORT_ASC, $connected_modules);
-
- foreach ($connected_modules as $index => $connection) {
- $current_module = $connection["id"];
-
- if ($this->module_count == 0)
- $content_modules_list[$index]['show_header'] = true;
- $this->module_count++;
- $this->module_system_count[$connection["cms"]]++;
-
- if ($this->open_all != "")
- $_SESSION['elearning_open_close'][$connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getReferenceString()] = true;
- elseif ($this->close_all != "")
- $_SESSION['elearning_open_close'][$connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getReferenceString()] = false;
-
- $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->view->setChangeDate($connection["chdate"]);
- $content_modules_list[$index]['module'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->view->show();
- }
- }
- if (!$this->module_count && !$this->new_account_cms) {
- if (Context::isInstitute()) {
- PageLayout::postInfo(_('Momentan sind dieser Einrichtung keine Lernmodule zugeordnet.'));
- } else {
- PageLayout::postInfo(_('Momentan sind dieser Veranstaltung keine Lernmodule zugeordnet.'));
- }
- }
-
- $widget = new ActionsWidget();
- $widget->addLink(
- _('Externe Accounts verwalten'),
- URLHelper::getURL('dispatch.php/elearning/my_accounts'),
- Icon::create('person')
- );
- if ($this->course_output['courses'])
- foreach ($this->course_output['courses'] as $course) {
- $widget->addLink(
- sprintf(_('Direkt zum Kurs in %s'), $course['cms_name']),
- $course['url'],
- Icon::create('link-extern'),
- ['target' => '_blank', 'rel' => 'noopener noreferrer']
- );
- }
- $this->sidebar->addWidget($widget);
- $this->new_account = $this->new_account_cms;
- $this->content_modules = $content_modules_list;
- }
-
- /**
- * Displays a page.
- */
- public function edit_action($id = null)
- {
- global $connected_cms, $current_module;
- if (!$this->rechte) {
- throw new AccessDeniedException();
- }
- Navigation::activateItem('/course/elearning/edit');
- $GLOBALS['view'] = 'edit';
- // ggf. neuen Ilias4-Kurs anlegen
- if (Request::submitted('create_course') AND $this->rechte) {
- ELearningUtils::loadClass($this->cms_select);
- if ((method_exists($connected_cms[$this->cms_select], "createCourse")))
- if ($connected_cms[$this->cms_select]->createCourse($this->seminar_id))
- PageLayout::postInfo(_('Kurs wurde angelegt.'));
- }
-
- // ggf. bestehenden Ilias4-Kurs zuordnen
- if (Request::submitted('connect_course')) {
- if (
- ObjectConnections::getConnectionModuleId(Request::option('connect_course_sem_id'), 'crs', $this->cms_select)
- && $GLOBALS['perm']->have_studip_perm('dozent', Request::option('connect_course_sem_id'))
- ) {
- ObjectConnections::setConnection($this->seminar_id, ObjectConnections::getConnectionModuleId(Request::option("connect_course_sem_id"), "crs", $this->cms_select), "crs", $this->cms_select);
- PageLayout::postInfo(_('Zuordnung wurde gespeichert.'));
- ELearningUtils::loadClass($this->cms_select);
- if ((method_exists($connected_cms[$this->cms_select], "updateConnections")))
- $connected_cms[$this->cms_select]->updateConnections( ObjectConnections::getConnectionModuleId(Request::option("connect_course_sem_id"), "crs", $this->cms_select) );
- }
- }
-
- // Zugeordnete Ilias-Kurse ermitteln und ggf. aktualisieren
- $this->course_output = ELearningUtils::getIliasCourses($this->seminar_id);
- if ($this->new_account_cms == "") {
- if ($this->module_system_type != "") {
- $user_crs_role = $connected_cms[$this->module_system_type]->crs_roles[$GLOBALS['auth']->auth["perm"]];
- ELearningUtils::loadClass($this->module_system_type);
- }
- if (Request::submitted('remove')) {
- $connected_cms[$this->module_system_type]->newContentModule($this->module_id, $this->module_type, true);
- if ($connected_cms[$this->module_system_type]->content_module[$this->module_id]->unsetConnection($this->seminar_id, $this->module_id, $this->module_type, $this->module_system_type))
- PageLayout::postInfo(_('Die Zuordnung wurde entfernt.'));
- unset($connected_cms[$this->module_system_type]->content_module[$this->module_id]);
- } elseif (Request::submitted('add')) {
- $connected_cms[$this->module_system_type]->newContentModule($this->module_id, $this->module_type, true);
- if ($connected_cms[$this->module_system_type]->content_module[$this->module_id]->setConnection($this->seminar_id))
- PageLayout::postInfo(_('Die Zuordnung wurde gespeichert.'));
- unset($connected_cms[$this->module_system_type]->content_module[$this->module_id]);
- }
- if ($this->search_key != "") {
- ELearningUtils::loadClass($this->cms_select);
- if ( mb_strlen( trim($this->search_key) ) > 2)
- $searchresult_content_modules = $connected_cms[$this->cms_select]->searchContentModules($this->search_key);
- else
- PageLayout::postError(_('Jeder Suchbegriff muss mindestens 3 Zeichen lang sein!'));
- }
- }
- //Instanz mit den Zuordnungen von Content-Modulen zur Veranstaltung
- $object_connections = new ObjectConnections($this->seminar_id);
-
- $connected_modules = $object_connections->getConnections();
- $this->module_count = 0;
- $content_modules_list = [];
- $user_modules_list = [];
- $search_modules_list = [];
- if ($object_connections->isConnected()) {
- $caching_active = true;
- foreach ($connected_modules as $key => $connection) {
- if (ELearningUtils::isCMSActive($connection["cms"])) {
-
- ELearningUtils::loadClass($connection["cms"]);
-
- $connected_cms[$connection["cms"]]->newContentModule($connection["id"], $connection["type"], true);
- $connected_modules[$key]['title'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getTitle();
- $title_tmp[$key] = str_replace(['ä','ö','ü','ß'],['ae','oe','ue','ss'],mb_strtolower($connected_modules[$key]['title']));
- $type_tmp[$key] = array_search($connection['type'], array_keys($GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]['types']));
- $class_tmp[$key] = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]["CLASS_PREFIX"];
- }
- }
- array_multisort($class_tmp, SORT_ASC, $type_tmp, SORT_ASC, $title_tmp, SORT_ASC, $connected_modules);
-
- foreach ($connected_modules as $index => $connection) {
- $current_module = $connection["id"];
-
- if ($this->module_count == 0)
- $content_modules_list[$index]['show_header'] = true;
- $this->module_count++;
- $this->module_system_count[$connection["cms"]]++;
-
- if ($this->open_all != "")
- $_SESSION['elearning_open_close'][$connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getReferenceString()] = true;
- elseif ($this->close_all != "")
- $_SESSION['elearning_open_close'][$connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getReferenceString()] = false;
- $content_modules_list[$index]['module'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->view->showAdmin();
- }
- }
- if (($this->module_count == 0) AND ($this->new_account_cms == "")) {
- if (Context::isInstitute()) {
- PageLayout::postInfo(_('Momentan sind dieser Einrichtung keine Lernmodule zugeordnet.'));
- } else {
- PageLayout::postInfo(_('Momentan sind dieser Veranstaltung keine Lernmodule zugeordnet.'));
- }
- }
- $this->caching_active = false;
- if (isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_select]["name"])) {
- ELearningUtils::loadClass($this->cms_select);
-
- $user_content_modules = $connected_cms[$this->cms_select]->getUserContentModules();
- if (! ($user_content_modules == false)) {
- foreach ($user_content_modules as $key => $connection) {
- // show only those modules which are not already connected to the seminar
- if (is_object($connected_cms[$this->cms_select]->content_module[$connection["ref_id"]]))
- continue;
- $connected_cms[$this->cms_select]->setContentModule($connection, false);
- $connected_cms[$this->cms_select]->content_module[$current_module]->view->showAdmin();
- $user_modules_list[$key]['module'] = $connected_cms[$this->cms_select]->content_module[$current_module]->view->showAdmin();
- }
- }
-
- if (!$connected_cms[$this->cms_select]->isAuthNecessary()
- || $connected_cms[$this->cms_select]->user->isConnected()) {
- $this->show_search = true;
- }
-
- if (! ($searchresult_content_modules == false)) {
- foreach ($searchresult_content_modules as $key => $connection) {
- // show only those modules which are not already connected to the seminar
- if (is_object($connected_cms[$this->cms_select]->content_module[$connection["ref_id"]]))
- continue;
- $connected_cms[$this->cms_select]->setContentModule($connection, false);
- $search_modules_list[$key]['module'] = $connected_cms[$this->cms_select]->content_module[$current_module]->view->showAdmin();
- }
- }
-
- // ILIAS 4: Leeren Kurs anlegen oder Kurse von anderen Veranstaltungen zuordnen
- if ((method_exists($connected_cms[$this->cms_select], "updateConnections")) AND ! ($this->module_system_count[$this->cms_select]) AND ! (ObjectConnections::getConnectionModuleId($this->seminar_id, "crs", $this->cms_select)))
- {
- $show_ilias_empty_course = true;
- if ($GLOBALS['perm']->have_perm('root')) {
- $query = "SELECT DISTINCT object_id, module_id, Name
- FROM object_contentmodules
- LEFT JOIN seminare ON (object_id = Seminar_id)
- WHERE module_type = 'crs' AND system_type = ?";
- } else {
- $query = "SELECT DISTINCT object_id, module_id, Name
- FROM object_contentmodules
- LEFT JOIN seminare ON (object_id = Seminar_id)
- LEFT JOIN seminar_user USING (Seminar_id)
- WHERE module_type = 'crs' AND system_type = ? AND seminar_user.status = 'dozent'";
- }
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$this->cms_select]);
- while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
- if ($GLOBALS['perm']->have_studip_perm('dozent', $row['object_id'])) {
- $existing_courses[$row['object_id']] = my_substr($row['Name'],0,60)." ".sprintf(_("(Kurs-ID %s)"), $row['module_id']);
- }
- }
- }
-
- // ILIAS 4: ggf. Hinweis auf Möglichkeit, weitere Modulformen als Link einzubinden
- elseif (method_exists($connected_cms[$this->cms_select], "updateConnections") AND count($connected_cms[$this->cms_select]->types['webr'])) {
- $this->show_ilias_link_info = true;
- $crs_data = ObjectConnections::getConnectionModuleId($this->seminar_id, "crs", $this->cms_select);
- }
- }
-
- // Cachen der SOAP-Daten
- if (is_array($connected_cms))
- foreach($connected_cms as $system)
- $system->terminate();
-
- $widget = new ActionsWidget();
- if (is_array($this->course_output['courses']) && count($this->course_output['courses'])) {
- $widget->addLink(
- _('Zuordnungen aktualisieren'),
- URLHelper::getURL('?', ['view' => 'edit', 'cms_select' => $this->cms_select,'update'=>1]),
- Icon::create('refresh')
- );
- }
- $this->sidebar->addWidget($widget);
- $this->new_account = $this->new_account_cms;
- $this->is_inst = Context::isInstitute();
- if ($this->cms_select) {
- $this->cms_name = $connected_cms[$this->cms_select]->getName();
- $this->cms_logo = $connected_cms[$this->cms_select]->getLogo();
- $this->user_modules = $user_modules_list;
- $this->search_modules = $search_modules_list;
- $this->existing_courses = $existing_courses;
- $this->show_ilias_empty_course = $show_ilias_empty_course;
- }
- $this->content_modules = $content_modules_list;
- }
-}
diff --git a/app/controllers/elearning.php b/app/controllers/elearning.php
deleted file mode 100644
index b2a2117..0000000
--- a/app/controllers/elearning.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/*
- * elearning.php
- *
- * 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 Arne Schroeder <schroeder@data-quest.de>
- * @author Suchi & Berg GmbH <info@data-quest.de>
- * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
- * @category Stud.IP
-*/
-
-class ElearningController extends AuthenticatedController
-{
- /**
- * Before filter, set up the page by initializing the session and checking
- * all conditions.
- *
- * @param String $action Name of the action to be invoked
- * @param Array $args Arguments to be passed to the action method
- */
- public function before_filter(&$action, &$args)
- {
- parent::before_filter($action, $args);
-
- if (!Config::Get()->ELEARNING_INTERFACE_ENABLE ) {
- throw new AccessDeniedException(_('Elearning-Interface ist nicht aktiviert.'));
- } else
- $this->elearning_active = true;
-
- PageLayout::setHelpKeyword('Basis.Ilias');
-
- $this->cms_select = Request::quoted('cms_select');
- $GLOBALS['cms_select'] = $this->cms_select;
- $this->cms_list = [];
- if (isset($_SESSION['elearning_open_close']) && $_SESSION['elearning_open_close']["type"] != "user") {
- unset($_SESSION['elearning_open_close']);
- }
- $_SESSION['elearning_open_close']["type"] = "user";
- $_SESSION['elearning_open_close']["id"] = $GLOBALS['user']->id;
- if (Request::get('do_open'))
- $_SESSION['elearning_open_close'][Request::get('do_open')] = true;
- elseif (Request::get('do_close'))
- $_SESSION['elearning_open_close'][Request::get('do_close')] = false;
-
- $this->open_all = Request::get('open_all');
- $this->close_all = Request::get('close_all');
- $this->new_account_cms = Request::get('new_account_cms');
- $this->module_system_type = Request::option('module_system_type');
- $this->module_id = Request::option('module_id');
- $this->module_type = Request::option('module_type');
- $this->anker_target = Request::option('anker_target');
-
- if (!isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->new_account_cms])) {
- unset($this->new_account_cms);
- }
- if (!isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_select])) {
- unset($this->cms_select);
- }
- if ($this->open_all != "")
- $_SESSION['elearning_open_close']["all open"] = true;
- elseif ($this->close_all != "")
- $_SESSION['elearning_open_close']["all open"] = "";
- $this->sidebar = Sidebar::get();
- //$this->sidebar->setContextAvatar(CourseAvatar::getAvatar($this->seminar_id));
- }
-
- /**
- * Displays accounts and elearning modules for active user
- */
- public function my_accounts_action()
- {
- global $connected_cms, $current_module,$messages;
- Navigation::activateItem('/contents/my_elearning');
-
- PageLayout::setTitle(_("Meine Lernmodule und Benutzer-Accounts"));
-
- if ($this->new_account_cms != "")
- $this->new_account_form = ELearningUtils::getNewAccountForm($this->new_account_cms);
- foreach($GLOBALS['ELEARNING_INTERFACE_MODULES'] as $cms => $cms_preferences) {
- if (ELearningUtils::isCMSActive($cms)) {
- ELearningUtils::loadClass($cms);
- if ( $cms_preferences["auth_necessary"] == true) {
- $this->new_module_form[$cms] = ELearningUtils::getNewModuleForm($cms);
- }
- $connection_status = $connected_cms[$cms]->getConnectionStatus($cms);
-
- foreach ($connection_status as $type => $msg) {
- if (!empty($msg["error"])) {
- PageLayout::postError(_("Es traten Probleme bei der Anbindung einzelner Lermodule auf. Bitte wenden Sie sich an Ihren Systemadministrator."), [$cms .': ' . $msg["error"]]);
- $GLOBALS["ELEARNING_INTERFACE_" . $cms . "_ACTIVE"] = false;
- }
- }
- }
- }
-
- $connected_cms = [];
- // prepare cms list
- foreach($GLOBALS['ELEARNING_INTERFACE_MODULES'] as $cms => $cms_preferences) {
- if (ELearningUtils::isCMSActive($cms) AND $cms_preferences["auth_necessary"]) {
- ELearningUtils::loadClass($cms);
- $this->cms_list[$cms] = $cms_preferences;
- $this->cms_list[$cms]['name'] = $connected_cms[$cms]->getName();
- $this->cms_list[$cms]['logo'] = $connected_cms[$cms]->getLogo();
- $this->cms_list[$cms]['modules'] = [];
- if ($this->new_account_cms != $cms)
- $this->cms_list[$cms]['show_account_form'] = $cms_preferences;
- if ($GLOBALS["module_type_" . $cms] != "")
- $this->cms_list[$cms]['cms_anker_target'] = true;
- if ($connected_cms[$cms]->user->isConnected())
- $this->cms_list[$cms]['start_link'] = $connected_cms[$cms]->link->getStartpageLink();
-
- if ($this->new_account_cms != $cms) {
- if ($connected_cms[$cms]->user->isConnected()) {
- $this->cms_list[$cms]['user'] = $connected_cms[$cms]->user->getUsername();
- $connected_cms[$cms]->soap_client->setCachingStatus(false);
- $this->user_content_modules = $connected_cms[$cms]->getUserContentModules();
- $connected_cms[$cms]->soap_client->setCachingStatus(true);
- if (! ($this->user_content_modules == false)) {
- foreach ($this->user_content_modules as $key => $connection) {
- $connected_cms[$cms]->setContentModule($connection, false);
- $this->cms_list[$cms]['modules'][] = $connected_cms[$cms]->content_module[$current_module]->view->show();
- }
- }
- $this->cms_list[$cms]['new_module_form'] = $this->new_module_form[$cms];
- }
- } else {
- $this->cms_list[$cms]['account_form'] = $this->new_account_form;
- }
- }
- }
-
- $sidebar = Sidebar::get();
- $widget = new ActionsWidget();
-
- $link_count = 0;
- if ($GLOBALS['perm']->have_perm('autor') AND count($this->cms_list)) {
- foreach($this->cms_list as $cms_key => $cms_data) {
- if ($connected_cms[$cms_key]->user->isConnected()) {
- $widget->addLink(
- sprintf(_('Zur %s Startseite'), $cms_data['name']),
- URLHelper::getURL($cms_data['start_link']),
- Icon::create('link-extern', 'clickable'),
- ['target' => '_blank', 'rel' => 'noopener noreferrer']
- );
- $link_count++;
- }
- }
- }
- if ($link_count) {
- $sidebar->addWidget($widget);
- }
-
- // terminate objects
- if (is_array($connected_cms)) {
- foreach ($connected_cms as $system) {
- $system->terminate();
- }
- }
-
- if (is_array($messages)) {
- foreach ($messages as $mtype => $mtext) {
- PageLayout::postMessage(MessageBox::$mtype($mtext));
- }
- }
- }
-}
diff --git a/app/controllers/loncapa.php b/app/controllers/loncapa.php
deleted file mode 100644
index dd7ea40..0000000
--- a/app/controllers/loncapa.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-class LoncapaController extends AuthenticatedController
-{
- public function enter_action()
- {
- checkObject();
- checkObjectModule("elearning_interface");
-
- $cms_type = Request::get('cms_type');
- $module = Request::get('module');
- $course_id = Context::getId();
-
- if ($GLOBALS['perm']->have_studip_perm('user', $course_id)
- && isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$cms_type]))
- {
- require_once 'lib/elearning/ELearningUtils.php';
- require_once 'lib/elearning/ObjectConnections.php';
-
- $object_connections = new ObjectConnections($course_id);
- $connected_modules = $object_connections->getConnections();
- $reference = "{$cms_type}_loncapa_{$module}";
-
- if (isset($connected_modules[$reference])
- && ELearningUtils::isCMSActive($cms_type))
- {
- ELearningUtils::loadClass($cms_type);
- $lclink = new LonCapaConnectedLink($cms_type);
- $this->redirect($lclink->getRedirectUrl($module, $course_id));
- return;
- }
- }
- throw new AccessDeniedException(_('LonCapa Zugang nicht erlaubt'));
- }
-}
diff --git a/app/views/elearning/my_accounts.php b/app/views/elearning/my_accounts.php
deleted file mode 100644
index 83719ff..0000000
--- a/app/views/elearning/my_accounts.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php use Studip\Button, Studip\LinkButton; ?>
- <h2><?=_('Meine Lernmodule und Benutzer-Accounts')?></h2>
- <? foreach($cms_list as $cms_index => $cms_data) : ?>
- <? if ($cms_anker_target == $cms_index) : ?>
- <a name='anker'></a>
- <? endif?>
- <?=ELearningUtils::getCMSHeader($cms_data['name'])?>
- <br>
- <?=ELearningUtils::getHeader(_("Mein Benutzeraccount"))?>
- <? if ($cms_data['account_form']) : ?>
- <?=$cms_data['account_form']?>
- <? else : ?>
- <? if ($cms_data['show_account_form'] AND $cms_data['user']) : ?>
- <?=ELearningUtils::getMyAccountForm('', $cms_index)?>
- <? elseif ($cms_data['show_account_form']) : ?>
- <?=ELearningUtils::getMyAccountForm(sprintf(_("Sie haben im System %s bisher keinen Benutzer-Account."), htmlReady($cms_data['name'])), $cms_index)?>
- <? endif ?>
- <? if ($cms_data['user'] AND $cms_data['start_link']) : ?>
- <div class="messagebox messagebox_info" style="background-image: none; padding-left: 15px">
- <?=_('Hier gelangen Sie direkt zur Startseite im angebundenen System:')?>
- <a href="<?= URLHelper::getScriptLink($cms_data['start_link']) ?>" target="_blank" rel="noopener noreferrer">
- <?= htmlReady($cms_data['name']) ?>
- </a>
- </div>
- <br>
- <? endif ?>
- <?=ELearningUtils::getHeader(_('Meine Lernmodule'))?>
- <? if (count($cms_data['modules'])) : ?>
- <? foreach ($cms_data['modules'] as $module_html) : ?>
- <?=$module_html?>
- <? endforeach ?>
- <? else : ?>
- <table border="0" cellspacing="0" cellpadding="6">
- <tr>
- <td>
- <?=sprintf(_("Sie haben im System %s keine eigenen Lernmodule."), htmlReady($cms_data['name']))?><br>
- <br>
- </td>
- </tr>
- </table>
- <? endif ?>
- <br>
- <br>
- <?=$cms_data['new_module_form']?>
- <? endif ?>
- <?=ELearningUtils::getCMSFooter($cms_data['logo'])?>
- <br>
- <? endforeach ?>
diff --git a/config/config_defaults.inc.php b/config/config_defaults.inc.php
index e4aed07..d0f7d69 100644
--- a/config/config_defaults.inc.php
+++ b/config/config_defaults.inc.php
@@ -78,88 +78,6 @@ $FOP_SH_CALL = "/usr/bin/fop"; //path to fop
$EXTERN_SERVER_NAME = ""; //define name, if you use special setup
-$ELEARNING_INTERFACE_MODULES = [];
-
-// example entry for wikifarm as server for elearning modules
-// Copy them into your customized config_local.inc.php and adjust them.
-// remember to activate studip-webservices with WEBSERVICES_ENABLE and to set STUDIP_INSTALLATION_ID
-
-// $ELEARNING_INTERFACE_MODULES["ilias5"] = [
-// "name" => "ILIAS 5",
-// "ABSOLUTE_PATH_ELEARNINGMODULES" => "http://<your Ilias installation>/",
-// "ABSOLUTE_PATH_SOAP" => "http://<your Ilias installation>/webservice/soap/server.php?wsdl",
-// "CLASS_PREFIX" => "Ilias5",
-// "auth_necessary" => true,
-// "USER_AUTO_CREATE" => true,
-// "USER_PREFIX" => "",
-// "target_file" => "studip_referrer.php",
-// "logo_file" => "assets/images/logos/ilias_logo.png",
-// "soap_data" => [
-// "username" => "<username>", //this credentials are used to communicate with your Ilias 3 installation over SOAP
-// "password" => "<password>",
-// "client" => "<ilias client id>"],
-// "types" => [
-// "webr" => ["name" => "ILIAS-Link", "icon" => "learnmodule"],
-// "htlm" => ["name" => "HTML-Lerneinheit", "icon" => "learnmodule"],
-// "sahs" => ["name" => "SCORM/AICC-Lerneinheit", "icon" => "learnmodule"],
-// "lm" => ["name" => "ILIAS-Lerneinheit", "icon" => "learnmodule"],
-// "glo" => ["name" => "ILIAS-Glossar", "icon" => "learnmodule"],
-// "tst" => ["name" => "ILIAS-Test", "icon" => "learnmodule"],
-// "svy" => ["name" => "ILIAS-Umfrage", "icon" => "learnmodule"],
-// "exc" => ["name" => "ILIAS-Übung", "icon" => "learnmodule"]
-// ],
-// "global_roles" => [4,5,14], // put here the ilias role-ids for User, Guest and Anonymous
-// "roles" => [
-// "autor" => "4",
-// "tutor" => "4",
-// "dozent" => "4",
-// "admin" => "4",
-// "root" => "2"
-// ],
-// "crs_roles" => [
-// "autor" => "member",
-// "tutor" => "tutor",
-// "dozent" => "admin",
-// "admin" => "admin",
-// "root" => "admin"
-// ]
-// ];
-//
-// $ELEARNING_INTERFACE_MODULES["pmwiki-farm"] = [
-// "name" => "Wikifarm",
-// "ABSOLUTE_PATH_ELEARNINGMODULES" => "http://<your PmWiki farm server>/<path to wiki fields>/",
-//
-// "WEBSERVICE_CLASS" => "xml_rpc_webserviceclient",
-// "ABSOLUTE_PATH_SOAP" => "http://<your PmWiki farm server>/<path to PmWiki farm>/pmwiki.php", // url to farm webservices
-// "URL_PARAMS" => "action=xmlrpc",
-//
-// "CLASS_PREFIX" => "PmWiki",
-// "auth_necessary" => false,
-//
-// "field_script" => "field.php",
-// "logo_file" => $ASSETS_URL."/images/logos/pmwiki-32.gif",
-//
-// "soap_data" => [
-// "api-key" => "<api-key for wiki webservices>",
-// ],
-// "types" => [
-// "wiki" => ["name" => "PmWiki-Lernmodul", "icon" => "learnmodule"],
-// ]
-// ];
-//
-// $ELEARNING_INTERFACE_MODULES["loncapa"] =
-// [
-// "name" => "LonCapa",
-// "ABSOLUTE_PATH_ELEARNINGMODULES" => "http://127.0.0.1/loncapa",
-// "CLASS_PREFIX" => "LonCapa",
-// "auth_necessary" => false,
-// "logo_file" => "assets/images/logos/lon-capa.gif",
-// "types" => [
-// "loncapa" => ["name" => "LonCapa-Lernmodul",
-// "icon" => "learnmodule"],
-// ]
-// ];
-
$PLUGINS_UPLOAD_ENABLE = $_ENV['STUDIP_PLUGIN_UPLOAD_ENABLE'] ?? true; //Upload of Plugins is enabled
$PLUGIN_REPOSITORIES = [
diff --git a/db/migrations/6.0.16_step_4109.php b/db/migrations/6.0.16_step_4109.php
new file mode 100644
index 0000000..6332f26
--- /dev/null
+++ b/db/migrations/6.0.16_step_4109.php
@@ -0,0 +1,47 @@
+<?php
+return new class extends Migration
+{
+
+ public function description()
+ {
+ return 'StEP 4109: Remove ELEARNING_INTERFACE';
+ }
+
+ protected function up()
+ {
+ $db = DBManager::get();
+
+ $plugin_id = $db->fetchColumn("SELECT pluginid FROM plugins WHERE pluginclassname='CoreElearningInterface'");
+ $db->execute("DELETE FROM roles_plugins WHERE pluginid=?", [$plugin_id]);
+ $db->execute("DELETE FROM tools_activated WHERE plugin_id=?", [$plugin_id]);
+ $db->execute("DELETE FROM plugins WHERE pluginid=?", [$plugin_id]);
+
+ $ilias_config = $db->fetchColumn("SELECT `value` FROM config_values WHERE `field`='ILIAS_INTERFACE_SETTINGS'");
+ if ($ilias_config) {
+ $ilias_config = json_decode($ilias_config, true);
+ if (is_array($ilias_config)) {
+ $config_keys = array_keys($ilias_config);
+ if (count($config_keys)) {
+ $db->execute("DELETE FROM auth_extern WHERE external_user_system_type NOT IN (?)", [$config_keys]);
+ $db->execute("DELETE FROM object_contentmodules WHERE system_type NOT IN (?)", [$config_keys]);
+ }
+ }
+ } else {
+ $elearning_active = $db->fetchColumn("SELECT `value` FROM config_values WHERE `field` LIKE 'ELEARNING_INTERFACE%ACTIVE' LIMIT 1");
+ if (!$elearning_active) {
+ $db->execute("DELETE FROM auth_extern");
+ $db->execute("DELETE FROM object_contentmodules");
+ }
+ }
+ $db->exec("DELETE FROM `config_values` WHERE `field` LIKE 'ELEARNING_INTERFACE%'");
+ $db->exec("DELETE FROM `config_values` WHERE `field` IN ('SOAP_ENABLE', 'SOAP_USE_PHP5')");
+ $db->exec("DELETE FROM `config` WHERE `field` LIKE 'ELEARNING_INTERFACE%'");
+ $db->exec("DELETE FROM `config` WHERE `field` IN ('SOAP_ENABLE', 'SOAP_USE_PHP5')");
+
+ }
+
+ protected function down()
+ {
+ }
+
+};
diff --git a/lib/bootstrap.php b/lib/bootstrap.php
index 478ca0e..2e762c5 100644
--- a/lib/bootstrap.php
+++ b/lib/bootstrap.php
@@ -223,13 +223,10 @@ if (Config::get()->CALENDAR_ENABLE) {
require_once 'lib/calendar_functions.inc.php';
}
-if (Config::get()->SOAP_ENABLE) {
- require_once 'lib/soap/StudipSoapClient' . (Config::get()->SOAP_USE_PHP5 ? '_PHP5' : '' ) . '.php';
-}
-
if (Config::Get()->ILIAS_INTERFACE_ENABLE) {
require_once 'lib/ilias_interface/IliasUserObserver.php';
require_once 'lib/ilias_interface/IliasCourseObserver.php';
+ require_once 'lib/ilias_interface/StudipSoapClient.php';
}
// set dummy navigation until db is ready
diff --git a/lib/classes/UserManagement.php b/lib/classes/UserManagement.php
index 53b5675..809d0c3 100644
--- a/lib/classes/UserManagement.php
+++ b/lib/classes/UserManagement.php
@@ -1250,24 +1250,6 @@ class UserManagement
$msg .= 'info§' . _('Bild gelöscht.') . '§';
}
- //delete connected users
- if (Config::get()->ELEARNING_INTERFACE_ENABLE) {
- if (ELearningUtils::initElearningInterfaces()) {
- foreach ($GLOBALS['connected_cms'] as $cms){
- if ($cms->auth_necessary && $cms->user instanceOf ConnectedUser) {
- $user_auto_create = $cms->USER_AUTO_CREATE;
- $cms->USER_AUTO_CREATE = false;
- $userclass = mb_strtolower(get_class($cms->user));
- $connected_user = new $userclass($cms->cms_type, $user_id);
- if ($connected_user->deleteUser() && $connected_user->is_connected) {
- $msg .= 'info§' . sprintf(_('Der verknüpfte Nutzer %s wurde im System %s gelöscht.'), $connected_user->login, $connected_user->cms_type) . '§';
- }
- $cms->USER_AUTO_CREATE = $user_auto_create;
- }
- }
- }
- }
-
return $msg;
}
diff --git a/lib/elearning/ConnectedCMS.php b/lib/elearning/ConnectedCMS.php
deleted file mode 100644
index f5617e8..0000000
--- a/lib/elearning/ConnectedCMS.php
+++ /dev/null
@@ -1,466 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/**
-* main-class for connected systems
-*
-* This class contains the main methods of the elearning-interface to connect content-management-systems.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module ConnectedCMS
-* @package ELearning-Interface
-*/
-class ConnectedCMS
-{
- public $title;
-
- public $is_active;
- public $cms_type;
- public $name = null;
- public $ABSOLUTE_PATH_ELEARNINGMODULES = null;
- public $ABSOLUTE_PATH_SOAP = null;
- public $RELATIVE_PATH_DB_CLASSES = false;
- public $CLASS_PREFIX = null;
- public $auth_necessary = null;
- public $USER_AUTO_CREATE = null;
- public $USER_PREFIX = null;
- public $target_file = null;
- public $logo_file = null;
- public $db_classes;
- public $soap_data = null;
- public $soap_client;
- public $types = null;
- public $roles = null;
-
- public $db;
- public $db_class;
- public $link;
- public $user;
- public $permissions;
- public $content_module;
-
- /**
- * constructor
- *
- * init class. don't call directly but by extending class ("new Ilias3ConnectedCMS($cms)" for example), except for basic administration
- * @access
- * @param string $cms system-type
- */
- public function __construct($cms = "")
- {
- $this->cms_type = $cms;
- $this->is_active = (bool) Config::get()->getValue("ELEARNING_INTERFACE_{$cms}_ACTIVE");
-
- if ($cms) {
- $this->init($cms);
- }
- }
-
- /**
- * init settings
- *
- * gets settings from config-array and initializes db
- * @access private
- * @param string $cms system-type
- */
- public function init($cms)
- {
- global $ELEARNING_INTERFACE_MODULES;
-
- $this->name = $ELEARNING_INTERFACE_MODULES[$cms]['name'] ?? null;
- $this->ABSOLUTE_PATH_ELEARNINGMODULES = $ELEARNING_INTERFACE_MODULES[$cms]["ABSOLUTE_PATH_ELEARNINGMODULES"];
- $this->ABSOLUTE_PATH_SOAP = $ELEARNING_INTERFACE_MODULES[$cms]["ABSOLUTE_PATH_SOAP"];
- if (isset($ELEARNING_INTERFACE_MODULES[$cms]["RELATIVE_PATH_DB_CLASSES"])) {
- $this->RELATIVE_PATH_DB_CLASSES = $ELEARNING_INTERFACE_MODULES[$cms]["RELATIVE_PATH_DB_CLASSES"];
- $this->db_classes = $ELEARNING_INTERFACE_MODULES[$cms]["db_classes"];
- } else {
- $this->RELATIVE_PATH_DB_CLASSES = false;
- }
- $this->CLASS_PREFIX = $ELEARNING_INTERFACE_MODULES[$cms]['CLASS_PREFIX'];
- $this->auth_necessary = $ELEARNING_INTERFACE_MODULES[$cms]['auth_necessary'];
- $this->USER_AUTO_CREATE = $ELEARNING_INTERFACE_MODULES[$cms]['USER_AUTO_CREATE'] ?? null;
- $this->USER_PREFIX = $ELEARNING_INTERFACE_MODULES[$cms]['USER_PREFIX'] ?? null;
- $this->target_file = $ELEARNING_INTERFACE_MODULES[$cms]['target_file'] ?? null;
- $this->logo_file = $ELEARNING_INTERFACE_MODULES[$cms]['logo_file'] ?? null;
- $this->soap_data = $ELEARNING_INTERFACE_MODULES[$cms]['soap_data'] ?? null;
- $this->types = $ELEARNING_INTERFACE_MODULES[$cms]['types'] ?? null;
- $this->roles = $ELEARNING_INTERFACE_MODULES[$cms]['roles'] ?? null;
- }
-
- /**
- * init subclasses
- *
- * loads classes for user-functions
- * @access public
- */
- public function initSubclasses()
- {
- if ($this->auth_necessary) {
- require_once $this->CLASS_PREFIX . "ConnectedUser.php";
- $classname = $this->CLASS_PREFIX . "ConnectedUser";
- $this->user = new $classname($this->cms_type);
-
- require_once $this->CLASS_PREFIX . "ConnectedPermissions.php";
- $classname = $this->CLASS_PREFIX . "ConnectedPermissions";
- $this->permissions = new $classname($this->cms_type);
- }
- require_once $this->CLASS_PREFIX . "ConnectedLink.php";
- $classname = $this->CLASS_PREFIX . "ConnectedLink";
- $this->link = new $classname($this->cms_type);
- }
-
- /**
- * get connection status
- *
- * checks settings
- * @access public
- * @param string $cms system-type
- * @return array messages
- */
- public function getConnectionStatus($cms = "")
- {
- $msg = [
- 'path' => [],
- ];
-
- if ($this->cms_type == "") {
- $this->init($cms);
- }
-
- // check connection to CMS
- if (!$this->auth_necessary) {
- $msg['auth'] = [
- 'info' => _('Eine Authentifizierung ist für dieses System nicht vorgesehen.')
- ];
- }
-
- // check for SOAP-Interface
- if (in_array($this->CLASS_PREFIX, ['Ilias3','Ilias4','Ilias5'])) {
- $ch = curl_init($this->ABSOLUTE_PATH_ELEARNINGMODULES . 'login.php');
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_exec($ch);
-
- if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) !== 200) {
- $msg['path']['error'] = sprintf(
- _('Die Verbindung zum System "%s" konnte nicht hergestellt werden. Der Pfad "%s" ist ungültig.'),
- $this->name,
- $this->ABSOLUTE_PATH_ELEARNINGMODULES
- );
-
- } else {
- $msg['path']['info'] = sprintf(
- _('Die %s-Installation wurde gefunden.'),
- $this->name
- );
- }
-
- $msg['soap'] = [];
- if (!Config::get()->SOAP_ENABLE) {
- $msg['soap']['error'] = _('Das Stud.IP-Modul für die SOAP-Schnittstelle ist nicht aktiviert. Ändern Sie den entsprechenden Eintrag in der Konfigurationsdatei "local.inc".');
- } elseif (!is_array($this->soap_data)) {
- $msg['soap']['error'] = _('Die SOAP-Verbindungsdaten sind für dieses System nicht gesetzt. Ergänzen Sie die Einstellungen für dieses Systems um den Eintrag "soap_data" in der Konfigurationsdatei "local.inc".');
- } else {
- $this->soap_client = new StudipSoapClient($this->ABSOLUTE_PATH_SOAP);
- $msg['soap']['info'] = _('Das SOAP-Modul ist aktiv.');
- }
- } else {
- $file = fopen($this->ABSOLUTE_PATH_ELEARNINGMODULES, 'r');
- if ($file === false) {
- $msg['path']['error'] = sprintf(
- _('Die Verbindung zum System "%s" konnte nicht hergestellt werden. Der Pfad "%s" ist ungültig.'),
- $this->name,
- $this->ABSOLUTE_PATH_ELEARNINGMODULES
- );
- } else {
- fclose($file);
- $msg['path']['info'] = sprintf(
- _("Die %s-Installation wurde gefunden."),
- $this->name
- );
-
- // check if target-file exists
- $msg['auth'] = [];
-
- $file = fopen($this->ABSOLUTE_PATH_ELEARNINGMODULES . $this->target_file, 'r');
- if ($file === false) {
- $msg['auth']['error'] = sprintf(
- _('Die Zieldatei "%s" liegt nicht im Hauptverzeichnis der %s-Installation.'),
- $this->target_file,
- $this->name
- );
- } else {
- fclose($file);
- $msg['auth']['info'] = _('Die Zieldatei ist vorhanden.');
- }
- }
- }
-
- $el_path = $GLOBALS['STUDIP_BASE_PATH'] . '/lib/elearning';
- // check if needed classes exist
- $files = [
- 'class_link' => "{$el_path}/{$this->CLASS_PREFIX}ConnectedLink.php",
- 'class_content' => "{$el_path}/{$this->CLASS_PREFIX}ContentModule.php",
- 'class_cms' => "{$el_path}/{$this->CLASS_PREFIX}ConnectedCMS.php",
- ];
-
- if ($this->auth_necessary) {
- $files['class_user'] = "{$el_path}/{$this->CLASS_PREFIX}ConnectedUser.php";
- $files['class_perm'] = "{$el_path}/{$this->CLASS_PREFIX}ConnectedPermissions.php";
- }
-
- $errors = 0;
- foreach ($files as $index => $file) {
- if (!file_exists($file)) {
- $msg[$index] = [
- 'error' => sprintf(_('Die Datei "%s" existiert nicht.'), $file),
- ];
- $errors += 1;
- }
- }
-
- $msg['classes'] = [];
- if ($errors === 0) {
- require_once $files['class_cms'];
- $msg['classes']['info'] = sprintf(
- _('Die Klassen der Schnittstelle zum System "%s" wurden geladen.'),
- $this->name
- );
- } else {
- $msg['classes']['error'] = sprintf(
- _('Die Klassen der Schnittstelle zum System "%s" wurden nicht geladen.'),
- $this->name
- );
- }
-
- return $msg;
- }
-
- /**
- * get preferences
- *
- * shows additional settings. can be overwritten by subclass.
- * @access public
- */
- public function getPreferences()
- {
- if ($this->types != "")
- {
- echo "<b>" . _("Angebundene Lernmodul-Typen: ") . "</b>";
- echo "<br>\n";
- foreach($this->types as $key => $type)
- echo Icon::create($type["icon"], Icon::ROLE_INACTIVE)->asImg() . $type["name"] . " ($key)<br>\n";
- echo "<br>\n";
- }
-
- if ($this->db_classes != "")
- {
- echo "<b>" . _("Verwendete DB-Zugriffs-Klassen: ") . "</b>";
- echo "<br>\n";
- foreach($this->db_classes as $key => $type) {
- echo $type["file"] . " ($key)<br>\n";
- }
- echo "<br>\n";
- }
- }
-
- /**
- * create new instance of subclass content-module with given values
- *
- * creates new instance of subclass content-module with given values
- * @access public
- * @param array $data module-data
- * @param boolean $is_connected is module connected to seminar?
- */
- public function setContentModule($data, $is_connected = false)
- {
- global $current_module;
- $current_module = $data["ref_id"];
-
- require_once($this->CLASS_PREFIX . "ContentModule.php");
- $classname = $this->CLASS_PREFIX . "ContentModule";
-
- $this->content_module[$current_module] = new $classname("", $data["type"], $this->cms_type);
- $this->content_module[$current_module]->setId($data["ref_id"]);
- $this->content_module[$current_module]->setTitle($data["title"]);
- $this->content_module[$current_module]->setDescription($data["description"]);
- $this->content_module[$current_module]->setConnectionType($is_connected);
- }
-
- /**
- * create new instance of subclass content-module
- *
- * creates new instance of subclass content-module
- * @access public
- * @param string $module_id module-id
- * @param string $module_type module-type
- * @param boolean $is_connected is module connected to seminar?
- */
- public function newContentModule($module_id, $module_type, $is_connected = false)
- {
- global $current_module;
- $current_module = $module_id;
-
- require_once($this->CLASS_PREFIX . "ContentModule.php");
- $classname = $this->CLASS_PREFIX . "ContentModule";
-
- if ($is_connected == false)
- {
- $this->content_module[$module_id] = new $classname("", $module_type, $this->cms_type);
- $this->content_module[$module_id]->setId($module_id);
- }
- else
- {
- $this->content_module[$module_id] = new $classname($module_id, $module_type, $this->cms_type);
- }
-
- $this->content_module[$module_id]->setConnectionType($is_connected);
- }
-
- /**
- * get name of cms
- *
- * returns name of cms
- * @access public
- * @return string name
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * get type of cms
- *
- * returns type of cms
- * @access public
- * @return string type
- */
- public function getCMSType()
- {
- return $this->cms_type;
- }
-
- /**
- * get path of cms
- *
- * returns path of cms
- * @access public
- * @return string path
- */
- public function getAbsolutePath()
- {
- return $this->ABSOLUTE_PATH_ELEARNINGMODULES;
- }
-
- /**
- * get target file of cms
- *
- * returns target file of cms
- * @access public
- * @return string target file
- */
- public function getTargetFile()
- {
- return $this->target_file;
- }
-
- /**
- * get class prefix
- *
- * returns class prefix
- * @access public
- * @return string class prefix
- */
- public function getClassPrefix()
- {
- return $this->CLASS_PREFIX;
- }
-
- /**
- * get authentification-setting
- *
- * returns true, if authentification is necessary
- * @access public
- * @return boolean authentification-setting
- */
- public function isAuthNecessary()
- {
- return $this->auth_necessary;
- }
-
- /**
- * get active-setting
- *
- * returns true, if cms is active
- * @access public
- * @return boolean active-setting
- function isActive($cms = "")
- {
- return $this->is_active;
- }
- */
-
- /**
- * get user prefix
- *
- * returns user prefix
- * @access public
- * @return string user prefix
- */
- public function getUserPrefix()
- {
- return $this->USER_PREFIX;
- }
-
- /**
- * get logo-image
- *
- * returns logo-image
- * @access public
- * @return string logo-image
- */
- public function getLogo()
- {
- return "<img src=\"" . $this->logo_file . "\">";
- }
-
- /**
- * get user modules
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- public function getUserContentModules()
- {
- return false;
- }
-
- /**
- * search modules
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- public function searchContentModules($key)
- {
- return false;
- }
-
- /**
- * dummy-method. can be overwritten by subclass.
- */
- public function terminate()
- {
- }
-
- public function deleteConnectedModules($object_id){
- return ObjectConnections::DeleteAllConnections($object_id, $this->cms_type);
- }
-}
diff --git a/lib/elearning/ConnectedLink.php b/lib/elearning/ConnectedLink.php
deleted file mode 100644
index 6fa1de5..0000000
--- a/lib/elearning/ConnectedLink.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/**
-* class to generate links to connected systems
-*
-* This class contains methods to generate links to connected content-management-systems.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module ConnectedLink
-* @package ELearning-Interface
-*/
-
-use Studip\Button, Studip\LinkButton;
-
-class ConnectedLink
-{
- var $cms_type;
- var $cms_link;
- /**
- * constructor
- *
- * init class. don't call directly, class is loaded by ConnectedCMS.
- * @access public
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- global $ELEARNING_INTERFACE_MODULES;
-
- $this->cms_type = $cms;
- $this->cms_link = $ELEARNING_INTERFACE_MODULES[$cms]["ABSOLUTE_PATH_ELEARNINGMODULES"] . ($ELEARNING_INTERFACE_MODULES[$cms]["target_file"] ?? null);
- }
-
- /**
- * get link to create new account
- *
- * returns link to create new user-account
- * @access public
- * @return string html-code
- */
- function getNewAccountLink()
- {
- global $connected_cms, $cms_select, $current_module;
-
- $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";
- $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=\"search_key\" value=\"" . htmlReady(Request::get('search_key')) . "\">\n";
- $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
- $output .= "<input type=\"HIDDEN\" name=\"new_account_cms\" value=\"" . htmlReady($this->cms_type) . "\">\n";
- $output .= "<input type=\"HIDDEN\" name=\"new_account_step\" value=\"0\">\n";
- $output .= Button::createAccept(_('Starten'), 'start');
- $output .= "</form>";
- return $output;
- }
-
- /**
- * get module-links for user
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- function getUserModuleLinks()
- {
- return false;
- }
-
- /**
- * get module-links for admin
- *
- * returns links to remove or add module to object
- * @access public
- * @return string html-code
- */
- 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 .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
- else
- $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
- $output .= "</form>";
-
- return $output;
- }
-
- /**
- * get new module link
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- function getNewModuleLink()
- {
- return false;
- }
-
- /**
- * get start page link
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- function getStartpageLink()
- {
- return false;
- }
-}
-?>
diff --git a/lib/elearning/ConnectedPermissions.php b/lib/elearning/ConnectedPermissions.php
deleted file mode 100644
index a2216b7..0000000
--- a/lib/elearning/ConnectedPermissions.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/**
-* class to handle access controls
-*
-* This class contains methods to handle permissions on connected objects.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module ConnectedPermission
-* @package ELearning-Interface
-*/
-class ConnectedPermissions
-{
- var $cms_type;
-
- var $db_class;
- /**
- * constructor
- *
- * init class. don't call directly, class is loaded by ConnectedCMS.
- * @access public
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- global $connected_cms, $ELEARNING_INTERFACE_MODULES;
-
- $this->cms_type = $cms;
- if ($ELEARNING_INTERFACE_MODULES[$this->cms_type]["RELATIVE_PATH_DB_CLASSES"] != false)
- {
- require_once('lib/elearning/' . $ELEARNING_INTERFACE_MODULES[$this->cms_type]["RELATIVE_PATH_DB_CLASSES"]
- . "/" . $ELEARNING_INTERFACE_MODULES[$this->cms_type]["db_classes"]["permissions"]["file"] );
- $classname = $ELEARNING_INTERFACE_MODULES[$this->cms_type]["db_classes"]["permissions"]["classname"];
- $this->db_class = new $classname();
- }
-
- }
-
- /**
- * get module-permissions
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @param string $module_id module-id
- * @return boolean returns false
- */
- function getContentModulePerms($module_id)
- {
- return false;
- }
-}
-?> \ No newline at end of file
diff --git a/lib/elearning/ConnectedUser.php b/lib/elearning/ConnectedUser.php
deleted file mode 100644
index 3c74a14..0000000
--- a/lib/elearning/ConnectedUser.php
+++ /dev/null
@@ -1,512 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-DEFINE ("USER_TYPE_ORIGINAL" , "1");
-DEFINE ("USER_TYPE_CREATED", "0");
-
-/**
-* class to handle user-accounts
-*
-* This class contains methods to handle connected user-accounts.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module ConnectedUser
-* @package ELearning-Interface
-*/
-class ConnectedUser
-{
- var $cms_type;
- var $id;
- var $studip_id;
- var $studip_login;
- var $studip_password;
- var $login;
- var $external_password;
- var $category;
- var $gender;
- var $title_front;
- var $title_rear;
- var $title;
- var $firstname;
- var $lastname;
- var $institution;
- var $department;
- var $street;
- var $city;
- var $zipcode;
- var $country;
- var $phone_home;
- var $fax;
- var $matriculation;
- var $email;
- var $type;
- var $is_connected;
-
- var $db_class;
- /**
- * constructor
- *
- * init class. don't call directly, class is loaded by ConnectedCMS.
- * @access public
- * @param string $cms system-type
- */
- function __construct($cms, $user_id = false)
- {
- global $auth, $ELEARNING_INTERFACE_MODULES;
-
- $this->studip_id = $user_id ? $user_id : $auth->auth["uid"];
- $this->cms_type = $cms;
-
- if ($ELEARNING_INTERFACE_MODULES[$this->cms_type]["RELATIVE_PATH_DB_CLASSES"] != false)
- {
- require_once("lib/elearning/" . $ELEARNING_INTERFACE_MODULES[$this->cms_type]["RELATIVE_PATH_DB_CLASSES"] . "/" . $ELEARNING_INTERFACE_MODULES[$this->cms_type]["db_classes"]["user"]["file"] );
- $classname = $ELEARNING_INTERFACE_MODULES[$this->cms_type]["db_classes"]["user"]["classname"];
- $this->db_class = new $classname();
- }
- $this->readData();
- $this->getStudipUserData();
- }
-
- /**
- * get data
- *
- * gets data from database
- * @access public
- * @return boolean returns false, if no data was found
- */
- function readData()
- {
- $query = "SELECT external_user_id, external_user_name, external_user_password, external_user_category, external_user_type
- FROM auth_extern
- WHERE studip_user_id = ? AND external_user_system_type = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$this->studip_id, $this->cms_type]);
- $data = $statement->fetch(PDO::FETCH_ASSOC);
-
- if (!$data) {
- $this->id = '';
- $this->is_connected = false;
- return false;
- }
-
- $this->id = $data['external_user_id'];
- $this->login = $data['external_user_name'];
- $this->external_password = $data['external_user_password'];
- $this->category = $data['external_user_category'];
- $this->type = $data['external_user_type'];
- $this->is_connected = true;
-
- return true;
- }
-
- /**
- * get stud.ip-user-data
- *
- * gets stud.ip-user-data from database
- * @access public
- * @return boolean returns false, if no data was found
- */
- function getStudipUserData()
- {
- global $connected_cms;
-
- $query = "SELECT username, password, title_front, title_rear, Vorname,
- Nachname, Email, privatnr, privadr, geschlecht
- FROM auth_user_md5
- LEFT JOIN user_info USING (user_id)
- WHERE user_id = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$this->studip_id]);
- $data = $statement->fetch(PDO::FETCH_ASSOC);
-
- if (!$data) {
- return false;
- }
-
- $this->studip_login = $data['username'];
- if ($this->is_connected == false) {
- $this->login = $connected_cms[$this->cms_type]->getUserPrefix() . $this->studip_login;
- }
-
- $this->studip_password = $data['password'];
- $this->title_front = $data['title_front'];
- $this->title_rear = $data['title_rear'];
- $this->firstname = $data['Vorname'];
- $this->lastname = $data['Nachname'];
- $this->email = $data['Email'];
- $this->phone_home = $data['privatnr'];
- $this->street = $data['privadr'];
- $this->gender = ($data['geschlecht'] == 2 ? 'f' : 'm');
-
- if ($this->title_front != '') {
- $this->title = $this->title_front;
- }
- if ($this->title_front != '' && $this->title_rear != '') {
- $this->title .= ' ';
- }
- if ($this->title_rear != '') {
- $this->title .= $this->title_rear;
- }
- return true;
- }
-
- /**
- * create new user-account
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- function newUser()
- {
- return false;
- }
-
- /**
- * update user-account
- *
- * dummy-method. must be overwritten by subclass.
- */
- public function updateUser()
- {
- }
-
- /**
- * delete user-account
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- function deleteUser()
- {
- return false;
- }
-
- /**
- * get login-data of user-account
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- function getLoginData($username)
- {
- return false;
- }
-
- /**
- * get id
- *
- * returns id
- * @access public
- * @return string id
- */
- function getId()
- {
- return $this->id;
- }
-
- /**
- * get stud.ip user-id
- *
- * returns id
- * @access public
- * @return string stud.ip user-id
- */
- function getStudipId()
- {
- return $this->studip_id;
- }
-
- /**
- * get username
- *
- * returns username
- * @access public
- * @return string username
- */
- function getUsername()
- {
- return $this->login;
- }
-
- /**
- * set username
- *
- * sets username
- * @access public
- * @param string $user_login username
- */
- function setUsername($user_login)
- {
- $this->login = $user_login;
- }
-
- /**
- * get password
- *
- * returns password
- * @access public
- * @return string password
- */
- function getPassword()
- {
- return $this->external_password;
- }
-
- /**
- * set password
- *
- * sets password
- * @access public
- * @param string $user_password password
- */
- function setPassword($user_password)
- {
- $this->external_password = $user_password;
- }
-
- /**
- * get user category
- *
- * returns id
- * @access public
- * @return string id
- */
- function getCategory()
- {
- return $this->category;
- }
-
- /**
- * set user category
- *
- * sets user category
- * @access public
- * @param string $user_category category
- */
- function setCategory($user_category)
- {
- $this->category = $user_category;
- }
-
- /**
- * get crypted password
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @return boolean returns false
- */
- function getCryptedPassword($password)
- {
- return false;
- }
-
- /**
- * verify login data
- *
- * returns true, if login-data is valid
- * @access public
- * @param string $username username
- * @param string $password password
- * @return boolean login-validation
- */
- function verifyLogin($username, $password)
- {
- $this->getLoginData($username);
- if (($username == "") OR ($password == ""))
- return false;
- if ( ($this->login == $username) AND ($this->external_password == $this->getCryptedPassword($password) ) )
- return true;
- return false;
- }
-
- /**
- * get gender
- *
- * returns gender-setting
- * @access public
- * @return string gender-setting
- */
- function getGender()
- {
- return $this->gender;
- }
-
- /**
- * set gender
- *
- * sets gender
- * @access public
- * @param string $user_gender gender-setting
- */
- function setGender($user_gender)
- {
- $this->gender = $user_gender;
- }
-
- /**
- * get full name
- *
- * returns full name
- * @access public
- * @return string name
- */
- function getName()
- {
- if ($this->title != "")
- return $this->title . ' ' . $this->firstname . ' ' . $this->lastname;
- else
- return $this->firstname . ' ' . $this->lastname;
- }
-
- /**
- * get firstname
- *
- * returns firstname
- * @access public
- * @return string firstname
- */
- function getFirstname()
- {
- return $this->firstname;
- }
-
- /**
- * set firstname
- *
- * sets firstname
- * @access public
- * @param string $user_firstname firstname
- */
- function setFirstname($user_firstname)
- {
- $this->firstname = $user_firstname;
- }
-
- /**
- * get lastname
- *
- * returns lastname
- * @access public
- * @return string lastname
- */
- function getLastname()
- {
- return $this->lastname;
- }
-
- /**
- * set lastname
- *
- * sets lastname
- * @access public
- * @param string $user_lastname lastname
- */
- function setLastname($user_lastname)
- {
- $this->lastname = $user_lastname;
- }
-
- /**
- * get email-adress
- *
- * returns email-adress
- * @access public
- * @return string email-adress
- */
- function getEmail()
- {
- return $this->email;
- }
-
- /**
- * set email-adress
- *
- * sets email-adress
- * @access public
- * @param string $user_email email-adress
- */
- function setEmail($user_email)
- {
- $this->email = $user_email;
- }
-
- /**
- * get user-type
- *
- * returns user-type
- * @access public
- * @return string user-type
- */
- function getUserType()
- {
- return $this->type;
- }
-
- /**
- * set user-type
- *
- * sets user-type
- * @access public
- * @param string $user_type user-type
- */
- function setUserType($user_type)
- {
- $this->type = $user_type;
- }
-
- /**
- * save connection for user-account
- *
- * saves user-connection to database and sets type for actual user
- * @param string $user_type user-type
- */
- public function setConnection($user_type)
- {
- $this->setUserType($user_type);
-
- $query = "INSERT INTO auth_extern (studip_user_id, external_user_id, external_user_name,
- external_user_password, external_user_category,
- external_user_system_type, external_user_type)
- VALUES (?, ?, ?, ?, ?, ?, ?)
- ON DUPLICATE KEY
- UPDATE external_user_name = VALUES(external_user_name),
- external_user_password = VALUES(external_user_password),
- external_user_category = VALUES(external_user_category),
- external_user_id = VALUES(external_user_id),
- external_user_type = VALUES(external_user_type)";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([
- (string)$this->studip_id,
- (string)$this->id,
- (string)$this->login,
- (string)$this->external_password,
- (string)$this->category,
- (string)$this->cms_type,
- (int)$this->type,
- ]);
-
- $this->is_connected = true;
- $this->readData();
- }
-
- /**
- * get connection-status
- *
- * returns true, if there is a connected user
- * @access public
- * @return boolean connection-status
- */
- function isConnected()
- {
- return $this->is_connected;
- }
-}
-?>
diff --git a/lib/elearning/ContentModule.php b/lib/elearning/ContentModule.php
deleted file mode 100644
index 1b2921b..0000000
--- a/lib/elearning/ContentModule.php
+++ /dev/null
@@ -1,388 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
-* class to handle content module data
-*
-* This class contains methods to handle connected content module data.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module ContentModule
-* @package ELearning-Interface
-*/
-abstract class ContentModule
-{
- /**
- * Fetches data from conencted cms.
- */
- abstract function readData();
-
- var $id;
- var $title;
- var $module_type;
- var $module_type_name;
- var $icon_file;
- var $cms_type;
- var $cms_name;
- var $description;
- var $authors;
- var $is_connected;
- var $is_dummy;
- var $allowed_operations;
-
- var $db_class;
- var $view;
- /**
- * constructor
- *
- * init class. don't call directly, class is loaded by ConnectedCMS.
- * @access public
- * @param string $module_id module-id
- * @param string $module_type module-type
- * @param string $cms_type system-type
- */
- function __construct($module_id, $module_type, $cms_type)
- {
- global $connected_cms;
-
- $this->is_dummy = false;
- $this->setCMSType($cms_type);
- $this->setModuleType($module_type);
- if ($module_id != "")
- {
- $this->setId($module_id);
-
- $this->readData();
- }
- $this->view = new ContentModuleView($this->cms_type);
-
-/**/ }
-
-/* // Dummy-method. Must be overwritten by subclass.
- function readData()
- {
- return false;
- }
-*/
-
- /**
- * set id
- *
- * sets id
- * @access public
- * @param string $module_id id
- */
- function setId($module_id)
- {
- $this->id = $module_id;
- }
-
- /**
- * get id
- *
- * returns id
- * @access public
- * @return string id
- */
- function getId()
- {
- return $this->id;
- }
-
- /**
- * set cms-type
- *
- * sets cms-type
- * @access public
- * @param string $module_cms_type cms-type
- */
- function setCMSType($module_cms_type)
- {
- global $ELEARNING_INTERFACE_MODULES;
- $this->cms_type = $module_cms_type;
- $this->cms_name = $ELEARNING_INTERFACE_MODULES[$module_cms_type]["name"];
- }
-
- /**
- * get cms-type
- *
- * returns cms-type
- * @access public
- * @return string cms-type
- */
- function getCMSType()
- {
- return $this->cms_type;
- }
-
- /**
- * get cms name
- *
- * returns cms name
- * @access public
- * @return string cms name
- */
- function getCMSName()
- {
- return $this->cms_name;
- }
-
- /**
- * set module-type
- *
- * sets module-type
- * @access public
- * @param string $module_type module-type
- */
- function setModuleType($module_type)
- {
- global $ELEARNING_INTERFACE_MODULES;
- $this->module_type = $module_type;
- $this->module_type_name = $ELEARNING_INTERFACE_MODULES[$this->cms_type]["types"][$module_type]["name"];
- $this->icon_file = $ELEARNING_INTERFACE_MODULES[$this->cms_type]["types"][$module_type]["icon"];
- }
-
- /**
- * get module-type
- *
- * returns module-type
- * @access public
- * @return string module-type
- */
- function getModuleType()
- {
- return $this->module_type;
- }
-
- /**
- * get module-type name
- *
- * returns module-type name
- * @access public
- * @return string module-type name
- */
- function getModuleTypeName()
- {
- return $this->module_type_name;
- }
-
- /**
- * set title
- *
- * sets title
- * @access public
- * @param string $module_title title
- */
- function setTitle($module_title)
- {
- $this->title = $module_title;
- }
-
- /**
- * get title
- *
- * returns title
- * @access public
- * @return string title
- */
- function getTitle()
- {
- return $this->title;
- }
-
- /**
- * set description
- *
- * sets description
- * @access public
- * @param string $module_description description
- */
- function setDescription($module_description)
- {
- $this->description = $module_description;
- }
-
- /**
- * get description
- *
- * returns description
- * @access public
- * @return string description
- */
- function getDescription()
- {
- return $this->description;
- }
-
- /**
- * set authors
- *
- * sets authors
- * @access public
- * @param array $module_authors authors
- */
- function setAuthors($module_authors)
- {
- $this->authors = $module_authors;
- }
-
- /**
- * get authors
- *
- * returns authors
- * @access public
- * @return array authors
- */
- function getAuthors()
- {
- return $this->authors;
- }
-
- /**
- * set connection
- *
- * sets connection with seminar
- * @access public
- * @param string $seminar_id seminar-id
- * @return boolean successful
- */
- function setConnection($seminar_id)
- {
- $this->is_connected = true;
-// echo "$this->id, $this->module_type, $this->cms_type";
- return ObjectConnections::setConnection($seminar_id, $this->id, $this->module_type, $this->cms_type);
- }
-
- /**
- * unset connection
- *
- * unsets connection with seminar
- * @access public
- * @param string $seminar_id seminar-id
- * @return boolean successful
- */
- function unsetConnection($seminar_id)
- {
- $this->is_connected = false;
- return ObjectConnections::unsetConnection($seminar_id, $this->id, $this->module_type, $this->cms_type);
- }
-
- /**
- * set connection-status
- *
- * sets connection-status
- * @access public
- * @param boolean $is_connected connection-status
- */
- function setConnectionType($is_connected)
- {
- $this->is_connected = $is_connected;
- }
-
- /**
- * get connection-status
- *
- * returns true, if module is connected to seminar
- * @access public
- * @return boolean connection-status
- */
- function isConnected()
- {
- return $this->is_connected;
- }
-
- /**
- * get reference string
- *
- * returns reference string for content-module
- * @access public
- * @return string reference string
- */
- function getReferenceString()
- {
- return $this->cms_type."_".$this->module_type."_".$this->id;
- }
-
- /**
- * get icon-image
- *
- * returns icon-image
- * @access public
- * @return string icon-image
- */
- function getIcon()
- {
- if (!$this->icon_file) {
- $this->icon_file = 'learnmodule';
- }
- if (mb_strpos('http', $this->icon_file) === 0) {
- return "<img src=\"" . $this->icon_file . "\">";
- } else {
- return Icon::create($this->icon_file, 'inactive')->asImg();
- }
- }
-
- /**
- * get module-status
- *
- * returns true, if module is a dummy
- * @access public
- * @return boolean module-status
- */
- function isDummy()
- {
- return $this->is_dummy;
- }
-
- /**
- * create module-dummy
- *
- * sets title and description of module to display error-message
- * @access public
- * @param string $error error-type
- */
- function createDummyForErrormessage($error = "unknown")
- {
- global $connected_cms;
-
- switch($error)
- {
- case "no permission":
- $this->setTitle(_("--- Keine Lese-Berechtigung! ---"));
- $this->setDescription(sprintf(_("Sie haben im System \"%s\" keine Lese-Berechtigung für das Lernmodul, das dieser Veranstaltung / Einrichtung an dieser Stelle zugeordnet ist."), $this->getCMSName()));
- break;
- case "not found":
- $this->setTitle(_("--- Dieses Content-Modul existiert nicht mehr im angebundenen System! ---"));
- $this->setDescription(sprintf(_("Das Lernmodul, das dieser Veranstaltung / Einrichtung an dieser Stelle zugeordnet war, existiert nicht mehr. Dieser Fehler tritt auf, wenn das angebundene LCMS \"%s\" nicht erreichbar ist oder wenn das Lernmodul innerhalb des angebundenen Systems gelöscht wurde."), $this->getCMSName()));
- break;
- case "deleted":
- $this->setTitle(_("--- Dieses Content-Modul wurde im angebundenen System gelöscht! ---"));
- $this->setDescription(sprintf(_("Das Lernmodul, das dieser Veranstaltung / Einrichtung an dieser Stelle zugeordnet war, wurde gelöscht."), $this->getCMSName()));
- break;
- default:
- $this->setTitle(_("--- Es ist ein unbekannter Fehler aufgetreten! ---"));
- $this->setDescription(sprintf(_("Unbekannter Fehler beim Lernmodul mit der Referenz-ID \"%s\" im LCMS \"%s\""), $this->getId(), $this->getCMSName()));
- }
-
- $this->is_dummy = true;
- }
-
- /**
- * ask for permission for given operation
- *
- * dummy-method. returns false. must be overwritten by subclass.
- * @access public
- * @param string $operation operation
- * @return boolean returns false
- */
- function isAllowed($operation)
- {
- return false;
- }
-}
-?>
diff --git a/lib/elearning/ContentModuleView.php b/lib/elearning/ContentModuleView.php
deleted file mode 100644
index c351c1c..0000000
--- a/lib/elearning/ContentModuleView.php
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/**
-* class to show content-module data
-*
-* This class contains methods for output of connected module data.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module ContentModuleView
-* @package ELearning-Interface
-*/
-class ContentModuleView
-{
- var $view_mode;
- var $change_date;
- var $module_new;
- var $cms_type;
- /**
- * constructor
- *
- * init class. don't call directly, class is loaded by ContentModule.
- * @access public
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- global $connected_cms;
-
- $this->change_date = 0;
- $this->module_new = false;
- $this->cms_type = $cms;
- $this->setViewMode("closed");
- }
-
- /**
- * show module-data
- *
- * show module-data in printhead/printcontent-style. user-mode
- * @access public
- */
- function show($mode = "")
- {
- global $connected_cms, $view, $search_key, $cms_select, $current_module, $anker_target;
-
- $content_module = $connected_cms[$this->cms_type]->content_module[$current_module];
-
- if ( (! $content_module->isDummy()) AND ($connected_cms[$this->cms_type]->isAuthNecessary() == true) AND ($connected_cms[$this->cms_type]->user->isConnected() == true)) {
- if (! $content_module->isAllowed(OPERATION_VISIBLE)) {
- return false;
- }
- }
-
- if ($_SESSION['elearning_open_close'][$content_module->getReferenceString()] == true)
- $this->setViewMode("open");
- $module_title = $content_module->getTitle();
-/*/
- if ($mode == "searchresult") {
- $module_title = $module_title . " (ID " . $content_module->getId() . ", ";
- if ($content_module->isAllowed(OPERATION_WRITE))
- $module_title = $module_title . " " . _("Schreibzugriff") . ")";
- else
- $module_title = $module_title . " " . _("Lesezugriff") . ")";
- }/**/
- if ($this->isOpen() == true)
- $module_link = URLHelper::getLink('?do_close='. $content_module->getReferenceString() . '&view='.$view.'&search_key='.$search_key.'&cms_select='.$cms_select.'#anker');
- else
- $module_link = URLHelper::getLink('?do_open='. $content_module->getReferenceString() . '&view='.$view.'&search_key='.$search_key.'&cms_select='.$cms_select.'#anker');
- if (! $content_module->isDummy())
- $module_buttons = $connected_cms[$this->cms_type]->link->getUserModuleLinks();
- $template = $GLOBALS['template_factory']->open('elearning/_content_module.php');
- $template->set_attribute('module_anker_target', ($anker_target == $content_module->getReferenceString()));
- $template->set_attribute('module_link', $module_link);
- $template->set_attribute('module_buttons', $module_buttons);
- $template->set_attribute('module_authors', $content_module->getAuthors());
- $template->set_attribute('module_title', $module_title);
- $template->set_attribute('module_description', $content_module->getDescription());
- $template->set_attribute('module_is_new', $this->module_new);
- $template->set_attribute('module_chdate', $this->change_date);
- $template->set_attribute('module_reference', $content_module->getReferenceString());
- $template->set_attribute('module_source', $content_module->getCMSName() . " / " . $content_module->getModuleTypeName());
- $template->set_attribute('module_icon', $content_module->getIcon());
- $template->set_attribute('module_is_open', $this->isOpen());
- return $template->render();
- }
-
- /**
- * show module-data to admin
- *
- * show module-data in printhead/printcontent-style. admin-mode
- * @access public
- */
- function showAdmin($mode = "")
- {
- global $connected_cms, $view, $search_key, $cms_select, $current_module, $anker_target;
-
- $content_module = $connected_cms[$this->cms_type]->content_module[$current_module];
-
- if ( (! $content_module->isDummy()) AND ($connected_cms[$this->cms_type]->isAuthNecessary() == true) AND ($connected_cms[$this->cms_type]->user->isConnected() == true)) {
- if (! $content_module->isAllowed(OPERATION_VISIBLE)) {
- return false;
- }
- }
-
- if ($_SESSION['elearning_open_close'][$content_module->getReferenceString()] == true)
- $this->setViewMode("open");
-
- $module_title = $content_module->getTitle();
- $module_title = $module_title . " (ID " . $content_module->getId();
- if ($content_module->isAllowed(OPERATION_WRITE))
- $module_title = $module_title . ", " . _("Schreibzugriff");
- elseif ($content_module->isAllowed(OPERATION_READ))
- $module_title = $module_title . ", " . _("Lesezugriff");
- else
- $module_title = $module_title . ", " . _("kein Lesezugriff");
- $module_title = $module_title . ")";
-
- if ($this->isOpen() == true)
- $module_link = URLHelper::getLink('?do_close='. $content_module->getReferenceString() . '&view='.$view.'&search_key='.$search_key.'&cms_select='.$cms_select.'#anker');
- else
- $module_link = URLHelper::getLink('?do_open='. $content_module->getReferenceString() . '&view='.$view.'&search_key='.$search_key.'&cms_select='.$cms_select.'#anker');
-
- $template = $GLOBALS['template_factory']->open('elearning/_content_module.php');
- $template->set_attribute('module_anker_target', ($anker_target == $content_module->getReferenceString()));
- $template->set_attribute('module_link', $module_link);
- if ($content_module->isAllowed(OPERATION_READ))
- $module_buttons = $connected_cms[$this->cms_type]->link->getAdminModuleLinks();
- $template->set_attribute('module_buttons', $module_buttons);
- $template->set_attribute('module_authors', $content_module->getAuthors());
- $template->set_attribute('module_title', $module_title);
- $template->set_attribute('module_description', $content_module->getDescription());
- $template->set_attribute('module_is_new', $this->module_new);
- $template->set_attribute('module_chdate', $this->change_date);
- $template->set_attribute('module_reference', $content_module->getReferenceString());
- $template->set_attribute('module_source', $content_module->getCMSName() . " / " . $content_module->getModuleTypeName());
- $template->set_attribute('module_icon', $content_module->getIcon());
- $template->set_attribute('module_is_open', $this->isOpen());
- return $template->render();
- }
-
- /**
- * get open-status
- *
- * returns true, if module is opened
- * @access public
- * @return boolean open-status
- */
- function isOpen()
- {
- if ($this->view_mode == "open")
- return true;
- else
- return false;
- }
-
- /**
- * set view-mode
- *
- * sets view-mode
- * @access public
- * @param boolean $module_mode view-mode
- */
- function setViewMode($module_mode)
- {
- $this->view_mode = $module_mode;
- }
-
- /**
- * set changedate
- *
- * sets changedate for view
- * @access public
- * @param string $module_chdate changedate
- */
- function setChangeDate($module_chdate)
- {
- $this->change_date = $module_chdate;
-
- if (object_get_visit(Context::getId(), "elearning_interface") < $this->change_date)
- $this->module_new = true;
- else
- $this->module_new = false;
- }
-}
-?>
diff --git a/lib/elearning/ELearningUtils.php b/lib/elearning/ELearningUtils.php
deleted file mode 100644
index 806cff9..0000000
--- a/lib/elearning/ELearningUtils.php
+++ /dev/null
@@ -1,612 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/**
-* class with several forms and tools for the elearning interface
-*
-* This class contains Utilities for the elearning-interface.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @package ELearning-Interface
-*/
-
-use Studip\Button, Studip\LinkButton;
-
-class ELearningUtils
-{
- /**
- * loads class ConnectedCMS for given system-type and creates an instance
- *
- * @param string $cms system-type
- */
- public static function loadClass($cms)
- {
- global $connected_cms, $ELEARNING_INTERFACE_MODULES;
-
- if (!isset($connected_cms[$cms]) || !is_object($connected_cms[$cms])) {
- require_once "lib/elearning/{$ELEARNING_INTERFACE_MODULES[$cms]['CLASS_PREFIX']}ConnectedCMS.php";
- $classname = "{$ELEARNING_INTERFACE_MODULES[$cms]['CLASS_PREFIX']}ConnectedCMS";
- $connected_cms[$cms] = new $classname($cms);
- $connected_cms[$cms]->initSubclasses();
- }
- }
-
- public static function initElearningInterfaces()
- {
- global $ELEARNING_INTERFACE_MODULES, $connected_cms;
- if (is_array($ELEARNING_INTERFACE_MODULES)) {
- foreach (array_keys($ELEARNING_INTERFACE_MODULES) as $cms) {
- if (self::isCMSActive($cms)) {
- self::loadClass($cms);
- }
- }
- }
- return is_array($connected_cms) ? count($connected_cms) : false;
- }
-
- /**
- * gets config-value with given name from globals
- *
- * @param string $name entry-name
- * @param string $cms system-type
- * @return boolean returns false if no cms is given
- */
- public static function getConfigValue($name, $cms)
- {
- if (!$cms) {
- return false;
- }
- return Config::get()->getValue("ELEARNING_INTERFACE_{$cms}_{$name}");
- }
-
- /**
- * set config-value
- *
- * writes config-value with given name and value to database
- *
- * @param string $name entry-name
- * @param string $value value
- * @param string $cms system-type
- */
- public static function setConfigValue($name, $value, $cms)
- {
- if (!$cms) {
- return;
- }
-
- try {
- Config::get()->store("ELEARNING_INTERFACE_{$cms}_{$name}", $value);
- } catch (InvalidArgumentException $e) {
- Config::get()->create("ELEARNING_INTERFACE_{$cms}_{$name}", [
- 'value' => $value,
- 'type' => 'string',
- ]);
- }
- }
-
- /**
- * check cms-status
- *
- * checks if connected content-management-system is activated
- *
- * @param string $cms system-type
- */
- public static function isCMSActive($cms)
- {
- return self::getConfigValue('ACTIVE', $cms);
- }
-
- /**
- * get cms-selectbox
- *
- * returns a form to select a cms
- *
- * @param string $message description-text
- * @param boolean $check_active show only activated systems
- * @return string returns html-code
- */
- public static function getCMSSelectbox($message, $check_active = true)
- {
- global $ELEARNING_INTERFACE_MODULES, $cms_select, $search_key, $view;
- if (!is_array($ELEARNING_INTERFACE_MODULES)) {
- $msg = sprintf(_("Die ELearning-Schnittstelle ist nicht korrekt konfiguriert. Die Variable \"%s\" "
- ."muss in der Konfigurationsdatei von Stud.IP erst mit den Verbindungsdaten angebundener "
- ."Learning-Content-Management-Systeme aufgefüllt werden. Solange dies nicht geschehen "
- ."ist, setzen Sie die Variable \"%s\" auf FALSE!"), "\$ELEARNING_INTERFACE_MODULES", "\$ELEARNING_INTERFACE_ENABLE");
- PageLayout::postError($msg);
- return false;
- }
- $options = [];
- foreach ($ELEARNING_INTERFACE_MODULES as $cms => $cms_preferences) {
- if (!$check_active || self::isCMSActive($cms)) {
- $options[$cms] = $cms_preferences['name'];
- }
- }
- $template = $GLOBALS['template_factory']->open('elearning/_cms_selectbox.php');
- $template->cms_select = $cms_select;
- $template->options = $options;
- $template->search_key = $search_key;
- $template->view = $view;
- $template->message = $message;
- return $template->render();
- }
-
- /**
- * get moduletype-selectbox
- *
- * returns a form to select type for new contentmodule
- *
- * @param string $cms system-type
- * @return string returns html-code
- */
- public static function getTypeSelectbox($cms)
- {
- global $ELEARNING_INTERFACE_MODULES;
- $options = [];
- foreach ($ELEARNING_INTERFACE_MODULES[$cms]['types'] as $type => $info) {
- $options[$type] = $info['name'];
- if (Request::get("module_type_{$cms}") === $type) {
- $selected = $type;
- }
- }
- $template = $GLOBALS['template_factory']->open('elearning/_type_selectbox.php');
- $template->options = $options;
- $template->selected = $selected;
- $template->cms = $cms;
- return $template->render();
- }
-
- /**
- * get searchfield
- *
- * returns a form to search for modules
- *
- * @param string $message description-text
- * @return string returns html-code
- */
- public static function getSearchfield($message)
- {
- global $cms_select, $search_key, $view;
- $template = $GLOBALS['template_factory']->open('elearning/_searchfield.php');
- $template->cms_select = $cms_select;
- $template->search_key = $search_key;
- $template->view = $view;
- $template->message = $message;
- return $template->render();
- }
-
- /**
- * get form for new content-module
- *
- * returns a form to choose module-type and to create a new content-module
- *
- * @param string $cms system-type
- * @return string returns html-code
- */
- public static function getNewModuleForm($cms)
- {
- global $ELEARNING_INTERFACE_MODULES, $connected_cms;
- if (sizeof($ELEARNING_INTERFACE_MODULES[$cms]["types"]) == 1)
- foreach($ELEARNING_INTERFACE_MODULES[$cms]["types"] as $type => $info)
- Request::set("module_type_" . $cms, $type);
- $link = $connected_cms[$cms]->link->getNewModuleLink();
-
- if ($link == false)
- return false;
- $types = [];
- $cms_types = [];
- foreach ($ELEARNING_INTERFACE_MODULES as $cms_type => $cms_data)
- $cms_types["module_type_" . $cms_type] = Request::option("module_type_" . $cms_type);
- $template = $GLOBALS['template_factory']->open('elearning/_new_module_form.php');
- $template->set_attribute('link', $link);
- $template->set_attribute('cms', $cms);
- $template->set_attribute('cms_types', $cms_types);
- $template->set_attribute('types', $ELEARNING_INTERFACE_MODULES[$cms]["types"]);
- return $template->render();
- }
-
- /**
- * get form for external user-account
- *
- * returns a form for administration of external user-account
- *
- * @param string message message-string
- * @param string my_account_cms cms-type
- * @return string returns html-code
- */
- public static function getMyAccountForm($message, $my_account_cms)
- {
- global $connected_cms;
- $template = $GLOBALS['template_factory']->open('elearning/_my_account_form.php');
- if ($connected_cms[$my_account_cms]->user->isConnected()) {
- $template->set_attribute('login', $connected_cms[$my_account_cms]->user->getUsername());
- $template->set_attribute('is_connected', 1);
- }
- $template->set_attribute('my_account_cms', $my_account_cms);
- $template->set_attribute('message', $message);
- return $template->render();
- }
-
- /**
- * get form for new user
- *
- * returns a form to add a user-account to connected cms
- *
- * @param string $new_account_cms system-type
- * @return string returns html-code
- */
- public static function getNewAccountForm(&$new_account_cms)
- {
- global $connected_cms, $cms_select, $view, $current_module, $messages,
- $ELEARNING_INTERFACE_MODULES;
-
- $new_account_step = Request::int('new_account_step');
- $ext_password = Request::get('ext_password');
- $ext_password_2 = Request::get('ext_password_2');
- $ext_username = Request::get('ext_username');
- $ref_id = Request::get('ref_id');
- $module_type = Request::get('module_type');
-
- self::loadClass($new_account_cms);
-
- //Password was sent, but is to short
- if (isset($ext_password_2) && !Request::submitted('go_back') && Request::submitted('next') && mb_strlen($ext_password_2) < 6) {
- PageLayout::postError(_('Das Passwort muss mindestens 6 Zeichen lang sein!'));
- $new_account_step--;
- } elseif (isset($ext_password_2) && ! Request::submitted('go_back') && Request::submitted('next') && $ext_password != $ext_password_2) {
- //Passwords doesn't match password repeat
- PageLayout::postError(_('Das Passwort entspricht nicht der Passwort-Wiederholung!'));
- $new_account_step--;
- }
-
- // Benutzername was sent
- if ($ext_username && !Request::submitted('go_back') && Request::submitted('assign')) {
- $caching_status = $connected_cms[$new_account_cms]->soap_client->getCachingStatus();
- $connected_cms[$new_account_cms]->soap_client->setCachingStatus(false);
- if ($connected_cms[$new_account_cms]->user->verifyLogin($ext_username, $ext_password)) {
- $is_verified = true;
- PageLayout::postInfo(_('Der Account wurde zugeordnet.'));
- $connected_cms[$new_account_cms]->user->setCategory("");
- $connected_cms[$new_account_cms]->user->setUsername($ext_username);
- $connected_cms[$new_account_cms]->user->setPassword($ext_password);
- $connected_cms[$new_account_cms]->user->setConnection(USER_TYPE_ORIGINAL);
- if ($ref_id) {
- $connected_cms[$new_account_cms]->newContentModule($ref_id, $module_type, true);
- $module_title = $connected_cms[$new_account_cms]->content_module[$current_module]->getTitle();
- $module_links = $connected_cms[$new_account_cms]->link->getUserModuleLinks();
- }
- } else {
- $new_account_step = 1;
- PageLayout::postError(_('Die eingegebenen Login-Daten sind nicht korrekt.'));
- }
- $connected_cms[$new_account_cms]->soap_client->setCachingStatus($caching_status);
- }
-
- if (Request::submitted('start')) {
- $new_account_step = 1;
- }
- if (Request::submitted('go_back')) {
- $new_account_step--;
- if ($new_account_step < 1) {
- $new_account_cms = '';
- return false;
- }
- } elseif (Request::submitted('next') || Request::submitted('assign')) {
- $new_account_step++;
- }
-
- if ($new_account_step == 2 && Request::submitted('assign')) {
- // Assign existing Account
- $step = 'assign';
- } elseif ($new_account_step == 2 && Request::submitted('next')) {
- // Create new Account: ask for new password
- $step = 'new_account';
- } elseif ($new_account_step == 3 && Request::submitted('next')) {
- // Create new Account
- $connected_cms[$new_account_cms]->user->setPassword($ext_password);
- if ($connected_cms[$new_account_cms]->user->newUser()) {
- $is_verified = true;
- PageLayout::postInfo(sprintf(_("Der Account wurde erzeugt und zugeordnet. Ihr Loginname ist %s."), "<b>" . htmlReady($connected_cms[$new_account_cms]->user->getUsername()) . "</b>"));
- if ($ref_id) {
- $connected_cms[$new_account_cms]->newContentModule($ref_id, $module_type, true);
- $module_title = $connected_cms[$new_account_cms]->content_module[$current_module]->getTitle();
- $module_links = $connected_cms[$new_account_cms]->link->getUserModuleLinks();
- }
- }
- } elseif (!$is_verified) {
- 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";
- }
- }
- $template = $GLOBALS['template_factory']->open('elearning/_new_account_form.php');
- $template->cms_title = htmlReady($connected_cms[$new_account_cms]->getName());
- $template->cms_select = $cms_select;
- $template->module_title = $module_title;
- $template->module_links = $module_links;
- $template->module_type = $module_type;
- $template->ref_id = $ref_id;
- $template->ext_username = $ext_username;
- $template->new_account_cms = $new_account_cms;
- $template->new_account_step = $new_account_step;
- $template->is_connected = $connected_cms[$new_account_cms]->user->isConnected();
- $template->is_verified = $is_verified;
- $template->step = $step;
-
- // TODO: Should this really be below the assignment?
- if ($is_verified) {
- $new_account_cms = "";
- }
-
- return $template->render();
- }
-
- /**
- * get table-header for connected cms
- *
- * returns a table-header for connected cms
- *
- * @param string $title table-title
- * @return string returns html-code
- */
- public static function getCMSHeader($title)
- {
- $template = $GLOBALS['template_factory']->open('elearning/_cms_header.php');
- $template->title = $title;
- return $template->render();
- }
-
- /**
- * get table-footer for connected cms
- *
- * returns a table-footer for connected cms
- *
- * @param string $logo system-logo
- * @return string returns html-code
- */
- public static function getCMSFooter($logo)
- {
- $template = $GLOBALS['template_factory']->open('elearning/_cms_footer.php');
- $template->logo = $logo;
- return $template->render();
- }
-
- /**
- * get headline for modules
- *
- * returns a table with a headline
- *
- * @param string $title headline
- * @return string returns html-code
- */
- public static function getModuleHeader($title)
- {
- global $view, $cms_select, $search_key;
- $template = $GLOBALS['template_factory']->open('elearning/_module_header.php');
- $template->title = $title;
- $template->view = $view;
- $template->cms_select = $cms_select;
- $template->search_key = $search_key;
- $template->all_open = $_SESSION['elearning_open_close']['all open'];
- return $template->render();
- }
-
- /**
- * get Headline
- *
- * returns a table with a headline
- *
- * @param string $title headline
- * @return string returns html-code
- */
- public static function getHeader($title)
- {
- $template = $GLOBALS['template_factory']->open('elearning/_header.php');
- $template->title = $title;
- return $template->render();
- }
-
- /**
- * save timestamp
- *
- * saves a timestamp for debugging and performance-check
- *
- * @param string $stri description
- */
- public static function bench($stri)
- {
- $GLOBALS['timearray'][] = [
- 'zeit' => microtime(true),
- 'name' => $stri,
- ];
- }
-
- /**
- * show benchmark
- *
- * shows saved timestamps with descriptions
- *
- * @param string $stri description
- */
- public static function showbench()
- {
- global $timearray;
- echo "<table><tr><td>Zeit (".$timearray[0]["name"].")</td><td align=\"right\"></td></tr>";
- for ($i = 0; $i < count($timearray); $i++) {
- echo "<tr><td>".$timearray[$i]["name"].": </td><td align=\"right\">" . number_format(($timearray[$i]["zeit"]-$timearray[$i-1]["zeit"])*1000,2) . " msek</td></tr>";
- }
- echo "<tr><td>Gesamtzeit: </td><td align=\"right\">" . number_format(($timearray[$i-1]["zeit"]-$timearray[0]["zeit"])*1000,2)." msek</td></tr></table>";
- }
-
- /**
- * delete cms-data
- *
- * deletes all data belonging to the specified cms from stud.ip database
- */
- public static function deleteCMSData($cms_type)
- {
- $db = DBManager::get();
- $db->execute("DELETE FROM auth_extern WHERE external_user_system_type = ?", [$cms_type]);
- $db->execute("DELETE FROM object_contentmodules WHERE system_type = ?", [$cms_type]);
-
- $config = Config::get();
- foreach ($config->getFields('global' ,null , "ELEARNING_INTERFACE_{$cms_type}") as $key) {
- $config->delete($key);
- }
- }
-
- /**
- * get ilias courses
- *
- * creates output of ilias courses linked to the chosen seminar. also updates object-connections.
- *
- * @return array
- */
- public static function getIliasCourses($sem_id)
- {
- global $connected_cms, $messages, $view, $cms_select;
- $db = DBManager::get();
-
- $rs = $db->query("SELECT DISTINCT system_type, module_id
- FROM object_contentmodules
- WHERE module_type = 'crs' AND object_id = " . $db->quote($sem_id))
- ->fetchAll(PDO::FETCH_ASSOC);
- $courses = [];
- 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) {
- 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()
- ];
- // gegebenenfalls zugeordnete Module aktualisieren
- if (Request::option('update')) {
- if ((method_exists($connected_cms[$system_type], "updateConnections"))) {
- $connected_cms[$system_type]->updateConnections($crs_id);
- }
- }
- if (method_exists($connected_cms[$system_type]->permissions, 'CheckUserPermissions')) {
- $connected_cms[$system_type]->permissions->CheckUserPermissions($crs_id);
- }
- }
- }
- }
-
- if ($connected_courses['courses']) {
- 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 {
- $connected_courses['text'] = _("Diese Veranstaltung ist mit einem Ilias-Kurs verknüpft. Hier gelangen Sie direkt in den Kurs: ");
- }
- }
-
- return $connected_courses;
- }
-
- /**
- * check db-integrity
- *
- * checks if there are broken links in the database
- *
- * @return boolean successful
- */
- public static function checkIntegrity()
- {
- global $ELEARNING_INTERFACE_MODULES, $messages;
- $db = DBManager::get();
-
- foreach ($ELEARNING_INTERFACE_MODULES as $cms_type =>$data) $cmsystems[$cms_type] = [];
-
- $config = Config::get();
- foreach ($config->getFields('global' ,null , 'ELEARNING_INTERFACE_') as $key) {
- $parts = explode("_", $key);
- $cmsystems[$parts[2]]["config"]++;
- }
-
- $rs = $db->query("SELECT external_user_system_type, COUNT(*) as c FROM auth_extern GROUP BY external_user_system_type");
- while ($row = $rs->fetch())
- $cmsystems[$row["external_user_system_type"]]["accounts"] = $row['c'];
- $rs = $db->query("SELECT system_type, COUNT(*) FROM object_contentmodules GROUP BY system_type");
- while ($row = $rs->fetch())
- $cmsystems[$row["system_type"]]["modules"] = $row['c'];
-
- if (Request::submitted('delete')) {
- $messages["info"] .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">";
- $messages["info"] .= CSRFProtection::tokenTag();
- $messages["info"] .= "<table>";
- $messages["info"] .= "<tr><td>&nbsp;</td></tr>";
- $messages["info"] .= "<tr><td>" . sprintf(_("Durch das Löschen der Daten zum System mit dem Index \"%s\" werden %s Konfigurationseinträge und Verknüpfungen von Stud.IP-Veranstaltungen und -User-Accounts unwiederbringlich aus der Stud.IP-Datenbank entfernt. Wollen Sie diese Daten jetzt löschen?"), Request::quoted('delete_cms'), $cmsystems[Request::quoted('delete_cms')]["accounts"]+$cmsystems[Request::quoted('delete_cms')]["modules"]+$cmsystems[Request::quoted('delete_cms')]["config"] ) . "</td></tr>";
- $messages["info"] .= "<tr><td align=\"center\"><input type=\"hidden\" name=\"delete_cms\" value=\"".Request::quoted('delete_cms')."\">";
- $messages["info"] .= '<div class="button-group">' . Button::create(_('Alle löschen'), 'confirm_delete') . Button::createCancel(_('Abbrechen'), 'abbruch') . '<div></td></tr>';
- $messages["info"] .= "<tr><td align=\"center\"></td></tr>";
- $messages["info"] .= "</table>";
- $messages["info"] .= "</form>";
- }
-
- if (Request::submitted('confirm_delete')) {
- unset($cmsystems[Request::quoted('delete_cms')]);
-// deleteCMSData(Request::quoted('delete_cms'));
- $messages["info"] .= _("Daten wurden gelöscht.");
- }
-
- foreach ($cmsystems as $cms_type =>$data) {
- if ($ELEARNING_INTERFACE_MODULES[$cms_type]) {
- $output .= self::getCMSHeader($ELEARNING_INTERFACE_MODULES[$cms_type]["name"]);
- $output .= "<table>";
- $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
- if (self::isCMSActive($cms_type)) {
- $output .= "<tr><td>" . Icon::create('checkbox-checked', 'clickable')->asImg(['class' => 'text-top']) . "</td><td><b>". sprintf(_("Die Schnittstelle zum System %s ist aktiv."), $ELEARNING_INTERFACE_MODULES[$cms_type]["name"]) . "</b></td></tr>";
- $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
- }
- elseif ($data["config"] < 1)
- $output .= "<tr><td>" . Icon::create('checkbox-unchecked', 'clickable')->asImg(['class' => 'text-top']) . "</td><td><i>". sprintf(_("Die Schnittstelle für das System %s wurde noch nicht eingerichtet."), $ELEARNING_INTERFACE_MODULES[$cms_type]["name"]) . "</i></td></tr>";
- elseif ($data["config"] < 1)
- $output .= "<tr><td>" . Icon::create('checkbox-unchecked', 'clickable')->asImg(['class' => 'text-top']) . "</td><td><i>". sprintf(_("Die Schnittstelle wurde noch nicht aktiviert."), $ELEARNING_INTERFACE_MODULES[$cms_type]["name"]) . "</i></td></tr>";
-
- if ($data["accounts"])
- $output .= "<tr><td colspan=\"2\">". sprintf(_("%s Stud.IP-User-Accounts sind mit Accounts im System %s verknüpft."), $data["accounts"], $ELEARNING_INTERFACE_MODULES[$cms_type]["name"]) . "</td></tr>";
- if ($data["modules"])
- $output .= "<tr><td colspan=\"2\">". sprintf(_("%s Objekte sind Stud.IP-Veranstaltungen oder -Einrichtungen zugeordnet."), $data["modules"]) . "</td></tr>";
- if ($data["config"])
- $output .= "<tr><td colspan=\"2\">". sprintf(_("%s Einträge in der config-Tabelle der Stud.IP-Datenbank."), $data["config"]) . "</td></tr>";
- $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
- $output .= "</table>";
- $output .= self::getCMSFooter(($ELEARNING_INTERFACE_MODULES[$cms_type]["logo_file"] ? "<img src=\"".$ELEARNING_INTERFACE_MODULES[$cms_type]["logo_file"]."\" border=\"0\">" : $cms_type));
- }
- else {
- $output .= self::getCMSHeader("<font color=FF0000> Unbekanntes System: " . $cms_type . "</font>");
- $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">";
- $output .= CSRFProtection::tokenTag();
- $output .= "<table>";
- $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
- $output .= "<tr><td>" . Icon::create('decline', 'attention')->asImg(['class' => 'text-top']) . "</td><td><i>".sprintf(_("Für das System mit dem Index \"%s\" existieren keine Voreinstellungen in den Konfigurationsdateien mehr."), $cms_type) . "</i></td></tr>";
- $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
- $output .= "<tr><td colspan=\"2\"><b>". _("In der Stud.IP-Datenbank sind noch folgende Informationen zu diesem System gespeichert:") . "</b></td></tr>";
- if ($data["accounts"])
- $output .= "<tr><td colspan=\"2\">". sprintf(_("%s Stud.IP-User-Accounts sind mit externen Accounts mit dem Index \"%s\" verknüpft."), $data["accounts"], $cms_type) . "</td></tr>";
- if ($data["modules"])
- $output .= "<tr><td colspan=\"2\">". sprintf(_("%s Objekte sind Stud.IP-Veranstaltungen oder -Einrichtungen zugeordnet."), $data["modules"]) . "</td></tr>";
- if ($data["config"])
- $output .= "<tr><td colspan=\"2\">". sprintf(_("%s Einträge in der config-Tabelle der Stud.IP-Datenbank."), $data["config"]) . "</td></tr>";
- $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
- $output .= "<tr><td align=\"center\" colspan=\"2\"><input type=\"hidden\" name=\"delete_cms\" value=\"".$cms_type."\">" . Button::create(_('Löschen'), 'delete') . "</td></tr>";
- $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
- $output .= "</table>";
- $output .= "</form>";
- $output .= self::getCMSFooter('');
- }
- $output .= "<br>";
- }
-
- return $output;
- }
-}
diff --git a/lib/elearning/Ilias3ConnectedCMS.php b/lib/elearning/Ilias3ConnectedCMS.php
deleted file mode 100644
index 759880a..0000000
--- a/lib/elearning/Ilias3ConnectedCMS.php
+++ /dev/null
@@ -1,350 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-use Studip\Button, Studip\LinkButton;
-
-/**
-* main-class for connection to ILIAS 3
-*
-* This class contains the main methods of the elearning-interface to connect to ILIAS 3. Extends ConnectedCMS.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module Ilias3ConnectedCMS
-* @package ELearning-Interface
-*/
-class Ilias3ConnectedCMS extends ConnectedCMS
-{
- var $client_id;
- var $root_user_sid;
- var $main_category_node_id;
- var $user_role_template_id;
- var $user_skin;
- var $user_style;
- var $crs_roles;
- var $global_roles;
- var $soap_client;
- var $encrypt_passwords;
- var $is_first_call = true;
-
- /**
- * constructor
- *
- * init class.
- * @access public
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- global $ELEARNING_INTERFACE_MODULES;
-
- parent::__construct($cms);
-
- require_once($this->CLASS_PREFIX . "Soap.php");
- $classname = $this->CLASS_PREFIX . "Soap";
- $this->soap_client = new $classname($this->cms_type);
- $this->soap_client->setCachingStatus(true);
-
- $this->main_category_node_id = ELearningUtils::getConfigValue("category_id", $cms);
-
- if ((ELearningUtils::getConfigValue("user_role_template_id", $cms) == "") AND ($GLOBALS["role_template_name"] == ""))
- $GLOBALS["role_template_name"] = "Author";
- $this->user_role_template_id = ELearningUtils::getConfigValue("user_role_template_id", $cms);
- $this->user_skin = ELearningUtils::getConfigValue("user_skin", $cms);
- $this->user_style = ELearningUtils::getConfigValue("user_style", $cms);
- $this->encrypt_passwords = ELearningUtils::getConfigValue("encrypt_passwords", $cms);
-
- $this->crs_roles = $ELEARNING_INTERFACE_MODULES[$cms]["crs_roles"];
- $this->client_id = $ELEARNING_INTERFACE_MODULES[$cms]["soap_data"]["client"];
- $this->global_roles = $ELEARNING_INTERFACE_MODULES[$cms]["global_roles"];
- }
-
- /**
- * get preferences
- *
- * shows additional settings.
- */
- public function getPreferences()
- {
- $role_template_name = Request::get('role_template_name');
- $cat_name = Request::get('cat_name');
- $style_setting = Request::option('style_setting');
- $encrypt_passwords = Request::option('encrypt_passwords');
-
- $this->soap_client->setCachingStatus(false);
-
- $messages = ['error' => ''];
-
- if ($cat_name) {
- $cat = $this->soap_client->getReferenceByTitle( trim( $cat_name ), "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 ($role_template_name) {
- $role_template = $this->soap_client->getObjectByTitle( trim( $role_template_name ), "rolt" );
- 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";
- } 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')) {
- 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)) {
- $style_setting = ELearningUtils::getConfigValue("user_style", $this->cms_type);
- }
- if (ELearningUtils::getConfigValue("encrypt_passwords", $this->cms_type)) {
- $encrypt_passwords = ELearningUtils::getConfigValue("encrypt_passwords", $this->cms_type);
- }
- }
-
-
- 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\">";
- echo "<b>" . _("SOAP-Verbindung: ") . "</b>";
- echo "</td><td><font size=\"-1\">";
- $error = $this->soap_client->getError();
- if ($error != false)
- echo sprintf(_("Beim Herstellen der SOAP-Verbindung trat folgender Fehler auf:")) . "<br><br>" . $error;
- else
- echo sprintf(_("Die SOAP-Verbindung zum Klienten \"%s\" wurde hergestellt, der Name des Administrator-Accounts ist \"%s\"."), htmlReady($this->soap_data["client"]), htmlReady($this->soap_data["username"]));
- echo "<br>\n";
- echo "<br>\n";
- echo "</td></tr><tr><td width=30% align=\"left\"><font size=\"-1\">";
-
- $cat = $this->soap_client->getObjectByReference( $this->main_category_node_id );
- echo '<b>' . _('Kategorie') . ':</b>';
- echo "</td><td>";
- echo "<input type=\"text\" size=\"20\" border=0 value=\"" . $cat["title"] . "\" name=\"cat_name\">&nbsp;";
- echo Icon::create('info-circle', 'inactive', ['title' => _('Geben Sie hier den Namen einer bestehenden ILIAS 3 - Kategorie ein, in der die Lernmodule und User-Kategorien abgelegt werden sollen.')])->asImg();
- echo "</td></tr><tr><td></td><td><font size=\"-1\">";
- echo " (ID " . $this->main_category_node_id;
- if ($cat["description"] != "")
- echo ", " . _("Beschreibung: ") . htmlReady($cat["description"]);
- echo ")";
- echo "<br>\n";
- echo "<br>\n";
- echo "</td></tr><tr><td width=30% align=\"left\"><font size=\"-1\">";
-
-
- echo "<b>" . _("Rollen-Template für die persönliche Kategorie: ") . "</b>";
- echo "</td><td>";
- echo "<input type=\"text\" size=\"20\" border=0 value=\"" . ELearningUtils::getConfigValue("user_role_template_name", $this->cms_type) . "\" name=\"role_template_name\">&nbsp;";
- echo Icon::create('info-circle', 'inactive', ['title' => _('Geben Sie den Namen des Rollen-Templates ein, das für die persönliche Kategorie von Lehrenden verwendet werden soll (z.B. \"Author\").')])->asImg();
- echo "</td></tr><tr><td></td><td><font size=\"-1\">";
- echo " (ID " . $this->user_role_template_id;
- echo ")";
- echo "<br>\n";
- echo "<br>\n";
- echo "</td></tr><tr><td width=30% align=\"left\"><font size=\"-1\">";
-
- echo "<b>" . _("Passwörter: ") . "</b>";
- echo "</td><td><font size=\"-1\">";
- echo "<input type=\"checkbox\" border=0 value=\"md5\" name=\"encrypt_passwords\"";
- if ($encrypt_passwords == "md5")
- echo " checked";
- echo ">&nbsp;" . _("ILIAS-Passwörter verschlüsselt speichern.");
- echo Icon::create('info-circle', 'inactive', ['title' => _('Wählen Sie diese Option, wenn die ILIAS-Passwörter der zugeordneten Accounts verschlüsselt in der Stud.IP-Datenbank abgelegt werden sollen.')])->asImg();
- echo "</td></tr><tr><td></td><td><font size=\"-1\">";
- echo "<br>\n";
- echo "<br>\n";
- echo "</td></tr><tr><td width=30% align=\"left\"><font size=\"-1\">";
-
- echo "<b>" . _("Style / Skin: ") . "</b>";
- echo "</td><td><font size=\"-1\">";
- echo "<input type=\"checkbox\" border=0 value=\"studip\" name=\"style_setting\"";
- if ($style_setting == "studip")
- echo " checked";
- echo ">&nbsp;" . _("Stud.IP-Style für neue Nutzer-Accounts voreinstellen.");
- echo Icon::create('info-circle', 'inactive', ['title' => _('Wählen Sie diese Option, wenn für alle von Stud.IP angelegten ILIAS-Accounts das Stud.IP-Layout als System-Style eingetragen werden soll. ILIAS-seitig angelegte Accounts erhalten weiterhin den Standard-Style.')])->asImg();
- echo "</td></tr><tr><td></td><td><font size=\"-1\">";
- echo "<br>\n";
- echo "<br>\n";
-
-
-
-
- echo "</td></tr>";
- echo "</table>";
- echo "<center>" . Button::create(_('übernehmen'), 'submit') . "</center><br>";
- echo "<br>\n";
-
- parent::getPreferences();
-
- echo "<br>\n";
- }
-
- function setContentModule($data, $is_connected = false)
- {
- parent::setContentModule($data, $is_connected);
-
- if ($data["owner"] != "")
- {
- $user_data = $this->soap_client->getUser($data["owner"]);
- $user_name = trim($user_data["title"] . " " . $user_data["firstname"] . " " . $user_data["lastname"]);
- $this->content_module[$data["ref_id"]]->setAuthors($user_name);
- }
- $this->content_module[$data["ref_id"]]->setPermissions($data["accessInfo"], $data["operations"]);
- }
-
- /**
- * create new instance of subclass content-module
- *
- * creates new instance of subclass content-module and gets permissions
- * @access public
- * @param string $module_id module-id
- * @param string $module_type module-type
- * @param string $is_connected is module connected to seminar?
- */
- function newContentModule($module_id, $module_type, $is_connected = false)
- {
- global $seminar_id, $current_module, $caching_active;
-
- $current_module = $module_id;
-// echo "call module $module_id";
-
- if ($this->is_first_call AND ($seminar_id != "") AND ($is_connected == true))
- {
- $id = ObjectConnections::getConnectionModuleId( $seminar_id, "crs", $this->cms_type );
- if ($id != false)
- {
- if ($this->user->isConnected())
- $this->permissions->checkUserPermissions($id);
- $this->is_first_call = false;
- }
-// echo "first call, ref_id $id";
- }
-
- parent::newContentModule($module_id, $module_type, $is_connected);
- }
-
- /**
- * get user modules
- *
- * returns user content modules
- * @access public
- * @return array list of content modules
- */
- function getUserContentModules()
- {
- global $connected_cms;
-
- $types = [];
- foreach ($this->types as $type => $name)
- {
- $types[] = $type;
- }
- if ($this->user->getCategory() == false)
- return false;
- $result = $this->soap_client->getTreeChilds($this->user->getCategory(), $types, $connected_cms[$this->cms_type]->user->getId());
- $obj_ids = [];
- if (is_array($result))
- foreach($result as $key => $object_data){
- if (is_array($object_data["operations"])){
- if ((!in_array($object_data["obj_id"], $obj_ids) && in_array(OPERATION_READ, $object_data["operations"]))
- || in_array(OPERATION_WRITE, $object_data["operations"]))
- {
- if (is_array($user_modules[$object_data["obj_id"]]["operations"])){
- if (in_array(OPERATION_WRITE, $user_modules[$object_data["obj_id"]]["operations"])){
- continue;
- }
- }
- $user_modules[$object_data["obj_id"]] = $object_data;
- $obj_ids[] = $result[$key]["obj_id"];
- }
- }
- }
- return $user_modules;
- }
-
- /**
- * search for content modules
- *
- * returns found content modules
- * @access public
- * @param string $key keyword
- * @return array list of content modules
- */
- function searchContentModules($key)
- {
- global $connected_cms;
-
- $types = [];
- foreach ($this->types as $type => $name)
- {
- $types[] = $type;
- }
-
- $result = $this->soap_client->searchObjects($types, $key,"and", $connected_cms[$this->cms_type]->user->getId());
- return $result;
- }
-
-
- /**
- * get client-id
- *
- * returns client-id
- * @access public
- * @return string client-id
- */
- function getClientId()
- {
- return $this->client_id;
- }
-
- /**
- * get session-id
- *
- * returns soap-session-id
- * @access public
- * @return string session-id
- */
- function getSID()
- {
- return $this->root_user_sid;
- }
-
- /**
- * terminate
- *
- * terminates connection.
- */
- public function terminate()
- {
-// $this->soap_client->logout();
- $this->soap_client->saveCacheData();
- }
-
- //we have to delete the course only
- function deleteConnectedModules($object_id){
- global $connected_cms;
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
- $connected_cms[$this->cms_type]->soap_client->clearCache();
- $connected_cms[$this->cms_type]->soap_client->user_type == "admin";
- $crs_id = ObjectConnections::getConnectionModuleId($object_id, "crs", $this->cms_type);
- if($crs_id && $connected_cms[$this->cms_type]->soap_client->checkReferenceById($crs_id)){
- $connected_cms[$this->cms_type]->soap_client->deleteObject($crs_id);
- }
- return parent::deleteConnectedModules($object_id);
- }
-}
-?>
diff --git a/lib/elearning/Ilias3ConnectedLink.php b/lib/elearning/Ilias3ConnectedLink.php
deleted file mode 100644
index f50fd53..0000000
--- a/lib/elearning/Ilias3ConnectedLink.php
+++ /dev/null
@@ -1,188 +0,0 @@
-<?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 .= "&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;";
- }
- }
-
- 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 .= "&nbsp;" . 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 .= "&nbsp;" . 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 = "&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',
- ]
- );
- }
- $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;
- }
-}
-?>
diff --git a/lib/elearning/Ilias3ConnectedPermissions.php b/lib/elearning/Ilias3ConnectedPermissions.php
deleted file mode 100644
index 5ac5f59..0000000
--- a/lib/elearning/Ilias3ConnectedPermissions.php
+++ /dev/null
@@ -1,256 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-DEFINE ("CRS_NOTIFICATION", "1");
-DEFINE ("CRS_NO_NOTIFICATION", "2");
-DEFINE ("CRS_ADMIN_ROLE", "1");
-DEFINE ("CRS_MEMBER_ROLE", "2");
-DEFINE ("CRS_TUTOR_ROLE", "3");
-DEFINE ("CRS_PASSED_VALUE", "0");
-
-DEFINE ("OPERATION_VISIBLE", "visible");
-DEFINE ("OPERATION_READ", "read");
-DEFINE ("OPERATION_WRITE", "write");
-DEFINE ("OPERATION_DELETE", "delete");
-DEFINE ("OPERATION_CREATE_LM", "create_lm");
-DEFINE ("OPERATION_CREATE_TEST", "create_tst");
-DEFINE ("OPERATION_CREATE_QUESTIONS", "create_qps");
-DEFINE ("OPERATION_CREATE_FILE", "create_file");
-
-/**
-* class to handle ILIAS 3 access controls
-*
-* This class contains methods to handle permissions on connected objects.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module Ilias3ConnectedPermission
-* @package ELearning-Interface
-*/
-class Ilias3ConnectedPermissions extends ConnectedPermissions
-{
- var $operations;
- var $allowed_operations;
- var $tree_allowed_operations;
-
- var $USER_OPERATIONS;
- var $AUTHOR_OPERATIONS;
-
- /**
- * constructor
- *
- * init class.
- * @access
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- global $connected_cms;
-
- parent::__construct($cms);
- $this->readData();
-
- if ($connected_cms[$this->cms_type]->user->isConnected())
- {
- $roles = $this->getUserRoles();
- $connected_cms[$this->cms_type]->user->setRoles( $roles );
- }
- $this->USER_OPERATIONS = [OPERATION_VISIBLE, OPERATION_READ];
-// $this->AUTHOR_OPERATIONS = array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_CREATE_LM, OPERATION_CREATE_TEST, OPERATION_CREATE_QUESTIONS, OPERATION_CREATE_FILE);
- }
-
- /**
- * read data
- *
- * reads acces control data from database
- * @access public
- */
- function readData()
- {
- global $connected_cms;
-
- $this->operations = $connected_cms[$this->cms_type]->soap_client->getOperations();
- }
-
- /**
- * check user permissions
- *
- * checks user permissions for connected course and changes setting if necessary
- * @access public
- * @param string $course_id course-id
- * @return boolean returns false on error
- */
- function checkUserPermissions($course_id)
- {
- global $connected_cms, $messages;
-
- if (!$course_id) {
- return false;
- }
- 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[$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) {
- $proper_role = $role_data["obj_id"];
- }
- }
- }
- }
-
- // 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) {
- $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) {
- case "admin":
- $member_data["role"] = CRS_ADMIN_ROLE;
- $type = "Admin";
- break;
- case "tutor":
- $member_data["role"] = CRS_TUTOR_ROLE;
- $type = "Tutor";
- break;
- case "member":
- $member_data["role"] = CRS_MEMBER_ROLE;
- $type = "Member";
- break;
- default:
- }
- $member_data["passed"] = CRS_PASSED_VALUE;
- if ($type != "")
- {
- $connected_cms[$this->cms_type]->soap_client->addMember( $connected_cms[$this->cms_type]->user->getId(), $type, $course_id );
- if ($GLOBALS["debug"] == true)
- echo "addMember";
- }
- }
-
- // check if user has proper local role
- // if not, change it
- if ($active_role != $proper_role)
- {
- if ($active_role != "")
- {
- $connected_cms[$this->cms_type]->soap_client->deleteUserRoleEntry( $connected_cms[$this->cms_type]->user->getId(), $active_role);
- if ($GLOBALS["debug"] == true)
- echo "Role $active_role deleted.";
- }
-
- if ($proper_role != "")
- {
- $connected_cms[$this->cms_type]->soap_client->addUserRoleEntry( $connected_cms[$this->cms_type]->user->getId(), $proper_role);
- if ($GLOBALS["debug"] == true)
- echo "Role $proper_role added.";
- }
-
- }
- if (!$this->getContentModulePerms($course_id)) {
- $messages["info"] .= _("Für den zugeordneten ILIAS-Kurs konnten keine Berechtigungen ermittelt werden.") . "<br>";
- }
-
- return true;
- }
-
- /**
- * get user roles
- *
- * returns roles for current user
- * @access public
- * @return array role-ids
- */
- function getUserRoles()
- {
- global $connected_cms;
-
- return $connected_cms[$this->cms_type]->soap_client->getUserRoles($connected_cms[$this->cms_type]->user->getId());
- }
-
- /**
- * get permissions for content module
- *
- * returns allowed operations for given user and module
- * @access public
- * @param string $module_id module-id
- * @return boolean returns false on error
- */
- function getContentModulePerms($module_id)
- {
- global $connected_cms, $current_module;
-
- if (is_array($connected_cms[$this->cms_type]->content_module[$current_module]->allowed_operations))
- return true;
- $this->allowed_operations = [];
- $this->tree_allowed_operations = $connected_cms[$this->cms_type]->soap_client->getObjectTreeOperations(
- $module_id,
- $connected_cms[$this->cms_type]->user->getId()
- );
- if (!is_array($this->tree_allowed_operations)) {
- return false;
- }
-
- $no_permission = false;
- if (isset($current_module)) { //TODO: fixes Warning:Creating default object from empty value - possible side effects
- if ((! in_array($this->operations[OPERATION_READ], $this->tree_allowed_operations)) OR (! in_array($this->operations[OPERATION_VISIBLE], $this->tree_allowed_operations)))
- $no_permission = true;
-
- if ($no_permission == false)
- $connected_cms[$this->cms_type]->content_module[$current_module]->allowed_operations = $this->tree_allowed_operations;
- else
- $connected_cms[$this->cms_type]->content_module[$current_module]->allowed_operations = false;
- }
- return true;
- }
-
- /**
- * get operation
- *
- * returns id for given operation-string
- * @access public
- * @param string $operation operation
- * @return integer operation-id
- */
- function getOperation($operation)
- {
- return $this->operations[$operation];
- }
-
- /**
- * get operation-ids
- *
- * returns an array of operation-ids
- * @param array $operation operation
- * @return array|false operation-ids
- */
- public function getOperationArray($operation)
- {
- if (!is_array($operation)) {
- return false;
- }
-
- return array_map(
- function ($operation_name) {
- return $this->operations[$operation_name];
- },
- $operation
- );
- }
-}
diff --git a/lib/elearning/Ilias3ConnectedUser.php b/lib/elearning/Ilias3ConnectedUser.php
deleted file mode 100644
index ef98529..0000000
--- a/lib/elearning/Ilias3ConnectedUser.php
+++ /dev/null
@@ -1,345 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
-* class to handle ILIAS 3 user-accounts
-*
-* This class contains methods to handle connected ILIAS 3 user-accounts.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module Ilias3ConnectedUser
-* @package ELearning-Interface
-*/
-class Ilias3ConnectedUser extends ConnectedUser
-{
- var $roles;
- var $user_sid;
- /**
- * constructor
- *
- * init class.
- * @access
- * @param string $cms system-type
- */
- function __construct($cms, $user_id = false)
- {
- global $connected_cms, $perm;
-
- parent::__construct($cms, $user_id);
- // create account automatically if it doesn't exist
- if (! $this->isConnected() AND ($connected_cms[$this->cms_type]->USER_AUTO_CREATE == true))
- {
- $this->setPassword(md5(uniqid("4dfmjsnll")));
- $this->newUser(true);
- $this->readData();
- }
- $this->roles = [$connected_cms[$cms]->roles[$perm->get_perm($this->studip_id)]];
- }
-
- function readData()
- {
- global $connected_cms;
- parent::readData();
- if($this->is_connected){
- $user_id = $connected_cms[$this->cms_type]->soap_client->lookupUser($this->login);
- if (!$user_id) {
- //do not delete in case of error
- if($user_id !== false) {
- $query = "DELETE FROM auth_extern WHERE studip_user_id = ? LIMIT 1";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$this->studip_id]);
- }
- $this->id = '';
- $this->login = '';
- $this->external_password = '';
- $this->category = '';
- $this->type = '';
- $this->is_connected = false;
- } elseif($this->category != ''){
- $cat = $connected_cms[$this->cms_type]->soap_client->checkReferenceById($this->category);
- if(!$cat){
- $query = "UPDATE auth_extern SET external_user_category = '' WHERE studip_user_id = ? LIMIT 1";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$this->studip_id]);
-
- $this->category = '';
- }
- }
- }
- return $this->is_connected;
- }
-
- /**
- * get login-data
- *
- * gets login-data from database
- * @access public
- * @param string $username username
- * @return boolean returns false, if no data was found
- */
- function getLoginData($username)
- {
- global $connected_cms;
-
- if (!$username) {
- return false;
- }
- $user_id = $connected_cms[$this->cms_type]->soap_client->lookupUser($username);
-
- if ($user_id == false)
- return false;
-
- $user_data = $connected_cms[$this->cms_type]->soap_client->getUser($user_id);
-
- if ($user_data == false)
- return false;
-
- $this->id = $user_data["usr_id"];
- $this->login = $user_data["login"];
- $this->external_password = $user_data["passwd"];
- return true;
- }
-
- /**
- * get crypted password
- *
- * returns ILIAS 3 password
- * @access public
- * @param string $password password
- * @return string password
- */
- function getCryptedPassword($password)
- {
- return md5($password);
- }
-
- /**
- * set roles
- *
- * sets roles
- * @access public
- * @param array $role_array role-array
- */
- function setRoles($role_array)
- {
- $this->roles = $role_array;
- }
-
- /**
- * get roles
- *
- * returns roles
- * @access public
- * @return array roles
- */
- function getRoles()
- {
- return $this->roles;
- }
-
- /**
- * create new user category
- *
- * create new user category
- * @access public
- * @return boolean returns false on error
- */
- function newUserCategory()
- {
- global $connected_cms, $messages;
-
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
-
- // data for user-category in ILIAS 3
- $object_data["title"] = sprintf(_("Eigene Daten von %s (%s)."), $this->getName(), $this->getId());
- $object_data["description"] = sprintf(_("Hier befinden sich die persönlichen Lernmodule des Benutzers %s."), $this->getName());
- $object_data["type"] = "cat";
- $object_data["owner"] = $this->getId();
-
- $cat = $connected_cms[$this->cms_type]->soap_client->getReferenceByTitle($object_data["title"]);
- if ($cat != false && $connected_cms[$this->cms_type]->soap_client->checkReferenceById($cat) )
- {
- $messages["info"] .= sprintf(_("Ihre persönliche Kategorie wurde bereits angelegt."), $this->login) . "<br>\n";
- $this->category = $cat;
- }
- else
- {
- $this->category = $connected_cms[$this->cms_type]->soap_client->addObject($object_data, $connected_cms[$this->cms_type]->main_category_node_id);
- }
- if ($this->category != false)
- parent::setConnection( $this->getUserType() );
- else
- {
- echo "CATEGORY_ERROR".$connected_cms[$this->cms_type]->main_category_node_id ."-";
- return false;
- }
- // data for personal user-role in ILIAS 3
- $role_data["title"] = "studip_usr" . $this->getId() . "_cat" . $this->category;
- $role_data["description"] = sprintf(_("User-Rolle von %s. Diese Rolle wurde von Stud.IP generiert."), $this->getName());
- $role_id = $connected_cms[$this->cms_type]->soap_client->getObjectByTitle($role_data["title"], "role");
- if ($role_id != false)
- $messages["info"] .= sprintf(_("Ihre persönliche Userrolle wurde bereits angelegt."), $this->login) . "<br>\n";
- else
- $role_id = $connected_cms[$this->cms_type]->soap_client->addRoleFromTemplate($role_data, $this->category, $connected_cms[$this->cms_type]->user_role_template_id);
- $connected_cms[$this->cms_type]->soap_client->addUserRoleEntry($this->getId(), $role_id);
- // delete permissions for all global roles for this category
- foreach ($connected_cms[$this->cms_type]->global_roles as $key => $role)
- $connected_cms[$this->cms_type]->soap_client->revokePermissions($role, $this->category);
- return true;
- }
-
- /**
- * new user
- *
- * save new user
- * @access public
- * @return boolean returns false on error
- */
- function newUser($ignore_encrypt_passwords = false)
- {
- global $connected_cms, $auth, $messages;
-
- if ($this->getLoginData($this->login))
- {
- $messages["error"] .= sprintf(_("Es existiert bereits ein Account mit dem Benutzernamen \"%s\"."), $this->login) . "<br>\n";
- return false;
- }
-
- // data for user-account in ILIAS 3
- $user_data["login"] = $this->login;
- $user_data["passwd"] = $this->external_password;
- $user_data["firstname"] = $this->firstname;
- $user_data["lastname"] = $this->lastname;
- $user_data["title"] = $this->title;
- $user_data["gender"] = $this->gender;
- $user_data["email"] = $this->email;
- $user_data["street"] = $this->street;
- $user_data["phone_home"] = $this->phone_home;
- $user_data["time_limit_unlimited"] = 1;
- $user_data["active"] = 1;
- $user_data["approve_date"] = date('Y-m-d H:i:s');
- $user_data["accepted_agreement"] = true;
-
- if ($connected_cms[$this->cms_type]->user_style != "")
- $user_data["user_style"] = $connected_cms[$this->cms_type]->user_style;
- if ($connected_cms[$this->cms_type]->user_skin != "")
- $user_data["user_skin"] = $connected_cms[$this->cms_type]->user_skin;
-
- $role_id = $connected_cms[$this->cms_type]->roles[$auth->auth["perm"]];
-
- $user_id = $connected_cms[$this->cms_type]->soap_client->addUser($user_data, $role_id);
-
- if ($user_id != false)
- {
- $this->id = $user_id;
-
-// $connected_cms[$this->cms_type]->soap_client->updatePassword($user_id, $user_data["passwd"]);
-
-// $this->newUserCategory();
-
- $this->setConnection(USER_TYPE_CREATED, $ignore_encrypt_passwords);
- return true;
- }
- echo $connected_cms[$this->cms_type]->soap_client->getError();
- return false;
- }
-
- /**
- * update user-account
- */
- public function updateUser()
- {
- }
-
- /**
- * delete user
- *
- * delete user-account
- * @access public
- * @return boolean returns false on error
- */
- function deleteUser()
- {
- global $connected_cms;
- $ret = null;
- $connected_cms[$this->cms_type]->soap_client->user_type == "admin";
- $connected_cms[$this->cms_type]->soap_client->caching_active = false;
- if($this->category){
- $ret['cat_deleted'] = $connected_cms[$this->cms_type]->soap_client->deleteObject($this->category);
- }
- if($this->type == 0 && $this->id){
- $ret['iliasuser_deleted'] = $connected_cms[$this->cms_type]->soap_client->deleteUser($this->id);
- }
- $query = "DELETE FROM auth_extern WHERE studip_user_id = ? LIMIT 1";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$this->studip_id]);
-
- $ret['auth_extern_deleted'] = $statement->rowCount();
- return $ret;
- }
-
- /**
- * set connection
- *
- * set user connection
- * @access public
- * @param string user_type user-type
- */
- public function setConnection($user_type, $ignore_encrypt_passwords = false)
- {
- global $connected_cms;
-
- if (!$ignore_encrypt_passwords && $connected_cms[$this->cms_type]->encrypt_passwords === "md5")
- {
-// echo "PASSWORD-ENCRYPTION";
- $this->external_password = $this->getCryptedPassword( $this->external_password );
- }
-
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
- parent::setConnection($user_type);
- }
-
- /**
- * get sid
- *
- * returns soap-sid
- * @access public
- * @return string soap-sid
- */
- function getSID()
- {
- global $connected_cms;
-
- $caching_status = $connected_cms[$this->cms_type]->soap_client->getCachingStatus();
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
-
- $connected_cms[$this->cms_type]->soap_client->setUserType("user");
- $this->user_sid = $connected_cms[$this->cms_type]->soap_client->login();
-
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus($caching_status);
- $connected_cms[$this->cms_type]->soap_client->setUserType("admin");
- return $this->user_sid;
- }
-
- /**
- * get session-id
- *
- * returns soap-session-id
- * @access public
- * @return string soap-session-id
- */
- function getSessionId()
- {
- $sid = $this->getSID();
- if ($sid == false)
- return false;
- $arr = explode("::", $sid);
- return $arr[0];
- }
-}
-?>
diff --git a/lib/elearning/Ilias3ContentModule.php b/lib/elearning/Ilias3ContentModule.php
deleted file mode 100644
index 3067575..0000000
--- a/lib/elearning/Ilias3ContentModule.php
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
-* class to handle ILIAS 3 learning modules and tests
-*
-* This class contains methods to handle ILIAS 3 learning modules and tests.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module Ilias3ContentModule
-* @package ELearning-Interface
-*/
-class Ilias3ContentModule extends ContentModule
-{
- var $object_id;
-
- /**
- * constructor
- *
- * init class.
- * @access public
- * @param string $module_id module-id
- * @param string $module_type module-type
- * @param string $cms_type system-type
- */
- function __construct($module_id, $module_type, $cms_type)
- {
- parent::__construct($module_id, $module_type, $cms_type);
- if ($module_id != "")
- $this->readData();
- }
-
- /**
- * read data
- *
- * get module data from database.
- * @access public
- */
- function readData()
- {
- global $connected_cms;
-
- $object_data = $connected_cms[$this->cms_type]->soap_client->getObjectByReference($this->id, $connected_cms[$this->cms_type]->user->getId());
- if ( (! ($object_data == false)) AND ($connected_cms[$this->cms_type]->types[$object_data["type"]] != "") )
- {
- // If User has no external Account, show module and link to user-assignment
- if (! $connected_cms[$this->cms_type]->user->isConnected())
- $this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ] );
-
- //set module data
- $this->setObjectId($object_data["obj_id"]);
- $this->setTitle($object_data["title"]);
- $this->setDescription($object_data["description"]);
- if ($object_data["owner"] != "")
- {
- $user_data = $connected_cms[$this->cms_type]->soap_client->getUser($object_data["owner"]);
- $user_name = trim($user_data["title"] . " " . $user_data["firstname"] . " " . $user_data["lastname"]);
- $this->setAuthors($user_name);
- }
- $this->setPermissions($object_data["accessInfo"], $object_data["operations"]);
- }
- else
- {
- // If module doesn't exist, show errormessage
- $this->createDummyForErrormessage("not found");
- $this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ, OPERATION_DELETE] );
- }
- }
-
- /**
- * set permissions
- *
- * sets permissions for content-module
- * @access public
- * @param string $acces_info access-status
- * @param array $operations array of operations
- * @return boolean successful
- */
- function setPermissions($access_info, $operations)
- {
- global $connected_cms;
-
- switch ($access_info) {
- case "granted":
- $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("<i>" . _("Sie haben keine Leseberechtigung für dieses Modul.") . "</i>");
- return false;
- case "missing_precondition":
- $this->allowed_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray($operations );
- $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("<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("<i>" . _("Sie haben keinen Zugriff auf die übergeordneten Objekte dieses Moduls.") . "</i>");
- return false;
- case "object_deleted":
- $this->createDummyForErrormessage("deleted");
- return false;
- }
- 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) && !$this->isDummy() && $connected_cms[$this->cms_type]->user->isConnected()) {
- $this->createDummyForErrormessage("no permission");
- }
- }
-
- return true;
- }
-
- /**
- * set connection
- *
- * sets connection with seminar
- * @access public
- * @param string $seminar_id seminar-id
- * @return boolean successful
- */
- function setConnection($seminar_id)
- {
- global $connected_cms, $messages;
-
- $write_permission = Request::option("write_permission");
- $write_permission_autor = Request::option("write_permission_autor");
-
- $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type);
-// echo "SET?".$this->cms_type;
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
- $connected_cms[$this->cms_type]->soap_client->clearCache();
-
- // Check, ob Kurs in ILIAS gelöscht wurde
- if (($crs_id != false) AND ($connected_cms[$this->cms_type]->soap_client->getObjectByReference($crs_id) == false))
- {
- ObjectConnections::unsetConnection($seminar_id, $crs_id, "crs", $this->cms_type);
-// echo "deleted: ".ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type);
-// echo "Der zugeordnete ILIAS-Kurs (ID $crs_id) existiert nicht mehr. Ein neuer Kurs wird angelegt.";
- $messages["info"] .= _("Der zugeordnete ILIAS-Kurs (ID $crs_id) existiert nicht mehr. Ein neuer Kurs wird angelegt.") . "<br>";
- $crs_id = false;
- }
-
- if ($crs_id == false)
- {
-
- $lang_array = explode("_",Config::get()->DEFAULT_LANGUAGE);
- $course_data["language"] = $lang_array[0];
- $course_data["title"] = "Stud.IP-Kurs " . Context::get()->Name;
- $course_data["description"] = "";
- $ref_id = $connected_cms[$this->cms_type]->main_category_node_id;
- $crs_id = $connected_cms[$this->cms_type]->soap_client->addCourse($course_data, $ref_id);
-
- if ($crs_id == false)
- {
- $messages["error"] .= _("Zuordnungs-Fehler: Kurs konnte nicht angelegt werden.");
- return false;
- }
- ObjectConnections::setConnection($seminar_id, $crs_id, "crs", $this->cms_type);
-
- // Rollen zuordnen
- $connected_cms[$this->cms_type]->permissions->CheckUserPermissions($crs_id);
-// $messages["info"] .= "Neue Kurs-ID: $crs_id. <br>";
- }
-
-
- $ref_id = $this->getId();
- $ref_id = $connected_cms[$this->cms_type]->soap_client->addReference($this->id, $crs_id);
- $local_roles = $connected_cms[$this->cms_type]->soap_client->getLocalRoles($crs_id);
- $member_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ]);
- $admin_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE]);
- 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"], "il_crs_") === 0) {
- if(mb_strpos($role_data["title"], 'il_crs_member') === 0){
- $operations = $write_permission_autor ? $admin_operations : $member_operations;
- } else if(mb_strpos($role_data["title"], 'il_crs_tutor') === 0){
- $operations = $write_permission_autor || $write_permission ? $admin_operations : $member_operations;
- } else {
- continue;
- }
- $connected_cms[$this->cms_type]->soap_client->revokePermissions($role_data["obj_id"], $ref_id);
- $connected_cms[$this->cms_type]->soap_client->grantPermissions($operations, $role_data["obj_id"], $ref_id);
- }
- }
- if ($ref_id)
- {
- $this->setId($ref_id);
- return parent::setConnection($seminar_id);
- }
- else
- $messages["error"] .= _("Die Zuordnung konnte nicht gespeichert werden.");
- return false;
- }
-
- /**
- * unset connection
- *
- * unsets connection with seminar
- * @access public
- * @param string $seminar_id seminar-id
- * @return boolean successful
- */
- function unsetConnection($seminar_id)
- {
- global $connected_cms, $messages;
-
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
- {
- if ( $this->getObjectId() != false)
- $connected_cms[$this->cms_type]->soap_client->deleteObject($this->getId());
- return parent::unsetConnection($seminar_id);
- }
- $messages["error"] .= _("Die Zuordnung konnte nicht entfernt werden.");
- return false;
- }
-
- /**
- * set object id
- *
- * sets object id
- * @access public
- * @param string $module_object_id object id
- */
- function setObjectId($module_object_id)
- {
- $this->object_id = $module_object_id;
- }
-
- /**
- * get object id
- *
- * returns object id
- * @access public
- * @return string object id
- */
- function getObjectId()
- {
- return $this->object_id;
- }
-
- /**
- * set allowed operations
- *
- * sets allowed operations
- * @access public
- * @param array $operation_array operation-ids
- */
- function setAllowedOperations( $operation_array )
- {
- global $connected_cms;
-
- $this->allowed_operations = [];
- foreach($operation_array as $key => $operation)
- {
-// echo "O$operation = I".$connected_cms[$this->cms_type]->permissions->getOperation[$operation]."<br>";
- $this->allowed_operations[] = $connected_cms[$this->cms_type]->permissions->getOperation[$operation];
- }
- }
-
- /**
- * get permission-status
- *
- * returns true, if operation is allowed
- * @access public
- * @param string $operation operation
- * @return boolean allowed
- */
- function isAllowed($operation)
- {
- global $connected_cms;
-
- if (is_array($this->allowed_operations))
- {
- if (in_array($connected_cms[$this->cms_type]->permissions->getOperation($operation), $this->allowed_operations))
- return true;
- else
- return false;
- }
- else
- return false;
- }
-}
-?>
diff --git a/lib/elearning/Ilias3ObjectXMLParser.php b/lib/elearning/Ilias3ObjectXMLParser.php
deleted file mode 100644
index 172ca2a..0000000
--- a/lib/elearning/Ilias3ObjectXMLParser.php
+++ /dev/null
@@ -1,236 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/*
- +-----------------------------------------------------------------------------+
- | ILIAS open source |
- +-----------------------------------------------------------------------------+
- | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
- | |
- | 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. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
- +-----------------------------------------------------------------------------+
-*/
-
-
-/**
-* Object XML Parser
-*
-* @author Stefan Meyer <smeyer@databay.de>
-*
-* @extends ilSaxParser
-* @package common
-*/
-
-class Ilias3ObjectXMLParser extends Ilias3SaxParser
-{
- var $object_data = [];
- var $curr_obj;
- var $reference_count;
- var $cdata = '';
-
- /**
- * Constructor
- *
- * @param object $a_content_object must be of type ilObjContentObject
- * ilObjTest or ilObjQuestionPool
- * @param string $a_xml_file xml data
- * @param string $a_subdir subdirectory in import directory
- *
- * @access public
- */
- function __construct($a_xml_data = '')
- {
- parent::__construct();
- $this->setXMLContent($a_xml_data);
- }
-
- function getObjectData()
- {
- return $this->object_data ? $this->object_data : [];
- }
-
- /**
- * set event handlers
- *
- * @param resource reference to the xml parser
- *
- * @access private
- */
- function setHandlers($a_xml_parser)
- {
- xml_set_object($a_xml_parser, $this);
- xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
- xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
- }
-
-
- /**
- * handler for begin of element
- *
- * @param resource $a_xml_parser xml parser
- * @param string $a_name element name
- * @param array $a_attribs element attributes array
- */
- function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
- {
-
- switch ($a_name) {
- case 'Objects':
- $this->curr_obj = -1;
- break;
-
- case 'Object':
- ++$this->curr_obj;
- $this->reference_count = -1;
-
- $this->addProperty__('type', $a_attribs['type']);
- $this->addProperty__('obj_id', $a_attribs['obj_id']);
- break;
-
- case 'Title':
- break;
-
- case 'Description':
- break;
-
- case 'Owner':
- break;
-
- case 'CreateDate':
- break;
-
- case 'LastUpdate':
- break;
-
- case 'ImportId':
- break;
-
- case 'References':
- ++$this->reference_count;
- $this->addReference__($a_attribs['ref_id'], $a_attribs['accessInfo']);
- break;
-
- case 'Operation':
- break;
- }
- }
-
-
- /**
- * handler for end of element
- *
- * @param resource $a_xml_parser xml parser
- * @param string $a_name element name
- */
- function handlerEndTag($a_xml_parser, $a_name)
- {
- switch ($a_name) {
- case 'Objects':
- break;
-
- case 'Object':
- break;
-
- case 'Title':
- $this->addProperty__('title', trim($this->cdata));
- break;
-
- case 'Description':
- $this->addProperty__('description', trim($this->cdata));
- break;
-
- case 'Owner':
- $this->addProperty__('owner', trim($this->cdata));
- break;
-
- case 'CreateDate':
- $this->addProperty__('create_date', trim($this->cdata));
- break;
-
- case 'LastUpdate':
- $this->addProperty__('last_update', trim($this->cdata));
- break;
-
- case 'ImportId':
- $this->addProperty__('import_id', trim($this->cdata));
- break;
-
- case 'References':
- $this->addReference__(trim($this->cdata));
- break;
-
- case 'Operation':
- $this->addOperation__(trim($this->cdata));
- break;
- }
-
- $this->cdata = '';
-
- return;
- }
-
- /**
- * handler for character data
- *
- * @param resource $a_xml_parser xml parser
- * @param string $a_data character data
- */
- function handlerCharacterData($a_xml_parser, $a_data)
- {
- if ($a_data != "\n") {
- // Replace multiple tabs with one space
- $a_data = preg_replace("/\t+/", " ", $a_data);
-
- $this->cdata .= $a_data;
- }
-
-
- }
-
- // PRIVATE
- function addProperty__($a_name, $a_value)
- {
- $this->object_data[$this->curr_obj][$a_name] = $a_value;
- /*/
- if (is_array($this->object_data[$this->curr_obj][$a_name]))
- $this->object_data[$this->curr_obj][$a_name][] = $a_value;
- elseif ($this->object_data[$this->curr_obj][$a_name] != "")
- {
- $old_value = $this->object_data[$this->curr_obj][$a_name];
- $this->object_data[$this->curr_obj][$a_name] = array($old_value);
- $this->object_data[$this->curr_obj][$a_name][] = $a_value;
- }
- else
- $this->object_data[$this->curr_obj][$a_name] = $a_value;
- /**/
- }
-
- function addReference__($a_value, $a_accessinfo = "")
- {
- if ($a_value) {
- $this->object_data[$this->curr_obj]['references'][$this->reference_count]["ref_id"] = $a_value;
- $this->object_data[$this->curr_obj]['references'][$this->reference_count]["accessInfo"] = $a_accessinfo;
- }
- }
-
- function addOperation__($a_value)
- {
- if ($a_value) {
- $this->object_data[$this->curr_obj]['references'][$this->reference_count]["operations"][] = $a_value;
- }
- }
-}
diff --git a/lib/elearning/Ilias3SaxParser.php b/lib/elearning/Ilias3SaxParser.php
deleted file mode 100644
index 92d247d..0000000
--- a/lib/elearning/Ilias3SaxParser.php
+++ /dev/null
@@ -1,230 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-/*
- +-----------------------------------------------------------------------------+
- | ILIAS open source |
- +-----------------------------------------------------------------------------+
- | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
- | |
- | 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. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
- +-----------------------------------------------------------------------------+
-*/
-
-
-/**
-* Base class for sax-based expat parsing
-* extended classes need to overwrite the method setHandlers and implement their own handler methods
-*
-*
-* @author Stefan Meyer <smeyer@databay>
-*
-* @package ilias-core
-*/
-class Ilias3SaxParser
-{
- /**
- * XML-Content type 'file' or 'string'
- * If you choose file set the filename in constructor
- * If you choose 'String' call the constructor with no argument and use setXMLContent()
- * @var string
- * @access private
- */
- var $input_type = null;
-
- /**
- * XML-Content in case of content type 'string'
-
- * @var string
- * @access private
- */
- var $xml_content = '';
-
- /**
- * ilias object
- * @var object ilias
- * @access private
- */
- var $ilias;
-
- /**
- * language object
- * @var object language
- * @access private
- */
- var $lng;
-
- /**
- * xml filename
- * @var filename
- * @access private
- */
- var $xml_file;
-
- /**
- * Constructor
- * setup ILIAS global object
- * @access public
- */
- function __construct($a_xml_file = '')
- {
- global $ilias, $lng;
-
- if($a_xml_file)
- {
- $this->xml_file = $a_xml_file;
- $this->input_type = 'file';
- }
-
- $this->ilias = &$ilias;
- $this->lng = &$lng;
- }
-
- function setXMLContent($a_xml_content)
- {
- $this->xml_content = $a_xml_content;
- $this->input_type = 'string';
- }
-
- function getXMLContent()
- {
- return $this->xml_content;
- }
-
- function getInputType()
- {
- return $this->input_type;
- }
-
- /**
- * stores xml data in array
- *
- * @access private
- */
- function startParsing()
- {
- $xml_parser = $this->createParser();
- $this->setOptions($xml_parser);
- $this->setHandlers($xml_parser);
-
- switch($this->getInputType())
- {
- case 'file':
- $fp = $this->openXMLFile();
- $this->parse($xml_parser,$fp);
- break;
-
- case 'string':
- $this->parse($xml_parser);
- break;
-
- default:
- echo "No input type given. Set filename in constructor or choose setXMLContent()";
- break;
- }
- $this->freeParser($xml_parser);
- }
- /**
- * create parser
- *
- * @access private
- */
- function createParser()
- {
- $xml_parser = xml_parser_create("UTF-8");
-
- if($xml_parser == false)
- {
- echo "Cannot create an XML parser handle";
- }
- return $xml_parser;
- }
- /**
- * set parser options
- *
- * @access private
- */
- function setOptions($a_xml_parser)
- {
- xml_parser_set_option($a_xml_parser,XML_OPTION_CASE_FOLDING,false);
- }
- /**
- * set event handler
- * should be overwritten by inherited class
- * @access private
- */
- function setHandlers($a_xml_parser)
- {
- echo 'ilSaxParser::setHandlers() must be overwritten';
- }
- /**
- * open xml file
- *
- * @access private
- */
- function openXMLFile()
- {
- if(!($fp = fopen($this->xml_file,'r')))
- {
- echo "Cannot open xml file";
- }
- return $fp;
- }
- /**
- * parse xml file
- *
- * @access private
- */
- function parse($a_xml_parser,$a_fp = null)
- {
- switch($this->getInputType())
- {
- case 'file':
-
- while($data = fread($a_fp,4096))
- {
- $parseOk = xml_parse($a_xml_parser,$data,feof($a_fp));
- }
- break;
-
- case 'string':
- $parseOk = xml_parse($a_xml_parser,$this->getXMLContent());
- break;
- }
- if(!$parseOk
- && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
- {
- echo $this->getXMLContent();
- echo "XML Parse Error: ".xml_get_error_code($a_xml_parser);
- }
- return true;
-
- }
- /**
- * free xml parser handle
- *
- * @access private
- */
- function freeParser($a_xml_parser)
- {
- if(!xml_parser_free($a_xml_parser))
- {
- echo "Error freeing xml parser handle ";
- }
- }
-}
-?>
diff --git a/lib/elearning/Ilias3Soap.php b/lib/elearning/Ilias3Soap.php
deleted file mode 100644
index 4fc5a65..0000000
--- a/lib/elearning/Ilias3Soap.php
+++ /dev/null
@@ -1,1069 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
-* class to use ILIAS-3-Webservices
-*
-* This class contains methods to connect to the ILIAS-3-Soap-Server.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module Ilias3Soap
-* @package ELearning-Interface
-*/
-class Ilias3Soap extends StudipSoapClient
-{
- var $cms_type;
- var $admin_sid;
- var $user_sid;
- var $user_type;
- var $soap_cache;
- var $caching_active = false;
-
- /**
- * constructor
- *
- * init class.
- * @access
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- global $ELEARNING_INTERFACE_MODULES, $connected_cms;
- $this->cms_type = $cms;
-
- parent::__construct($ELEARNING_INTERFACE_MODULES[$cms]["ABSOLUTE_PATH_SOAP"]);
- $this->user_type = "admin";
-
- $this->loadCacheData($cms);
- }
-
-
-
- /**
- * set usertype
- *
- * sets usertype fpr soap-calls
- * @access public
- * @param string user_type usertype (admin or user)
- */
- function setUserType($user_type)
- {
- $this->user_type = $user_type;
- }
-
- /**
- * get sid
- *
- * returns soap-session-id
- * @access public
- * @return string session-id
- */
- function getSID()
- {
- if ($this->user_type == "admin")
- {
- if ($this->admin_sid == false)
- $this->login();
-// echo "a";
- return $this->admin_sid;
- }
- if ($this->user_type == "user")
- {
- if ($this->user_sid == false)
- $this->login();
-// echo "u";
- return $this->user_sid;
- }
- return false;
- }
-
- /**
- * call soap-function
- *
- * calls soap-function with given parameters
- * @access public
- * @param string method method-name
- * @param string params parameters
- * @return mixed result
- */
- function call($method, $params)
- {
- $index = md5($method . ":" . implode('-', $params));
- // return false if no session_id is given
- if (($method != "login") AND ($params["sid"] == ""))
- return false;
-// echo $this->caching_active;
- if (($this->caching_active == true) AND (isset($this->soap_cache[$index])))
- {
-// echo $index;
-// echo " from Cache<br>";
- $result = $this->soap_cache[$index];
- }
- else
- {
- $result = $this->_call($method, $params);
- // if Session is expired, re-login and try again
- if (($method != "login") AND $this->soap_client->fault AND in_array(mb_strtolower($this->faultstring), ["session not valid","session invalid", "session idled"]) )
- {
-// echo "LOGIN AGAIN.";
- $caching_status = $this->caching_active;
- $this->caching_active = false;
- $params["sid"] = $this->login();
- $result = $this->_call($method, $params);
- $this->caching_active = $caching_status;
- }
- elseif (! $this->soap_client->fault)
- $this->soap_cache[$index] = $result;
- }
- return $result;
- }
-
- /**
- * load cache
- *
- * load soap-cache
- * @access public
- * @param string cms cms-type
- */
- function loadCacheData($cms)
- {
- $this->soap_cache = (array)$_SESSION["cache_data"][$cms];
- }
-
- /**
- * get caching status
- *
- * gets caching-status
- * @access public
- * @return boolean status
- */
- function getCachingStatus()
- {
- return $this->caching_active;
- }
-
- /**
- * set caching status
- *
- * sets caching-status
- * @access public
- * @param boolean bool_value status
- */
- function setCachingStatus($bool_value)
- {
- $this->caching_active = $bool_value;
-// echo "SET:".$this->caching_active."<br>";
- }
-
- /**
- * clear cache
- *
- * clears cache
- * @access public
- */
- function clearCache()
- {
- $this->soap_cache = [];
- $_SESSION["cache_data"][$this->cms_type] = [];
-
- }
-
- /**
- * save cache
- *
- * saves soap-cache in session-variable
- * @access public
- */
- function saveCacheData()
- {
- $_SESSION["cache_data"][$this->cms_type] = $this->soap_cache;
-
- }
-
- /**
- * parse xml
- *
- * use xml-parser
- * @access public
- * @param string data xml-data
- * @return array object
- */
- function ParseXML($data)
- {
- $xml_parser = new Ilias3ObjectXMLParser($data);
- $xml_parser->startParsing();
- return $xml_parser->getObjectData();
- }
-
- /**
- * login
- *
- * login to soap-webservice
- * @access public
- * @return string result
- */
- function login()
- {
- global $ELEARNING_INTERFACE_MODULES, $connected_cms;
- if ($this->user_type == "admin")
- $param = [
- 'client' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["client"],
- 'username' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["username"],
- 'password' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["password"]
- ];
- elseif ($this->user_type == "user")
- $param = [
- 'client' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["client"],
- 'username' => $connected_cms[$this->cms_type]->user->getUsername(),
- 'password' => $connected_cms[$this->cms_type]->user->getPassword()
- ];
- $result = $this->call('login', $param);
- if ($this->user_type == "admin")
- $this->admin_sid = $result;
- if ($this->user_type == "user")
- $this->user_sid = $result;
-// if ($this->user_type == "user") echo "SID".$this->call('login', $param).$param["username"];
- return $result;
- }
-
- /**
- * logout
- *
- * logout from soap-webservice
- * @access public
- * @return boolean result
- */
- function logout()
- {
- $param = [
- 'sid' => $this->getSID()
- ];
- return $this->call('logout', $param);
- }
-
-
-///////////////////////////
-// OBJECT-FUNCTIONS //
-//////////////////////////
-
- /**
- * search objects
- *
- * search for ilias-objects
- * @access public
- * @param array types types
- * @param string key keyword
- * @param string combination search-combination
- * @param string user_id ilias-user-id
- * @return array objects
- */
- function searchObjects($types, $key, $combination, $user_id = "")
- {
- $param = [
- 'sid' => $this->getSID(),
- 'types' => $types,
- 'key' => $key,
- 'combination' => $combination
- ];
- if ($user_id != "")
- $param["user_id"] = $user_id;
- $result = $this->call('searchObjects', $param);
- if ($result != false)
- {
- $objects = $this->parseXML($result);
- $all_objects = [];
- foreach($objects as $count => $object_data){
- if (is_array($object_data["references"]))
- {
- foreach($object_data["references"] as $ref_data)
- if ($ref_data["accessInfo"] == "granted"
- && (count($all_objects[$object_data["obj_id"]]["operations"]) < count($ref_data["operations"])))
- {
- $all_objects[$object_data["obj_id"]] = $object_data;
- unset($all_objects[$object_data["obj_id"]]["references"]);
- $all_objects[$object_data["obj_id"]]["ref_id"] = $ref_data["ref_id"];
- $all_objects[$object_data["obj_id"]]["accessInfo"] = $ref_data["accessInfo"];
- $all_objects[$object_data["obj_id"]]["operations"] = $ref_data["operations"];
- }
- }
- }
- if (count($all_objects)){
- foreach($all_objects as $one_object){
- $ret[$one_object['ref_id']] = $one_object;
- }
- return $ret;
- }
- }
- return false;
-
- }
-
- /**
- * get object by reference
- *
- * gets object by reference-id
- * @access public
- * @param ref reference_id
- * @param string user_id ilias-user-id
- * @return array object
- */
- function getObjectByReference($ref, $user_id = "")
- {
- $param = [
- 'sid' => $this->getSID(),
- 'reference_id' => $ref
- ];
- if ($user_id != "")
- $param["user_id"] = $user_id;
- $result = $this->call('getObjectByReference', $param);
- if ($result != false)
- {
-
- $objects = $this->parseXML($result);
- foreach($objects as $count => $object_data)
- if (is_array($object_data["references"]))
- {
- foreach($object_data["references"] as $ref_data)
- if ($ref_data["accessInfo"] != "object_deleted" && $ref == $ref_data["ref_id"])
- {
- $all_objects[$ref_data["ref_id"]] = $object_data;
- unset($all_objects[$ref_data["ref_id"]]["references"]);
- $all_objects[$ref_data["ref_id"]]["ref_id"] = $ref_data["ref_id"];
- $all_objects[$ref_data["ref_id"]]["accessInfo"] = $ref_data["accessInfo"];
- $all_objects[$ref_data["ref_id"]]["operations"] = $ref_data["operations"];
- }
- }
- return $all_objects[$ref];
- }
- return false;
- }
-
- /**
- * get object by title
- *
- * gets object by title
- * @access public
- * @param string key keyword
- * @param string type object-type
- * @return array object
- */
- function getObjectByTitle($key, $type = "")
- {
- $param = [
- 'sid' => $this->getSID(),
- 'title' => $key
- ];
- $result = $this->call('getObjectsByTitle', $param);
- if ($result != false)
- {
- $objects = $this->parseXML($result);
- foreach($objects as $index => $object_data)
- {
- if (($type != "") AND ($object_data["type"] != $type))
- unset($objects[$index]);
- elseif (! (mb_strpos(mb_strtolower($object_data["title"]), mb_strtolower(trim($key)) ) === 0))
- unset($objects[$index]);
- }
- reset($objects);
- if (sizeof($objects) > 0)
- return current($objects);
- }
- return false;
- }
-
- /**
- * get reference by title
- *
- * gets reference-id by object-title
- * @access public
- * @param string key keyword
- * @param string type object-type
- * @return string reference-id
- */
- function getReferenceByTitle($key, $type = "")
- {
- $param = [
- 'sid' => $this->getSID(),
- 'title' => $key
- ];
- $result = $this->call('getObjectsByTitle', $param);
- if ($result != false)
- {
- $objects = $this->parseXML($result);
- foreach($objects as $index => $object_data)
- {
- if (($type != "") AND ($object_data["type"] != $type))
- unset($objects[$index]);
- elseif (mb_strpos(mb_strtolower($object_data["title"]), mb_strtolower(trim($key)) ) === false)
- unset($objects[$index]);
- }
- if (sizeof($objects) > 0)
- foreach($objects as $object_data)
- if (sizeof($object_data["references"]) > 0)
- {
- return $object_data["references"][0]["ref_id"];
- }
- }
- return false;
- }
-
- /**
- * add object
- *
- * adds new ilias-object
- * @access public
- * @param array object_data object-data
- * @param string ref_id reference-id
- * @return string result
- */
- function addObject($object_data, $ref_id)
- {
- $type = $object_data["type"];
- $title = htmlReady($object_data["title"]);
- $description = htmlReady($object_data["description"]);
-
- $xml = "<!DOCTYPE Objects SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_object_0_1.dtd\">
-<Objects>
- <Object type=\"$type\">
- <Title>
- $title
- </Title>
- <Description>
- $description
- </Description>
- </Object>
-</Objects>";
-
- $param = [
- 'sid' => $this->getSID(),
- 'target_id' => $ref_id,
- 'object_xml' => $xml
- ];
- return $this->call('addObject', $param);
- }
-
- /**
- * delete object
- *
- * deletes ilias-object
- * @access public
- * @param string ref_id reference-id
- * @return boolean result
- */
- function deleteObject($reference_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'reference_id' => $reference_id
- ];
- return $this->call('deleteObject', $param);
- }
-
- /**
- * add reference
- *
- * add a new reference to an existing ilias-object
- * @access public
- * @param string object_id source-object-id
- * @param string ref_id target-id
- * @return string created reference-id
- */
- function addReference($object_id, $ref_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'source_id' => $object_id,
- 'target_id' => $ref_id
- ];
- return $this->call('addReference', $param);
- }
-
- /**
- * get tree childs
- *
- * gets child-objects of the given tree node
- * @access public
- * @param string ref_id reference-id
- * @param array types show only childs with these types
- * @param string user_id user-id for permissions
- * @return array objects
- */
- function getTreeChilds($ref_id, $types = "", $user_id = "")
- {
- if ($types == "")
- $types = [];
- $param = [
- 'sid' => $this->getSID(),
- 'ref_id' => $ref_id,
- 'types' => $types
- ];
- if ($user_id != "")
- $param["user_id"] = $user_id;
- $result = $this->call('getTreeChilds', $param);
- if ($result != false)
- {
-
- $objects = $this->parseXML($result);
- foreach($objects as $count => $object_data)
- if (is_array($object_data["references"]))
- foreach($object_data["references"] as $ref_data)
- if ($ref_data["accessInfo"] != "object_deleted")
- {
- $all_objects[$ref_data["ref_id"]] = $object_data;
-// unset($all_objects[$ref_id]["references"]);
- $all_objects[$ref_data["ref_id"]]["ref_id"] = $ref_data["ref_id"];
- $all_objects[$ref_data["ref_id"]]["accessInfo"] = $ref_data["accessInfo"];
- $all_objects[$ref_data["ref_id"]]["operations"] = $ref_data["operations"];
- }
- if (sizeof($all_objects) > 0) {
- return $all_objects;
- } else {
- return [];
- }
- }
- return false;
- }
-
-/////////////////////////
-// RBAC-FUNCTIONS //
-///////////////////////
- /**
- * get operation
- *
- * gets all ilias operations
- * @access public
- * @return array operations
- */
- function getOperations()
- {
- $param = [
- 'sid' => $this->getSID()
- ];
- $result = $this->call('getOperations', $param);
- if (is_array($result))
- foreach ($result as $operation_set)
- $operations[$operation_set["operation"]] = $operation_set["ops_id"];
- return $operations;
- }
-
- /**
- * get object tree operations
- *
- * gets permissions for object at given tree-node
- * @access public
- * @param string ref_id reference-id
- * @param string user_id user-id for permissions
- * @return array operation-ids
- */
- function getObjectTreeOperations($ref_id, $user_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'ref_id' => $ref_id,
- 'user_id' => $user_id
- ];
- $result = $this->call('getObjectTreeOperations', $param);
- if ($result != false)
- {
- $ops_ids = [];
- foreach ($result as $operation_set)
- $ops_ids[] = $operation_set["ops_id"];
- return $ops_ids;
- }
- return false;
- }
-
- /**
- * get user roles
- *
- * gets user roles
- * @access public
- * @param string user_id user-id
- * @return array role-ids
- */
- function getUserRoles($user_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_id' => $user_id
- ];
- $result = $this->call('getUserRoles', $param);
- if ($result != false)
- {
- $objects = $this->parseXML($result);
- $roles = [];
- foreach ($objects as $count => $role) {
- $roles[$count] = $role["obj_id"];
- }
- return $roles;
- }
- return false;
- }
-
- /**
- * get local roles
- *
- * gets local roles for given object
- * @access public
- * @param string course_id object-id
- * @return array role-objects
- */
- function getLocalRoles($course_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'ref_id' => $course_id
- ];
- $result = $this->call('getLocalRoles', $param);
- if ($result != false)
- {
- $objects = $this->parseXML($result);
- return $objects;
- }
- return false;
- }
-
- /**
- * add role
- *
- * adds a new role
- * @access public
- * @param array role_data data for role-object
- * @param string ref_id reference-id
- * @return string role-id
- */
- function addRole($role_data, $ref_id)
- {
- $type = "role";
- $title = htmlReady($role_data["title"]);
- $description = htmlReady($role_data["description"]);
-
- $xml = "<!DOCTYPE Objects SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_object_0_1.dtd\">
-<Objects>
- <Object type=\"$type\">
- <Title>
- $title
- </Title>
- <Description>
- $description
- </Description>
- </Object>
-</Objects>";
-
- $param = [
- 'sid' => $this->getSID(),
- 'target_id' => $ref_id,
- 'obj_xml' => $xml
- ];
- $result = $this->call('addRole', $param);
- if (is_array($result))
- return current($result);
- else
- return false;
- }
-
- /**
- * add role from tremplate
- *
- * adds a new role and adopts properties of the given role template
- * @access public
- * @param array role_data data for role-object
- * @param string ref_id reference-id
- * @param string role_id role-template-id
- * @return string role-id
- */
- function addRoleFromTemplate($role_data, $ref_id, $role_id)
- {
- $type = "role";
- $title = htmlReady($role_data["title"]);
- $description = htmlReady($role_data["description"]);
-
- $xml = "<!DOCTYPE Objects SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_object_0_1.dtd\">
-<Objects>
- <Object type=\"$type\">
- <Title>
- $title
- </Title>
- <Description>
- $description
- </Description>
- </Object>
-</Objects>";
-
- $param = [
- 'sid' => $this->getSID(),
- 'target_id' => $ref_id,
- 'obj_xml' => $xml,
- 'role_template_id' => $role_id
- ];
- $result = $this->call('addRoleFromTemplate', $param);
- if (is_array($result))
- return current($result);
- else
- return false;
- }
-
- /**
- * delete user role entry
- *
- * deletes a role entry from the given user
- * @access public
- * @param string user_id user-id
- * @param string role_id role-id
- * @return boolean result
- */
- function deleteUserRoleEntry($user_id, $role_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_id' => $user_id,
- 'role_id' => $role_id
- ];
- return $this->call('deleteUserRoleEntry', $param);
- }
-
- /**
- * add user role entry
- *
- * adds a role entry for the given user
- * @access public
- * @param string user_id user-id
- * @param string role_id role-id
- * @return boolean result
- */
- function addUserRoleEntry($user_id, $role_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_id' => $user_id,
- 'role_id' => $role_id
- ];
- return $this->call('addUserRoleEntry', $param);
- }
-
- /**
- * grant permissions
- *
- * grants permissions for given operations at role-id and ref-id
- * @access public
- * @param array operations operation-array
- * @param string role_id role-id
- * @param string ref_id reference-id
- * @return boolean result
- */
- function grantPermissions($operations, $role_id, $ref_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'ref_id' => $ref_id,
- 'role_id' => $role_id,
- 'operations' => $operations,
- ];
- return $this->call('grantPermissions', $param);
- }
-
- /**
- * revoke permissions
- *
- * revokes all permissions role-id and ref-id
- * @access public
- * @param string role_id role-id
- * @param string ref_id reference-id
- * @return boolean result
- */
- function revokePermissions($role_id, $ref_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'ref_id' => $ref_id,
- 'role_id' => $role_id,
- ];
- return $this->call('revokePermissions', $param);
- }
-
-/////////////////////////
-// USER-FUNCTIONS //
-///////////////////////
-
- /**
- * lookup user
- *
- * gets user-id for given username
- * @access public
- * @param string username username
- * @return string user-id
- */
- function lookupUser($username)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_name' => $username,
- ];
- return $this->call('lookupUser', $param); // returns user_id
- }
-
- /**
- * get user
- *
- * gets user-data for given user-id
- * @access public
- * @param string user_id user-id
- * @return array user-data
- */
- function getUser($user_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_id' => $user_id,
- ];
- $result = $this->call('getUser', $param); // returns user-data-array
- return $result;
- }
-
- /**
- * add user
- *
- * adds new user and sets role-id
- * @access public
- * @param array user_data user-data
- * @param string role_id global role-id for new user
- * @return string user-id
- */
- function addUser($user_data, $role_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_data' => $user_data,
- 'global_role_id' => $role_id
- ];
- return $this->call('addUser', $param); // returns user_id
- }
-
- /**
- * update user
- *
- * update user-data
- * @access public
- * @param array user_data user-data
- * @return string result
- */
- function updateUser($user_data)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_data' => $user_data
- ];
- return $this->call('updateUser', $param); // returns boolean
- }
-
- /**
- * update password
- *
- * update password with given string and write it uncrypted to the ilias-database
- * @access public
- * @param string user_id user-id
- * @param string password password
- * @return string result
- */
- function updatePassword($user_id, $password)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_id' => $user_id,
- 'new_password' => $password
- ];
- return $this->call('updatePassword', $param); // returns boolean
- }
-
- /**
- * delete user
- *
- * deletes user-account
- * @access public
- * @param string user_id user-id
- * @return string result
- */
- function deleteUser($user_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'user_id' => $user_id
- ];
- return $this->call('deleteUser', $param); // returns boolean
- }
-
-////////////////////////////
-// COURSE-FUNCTIONS //
-//////////////////////////
-
- /**
- * is course member
- *
- * checks if user is course-member
- * @access public
- * @param string user_id user-id
- * @param string course_id course-id
- * @return boolean result
- */
- function isMember($user_id, $course_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'course_id' => $course_id,
- 'user_id' => $user_id
- ];
- $status = $this->call('isAssignedToCourse', $param); // returns 0 if not assigned, 1 => course admin, 2 => course member or 3 => course tutor
- if ($status == 0)
- return false;
- else
- return true;
- }
-
- /**
- * add course member
- *
- * adds user to course
- * @access public
- * @param string user_id user-id
- * @param string type member-type (Admin, Tutor or Member)
- * @param string course_id course-id
- * @return boolean result
- */
- function addMember($user_id, $type, $course_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'course_id' => $course_id,
- 'user_id' => $user_id,
- 'type' => $type
- ];
- return $this->call('assignCourseMember', $param);
- }
-
- /**
- * add course
- *
- * adds course
- * @access public
- * @param array course_data course-data
- * @param string ref_id target-id
- * @return string course-id
- */
- function addCourse($course_data, $ref_id)
- {
- foreach($course_data as $key => $value) {
- $course_data[$key] = htmlReady($course_data[$key]);
- }
-
- $xml = $this->getCourseXML($course_data);
- $param = [
- 'sid' => $this->getSID(),
- 'target_id' => $ref_id,
- 'crs_xml' => $xml
- ];
- $crs_id = $this->call('addCourse', $param);
- return $crs_id;
- }
-
- /**
- * get course-xml
- *
- * gets course xml-object for given course-data
- * @access public
- * @param array course_data course-data
- * @return string course-xml
- */
- function getCourseXML($course_data)
- {
- $crs_language = $course_data["language"];
- $crs_admin_id = $course_data["admin_id"];
- $crs_title = $course_data["title"];
- $crs_desc = $course_data["description"];
-
- $xml = "<!DOCTYPE Course SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_course_0_1.dtd\">
-<Course>
- <MetaData>
- <General Structure=\"Hierarchical\">
- <Identifier Catalog=\"ILIAS\"/>
- <Title Language=\"$crs_language\">
- $crs_title
- </Title>
- <Language Language=\"$crs_language\"/>
- <Description Language=\"$crs_language\">
- $crs_desc
- </Description>
- <Keyword Language=\"$crs_language\">
- </Keyword>
- </General>
- </MetaData>
- <Admin id=\"$crs_admin_id\" notification=\"Yes\" passed=\"No\">
- </Admin>
- <Settings>
- <Availability>
- <Unlimited/>
- </Availability>
- <Syllabus>
- </Syllabus>
- <Contact>
- <Name>
- </Name>
- <Responsibility>
- </Responsibility>
- <Phone>
- </Phone>
- <Email>
- </Email>
- <Consultation>
- </Consultation>
- </Contact>
- <Registration registrationType=\"Password\" maxMembers=\"0\" notification=\"No\">
- <Disabled/>
- </Registration>
- <Sort type=\"Manual\"/>
- <Archive Access=\"Disabled\">
- </Archive>
- </Settings>
-</Course>";
- return $xml;
- }
-
- /**
- * check reference by title
- *
- * gets reference-id by object-title
- * @access public
- * @param string key keyword
- * @param string type object-type
- * @return string reference-id
- */
- function checkReferenceById($id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'reference_id' => $id
- ];
-
- $result = $this->call('getObjectByReference', $param);
- if ($result != false)
- {
- $objects = $this->parseXML($result);
- //echo "<pre><hr>".print_r($objects,1);
- //echo "\n</pre><hr>";
- if(is_array($objects)){
- foreach($objects as $index => $object_data){
- if(is_array($object_data['references'])){
- foreach($object_data['references'] as $reference){
- if($reference['ref_id'] == $id && $reference['accessInfo'] != 'object_deleted') return $object_data['obj_id'];
- }
- }
- }
- }
- }
- return false;
- }
-}
diff --git a/lib/elearning/Ilias4ConnectedCMS.php b/lib/elearning/Ilias4ConnectedCMS.php
deleted file mode 100644
index 8db483b..0000000
--- a/lib/elearning/Ilias4ConnectedCMS.php
+++ /dev/null
@@ -1,271 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
- * main-class for connection to ILIAS 4
- *
- * This class contains the main methods of the elearning-interface to connect to ILIAS 4. Extends Ilias3ConnectedCMS.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias4ConnectedCMS
- * @package ELearning-Interface
- */
-class Ilias4ConnectedCMS extends Ilias3ConnectedCMS
-{
- var $user_category_node_id;
- var $ldap_enable;
- /**
- * constructor
- *
- * init class.
- * @access public
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- global $messages;
- parent::__construct($cms);
- if (ELearningUtils::getConfigValue("user_category_id", $cms)) {
- $this->user_category_node_id = ELearningUtils::getConfigValue("user_category_id", $cms);
- } else {
- $this->user_category_node_id = $this->main_category_node_id;
- }
- if (ELearningUtils::getConfigValue("ldap_enable", $cms)) {
- $this->ldap_enable = ELearningUtils::getConfigValue("ldap_enable", $cms);
- }
- }
-
- /**
- * Helper function to fetch children including objects in folders
- * The typo in the function name, 'childs', is intentional to reflect the name of the ILIAS-SOAP call.
- *
- * @access public
- * @param string $parent_id
- * @return array result
- */
- function getChilds($parent_id) {
- $types[] = 'fold';
- foreach ($this->types as $type => $name) {
- $types[] = $type;
- }
-
- $result = $this->soap_client->getTreeChilds($parent_id, $types, $this->user->getId());
- if ($result) {
- $parent_path = $this->soap_client->getRawPath($parent_id) . '_' . $parent_id;
- foreach($result as $ref_id => $data) {
- // Workaround: getTreeChilds() liefert ALLE Referenzen der beteiligten Objekte, hier sollen aber nur die aus dem Kurs geprüft werden. Deshalb Abgleich der Pfade aller gefundenen Objekt-Referenzen.
- if (($data["accessInfo"] != "granted") OR ($this->soap_client->getRawPath($ref_id) != $parent_path))
- unset($result[$ref_id]);
- elseif ($data['type'] == 'fold') {
- unset($result[$ref_id]);
- $result = $result + $this->getChilds($ref_id);
- }
- }
- }
-
- if (is_array($result))
- return $result;
- else
- return [];
- }
-
- /**
- * check connected modules and update connections
- *
- * checks if there are modules in the course that are not connected to the seminar
- * @access public
- * @param string $course_id course-id
- */
- function updateConnections($course_id)
- {
- global $connected_cms, $messages, $object_connections;
-
- $db = DBManager::get();
-
- $result = $this->soap_client->getObjectByReference($course_id);
- if ($result) {
- $course_path = $this->soap_client->getRawPath($course_id) . '_' . $result["ref_id"];
- }
- $this->soap_client->setCachingStatus(false);
- // fetch childs
- $result = $this->getChilds($course_id);
-
- if (is_array($result)) {
- $check = $db->prepare("SELECT 1 FROM object_contentmodules WHERE object_id = ? AND module_id = ? AND system_type = ? AND module_type = ?");
- $found = [];
- $added = 0;
- $deleted = 0;
- $messages["info"] .= "<b>".sprintf(_("Aktualisierung der Zuordnungen zum System \"%s\":"), $this->getName()) . "</b><br>";
- foreach($result as $ref_id => $data) {
- $check->execute([Context::getId(), $ref_id, $this->cms_type, $data["type"]]);
- if (!$check->fetch()) {
- $messages["info"] .= sprintf(_("Zuordnung zur Lerneinheit \"%s\" wurde hinzugefügt."), ($data["title"])) . "<br>";
- ObjectConnections::setConnection(Context::getId(), $ref_id, $data["type"], $this->cms_type);
- $added++;
- }
- $found[] = $ref_id . '_' . $data["type"];
- }
- $to_delete = $db->prepare("SELECT module_id,module_type FROM object_contentmodules WHERE module_type <> 'crs' AND object_id = ? AND system_type = ? AND CONCAT_WS('_', module_id,module_type) NOT IN (?)");
- $to_delete->execute([Context::getId(), $this->cms_type, count($found) ? $found : ['']]);
- while ($row = $to_delete->fetch(PDO::FETCH_ASSOC)) {
- ObjectConnections::unsetConnection(Context::getId(), $row["module_id"], $row["module_type"], $this->cms_type);
- $deleted++;
- $messages["info"] .= sprintf(_("Zuordnung zu \"%s\" wurde entfernt."), $row["module_id"] . '_' . $row["module_type"]) . "<br>";
- }
- if (($added + $deleted) < 1) {
- $messages["info"] .= _("Die Zuordnungen sind bereits auf dem aktuellen Stand.") . "<br>";
- }
- }
- ELearningUtils::bench("update connections");
- }
-
- /**
- * create course
- *
- * creates new ilias course
- * @access public
- * @param string $seminar_id seminar-id
- * @return boolean successful
- */
- function createCourse($seminar_id)
- {
- global $messages, $ELEARNING_INTERFACE_MODULES;
-
- $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type);
- $this->soap_client->setCachingStatus(false);
- $this->soap_client->clearCache();
-
- if ($crs_id == false) {
- $course = Course::find($seminar_id);
- if ($course->home_institut) {
- $ref_id = ObjectConnections::getConnectionModuleId($course->institut_id, 'cat', $this->cms_type);
- }
- if ($ref_id < 1) {
- // Kategorie für Heimateinrichtung anlegen
- $object_data['title'] = $course->home_institut->name;
- $object_data['description'] = sprintf(_('Hier befinden sich die Veranstaltungsdaten zur Stud.IP-Einrichtung "%s".'), $course->home_institut->name);
- $object_data['type'] = 'cat';
- $object_data['owner'] = $this->soap_client->LookupUser($ELEARNING_INTERFACE_MODULES[$this->cms_type]['soap_data']['username']);
- $ref_id = $this->soap_client->addObject($object_data, $this->main_category_node_id);
- ObjectConnections::setConnection($course->institut_id, $ref_id, 'cat', $this->cms_type);
- }
- if ($ref_id < 1) {
- $ref_id = $this->main_category_node_id;
- }
-
- // Kurs anlegen
- $lang_array = explode('_', Config::get()->DEFAULT_LANGUAGE);
- $course_data['language'] = $lang_array[0];
- $course_data['title'] = 'Stud.IP-Kurs ' . $course->name;
- $course_data['description'] = '';
- $crs_id = $this->soap_client->addCourse($course_data, $ref_id);
- if ($crs_id == false) {
- $messages["error"] .= _("Zuordnungs-Fehler: Kurs konnte nicht angelegt werden.");
- return false;
- }
- ObjectConnections::setConnection($seminar_id, $crs_id, "crs", $this->cms_type);
-
- // Rollen zuordnen
- $this->permissions->CheckUserPermissions($crs_id);
- }
- return $crs_id;
- }
-
- /**
- * get preferences
- *
- * shows additional settings.
- * @access public
- */
- function getPreferences()
- {
- global $connected_cms;
-
- $role_template_name = Request::get('role_template_name');
- $cat_name = Request::get('cat_name');
-
- $this->soap_client->setCachingStatus(false);
-
- $messages = ['error' => ''];
-
- if ($cat_name) {
- $cat = $this->soap_client->getReferenceByTitle( trim( $cat_name ), "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"] = _("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) {
- $this->user_category_node_id = $user_cat;
- ELearningUtils::setConfigValue("user_category_id", $user_cat, $this->cms_type);
- } else {
- $messages["error"] .= _("Die Kategorie für User-Daten konnte nicht angelegt werden.") . "<br>\n";
- }
- }
-
- if ($role_template_name != "") {
- $role_template = $this->soap_client->getObjectByTitle( trim( $role_template_name ), "rolt" );
- if ($role_template == false) {
- $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)) {
- 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')) {
- ELearningUtils::setConfigValue("encrypt_passwords", Request::option("encrypt_passwords"), $this->cms_type);
- $encrypt_passwords = Request::option("encrypt_passwords");
- ELearningUtils::setConfigValue("ldap_enable", Request::option("ldap_enable"), $this->cms_type);
- $this->ldap_enable = Request::option("ldap_enable");
- } else {
- if (ELearningUtils::getConfigValue("encrypt_passwords", $this->cms_type) != "")
- $encrypt_passwords = ELearningUtils::getConfigValue("encrypt_passwords", $this->cms_type);
- }
-
- $cat = $this->soap_client->getObjectByReference( $this->main_category_node_id );
- $user_cat = $this->soap_client->getObjectByReference( $this->user_category_node_id );
- $title = $this->link->getModuleLink($user_cat["title"], $this->user_category_node_id, "cat");
- $ldap_options = [];
- foreach (StudipAuthAbstract::GetInstance() as $plugin) {
- if ($plugin instanceof StudipAuthLdap) {
- $ldap_options[] = '<option '.($plugin->plugin_name == $this->ldap_enable ? 'selected' : '').'>' . $plugin->plugin_name . '</option>';
- }
- }
- ob_start();
- ConnectedCMS::getPreferences();
- $module_types = ob_get_clean();
-
- $template = $GLOBALS['template_factory']->open('elearning/ilias4_connected_cms_preferences.php');
- $template->set_attribute('messages', $messages);
- $template->set_attribute('soap_error', $this->soap_client->getError());
- $template->set_attribute('soap_data', $this->soap_data);
- $template->set_attribute('main_category_node_id', $this->main_category_node_id);
- $template->set_attribute('main_category_node_id_title', $cat['title']);
- $template->set_attribute('user_category_node_id', $this->user_category_node_id);
- $template->set_attribute('user_category_node_id_title', $title);
- $template->set_attribute('user_role_template_name', ELearningUtils::getConfigValue("user_role_template_name", $this->cms_type));
- $template->set_attribute('user_role_template_id', $this->user_role_template_id);
- $template->set_attribute('encrypt_passwords', $encrypt_passwords);
- $template->set_attribute('ldap_options', count($ldap_options) ? join("\n", array_merge(['<option></option>'], $ldap_options)) : '');
- $template->set_attribute('module_types', $module_types);
- echo $template->render();
- }
-
-}
diff --git a/lib/elearning/Ilias4ConnectedLink.php b/lib/elearning/Ilias4ConnectedLink.php
deleted file mode 100644
index a2bdb14..0000000
--- a/lib/elearning/Ilias4ConnectedLink.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-use Studip\Button, Studip\LinkButton;
-
-/**
- * class to generate links to ILIAS 4
- *
- * This class contains methods to generate links to ILIAS 4.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias4ConnectedLink
- * @package ELearning-Interface
- */
-class Ilias4ConnectedLink extends Ilias3ConnectedLink
-{
- /**
- * constructor
- *
- * init class.
- * @access
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- parent::__construct($cms);
- $this->cms_link = "ilias3_referrer.php";
- }
-
- /**
- * get module link
- *
- * returns link to the specified ilias object. works without initializing module-class.
- * @access public
- * @return string html-code
- */
- function getModuleLink($title, $module_id, $module_type)
- {
- global $connected_cms, $view, $search_key, $cms_select, $current_module;
-
- if ($connected_cms[$this->cms_type]->isAuthNecessary() AND (! $connected_cms[$this->cms_type]->user->isConnected())) {
- return false;
- }
- $output = "<a href=\"" . URLHelper::getLink($this->cms_link . "?"
- . "client_id=" . $connected_cms[$this->cms_type]->getClientId()
- . "&cms_select=" . $this->cms_type
- . "&ref_id=" . $module_id
- . "&type=" . $module_type
- . "&target=start"). "\" target=\"_blank\" rel=\"noopener noreferrer\">";
- $output .= $title;
- $output .= "</a>&nbsp;";
-
- return $output;
- }
-
- /**
- * get admin module links
- *
- * returns links add or remove a module from course
- * @access public
- * @return string returns html-code
- */
- function getAdminModuleLinks()
- {
- global $connected_cms, $view, $search_key, $cms_select, $current_module;
-
- $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) {
- $output .= "<i>Pfad: ". htmlReady($result) . "</i><br><br>";
- }
- $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 .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
- } elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
- $output .= "<div align=\"left\">";
- if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_COPY) AND (! in_array($connected_cms[$this->cms_type]->content_module[$current_module]->module_type, ["lm", "htlm", "sahs", "cat", "crs", "dbk"]))) {
- $output .= "<input type=\"CHECKBOX\" name=\"copy_object\" value=\"1\">";
- $output .= _("Als Kopie anlegen") . "&nbsp;";
- $output .= Icon::create('info-circle', 'inactive', ['title' => _('Wenn Sie diese Option wählen, wird eine identische Kopie als eigenständige Instanz des Lernmoduls erstellt. Anderenfalls wird ein Link zum Lernmodul gesetzt.')])->asImg();
- $output .= "<br>";
- }
- $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"none\" checked>";
- $output .= _("Keine Schreibrechte") . "&nbsp;";
- $output .= Icon::create('info-circle', 'inactive', ['title' => _('Nur der/die BesitzerIn des Lernmoduls hat Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
- $output .= "<br>";
- $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"dozent\">";
- $output .= _("Mit Schreibrechten für alle Lehrenden dieser Veranstaltung") . "&nbsp;";
- $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
- $output .= "<br>";
- $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"tutor\">";
- $output .= _("Mit Schreibrechten für alle Lehrenden und Tutor/-innen dieser Veranstaltung") . "&nbsp;";
- $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende und Tutor/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
- $output .= "<br>";
- $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"autor\">";
- $output .= _("Mit Schreibrechten für alle Personen dieser Veranstaltung") . "&nbsp;";
- $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende, Tutor/-innen und Teilnehmende haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
- $output .= "</div>";
- $output .= "</div><br>" . Button::create(_('Hinzufügen'), 'add') . "<br>";
- } else {
- $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
- }
- $output .= "</form>";
-
- return $output;
- }
-}
diff --git a/lib/elearning/Ilias4ConnectedPermissions.php b/lib/elearning/Ilias4ConnectedPermissions.php
deleted file mode 100644
index af70ba7..0000000
--- a/lib/elearning/Ilias4ConnectedPermissions.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-DEFINE ("OPERATION_COPY", "copy");
-
-/**
- * class to handle ILIAS 4 access controls
- *
- * This class contains methods to handle permissions on connected objects.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias4ConnectedPermission
- * @package ELearning-Interface
- */
-class Ilias4ConnectedPermissions extends Ilias3ConnectedPermissions
-{
- var $operations;
- var $allowed_operations;
- var $tree_allowed_operations;
-
- var $USER_OPERATIONS;
- var $AUTHOR_OPERATIONS;
- /**
- * constructor
- *
- * init class.
- * @access
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- parent::__construct($cms);
- }
-
- /**
- * check user permissions
- *
- * checks user permissions for connected course and changes setting if necessary
- * @access public
- * @param string $course_id course-id
- * @return boolean returns false on error
- */
- function checkUserPermissions($course_id = "")
- {
- global $connected_cms, $messages;
-
- if ($course_id == "") return false;
- 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[$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 ) {
- $proper_role = $role_data["obj_id"];
- }
- }
- }
- }
-
- // 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) {
- $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)
- {
- case "admin":
- $member_data["role"] = CRS_ADMIN_ROLE;
- $type = "Admin";
- break;
- case "tutor":
- $member_data["role"] = CRS_TUTOR_ROLE;
- $type = "Tutor";
- break;
- case "member":
- $member_data["role"] = CRS_MEMBER_ROLE;
- $type = "Member";
- break;
- default:
- }
- $member_data["passed"] = CRS_PASSED_VALUE;
- if ($type != "") {
- $connected_cms[$this->cms_type]->soap_client->addMember( $connected_cms[$this->cms_type]->user->getId(), $type, $course_id );
- if ($GLOBALS["debug"] == true) echo "addMember";
- }
- }
-
- // check if user has proper local role
- // if not, change it
- if ($active_role != $proper_role) {
- if ($active_role != "") {
- $connected_cms[$this->cms_type]->soap_client->deleteUserRoleEntry( $connected_cms[$this->cms_type]->user->getId(), $active_role);
- if ($GLOBALS["debug"] == true) echo "Role $active_role deleted.";
- }
-
- if ($proper_role != "") {
- $connected_cms[$this->cms_type]->soap_client->addUserRoleEntry( $connected_cms[$this->cms_type]->user->getId(), $proper_role);
- if ($GLOBALS["debug"] == true) echo "Role $proper_role added.";
- }
-
- }
-
- if (! $this->getContentModulePerms( $course_id )) {
- $messages["info"] .= _("Für den zugeordneten ILIAS-Kurs konnten keine Berechtigungen ermittelt werden.") . "<br>";
- }
-
- return true;
- }
-}
-?>
diff --git a/lib/elearning/Ilias4ConnectedUser.php b/lib/elearning/Ilias4ConnectedUser.php
deleted file mode 100644
index be8b88c..0000000
--- a/lib/elearning/Ilias4ConnectedUser.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
- * class to handle ILIAS 4 user-accounts
- *
- * This class contains methods to handle connected ILIAS 4 user-accounts.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias4ConnectedUser
- * @package ELearning-Interface
- */
-class Ilias4ConnectedUser extends Ilias3ConnectedUser
-{
- var $roles;
- var $user_sid;
- var $auth_plugin;
-
- /**
- * constructor
- *
- * init class.
- * @access
- * @param string $cms system-type
- */
- function __construct($cms, $user_id = false)
- {
- // get auth_plugin
- $user_id = $user_id ? $user_id : $GLOBALS['user']->id;
- $this->auth_plugin = DBManager::get()->query("SELECT IFNULL(auth_plugin, 'standard') FROM auth_user_md5 WHERE user_id = '" . $user_id . "'")->fetchColumn();
- parent::__construct($cms, $user_id);
- }
-
- /**
- * new user
- *
- * save new user
- * @access public
- * @return boolean returns false on error
- */
- function newUser($ignore_encrypt_passwords = false)
- {
- global $connected_cms, $auth, $messages;
-
- if ($this->getLoginData($this->login)) {
- //automatische Zuordnung von bestehenden Ilias Accounts
- //nur wenn ldap Modus benutzt wird und Stud.IP Nutzer passendes ldap plugin hat
- if (
- $connected_cms[$this->cms_type]->USER_AUTO_CREATE
- && !$connected_cms[$this->cms_type]->USER_PREFIX
- && $this->auth_plugin
- && $this->auth_plugin !== 'standard'
- && $this->auth_plugin === $connected_cms[$this->cms_type]->ldap_enable
- ) {
- if (!$this->external_password) {
- $this->setPassword(md5(uniqid("4dfmjsnll")));
- }
- $ok = $connected_cms[$this->cms_type]->soap_client->updatePassword($this->id, $this->external_password);
- $this->setConnection($this->getUserType(), true);
- if ($ok) {
- $messages["info"] .= sprintf(_("Verbindung mit Nutzer ID %s wiederhergestellt."), $this->id);
- }
- return true;
- }
- $messages["error"] .= sprintf(_("Es existiert bereits ein Account mit dem Benutzernamen \"%s\" (Account ID %s)."), $this->login, $this->id) . "<br>\n";
- return false;
- }
-
- // data for user-account in ILIAS 4
- $user_data["login"] = $this->login;
- $user_data["passwd"] = $this->external_password;
- $user_data["firstname"] = $this->firstname;
- $user_data["lastname"] = $this->lastname;
- $user_data["title"] = $this->title;
- $user_data["gender"] = $this->gender;
- $user_data["email"] = $this->email;
- $user_data["street"] = $this->street;
- $user_data["phone_home"] = $this->phone_home;
- $user_data["time_limit_unlimited"] = 1;
- $user_data["active"] = 1;
- $user_data["approve_date"] = date('Y-m-d H:i:s');
- $user_data["accepted_agreement"] = true;
- // new values for ILIAS 4
- $user_data["agree_date"] = date('Y-m-d H:i:s');
- $user_data["external_account"] = $this->login;
- if ($this->auth_plugin && $this->auth_plugin != "standard" && ($this->auth_plugin == $connected_cms[$this->cms_type]->ldap_enable)) {
- $user_data["auth_mode"] = "ldap";
- } else {
- $user_data["auth_mode"] = "default";
- }
- if ($connected_cms[$this->cms_type]->user_style != "") {
- $user_data["user_style"] = $connected_cms[$this->cms_type]->user_style;
- }
- if ($connected_cms[$this->cms_type]->user_skin != "") {
- $user_data["user_skin"] = $connected_cms[$this->cms_type]->user_skin;
- }
-
- $role_id = $connected_cms[$this->cms_type]->roles[$auth->auth["perm"]];
-
- $user_id = $connected_cms[$this->cms_type]->soap_client->addUser($user_data, $role_id);
-
- if ($user_id != false) {
- $this->id = $user_id;
-
- // $connected_cms[$this->cms_type]->soap_client->updatePassword($user_id, $user_data["passwd"]);
-
- // $this->newUserCategory();
-
- $this->setConnection(USER_TYPE_CREATED);
- return true;
- }
- return false;
- }
-
- /**
- * create new user category
- *
- * create new user category
- * @access public
- * @return boolean returns false on error
- */
- function newUserCategory()
- {
- global $connected_cms, $messages;
-
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
-
- // data for user-category in ILIAS 4
- $object_data["title"] = sprintf(_("Eigene Daten von %s (%s)."), $this->getName(), $this->getId());
- $object_data["description"] = sprintf(_("Hier befinden sich die persönlichen Lernmodule des Benutzers %s."), $this->getName());
- $object_data["type"] = "cat";
- $object_data["owner"] = $this->getId();
-
- $cat = $connected_cms[$this->cms_type]->soap_client->getReferenceByTitle($object_data["title"]);
- if ($cat != false && $connected_cms[$this->cms_type]->soap_client->checkReferenceById($cat) ) {
- $messages["info"] .= sprintf(_("Ihre persönliche Kategorie wurde bereits angelegt."), $this->login) . "<br>\n";
- $this->category = $cat;
- } else {
- $this->category = $connected_cms[$this->cms_type]->soap_client->addObject($object_data, $connected_cms[$this->cms_type]->user_category_node_id);
- }
- if ($this->category != false) {
- parent::setConnection($this->getUserType(), true);
- } else {
- echo "CATEGORY_ERROR".$connected_cms[$this->cms_type]->user_category_node_id ."-";
- return false;
- }
- // data for personal user-role in ILIAS 4
- $role_data["title"] = "studip_usr" . $this->getId() . "_cat" . $this->category;
- $role_data["description"] = sprintf(_("User-Rolle von %s. Diese Rolle wurde von Stud.IP generiert."), $this->getName());
- $role_id = $connected_cms[$this->cms_type]->soap_client->getObjectByTitle($role_data["title"], "role");
- if ($role_id != false) {
- $messages["info"] .= sprintf(_("Ihre persönliche Userrolle wurde bereits angelegt."), $this->login) . "<br>\n";
- } else {
- $role_id = $connected_cms[$this->cms_type]->soap_client->addRoleFromTemplate($role_data, $this->category, $connected_cms[$this->cms_type]->user_role_template_id);
- }
- $connected_cms[$this->cms_type]->soap_client->addUserRoleEntry($this->getId(), $role_id);
- // delete permissions for all global roles for this category
- foreach ($connected_cms[$this->cms_type]->global_roles as $key => $role) {
- $connected_cms[$this->cms_type]->soap_client->revokePermissions($role, $this->category);
- }
- return true;
- }
-}
diff --git a/lib/elearning/Ilias4ContentModule.php b/lib/elearning/Ilias4ContentModule.php
deleted file mode 100644
index f8552c3..0000000
--- a/lib/elearning/Ilias4ContentModule.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
- * class to handle ILIAS 4 learning modules and tests
- *
- * This class contains methods to handle ILIAS 4 learning modules and tests.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias4ContentModule
- * @package ELearning-Interface
- */
-class Ilias4ContentModule extends Ilias3ContentModule
-{
- var $object_id;
-
- /**
- * constructor
- *
- * init class.
- * @access public
- * @param string $module_id module-id
- * @param string $module_type module-type
- * @param string $cms_type system-type
- */
- function __construct($module_id, $module_type, $cms_type)
- {
- parent::__construct($module_id, $module_type, $cms_type);
- }
-
- /**
- * set connection
- *
- * sets connection with seminar
- * @access public
- * @param string $seminar_id seminar-id
- * @return boolean successful
- */
- function setConnection($seminar_id)
- {
- global $connected_cms, $messages;
-
- $write_permission = Request::option("write_permission");
-
- $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type);
- $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
- $connected_cms[$this->cms_type]->soap_client->clearCache();
-
- // Check, ob Kurs in ILIAS gelöscht wurde
- if (($crs_id != false) AND ($connected_cms[$this->cms_type]->soap_client->getObjectByReference($crs_id) == false)) {
- ObjectConnections::unsetConnection($seminar_id, $crs_id, "crs", $this->cms_type);
- $messages["info"] .= _("Der zugeordnete ILIAS-Kurs (ID $crs_id) existiert nicht mehr. Ein neuer Kurs wird angelegt.") . "<br>";
- $crs_id = false;
- }
-
- $crs_id == $connected_cms[$this->cms_type]->createCourse($seminar_id);
-
- if ($crs_id == false) return false;
-
- $ref_id = $this->getId();
- if (Request::get("copy_object") == "1") {
- $connected_cms[$this->cms_type]->soap_client->user_type = 'user';
- $ref_id = $connected_cms[$this->cms_type]->soap_client->copyObject($this->id, $crs_id);
- $connected_cms[$this->cms_type]->soap_client->user_type = 'admin';
- } else {
- $ref_id = $connected_cms[$this->cms_type]->soap_client->addReference($this->id, $crs_id);
- }
- if (!$ref_id) {
- $messages["error"] .= _("Zuordnungs-Fehler: Objekt konnte nicht angelegt werden.");
- return false;
- }
- $local_roles = $connected_cms[$this->cms_type]->soap_client->getLocalRoles($crs_id);
- $member_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ]);
- $admin_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE, OPERATION_DELETE]);
- $admin_operations_no_delete = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE]);
- $admin_operations_readonly = $connected_cms[$this->cms_type]->permissions->getOperationArray([OPERATION_VISIBLE, OPERATION_READ, OPERATION_DELETE]);
- 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"], "il_crs_") === 0) {
- if(mb_strpos($role_data["title"], 'il_crs_member') === 0){
- $operations = ($write_permission == "autor") ? $admin_operations_no_delete : $member_operations;
- } elseif(mb_strpos($role_data["title"], 'il_crs_tutor') === 0){
- $operations = (($write_permission == "tutor") || ($write_permission == "autor")) ? $admin_operations : $admin_operations_readonly;
- } elseif(mb_strpos($role_data["title"], 'il_crs_admin') === 0){
- $operations = (($write_permission == "dozent") || ($write_permission == "tutor") || ($write_permission == "autor")) ? $admin_operations : $admin_operations_readonly;
- } else {
- continue;
- }
- $connected_cms[$this->cms_type]->soap_client->revokePermissions($role_data["obj_id"], $ref_id);
- $connected_cms[$this->cms_type]->soap_client->grantPermissions($operations, $role_data["obj_id"], $ref_id);
- }
- }
- if ($ref_id) {
- $this->setId($ref_id);
- return ContentModule::setConnection($seminar_id);
- } else {
- $messages["error"] .= _("Die Zuordnung konnte nicht gespeichert werden.");
- }
- return false;
- }
-}
diff --git a/lib/elearning/Ilias4Soap.php b/lib/elearning/Ilias4Soap.php
deleted file mode 100644
index 27c28fb..0000000
--- a/lib/elearning/Ilias4Soap.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
- * class to use ILIAS-4-Webservices
- *
- * This class contains methods to connect to the ILIAS-4-Soap-Server.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias4Soap
- * @package ELearning-Interface
- */
-class Ilias4Soap extends Ilias3Soap
-{
- var $cms_type;
- var $admin_sid;
- var $user_sid;
- var $user_type;
- var $soap_cache;
- var $separator_string;
-
- /**
- * constructor
- *
- * init class.
- * @access
- * @param string $cms system-type
- */
- function __construct($cms)
- {
- parent::__construct($cms);
- $this->separator_string = " / ";
- }
-
- /**
- * add user by importUsers
- *
- * adds new user and sets role-id
- * @access public
- * @param array user_data user-data
- * @param string role_id global role-id for new user
- * @return string user-id
- */
- function addUser($user_data, $role_id)
- {
- foreach($user_data as $key => $value) {
- $user_data[$key] = htmlReady($user_data[$key]);
- }
-
- $usr_xml = "<Users>
-<User>
-<UDFDefinitions></UDFDefinitions>
-<Login>".$user_data["login"]."</Login>
-<Password Type=\"PLAIN\">".$user_data["passwd"]."</Password>
-<Firstname>".$user_data["firstname"]."</Firstname>
-<Lastname>".$user_data["lastname"]."</Lastname>
-<Title>".$user_data["title"]."</Title>
-<Gender>".$user_data["gender"]."</Gender>
-<Email>".$user_data["email"]."</Email>
-<Street>".$user_data["street"]."</Street>
-<PhoneHome>".$user_data["phone_home"]."</PhoneHome>
-<Role Id=\"".$role_id."\" Type=\"Global\"/>
-<Active>true</Active>
-<TimeLimitUnlimited>".$user_data["time_limit_unlimited"]."</TimeLimitUnlimited>
-<TimeLimitMessage>0</TimeLimitMessage>
-<ApproveDate>".$user_data["approve_date"]."</ApproveDate>
-<AgreeDate>".$user_data["agree_date"]."</AgreeDate>";
- if (($user_data["user_skin"] != "") OR ($user_data["user_style"] != "")) {
- $usr_xml .= "<Look Skin=\"".$user_data["user_skin"]."\" Style=\"".$user_data["user_style"]."\"/>";
- }
- $usr_xml .= "<AuthMode type=\"".$user_data["auth_mode"]."\"/>
-<ExternalAccount>".$user_data["external_account"]."</ExternalAccount>
-</User>
-</Users>";
-
- $param = [
- 'sid' => $this->getSID(),
- 'folder_id' => -1,
- 'usr_xml' => $usr_xml,
- 'conflict_role' => 1,
- 'send_account_mail' => 0
- ];
- $result = $this->call('importUsers', $param);
-
- $s = simplexml_load_string($result);
-
- if ((string)$s->rows->row->column[3] == "successful")
- return (string)$s->rows->row->column[0];
- else
- return false;
- }
-
- /**
- * copy object
- *
- * copy ilias-object
- * @access public
- * @param string source_id reference-id
- * @param string target_id reference-id
- * @return string result
- */
- function copyObject($source_id, $target_id)
- {
- $xml = "<Settings source_id=\"$source_id\" target_id=\"$target_id\" default_action=\"COPY\"/>";
-
- $param = [
- 'sid' => $this->getSID(),
- 'xml' => $xml
- ];
- return $this->call('copyObject', $param);
- }
-
- /**
- * get path
- *
- * returns repository-path to ilias-object
- * @access public
- * @param string source_id reference-id
- * @param string target_id reference-id
- * @return string result
- */
- function getPath($ref_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'ref_id' => $ref_id
- ];
- $result = $this->call('getPathForRefId', $param);
-
- if ($result) {
- $s = simplexml_load_string($result);
-
- foreach ($s->rows->row as $row) {
- $path[] = (string)$row->column[2];
- }
- }
-
- if (is_array($path)) {
- return implode($this->separator_string, $path);
- } else {
- return false;
- }
- }
-
- /**
- *
- * returns repository-path to ilias-object
- *
- * @access public
- * @param string source_id reference-id
- * @param string target_id reference-id
- * @return string result
- */
- function getRawPath($ref_id)
- {
- $param = [
- 'sid' => $this->getSID(),
- 'ref_id' => $ref_id
- ];
- $result = $this->call('getPathForRefId', $param);
-
- if ($result) {
- $s = simplexml_load_string($result);
-
- foreach ($s->rows->row as $row) {
- $path[] = (string)$row->column[0];
- }
- }
-
- if (is_array($path)) {
- return implode('_', $path);
- } else {
- return false;
- }
- }
-}
diff --git a/lib/elearning/Ilias5ConnectedCMS.php b/lib/elearning/Ilias5ConnectedCMS.php
deleted file mode 100644
index 011d046..0000000
--- a/lib/elearning/Ilias5ConnectedCMS.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/**
- * main-class for connection to ILIAS 5.2
- *
- * This class contains the main methods of the elearning-interface to connect to ILIAS 5. Extends Ilias3ConnectedCMS.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias5ConnectedCMS
- * @package ELearning-Interface
- */
-class Ilias5ConnectedCMS extends Ilias4ConnectedCMS
-{
-
-}
diff --git a/lib/elearning/Ilias5ConnectedLink.php b/lib/elearning/Ilias5ConnectedLink.php
deleted file mode 100644
index 0ce4a0f..0000000
--- a/lib/elearning/Ilias5ConnectedLink.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * class to generate links to ILIAS 5.2
- *
- * This class contains methods to generate links to ILIAS 5.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias5ConnectedLink
- * @package ELearning-Interface
- */
-class Ilias5ConnectedLink extends Ilias4ConnectedLink
-{
-}
-?> \ No newline at end of file
diff --git a/lib/elearning/Ilias5ConnectedPermissions.php b/lib/elearning/Ilias5ConnectedPermissions.php
deleted file mode 100644
index 17d6f0d..0000000
--- a/lib/elearning/Ilias5ConnectedPermissions.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/**
- * class to handle ILIAS 5.2 access controls
- *
- * This class contains methods to handle permissions on connected objects.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias4ConnectedPermission
- * @package ELearning-Interface
- */
-class Ilias5ConnectedPermissions extends Ilias4ConnectedPermissions
-{
-
-}
-?> \ No newline at end of file
diff --git a/lib/elearning/Ilias5ConnectedUser.php b/lib/elearning/Ilias5ConnectedUser.php
deleted file mode 100644
index 6172976..0000000
--- a/lib/elearning/Ilias5ConnectedUser.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * class to handle ILIAS 5.2 user-accounts
- *
- * This class contains methods to handle connected ILIAS 5 user-accounts.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias5ConnectedUser
- * @package ELearning-Interface
- */
-class Ilias5ConnectedUser extends Ilias4ConnectedUser
-{
-
- /**
- * verify login data
- *
- * returns true, if login-data is valid
- * @access public
- * @param string $username username
- * @param string $password password
- * @return boolean login-validation
- */
- function verifyLogin($username, $password)
- {
- global $connected_cms, $messages;
- $result = $connected_cms[$this->cms_type]->soap_client->checkPassword($username, $password);
- if (strpos($result, '::') > 0) {
- return $this->getLoginData($username);
- }
- return false;
- }
-
- function setConnection($user_type, $ignore_encrypted_passwords = false)
- {
- $this->external_password = '';
- parent::setConnection($user_type, true);
- }
-} \ No newline at end of file
diff --git a/lib/elearning/Ilias5ContentModule.php b/lib/elearning/Ilias5ContentModule.php
deleted file mode 100644
index 3f50c02..0000000
--- a/lib/elearning/Ilias5ContentModule.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * class to handle ILIAS 5.2 learning modules and tests
- *
- * This class contains methods to handle ILIAS 5 learning modules and tests.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias5ContentModule
- * @package ELearning-Interface
- */
-class Ilias5ContentModule extends Ilias4ContentModule
-{
-
-} \ No newline at end of file
diff --git a/lib/elearning/Ilias5Soap.php b/lib/elearning/Ilias5Soap.php
deleted file mode 100644
index cf8bd4c..0000000
--- a/lib/elearning/Ilias5Soap.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * class to use ILIAS-5-Webservices
- *
- * This class contains methods to connect to the ILIAS-5-Soap-Server.
- *
- * @author Arne Schröder <schroeder@data-quest.de>
- * @access public
- * @modulegroup elearning_interface_modules
- * @module Ilias5Soap
- * @package ELearning-Interface
- */
-class Ilias5Soap extends Ilias4Soap
-{
- var $cms_type;
- var $admin_sid;
- var $user_sid;
- var $user_type;
- var $soap_cache;
- var $separator_string;
-
- /**
- * call soap-function
- *
- * calls soap-function with given parameters
- * @access public
- * @param string method method-name
- * @param string params parameters
- * @return mixed result
- */
- function call($method, $params)
- {
- $index = md5($method . ":" . implode('-', $params));
- // return false if no session_id is given
- if (($method != "login") AND ($params["sid"] == ""))
- return false;
-// echo $this->caching_active;
- if (($this->caching_active == true) AND (isset($this->soap_cache[$index])))
- {
-// echo $index;
-// echo " from Cache<br>";
- $result = $this->soap_cache[$index];
- }
- else
- {
- $result = $this->_call($method, $params);
- // if Session is expired, re-login and try again
- if (($method != "login") AND $this->soap_client->fault AND in_array(mb_strtolower($this->faultstring), ["session not valid","session invalid", "session idled"]) )
- {
- $caching_status = $this->caching_active;
- $this->caching_active = false;
- $user_type = $this->user_type;
- $this->user_type = 'admin';
- $params["sid"] = $this->login();
- $result = $this->_call($method, $params);
- $this->caching_active = $caching_status;
- $this->user_type = $user_type;
- }
- elseif (! $this->soap_client->fault)
- $this->soap_cache[$index] = $result;
- }
- return $result;
- }
-
- /**
- * login
- *
- * login to soap-webservice
- * @access public
- * @return string result
- */
- function login()
- {
- global $ELEARNING_INTERFACE_MODULES, $connected_cms;
- if ($this->user_type == "admin") {
- $param = [
- 'client' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["client"],
- 'username' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["username"],
- 'password' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["password"]
- ];
- $result = $this->call('login', $param);
- } elseif ($this->user_type == "user") {
- $param = [
- 'sid' => $this->admin_sid,
- 'user_id' => $connected_cms[$this->cms_type]->user->getId()
- ];
- $result = $this->call('loginStudipUser', $param);
- }
- if ($this->user_type == "admin")
- $this->admin_sid = $result;
- if ($this->user_type == "user")
- $this->user_sid = $result;
- return $result;
- }
-
- /**
- * Check Auth
- *
- * login to soap-webservice
- * @access public
- * @return string result
- */
- function checkPassword($username, $password)
- {
- global $ELEARNING_INTERFACE_MODULES, $connected_cms;
- $param = [
- 'client' => $ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["client"],
- 'username' => $username,
- 'password' => $password
- ];
- $result = $this->call('login', $param);
- return $result;
- }
-}
diff --git a/lib/elearning/LonCapaConnectedCMS.php b/lib/elearning/LonCapaConnectedCMS.php
deleted file mode 100644
index 2f86aa8..0000000
--- a/lib/elearning/LonCapaConnectedCMS.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * main-class for connection to LonCapa
- *
- * This class contains the main methods of the elearning-interface to connect to
- * LonCapa. Extends ConnectedCMS.
- *
- * @access public
- * @modulegroup elearning_interface_modules
- * @module LonCapaConnectedCMS
- * @package ELearning-Interface
- */
-class LonCapaConnectedCMS extends ConnectedCMS
-{
- public $user;
- protected $seminarId;
- protected $lcRequest;
- protected $cmsUrl;
-
- public function __construct($cms = '')
- {
- parent::__construct($cms);
-
- $this->seminarId = Context::getId();
- $this->user = User::findCurrent();
- $this->lcRequest = new LonCapaRequest();
- $this->cmsUrl = $this->ABSOLUTE_PATH_ELEARNINGMODULES;
- }
-
-
- /**
- * search for content modules
- *
- * returns found content modules
- * @throws AccessDeniedException
- * @param string $key keyword
- * @return array list of content modules
- */
- public function searchContentModules($key)
- {
-
- if (!$GLOBALS['perm']->have_studip_perm('tutor', $this->seminarId)) {
- throw new AccessDeniedException();
- }
-
- $url = $this->cmsUrl . '/courses?search=' . urlencode($key) . '&owner=' . urlencode($this->user->username);
- $response = $this->lcRequest->request($url);
-
- if ($response) {
- $courses = new SimpleXMLElement($response);
-
- $result = [];
- foreach ($courses->course as $course) {
- $temp = explode(':', (string)$course->owner);
-
- $result[] = [
- 'ref_id' => (string)$course->id,
- 'title' => (string)$course->description,
- 'authors' => $temp[0],
- 'type' => $this->cms_type
- ];
- }
- }
-
- return $result;
- }
-}
diff --git a/lib/elearning/LonCapaConnectedLink.php b/lib/elearning/LonCapaConnectedLink.php
deleted file mode 100644
index c00958b..0000000
--- a/lib/elearning/LonCapaConnectedLink.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- *
- * This class contains methods to generate links to LonCapa
- *
- * @modulegroup elearning_interface_modules
- * @module LonCapaConnectedLink
- * @package ELearning-Interface
- */
-class LonCapaConnectedLink extends ConnectedLink
-{
- /**
- * get user module links
- *
- * returns content module links for user
- * @return string html-code
- */
- public function getUserModuleLinks()
- {
- global $connected_cms, $current_module;
-
- $url = URLHelper::getURL('dispatch.php/loncapa/enter', ['cms_type' => $this->cms_type, 'module' => $current_module]);
-
- return Studip\LinkButton::create(_('Starten'), $url, [
- 'target' => '_blank',
- 'rel' => 'noopener noreferrer',
- ]);
- }
-
- /**
- * 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;
- global $template_factory;
-
- $template = $template_factory->open('elearning/loncapa_connected_link_edit');
- $template->current_module = $connected_cms[$this->cms_type]->content_module[$current_module]->getId();
- $template->connected = $connected_cms[$this->cms_type]->content_module[$current_module]->isConnected();
- $template->cms_type = $this->cms_type;
- $template->search_key = $search_key;
- return $template->render(compact('view', 'search_key', 'cms_select', 'current_module'));
- }
-
- /**
- * returns url for connected LonCapa course
- *
- * @param string $module_id LonCapa ID
- * @param string $course_id Stud.IP course ID
- * @return string url for LonCapa
- */
- public function getRedirectUrl($module_id, $course_id)
- {
- return sprintf(
- '%s/enter/%s?token=%s&courseid=%s&systemid=%s',
- $this->cms_link,
- $module_id,
- Token::create(60),
- $course_id,
- $this->cms_type
- );
- }
-}
diff --git a/lib/elearning/LonCapaContentModule.php b/lib/elearning/LonCapaContentModule.php
deleted file mode 100644
index 0f16cd0..0000000
--- a/lib/elearning/LonCapaContentModule.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/**
- *
- * This class contains methods to handle LonCapa learning modules
- *
- * @modulegroup elearning_interface_modules
- * @module LonCapaContentModule
- * @package ELearning-Interface
- */
-
-class LonCapaContentModule extends ContentModule
-{
- /**
- * @var LonCapaRequest
- */
- public $lcRequest;
- /**
- * @var string
- */
- public $cmsUrl;
-
- /**
- * LonCapaContentModule constructor.
- * @param string $module_id
- * @param string $module_type
- * @param string $cms_type
- */
- public function __construct($module_id, $module_type, $cms_type)
- {
- $this->lcRequest = new LonCapaRequest();
- $this->cmsUrl = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$cms_type]['ABSOLUTE_PATH_ELEARNINGMODULES'];
-
- parent::__construct($module_id, $module_type, $cms_type);
- }
-
- /**
- *fetch data from LonCapa
- *
- */
- public function readData()
- {
- $url = $this->cmsUrl . '/course/' . urlencode($this->id);
- $response = $this->lcRequest->request($url);
-
- if ($response) {
- $courses = new SimpleXMLElement($response);
- $course = $courses->course[0];
-
- list($author, $dummy) = explode(':', (string)$course->owner);
-
- $this->id = (string)$course->id;
- $this->title = (string)$course->description;
- $this->authors = $author;
- }
-
- }
-
- /**
- * get permission-status
- *
- *
- * @param string $operation operation
- * @return boolean allowed
- */
- public function isAllowed($operation)
- {
- return true;
- }
-
- /**
- * store connection between Stud.IP course and LonCapa course
- *
- * @param string $seminar_id
- * @return bool
- */
- public function setConnection($seminar_id)
- {
- $this->is_connected = true;
- return ObjectConnections::setConnection(
- $seminar_id,
- $this->id,
- $this->module_type,
- $this->cms_type
- );
- }
-}
diff --git a/lib/elearning/LonCapaRequest.php b/lib/elearning/LonCapaRequest.php
deleted file mode 100644
index ecf3075..0000000
--- a/lib/elearning/LonCapaRequest.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-/**
- *
- * This class is used to communicate with LonCapa
- *
- * @depends curl
- * @modulegroup elearning_interface_modules
- * @module LonCapaContentModule
- * @package ELearning-Interface
- */
-class LonCapaRequest
-{
- /**
- * options for curl
- * @var array
- */
- protected $options;
- /**
- * curl resource
- * @var resource
- */
- protected $ch;
-
- /**
- * LonCapaRequest constructor.
- */
- public function __construct()
- {
- $this->ch = curl_init();
- $this->initOptions();
- }
-
- /**
- * initializes curl options
- */
- public function initOptions()
- {
- $this->options = [
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_FOLLOWLOCATION => true,
- //CURLOPT_CAINFO => '',
- CURLOPT_SSL_VERIFYPEER => false,
- CURLOPT_SSL_VERIFYHOST => false
- ];
- }
-
- /**
- * close connection
- */
- public function __destruct()
- {
- curl_close($this->ch);
- }
-
- /**
- * set curl options
- * @param $key
- * @param $value
- */
- public function setOption($key, $value)
- {
- $this->options[$key] = $value;
- }
-
- /**
- * do a curl request on the given url and return the result if successfull
- *
- * @param $url string
- * @param array $postfields
- * @return string
- */
- public function request($url, $postfields = null)
- {
- $result = $this->sendRequest($url, $postfields);
- if ($result['statusCode'] == 200) {
- return $result['response'];
- } else {
- // TODO: fehlermeldung wäre schöner
- return null;
- }
- }
-
- /**
- * do a curl request on the given url and return the result if successfull
- * @param $url string
- * @param array $postfields
- * @return array
- */
- protected function sendRequest($url, $postfields = null)
- {
- $options = $this->options;
- $options[CURLOPT_URL] = $url;
-
- if ($postfields) {
- $options[CURLOPT_POST] = true;
- $options[CURLOPT_POSTFIELDS] = $postfields;
- }
-
- curl_setopt_array($this->ch, $options);
- $response = curl_exec($this->ch);
-
- $statusCode = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
-
- if ($response === false) {
- $last_error = curl_error($this->ch);
- Log::error(__CLASS__ . ' curl_exec failed: ' . $last_error);
- }
- return compact('statusCode', 'response');
- }
-}
diff --git a/lib/elearning/ObjectConnections.php b/lib/elearning/ObjectConnections.php
deleted file mode 100644
index e360f71..0000000
--- a/lib/elearning/ObjectConnections.php
+++ /dev/null
@@ -1,254 +0,0 @@
-<?php
-# Lifter002: DONE
-# Lifter003: TEST
-# Lifter007: TODO
-# Lifter010: TODO
-/**
-* class to handle object connections
-*
-* This class contains methods to handle connections between stud.ip-objects and external content.
-*
-* @author Arne Schröder <schroeder@data-quest.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module ObjectConnections
-* @package ELearning-Interface
-*/
-class ObjectConnections
-{
- var $id;
- var $object_connections;
- /**
- * constructor
- *
- * init class.
- * @access public
- * @param string $object_id object-id
- */
- function __construct($object_id = "")
- {
- $this->id = $object_id;
- if ($object_id != "")
- $this->readData();
- }
-
- /**
- * read object connections
- *
- * gets object connections from database
- * @access public
- */
- function readData()
- {
- global $ELEARNING_INTERFACE_MODULES;
-
- $this->object_connections = [];
-
- $query = "SELECT system_type, module_type, module_id, chdate
- FROM object_contentmodules
- WHERE object_id = ?
- ORDER BY chdate DESC";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$this->id]);
-
- $module_count = 0;
- while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
- // show only connected modules with valid module-type
- if ($ELEARNING_INTERFACE_MODULES[$row['system_type']]['types'][$row['module_type']] == '') {
- continue;
- }
- $module_count += 1;
- $d_system_type = $row['system_type'];
- $d_module_type = $row['module_type'];
- $d_module_id = $row['module_id'];
-
- $reference = $d_system_type . '_' . $d_module_type . '_' . $d_module_id;
- $this->object_connections[$reference]['cms'] = $d_system_type;
- $this->object_connections[$reference]['type'] = $d_module_type;
- $this->object_connections[$reference]['id'] = $d_module_id;
- $this->object_connections[$reference]['chdate'] = $row['chdate'];
- }
-
- if ($module_count == 0) {
- $this->object_connections = false;
- }
- }
-
- /**
- * get object connections
- *
- * returns object connections
- * @access public
- * @return array object connections
- */
- function getConnections()
- {
- return $this->object_connections;
- }
-
- /**
- * get connection-status
- *
- * returns true, if object has connections
- * @access public
- * @return boolean connection-status
- */
- function isConnected()
- {
- return (boolean) $this->object_connections;
- }
-
- /**
- * get connection-status
- *
- * returns true, if object has connections
- * @access public
- * @param string $object_id object-id (optional)
- * @return boolean connection-status
- */
- public static function isObjectConnected($object_id)
- {
- $query = "SELECT 1 FROM object_contentmodules WHERE object_id = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$object_id]);
- return (bool)$statement->fetchColumn();
- }
-
- /**
- * get module-id
- *
- * returns module-id of given connection
- * @access public
- * @param string $connection_object_id object-id
- * @param string $connection_module_type module-type
- * @param string $connection_cms system-type
- * @return string module-id
- */
- public static function getConnectionModuleId($connection_object_id, $connection_module_type, $connection_cms)
- {
- $query = "SELECT module_id
- FROM object_contentmodules
- WHERE object_id = ? AND system_type = ? AND module_type = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([
- $connection_object_id,
- $connection_cms,
- $connection_module_type
- ]);
- return $statement->fetchColumn() ?: false;
- }
-
- /**
- * set connection
- *
- * sets connection with object
- * @access public
- * @param string $connection_object_id object-id
- * @param string $connection_module_id module-id
- * @param string $connection_module_type module-type
- * @param string $connection_cms system-type
- * @return boolean successful
- */
- public static function setConnection($connection_object_id, $connection_module_id, $connection_module_type, $connection_cms)
- {
- $query = "SELECT 1
- FROM object_contentmodules
- WHERE object_id = ? AND module_id = ? AND system_type = ?
- AND module_type = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([
- $connection_object_id,
- $connection_module_id,
- $connection_cms,
- $connection_module_type
- ]);
- $check = $statement->fetchColumn();
-
- if ($check) {
- $query = "UPDATE object_contentmodules
- SET module_type = ?, chdate = UNIX_TIMESTAMP()
- WHERE object_id = ? AND module_id = ? AND system_type = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([
- $connection_module_type,
- $connection_object_id,
- $connection_module_id,
- $connection_cms
- ]);
- } else {
- $query = "INSERT INTO object_contentmodules
- (object_id, module_id, system_type, module_type, mkdate, chdate)
- VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([
- $connection_object_id,
- $connection_module_id,
- $connection_cms,
- $connection_module_type
- ]);
- }
- return true;
- }
-
- /**
- * unset connection
- *
- * deletes connection with object
- * @access public
- * @param string $connection_object_id object-id
- * @param string $connection_module_id module-id
- * @param string $connection_module_type module-type
- * @param string $connection_cms system-type
- * @return boolean successful
- */
- public static function unsetConnection($connection_object_id, $connection_module_id, $connection_module_type, $connection_cms)
- {
- $query = "SELECT 1
- FROM object_contentmodules
- WHERE object_id = ? AND module_id = ? AND system_type = ?
- AND module_type = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([
- $connection_object_id,
- $connection_module_id,
- $connection_cms,
- $connection_module_type
- ]);
- $check = $statement->fetchColumn();
-
-
- if ($check) {
- $query = "DELETE FROM object_contentmodules
- WHERE object_id = ? AND module_id = ? AND system_type = ?
- AND module_type = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([
- $connection_object_id,
- $connection_module_id,
- $connection_cms,
- $connection_module_type
- ]);
- return true;
- }
- return false;
- }
-
- public static function GetConnectedSystems($object_id)
- {
- $query = "SELECT DISTINCT system_type
- FROM object_contentmodules
- WHERE object_id = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$object_id]);
- return $statement->fetchAll(PDO::FETCH_COLUMN);
- }
-
- public static function DeleteAllConnections($object_id, $cms_type)
- {
- $query = "DELETE FROM object_contentmodules
- WHERE object_id = ? AND system_type = ?";
- $statement = DBManager::get()->prepare($query);
- $statement->execute([$object_id, $cms_type]);
- return $statement->rowCount();
- }
-}
diff --git a/lib/elearning/PmWikiConnectedCMS.php b/lib/elearning/PmWikiConnectedCMS.php
deleted file mode 100644
index d890126..0000000
--- a/lib/elearning/PmWikiConnectedCMS.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/*
- * PmWikiConnectedCMS.php - Provides search capabilities
- * to search WikiFarm
- *
- * Copyright (C) 2006 - Marco Diedrich (mdiedric@uos.de)
- *
- * 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.
- */
-
-require_once 'clients/xml_rpc_webservice_client.php';
-require_once 'clients/soap_webservice_client.php';
-require_once 'clients/webservice_client.php';
-
-/**
-* main-class for connection to PmWiki
-*
-* This class contains the main methods of the elearning-interface to connect to PmWiki. Extends ConnectedCMS.
-*
-* @author Marco Diedrich <mdiedric@uos.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module PmWikiConnectedCMS
-* @package ELearning-Interface
-*/
-
-class PmWikiConnectedCMS extends ConnectedCMS
-{
- public $client;
- public $api_key;
- public $field_script;
-
- function __construct($cms)
- {
- parent::__construct($cms);
- $this->client = WebserviceClient::instance( $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['ABSOLUTE_PATH_SOAP'] .
- '?' . $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['URL_PARAMS'],
- $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['WEBSERVICE_CLASS']);
-
- $this->api_key = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'];
- }
-
- function init($cms)
- {
- parent::init($cms);
- $this->field_script = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$cms]["field_script"];
- }
-
- /**
- * search for content modules
- *
- * returns found content modules
- * @param string $key keyword
- * @return array list of content modules
- */
- public function searchContentModules($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' => null,
- 'create_date' => $field['create_date'],
- 'last_update' => $field['change_date'],
- 'title' => $field['field_title'],
- 'description' => $field['field_description'],
- ];
- }
- return $result;
- }
-
-}
diff --git a/lib/elearning/PmWikiConnectedLink.php b/lib/elearning/PmWikiConnectedLink.php
deleted file mode 100644
index 973c272..0000000
--- a/lib/elearning/PmWikiConnectedLink.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/*
- * PmWikiConnectedLink.php - Provides links to PmWiki Modules
- *
- * Copyright (C) 2006 - Marco Diedrich (mdiedric@uos.de)
- *
- * 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.
- */
-
-use Studip\Button, Studip\LinkButton;
-
-require_once 'lib/webservices/api/studip_seminar.php';
-
-/**
-*
-* This class contains methods to generate links to PmWiki-Farm
-*
-* @author Marco Diedrich <mdiedric@uos.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module PmWikiConnectedLink
-* @package ELearning-Interface
-*/
-
-class PmWikiConnectedLink extends ConnectedLink
-{
- function __construct($cms)
- {
- parent::__construct($cms);
- $this->cms_link = "pmwiki_referrer.php";
- }
-
- /**
- * get user module links
- *
- * returns content module links for user
- * @access public
- * @return string html-code
- */
-
- function getUserModuleLinks()
- {
- $range_id = Context::getId();
- $username = get_username($GLOBALS['auth']->auth['uid']);
-
- global $connected_cms, $view, $search_key, $cms_select, $current_module;
-
- // hier muss die Authentifizierung mit übergeben werden...
- //
- if (Context::isCourse()) {
- $context = 'seminar';
-
- $status = StudipSeminarHelper::get_user_status($username, $range_id);
-
- } else if (Context::isInstitute()) {
- $context = 'institute';
-
- $status = StudipInstituteHelper::get_user_status($username, $range_id);
- }
-
- ob_start(); ?>
- <form method="post" target="_blank" rel="noopener noreferrer"
- action="<?= $connected_cms[$this->cms_type]->content_module[$current_module]->link ?>">
-
- <?= CSRFProtection::tokenTag() ?>
- <input type='hidden' name='authid' value='<?= htmlReady($GLOBALS['auth']->auth['uname']) ?>'>
- <input type='hidden' name='authpw' value='<?= htmlReady(Token::create()) ?>'>
- <input type='hidden' name='_permission' value='<?= htmlReady($status) ?>'>
- <input type='hidden' name='_range_id' value='<?= htmlReady($range_id) ?>'>
- <input type='hidden' name='_server' value='<?= htmlReady(Config::get()->STUDIP_INSTALLATION_ID) ?>'>
- <input type='hidden' name='_context' value='<?= htmlReady($context) ?>'>
- <?= Button::createAccept(_('Starten')) ?>
-
- </form>
-
- <?php
-
- $output = ob_get_contents();
- ob_end_clean();
- return $output;
- }
-
- /**
- * get admin module links
- *
- * returns links add or remove a module from course
- * @access public
- * @return string returns html-code
- */
-
- function getAdminModuleLinks()
- {
- global $connected_cms, $view, $search_key, $cms_select, $current_module;
-
- ob_start(); ?>
-
- <form method="post" action="<?= URLHelper::getLink() ?>">
- <?= CSRFProtection::tokenTag() ?>
- <input type="hidden" name="view" value="<?= htmlReady($view) ?>">
- <input type="hidden" name="search_key" value="<?= htmlReady($search_key) ?>">
- <input type="hidden" name="cms_select" value="<?= htmlReady($cms_select) ?>">
- <input type="hidden" name="module_type" value="wiki">
- <input type="hidden" name="module_id" value="<?= htmlReady($current_module) ?>">
- <input type="hidden" name="module_system_type" value="<?= htmlReady($this->cms_type) ?>">
-
- <?php if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) : ?>
-
- &nbsp;<?= Button::create(_('Entfernen'), 'remove') ?>
-
- <?php else :?>
-
- &nbsp;<?= Button::create(_('Hinzufügen'), 'add') ?>
-
- <?php endif ; ?>
-
- </form>
- <?php
-
- $output = ob_get_contents();
-
- ob_end_clean();
-
- return $output;
- }
-
-}
diff --git a/lib/elearning/PmWikiContentModule.php b/lib/elearning/PmWikiContentModule.php
deleted file mode 100644
index fb3cccd..0000000
--- a/lib/elearning/PmWikiContentModule.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-/*
- * PmWikiContentModule.php - Provides access PmWiki Modules
- *
- * Copyright (C) 2006 - Marco Diedrich (mdiedric@uos.de)
- *
- * 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.
- */
-
-/**
-*
-* This class contains methods to handle PmWiki learning modules
-*
-* @author Marco Diedrich <mdiedric@uos.de>
-* @access public
-* @modulegroup elearning_interface_modules
-* @module PmWikiContentModule
-* @package ELearning-Interface
-*/
-
-class PmWikiContentModule extends ContentModule
-{
- public $link;
- public $client;
- public $chdate;
- public $accepted_users;
-
- /**
- * constructor
- *
- * init class.
- * @access public
- * @param string $module_id module-id
- * @param string $module_type module-type
- * @param string $cms_type system-type
- */
-
- function __construct($module_id, $module_type, $cms_type)
- {
- parent::__construct($module_id, $module_type, $cms_type);
- $this->link = $GLOBALS['connected_cms'][$this->cms_type]->ABSOLUTE_PATH_ELEARNINGMODULES.$this->id."/";
- $this->client = WebserviceClient::instance( $this->link. '?' .
- $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['URL_PARAMS'],
- $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['WEBSERVICE_CLASS']);
- }
-
- /**
- * reads data for content module
- *
- */
-
- function readData()
- {
- global $connected_cms, $view, $search_key, $cms_select, $current_module;
-
- $args = [$GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'], $this->id];
-
- $field_data = $connected_cms[$this->cms_type]->client->call('get_field_info', $args);
-
- $this->title = $field_data['field_title'];
- $this->authors = $field_data['field_author'];
- $this->chdate = $field_data['change_date'];
-
- $this->accepted_users = $field_data['field_accepted_users'];
-
- return false;
- }
-
- /**
- * get permission-status
- *
- * returns true, if operation is allowed
- * @access public
- * @param string $operation operation
- * @return boolean allowed
- */
-
- function isAllowed($operation)
- {
- global $connected_cms, $view, $search_key, $cms_select, $current_module;
-
- if (Config::get()->STUDIP_INSTALLATION_ID)
- {
- $username = Config::get()->STUDIP_INSTALLATION_ID."#".$GLOBALS['auth']->auth['uname'];
- } else
- {
- $username = $GLOBALS['auth']->auth['uname'];
- }
-
- $args = [$GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'],$this->id, $username];
-
- $authorized = $connected_cms[$this->cms_type]->client->call('field_accessable_by_user', $args);
-
- if ($authorized)
- {
- return true;
- } else
- {
- # old authorization
- if (is_array($this->accepted_users) && in_array($username, $this->accepted_users))
- return true;
- else
- return false;
- }
-
- }
-}
diff --git a/lib/elearning/clients/soap_webservice_client.php b/lib/elearning/clients/soap_webservice_client.php
deleted file mode 100644
index 9c392a8..0000000
--- a/lib/elearning/clients/soap_webservice_client.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-require_once 'webservice_client.php';
-require_once 'vendor/nusoap/nusoap.php';
-
-class Soap_WebserviceClient extends WebserviceClient
-{
- private $client;
-
- public function __construct($webservice_url)
- {
- $this->client = new soap_client($webservice_url);
- $this->client->response_timeout = 7600;
- }
-
- public function &call($method_name, &$args)
- {
- $result = $this->client->call($method_name, $args);
- return $result;
- }
-}
diff --git a/lib/elearning/clients/webservice_client.php b/lib/elearning/clients/webservice_client.php
deleted file mode 100644
index a7f97f2..0000000
--- a/lib/elearning/clients/webservice_client.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-class WebserviceClient
-{
- public static function instance($webservice_url, $classname)
- {
- static $instances = [];
-
- if (!isset($instances[$classname . $webservice_url])) {
- $instances[$classname . $webservice_url] = new $classname($webservice_url);
- }
-
- return $instances[$classname . $webservice_url];
- }
-
- public function __construct()
- {
- trigger_error("this class can't be instantiated");
- }
-
- public function &call($method_name, &$args)
- {
- trigger_error("WebserviceCaller::WebserviceCaller:: call not defined");
- }
-}
diff --git a/lib/elearning/clients/xml_rpc_webservice_client.php b/lib/elearning/clients/xml_rpc_webservice_client.php
deleted file mode 100644
index 2e24e41..0000000
--- a/lib/elearning/clients/xml_rpc_webservice_client.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-
-require_once __DIR__ . '/webservice_client.php';
-
-class XML_RPC_WebserviceClient extends WebserviceClient
-{
- private $client;
-
- public function __construct($webservice_url)
- {
- $this->client = new xmlrpc_client($webservice_url);
- $this->client->debug = false;
- $this->client->return_type = 'phpvals';
-
- }
-
- public function &call($method_name, &$args)
- {
- $xmlrpc_args = [];
- foreach ($args as $arg)
- {
- $xmlrpc_args[] = php_xmlrpc_encode($arg);
- }
-
- $xmlrpc_return = $this->client->send(new xmlrpcmsg($method_name, $xmlrpc_args), 300);
- $xmlrpc_result = $xmlrpc_return->value();
- return $xmlrpc_result;
- }
-}
diff --git a/lib/soap/StudipSoapClient_PHP5.php b/lib/ilias_interface/StudipSoapClient.php
index 0aafd4a..0aafd4a 100644
--- a/lib/soap/StudipSoapClient_PHP5.php
+++ b/lib/ilias_interface/StudipSoapClient.php
diff --git a/lib/elearning/studip_referrer_7x.php b/lib/ilias_interface/studip_referrer_7x.php
index e367569..e367569 100644
--- a/lib/elearning/studip_referrer_7x.php
+++ b/lib/ilias_interface/studip_referrer_7x.php
diff --git a/lib/elearning/studip_referrer_8x.php b/lib/ilias_interface/studip_referrer_8x.php
index f7552af..f7552af 100644
--- a/lib/elearning/studip_referrer_8x.php
+++ b/lib/ilias_interface/studip_referrer_8x.php
diff --git a/lib/models/Course.php b/lib/models/Course.php
index b252063..25350db 100644
--- a/lib/models/Course.php
+++ b/lib/models/Course.php
@@ -337,18 +337,6 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
$query = 'DELETE FROM `schedule_courses` WHERE `course_id` = ?';
$statement = DBManager::get()->execute($query, [$course->id]);
- //Remove connections to other e-learning systems:
- if (Config::get()->ELEARNING_INTERFACE_ENABLE) {
- $cms_types = ObjectConnections::GetConnectedSystems($course->id);
- foreach ($cms_types as $system) {
- if (empty($GLOBALS['connected_cms'][$system])) {
- continue;
- }
- ELearningUtils::loadClass($system);
- $del_cms += $GLOBALS['connected_cms'][$system]->deleteConnectedModules($course->id);
- }
- }
-
//Remove all entries in object_user_vists for the course:
object_kill_visits(null, $course->id);
diff --git a/lib/modules/CoreElearningInterface.php b/lib/modules/CoreElearningInterface.php
deleted file mode 100644
index a5f7119..0000000
--- a/lib/modules/CoreElearningInterface.php
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-
-/*
- * Copyright (c) 2012 Rasmus Fuhse <fuhse@data-quest.de>
- *
- * 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.
- */
-
-class CoreElearningInterface extends CorePlugin implements StudipModule
-{
- /**
- * {@inheritdoc}
- */
- public function getIconNavigation($course_id, $last_visit, $user_id)
- {
- if (!Config::get()->ELEARNING_INTERFACE_ENABLE) {
- return null;
- }
-
- $sql = "SELECT COUNT(module_id) AS count,
- 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
- AND a.module_type != 'crs'
- 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 (!empty($result)) {
- $nav = new Navigation(_('Lernmodule'), 'dispatch.php/course/elearning/show');
- if ($result['neue']) {
- $nav->setImage(Icon::create('learnmodule', Icon::ROLE_ATTENTION), [
- 'title' => sprintf(
- ngettext(
- '%1$d Lernmodul, %2$d neues',
- '%1$d Lernmodule, %2$d neue',
- $result['count']
- ),
- $result['count'],
- $result['neue']
- )
- ]);
- } elseif ($result['count']) {
- $nav->setImage(Icon::create('learnmodule', Icon::ROLE_CLICKABLE), [
- 'title' => sprintf(
- ngettext(
- '%d Lernmodul',
- '%d Lernmodule',
- $result['count']
- ),
- $result['count']
- )
- ]);
- }
- return $nav;
- }
-
- return null;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getTabNavigation($course_id)
- {
- if (!Config::get()->ELEARNING_INTERFACE_ENABLE) {
- return null;
- }
-
- $navigation = new Navigation(_('Lernmodule'));
- $navigation->setImage(Icon::create('learnmodule', Icon::ROLE_INFO_ALT));
- $navigation->setActiveImage(Icon::create('learnmodule', Icon::ROLE_INFO));
-
- if (ObjectConnections::isObjectConnected($course_id)) {
- $elearning_nav = new Navigation(_('Lernmodule dieser Veranstaltung'), 'dispatch.php/course/elearning/show?seminar_id=' . $course_id);
-
- if (get_object_type($course_id, ['inst'])) {
- $elearning_nav->setTitle(_('Lernmodule dieser Einrichtung'));
- }
-
- $navigation->addSubNavigation('show', $elearning_nav);
- }
-
- if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id)) {
- $navigation->addSubNavigation('edit', new Navigation(_('Lernmodule hinzufügen / entfernen'), 'dispatch.php/course/elearning/edit?seminar_id=' . $course_id));
- }
-
- return ['elearning' => $navigation];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetadata()
- {
- return [
- 'summary' => _('Zugang zu extern erstellten Lernmodulen'),
- 'description' => _('Über diese Schnittstelle ist es möglich, '.
- 'Selbstlerneinheiten, die in externen Programmen erstellt '.
- 'werden, in Stud.IP zur Verfügung zu stellen. Ein häufig '.
- 'angebundenes System ist ILIAS. Besteht eine Anbindung zu '.
- 'einem ILIAS-System, haben Lehrende die Möglichkeit, in '.
- 'ILIAS Selbstlerneinheiten zu erstellen und in Stud.IP '.
- 'bereit zu stellen.'),
- 'displayname' => _('Lernmodulschnittstelle'),
- 'category' => _('Inhalte und Aufgabenstellungen'),
- 'keywords' => _('Einbindung z. B. von ILIAS-Lerneinheiten;
- Zugang zu externen Lernplattformen;
- Aufgaben- und Test-Erstellung'),
- 'icon' => Icon::create('learnmodule', Icon::ROLE_INFO),
- 'icon_clickable' => Icon::create('learnmodule', Icon::ROLE_CLICKABLE),
- 'descriptionshort' => _('Zugang zu extern erstellten Lernmodulen'),
- 'descriptionlong' => _('Über diese Schnittstelle ist es möglich, Selbstlerneinheiten, '.
- 'die in externen Programmen erstellt werden, in Stud.IP zur Verfügung '.
- 'zu stellen. Ein häufig angebundenes System ist ILIAS. Besteht eine '.
- 'Anbindung zu einem ILIAS-System, haben Lehrende die Möglichkeit, in '.
- 'ILIAS Selbstlerneinheiten zu erstellen und in Stud.IP bereit zu stellen.')
- ];
- }
-
- public function isActivatableForContext(Range $context)
- {
- return Config::get()->ELEARNING_INTERFACE_ENABLE && $context->getRangeType() === 'course';
- }
-
- public function getInfoTemplate($course_id)
- {
- // TODO: Implement getInfoTemplate() method.
- return null;
- }
-}
diff --git a/lib/navigation/AdminNavigation.php b/lib/navigation/AdminNavigation.php
index e078283..1b86ca11 100644
--- a/lib/navigation/AdminNavigation.php
+++ b/lib/navigation/AdminNavigation.php
@@ -193,10 +193,6 @@ class AdminNavigation extends Navigation
}
$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()->CRONJOBS_ENABLE) {
$navigation->addSubNavigation('cronjobs', new Navigation(_('Cronjobs'), 'dispatch.php/admin/cronjobs/schedules'));
}
diff --git a/lib/navigation/ContentsNavigation.php b/lib/navigation/ContentsNavigation.php
index a00adb6..0d75b3f 100644
--- a/lib/navigation/ContentsNavigation.php
+++ b/lib/navigation/ContentsNavigation.php
@@ -124,14 +124,6 @@ class ContentsNavigation extends Navigation
}
}
- // elearning
- if (Config::get()->ELEARNING_INTERFACE_ENABLE) {
- $elearning = new Navigation(_('Lernmodule'), 'dispatch.php/elearning/my_accounts');
- $elearning->setImage(Icon::create('learnmodule'));
- $elearning->setDescription(_('Zugang zu externen Lernmaterialien'));
- $this->addSubNavigation('my_elearning', $elearning);
- }
-
if (!$GLOBALS['perm']->have_perm('root') && $GLOBALS['user']->getAuthenticatedUser()->hasRole('Hilfe-Administrator(in)')) {
$help = new Navigation(_('Hilfe'), 'dispatch.php/help_content/admin_overview');
$help->setImage(Icon::create('question-circle'));
diff --git a/lib/navigation/StartNavigation.php b/lib/navigation/StartNavigation.php
index 0a6d52a..94881c8 100644
--- a/lib/navigation/StartNavigation.php
+++ b/lib/navigation/StartNavigation.php
@@ -232,11 +232,6 @@ class StartNavigation extends Navigation
$navigation->addSubNavigation('questionnaire', new Navigation(_('Ankündigungen'), 'dispatch.php/news/admin_news'));
}
- // elearning
- if (Config::get()->ELEARNING_INTERFACE_ENABLE) {
- $navigation->addSubNavigation('my_elearning', new Navigation(_('Lernmodule'), 'dispatch.php/elearning/my_accounts'));
- }
-
if (!$GLOBALS['perm']->have_perm('root') && $GLOBALS['user']->getAuthenticatedUser()->hasRole('Hilfe-Administrator(in)')) {
$navigation->addSubNavigation('help_content', new Navigation(_('Hilfe-Texte und Touren'), 'dispatch.php/help_content/admin_overview'));
}
diff --git a/lib/soap/StudipSoapClient.php b/lib/soap/StudipSoapClient.php
deleted file mode 100644
index f6c0cad..0000000
--- a/lib/soap/StudipSoapClient.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-class StudipSoapClient
-{
- var $soap_client;
- var $error;
- var $faultstring;
-
- function __construct($path)
- {
- require_once("vendor/nusoap/nusoap.php");
-
- $this->soap_client = new soap_client($path, true);
- $this->soap_client->soap_defencoding = 'UTF-8';
- $this->soap_client->decode_utf8 = false;
- $this->soap_client->setDebugLevel(0);
-
- $err = $this->soap_client->getError();
- if ($err)
- $this->error = "<b>Soap Constructor Error</b><br>" . $err . "<br><br>";
- }
-
- function _call($method, $params)
- {
- $this->faultstring = "";
- $result = $this->soap_client->call($method, $params);
-
- if ($this->soap_client->fault)
- {
- $this->faultstring = $result["faultstring"];
- if (!in_array(mb_strtolower($this->faultstring), ["session not valid","session invalid", "session idled"]))
- $this->error .= "<b>" . sprintf(_("SOAP-Fehler, Funktion \"%s\":"), $method) . "</b> " . $result["faultstring"] . " (" . $result["faultcode"] . ")<br>";
- } else {
- $err = $this->soap_client->getError();
- if ($err) {
- $this->error .= "<b>" . sprintf(_("SOAP-Fehler, Funktion \"%s\":"), $method) . "</b> " . $err . "<br>";
- } else {
- return $result;
- }
- }
- error_log($this->error);
- return false;
- }
-
- function getError()
- {
- $error = $this->error;
- $this->error = "";
- if ($error != "")
- return $error;
- else
- return false;
- }
-}
-?>
diff --git a/public/admin_elearning_interface.php b/public/admin_elearning_interface.php
deleted file mode 100644
index 24eb47c..0000000
--- a/public/admin_elearning_interface.php
+++ /dev/null
@@ -1,196 +0,0 @@
-<?
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-// +---------------------------------------------------------------------------+
-// This file is part of Stud.IP
-// admin_elearning_interface.php
-//
-// Copyright (c) 2005 Arne Schroeder <schroeder@data-quest.de>
-// Suchi & Berg GmbH <info@data-quest.de>
-// +---------------------------------------------------------------------------+
-// 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 any later version.
-// +---------------------------------------------------------------------------+
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// +---------------------------------------------------------------------------+
-
-use Studip\Button, Studip\LinkButton;
-
-require '../lib/bootstrap.php';
-
-page_open(["sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", 'user' => "Seminar_User"]);
-$GLOBALS['perm']->check("root");
-
-include 'lib/seminar_open.php'; // initialise Stud.IP-Session
-// -- here you have to put initialisations for the current page
-
-PageLayout::setHelpKeyword("Basis.Ilias");
-PageLayout::setTitle(_("Verwaltung der Lernmodul-Schnittstelle"));
-Navigation::activateItem('/admin/config/elearning');
-
-ob_start();
-
-$cms_select = Request::get('cms_select');
-
-if (Config::get()->ELEARNING_INTERFACE_ENABLE)
-{
- $connection_status = [];
- $connected_cms = [];
- if ($cms_select != "" && isset($ELEARNING_INTERFACE_MODULES[$cms_select]))
- {
- $connected_cms[$cms_select] = new ConnectedCMS();
- $connection_status = $connected_cms[$cms_select]->getConnectionStatus($cms_select);
- if (Request::submitted('activate'))
- {
- ELearningUtils::setConfigValue("ACTIVE", "1", $cms_select);
- }
- if (Request::submitted('deactivate'))
- {
- ELearningUtils::setConfigValue("ACTIVE", "0", $cms_select);
- }
- if (!count(array_column($connection_status, 'error')))
- {
- require_once ("lib/elearning/" . $ELEARNING_INTERFACE_MODULES[$cms_select]["CLASS_PREFIX"] . "ConnectedCMS.php");
- $classname = $ELEARNING_INTERFACE_MODULES[$cms_select]["CLASS_PREFIX"] . "ConnectedCMS";
- $connected_cms[$cms_select] = new $classname($cms_select);
- $connected_cms[$cms_select]->initSubclasses();
- }
- } else {
- unset($cms_select);
- }
-
- if (!empty($messages["error"])) {
- PageLayout::postError($messages["error"]);
- }
- if (!empty($messages["info"])) {
- PageLayout::postInfo($messages["info"]);
- }
-
- echo ELearningUtils::getCMSSelectbox(_("Bitte wählen Sie ein angebundenes System für die Schnittstelle: "), false) . "\n\n<br><br>";
-
- if (!empty($cms_select)) {
- echo "<table>";
- $error_count = 0;
- foreach ($connection_status as $type => $msg)
- {
- if ($msg["error"] != "")
- {
- echo "<tr><td valign=\"middle\">" . Icon::create('decline', Icon::ROLE_ATTENTION)->asImg(['class' => 'text-top', 'title' => _('Fehler')]) . $msg["error"] . "</td></tr>";
- $error_count++;
- }
- else
- echo "<tr><td valign=\"middle\">" . Icon::create('accept', Icon::ROLE_ACCEPT)->asImg(['class' => 'text-top', 'title' => _('OK')]) . $msg["info"] . "</td></tr>";
- }
- echo "<tr><td><br></td></tr>";
- if ($error_count > 0)
- {
- $status_info = "error";
- echo "<tr><td valign=\"middle\">" . Icon::create('decline', Icon::ROLE_ATTENTION)->asImg(['class' => 'text-top', 'title' => _('Fehler')]) . "<b>";
- echo _("Beim Laden der Schnittstelle sind Fehler aufgetreten. ");
- if (ELearningUtils::isCMSActive($cms_select))
- {
- ELearningUtils::setConfigValue("ACTIVE", "0", $cms_select);
- echo _("Die Schnittstelle wurde automatisch deaktiviert!");
- }
- echo "</b></td></tr>";
- }
- else
- echo "<tr><td valign=\"middle\">" . Icon::create('accept', Icon::ROLE_ACCEPT, ['title' => _('OK')])->asImg(['class' => 'text-top']) . "<b>" .sprintf( _("Die Schnittstelle zum %s-System ist korrekt konfiguriert."), $connected_cms[$cms_select]->getName()) . "</b></td></tr>";
- echo "</table>";
- echo "<br>\n";
- echo htmlReady(ELearningUtils::getCMSHeader(isset($connected_cms[$cms_select]) ? $connected_cms[$cms_select]->getName() : ''));
- echo "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\" class=\"default\">\n";
- echo CSRFProtection::tokenTag();
- echo '<fieldset>';
- if (ELearningUtils::isCMSActive($cms_select))
- {
- $status_info = "active";
- echo ELearningUtils::getHeader(_("Status"));
- echo "<br>\n";
- echo _("Die Schnittstelle ist <b>aktiv</b>.");
- echo "<br><br>\n";
- echo _("Hier können Sie die Schnittstelle deaktivieren.");
- echo "<br><br>\n";
- echo Button::create(_('Deaktivieren'), 'deactivate');
- }
- else
- {
- echo ELearningUtils::getHeader(_("Status"));
- echo "<br>\n";
- echo _("Die Schnittstelle ist nicht aktiv.");
- echo "<br><br>\n";
- if ($error_count == 0)
- {
- $status_info = "not active";
- echo _("Hier können Sie die Schnittstelle aktivieren.");
- echo "<br><br>\n";
- echo Button::create(_('Aktivieren'), 'activate');
- }
- }
- echo '</fieldset>';
- echo "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . $cms_select . "\">\n";
- echo "</form>";
- echo "<br>\n";
-
- echo "<form method=\"POST\" action=\"" . URLHelper::getURL() . "\" class=\"default\">\n";
- echo CSRFProtection::tokenTag();
- echo '<fieldset>';
- if ($error_count == 0)
- {
- echo ELearningUtils::getHeader(_("Einstellungen"));
- echo "<br>\n";
- $connected_cms[$cms_select]->getPreferences();
- }
- echo '</fieldset>';
- echo "<input type=\"hidden\" name=\"cms_select\" value=\"" . $cms_select . "\">\n";
- echo "</form>";
-
- echo ELearningUtils::getCMSFooter($connected_cms[$cms_select]->getLogo());
- }
-
- Helpbar::Get()->addPlainText(_('Information'), _('Hier können Sie angebundene Systeme verwalten.'), Icon::create('info'));
- Helpbar::Get()->addPlainText(_('Aktionen'), _('Nachdem Sie ein angebundenes System ausgewählt haben wird die Verbindung zum System geprüft.'), Icon::create('info'));
- // Anzeige, wenn noch keine Account-Zuordnung besteht
-
- switch ($status_info ?? null) {
- case "active":
- PageLayout::postSuccess(sprintf(_("Die Verbindung zum System \"%s\" ist <b>aktiv</b>. Sie können die Einbindung des Systems in Stud.IP jederzeit deaktivieren."), htmlReady($connected_cms[$cms_select]->getName())));
- break;
- case "not active":
- PageLayout::postWarning(sprintf(_("Die Verbindung zum System \"%s\" steht, das System ist jedoch nicht aktiviert. Sie können die Einbindung des Systems in Stud.IP jederzeit aktivieren. Solange die Verbindung nicht aktiviert wurde, werden die Module des Systems \"%s\" in Stud.IP nicht angezeigt."), htmlReady($connected_cms[$cms_select]->getName()), htmlReady($connected_cms[$cms_select]->getName())));
- break;
- case "error":
- PageLayout::postError(sprintf(_("Bei der Prüfung der Verbindung sind Fehler aufgetreten. Sie müssen zunächst die Einträge in der Konfigurationsdatei korrigieren, bevor das System angebunden werden kann."), $connected_cms[$cms_select]->getName()));
- break;
- }
-
-// terminate objects
- if (!empty($connected_cms))
- foreach($connected_cms as $system)
- $system->terminate();
-
-}
-else
-{
- PageLayout::postError(_("Die Schnittstelle für die Integration von Lernmodulen ist nicht aktiviert.
- Damit Lernmodule verwendet werden können, muss die Verbindung zu einem LCM-System in der Konfigurationsdatei von Stud.IP hergestellt werden.
- Wenden Sie sich bitte an den/die AdministratorIn."), [_("E-Learning-Schnittstelle nicht eingebunden")]);
-
-}
-
-
-$template = $GLOBALS['template_factory']->open('layouts/base.php');
-$template->content_for_layout = ob_get_clean();
-echo $template->render();
-
-page_close();
diff --git a/public/ilias3_referrer.php b/public/ilias3_referrer.php
deleted file mode 100644
index 82d9031..0000000
--- a/public/ilias3_referrer.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?
-# Lifter002: TODO
-# Lifter007: TODO
-# Lifter003: TODO
-# Lifter010: TODO
-// +---------------------------------------------------------------------------+
-// This file is part of Stud.IP
-// ilias3_referrer.php
-//
-// Copyright (c) 2005 Arne Schroeder <schroeder@data-quest.de>
-// Suchi & Berg GmbH <info@data-quest.de>
-// +---------------------------------------------------------------------------+
-// 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 any later version.
-// +---------------------------------------------------------------------------+
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// +---------------------------------------------------------------------------+
-
-require '../lib/bootstrap.php';
-
-ob_start();
-page_open(["sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", 'user' => "Seminar_User"]);
-$perm->check("autor");
-include 'lib/seminar_open.php'; // initialise Stud.IP-Session
-
-if (Config::get()->ELEARNING_INTERFACE_ENABLE) {
- ELearningUtils::bench("start");
-
- $cms_select = Request::quoted('cms_select');
- if (isset($ELEARNING_INTERFACE_MODULES[$cms_select]["name"])) {
- ELearningUtils::loadClass($cms_select);
- // init session now
- $sess_id = $connected_cms[$cms_select]->user->getSessionId();
- $connected_cms[$cms_select]->terminate();
- ob_end_clean();
- if (!$sess_id){
- $message = _("Login nicht möglich");
- $details = [];
- $details[] = sprintf(_("Automatischer Login für das System <b>%s</b> (Nutzername:%s) fehlgeschlagen."),
- htmlReady($connected_cms[$cms_select]->getName()),
- $connected_cms[$cms_select]->user->getUsername());
- $details[] = _("Dieser Fehler kann dadurch hervorgerufen werden, dass Sie Ihr Passwort geändert haben. In diesem Fall versuchen Sie bitte Ihren Account erneut zu verknüpfen.");
- $details[] = sprintf(_("%sZurück%s zu Meine Lernmodule"), '<a href="'.URLHelper::getLink("dispatch.php/elearning/my_accounts").'"><b>', '</b></a>');
-
- PageLayout::postError($message, $details);
- $template = $GLOBALS['template_factory']->open('layouts/base.php');
- $template->content_for_layout = ob_get_clean();
- $template->infobox = $infobox ? ['content' => $infobox] : null;
- echo $template->render();
- page_close();
- die;
- }
- $parameters = "?sess_id=$sess_id";
- $client_id = Request::get('client_id');
- if (!empty($client_id))
- $parameters .= "&client_id=$client_id";
- if (Request::get('target'))
- $parameters .= "&target=".Request::option('target');
- if (Request::get('ref_id'))
- $parameters .= "&ref_id=".Request::option('ref_id');
- if (Request::get('type'))
- $parameters .= "&type=".Request::option('type');
-
- // refer to studip_referrer.php
- header("Location: ".$ELEARNING_INTERFACE_MODULES[$cms_select]["ABSOLUTE_PATH_ELEARNINGMODULES"] . $ELEARNING_INTERFACE_MODULES[$cms_select]["target_file"] . $parameters);
- page_close();
- die;
- }
-}
-?>