diff --git a/course/edit.html b/course/edit.html index 6154fa5d6b1..4c5be51f67a 100644 --- a/course/edit.html +++ b/course/edit.html @@ -18,6 +18,15 @@ if (!isset($form->enrolperiod)) { $form->enrolperiod = 0; } + if (!isset($form->expirynotify)) { + $form->expirynotify = 1; + } + if (!isset($form->notifystudents)) { + $form->notifystudents = 0; + } + if (!isset($form->expirythreshold)) { + $form->expirythreshold = 10 * 86400; + } if (!isset($form->metacourse)) { $form->metacourse = 0; } @@ -98,6 +107,33 @@ helpbutton("enrolperiod", get_string("enrolperiod")); ?> +
Enrolment expiry notification
diff --git a/lang/en/help/expirynotifystudents.html b/lang/en/help/expirynotifystudents.html new file mode 100644 index 00000000000..53e175e0ca4 --- /dev/null +++ b/lang/en/help/expirynotifystudents.html @@ -0,0 +1 @@ +Notify students as well
diff --git a/lang/en/help/expirythreshold.html b/lang/en/help/expirythreshold.html new file mode 100644 index 00000000000..bd0a85cb817 --- /dev/null +++ b/lang/en/help/expirythreshold.html @@ -0,0 +1 @@ +Enrolment expiry notification threshold
diff --git a/lang/en/moodle.php b/lang/en/moodle.php index f5bc7a8d5fa..77b7d23c54f 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -463,6 +463,28 @@ $string['existingcreators'] = 'Existing course creators'; $string['existingstudents'] = 'Enrolled students'; $string['existingteachers'] = 'Existing teachers'; $string['explanation'] = 'Explanation'; +$string['expirynotify'] = 'Enrolment expiry notification'; +$string['expirynotifyemail'] = 'The following students in this course are expiring after exact $a->threshold days: + +$a->current + + +The following students in this course are expiring in less than $a->threshold days: + +$a->past + + +You may go to the following page to extend their enrolment period: +$a->extendurl +'; +$string['expirynotifystudents'] = 'Notify students'; +$string['expirynotifystudentsemail'] = 'Dear student: + +This is a notification that your enrolment for course $a->course will be expired in $a->threshold days. + +Please contact your tutor for any further enqiries. +'; +$string['expirythreshold'] = 'Threshold'; $string['extendenrol'] = 'Extend enrolment'; $string['extendperiod'] = 'Extended period'; $string['failedloginattempts'] = '$a->attempts failed logins since your last login'; diff --git a/lib/db/mysql.php b/lib/db/mysql.php index ece04abbbf9..062502165b9 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -1633,6 +1633,16 @@ function main_upgrade($oldversion=0) { } + if ($oldversion < 2005100300) { + table_column('course','','expirynotify','tinyint','1'); + table_column('course','','expirythreshold','int','10'); + table_column('course','','notifystudents','tinyint','1'); + $new = new stdClass(); + $new->name = 'lastexpirynotify'; + $new->value = 0; + insert_record('config', $new); + } + return $result; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 0bce36dbb93..99c5323cb7c 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -79,6 +79,9 @@ CREATE TABLE `prefix_course` ( `metacourse` int(1) unsigned NOT NULL default '0', `requested` int(1) unsigned NOT NULL default '0', `restrictmodules` int(1) unsigned NOT NULL default '0', + `expirynotify` tinyint(1) unsigned NOT NULL default '0', + `expirythreshold` int(10) unsigned NOT NULL default '0', + `notifystudents` tinyint(1) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `category` (`category`), KEY `idnumber` (`idnumber`), diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 12f4957a232..f67df7063b8 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -1375,6 +1375,16 @@ function main_upgrade($oldversion=0) { modify_database("","CREATE INDEX prefix_stats_user_monthly_timeend_idx ON prefix_stats_user_monthly (timeend);"); } + if ($oldversion < 2005100300) { + table_column('course','','expirynotify','integer','1'); + table_column('course','','expirythreshold','integer'); + table_column('course','','notifystudents','integer','1'); + $new = new stdClass(); + $new->name = 'lastexpirynotify'; + $new->value = 0; + insert_record('config', $new); + } + return $result; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index c80aab191b4..8e78ebc8846 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -49,7 +49,10 @@ CREATE TABLE prefix_course ( timemodified integer NOT NULL default '0', metacourse integer NOT NULL default '0', requested integer NOT NULL default '0', - restrictmodules integer NOT NULL default '0' + restrictmodules integer NOT NULL default '0', + expirynotify integer NOT NULL default '0', + expirythreshold integer NOT NULL default '0', + notifystudents integer NOT NULL default '0' ); CREATE UNIQUE INDEX prefix_course_category_sortorder_uk ON prefix_course (category,sortorder); diff --git a/version.php b/version.php index 1de900ccdaa..3c610d46333 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2005090100; // YYYYMMDD = date + $version = 2005100300; // YYYYMMDD = date // XY = increments within a single day $release = '1.6 development'; // Human-friendly version name