";
diff --git a/lang/de/local_lsf_unification.php b/lang/de/local_lsf_unification.php
index f0ba1ff..2388110 100644
--- a/lang/de/local_lsf_unification.php
+++ b/lang/de/local_lsf_unification.php
@@ -17,7 +17,7 @@
/**
* Question engine upgrade helper langauge strings.
*
- * @package local
+ * @package local_lsf_unification
* @subpackage qeupgradehelper
* @copyright 2010 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -25,150 +25,150 @@
-$string['pluginname'] = 'LSF Unification';
-$string['plugintitle'] = 'LSF Unification';
-
-$string['delete'] = 'löschen';
-$string['warnings'] = 'Hinweise:';
-$string['select'] = 'Auswählen';
-$string['back'] = 'Zurück';
-$string['navigate'] = 'navigieren';
-$string['map'] = 'zuordnen';
-$string['map_done'] = 'Zuordnung(en) wurde(n) festgehalten';
-$string['mapped'] = 'zugeordnet';
-$string['not_mapped'] = 'nicht zugeordnet';
-$string['choose_course'] = 'Bitte wählen Sie den Kurs aus, den Sie im Learnweb zur Verfügung stellen wollen.';
-$string['create_mappings'] = 'Zuordnungen hinzufügen';
-$string['main_category'] = 'Hauptkategorie';
-$string['overwrite'] = 'überschreiben';
-$string['sub_category'] = 'Unterkategorie';
-$string['update_helptable'] = 'Hilfstabelle automatisch aktualisieren';
-
-$string['dbhost'] = 'Host';
-$string['dbhost_description'] = 'PostgreDB-Host';
-$string['dbname'] = 'Name';
-$string['dbname_description'] = 'PostgreDB-Name';
-$string['dbpass'] = 'Pass';
-$string['dbpass_description'] = 'PostgreDB-Password';
-$string['dbuser'] = 'User';
-$string['dbuser_description'] = 'PostgreDB-User';
-$string['db_not_available'] = "Die Import-Funktion ist zurzeit leider nicht verfügbar. Bitte nutzen sie das reguläre Beantragungsformular (→ Link).";
-$string['defaultcategory'] = 'Standard Kategorie';
-$string['defaultcategory_description'] = 'Falls keine Kategorie eingetragen werden kann wird diese Kategorie angegeben';
-$string['max_import_age'] = 'Maximales Kurs-Alter';
-$string['max_import_age_description'] = 'Maximales Alter, dass ein Kurs haben darf, danach wird er nicht mehr zur Auswahl angezeigt.';
-$string['roleid_creator'] = 'RoleID Ersteller';
-$string['roleid_creator_description'] = 'Rolle für Kursersteller';
-$string['roleid_student'] = 'RoleID Student';
-$string['roleid_student_description'] = 'Rolle für automatisch angemeldete Studenten';
-$string['roleid_teacher'] = 'RoleID Lehrer';
-$string['roleid_teacher_description'] = 'Rolle für automatisch angemeldete Lehrer';
-$string['subcategories'] = 'Unterkategorien freischalten';
-$string['subcategories_description'] = 'Erlaubt das einordnen nicht zugeordneter Unterkategorien zu Oberkategorien';
-
-$string['notice'] = 'Im Normalfall übernimmt Learnweb die Kursinformationen aus der HIS-Datenbank und schlägt diese unten als Auswahl vor. Voraussetzung ist, dass Sie als Lehrende(r) bzw. Begleitperson der Veranstaltung zugeordnet sind und Ihre Kennung im HIS-LSF hinterlegt ist. Sollte kein Kurs von Ihnen erscheinen, wählen Sie bitte eine der anderen zutreffenden Alternativen.';
-$string['question'] = "Bitte wählen Sie die erste zutreffende Aussage:";
+$string['ad_hoc_task_failed'] = 'Der Adhoc-Task {$a} ist fehlgeschlagen. Er wird neu geplant und später erneut versucht.';
+$string['already_requested'] = 'Diesr Kurs wurde bereits angefragt. Der/die Lehrende muss erst die bestehende Anfrage beantworten, bevor neue Anfragen getätigt werden können.';
$string['answer_course_found'] = "Der zu beantragende Kurs befindet sich in der nachfolgenden Liste:";
$string['answer_course_in_lsf_and_visible'] = "Der zu beantragende Kurs befindet sich im HIS-LSF und Sie sind dort als Lehrende(r) eingetragen.";
-$string['answer_proxy_creation'] = "Der Kurs existiert im HIS-LSF und Sie möchten im Auftrag einer/s dort eingetragenen Lehrenden diesen Kurs erstellen.";
+$string['answer_course_in_lsf_but_invisible'] = 'Der zu beantragende Kurs befindet sich im HIS-LSF und der Kurs wird oben nicht angezeigt, obwohl der Nutzer mit der Kennung {$a} als Lehrende(r) für den Kurs eingetragen ist.';
$string['answer_goto_old_requestform'] = "Sie möchten eine Kursbeantragung ohne Übernahme der Daten aus dem HIS-LSF vornehmen.";
-
-
-
-
-$string['info_course_in_lsf_and_visible'] = '
Dass der gewünschte Kurs nicht aufgelistet wird, kann folgende Ursachen haben:
Es ist weniger als 24 Stunden her, dass die Veranstaltung in das HIS-LSF eingetragen wurde. Die Daten werden nur einmal täglich aus dem System übernommen. Wenn kein weiterer Fehler vorliegt, warten Sie bitte bis morgen, dann sollte eine Übernahme in das Learnweb funktionieren.
Die Kennung, mit der Sie im Learnweb angemeldet sind (Kennung: {$a}), ist keiner Person im HIS-LSF zugeordnet. Wenden Sie sich bitte an eine Person Ihres Fachbereichs, die Bearbeitungsrechte im HIS-LSF besitzt. Im Normalfall haben Sekretariate bzw. das Dekanat Bearbeitungsrechte im HIS-LSF. Ihr Profil im HIS-LSF muss bearbeitet werden (Person bearbeiten). In Registerkarte 2 muss der Bereich Login gewählt werden, und im Feld Login Ihre ZIV-Nutzerkennung eingetragen werden (vgl. Abb.). Die Änderung wird erst am nächsten Tag wirksam.
';
-$string['info_goto_old_requestform'] = "Bitte nutzen Sie die manuelle Kursbeantragung, um Ihren Kurs zu beantragen (→ Link). Geben Sie bitte unbedingt einen Verweis auf den Kurs im HIS-LSF an (einen Link bzw. genaue Kursbezeichnung). Ihr Antrag wird vom Learnweb-Support schnellst möglichst bearbeitet.";
-
+$string['answer_proxy_creation'] = "Der Kurs existiert im HIS-LSF und Sie möchten im Auftrag einer/s dort eingetragenen Lehrenden diesen Kurs erstellen.";
+$string['answer_sent'] = 'Vielen Dank für das Verarbeiten dieser Anfrage. Ihre Entscheidung wird dem Anfragenden automatisch per Email mitgeteilt.';
+$string['back'] = 'Zurück';
+$string['categoryinvalid'] = 'Bitte eine Kategorie wählen';
+$string['choose_course'] = 'Bitte wählen Sie den Kurs aus, den Sie im Learnweb zur Verfügung stellen wollen.';
+$string['choose_teacher'] = 'Bitte geben Sie die Nutzerkennung der/s autorisierenden Lehrenden an:';
$string['config_auto_update'] = "Automatische Aktualisierung";
$string['config_auto_update_duration'] = "Neuanmeldungen&Abmeldungen zum Kurs (im HIS-LSF) ins Learnweb übernehmen für";
+$string['config_auto_update_duration-1'] = "Nie";
$string['config_auto_update_duration182'] = "sechs Monate ab Startdatum";
$string['config_auto_update_duration31'] = "einen Monat ab Startdatum";
$string['config_auto_update_duration7'] = "eine Woche ab Startdatum";
-$string['config_auto_update_duration-1'] = "Nie";
$string['config_category'] = "Kategorie";
$string['config_category_wish'] = "Kategorieumzugswunsch";
$string['config_category_wish_help'] = "Falls Sie den Kurs gerne in einer anderen stärker spezifizierten Kategorie eingeordnet haben möchten, hinterlassen Sie bitte hier einen Kommentar mit der entsprechenden Wunschkategorie und -pfad.";
$string['config_course_semester'] = "Semester";
$string['config_course_semester_missing'] = "Das Feld zur Angabe des Semesters ist nicht ausgefüllt.";
-$string['config_enrol'] = "Einschreibemethoden";
$string['config_dbenrolment'] = "HISLSF Einschreibung";
$string['config_dbenrolment_help'] = "Eine Möglichkeit den Kurs nur für bestimmte Studierende freizuschalten, ist die automatische Synchronisierung mit der HISLSF-Datenbank. Die Einschreibungen der Studenten in Ihren Kurs werden automatisch mit dem HISLSF synchronisiert sobald sich diese im Learnweb anmelden. Wir empfehlen zusätzlich die Selbsteinschreibung mit Passwort, da der Abgleich mit den HISLSF-Daten systembedingt ca. 24 Std. versetzt stattfinden.";
-$string['config_selfenrolment'] = "Selbsteinschreibung";
-$string['config_selfenrolment_help'] = "Eine Möglichkeit den Kurs nur für bestimmte Studierende freizuschalten, ist die Selbsteinschreibung mit oder ohne Passwort. Wir empfehlen ein Passwort zu setzen und dieses in der Präsenzveranstaltung bekanntzugeben.";
+$string['config_enrol'] = "Einschreibemethoden";
$string['config_enrolment_key'] = "Selbsteinschreibungs-Schlüssel";
$string['config_enrolment_key_help'] = "Das nachfolgend eingegebene Passwort müssen Studierende einmalig beim Betreten des Kursraums durch Selbsteinschreibung eingeben. Wenn der Learnweb-Kurs nicht Passwortgeschützt werden soll, lassen Sie das Feld leer. Wir empfehlen dringend ein Passwort zu vergeben, insb. wenn se digitale Dokumente im Rahmen von e-Semesterapparaten oder ähnlichem bereitstellen möchten.";
$string['config_misc'] = "Sonstiges";
+$string['config_selfenrolment'] = "Selbsteinschreibung";
+$string['config_selfenrolment_help'] = "Eine Möglichkeit den Kurs nur für bestimmte Studierende freizuschalten, ist die Selbsteinschreibung mit oder ohne Passwort. Wir empfehlen ein Passwort zu setzen und dieses in der Präsenzveranstaltung bekanntzugeben.";
$string['config_shortname'] = "Kurztitel";
$string['config_summary'] = "Kurzbeschreibung";
$string['config_summary_desc'] = "(Wird in der Kurssuche dargestellt)";
+$string['continue'] = 'Fortfahren';
+$string['continue_with_empty_course'] = 'Mit einem leeren Kurs fortfahren';
+$string['course_duplication_question'] = 'Wollen Sie die Daten aus einem alten Learnweb-Kurs in den soeben erstellten Kurs kopieren? (Dies ist die einzige Gelegenheit dazu)';
+$string['course_duplication_selection'] = 'Bitte wählen Sie ein Kursbackup aus:';
+$string['create_mappings'] = 'Zuordnungen hinzufügen';
+$string['db_not_available'] = "Die Import-Funktion ist zurzeit leider nicht verfügbar. Bitte nutzen sie das reguläre Beantragungsformular (→ Link).";
+$string['dbhost'] = 'Host';
+$string['dbhost_description'] = 'PostgreDB-Host';
+$string['dbname'] = 'Name';
+$string['dbname_description'] = 'PostgreDB-Name';
+$string['dbpass'] = 'Pass';
+$string['dbpass_description'] = 'PostgreDB-Password';
+$string['dbuser'] = 'User';
+$string['dbuser_description'] = 'PostgreDB-User';
+$string['defaultcategory'] = 'Standard Kategorie';
+$string['defaultcategory_description'] = 'Falls keine Kategorie eingetragen werden kann wird diese Kategorie angegeben';
+$string['delete'] = 'löschen';
+$string['duplication_timeframe_error'] = 'Aus Sicherheitsgründen ist es nicht erlaubt Kursdaten aus Musterkursen oder Kursbackups wiederherzustellen, falls die Kurserstellung mehr als {$a} Stunden zurückliegt.';
+$string['email'] = 'ABSENDER:
+{$a->a} (' . $CFG->wwwroot . '/user/view.php?id={$a->b})
-$string['categoryinvalid'] = 'Bitte eine Kategorie wählen';
-$string['email_error'] = 'Der Kategorieumzugswunsch konnte leider nicht automatisch versendet werden. Kontaktieren Sie den Support manuell! ('.$CFG->supportemail.')';
+ KURS:
+ {$a->c} (' . $CFG->wwwroot . '/course/view.php?id={$a->d})
+
+ NACHRICHT:
+ {$a->e}';
+$string['email2'] = 'Der Benutzer "{$a->a}" ({$a->userurl}) versucht den Kurs "{$a->c}" in Ihrem Namen zu erstellen. Bitte akzeptieren oder verweigern Sie die Anfrage auf dieser Webseite: {$a->requesturl}';
+$string['email2_title'] = "Anfrage zur Kurserstellung";
+$string['email3'] = 'Der Benutzer "{$a->a}" ({$a->userurl}) akzeptierte Ihre Kursanfrage "{$a->c}". Bitte fahren Sie mit der Erstellung hier fort: {$a->requesturl}';
+$string['email3_title'] = "Anfrage zur Kurserstellungs akzeptiert";
+$string['email4'] = 'Der Benutzer "{$a->a}" ({$a->userurl}) verweigerte Ihre Kursanfrage "{$a->c}".';
+$string['email4_title'] = "Anfrage zur Kurserstellung verweigert";
+$string['email_error'] = 'Der Kategorieumzugswunsch konnte leider nicht automatisch versendet werden. Kontaktieren Sie den Support manuell! (' . $CFG->supportemail . ')';
+$string['email_from'] = "HIS LSF Import";
$string['email_success'] = 'Eine Email bzgl. des Kategoriewechsels wird an den Support gesendet.';
+$string['eventcourse_duplicated'] = 'Kursinhalte dupliziert';
+$string['eventcourse_imported'] = 'Kurs importiert';
+$string['eventmatchingtable_updated'] = 'Matchingtable geändert';
+$string['his_info'] = 'Bitte weisen Sie den/die Lehrende(n) an, diesen Hinweisen zu folgen, sodass seine/ihre HIS-LSF-Kurse mit seiner/ihrer Nutzerkennung verknüpft werden können.';
+$string['icalurl'] = 'ICal URL';
+$string['icalurl_description'] = 'URL des HisLSF ICal Exports (eine Liste der relevanten Termine wird dynamisch angehängt)';
+$string['importcalendar'] = 'HISLSF Stundenplan';
+$string['importical'] = 'Stundenplan importieren';
+$string['info_course_in_lsf_and_visible'] = '
Dass der gewünschte Kurs nicht aufgelistet wird, kann folgende Ursachen haben:
Es ist weniger als 24 Stunden her, dass die Veranstaltung in das HIS-LSF eingetragen wurde. Die Daten werden nur einmal täglich aus dem System übernommen. Wenn kein weiterer Fehler vorliegt, warten Sie bitte bis morgen, dann sollte eine Übernahme in das Learnweb funktionieren.
Die Kennung, mit der Sie im Learnweb angemeldet sind (Kennung: {$a}), ist keiner Person im HIS-LSF zugeordnet. Wenden Sie sich bitte an eine Person Ihres Fachbereichs, die Bearbeitungsrechte im HIS-LSF besitzt. Im Normalfall haben Sekretariate bzw. das Dekanat Bearbeitungsrechte im HIS-LSF. Ihr Profil im HIS-LSF muss bearbeitet werden (Person bearbeiten). In Registerkarte 2 muss der Bereich Login gewählt werden, und im Feld Login Ihre ZIV-Nutzerkennung eingetragen werden (vgl. Abb.). Die Änderung wird erst am nächsten Tag wirksam.
';
+$string['info_goto_old_requestform'] = "Bitte nutzen Sie die manuelle Kursbeantragung, um Ihren Kurs zu beantragen (→ Link). Geben Sie bitte unbedingt einen Verweis auf den Kurs im HIS-LSF an (einen Link bzw. genaue Kursbezeichnung). Ihr Antrag wird vom Learnweb-Support schnellst möglichst bearbeitet.";
+$string['linktext_content'] = "... importieren Sie Inhalte aus bereits existierenden Kursen ...";
+$string['linktext_course'] = "... oder gehen Sie direkt zum neu erstellten Kurs.";
+$string['linktext_users'] = "Bearbeiten Sie die eingeschriebenen Lehrenden und Studierenden, ...";
+$string['main_category'] = 'Hauptkategorie';
+$string['map'] = 'zuordnen';
+$string['map_done'] = 'Zuordnung(en) wurde(n) festgehalten';
+$string['mapped'] = 'zugeordnet';
+$string['max_import_age'] = 'Maximales Kurs-Alter';
+$string['max_import_age_description'] = 'Maximales Alter, dass ein Kurs haben darf, danach wird er nicht mehr zur Auswahl angezeigt.';
+$string['navigate'] = 'navigieren';
$string['new_request'] = 'Einen weiteren Kurs beantragen.';
+$string['next_steps'] = "Nächste Schritte";
+$string['no'] = 'Nein';
$string['noConnection'] = "Es konnte keine Verbindung zur LSF-Datenbank hergestellt werden. Bitte nutzen Sie das manuelle Kursbeantragungs-Formular.";
+$string['no_template'] = 'Alternative {$a}: Kurs ohne Inhalte vorbereiten...';
+$string['not_mapped'] = 'nicht zugeordnet';
+$string['notice'] = 'Im Normalfall übernimmt Learnweb die Kursinformationen aus der HIS-Datenbank und schlägt diese unten als Auswahl vor. Voraussetzung ist, dass Sie als Lehrende(r) bzw. Begleitperson der Veranstaltung zugeordnet sind und Ihre Kennung im HIS-LSF hinterlegt ist. Sollte kein Kurs von Ihnen erscheinen, wählen Sie bitte eine der anderen zutreffenden Alternativen.';
+$string['overwrite'] = 'überschreiben';
+$string['pluginname'] = 'LSF Unification';
+$string['plugintitle'] = 'LSF Unification';
+
+$string['pre_template'] = 'Alternative {$a}: Kurs mit Inhalten aus einer Vorlage vorbereiten...';
+$string['question'] = "Bitte wählen Sie die erste zutreffende Aussage:";
+$string['remote_request_accept'] = 'Akzeptiere die Anfrage von "{$a->a}" den Kurs "{$a->b}" zu erstellen';
+$string['remote_request_decline'] = 'Verweigere die Anfrage von "{$a->a}"';
+$string['remote_request_select_alternative'] = 'Bitte wählen Sie eine Aktion aus:';
+$string['request_sent'] = 'Die Anfrage wird per Mail an den/die Lehrende(n) gesendet. Sie werden per Mail eine Rückmeldung erhalten, sobald der/die Lehrende die Anfrage bearbeitet hat.';
+$string['roleid_creator'] = 'RoleID Ersteller';
+$string['roleid_creator_description'] = 'Rolle für Kursersteller';
+$string['roleid_student'] = 'RoleID Student';
+$string['roleid_student_description'] = 'Rolle für automatisch angemeldete Studenten';
+$string['roleid_teacher'] = 'RoleID Lehrer';
+$string['roleid_teacher_description'] = 'Rolle für automatisch angemeldete Lehrer';
+$string['select'] = 'Auswählen';
+$string['shortnamecourse'] = get_string('shortnamecourse') . ' (der Kurzname muss {$a} am Ende enthalten) ';
$string['shortnameinvalid'] = 'Kurzbezeichnung fehlerhaft (es muss {$a} am Ende stehen)';
-$string['shortnamecourse'] = get_string('shortnamecourse'). ' (der Kurzname muss {$a} am Ende enthalten) ';
+$string['skip'] = 'Überspringen';
+$string['sub_category'] = 'Unterkategorie';
+$string['subcategories'] = 'Unterkategorien freischalten';
+$string['subcategories_description'] = 'Erlaubt das einordnen nicht zugeordneter Unterkategorien zu Oberkategorien';
+$string['template_from_course'] = 'Alternative {$a}: Fortfahren mit den Inhalten eines existierenden Kurses...';
+$string['update_helptable'] = 'Hilfstabelle automatisch aktualisieren';
$string['warning_cannot_enrol_nologin'] = "Person wurde nicht hinzugefügt (kein Benutzername gefunden)";
$string['warning_cannot_enrol_nouser'] = "Person wurde nicht hinzugefügt (kein Benutzer gefunden)";
$string['warning_cannot_enrol_other'] = "Person wurde nicht hinzugefügt";
+$string['warnings'] = 'Hinweise:';
-$string['next_steps'] = "Nächste Schritte";
-$string['linktext_users'] = "Bearbeiten Sie die eingeschriebenen Lehrenden und Studierenden, ...";
-$string['linktext_content'] = "... importieren Sie Inhalte aus bereits existierenden Kursen ...";
-$string['linktext_course'] = "... oder gehen Sie direkt zum neu erstellten Kurs.";
-$string['course_duplication_question'] = 'Wollen Sie die Daten aus einem alten Learnweb-Kurs in den soeben erstellten Kurs kopieren? (Dies ist die einzige Gelegenheit dazu)';
-$string['yes'] = 'Ja';
-$string['no'] = 'Nein';
-$string['skip'] = 'Überspringen';
-$string['course_duplication_selection'] = 'Bitte wählen Sie ein Kursbackup aus:';
-$string['email'] = 'ABSENDER:
-{$a->a} ('.$CFG->wwwroot.'/user/view.php?id={$a->b})
- KURS:
- {$a->c} ('.$CFG->wwwroot.'/course/view.php?id={$a->d})
- NACHRICHT:
- {$a->e}';
-$string['choose_teacher'] = 'Bitte geben Sie die Nutzerkennung der/s autorisierenden Lehrenden an:';
-$string['his_info'] = 'Bitte weisen Sie den/die Lehrende(n) an, diesen Hinweisen zu folgen, sodass seine/ihre HIS-LSF-Kurse mit seiner/ihrer Nutzerkennung verknüpft werden können.';
-$string['answer_course_in_lsf_but_invisible'] = 'Der zu beantragende Kurs befindet sich im HIS-LSF und der Kurs wird oben nicht angezeigt, obwohl der Nutzer mit der Kennung {$a} als Lehrende(r) für den Kurs eingetragen ist.';
-$string['already_requested'] = 'Diesr Kurs wurde bereits angefragt. Der/die Lehrende muss erst die bestehende Anfrage beantworten, bevor neue Anfragen getätigt werden können.';
-$string['request_sent'] = 'Die Anfrage wird per Mail an den/die Lehrende(n) gesendet. Sie werden per Mail eine Rückmeldung erhalten, sobald der/die Lehrende die Anfrage bearbeitet hat.';
-$string['answer_sent'] = 'Vielen Dank für das Verarbeiten dieser Anfrage. Ihre Entscheidung wird dem Anfragenden automatisch per Email mitgeteilt.';
-$string['email_from'] = "HIS LSF Import";
-$string['email2_title'] = "Anfrage zur Kurserstellung";
-$string['email2'] = 'Der Benutzer "{$a->a}" ({$a->userurl}) versucht den Kurs "{$a->c}" in Ihrem Namen zu erstellen. Bitte akzeptieren oder verweigern Sie die Anfrage auf dieser Webseite: {$a->requesturl}';
-$string['email3_title'] = "Anfrage zur Kurserstellungs akzeptiert";
-$string['email3'] = 'Der Benutzer "{$a->a}" ({$a->userurl}) akzeptierte Ihre Kursanfrage "{$a->c}". Bitte fahren Sie mit der Erstellung hier fort: {$a->requesturl}';
-$string['email4_title'] = "Anfrage zur Kurserstellung verweigert";
-$string['email4'] = 'Der Benutzer "{$a->a}" ({$a->userurl}) verweigerte Ihre Kursanfrage "{$a->c}".';
-$string['remote_request_select_alternative'] = 'Bitte wählen Sie eine Aktion aus:';
-$string['remote_request_accept'] = 'Akzeptiere die Anfrage von "{$a->a}" den Kurs "{$a->b}" zu erstellen';
-$string['remote_request_decline'] = 'Verweigere die Anfrage von "{$a->a}"';
-$string['no_template'] = 'Alternative {$a}: Kurs ohne Inhalte vorbereiten...';
-$string['pre_template'] = 'Alternative {$a}: Kurs mit Inhalten aus einer Vorlage vorbereiten...';
-$string['template_from_course'] = 'Alternative {$a}: Fortfahren mit den Inhalten eines existierenden Kurses...';
-$string['continue'] = 'Fortfahren';
-$string['continue_with_empty_course'] = 'Mit einem leeren Kurs fortfahren';
-$string['duplication_timeframe_error'] = 'Aus Sicherheitsgründen ist es nicht erlaubt Kursdaten aus Musterkursen oder Kursbackups wiederherzustellen, falls die Kurserstellung mehr als {$a} Stunden zurückliegt.';
-$string['ad_hoc_task_failed'] = 'Der Adhoc-Task {$a} ist fehlgeschlagen. Er wird neu geplant und später erneut versucht.';
+
+$string['yes'] = 'Ja';
+
+
+
+
+
-$string['importcalendar'] = 'HISLSF Stundenplan';
-$string['importical'] = 'Stundenplan importieren';
-$string['icalurl'] = 'ICal URL';
-$string['icalurl_description'] = 'URL des HisLSF ICal Exports (eine Liste der relevanten Termine wird dynamisch angehängt)';
-$string['eventcourse_imported'] = 'Kurs importiert';
-$string['eventmatchingtable_updated'] = 'Matchingtable geändert';
-$string['eventcourse_duplicated'] = 'Kursinhalte dupliziert';
// Privacy API
$string['privacy:metadata:local_lsf_unification:veranstid'] = 'ID der Veranstaltung im HISLSF System';
$string['privacy:metadata:local_lsf_unification:mdlid'] = 'ID der Veranstaltung im Moodle System';
diff --git a/lang/en/local_lsf_unification.php b/lang/en/local_lsf_unification.php
index e97fdad..f733a5c 100644
--- a/lang/en/local_lsf_unification.php
+++ b/lang/en/local_lsf_unification.php
@@ -17,7 +17,7 @@
/**
* Question engine upgrade helper langauge strings.
*
- * @package local
+ * @package local_lsf_unification
* @subpackage qeupgradehelper
* @copyright 2010 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -25,172 +25,172 @@
-$string['pluginname'] = 'LSF Unification';
-$string['plugintitle'] = 'LSF Unification';
-
-$string['delete'] = 'delete';
-$string['warnings'] = 'Warnings:';
-$string['select'] = 'Submit';
-$string['back'] = 'Back';
-$string['navigate'] = 'navigate';
-$string['map'] = 'map';
-$string['map_done'] = 'mapping(s) saved';
-$string['mapped'] = 'mapped';
-$string['not_mapped'] = 'not mapped';
-$string['choose_course'] = 'Please select the course you want to create.';
-$string['create_mappings'] = 'Create New Mappings';
-$string['main_category'] = 'Maincateogry';
-$string['overwrite'] = 'overwrite';
-$string['sub_category'] = 'Subcategory';
-$string['update_helptable'] = 'Update Helptable With HIS-LSF data';
-
-$string['dbhost'] = 'Host';
-$string['dbhost_description'] = 'PostgreDB-Host';
-$string['dbport'] = 'Port';
-$string['dbport_description'] = 'PostgreDB-Port';
-$string['dbname'] = 'Name';
-$string['dbname_description'] = 'PostgreDB-Name';
-$string['dbpass'] = 'Pass';
-$string['dbpass_description'] = 'PostgreDB-Password';
-$string['dbuser'] = 'User';
-$string['dbuser_description'] = 'PostgreDB-User';
-$string['db_not_available'] = "The Import-Services is currently not available. Please use the standard request-form. (Link)";
-$string['defaultcategory'] = 'Default Category';
-$string['defaultcategory_description'] = 'If no category can be matched this category will be offered';
-$string['max_import_age'] = 'Max Import Age';
-$string['max_import_age_description'] = 'The maximum age, a course may have before being imported.';
-$string['roleid_creator'] = 'RoleID Creator';
-$string['roleid_creator_description'] = 'role for coursecreators';
-$string['roleid_student'] = 'RoleID Student';
-$string['roleid_student_description'] = 'role for autoassigned students';
-$string['roleid_teacher'] = 'RoleID Teacher';
-$string['roleid_teacher_description'] = 'role for autoassigned teachers';
-$string['subcategories'] = 'Unlock Subcategories';
-$string['subcategories_description'] = 'Enable choosing not mapped subcategories of mapped categories';
-
-
-$string['notice'] = 'Usually Learnweb copies course information from the HIS database and provides these information below. This requires that you are assigned to the course in HIS-LSF as a teacher or assistant. Furthermore your ZIV account has to be assigned to your HIS-LSF profile. If your course is not listed, please choose from the other provided options.';
-$string['question'] = "Please select the first accurate statement:";
+$string['ad_hoc_task_failed'] = 'The ad hoc task {$a} failed. It will be queued automatically and executed later again.';
+$string['add_features'] = 'Additional Features';
+$string['add_features_information'] = 'configure additional features here';
+$string['already_requested'] = 'Sorry, this course was already requested and the teacher has to reply to this request before a new request can be issued';
$string['answer_course_found'] = "The following list contains the course I'm looking for:";
$string['answer_course_in_lsf_and_visible'] = "The course exists on the HIS-LSF platform and you are registered as a teacher for that course.";
-$string['answer_proxy_creation'] = "The course exists on the HIS-LSF platform and you are authorized to create this course on behalf of a registered teacher.";
+$string['answer_course_in_lsf_but_invisible'] = 'The course is not listed above, but exists on the HIS-LSF platform and {$a} is registered as a teacher for that course.';
$string['answer_goto_old_requestform'] = "None of the above apply and you are authorized to create this course in the Learnweb.";
-
-$string['info_course_in_lsf_and_visible'] = 'There are two potential reasons, why your course is not listed:
Your course is published in HIS-LSF less than 24 hours ago. Data is only transferred once a day. If no further problem occurs, course data will be transferred tomorrow and then Learnweb course creation will be possible.
The username you use right now ({$a}) is not registered on the HIS-LSF. To access the courses you have registered on the HIS-LSF platform you have to include your username in your HIS-LSF-profile. After doing so, please wait at least one day for our database to update.
';
-
-$string['info_goto_old_requestform'] = "Please use the standard form to apply for course creation. (Link)";
-
+$string['answer_proxy_creation'] = "The course exists on the HIS-LSF platform and you are authorized to create this course on behalf of a registered teacher.";
+$string['answer_sent'] = 'Thank you for processing this request, your decision will be sent to the requester.';
+$string['back'] = 'Back';
+$string['categoryinvalid'] = 'please choose a category from this selection';
+$string['choose_course'] = 'Please select the course you want to create.';
+$string['choose_teacher'] = 'Please enter the username of the authorizing teacher:';
$string['config_auto_update'] = "Auto-Update from His-Lsf";
$string['config_auto_update_duration'] = "Keep newly assigned users up to date for";
+$string['config_auto_update_duration-1'] = "never";
$string['config_auto_update_duration182'] = "1 semester since startdate";
$string['config_auto_update_duration31'] = "1 month since startdate";
$string['config_auto_update_duration7'] = "1 week since startdate";
-$string['config_auto_update_duration-1'] = "never";
$string['config_category'] = "Category";
$string['config_category_wish'] = "Category Relocation Wish";
$string['config_category_wish_help'] = "If you have a wish to get your course moved into a more specific category, please leave a comment here containing your wish-category and path.";
$string['config_course_semester'] = "Term";
$string['config_course_semester_missing'] = "The term that the course belongs to is missing.";
-$string['config_enrol'] = "Enrolment";
$string['config_dbenrolment'] = "HISLSF Enrolment";
$string['config_dbenrolment_help'] = "One method for students to enrol for your course is to do so by enroling themself in the HISLSF. Their enrolments will be automatically synchronized when they log into Learnweb.";
-$string['config_selfenrolment'] = "Self Enrolment";
-$string['config_selfenrolment_help'] = "One method for students to enrol for your course is to do this by clicking an enrolment button and optionally typing in a password.";
+$string['config_enrol'] = "Enrolment";
$string['config_enrolment_key'] = "Self Enrolment Key";
$string['config_enrolment_key_help'] = "If you only want students with knowledge of a specific password to enrol, then specify your password wish. If you want every student to be able to enrol, just leave the textbox empty.";
$string['config_misc'] = "Miscellaneous";
+$string['config_selfenrolment'] = "Self Enrolment";
+$string['config_selfenrolment_help'] = "One method for students to enrol for your course is to do this by clicking an enrolment button and optionally typing in a password.";
$string['config_shortname'] = "Shortname";
$string['config_summary'] = "Summary";
$string['config_summary_desc'] = "(Will be displayed in course-search)";
+$string['continue'] = 'Continue';
+$string['continue_with_empty_course'] = 'Leave the course blank and continue';
+$string['create_mappings'] = 'Create New Mappings';
+$string['db_not_available'] = "The Import-Services is currently not available. Please use the standard request-form. (Link)";
+$string['dbhost'] = 'Host';
+$string['dbhost_description'] = 'PostgreDB-Host';
+$string['dbname'] = 'Name';
+$string['dbname_description'] = 'PostgreDB-Name';
+$string['dbpass'] = 'Pass';
+$string['dbpass_description'] = 'PostgreDB-Password';
+$string['dbport'] = 'Port';
+$string['dbport_description'] = 'PostgreDB-Port';
+$string['dbuser'] = 'User';
+$string['dbuser_description'] = 'PostgreDB-User';
+$string['defaultcategory'] = 'Default Category';
+$string['defaultcategory_description'] = 'If no category can be matched this category will be offered';
+$string['delete'] = 'delete';
+$string['duplication_timeframe'] = 'Course Duplication Timeframe';
+$string['duplication_timeframe_description'] = 'The number of hours after course creation where restore-actions are allowed';
+$string['duplication_timeframe_error'] = 'Sorry but for safety reasons it is not allowed import course data from templates or backups more than {$a} hour(s) after course creation';
+$string['email'] = 'SENDER:
+{$a->a} (' . $CFG->wwwroot . '/user/view.php?id={$a->b})
-$string['categoryinvalid'] = 'please choose a category from this selection';
+ COURSE:
+ {$a->c} (' . $CFG->wwwroot . '/course/view.php?id={$a->d})
+
+ MESSAGE:
+ {$a->e}';
+$string['email2'] = 'The user "{$a->a}" ({$a->userurl}) requested to create the Learnweb-course "{$a->c}" in your name. Please confirm or refuse the request on this website: {$a->requesturl}';
+$string['email2_title'] = "Course Creation Request";
+$string['email3'] = 'The user "{$a->a}" ({$a->userurl}) accepted your request to create the Learnweb-course "{$a->c}". Please continue the course-creation on this website: {$a->requesturl}';
+$string['email3_title'] = "Course Creation Request accepted";
+$string['email4'] = 'The user "{$a->a}" ({$a->userurl}) declined your request to create the Learnweb-course "{$a->c}".';
+$string['email4_title'] = "Course Creation Request declined";
$string['email_error'] = 'The category wish wasn\'t sent. Please contact the support team manually.';
+$string['email_from'] = "HIS LSF Import";
$string['email_success'] = 'Email regarding category wish will be sent.';
+$string['enable_enrol_ext_db'] = 'Enable external database enrolement';
+$string['enable_enrol_ext_db_description'] = 'Teacher can choose if he wants to use external database enrolement. External database enrolment must be enabled and it must be changed so that it can be enabled for particular courses only';
+$string['eventcourse_duplicated'] = 'Course duplicated';
+$string['eventcourse_imported'] = 'Course imported';
+$string['eventmatchingtable_updated'] = 'Matchingtable updated';
+$string['his_deeplink_heading'] = 'HIS Deeplink Web Service settings';
+$string['his_deeplink_information'] = 'HIS Deeplink Web Service calls a HIS web service that adds a link to the his course pointing to the moodle course';
+$string['his_deeplink_via_soap'] = 'Enable HIS Deeplink';
+$string['his_deeplink_via_soap_description'] = 'Enable the HIS Deeplink web service';
+$string['his_info'] = 'Please inform your teacher to follow this guide, for the HIS-LSF courses to be matched to the username.';
+$string['icalurl'] = 'ICal URL';
+$string['icalurl_description'] = 'URL that points to the HisLSF Ical Export (the list of relevant event ids will be dynamically appended)';
+$string['importcalendar'] = 'HISLSF timetable';
+$string['importical'] = 'import timetable';
+$string['info_course_in_lsf_and_visible'] = 'There are two potential reasons, why your course is not listed:
Your course is published in HIS-LSF less than 24 hours ago. Data is only transferred once a day. If no further problem occurs, course data will be transferred tomorrow and then Learnweb course creation will be possible.
The username you use right now ({$a}) is not registered on the HIS-LSF. To access the courses you have registered on the HIS-LSF platform you have to include your username in your HIS-LSF-profile. After doing so, please wait at least one day for our database to update.
';
+$string['info_goto_old_requestform'] = "Please use the standard form to apply for course creation. (Link)";
+$string['linktext_content'] = "... import content from already existing courses ...";
+$string['linktext_course'] = "... or go directly to your new couse.";
+$string['linktext_users'] = "Edit the assigned teachers and students, ...";
+$string['main_category'] = 'Maincateogry';
+$string['map'] = 'map';
+$string['map_done'] = 'mapping(s) saved';
+$string['mapped'] = 'mapped';
+$string['max_import_age'] = 'Max Import Age';
+$string['max_import_age_description'] = 'The maximum age, a course may have before being imported.';
+$string['moodle_url'] = 'Moodle www root';
+$string['moodle_url_description'] = 'URL to Moodle www root, which is used to create the link for the his course';
+$string['navigate'] = 'navigate';
$string['new_request'] = 'request another course';
+$string['next_steps'] = "Next Steps";
$string['noConnection'] = "A connection to LSF-Database couldn't be established. Please use the regular formular.";
+$string['no_template'] = 'Alternative {$a}: Leave the course blank course and continue';
+$string['not_mapped'] = 'not mapped';
+$string['notice'] = 'Usually Learnweb copies course information from the HIS database and provides these information below. This requires that you are assigned to the course in HIS-LSF as a teacher or assistant. Furthermore your ZIV account has to be assigned to your HIS-LSF profile. If your course is not listed, please choose from the other provided options.';
+$string['overwrite'] = 'overwrite';
+$string['pluginname'] = 'LSF Unification';
+$string['plugintitle'] = 'LSF Unification';
+
+$string['pre_template'] = 'Alternative {$a}: Continue with content from a course template ...';
+$string['question'] = "Please select the first accurate statement:";
+$string['remote_creation'] = 'Remote Course Creation';
+$string['remote_creation_description'] = 'Allow everyone to request courses in the name of a teacher, who than has to confirm';
+$string['remote_request_accept'] = 'Accept request by "{$a->a}" to create the course "{$a->b}"';
+$string['remote_request_decline'] = 'Decline request and send the regarding information to "{$a->a}"';
+$string['remote_request_select_alternative'] = 'Please select the action you want to perform:';
+$string['request_sent'] = 'The request will be sent, please wait for an answer, that you will recieve via email.';
+$string['restore_old_courses'] = 'Duplicating Courses';
+$string['restore_old_courses_description'] = 'Allow a course creator to duplicate course contents by restoring from a course backup of his courses';
+$string['restore_templates'] = 'Course from Template';
+$string['restore_templates_description'] = 'Allow a course creator to add standard course contents by restoring from a course backup functioning as template';
+$string['roleid_creator'] = 'RoleID Creator';
+$string['roleid_creator_description'] = 'role for coursecreators';
+$string['roleid_student'] = 'RoleID Student';
+$string['roleid_student_description'] = 'role for autoassigned students';
+$string['roleid_teacher'] = 'RoleID Teacher';
+$string['roleid_teacher_description'] = 'role for autoassigned teachers';
+$string['select'] = 'Submit';
+$string['shortnamecourse'] = get_string('shortnamecourse') . ' (shortname must contain {$a} at the end) ';
$string['shortnameinvalid'] = 'shortname is invalid (it must contain {$a} at the end)';
-$string['shortnamecourse'] = get_string('shortnamecourse'). ' (shortname must contain {$a} at the end) ';
+$string['soappass'] = 'Password';
+$string['soappass_description'] = 'Password for the HIS Deeplink service';
+$string['soapuser'] = 'soapuser';
+$string['soapuser_description'] = 'Username for the HIS Deeplink service';
+$string['soapwsdl'] = 'soapwsdl';
+$string['soapwsdl_description'] = 'Wdsl link for the HIS Deeplink service';
+$string['sub_category'] = 'Subcategory';
+$string['subcategories'] = 'Unlock Subcategories';
+$string['subcategories_description'] = 'Enable choosing not mapped subcategories of mapped categories';
+$string['template_from_course'] = 'Alternative {$a}: Include contents from an existing course ...';
+$string['update_helptable'] = 'Update Helptable With HIS-LSF data';
$string['warning_cannot_enrol_nologin'] = "person wasn't enrolled (no username found)";
$string['warning_cannot_enrol_nouser'] = "person wasn't enrolled (no user found)";
$string['warning_cannot_enrol_other'] = "person wasn't enrolled";
-$string['next_steps'] = "Next Steps";
-$string['linktext_users'] = "Edit the assigned teachers and students, ...";
-$string['linktext_content'] = "... import content from already existing courses ...";
-$string['linktext_course'] = "... or go directly to your new couse.";
+$string['warnings'] = 'Warnings:';
+
+
+
+
+
-$string['email'] = 'SENDER:
-{$a->a} ('.$CFG->wwwroot.'/user/view.php?id={$a->b})
- COURSE:
- {$a->c} ('.$CFG->wwwroot.'/course/view.php?id={$a->d})
- MESSAGE:
- {$a->e}';
-$string['choose_teacher'] = 'Please enter the username of the authorizing teacher:';
-$string['his_info'] = 'Please inform your teacher to follow this guide, for the HIS-LSF courses to be matched to the username.';
-$string['answer_course_in_lsf_but_invisible'] = 'The course is not listed above, but exists on the HIS-LSF platform and {$a} is registered as a teacher for that course.';
-$string['already_requested'] = 'Sorry, this course was already requested and the teacher has to reply to this request before a new request can be issued';
-$string['request_sent'] = 'The request will be sent, please wait for an answer, that you will recieve via email.';
-$string['answer_sent'] = 'Thank you for processing this request, your decision will be sent to the requester.';
-$string['email_from'] = "HIS LSF Import";
-$string['email2_title'] = "Course Creation Request";
-$string['email2'] = 'The user "{$a->a}" ({$a->userurl}) requested to create the Learnweb-course "{$a->c}" in your name. Please confirm or refuse the request on this website: {$a->requesturl}';
-$string['email3_title'] = "Course Creation Request accepted";
-$string['email3'] = 'The user "{$a->a}" ({$a->userurl}) accepted your request to create the Learnweb-course "{$a->c}". Please continue the course-creation on this website: {$a->requesturl}';
-$string['email4_title'] = "Course Creation Request declined";
-$string['email4'] = 'The user "{$a->a}" ({$a->userurl}) declined your request to create the Learnweb-course "{$a->c}".';
-$string['remote_request_select_alternative'] = 'Please select the action you want to perform:';
-$string['remote_request_accept'] = 'Accept request by "{$a->a}" to create the course "{$a->b}"';
-$string['remote_request_decline'] = 'Decline request and send the regarding information to "{$a->a}"';
-$string['no_template'] = 'Alternative {$a}: Leave the course blank course and continue';
-$string['pre_template'] = 'Alternative {$a}: Continue with content from a course template ...';
-$string['template_from_course'] = 'Alternative {$a}: Include contents from an existing course ...';
-$string['continue'] = 'Continue';
-$string['continue_with_empty_course'] = 'Leave the course blank and continue';
-$string['duplication_timeframe_error'] = 'Sorry but for safety reasons it is not allowed import course data from templates or backups more than {$a} hour(s) after course creation';
-$string['ad_hoc_task_failed'] = 'The ad hoc task {$a} failed. It will be queued automatically and executed later again.';
-$string['add_features'] = 'Additional Features';
-$string['add_features_information'] = 'configure additional features here';
-$string['remote_creation'] = 'Remote Course Creation';
-$string['remote_creation_description'] = 'Allow everyone to request courses in the name of a teacher, who than has to confirm';
-$string['restore_old_courses'] = 'Duplicating Courses';
-$string['restore_old_courses_description'] = 'Allow a course creator to duplicate course contents by restoring from a course backup of his courses';
-$string['restore_templates'] = 'Course from Template';
-$string['restore_templates_description'] = 'Allow a course creator to add standard course contents by restoring from a course backup functioning as template';
-$string['enable_enrol_ext_db'] = 'Enable external database enrolement';
-$string['enable_enrol_ext_db_description'] = 'Teacher can choose if he wants to use external database enrolement. External database enrolment must be enabled and it must be changed so that it can be enabled for particular courses only';
-$string['duplication_timeframe'] = 'Course Duplication Timeframe';
-$string['duplication_timeframe_description'] = 'The number of hours after course creation where restore-actions are allowed';
-$string['his_deeplink_heading'] = 'HIS Deeplink Web Service settings';
-$string['his_deeplink_information'] = 'HIS Deeplink Web Service calls a HIS web service that adds a link to the his course pointing to the moodle course';
-$string['soappass_description'] = 'Password for the HIS Deeplink service';
-$string['soappass'] = 'Password';
-$string['soapuser_description'] = 'Username for the HIS Deeplink service';
-$string['soapuser'] = 'soapuser';
-$string['soapwsdl_description'] = 'Wdsl link for the HIS Deeplink service';
-$string['soapwsdl'] = 'soapwsdl';
-$string['his_deeplink_via_soap_description'] = 'Enable the HIS Deeplink web service';
-$string['his_deeplink_via_soap'] = 'Enable HIS Deeplink';
-$string['moodle_url'] = 'Moodle www root';
-$string['moodle_url_description'] = 'URL to Moodle www root, which is used to create the link for the his course';
-$string['importcalendar'] = 'HISLSF timetable';
-$string['importical'] = 'import timetable';
-$string['icalurl'] = 'ICal URL';
-$string['icalurl_description'] = 'URL that points to the HisLSF Ical Export (the list of relevant event ids will be dynamically appended)';
-$string['eventcourse_imported'] = 'Course imported';
-$string['eventmatchingtable_updated'] = 'Matchingtable updated';
-$string['eventcourse_duplicated'] = 'Course duplicated';
// Privacy API
$string['privacy:metadata:local_lsf_unification:veranstid'] = 'Identifier for the event from the HISLSF system';
diff --git a/lib.php b/lib.php
index 8de6a97..616fa12 100644
--- a/lib.php
+++ b/lib.php
@@ -1,12 +1,27 @@
.
+
/**
* Functions that aid core functionality
*/
defined('MOODLE_INTERNAL') || die();
// require_once("$CFG->dirroot/group/lib.php");
-require_once ($CFG->libdir . '/enrollib.php');
-require_once ($CFG->dirroot . '/user/lib.php');
+require_once($CFG->libdir . '/enrollib.php');
+require_once($CFG->dirroot . '/user/lib.php');
/**
* get_course_by_idnumber returns the course's id, where idnumber fits $courseid
@@ -16,11 +31,12 @@
*/
function get_course_by_idnumber($courseid, $silent = false) {
global $DB;
- $result = $DB->get_record('course', array('idnumber' => $courseid
- ), 'id');
+ $result = $DB->get_record('course', ['idnumber' => $courseid,
+ ], 'id');
$externid = isset($result->id) ? $result->id : -1;
- if (!$silent && (empty($externid) || $externid <= 0))
+ if (!$silent && (empty($externid) || $externid <= 0)) {
throw new moodle_exception('course not found');
+ }
return $externid;
}
@@ -32,8 +48,10 @@ function get_course_by_idnumber($courseid, $silent = false) {
*/
function find_or_create_category($title, $parent_title) {
global $DB;
- if ($category = $DB->get_record("course_categories", array("name" => $title
- ))) {
+ if (
+ $category = $DB->get_record("course_categories", ["name" => $title,
+ ])
+ ) {
return $category;
}
$parent = empty($parent_title) ? 0 : (find_or_create_category($parent_title, null)->id);
@@ -56,14 +74,18 @@ function find_or_create_category($title, $parent_title) {
function has_course_import_rights($veranstid, $user) {
global $DB;
if (!is_course_of_teacher($veranstid, $user->username)) {
- if ($courseentry = $DB->get_record("local_lsf_course",
- array("veranstid" => $veranstid, "requesterid" => $user->id
- ))) {
+ if (
+ $courseentry = $DB->get_record(
+ "local_lsf_course",
+ ["veranstid" => $veranstid, "requesterid" => $user->id,
+ ]
+ )
+ ) {
if ($courseentry->requeststate == 1) {
echo ("Course cannot be requested."); // The user shouldn't be on this website
// because this link isn't known to him
return false;
- } elseif ($courseentry->requeststate != 2) {
+ } else if ($courseentry->requeststate != 2) {
echo ("Course already created."); // The course already exists, so the user
// shouldn't get here
return false;
@@ -80,9 +102,13 @@ function has_course_import_rights($veranstid, $user) {
function is_course_imported_by($mdlid, $user) {
global $DB;
- if ($courseentry = $DB->get_record("local_lsf_course",
- array("mdlid" => $mdlid, "requesterid" => $user->id, "requeststate" => 2
- ))) {
+ if (
+ $courseentry = $DB->get_record(
+ "local_lsf_course",
+ ["mdlid" => $mdlid, "requesterid" => $user->id, "requeststate" => 2,
+ ]
+ )
+ ) {
return true;
}
return false;
@@ -90,10 +116,14 @@ function is_course_imported_by($mdlid, $user) {
function get_course_acceptor($mdlid) {
global $DB;
-
- if ($courseentry = $DB->get_record("local_lsf_course",
- array("mdlid" => $mdlid, "requeststate" => 2
- ))) {
+
+ if (
+ $courseentry = $DB->get_record(
+ "local_lsf_course",
+ ["mdlid" => $mdlid, "requeststate" => 2,
+ ]
+ )
+ ) {
return $courseentry->acceptorid;
}
return null;
@@ -107,12 +137,16 @@ function get_course_acceptor($mdlid) {
*/
function enable_manual_enrolment($course) {
global $DB;
-
+
$plugin = enrol_get_plugin('manual');
$instanceid = $plugin->add_default_instance($course);
- $instance = $DB->get_record('enrol',
- array('courseid' => $course->id, 'enrol' => 'manual', 'id' => $instanceid
- ), '*', MUST_EXIST);
+ $instance = $DB->get_record(
+ 'enrol',
+ ['courseid' => $course->id, 'enrol' => 'manual', 'id' => $instanceid,
+ ],
+ '*',
+ MUST_EXIST
+ );
$instance->roleid = get_config('local_lsf_unification', 'roleid_student');
$DB->update_record('enrol', $instance);
}
@@ -125,17 +159,17 @@ function enable_manual_enrolment($course) {
*/
function enable_lsf_enrolment($id, $enrolment_start, $enrolment_end) {
global $DB;
-
- $course = $DB->get_record('course', array('id' => $id
- ), '*', MUST_EXIST);
+
+ $course = $DB->get_record('course', ['id' => $id,
+ ], '*', MUST_EXIST);
$plugin = enrol_get_plugin('lsf');
- $fields = array(
- 'status' => ENROL_INSTANCE_ENABLED,
- 'enrolperiod' => null,
- 'roleid' => get_config('local_lsf_webservices', 'role_student'),
- 'customint1' => $enrolment_start,
- 'customint2' => $enrolment_end
- );
+ $fields = [
+ 'status' => ENROL_INSTANCE_ENABLED,
+ 'enrolperiod' => null,
+ 'roleid' => get_config('local_lsf_webservices', 'role_student'),
+ 'customint1' => $enrolment_start,
+ 'customint2' => $enrolment_end,
+ ];
$plugin->add_instance($course, $fields);
}
@@ -148,12 +182,16 @@ function enable_lsf_enrolment($id, $enrolment_start, $enrolment_end) {
*/
function enable_self_enrolment($course, $password) {
global $DB;
-
+
$plugin = enrol_get_plugin('self');
$instanceid = $plugin->add_default_instance($course);
- $instance = $DB->get_record('enrol',
- array('courseid' => $course->id, 'enrol' => 'self', 'id' => $instanceid
- ), '*', MUST_EXIST);
+ $instance = $DB->get_record(
+ 'enrol',
+ ['courseid' => $course->id, 'enrol' => 'self', 'id' => $instanceid,
+ ],
+ '*',
+ MUST_EXIST
+ );
$instance->password = $password;
$instance->roleid = get_config('local_lsf_unification', 'roleid_student');
$instance->expirythreshold = 0;
@@ -169,19 +207,23 @@ function enable_self_enrolment($course, $password) {
*/
function enable_database_enrolment($course) {
global $DB;
-
+
$plugin = enrol_get_plugin('database');
$instanceid = $plugin->add_default_instance($course);
}
-function create_guest_enrolment($course, $password = "", $enable = FALSE) {
+function create_guest_enrolment($course, $password = "", $enable = false) {
global $DB;
-
+
$plugin = enrol_get_plugin("guest");
$instanceid = $plugin->add_default_instance($course);
- $instance = $DB->get_record('enrol',
- array('courseid' => $course->id, 'enrol' => 'guest', 'id' => $instanceid
- ), '*', MUST_EXIST);
+ $instance = $DB->get_record(
+ 'enrol',
+ ['courseid' => $course->id, 'enrol' => 'guest', 'id' => $instanceid,
+ ],
+ '*',
+ MUST_EXIST
+ );
$instance->status = ($enable ? ENROL_INSTANCE_ENABLED : ENROL_INSTANCE_DISABLED);
if (!empty($password)) {
$instance->password = $password;
@@ -197,8 +239,8 @@ function create_guest_enrolment($course, $password = "", $enable = FALSE) {
*/
function self_enrolment_status($courseid) {
global $DB;
- return ($a = $DB->get_record('enrol', array("courseid" => $courseid, "enrol" => 'self'
- ))) ? ($a->password) : "";
+ return ($a = $DB->get_record('enrol', ["courseid" => $courseid, "enrol" => 'self',
+ ])) ? ($a->password) : "";
}
/**
@@ -213,9 +255,13 @@ function self_enrolment_status($courseid) {
*/
function get_default_course($fullname, $idnumber, $summary, $shortname) {
// check&format content
- if (empty($shortname))
- $shortname = (strlen($fullname) < 20) ? $fullname : substr($fullname, 0,
- strpos($fullname . ' ', ' ', 20));
+ if (empty($shortname)) {
+ $shortname = (strlen($fullname) < 20) ? $fullname : substr(
+ $fullname,
+ 0,
+ strpos($fullname . ' ', ' ', 20)
+ );
+ }
// create default object
$course = new stdClass();
$course->fullname = substr($fullname, 0, 254);
@@ -264,12 +310,12 @@ function get_or_create_support_user() {
function get_or_create_user($username, $email) {
global $DB, $CFG;
- if (!empty($username) && ($usr = $DB->get_record('user', array('username' => $username)))) {
+ if (!empty($username) && ($usr = $DB->get_record('user', ['username' => $username]))) {
if (empty($usr->email)) {
$usr->email = $email;
}
return $usr;
- } elseif ($usr = $DB->get_record('user', array('email' => $email))) {
+ } else if ($usr = $DB->get_record('user', ['email' => $email])) {
return $usr;
} else {
$user['firstname'] = "";
@@ -281,7 +327,7 @@ function get_or_create_user($username, $email) {
$user['auth'] = 'ldap'; // TODO default auth method should be configurable
$user['lang'] = $CFG->lang;
$user['id'] = user_create_user($user);
- return $DB->get_record('user', array('id' => $user['id']));
+ return $DB->get_record('user', ['id' => $user['id']]);
}
}
@@ -293,21 +339,23 @@ function get_or_create_user($username, $email) {
*/
function add_path_description($choices) {
global $DB;
- $result = array();
+ $result = [];
foreach ($choices as $id => $name) {
- $cat = $DB->get_record("course_categories", array("id" => $id
- ));
+ $cat = $DB->get_record("course_categories", ["id" => $id,
+ ]);
$path = explode("/", $cat->path);
$result[$id] = "";
foreach ($path as $pathid) {
- if(empty($pathid)){
+ if (empty($pathid)) {
$name = "";
} else {
- $name = $DB->get_record("course_categories",
- array("id" => $pathid
- ))->name;
+ $name = $DB->get_record(
+ "course_categories",
+ ["id" => $pathid,
+ ]
+ )->name;
}
- if(str_contains($name, 'Archiv')){
+ if (str_contains($name, 'Archiv')) {
unset($result[$id]);
break;
}
@@ -325,18 +373,19 @@ function add_path_description($choices) {
*/
function local_lsf_unification_cron() {
global $CFG, $pgDB;
- include_once (dirname(__FILE__) . '/class_pg_lite.php');
- include_once (dirname(__FILE__) . '/lib_features.php');
-
+ include_once(dirname(__FILE__) . '/class_pg_lite.php');
+ include_once(dirname(__FILE__) . '/lib_features.php');
+
$pgDB = new pg_lite();
$connected = $pgDB->connect();
$recourceid = $pgDB->connection;
-
+
mtrace(
- '! = unknown category found, ? = unknown linkage found;' . 'Verbindung: ' .
- ($connected ? 'ja' : 'nein') . ' (' . $recourceid . ')');
-
+ '! = unknown category found, ? = unknown linkage found;' . 'Verbindung: ' .
+ ($connected ? 'ja' : 'nein') . ' (' . $recourceid . ')'
+ );
+
insert_missing_helptable_entries(true, false);
-
+
$pgDB->dispose();
}
diff --git a/lib_features.php b/lib_features.php
index 2e7ca99..93c526f 100644
--- a/lib_features.php
+++ b/lib_features.php
@@ -1,4 +1,19 @@
.
+
/**
* Functions that are used by request.php
**/
@@ -24,7 +39,7 @@
* @param $category
* @throws moodle_exception
* @return array consisting of the course-object and warnings
-*/
+ */
function create_lsf_course($veranstid, $fullname, $shortname, $summary, $startdate, $database_enrol, $self_enrol, $password, $category) {
global $DB, $USER, $CFG;
$transaction = $DB->start_delegated_transaction();
@@ -34,14 +49,15 @@ function create_lsf_course($veranstid, $fullname, $shortname, $summary, $startda
}
// create course
$course = get_default_course($fullname, $veranstid, $summary, $shortname);
- $course->category = empty($category)?(find_or_create_category("HISLSF",null)->id):($category);
+ $course->category = empty($category) ? (find_or_create_category("HISLSF", null)->id) : ($category);
$course->startdate = $startdate;
// TODO: In future versions, better use `create_course()` in course/lib.php instead of several of the following lines.
$numsections = isset($course->numsections) ? $course->numsections : 0;
$course->id = $DB->insert_record('course', $course);
- if ($course->id == false)
- throw new moodle_exception('course not created: '.$DB->get_last_error());
- $course = $DB->get_record("course", array("id" => $course->id));
+ if ($course->id == false) {
+ throw new moodle_exception('course not created: ' . $DB->get_last_error());
+ }
+ $course = $DB->get_record("course", ["id" => $course->id]);
// create context
$context = context_course::instance($course->id);
// setup default blocks
@@ -59,14 +75,14 @@ function create_lsf_course($veranstid, $fullname, $shortname, $summary, $startda
// enrole creator
enrol_try_internal_enrol($course->id, $USER->id, get_config('local_lsf_unification', 'roleid_teacher'));
- //enrol_try_internal_enrol($course->id, $USER->id, get_config('local_lsf_unification', 'roleid_teacher'), time() - 1, time() + 60 * 60 * get_config('local_lsf_unification', 'duplication_timeframe'));
+ // enrol_try_internal_enrol($course->id, $USER->id, get_config('local_lsf_unification', 'roleid_teacher'), time() - 1, time() + 60 * 60 * get_config('local_lsf_unification', 'duplication_timeframe'));
// enrole teachers
$warnings .= enrole_teachers($veranstid, $course->id);
// create guest-enrolment
- create_guest_enrolment($course, $enable = FALSE);
-
+ create_guest_enrolment($course, $enable = false);
+
// enable enrolment-plugins
if ($database_enrol) {
enable_database_enrolment($course);
@@ -77,13 +93,14 @@ function create_lsf_course($veranstid, $fullname, $shortname, $summary, $startda
// create course in helptable
set_course_created($veranstid, $course->id);
-
+
// create deeplink
- if (get_config('local_lsf_unification', 'his_deeplink_via_soap'))
- $warnings .= setHisLink($veranstid,$course->id)? "" : ( (empty($warnings) ? "" : "\n")."Deeplink-Error");
+ if (get_config('local_lsf_unification', 'his_deeplink_via_soap')) {
+ $warnings .= setHisLink($veranstid, $course->id) ? "" : ( (empty($warnings) ? "" : "\n") . "Deeplink-Error");
+ }
$transaction->allow_commit();
- return array("course"=>$course,"warnings"=>$warnings);
+ return ["course" => $course, "warnings" => $warnings];
}
/**
@@ -97,14 +114,14 @@ function send_support_mail($course, $text) {
global $USER;
$supportuser = get_or_create_support_user();
$params = new stdClass();
- $params->a = $USER->firstname." ".$USER->lastname;
+ $params->a = $USER->firstname . " " . $USER->lastname;
$params->b = $USER->id;
$params->c = mb_convert_encoding($course->fullname, 'UTF-8', 'ISO-8859-1');
$params->d = $course->id;
$params->e = $text;
- $adhocdata = array('supportuserid' => $supportuser->id, 'requesterfirstname' => $USER->firstname,
- 'requesterlastname' => $USER->lastname, 'params' => $params);
+ $adhocdata = ['supportuserid' => $supportuser->id, 'requesterfirstname' => $USER->firstname,
+ 'requesterlastname' => $USER->lastname, 'params' => $params];
$sendemail = new \local_lsf_unification\task\send_mail_category_wish();
$sendemail->set_custom_data($adhocdata);
\core\task\manager::queue_adhoc_task($sendemail);
@@ -123,11 +140,11 @@ function send_course_request_mail($recipientusername, $course, $requestid) {
$email = username_to_mail($recipientusername);
$user = get_or_create_user($recipientusername, $email);
$params = new stdClass();
- $params->a = $USER->firstname." ".$USER->lastname;
+ $params->a = $USER->firstname . " " . $USER->lastname;
$params->c = mb_convert_encoding($course->titel, 'UTF-8', 'ISO-8859-1');
- $data = array('recipientid' => $user->id, 'requesterid' => $USER->id, 'requesterfirstname' => $USER->firstname,
- 'requesterlastname' => $USER->lastname, 'requestid' => $requestid, 'params' => $params);
+ $data = ['recipientid' => $user->id, 'requesterid' => $USER->id, 'requesterfirstname' => $USER->firstname,
+ 'requesterlastname' => $USER->lastname, 'requestid' => $requestid, 'params' => $params];
$sendemail = new \local_lsf_unification\task\send_mail_request_teacher_to_create_course();
$sendemail->set_custom_data($data);
\core\task\manager::queue_adhoc_task($sendemail);
@@ -136,7 +153,7 @@ function send_course_request_mail($recipientusername, $course, $requestid) {
function get_remote_creation_continue_link($veranstid) {
global $CFG;
- return $CFG->wwwroot.'/local/lsf_unification/request.php?answer=1&veranstid='.$veranstid;
+ return $CFG->wwwroot . '/local/lsf_unification/request.php?answer=1&veranstid=' . $veranstid;
}
/**
@@ -148,11 +165,11 @@ function get_remote_creation_continue_link($veranstid) {
function send_course_creation_mail($recipient, $course) {
global $USER;
$params = new stdClass();
- $params->a = $USER->firstname." ".$USER->lastname;
+ $params->a = $USER->firstname . " " . $USER->lastname;
$params->c = mb_convert_encoding($course->titel, 'UTF-8', 'ISO-8859-1');
- $data = array('recipientid' => $recipient->id, 'acceptorid' => $USER->id, 'acceptorfirstname' => $USER->firstname,
- 'acceptorlastname' => $USER->lastname, 'veranstid' => $course->veranstid, 'params' => $params);
+ $data = ['recipientid' => $recipient->id, 'acceptorid' => $USER->id, 'acceptorfirstname' => $USER->firstname,
+ 'acceptorlastname' => $USER->lastname, 'veranstid' => $course->veranstid, 'params' => $params];
$sendemail = new \local_lsf_unification\task\send_mail_course_creation_accepted();
$sendemail->set_custom_data($data);
\core\task\manager::queue_adhoc_task($sendemail);
@@ -168,11 +185,11 @@ function send_course_creation_mail($recipient, $course) {
function send_sorry_mail($recipient, $course) {
global $USER;
$params = new stdClass();
- $params->a = $USER->firstname." ".$USER->lastname;
+ $params->a = $USER->firstname . " " . $USER->lastname;
$params->c = mb_convert_encoding($course->titel, 'UTF-8', 'ISO-8859-1');
- $data = array('recipientid' => $recipient->id, 'acceptorid' => $USER->id, 'acceptorfirstname' => $USER->firstname,
- 'acceptorlastname' => $USER->lastname, 'params' => $params);
+ $data = ['recipientid' => $recipient->id, 'acceptorid' => $USER->id, 'acceptorfirstname' => $USER->firstname,
+ 'acceptorlastname' => $USER->lastname, 'params' => $params];
$sendemail = new \local_lsf_unification\task\send_mail_course_creation_declined();
$sendemail->set_custom_data($data);
\core\task\manager::queue_adhoc_task($sendemail);
@@ -186,11 +203,11 @@ function send_sorry_mail($recipient, $course) {
*/
function get_my_courses_as_teacher($additionalid = null) {
global $DB, $USER, $CFG;
- $helpfuntion1 = function($array_el) {
+ $helpfuntion1 = function ($array_el) {
return $array_el->instanceid;
};
- $addsql = empty($additionalid)?"":"OR ".$CFG->prefix."role_assignments.userid=$additionalid";
- $sql = "SELECT ".$CFG->prefix."role_assignments.id, instanceid, roleid FROM ".$CFG->prefix."role_assignments JOIN ".$CFG->prefix."context ON ".$CFG->prefix."role_assignments.contextid = ".$CFG->prefix."context.id WHERE ".$CFG->prefix."role_assignments.roleid=".$CFG->creatornewroleid." AND ( ".$CFG->prefix."role_assignments.userid=$USER->id ".$addsql." ) AND ".$CFG->prefix."context.contextlevel=50";
+ $addsql = empty($additionalid) ? "" : "OR " . $CFG->prefix . "role_assignments.userid=$additionalid";
+ $sql = "SELECT " . $CFG->prefix . "role_assignments.id, instanceid, roleid FROM " . $CFG->prefix . "role_assignments JOIN " . $CFG->prefix . "context ON " . $CFG->prefix . "role_assignments.contextid = " . $CFG->prefix . "context.id WHERE " . $CFG->prefix . "role_assignments.roleid=" . $CFG->creatornewroleid . " AND ( " . $CFG->prefix . "role_assignments.userid=$USER->id " . $addsql . " ) AND " . $CFG->prefix . "context.contextlevel=50";
return array_map($helpfuntion1, $DB->get_records_sql($sql));
}
@@ -199,20 +216,22 @@ function get_my_courses_as_teacher($additionalid = null) {
*/
function get_backup_files($additionalid = null) {
global $DB, $USER;
- //disable restore feature temporarily
- $backuppath = get_config('backup','backup_auto_destination').'';
- $result = array();
+ // disable restore feature temporarily
+ $backuppath = get_config('backup', 'backup_auto_destination') . '';
+ $result = [];
$copies = implode("|", get_my_courses_as_teacher($additionalid));
- if (!($handle = opendir($backuppath))) return $result;
+ if (!($handle = opendir($backuppath))) {
+ return $result;
+ }
while (false !== ($entry = readdir($handle))) {
- $matches = array();
- if (preg_match('/^sicherung-moodle2-course-('.$copies.')-(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})\.mbz$/mi',$entry,$matches)) {
+ $matches = [];
+ if (preg_match('/^sicherung-moodle2-course-(' . $copies . ')-(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})\.mbz$/mi', $entry, $matches)) {
$file = new stdClass();
$file->name = $entry;
$file->path = $backuppath;
$file->datetime = "$matches[5]:$matches[6] $matches[4].$matches[3].$matches[2]";
- $file->course = $DB->get_record("course", array("id"=>$matches[1]), "id, fullname, shortname");
- $result[md5($entry."_".$USER->id)] = $file;
+ $file->course = $DB->get_record("course", ["id" => $matches[1]], "id, fullname, shortname");
+ $result[md5($entry . "_" . $USER->id)] = $file;
}
}
closedir($handle);
@@ -224,18 +243,20 @@ function get_backup_files($additionalid = null) {
*/
function get_template_files() {
global $DB, $USER;
- //disable restore feature temporarily
- $backuppath = get_config('backup','backup_auto_destination').'/templates';
- $result = array();
- $files = array();
- if (!($handle = opendir($backuppath))) return $result;
+ // disable restore feature temporarily
+ $backuppath = get_config('backup', 'backup_auto_destination') . '/templates';
+ $result = [];
+ $files = [];
+ if (!($handle = opendir($backuppath))) {
+ return $result;
+ }
// read filetree
- $filenames = array();
+ $filenames = [];
while (false !== ($entry = readdir($handle))) {
- if ($entry != "." && $entry != ".." && is_dir($backuppath."/".$entry)) {
- $handle2 = opendir($backuppath."/".$entry);
+ if ($entry != "." && $entry != ".." && is_dir($backuppath . "/" . $entry)) {
+ $handle2 = opendir($backuppath . "/" . $entry);
while (false !== ($entry2 = readdir($handle2))) {
- $filenames[] = $entry."/".$entry2;
+ $filenames[] = $entry . "/" . $entry2;
}
} else {
$filenames[] = $entry;
@@ -243,14 +264,14 @@ function get_template_files() {
}
// build file-info objects
foreach ($filenames as $entry) {
- $matches = array();
- if (preg_match('/^((.+)\/)?template(\d{1,})\.mbz$/mi',$entry,$matches)) {
+ $matches = [];
+ if (preg_match('/^((.+)\/)?template(\d{1,})\.mbz$/mi', $entry, $matches)) {
$file = new stdClass();
$file->name = $entry;
$file->path = $backuppath;
$file->info = "no info available";
- $file->category = isset($matches[2])?$matches[2]:"";
- $txt_file = $file->path."/".substr($file->name,0,-3)."txt";
+ $file->category = isset($matches[2]) ? $matches[2] : "";
+ $txt_file = $file->path . "/" . substr($file->name, 0, -3) . "txt";
if (file_exists($txt_file)) {
$file->info = file_get_contents($txt_file);
}
@@ -258,10 +279,10 @@ function get_template_files() {
}
}
closedir($handle);
- //sort files and prepare output
+ // sort files and prepare output
ksort($files);
foreach ($files as $file) {
- $result[md5($file->name."_".$USER->id)] = $file;
+ $result[md5($file->name . "_" . $USER->id)] = $file;
}
return $result;
}
@@ -276,34 +297,39 @@ function get_template_files() {
*/
function duplicate_course($courseid, $foldername) {
global $DB, $USER;
-
+
$transaction = $DB->start_delegated_transaction();
-
+
try {
// Get required capability by temporarily assigning a role
- //$context = context_course::instance($courseid);
- //$roleid = 14;// array_shift(get_roles_with_capability("moodle/restore:restorecourse", CAP_ALLOW ,$context))->id;
- //enrol_try_internal_enrol($courseid, $USER->id, $roleid);
+ // $context = context_course::instance($courseid);
+ // $roleid = 14;// array_shift(get_roles_with_capability("moodle/restore:restorecourse", CAP_ALLOW ,$context))->id;
+ // enrol_try_internal_enrol($courseid, $USER->id, $roleid);
+
+ $USER->access = null;
- $USER->access = NULL;
-
// Init Restore Process
- $controller = new restore_controller($foldername, $courseid,
- backup::INTERACTIVE_NO, backup::MODE_SAMESITE, $USER->id,
- backup::TARGET_EXISTING_ADDING);
+ $controller = new restore_controller(
+ $foldername,
+ $courseid,
+ backup::INTERACTIVE_NO,
+ backup::MODE_SAMESITE,
+ $USER->id,
+ backup::TARGET_EXISTING_ADDING
+ );
// Restore bachup into course
- $restoresettings = array (
- 'role_assignments' => 0, // Include user role assignments (default = 1)
- 'activities' => 1, // Include activities (default = 1)
- 'blocks' => 1, // Include blocks (default = 1)
- 'filters' => 1, // Include filters (default = 1)
- 'comments' => 0, // Include comments (default = 1)
- 'userscompletion' => 0, // Include user completion details (default = 1)
- 'logs' => 0, // Include course logs (default = 0)
- 'grade_histories' => 0, // Include grade history (default = 0)
- 'users' => 0 // Include user data (default = 0)
- );
+ $restoresettings = [
+ 'role_assignments' => 0, // Include user role assignments (default = 1)
+ 'activities' => 1, // Include activities (default = 1)
+ 'blocks' => 1, // Include blocks (default = 1)
+ 'filters' => 1, // Include filters (default = 1)
+ 'comments' => 0, // Include comments (default = 1)
+ 'userscompletion' => 0, // Include user completion details (default = 1)
+ 'logs' => 0, // Include course logs (default = 0)
+ 'grade_histories' => 0, // Include grade history (default = 0)
+ 'users' => 0, // Include user data (default = 0)
+ ];
foreach ($controller->get_plan()->get_tasks() as $taskindex => $task) {
if ($taskindex == 0) {
@@ -324,18 +350,18 @@ function duplicate_course($courseid, $foldername) {
$controller->execute_plan();
// Delete temporary assignment and force capability cache to reload
- $USER->access = NULL;
+ $USER->access = null;
// Update SectionCount
- $format = $DB->get_record("course",array("id" => $courseid),"id, format")->format;
+ $format = $DB->get_record("course", ["id" => $courseid], "id, format")->format;
if ($format == "topics" || $format == "weeks") {
- $sectioncount = $DB->count_records("course_sections", array("course" => $courseid));
+ $sectioncount = $DB->count_records("course_sections", ["course" => $courseid]);
$format = course_get_format($courseid);
- $format->update_course_format_options(array("numsections" => ($sectioncount-1)));
+ $format->update_course_format_options(["numsections" => ($sectioncount - 1)]);
}
-
+
// Restore Course Summary
- $DB->update_record("course", (object) array("id" => $courseid, "summaryformat" => 1, "summary" => get_default_summary(get_course_by_veranstid($DB->get_record("course",array("id" => $courseid),"id, idnumber")->idnumber))));
+ $DB->update_record("course", (object) ["id" => $courseid, "summaryformat" => 1, "summary" => get_default_summary(get_course_by_veranstid($DB->get_record("course", ["id" => $courseid], "id, idnumber")->idnumber))]);
// Commit
$transaction->allow_commit();
@@ -344,7 +370,7 @@ function duplicate_course($courseid, $foldername) {
$transaction->rollback($e);
// Delete temporary assignment and force capability cache to reload
- $USER->access = NULL;
+ $USER->access = null;
}
}
@@ -352,8 +378,12 @@ function duplicate_course($courseid, $foldername) {
function lsf_unification_unzip($zipfile, $destination = '', $showstatus_ignored = true) {
global $CFG, $USER;
$fb = get_file_packer('application/vnd.moodle.backup');
- $result = $fb->extract_to_pathname($zipfile,
- $destination, null, null);
+ $result = $fb->extract_to_pathname(
+ $zipfile,
+ $destination,
+ null,
+ null
+ );
return $result != false;
return true;
-}
\ No newline at end of file
+}
diff --git a/lib_his.php b/lib_his.php
index fa9bc89..d7ccbbd 100644
--- a/lib_his.php
+++ b/lib_his.php
@@ -1,28 +1,45 @@
.
+
/**
* Functions that are specific to HIS database, format and helptables containing his-formatted data
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
-require_once ($CFG->dirroot . '/local/lsf_unification/class_pg_lite.php');
+require_once($CFG->dirroot . '/local/lsf_unification/class_pg_lite.php');
-define("HIS_PERSONAL", "public.learnweb_personal");
-define("HIS_VERANSTALTUNG", "public.learnweb_veranstaltung");
+define("HIS_PERSONAL", "public.learnweb_personal");
+define("HIS_VERANSTALTUNG", "public.learnweb_veranstaltung");
define("HIS_PERSONAL_VERANST", "public.learnweb_personal_veranst");
-define("HIS_UEBERSCHRIFT", "public.learnweb_ueberschrift");
-define("HIS_STDP", "public.learnweb_stdp");
-define("HIS_VERANST_KOMMENTAR","public.learnweb_veranst_kommentar");
+define("HIS_UEBERSCHRIFT", "public.learnweb_ueberschrift");
+define("HIS_STDP", "public.learnweb_stdp");
+define("HIS_VERANST_KOMMENTAR", "public.learnweb_veranst_kommentar");
/**
* establish_secondary_DB_connection is a required function for the lsf_unification plugin
*/
function establish_secondary_DB_connection() {
global $pgDB;
- if (!empty($pgDB) && !empty($pgDB->connection))
+ if (!empty($pgDB) && !empty($pgDB->connection)) {
return;
+ }
$pgDB = new pg_lite();
- if (!($pgDB->connect() === true))
+ if (!($pgDB->connect() === true)) {
return false;
+ }
return true;
}
@@ -31,24 +48,29 @@ function establish_secondary_DB_connection() {
*/
function close_secondary_DB_connection() {
global $pgDB;
- if (empty($pgDB) || empty($pgDB->connection))
+ if (empty($pgDB) || empty($pgDB->connection)) {
return;
+ }
$pgDB->dispose();
}
function setupHisSoap() {
global $CFG, $hislsf_soapclient;
- if (!get_config('local_lsf_unification', 'his_deeplink_via_soap'))
+ if (!get_config('local_lsf_unification', 'his_deeplink_via_soap')) {
return false;
+ }
if (empty($hislsf_soapclient)) {
try {
$hislsf_soapclient = new SoapClient(get_config('local_lsf_unification', 'soapwsdl'));
- $result = $hislsf_soapclient->auth(get_config('local_lsf_unification', 'soapuser'),
- get_config('local_lsf_unification', 'soappass'));
+ $result = $hislsf_soapclient->auth(
+ get_config('local_lsf_unification', 'soapuser'),
+ get_config('local_lsf_unification', 'soappass')
+ );
$his_moodle_url = get_config('local_lsf_unification', 'moodle_url');
$result = $result &&
$hislsf_soapclient->configureMoodleWKZ(
- $his_moodle_url . "/course/view.php?id=MOODLEID");
+ $his_moodle_url . "/course/view.php?id=MOODLEID"
+ );
return $result;
} catch (Exception $e) {
return false;
@@ -59,8 +81,9 @@ function setupHisSoap() {
function setHisLink($veranstid, $mdlid) {
global $hislsf_soapclient;
- if (!setupHisSoap())
+ if (!setupHisSoap()) {
return false;
+ }
$hislsf_soapclient->removeMoodleLink($veranstid); // to override the old value (if a link
// already is etablished) you have to remove
// the existing Link first
@@ -70,8 +93,9 @@ function setHisLink($veranstid, $mdlid) {
function removeHisLink($veranstid) {
global $hislsf_soapclient;
- if (!setupHisSoap())
+ if (!setupHisSoap()) {
return false;
+ }
$hislsf_soapclient->removeMoodleLink($veranstid);
return true;
}
@@ -79,10 +103,12 @@ function removeHisLink($veranstid) {
function get_students_stdp_terminids($mtknr) {
global $pgDB;
establish_secondary_DB_connection();
- $q = pg_query($pgDB->connection,
- "SELECT terminid FROM " . HIS_STDP .
- " WHERE mtknr = $mtknr and terminid is not null group by terminid order by terminid;");
- $return = array();
+ $q = pg_query(
+ $pgDB->connection,
+ "SELECT terminid FROM " . HIS_STDP .
+ " WHERE mtknr = $mtknr and terminid is not null group by terminid order by terminid;"
+ );
+ $return = [];
while ($terminid = pg_fetch_object($q)) {
array_push($return, $terminid->terminid);
}
@@ -92,15 +118,17 @@ function get_students_stdp_terminids($mtknr) {
/**
* get_teachers_pid returns the pid (personen-id) connected to a specific username
- *
+ *
* @param $username the teachers username
* @return $pid the teachers pid (personen-id)
*/
function get_teachers_pid($username, $checkhis = false) {
global $pgDB;
$emailcheck = $checkhis ? (" OR (login = '" . $username . "')") : "";
- $q = pg_query($pgDB->connection,
- "SELECT pid FROM " . HIS_PERSONAL . " WHERE (zivk = '" . $username . "')" . $emailcheck);
+ $q = pg_query(
+ $pgDB->connection,
+ "SELECT pid FROM " . HIS_PERSONAL . " WHERE (zivk = '" . $username . "')" . $emailcheck
+ );
if ($hislsf_teacher = pg_fetch_object($q)) {
return $hislsf_teacher->pid;
}
@@ -112,20 +140,23 @@ function get_teachers_pid($username, $checkhis = false) {
function get_courses_by_veranstids($veranstids) {
global $pgDB;
-
+
// if veranstids is empty, no need to make a db request. return empty list
- if (empty($veranstids))
- return array();
-
+ if (empty($veranstids)) {
+ return [];
+ }
+
$veranstids_string = implode(',', $veranstids);
- $q = pg_query($pgDB->connection,
- "SELECT veranstid, veranstnr, semester, semestertxt, veranstaltungsart, titel, urlveranst
+ $q = pg_query(
+ $pgDB->connection,
+ "SELECT veranstid, veranstnr, semester, semestertxt, veranstaltungsart, titel, urlveranst
FROM " .
HIS_VERANSTALTUNG . " as veranst where veranstid in (" . $veranstids_string .
") AND " . "(CURRENT_DATE - CAST(veranst.zeitstempel AS date)) < " .
get_config('local_lsf_unification', 'max_import_age') .
- "order by semester,titel;");
- $result_list = array();
+ "order by semester,titel;"
+ );
+ $result_list = [];
while ($course = pg_fetch_object($q)) {
$result = new stdClass();
$result->veranstid = $course->veranstid;
@@ -141,17 +172,19 @@ function get_courses_by_veranstids($veranstids) {
}
function get_course_by_veranstid($veranstid) {
- $result = get_courses_by_veranstids(array($veranstid
- ));
+ $result = get_courses_by_veranstids([$veranstid,
+ ]);
return $result[$veranstid];
}
function get_veranstids_by_teacher($pid) {
global $pgDB;
- $q = pg_query($pgDB->connection,
- "SELECT veranstid FROM " . HIS_PERSONAL_VERANST .
- " WHERE pid = $pid and veranstid is not null group by veranstid order by veranstid;");
- $return = array();
+ $q = pg_query(
+ $pgDB->connection,
+ "SELECT veranstid FROM " . HIS_PERSONAL_VERANST .
+ " WHERE pid = $pid and veranstid is not null group by veranstid order by veranstid;"
+ );
+ $return = [];
while ($veranstid = pg_fetch_object($q)) {
array_push($return, $veranstid->veranstid);
}
@@ -173,7 +206,7 @@ function username_to_mail($username) {
*/
function get_teachers_course_list($username, $longinfo = false) {
global $pgDB;
- $courselist = array();
+ $courselist = [];
$pid = get_teachers_pid($username);
if (empty($pid)) {
return $courselist;
@@ -217,12 +250,16 @@ function find_origin_category($quellid) {
$origin = $quellid;
do {
$quellid = $origin;
- $q = pg_query($pgDB->connection,
- "SELECT quellid FROM " . HIS_UEBERSCHRIFT . " WHERE ueid = '" . $quellid . "'");
+ $q = pg_query(
+ $pgDB->connection,
+ "SELECT quellid FROM " . HIS_UEBERSCHRIFT . " WHERE ueid = '" . $quellid . "'"
+ );
if ($hislsf_title = pg_fetch_object($q)) {
- $q2 = pg_query($pgDB->connection,
- "SELECT quellid FROM " . HIS_UEBERSCHRIFT . " WHERE ueid = '" .
- ($hislsf_title->quellid) . "'");
+ $q2 = pg_query(
+ $pgDB->connection,
+ "SELECT quellid FROM " . HIS_UEBERSCHRIFT . " WHERE ueid = '" .
+ ($hislsf_title->quellid) . "'"
+ );
if ($hislsf_title2 = pg_fetch_object($q2)) {
$origin = $hislsf_title->quellid;
}
@@ -241,26 +278,31 @@ function get_teachers_of_course($veranstid) {
global $pgDB;
// get sorted (by relevance) pids of teachers
$pidstring = "";
- $pids = array();
- $q1 = pg_query($pgDB->connection,
- "SELECT DISTINCT pid, sort FROM " . HIS_PERSONAL_VERANST . " WHERE veranstid = " .
- $veranstid . " ORDER BY sort ASC");
+ $pids = [];
+ $q1 = pg_query(
+ $pgDB->connection,
+ "SELECT DISTINCT pid, sort FROM " . HIS_PERSONAL_VERANST . " WHERE veranstid = " .
+ $veranstid . " ORDER BY sort ASC"
+ );
while ($person = pg_fetch_object($q1)) {
$pidstring .= (empty($pidstring) ? "" : ",") . $person->pid;
$pids[] = $person->pid;
}
- if (empty($pids))
- return array();
+ if (empty($pids)) {
+ return [];
+ }
// get personal info
- $result = array();
- $q2 = pg_query($pgDB->connection,
- "SELECT vorname, nachname, zivk, login, pid FROM " . HIS_PERSONAL . " WHERE pid IN (" .
- $pidstring . ")");
+ $result = [];
+ $q2 = pg_query(
+ $pgDB->connection,
+ "SELECT vorname, nachname, zivk, login, pid FROM " . HIS_PERSONAL . " WHERE pid IN (" .
+ $pidstring . ")"
+ );
while ($person = pg_fetch_object($q2)) {
$result[$person->pid] = $person;
}
// sort by relevance
- $sortedresult = array();
+ $sortedresult = [];
foreach ($pids as $pid) {
$sortedresult[] = $result[$pid];
}
@@ -296,8 +338,10 @@ function get_default_shortname($lsf_course, $long = false) {
$i .= strtoupper($word[0]) . (($long && !empty($word[1])) ? $word[1] : "");
}
$name = mb_convert_encoding($i . "-" . substr($lsf_course->semester, 0, 4) . "_" . substr($lsf_course->semester, -1), 'UTF-8', 'ISO-8859-1');
- if (!$long && $DB->record_exists('course', array('shortname' => $name
- ))) {
+ if (
+ !$long && $DB->record_exists('course', ['shortname' => $name,
+ ])
+ ) {
return get_default_shortname($lsf_course, true);
}
return $name;
@@ -313,9 +357,11 @@ function get_default_shortname($lsf_course, $long = false) {
function get_default_summary($lsf_course) {
global $pgDB;
$summary = '';
- $q = pg_query($pgDB->connection,
- "SELECT kommentar FROM " . HIS_VERANST_KOMMENTAR . " WHERE veranstid = '" .
- $lsf_course->veranstid . "'");
+ $q = pg_query(
+ $pgDB->connection,
+ "SELECT kommentar FROM " . HIS_VERANST_KOMMENTAR . " WHERE veranstid = '" .
+ $lsf_course->veranstid . "'"
+ );
while ($sum_object = pg_fetch_object($q)) {
if (!empty($sum_object->kommentar) && strpos($summary, $sum_object->kommentar) === false) {
$summary .= '
' . $sum_object->kommentar . '
';
@@ -349,15 +395,17 @@ function get_default_startdate($lsf_course) {
*/
function course_exists($veranstid) {
global $DB;
- if ($DB->record_exists("local_lsf_course", array("veranstid" => ($veranstid))) &&
- !($DB->record_exists("local_lsf_course", array("veranstid" => ($veranstid), "mdlid" => 0)) ||
- $DB->record_exists("local_lsf_course", array("veranstid" => ($veranstid), "mdlid" => 1)))) {
- if (!$DB->record_exists("course", array("idnumber" => ($veranstid)))) {
- $DB->delete_records("local_lsf_course", array("veranstid" => ($veranstid)));
+ if (
+ $DB->record_exists("local_lsf_course", ["veranstid" => ($veranstid)]) &&
+ !($DB->record_exists("local_lsf_course", ["veranstid" => ($veranstid), "mdlid" => 0]) ||
+ $DB->record_exists("local_lsf_course", ["veranstid" => ($veranstid), "mdlid" => 1]))
+ ) {
+ if (!$DB->record_exists("course", ["idnumber" => ($veranstid)])) {
+ $DB->delete_records("local_lsf_course", ["veranstid" => ($veranstid)]);
} else {
return true;
}
- } else if($DB->record_exists("course", array("idnumber" => ($veranstid)))){
+ } else if ($DB->record_exists("course", ["idnumber" => ($veranstid)])) {
return true;
}
return false;
@@ -406,15 +454,20 @@ function enrole_teachers($veranstid, $courseid) {
foreach (get_teachers_of_course($veranstid) as $lsf_user) {
unset($teacher);
if (!empty($lsf_user->zivk)) {
- $teacher = $DB->get_record("user", array("username" => $lsf_user->zivk));
+ $teacher = $DB->get_record("user", ["username" => $lsf_user->zivk]);
}
// if user cannot be found by zivk try to find user by login that is manually set in his
if (empty($teacher) && !empty($lsf_user->login)) {
- $teacher = $DB->get_record("user", array("username" => $lsf_user->login));
+ $teacher = $DB->get_record("user", ["username" => $lsf_user->login]);
}
- if (empty($teacher) ||
- !enrol_try_internal_enrol($courseid, $teacher->id,
- get_config('local_lsf_unification', 'roleid_teacher'))) {
+ if (
+ empty($teacher) ||
+ !enrol_try_internal_enrol(
+ $courseid,
+ $teacher->id,
+ get_config('local_lsf_unification', 'roleid_teacher')
+ )
+ ) {
$warnings = $warnings . "\n" .
get_string('warning_cannot_enrol_other', 'local_lsf_unification') . " (" .
$lsf_user->zivk . ", " . $lsf_user->login . " " . $lsf_user->vorname . " " .
@@ -433,7 +486,7 @@ function enrole_teachers($veranstid, $courseid) {
*/
function set_course_created($veranstid, $courseid) {
global $DB;
- if ($courseentry = $DB->get_record("local_lsf_course", array("veranstid" => $veranstid))) {
+ if ($courseentry = $DB->get_record("local_lsf_course", ["veranstid" => $veranstid])) {
$courseentry->mdlid = $courseid;
$courseentry->timestamp = time();
$DB->update_record('local_lsf_course', $courseentry);
@@ -448,18 +501,18 @@ function set_course_created($veranstid, $courseid) {
function get_course_request($rid) {
global $DB;
- return $DB->get_record("local_lsf_course", array("id" => $rid, "mdlid" => 0));
+ return $DB->get_record("local_lsf_course", ["id" => $rid, "mdlid" => 0]);
}
function get_course_requests() {
global $DB;
- return $DB->get_records("local_lsf_course", array("mdlid" => 0), "id");
+ return $DB->get_records("local_lsf_course", ["mdlid" => 0], "id");
}
function set_course_requested($veranstid) {
global $DB, $USER;
- if ($courseentry = $DB->get_record("local_lsf_course", array("veranstid" => $veranstid))) {
- return NULL;
+ if ($courseentry = $DB->get_record("local_lsf_course", ["veranstid" => $veranstid])) {
+ return null;
} else {
$courseentry = new stdClass();
$courseentry->veranstid = $veranstid;
@@ -473,19 +526,19 @@ function set_course_requested($veranstid) {
function set_course_accepted($veranstid) {
global $DB, $USER;
- if ($courseentry = $DB->get_record("local_lsf_course", array("veranstid" => $veranstid))) {
+ if ($courseentry = $DB->get_record("local_lsf_course", ["veranstid" => $veranstid])) {
$courseentry->requeststate = 2;
$courseentry->timestamp = time();
$courseentry->acceptorid = $USER->id;
$DB->update_record('local_lsf_course', $courseentry);
- return $courseentry->id;
+ return $courseentry->id;
}
}
function set_course_declined($veranstid) {
global $DB, $USER;
- if ($courseentry = $DB->get_record("local_lsf_course", array("veranstid" => $veranstid))) {
- $DB->delete_records("local_lsf_course", array("veranstid" => ($veranstid)));
+ if ($courseentry = $DB->get_record("local_lsf_course", ["veranstid" => $veranstid])) {
+ $DB->delete_records("local_lsf_course", ["veranstid" => ($veranstid)]);
}
}
@@ -507,12 +560,15 @@ function get_courses_categories($veranstid, $update_helptables_if_necessary = tr
$helpfuntion3 = function ($array_el) {
return $array_el->mdlid;
};
- $q = pg_query($pgDB->connection,
- "SELECT ueid FROM " . HIS_UEBERSCHRIFT . " WHERE veranstid=" . $veranstid . "");
- $choices = array();
- $categories = array();
- while ($hislsf_title = pg_fetch_object($q))
+ $q = pg_query(
+ $pgDB->connection,
+ "SELECT ueid FROM " . HIS_UEBERSCHRIFT . " WHERE veranstid=" . $veranstid . ""
+ );
+ $choices = [];
+ $categories = [];
+ while ($hislsf_title = pg_fetch_object($q)) {
$ueids = (empty($ueids) ? "" : ($ueids . ", ")) . ("" . $hislsf_title->ueid . "");
+ }
$other_ueids_sql = "SELECT parent FROM " . $CFG->prefix .
"local_lsf_categoryparenthood WHERE child in (" . $ueids . ")";
$origins_sql = "SELECT origin FROM " . $CFG->prefix . "local_lsf_category WHERE ueid in (" .
@@ -524,8 +580,10 @@ function get_courses_categories($veranstid, $update_helptables_if_necessary = tr
"local_lsf_category.mdlid = " . $CFG->prefix .
"course_categories.id) WHERE ueid in (" . $origins . ") ORDER BY sortorder";
if (get_config('local_lsf_unification', 'subcategories')) {
- $maincourses = implode(", ",
- array_map($helpfuntion3, $DB->get_records_sql($categories_sql)));
+ $maincourses = implode(
+ ", ",
+ array_map($helpfuntion3, $DB->get_records_sql($categories_sql))
+ );
if (empty($maincourses)) {
$maincourses = get_config('local_lsf_unification', 'defaultcategory');
}
@@ -535,14 +593,13 @@ function get_courses_categories($veranstid, $update_helptables_if_necessary = tr
$categories_sql_child = "SELECT id, name FROM " . $CFG->prefix .
"course_categories WHERE parent in (" . $maincourses . ") ORDER BY sortorder";
$categories_child = $DB->get_records_sql($categories_sql_child);
- $categories = $categories+ array_map($helpfuntion2, $categories_child);
- foreach($categories_child as $child){
- if(!str_contains($child->name, 'Archiv')){
+ $categories = $categories + array_map($helpfuntion2, $categories_child);
+ foreach ($categories_child as $child) {
+ if (!str_contains($child->name, 'Archiv')) {
$categories_sql_iterative = "SELECT id, name FROM " . $CFG->prefix .
- "course_categories WHERE path like '%".$child->id."/%' ORDER BY sortorder";
- $categories = array_map($helpfuntion2, $DB->get_records_sql($categories_sql_iterative))+ $categories;
+ "course_categories WHERE path like '%" . $child->id . "/%' ORDER BY sortorder";
+ $categories = array_map($helpfuntion2, $DB->get_records_sql($categories_sql_iterative)) + $categories;
}
-
}
return $categories;
}
@@ -569,21 +626,28 @@ function insert_missing_helptable_entries($debugoutput = false, $tryeverything =
$list2 = "";
$records1 = $DB->get_recordset('local_lsf_category', null, '', 'ueid');
$records2 = $DB->get_recordset('local_lsf_categoryparenthood', null, '', 'child, parent');
- $records1_unique = array();
- $records2_unique = array();
- foreach ($records1 as $record1)
+ $records1_unique = [];
+ $records2_unique = [];
+ foreach ($records1 as $record1) {
$records1_unique[$record1->ueid] = true;
- foreach ($records2 as $record2)
+ }
+ foreach ($records2 as $record2) {
$records2_unique[$record2->child][$record2->parent] = ($tryeverything === false);
-
- $q_main = pg_query($pgDB->connection,
- "SELECT ueid, uebergeord, uebergeord, quellid, txt, zeitstempel FROM " . HIS_UEBERSCHRIFT .
+ }
+
+ $q_main = pg_query(
+ $pgDB->connection,
+ "SELECT ueid, uebergeord, uebergeord, quellid, txt, zeitstempel FROM " . HIS_UEBERSCHRIFT .
" " .
- ((!empty($tryeverything)) ? ("WHERE ueid >= '" . $tryeverything . "'") : ""));
+ ((!empty($tryeverything)) ? ("WHERE ueid >= '" . $tryeverything . "'") : "")
+ );
while ($hislsf_title = pg_fetch_object($q_main)) {
- if (!isset($records1_unique[$hislsf_title->ueid]) || (!isset(
- $records2_unique[$hislsf_title->ueid][$hislsf_title->uebergeord]) ||
- $records2_unique[$hislsf_title->ueid][$hislsf_title->uebergeord] != true)) {
+ if (
+ !isset($records1_unique[$hislsf_title->ueid]) || (!isset(
+ $records2_unique[$hislsf_title->ueid][$hislsf_title->uebergeord]
+ ) ||
+ $records2_unique[$hislsf_title->ueid][$hislsf_title->uebergeord] != true)
+ ) {
$a++;
echo $hislsf_title->ueid . " ";
}
@@ -596,28 +660,34 @@ function insert_missing_helptable_entries($debugoutput = false, $tryeverything =
$entry->mdlid = 0;
$entry->timestamp = strtotime($hislsf_title->zeitstempel);
$entry->txt = mb_convert_encoding($hislsf_title->txt, 'UTF-8', 'ISO-8859-1');
- if ($debugoutput)
+ if ($debugoutput) {
echo "!";
+ }
try {
$DB->insert_record("local_lsf_category", $entry, true);
$records1_unique[$hislsf_title->ueid] = true;
- if ($debugoutput)
+ if ($debugoutput) {
echo "x";
+ }
} catch (Exception $e) {
try {
$entry->txt = mb_convert_encoding(delete_bad_chars($hislsf_title->txt), 'UTF-8', 'ISO-8859-1');
$DB->insert_record("local_lsf_category", $entry, true);
$records1_unique[$hislsf_title->ueid] = true;
- if ($debugoutput)
+ if ($debugoutput) {
echo "x";
- } catch(Exception $e) {
- if ($debugoutput)
- print("
";
diff --git a/version.php b/version.php
index f302d6c..a6e38b4 100644
--- a/version.php
+++ b/version.php
@@ -17,7 +17,7 @@
/**
* Version details.
*
- * @package local
+ * @package local_lsf_unification
* @subpackage lsf_unification
* @copyright 2011 Olaf Koehler WWU
*/
From 4541cc1229edec776c79683201cf6b232b7d54b0 Mon Sep 17 00:00:00 2001
From: Tamaro Walter
Date: Wed, 10 Dec 2025 18:39:19 +0100
Subject: [PATCH 5/7] ci: Add Learnweb workflow for static checks and tests
---
.github/PULL_REQUEST_TEMPLATE.md | 53 ++++++++++++++++++++++++++++++++
.github/workflows/moodle-ci.yml | 16 ++++++++++
2 files changed, 69 insertions(+)
create mode 100644 .github/PULL_REQUEST_TEMPLATE.md
create mode 100644 .github/workflows/moodle-ci.yml
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..cabc576
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,53 @@
+> **Note:** Please fill out all relevant sections and remove irrelevant ones.
+### 🔀 Purpose of this PR:
+
+- [ ] Fixes a bug
+- [ ] Updates for a new Moodle version
+- [ ] Adds a new feature of functionality
+- [ ] Improves or enhances existing features
+- [ ] Refactoring: restructures code for better performance or maintainability
+- [ ] Testing: add missing or improve existing tests
+- [ ] Miscellaneous: code cleaning (without functional changes), documentation, configuration, ...
+
+---
+
+### 📝 Description:
+
+Please describe the purpose of this PR in a few sentences.
+
+- What feature or bug does it address?
+- Why is this change or addition necessary?
+- What is the expected behavior after the change?
+
+---
+
+### 📋 Checklist
+
+Please confirm the following (check all that apply):
+
+- [ ] I have `phpunit` and/or `behat` tests that cover my changes or additions.
+- [ ] Code passes the code checker without errors and warnings.
+- [ ] Code passes the moodle-ci/cd pipeline on all supported Moodle versions or the ones the plugin supports.
+- [ ] Code does not have `var_dump()` or `var_export` or any other debugging statements (or commented out code) that
+ should not appear on the productive branch.
+- [ ] Code only uses language strings instead of hard-coded strings.
+- [ ] If there are changes in the database: I updated/created the necessary upgrade steps in `db/upgrade.php` and
+ updated the `version.php`.
+- [ ] If there are changes in javascript: I build new `.min` files with the `grunt amd` command.
+- [ ] If it is a Moodle update PR: I read the release notes, updated the `version.php` and the `CHANGES.md`.
+ I ran all tests thoroughly checking for errors. I checked if bootstrap had any changes/deprecations that require
+ changes in the plugins UI.
+
+---
+
+### 🔍 Related Issues
+
+- Related to #[IssueNumber]
+
+---
+
+### 🧾📸🌐 Additional Information (like screenshots, documentation, links, etc.)
+
+Any other relevant information.
+
+---
\ No newline at end of file
diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml
new file mode 100644
index 0000000..312e206
--- /dev/null
+++ b/.github/workflows/moodle-ci.yml
@@ -0,0 +1,16 @@
+name: Moodle Plugin CI
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ call-learnweb-moodle-ci:
+ name: "Central Learnweb Moodle CI workflow"
+ uses: learnweb/moodle-workflows-learnweb/.github/workflows/moodle-ci.yml@main
+ with:
+ allow-mustache-lint-error: true
+ allow-grunt-error: true
From 1059c4e58ae52e9693812c4451f686ee3b109cdf Mon Sep 17 00:00:00 2001
From: Tamaro Walter
Date: Wed, 10 Dec 2025 19:19:41 +0100
Subject: [PATCH 6/7] Design request page first overview using a template
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We introduce a new renderable called first_overview which uses a
template for rendering the first overview.
Co-authored-by: Daniel Meißner
---
classes/output/first_overview.php | 56 +++++++++++++++++
request.php | 27 +++-----
templates/first_overview.mustache | 101 ++++++++++++++++++++++++++++++
3 files changed, 166 insertions(+), 18 deletions(-)
create mode 100644 classes/output/first_overview.php
create mode 100644 templates/first_overview.mustache
diff --git a/classes/output/first_overview.php b/classes/output/first_overview.php
new file mode 100644
index 0000000..07f29c4
--- /dev/null
+++ b/classes/output/first_overview.php
@@ -0,0 +1,56 @@
+.
+
+namespace local_lsf_unification\output;
+
+use core\output\renderable;
+use core\output\renderer_base;
+use core\output\templatable;
+use stdClass;
+
+/**
+ * First overview dialog for the request page.
+ *
+ * @package local_lsf_unification
+ * @copyright 2025 Daniel Meißner
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class first_overview implements renderable, templatable {
+
+ /**
+ * Constructor for first_overview.
+ *
+ * @param array $courses An array of courses as returned by get_teachers_course_list
+ */
+ public function __construct(
+ /** @var array An array of courses as returned by get_teachers_course_list */
+ public readonly array $courses
+ ) {
+ }
+
+ #[\Override]
+ public function export_for_template(renderer_base $output): stdClass {
+ $courselist = array_map(function($course) {
+ return (object) ["title" => $course->info];
+ }, array_values($this->courses));
+ $showremotecreation = get_config("local_lsf_unification", "remote_creation");
+
+ return (object) [
+ "courselist" => $courselist,
+ "showremotecreation" => $showremotecreation,
+ ];
+ }
+}
diff --git a/request.php b/request.php
index bc2c31e..020bcee 100644
--- a/request.php
+++ b/request.php
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+use local_lsf_unification\output\first_overview;
+
require_once(dirname(__FILE__) . '/../../config.php');
global $CFG, $USER, $DB, $PAGE, $SESSION, $OUTPUT;
// require_once($CFG->dirroot . '/course/lib.php');
@@ -68,25 +70,14 @@
}
function print_first_overview() {
+ global $PAGE;
global $USER;
- $courselist = "
";
- foreach (get_teachers_course_list($USER->username, true) as $course) {
- if (!course_exists($course->veranstid)) {
- $courselist .= "
";
- echo "";
+ $courselist = array_filter(
+ get_teachers_course_list($USER->username, true),
+ function ($course) { return !course_exists($course->veranstid); }
+ );
+ $output = $PAGE->get_renderer('core');
+ echo $output->render(new first_overview($courselist));
}
function print_helptext($t, $s = null) {
diff --git a/templates/first_overview.mustache b/templates/first_overview.mustache
new file mode 100644
index 0000000..1a0c61e
--- /dev/null
+++ b/templates/first_overview.mustache
@@ -0,0 +1,101 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle 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 3 of the License, or
+ (at your option) any later version.
+
+ Moodle 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 Moodle. If not, see .
+}}
+{{!
+ @template local_lsf_unification/first_overview
+
+ This template renders the first overview part of the request page.
+
+ Example (json):
+ {
+ "courselist": [
+ {
+ "title": "Veranstaltungstitel Nr.1",
+ },
+ {
+ "title": "Veranstaltungstitel Nr.2",
+ },
+ {
+ "title": "Veranstaltungstitel Nr.3",
+ }
+ ]
+ }
+}}
+
+
{{#str}} notice, local_lsf_unification {{/str}}
+
+
From 2c5c7646e4619babd9b65dd43cfbbe6bb830333b Mon Sep 17 00:00:00 2001
From: Tamaro Walter
Date: Wed, 10 Dec 2025 19:25:36 +0100
Subject: [PATCH 7/7] Reformat SQL string to be more readable
---
lib_his.php | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/lib_his.php b/lib_his.php
index d7ccbbd..0ac14db 100644
--- a/lib_his.php
+++ b/lib_his.php
@@ -147,15 +147,24 @@ function get_courses_by_veranstids($veranstids) {
}
$veranstids_string = implode(',', $veranstids);
- $q = pg_query(
- $pgDB->connection,
- "SELECT veranstid, veranstnr, semester, semestertxt, veranstaltungsart, titel, urlveranst
- FROM " .
- HIS_VERANSTALTUNG . " as veranst where veranstid in (" . $veranstids_string .
- ") AND " . "(CURRENT_DATE - CAST(veranst.zeitstempel AS date)) < " .
- get_config('local_lsf_unification', 'max_import_age') .
- "order by semester,titel;"
- );
+ $max_age = get_config('local_lsf_unification', 'max_import_age');
+
+ $sql = "
+ SELECT
+ veranstid,
+ veranstnr,
+ semester,
+ semestertxt,
+ veranstaltungsart,
+ titel,
+ urlveranst
+ FROM " . HIS_VERANSTALTUNG . " as veranst
+ WHERE
+ veranstid in ($veranstids_string)
+ AND (CURRENT_DATE - CAST(veranst.zeitstempel AS date)) < $max_age
+ ORDER BY semester, titel;";
+
+ $q = pg_query($pgDB->connection, $sql);
$result_list = [];
while ($course = pg_fetch_object($q)) {
$result = new stdClass();