// Suchi & Berg GmbH // +---------------------------------------------------------------------------+ // 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.class.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

"; if (!empty($cms_select)) { echo ""; $error_count = 0; foreach ($connection_status as $type => $msg) { if ($msg["error"] != "") { echo ""; $error_count++; } else echo ""; } echo ""; if ($error_count > 0) { $status_info = "error"; echo ""; } else echo ""; echo "
" . Icon::create('decline', Icon::ROLE_ATTENTION)->asImg(['class' => 'text-top', 'title' => _('Fehler')]) . $msg["error"] . "
" . Icon::create('accept', Icon::ROLE_ACCEPT)->asImg(['class' => 'text-top', 'title' => _('OK')]) . $msg["info"] . "

" . Icon::create('decline', Icon::ROLE_ATTENTION)->asImg(['class' => 'text-top', 'title' => _('Fehler')]) . ""; 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 "
" . Icon::create('accept', Icon::ROLE_ACCEPT, ['title' => _('OK')])->asImg(['class' => 'text-top']) . "" .sprintf( _("Die Schnittstelle zum %s-System ist korrekt konfiguriert."), $connected_cms[$cms_select]->getName()) . "
"; echo "
\n"; echo htmlReady(ELearningUtils::getCMSHeader(isset($connected_cms[$cms_select]) ? $connected_cms[$cms_select]->getName() : '')); echo "
\n"; echo CSRFProtection::tokenTag(); echo '
'; if (ELearningUtils::isCMSActive($cms_select)) { $status_info = "active"; echo ELearningUtils::getHeader(_("Status")); echo "
\n"; echo _("Die Schnittstelle ist aktiv."); echo "

\n"; echo _("Hier können Sie die Schnittstelle deaktivieren."); echo "

\n"; echo Button::create(_('Deaktivieren'), 'deactivate'); } else { echo ELearningUtils::getHeader(_("Status")); echo "
\n"; echo _("Die Schnittstelle ist nicht aktiv."); echo "

\n"; if ($error_count == 0) { $status_info = "not active"; echo _("Hier können Sie die Schnittstelle aktivieren."); echo "

\n"; echo Button::create(_('Aktivieren'), 'activate'); } } echo '
'; echo "\n"; echo "
"; echo "
\n"; echo "
\n"; echo CSRFProtection::tokenTag(); echo '
'; if ($error_count == 0) { echo ELearningUtils::getHeader(_("Einstellungen")); echo "
\n"; $connected_cms[$cms_select]->getPreferences(); } echo '
'; echo "\n"; echo "
"; 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 aktiv. 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();