Various cleanups of the installation process
authormoodler <moodler>
Thu, 29 Jul 2004 18:01:32 +0000 (18:01 +0000)
committermoodler <moodler>
Thu, 29 Jul 2004 18:01:32 +0000 (18:01 +0000)
admin/index.php
admin/site.php
blocks/course_list/block_course_list.php
blocks/site_main_menu/block_site_main_menu.php
blocks/social_activities/block_social_activities.php
calendar/lib.php
course/lib.php
lib/defaults.php

index 2303c24699fc2d62f4839c5463658f4adf0c7fae..c3325fc98f85d7a30ab4e18f3cbc1760be27b0ea 100644 (file)
     }
 
 
+/// Insert default values for any important configuration variables
+
+    include_once("$CFG->dirroot/lib/defaults.php");
+
+    foreach ($defaults as $name => $value) {
+        if (!isset($CFG->$name)) {
+            $CFG->$name = $value;
+            set_config($name, $value);
+            $configchange = true;
+        }
+    }
+
+/// If any new configurations were found then send to the config page to check
+
+    if (!empty($configchange)) {
+        redirect("config.php");
+    }
+
+
 /// Upgrade backup/restore system if necessary
     require_once("$CFG->dirroot/backup/lib.php");
     upgrade_backup_db("$CFG->wwwroot/$CFG->admin/index.php");  // Return here afterwards
     }
 
 
-/// Insert default values for any important configuration variables
-
-    include_once("$CFG->dirroot/lib/defaults.php");
-
-    foreach ($defaults as $name => $value) {
-        if (!isset($CFG->$name)) {
-            $CFG->$name = $value;
-            set_config($name, $value);
-            $configchange = true;
-        }
-    }
-
-
-/// If any new configurations were found then send to the config page to check
-
-    if (!empty($configchange)) {
-        redirect("config.php");
-    }
-
 /// Set up the overall site name etc.
     if (! $site = get_site()) {
         redirect("site.php");
index 02ea4c53f23ded53093d55edc4c05f4d2d08a18d..d76248e076c064fcf92ac3376cbc6dd28b22c62f 100644 (file)
@@ -65,6 +65,7 @@
         $form->shortname = "";
         $form->summary = "";
         $form->newsitems = 3;
+        $form->numsections = 0;
         $form->id = "";
         $form->category = 0;
         $form->format = "social";
index ec2c56726c669b8c7dfa93952a52b3ee1e22a59b..5be560390fb1b8fc7c86c6cf84f8a72360af4779 100644 (file)
@@ -2,7 +2,7 @@
 
 class CourseBlock_course_list extends MoodleBlock {
     function CourseBlock_course_list ($course) {
-        $this->title = get_string('mycourses');
+        $this->title = get_string('courses');
         $this->content_type = BLOCK_TYPE_LIST;
         $this->course = $course;
         $this->version = 2005052600;
index 8ce4593b5343e5962921968145358c6dac6ce7a9..50b182ec0f150fd8ddba0af454ff01e2e6dbe849 100644 (file)
@@ -15,10 +15,14 @@ class CourseBlock_site_main_menu extends MoodleBlock {
     function get_content() {
         global $USER, $CFG;
 
-        if($this->content !== NULL) {
+        if ($this->content !== NULL) {
             return $this->content;
         }
 
+        if (empty($this->course)) {
+            return '';
+        }
+
         $this->content = New stdClass;
         $this->content->items = array();
         $this->content->icons = array();
index e5bdd5baf101585ce172ce6d948a797d897f897d..8190b58bf8bae5f9065ad0d67f7cd32b10063398 100644 (file)
@@ -15,9 +15,12 @@ class CourseBlock_social_activities extends MoodleBlock {
     function get_content() {
         global $USER, $CFG;
 
-        if($this->content !== NULL) {
+        if ($this->content !== NULL) {
             return $this->content;
         }
+        if (empty($this->course)) {
+            return '';
+        }
 
         $this->content = New object;
         $this->content->items = array();
index cf48e484bbc78104c3acee4e486b75dd0731f44d..e68ca2dc5b78ad126113ee093817875a3ffbed77 100644 (file)
@@ -628,7 +628,11 @@ function calendar_filter_controls($type, $vars = NULL, $course = NULL) {
             $getvars = '&amp;from='.$type;
         break;
         case 'course':
-            $getvars = '&amp;from=course&amp;id='.$_GET['id'];
+            if (isset($_GET['id'])) {
+                $getvars = '&amp;from=course&amp;id='.$_GET['id'];
+            } else {
+                $getvars = '&amp;from=course';
+            }
             if (isset($course->groupmode) and !$course->groupmode and $course->groupmodeforce) {
                 $groupevents = false;
             }
index 26ebd62582d25587fbc5f3d483ede14c0a3c7bf2..ba418173cee26aee4d6f846e6991a3e4e8bb6c65 100644 (file)
@@ -438,6 +438,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
     if ($course->category) {
         $joins[] = "l.course='$course->id'"; 
     } else {
+        $courses[0] = '';
         if ($ccc = get_courses("all", "c.id ASC", "c.id,c.shortname")) {
             foreach ($ccc as $cc) {
                 $courses[$cc->id] = "$cc->shortname";
@@ -500,6 +501,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
     }
 
     $count=0;
+    $ldcache = array();
     $tt = getdate(time());
     $today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
 
@@ -512,31 +514,37 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
 
     print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&");
 
-    echo "<table border=0 align=center cellpadding=3 cellspacing=3>";
+    echo '<table border=0 align=center cellpadding=3 cellspacing=3>';
     foreach ($logs as $log) {
 
-        if ($ld = get_record("log_display", "module", "$log->module", "action", "$log->action")) {
-            $log->info = get_field($ld->mtable, $ld->field, "id", $log->info);
+        if (isset($ldcache[$log->module][$log->action])) {
+            $ld = $ldcache[$log->module][$log->action];
+        } else {
+            $ld = get_record('log_display', 'module', $log->module, "action", $log->action);
+            $ldcache[$log->module][$log->action] = $ld;
+        }
+        if ($ld) {
+            $log->info = get_field($ld->mtable, $ld->field, 'id', $log->info);
         }
 
-        echo "<tr nowrap>";
+        echo '<tr nowrap="nowrap">';
         if (! $course->category) {
-            echo "<td nowrap><font size=2><a href=\"view.php?id=$log->course\">".$courses[$log->course]."</a></td>";
+            echo '<td nowrap="nowrap"><font size=2><a href="view.php?id='.$log->course.'">'.$courses[$log->course].'</a></td>';
         }
-        echo "<td nowrap align=right><font size=2>".userdate($log->time, "%a")."</td>";
-        echo "<td nowrap><font size=2>".userdate($log->time, $strftimedatetime)."</td>";
-        echo "<td nowrap><font size=2>";
-        link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", "ipatlas","$log->ip", 400, 700);
-        echo "</td>";
+        echo '<td nowrap align=right><font size=2>'.userdate($log->time, '%a').'</td>';
+        echo '<td nowrap><font size=2>'.userdate($log->time, $strftimedatetime).'</td>';
+        echo '<td nowrap><font size=2>';
+        link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", 'ipatlas',$log->ip, 400, 700);
+        echo '</td>';
         $fullname = fullname($log, $isteacher);
-        echo "<td nowrap><font size=2><a href=\"../user/view.php?id=$log->userid&course=$log->course\"><b>$fullname</b></td>";
-        echo "<td nowrap><font size=2>";
-        link_to_popup_window( make_log_url($log->module,$log->url), "fromloglive","$log->module $log->action", 400, 600);
-        echo "</td>";
-        echo "<td nowrap><font size=2>$log->info</td>";
-        echo "</tr>";
-    }
-    echo "</table>";
+        echo '<td nowrap><font size=2><a href="../user/view.php?id='."$log->userid&course=$log->course".'"><b>'.$fullname.'</b></td>';
+        echo '<td nowrap><font size=2>';
+        link_to_popup_window( make_log_url($log->module,$log->url), 'fromloglive',"$log->module $log->action", 400, 600);
+        echo '</td>';
+        echo '<td nowrap><font size=2>'.$log->info.'</td>';
+        echo '</tr>';
+    }
+    echo '</table>';
 
     print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&");
 }
index d5b7140a599c2f84c5d85885c509623e60955852..c39c7f9829fcda9081bffc4958b9002ad75d791c 100644 (file)
@@ -12,6 +12,7 @@
        "country"                  => "",
        "debug"                    =>  7,
        "deleteunconfirmed"        => 168,
+       "digestmailtime"           => 17,
        "displayloginfailures"     => '',
        "enablerssfeeds"           => 0,
        "enrol"                    => 'internal',