/** * 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'); $style_setting = Request::option('style_setting'); $encrypt_passwords = Request::option('encrypt_passwords'); $this->soap_client->setCachingStatus(false); if ($cat_name != "") { $cat = $this->soap_client->getReferenceByTitle(trim($cat_name), "cat"); if ($cat == false) { $messages["error"] .= sprintf(_("Das Objekt mit dem Namen \"%s\" wurde im System %s nicht gefunden."), htmlReady($cat_name), htmlReady($this->getName())) . "<br>\n"; } if ($cat != "") { 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 == 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("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\"> "; 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\"> "; 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 "> " . _("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 "> " . _("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"; }
/** * check db-integrity * * checks if there are broken links in the database * @access public * @return boolean successful */ function checkIntegrity() { global $ELEARNING_INTERFACE_MODULES, $messages; $db = DBManager::get(); foreach ($ELEARNING_INTERFACE_MODULES as $cms_type => $data) { $cmsystems[$cms_type] = array(); } $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> </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 .= ELearningUtils::getCMSHeader($ELEARNING_INTERFACE_MODULES[$cms_type]["name"]); $output .= "<table>"; $output .= "<tr><td colspan=\"2\"> </td></tr>"; if (ELearningUtils::getConfigValue("ACTIVE", $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\"> </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\"> </td></tr>"; $output .= "</table>"; $output .= ELearningUtils::getCMSFooter($ELEARNING_INTERFACE_MODULES[$cms_type]["logo_file"] ? "<img src=\"" . $ELEARNING_INTERFACE_MODULES[$cms_type]["logo_file"] . "\" border=\"0\">" : $cms_type); } else { $output .= ELearningUtils::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\"> </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\"> </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\"> </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\"> </td></tr>"; $output .= "</table>"; $output .= "</form>"; $output .= ELearningUtils::getCMSFooter(''); } $output .= "<br>"; } return $output; }
/** * 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); if ($cat_name != "") { $cat = $this->soap_client->getReferenceByTitle(trim($cat_name), "cat"); if ($cat == false) { $messages["error"] .= sprintf(_("Das Objekt mit dem Namen \"%s\" wurde im System %s nicht gefunden."), htmlReady($cat_name), htmlReady($this->getName())) . "<br>\n"; } elseif ($cat != "") { ELearningUtils::setConfigValue("category_id", $cat, $this->cms_type); $this->main_category_node_id = $cat; } } if ($this->main_category_node_id != false and ELearningUtils::getConfigValue("user_category_id", $this->cms_type) == "") { $object_data["title"] = sprintf(_("User-Daten")); $object_data["description"] = _("Hier befinden sich die persönlichen Ordner der Stud.IP-User."); $object_data["type"] = "cat"; $object_data["owner"] = $this->user->getId(); $user_cat = $connected_cms[$this->cms_type]->soap_client->addObject($object_data, $connected_cms[$this->cms_type]->main_category_node_id); if ($user_cat != false) { $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 = array(); 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(array('<option></option>'), $ldap_options)) : ''); $template->set_attribute('module_types', $module_types); echo $template->render(); }