]> git.mjollnir.org Git - moodle.git/commitdiff
Added a new course field called enrolperiod that allows a teacher to specify
authormoodler <moodler>
Thu, 29 Jul 2004 14:47:05 +0000 (14:47 +0000)
committermoodler <moodler>
Thu, 29 Jul 2004 14:47:05 +0000 (14:47 +0000)
an enrolment period for new students.

course/edit.html
lang/en/help/enrolperiod.html [new file with mode: 0644]
lib/db/mysql.php
lib/db/mysql.sql
lib/db/postgres7.php
lib/db/postgres7.sql
version.php

index 1281500642951e838ae989c2873bf849d244f8d0..b08c11fb1691dcbf4ab84b0308c451af133edcd6 100644 (file)
@@ -12,6 +12,9 @@
     if (!isset($form->lang)) {
         $form->lang = '';
     }
+    if (!isset($form->enrolperiod)) {
+        $form->enrolperiod = 0;
+    }
 ?>
 <FORM METHOD="post" action="edit.php" NAME="form">
 <table cellpadding=9 cellspacing=0 >
            helpbutton("coursestartdate", get_string("startdate"));
     ?></td>
 </tr>
+<tr valign=top>
+    <td align="right"><P><?php  print_string("enrolperiod") ?>:</td>
+    <td>
+        <?php
+            $periodmenu[0] = get_string('unlimited');
+            for ($i=1; $i<=365; $i++) {
+                $seconds = $i * 86400;
+                $periodmenu[$seconds] = get_string('numdays', '', $i);
+            }
+            choose_from_menu ($periodmenu, "enrolperiod", "$form->enrolperiod", "");
+            helpbutton("enrolperiod", get_string("enrolperiod"));
+        ?>
+    </td>
+</tr>
 <tr valign=top>
     <td align="right"><P><?php  print_string("numberweeks") ?>:</td>
     <td><?php
diff --git a/lang/en/help/enrolperiod.html b/lang/en/help/enrolperiod.html
new file mode 100644 (file)
index 0000000..c55f4ae
--- /dev/null
@@ -0,0 +1,13 @@
+<p align="center"><b>Enrolment period</b></b></p>
+
+<p>This setting specifies the number of days a student can be 
+   enrolled in this course (starting from the moment they enroll).</p>
+
+<p>If this is set, then students are automatically unenrolled 
+   after the specified time has elapsed.  This is most useful 
+   for rolling courses without a specific start or end time.</p>
+
+<p>If you don't set this then the student will remain
+   in this course until they are manually unenrolled or the 
+   clean-up function to remove defunct students takes effect. </p>
+
index 2b36fda9a1be512ad7e8564c913f600d9f6e0ef9..75615d929b3ef8733b8b11b8429592d331b43eee 100644 (file)
@@ -790,6 +790,10 @@ function main_upgrade($oldversion=0) {
         table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang');
     }
 
+    if ($oldversion < 2004072900) {
+        table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate');
+    }
+
 
     return $result;
 
index 8ba452bc621501ac2ea9933dc0691a532d6474e8..ccb439a285c128d847ccda292a0034867123739f 100644 (file)
@@ -47,6 +47,7 @@ CREATE TABLE `prefix_course` (
   `students` varchar(100) NOT NULL default 'Students',
   `guest` tinyint(2) unsigned NOT NULL default '0',
   `startdate` int(10) unsigned NOT NULL default '0',
+  `enrolperiod` int(10) unsigned NOT NULL default '0',
   `numsections` smallint(5) unsigned NOT NULL default '1',
   `marker` int(10) unsigned NOT NULL default '0',
   `maxbytes` int(10) unsigned NOT NULL default '0',
index 7870438f647d731606be6c72b68bc90faa6c906f..064268e7f0b6b131daf1dfd4878bd54927cac872 100644 (file)
@@ -532,6 +532,10 @@ function main_upgrade($oldversion=0) {
         table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang');
     }
 
+    if ($oldversion < 2004072900) {
+        table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate');
+    }
+
     return $result;
 
 }
index 9f04818d6d57953f1b9e46d6ac6e468e36698a6f..ac324ab6023d5448803b27ed78c82a4413d9d2a4 100644 (file)
@@ -25,6 +25,7 @@ CREATE TABLE prefix_course (
    students varchar(100) NOT NULL default 'Students',
    guest integer NOT NULL default '0',
    startdate integer NOT NULL default '0',
+   enrolperiod integer NOT NULL default '0',
    numsections integer NOT NULL default '1',
    marker integer NOT NULL default '0',
    maxbytes integer NOT NULL default '0',
index 5120acad74466ae127b80abc50b5479a6e9dbb79..88b8862194a012cbf1b155f72cf6991ec1be0984 100644 (file)
@@ -5,7 +5,7 @@
 // database to determine whether upgrades should
 // be performed (see lib/db/*.php)
 
-$version = 2004072500;   // The current version is a date (YYYYMMDDXX)
+$version = 2004072900;   // The current version is a date (YYYYMMDDXX)
 
 $release = "1.4 development";   // User-friendly version number