]> git.mjollnir.org Git - moodle.git/commitdiff
Improvements to the process of setting up Moodle the first time, also better interfac...
authormartin <martin>
Tue, 4 Dec 2001 14:02:36 +0000 (14:02 +0000)
committermartin <martin>
Tue, 4 Dec 2001 14:02:36 +0000 (14:02 +0000)
admin/cron.php
admin/index.php
admin/teacher.php

index 7b2851cfc5fc356204153e3f1051d884d5a4c79b..899efc6ab22ba8409e698f21a7d7dc9e7b1b71a1 100644 (file)
@@ -32,6 +32,8 @@
 
     $timenow  = time();
 
+//  Run all cron jobs for each module
+
     if ($mods = get_records_sql("SELECT * FROM modules WHERE cron > 0 AND (($timenow - lastcron) > cron)")) {
         foreach ($mods as $mod) {
             $cronfile = "$CFG->dirroot/mod/$mod->name/cron.php";
             }
         }
     }
+
+
+//  Any system-wide Moodle cron jobs should be run here
+
+    // Clean up users who never confirmed.
+
+
+
     echo "Cron script completed correctly\n";
 
 ?>
index c68dd77ce12d19e69e4edbc9392dfe3ffc400be8..b6fdd252d13e81b897f0850be70b010e15562863 100644 (file)
                 // do nothing
             } else if ($currmodule->version < $module->version) {
                 notify("$module->name module needs upgrading");  // XXX do the upgrade here
+                $updated_modules = true;
             } else {
                 error("Version mismatch: $module->name can't downgrade $currmodule->version -> $module->version !");
             }
     
         } else {    // module not installed yet, so install it
+            if (!$updated_modules) {
+                print_header("Setting up database", "Setting up database", "Setting up module tables", "");
+            }
+            $updated_modules = true;
             if (modify_database("$fullmod/install.sql")) {
                 if ($module->id = insert_record("modules", $module)) {
                     notify("$module->name tables have been set up correctly");
         }
     }
 
+    if ($updated_modules) {
+        print_heading("<A HREF=\"index.php\">Continue</A>");
+        die;
+    }
+
     // Set up the overall site name etc.
     if (! $course = get_record("course", "category", 0)) {
         redirect("site.php");
index f274272cb76fbb0bb9117251fbba3b355dc71798..1c576e68bcca662c766e1399e6528816d3e10d9e 100644 (file)
@@ -35,6 +35,7 @@
 
 
        print_header("Add teachers to $course->shortname", "Add teachers to a course", "<A HREF=\"$CFG->wwwroot/admin\">Admin</A> -> Add teachers to $course->shortname", "");
+    print_heading($course->fullname);
 
 
 /// Get all existing teachers for this course.
             error("That teacher (id = $add) doesn't exist", "teacher.php?id=$course->id");
         }
 
-        foreach ($teachers as $tt) {
-            if ($tt->id == $user->id) {
-                error("That user is already a teacher for this course.", "teacher.php?id=$course->id");
+        if ($teachers) {
+            foreach ($teachers as $tt) {
+                if ($tt->id == $user->id) {
+                    error("That user is already a teacher for this course.", "teacher.php?id=$course->id");
+                }
             }
         }
 
         if (! $user = get_record("user", "id", $remove)) {
             error("That teacher (id = $remove) doesn't exist", "teacher.php?id=$course->id");
         }
-        foreach ($teachers as $tt) {
-            if ($tt->id == $user->id) {
-                delete_records("user_teachers", "id", "$tt->teachid");
+        if ($teachers) {
+            foreach ($teachers as $tt) {
+                if ($tt->id == $user->id) {
+                    delete_records("user_teachers", "id", "$tt->teachid");
+                }
             }
         }
         $teachers = get_records_sql("SELECT u.*,t.authority,t.id as teachid FROM user u, user_teachers t 
     }
 
 
-/// Show existing teachers for this course
+/// Print the lists of existing and potential teachers
+
+    echo "<TABLE CELLPADDING=2 CELLSPACING=10 ALIGN=CENTER>";
+    echo "<TR><TH WIDTH=50%>Existing Teachers</TH><TH WIDTH=50%>Potential Teachers</TH></TR>";
+    echo "<TR><TD WIDTH=50% NOWRAP VALIGN=TOP>";
+
+/// First, show existing teachers for this course
 
-    if ($teachers) {
-        print_simple_box_start("center", "", "$THEME->cellheading");
-        print_heading("Existing teachers");
+    if (! $teachers) { 
+        echo "<P ALIGN=CENTER>No existing teachers</A>";
+
+    } else {
         foreach ($teachers as $teacher) {
-            echo "<LI>$teacher->firstname $teacher->lastname, $teacher->email &nbsp;&nbsp; <A HREF=\"teacher.php?id=$course->id&remove=$teacher->id\">remove</A>";
+            echo "<P ALIGN=right>$teacher->firstname $teacher->lastname, $teacher->email &nbsp;&nbsp; <A HREF=\"teacher.php?id=$course->id&remove=$teacher->id\" TITLE=\"Remove teacher\"><IMG SRC=\"../pix/t/right.gif\" BORDER=0></A></P>";
         }
-        print_simple_box_end();
     }
 
-/// Print list of potential teachers
+    echo "<TD WIDTH=50% NOWRAP VALIGN=TOP>";
 
-    echo "<BR>";
-    print_simple_box_start("center", "", "$THEME->cellcontent");
-    print_heading("Potential teachers");
+/// Print list of potential teachers
 
     if ($search) {
         $users = get_records_sql("SELECT * from user WHERE confirmed = 1 
     }
 
     
-    foreach ($users as $user) {  // Remove users who are already teachers
-        foreach ($teachers as $teacher) {
-            if ($teacher->id == $user->id) {
-                continue 2;
+    if ($users) {
+        foreach ($users as $user) {  // Remove users who are already teachers
+            if ($teachers) {
+                foreach ($teachers as $teacher) {
+                    if ($teacher->id == $user->id) {
+                        continue 2;
+                    }
+                }
             }
+            $potential[] = $user;
         }
-        $potential[] = $user;
     }
 
     if (! $potential) { 
-        echo "No potential teachers";
+        echo "<P ALIGN=CENTER>No potential teachers</A>";
+        if ($search) {
+            echo "<FORM ACTION=teacher.php METHOD=GET>";
+            echo "<INPUT TYPE=hidden NAME=id VALUE=\"$course->id\">";
+            echo "<INPUT TYPE=text NAME=search SIZE=20>";
+            echo "<INPUT TYPE=submit VALUE=\"Search again\">";
+            echo "</FORM>";
+        }
 
     } else {
+        if ($search) {
+            echo "<P ALIGN=CENTER>(Search results)</P>";
+        }
         if (count($potential) <= 20) {
             foreach ($potential as $user) {
-                echo "<LI>$user->firstname $user->lastname, $user->email &nbsp;&nbsp; <A HREF=\"teacher.php?id=$course->id&add=$user->id\">add</A>";
+                echo "<P ALIGN=LEFT><A HREF=\"teacher.php?id=$course->id&add=$user->id\" TITLE=\"Add teacher\"><IMG SRC=\"../pix/t/left.gif\" BORDER=0></A>&nbsp;&nbsp;$user->firstname $user->lastname, $user->email";
             }
         } else {
-            echo "There are too many users to show.<BR>Enter a search word here.";
+            echo "<P ALIGN=CENTER>There are too many users to show.<BR>";
+            echo "Enter a search word here.";
             echo "<FORM ACTION=teacher.php METHOD=GET>";
             echo "<INPUT TYPE=hidden NAME=id VALUE=\"$course->id\">";
             echo "<INPUT TYPE=text NAME=search SIZE=20>";
         }
     }
 
-    print_simple_box_end();
+    echo "</TR></TABLE>";
 
     print_footer();