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
diff --git a/cal_import.php b/cal_import.php
index 2a164b6..c1ca2cf 100644
--- a/cal_import.php
+++ b/cal_import.php
@@ -1,4 +1,19 @@
.
+
/**
* This page adds a hislsf calendar instance to the users calendars. It is accessible from the manage_calendars site.
* To limit the changes to original moodle-files, the call of his_add_cal() is done here.
@@ -11,4 +26,4 @@
$url->param('back', $back);
$PAGE->set_url($url);
his_add_cal();
-redirect($back);
\ No newline at end of file
+redirect($back);
diff --git a/cal_lib.php b/cal_lib.php
index 20acf55..c154198 100644
--- a/cal_lib.php
+++ b/cal_lib.php
@@ -1,15 +1,30 @@
.
+
/**
* Functions for creating hislsf calendar instances
*/
if (!defined('MOODLE_INTERNAL')) {
- die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+ die('Direct access to this script is forbidden.'); // It must be included from a Moodle page
}
define("HIS_CAL_IDENTIFIER", "hislsf");
-require_once($CFG->dirroot.'/calendar/lib.php');
-require_once($CFG->libdir.'/bennu/bennu.inc.php');
+require_once($CFG->dirroot . '/calendar/lib.php');
+require_once($CFG->libdir . '/bennu/bennu.inc.php');
/**
* Returns the CURRENT (because of the event ids instead of the user id being appended this URL changes when users subscribe to new events) userspecific ICal-URL
@@ -17,10 +32,10 @@
*/
function his_get_ical_url($userid) {
global $DB, $CFG;
- require_once($CFG->dirroot.'/local/lsf_unification/lib_his.php');
- $user = $DB->get_record("user" ,array("id" => $userid));
- $terminidstring = implode(",",get_students_stdp_terminids($user->idnumber));
- return get_config('local_lsf_unification', 'icalurl').$terminidstring;
+ require_once($CFG->dirroot . '/local/lsf_unification/lib_his.php');
+ $user = $DB->get_record("user", ["id" => $userid]);
+ $terminidstring = implode(",", get_students_stdp_terminids($user->idnumber));
+ return get_config('local_lsf_unification', 'icalurl') . $terminidstring;
}
/**
@@ -42,7 +57,9 @@ function create_default_his_subscription() {
*/
function his_add_cal() {
global $PAGE;
- if (his_already_imported_cal()) return;
+ if (his_already_imported_cal()) {
+ return;
+ }
$sub = create_default_his_subscription();
$subscriptionid = calendar_add_subscription($sub);
try {
@@ -60,7 +77,7 @@ function his_add_cal() {
*/
function his_already_imported_cal() {
global $USER, $DB;
- return $DB->record_exists('event_subscriptions', array("userid" => $USER->id, "url" => HIS_CAL_IDENTIFIER));
+ return $DB->record_exists('event_subscriptions', ["userid" => $USER->id, "url" => HIS_CAL_IDENTIFIER]);
}
/**
@@ -69,8 +86,12 @@ function his_already_imported_cal() {
*/
function his_print_cal_import_form($mform) {
global $PAGE, $CFG;
- if (his_already_imported_cal()) return;
- if (getSSONo() < 0) return;
+ if (his_already_imported_cal()) {
+ return;
+ }
+ if (getSSONo() < 0) {
+ return;
+ }
$mform->addElement('header', 'addhissubscriptionform', get_string('importcalendar', 'local_lsf_unification'));
- $mform->addElement('html', ''.get_string('importical', 'local_lsf_unification').'');
-}
\ No newline at end of file
+ $mform->addElement('html', '' . get_string('importical', 'local_lsf_unification') . '');
+}
diff --git a/class_pg_lite.php b/class_pg_lite.php
index 48f6d04..359d8de 100644
--- a/class_pg_lite.php
+++ b/class_pg_lite.php
@@ -1,18 +1,32 @@
.
+
defined('MOODLE_INTERNAL') || die;
class pg_lite {
-
public $connection = null;
public function connect() {
- $config = "host='".get_config('local_lsf_unification', 'dbhost')."' port ='".get_config('local_lsf_unification', 'dbport')."' user='".get_config('local_lsf_unification', 'dbuser')."' password='".get_config('local_lsf_unification', 'dbpass')."' dbname='".get_config('local_lsf_unification', 'dbname')."'";
+ $config = "host='" . get_config('local_lsf_unification', 'dbhost') . "' port ='" . get_config('local_lsf_unification', 'dbport') . "' user='" . get_config('local_lsf_unification', 'dbuser') . "' password='" . get_config('local_lsf_unification', 'dbpass') . "' dbname='" . get_config('local_lsf_unification', 'dbname') . "'";
ob_start();
$this->connection = pg_connect($config, PGSQL_CONNECT_FORCE_NEW);
$dberr = ob_get_contents();
ob_end_clean();
echo $dberr;
- return ((pg_connection_status($this->connection) === false) || (pg_connection_status($this->connection) === PGSQL_CONNECTION_BAD))?$dberr:true;
+ return ((pg_connection_status($this->connection) === false) || (pg_connection_status($this->connection) === PGSQL_CONNECTION_BAD)) ? $dberr : true;
}
public function dispose() {
@@ -21,5 +35,4 @@ public function dispose() {
$this->connection = null;
}
}
-
-}
\ No newline at end of file
+}
diff --git a/classes/event/course_duplicated.php b/classes/event/course_duplicated.php
index f9fca28..4680aee 100644
--- a/classes/event/course_duplicated.php
+++ b/classes/event/course_duplicated.php
@@ -13,12 +13,12 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
+
/**
* The matchingtableupdated event.
*
- * @package FULLPLUGINNAME
- * @copyright 2014 YOUR NAME
+ * @package local_lsf_unification
+ * @copyright 2025 Tamaro Walter
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace local_lsf_unification\event;
@@ -36,16 +36,16 @@ protected function init() {
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'course';
}
-
+
public static function get_name() {
return get_string('eventcourse_duplicated', 'local_lsf_unification');
}
-
+
public function get_description() {
return "The user with id '{$this->userid}' duplicated contents from course with id '{$this->other}' into a course with id '{$this->objectid}'.";
}
-
+
public function get_url() {
- return new \moodle_url('/course/view.php', array('id' => $this->objectid));
+ return new \moodle_url('/course/view.php', ['id' => $this->objectid]);
}
}
diff --git a/classes/event/course_imported.php b/classes/event/course_imported.php
index 5cacf55..66d91e5 100644
--- a/classes/event/course_imported.php
+++ b/classes/event/course_imported.php
@@ -13,12 +13,12 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
+
/**
* The matchingtableupdated event.
*
- * @package FULLPLUGINNAME
- * @copyright 2014 YOUR NAME
+ * @package local_lsf_unification
+ * @copyright 2025 Tamaro Walter
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace local_lsf_unification\event;
@@ -36,16 +36,16 @@ protected function init() {
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'course';
}
-
+
public static function get_name() {
return get_string('eventcourse_imported', 'local_lsf_unification');
}
-
+
public function get_description() {
return "The user with id '{$this->userid}' imported the HISLSF-course with veranstid '{$this->other}' as a new moodle course with id '{$this->objectid}'.";
}
-
+
public function get_url() {
- return new \moodle_url('/course/view.php', array('id' => $this->objectid));
+ return new \moodle_url('/course/view.php', ['id' => $this->objectid]);
}
}
diff --git a/classes/event/matchingtable_updated.php b/classes/event/matchingtable_updated.php
index 3a52584..c72569e 100644
--- a/classes/event/matchingtable_updated.php
+++ b/classes/event/matchingtable_updated.php
@@ -13,12 +13,12 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
+
/**
* The matchingtableupdated event.
*
- * @package FULLPLUGINNAME
- * @copyright 2014 YOUR NAME
+ * @package local_lsf_unification
+ * @copyright 2025 Tamaro Walter
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace local_lsf_unification\event;
@@ -36,16 +36,16 @@ protected function init() {
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'local_lsf_category';
}
-
+
public static function get_name() {
return get_string('eventmatchingtable_updated', 'local_lsf_unification');
}
-
+
public function get_description() {
return "The user with id '{$this->userid}' updated a his category matching with id '{$this->objectid}'. Original mapping: '{$this->other["mappingold"]}'. New mapping: '{$this->other["mappingnew"]}'.";
}
-
+
public function get_url() {
- return new \moodle_url('/local/lsf_unification/helptablemanager.php', array('originid' => $this->other["originid"]));
+ return new \moodle_url('/local/lsf_unification/helptablemanager.php', ['originid' => $this->other["originid"]]);
}
}
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/classes/privacy/provider.php b/classes/privacy/provider.php
index 8a41c84..653789f 100644
--- a/classes/privacy/provider.php
+++ b/classes/privacy/provider.php
@@ -17,7 +17,7 @@
/**
* Privacy Implementation for lsf_unification.
*
- * @package lsf_unification
+ * @package local_lsf_unification
* @copyright 2018 Nina Herrmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -46,7 +46,7 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l
* @param $collection
* @return mixed
*/
- public static function _get_metadata ($collection) {
+ public static function _get_metadata($collection) {
$collection->add_database_table(
'local_lsf_course',
[
@@ -55,7 +55,7 @@ public static function _get_metadata ($collection) {
'timestamp' => 'privacy:metadata:local_lsf_unification:timestamp',
'requeststate' => 'privacy:metadata:local_lsf_unification:requeststate',
'requesterid' => 'privacy:metadata:local_lsf_unification:requesterid',
- 'acceptorid' => 'privacy:metadata:local_lsf_unification:acceptorid'
+ 'acceptorid' => 'privacy:metadata:local_lsf_unification:acceptorid',
],
'privacy:metadata:local_lsf_unification'
@@ -69,7 +69,7 @@ public static function _get_metadata ($collection) {
* @return contextlist $contextlist The list of contexts for a specific user.
* @throws \dml_exception
*/
- public static function _get_contexts_for_userid ($userid) {
+ public static function _get_contexts_for_userid($userid) {
global $DB;
$contextlist = new contextlist();
@@ -133,7 +133,7 @@ public static function _export_user_data(approved_contextlist $contextlist) {
}
}
$subcontext = [
- get_string('pluginname', 'local_lsf_unification')
+ get_string('pluginname', 'local_lsf_unification'),
];
if (!empty($contextdatatowrite)) {
writer::with_context($context)->export_data($subcontext, (object)$contextdatatowrite);
@@ -154,14 +154,14 @@ private function create_data_to_write($action, $courserequest, $username) {
global $DB;
$status = '';
switch ($courserequest->requeststate) {
- case 0 :
+ case 0:
$status = "is declined or not requested";
break;
- case 1 :
+ case 1:
$status =
"is waiting";
break;
- case 2 :
+ case 2:
$status =
"is granted";
break;
@@ -170,10 +170,10 @@ private function create_data_to_write($action, $courserequest, $username) {
'action' => get_string('privacy:local_lsf_unification:' . $action, 'local_lsf_unification'),
'timestamp' => date('c', $courserequest->timestamp),
'username' => $username,
- 'status' => $status
+ 'status' => $status,
];
// In case the course exist we add the name to the information.
- $course = $DB->get_record('course', array('id' => $courserequest->mdlid));
+ $course = $DB->get_record('course', ['id' => $courserequest->mdlid]);
if (!empty($course)) {
$data->coursename = $course->fullname;
}
@@ -194,10 +194,10 @@ public static function _delete_data_for_all_users_in_context($context) {
return;
}
// Sanity check that context is at the User context level.
- if ($context->contextlevel == CONTEXT_USER ) {
+ if ($context->contextlevel == CONTEXT_USER) {
$userid = $context->instanceid;
- $DB->delete_records("local_lsf_course", array('acceptorid' => $userid));
- $DB->delete_records("local_lsf_course", array('requesterid' => $userid));
+ $DB->delete_records("local_lsf_course", ['acceptorid' => $userid]);
+ $DB->delete_records("local_lsf_course", ['requesterid' => $userid]);
}
}
@@ -214,15 +214,14 @@ public static function _delete_data_for_user($contextlist) {
}
foreach ($contexts as $context) {
-
// Sanity check that context is at the User context level, then get the userid.
if ($context->contextlevel !== CONTEXT_USER) {
continue;
}
$userid = $context->instanceid;
- $DB->delete_records("local_lsf_course", array('acceptorid' => $userid));
- $DB->delete_records("local_lsf_course", array('requesterid' => $userid));
+ $DB->delete_records("local_lsf_course", ['acceptorid' => $userid]);
+ $DB->delete_records("local_lsf_course", ['requesterid' => $userid]);
}
}
-}
\ No newline at end of file
+}
diff --git a/classes/task/send_mail_category_wish.php b/classes/task/send_mail_category_wish.php
index 38b252f..46b5913 100644
--- a/classes/task/send_mail_category_wish.php
+++ b/classes/task/send_mail_category_wish.php
@@ -17,7 +17,7 @@
/**
* The ad hoc task for sending a email to the support user with a wish for a different category.
*
- * @package his_unification
+ * @package local_lsf_unification
* @copyright 2018 Nina Herrmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -43,7 +43,7 @@ public function execute() {
$data = $this->get_custom_data();
$supportuserid = $data->supportuserid;
- $supportuserarray = user_get_users_by_id(array($supportuserid));
+ $supportuserarray = user_get_users_by_id([$supportuserid]);
// In case no recipient can be found the task is aborted and deleted.
if (empty($supportuserarray[$supportuserid])) {
return;
@@ -58,13 +58,20 @@ public function execute() {
// E) e-> the text entered by the user regarding the category wish.
$content = get_string('email', 'local_lsf_unification', $data->params);
- $wassent = email_to_user($supportuser, get_string('email_from', 'local_lsf_unification').
- " (by ".$data->requesterfirstname." ".$data->requesterlastname.")",
- get_string('config_category_wish', 'local_lsf_unification'), $content);
+ $wassent = email_to_user(
+ $supportuser,
+ get_string('email_from', 'local_lsf_unification') .
+ " (by " . $data->requesterfirstname . " " . $data->requesterlastname . ")",
+ get_string('config_category_wish', 'local_lsf_unification'),
+ $content
+ );
if (!$wassent) {
- throw new \moodle_exception(get_string('ad_hoc_task_failed',
- 'local_lsf_unification', 'send_mail_category_wish'));
+ throw new \moodle_exception(get_string(
+ 'ad_hoc_task_failed',
+ 'local_lsf_unification',
+ 'send_mail_category_wish'
+ ));
}
}
-}
\ No newline at end of file
+}
diff --git a/classes/task/send_mail_course_creation_accepted.php b/classes/task/send_mail_course_creation_accepted.php
index df05ba2..a3bd918 100644
--- a/classes/task/send_mail_course_creation_accepted.php
+++ b/classes/task/send_mail_course_creation_accepted.php
@@ -18,7 +18,7 @@
* The ad hoc task for sending a email that a requested course was accepted to be created. The mail is send to the
* user who requested the course.
*
- * @package his_unification
+ * @package local_lsf_unification
* @copyright 2018 Nina Herrmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -45,7 +45,7 @@ public function execute() {
$data = $this->get_custom_data();
$recipientid = $data->recipientid;
- $userarray = user_get_users_by_id(array($recipientid));
+ $userarray = user_get_users_by_id([$recipientid]);
// In case no recipient can be found the task is aborted and deleted.
if (empty($userarray[$recipientid])) {
@@ -53,7 +53,7 @@ public function execute() {
}
$user = $userarray[$recipientid];
$data->params->requesturl = get_remote_creation_continue_link($data->veranstid);
- $data->params->userurl = $CFG->wwwroot.'/user/view.php?id=' . $data->acceptorid;
+ $data->params->userurl = $CFG->wwwroot . '/user/view.php?id=' . $data->acceptorid;
// Expected params of $data->params are:
// A) a -> (string) firstname,
// B) userurl-> (string) the url to the user page,
@@ -61,12 +61,19 @@ public function execute() {
// D) requesturl-> the url to answer the request.
$content = get_string('email3', 'local_lsf_unification', $data->params);
- $wassent = email_to_user($user, get_string('email_from', 'local_lsf_unification')
- ." (by ".$data->acceptorfirstname." ".$data->acceptorlastname.")",
- get_string('email3_title', 'local_lsf_unification'), $content);
+ $wassent = email_to_user(
+ $user,
+ get_string('email_from', 'local_lsf_unification')
+ . " (by " . $data->acceptorfirstname . " " . $data->acceptorlastname . ")",
+ get_string('email3_title', 'local_lsf_unification'),
+ $content
+ );
if (!$wassent) {
- throw new \moodle_exception(get_string('ad_hoc_task_failed',
- 'local_lsf_unification', 'send_mail_course_creation_accepted'));
+ throw new \moodle_exception(get_string(
+ 'ad_hoc_task_failed',
+ 'local_lsf_unification',
+ 'send_mail_course_creation_accepted'
+ ));
}
}
-}
\ No newline at end of file
+}
diff --git a/classes/task/send_mail_course_creation_declined.php b/classes/task/send_mail_course_creation_declined.php
index 0ccb46a..998c910 100644
--- a/classes/task/send_mail_course_creation_declined.php
+++ b/classes/task/send_mail_course_creation_declined.php
@@ -18,7 +18,7 @@
* The ad hoc task for sending a email that a request to create a course was declined. The mail is send to the
* user who requested the course.
*
- * @package his_unification
+ * @package local_lsf_unification
* @copyright 2018 Nina Herrmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -46,26 +46,33 @@ public function execute() {
$data = $this->get_custom_data();
$recipientid = $data->recipientid;
- $userarray = user_get_users_by_id(array($recipientid));
+ $userarray = user_get_users_by_id([$recipientid]);
// In case no recipient can be found the task is aborted and deleted.
if (empty($userarray[$recipientid])) {
return;
}
$user = $userarray[$recipientid];
- $data->params->userurl = $CFG->wwwroot.'/user/view.php?id='. $data->acceptorid;
+ $data->params->userurl = $CFG->wwwroot . '/user/view.php?id=' . $data->acceptorid;
// Expected params of $data->params are:
// A) a -> (string) firstname of the user,
// B) userurl-> (string) URL to the profile page of the user who declined the request, and
// C) c-> the (string) coursename.
$content = get_string('email4', 'local_lsf_unification', $data->params);
- $wassent = email_to_user($user, get_string('email_from', 'local_lsf_unification').
- " (by ".$data->acceptorfirstname." ".$data->acceptorlastname.")",
- get_string('email4_title', 'local_lsf_unification'), $content);
+ $wassent = email_to_user(
+ $user,
+ get_string('email_from', 'local_lsf_unification') .
+ " (by " . $data->acceptorfirstname . " " . $data->acceptorlastname . ")",
+ get_string('email4_title', 'local_lsf_unification'),
+ $content
+ );
if (!$wassent) {
- throw new \moodle_exception(get_string('ad_hoc_task_failed', 'local_lsf_unification',
- 'send_mail_course_creation_declined'));
+ throw new \moodle_exception(get_string(
+ 'ad_hoc_task_failed',
+ 'local_lsf_unification',
+ 'send_mail_course_creation_declined'
+ ));
}
}
-}
\ No newline at end of file
+}
diff --git a/classes/task/send_mail_request_teacher_to_create_course.php b/classes/task/send_mail_request_teacher_to_create_course.php
index eb35e42..48983b2 100644
--- a/classes/task/send_mail_request_teacher_to_create_course.php
+++ b/classes/task/send_mail_request_teacher_to_create_course.php
@@ -18,7 +18,7 @@
* The ad hoc task for sending a email to the teacher of a course. The course is requested from a different user
* and the teacher is asked for permission.
*
- * @package his_unification
+ * @package local_lsf_unification
* @copyright 2018 Nina Herrmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -45,15 +45,15 @@ public function execute() {
$data = $this->get_custom_data();
$recipientid = $data->recipientid;
- $userarray = user_get_users_by_id(array($recipientid));
+ $userarray = user_get_users_by_id([$recipientid]);
// In case no recipient can be found the task is aborted and deleted.
if (empty($userarray[$recipientid])) {
return;
}
$user = $userarray[$recipientid];
- $data->params->requesturl = $CFG->wwwroot.'/local/lsf_unification/request.php?answer=12&requestid=' . $data->requestid;
- $data->params->userurl = $CFG->wwwroot.'/user/view.php?id=' . $data->requesterid;
+ $data->params->requesturl = $CFG->wwwroot . '/local/lsf_unification/request.php?answer=12&requestid=' . $data->requestid;
+ $data->params->userurl = $CFG->wwwroot . '/user/view.php?id=' . $data->requesterid;
// Expected params of $data->params are:
// A) a-> (string) firstname,
// B) userurl-> (string) url to the user profile page of the requesting user,
@@ -61,13 +61,20 @@ public function execute() {
// D) requesturl-> the (moodle_url)link for managing the request.
$content = get_string('email2', 'local_lsf_unification', $data->params);
- $wassent = email_to_user($user, get_string('email_from', 'local_lsf_unification').
- " (by ".$data->requesterfirstname." ".$data->requesterlastname.")",
- get_string('email2_title', 'local_lsf_unification'), $content);
+ $wassent = email_to_user(
+ $user,
+ get_string('email_from', 'local_lsf_unification') .
+ " (by " . $data->requesterfirstname . " " . $data->requesterlastname . ")",
+ get_string('email2_title', 'local_lsf_unification'),
+ $content
+ );
if (!$wassent) {
- throw new \moodle_exception(get_string('ad_hoc_task_failed', 'local_lsf_unification',
- 'send_mail_request_teacher_to_create_course'));
+ throw new \moodle_exception(get_string(
+ 'ad_hoc_task_failed',
+ 'local_lsf_unification',
+ 'send_mail_request_teacher_to_create_course'
+ ));
}
}
-}
\ No newline at end of file
+}
diff --git a/db/install.php b/db/install.php
index 7712979..c38aa44 100644
--- a/db/install.php
+++ b/db/install.php
@@ -1,29 +1,44 @@
.
// This file replaces:
-// * STATEMENTS section in db/install.xml
-// * lib.php/modulename_install() post installation hook
-// * partially defaults.php
+// * STATEMENTS section in db/install.xml
+// * lib.php/modulename_install() post installation hook
+// * partially defaults.php
+
defined('MOODLE_INTERNAL') || die();
/**
- * @package local
+ * @package local_lsf_unification
* @subpackage lsf_unification
- * @author Olaf Markus Khler (WWU)
+ * @author Olaf Markus K�hler (WWU)
*/
- function xmldb_local_lsf_unification_install() {
+function xmldb_local_lsf_unification_install() {
xmldb_local_lsf_unification_install_course_creator_role();
- }
-
+}
+
function xmldb_local_lsf_unification_install_course_creator_role() {
global $DB;
$result = true;
$sysctx = context_system::instance();
- $levels = array(CONTEXT_COURSECAT, CONTEXT_COURSE, CONTEXT_MODULE);
+ $levels = [CONTEXT_COURSECAT, CONTEXT_COURSE, CONTEXT_MODULE];
/// Fully setup the restore role.
- if (!$mrole = $DB->get_record('role', array('shortname' => 'lsfunificationcourseimporter'))) {
- if ($rid = create_role('LSF Unification Course Importer', 'lsfunificationcourseimporter', '','coursecreator')) {
+ if (!$mrole = $DB->get_record('role', ['shortname' => 'lsfunificationcourseimporter'])) {
+ if ($rid = create_role('LSF Unification Course Importer', 'lsfunificationcourseimporter', '', 'coursecreator')) {
$result = $result & assign_capability('moodle/restore:restorecourse', CAP_ALLOW, $rid, $sysctx->id);
$result = $result & assign_capability('moodle/restore:restoreactivity', CAP_ALLOW, $rid, $sysctx->id);
$result = $result & assign_capability('moodle/restore:restoresection', CAP_ALLOW, $rid, $sysctx->id);
@@ -34,4 +49,4 @@ function xmldb_local_lsf_unification_install_course_creator_role() {
}
}
return $result;
-}
\ No newline at end of file
+}
diff --git a/db/upgrade.php b/db/upgrade.php
index b371f6c..e447680 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -1,5 +1,4 @@
get_manager();
if ($oldversion < 2013050700) {
- // lsf_unification needs a new role from now on
+ // lsf_unification needs a new role from now on
require_once($CFG->dirroot . '/local/lsf_unification/db/install.php');
xmldb_local_lsf_unification_install_course_creator_role();
-
+
// Define key uni2 (unique) to be dropped form local_lsf_course
$table = new xmldb_table('local_lsf_course');
- $key = new xmldb_key('uni2', XMLDB_KEY_UNIQUE, array('mdlid'));
+ $key = new xmldb_key('uni2', XMLDB_KEY_UNIQUE, ['mdlid']);
// Launch drop key uni2
$dbman->drop_key($table, $key);
@@ -63,57 +62,56 @@ function xmldb_local_lsf_unification_upgrade($oldversion) {
// lsf_unification savepoint reached
upgrade_plugin_savepoint(true, 2013050700, 'local', 'lsf_unification');
}
-
+
if ($oldversion < 2013060400) {
- // Define field requeststate to be added to local_lsf_course
- $table = new xmldb_table('local_lsf_course');
- $field = new xmldb_field('requeststate', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, null, '0', 'ueid');
-
- // Conditionally launch add field requeststate
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // lsf_unification savepoint reached
- upgrade_plugin_savepoint(true, 2013060400, 'local', 'lsf_unification');
+ // Define field requeststate to be added to local_lsf_course
+ $table = new xmldb_table('local_lsf_course');
+ $field = new xmldb_field('requeststate', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, null, '0', 'ueid');
+
+ // Conditionally launch add field requeststate
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // lsf_unification savepoint reached
+ upgrade_plugin_savepoint(true, 2013060400, 'local', 'lsf_unification');
}
-
+
if ($oldversion < 2013061100) {
- // Define field requeststate to be added to local_lsf_course
- $table = new xmldb_table('local_lsf_course');
+ // Define field requeststate to be added to local_lsf_course
+ $table = new xmldb_table('local_lsf_course');
$field = new xmldb_field('ueid');
// Conditionally launch drop field ueid
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
-
+
$field = new xmldb_field('requesterid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'requeststate');
// Conditionally launch add field requesterid
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
-
+
$field = new xmldb_field('acceptorid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'requesterid');
// Conditionally launch add field acceptorid
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
-
- // lsf_unification savepoint reached
- upgrade_plugin_savepoint(true, 2013061100, 'local', 'lsf_unification');
+
+ // lsf_unification savepoint reached
+ upgrade_plugin_savepoint(true, 2013061100, 'local', 'lsf_unification');
}
if ($oldversion < 2013090300) {
- if(get_config('enrol_self','version') > 2012120600) {
- //lsf courses did not set customerint6 for self enrolments. This is the fix for already created self enrolments
+ if (get_config('enrol_self', 'version') > 2012120600) {
+ // lsf courses did not set customerint6 for self enrolments. This is the fix for already created self enrolments
$DB->execute("UPDATE {enrol} SET customint6 = 1 WHERE enrol = 'self' and customint6 is null");
}
// lsf_unification savepoint reached
upgrade_plugin_savepoint(true, 2013090300, 'local', 'lsf_unification');
}
-
return true;
-}
\ No newline at end of file
+}
diff --git a/deeplink_remove.php b/deeplink_remove.php
index c1a70f6..9c339fd 100644
--- a/deeplink_remove.php
+++ b/deeplink_remove.php
@@ -1,9 +1,24 @@
.
+
define('NO_OUTPUT_BUFFERING', true);
require_once("../../config.php");
require_once("$CFG->libdir/adminlib.php");
require_once("./lib_his.php");
-require_once($CFG->dirroot.'/course/lib.php');
+require_once($CFG->dirroot . '/course/lib.php');
require_login();
admin_externalpage_setup('local_lsf_unification_deeplink_remove');
@@ -13,10 +28,10 @@
$veranstid = optional_param('veranstid', -1, PARAM_INT); // his course id
$formcontent = "HisLSF-id: ";
-echo "
";
+echo "";
if ($veranstid != -1) {
- echo "
".$OUTPUT->box(removeHisLink($veranstid)?"Link in HIS-LSF-Entry $veranstid removed.":"Error!")."
";
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 069bafc..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 = utf8_encode($course->fullname);
+ $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->c = utf8_encode($course->titel);
+ $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->c = utf8_encode($course->titel);
+ $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->c = utf8_encode($course->titel);
+ $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 3dd685a..0ac14db 100644
--- a/lib_his.php
+++ b/lib_his.php
@@ -1,27 +1,45 @@
.
+
/**
* Functions that are specific to HIS database, format and helptables containing his-formatted data
*/
defined('MOODLE_INTERNAL') || die();
-require_once ($CFG->dirroot . '/local/lsf_unification/class_pg_lite.php');
+global $CFG;
+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;
}
@@ -30,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;
@@ -58,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
@@ -69,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;
}
@@ -78,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);
}
@@ -91,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;
}
@@ -111,20 +140,32 @@ 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
- 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();
+ $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();
$result->veranstid = $course->veranstid;
@@ -140,17 +181,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);
}
@@ -172,7 +215,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;
@@ -182,7 +225,7 @@ function get_teachers_course_list($username, $longinfo = false) {
foreach ($courses as $veranstid => $course) {
$result = new stdClass();
$result->veranstid = $course->veranstid;
- $result->info = utf8_encode($course->titel) .
+ $result->info = mb_convert_encoding($course->titel, 'UTF-8', 'ISO-8859-1') .
($longinfo ? (" (" . $course->semestertxt .
((!empty($course->urlveranst)) ? (", KVV-Nr. " . $course->veranstnr . "") : "") . ")") : "");
@@ -216,12 +259,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;
}
@@ -240,26 +287,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];
}
@@ -278,7 +330,7 @@ function get_default_fullname($lsf_course) {
foreach (get_teachers_of_course($lsf_course->veranstid) as $person) {
$personen .= ", " . trim($person->vorname) . " " . trim($person->nachname);
}
- return utf8_encode(($lsf_course->titel) . " " . trim($lsf_course->semestertxt) . $personen);
+ return mb_convert_encoding(($lsf_course->titel) . " " . trim($lsf_course->semestertxt) . $personen, 'UTF-8', 'ISO-8859-1');
}
/**
@@ -294,10 +346,11 @@ function get_default_shortname($lsf_course, $long = false) {
foreach (explode(" ", $lsf_course->titel) as $word) {
$i .= strtoupper($word[0]) . (($long && !empty($word[1])) ? $word[1] : "");
}
- $name = utf8_encode(
- $i . "-" . substr($lsf_course->semester, 0, 4) . "_" . substr($lsf_course->semester, -1));
- if (!$long && $DB->record_exists('course', array('shortname' => $name
- ))) {
+ $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', ['shortname' => $name,
+ ])
+ ) {
return get_default_shortname($lsf_course, true);
}
return $name;
@@ -313,15 +366,17 @@ 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 .= '