New course option to enable/disable display of "recent activity"
authormoodler <moodler>
Tue, 12 Nov 2002 04:26:16 +0000 (04:26 +0000)
committermoodler <moodler>
Tue, 12 Nov 2002 04:26:16 +0000 (04:26 +0000)
course/edit.html
course/topics.php
course/weeks.php
lang/en/help/courserecent.html [new file with mode: 0644]
lang/en/moodle.php
lib/db/mysql.php
lib/db/mysql.sql
version.php

index 9813a31..0edd2db 100644 (file)
               formerr($err["numsections"]);
        ?></td>
 </tr>
+<tr valign=top>
+       <td><P><? print_string("showrecent") ?>:</td>
+       <td><?
+    unset($choices);
+    $choices["0"] = get_string("no");
+    $choices["1"] = get_string("yes");
+    choose_from_menu ($choices, "showrecent", $form->showrecent, "");
+    helpbutton("courserecent", get_string("showrecent")); ?>
+       </td>
+</tr>
 <tr valign=top>
        <td><P><? print_string("wordforteacher") ?>:</td>
        <td><input type="text" name="teacher" size=25 value="<? p($form->teacher) ?>">
index 82df112..0a84899 100644 (file)
     echo "</TABLE>";
     
 
-    echo "</TD><TD WIDTH=210>";
-
-/// Print all the news items.
+    if ($news or $course->showrecent) {
+        echo "</TD><TD WIDTH=210>";
+
+        /// Print all the news items.
+
+        if ($news) {
+            print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+            echo "<FONT SIZE=1>";
+            forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
+            echo "</FONT>";
+            print_simple_box_end();
+            echo "<BR>";
+        }
+        
+        /// Print all the recent activity
+        if ($course->showrecent) {
+            print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+            print_recent_activity($course);
+            print_simple_box_end();
+        }
 
-    if ($news) {
-        print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-        print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-        echo "<FONT SIZE=1>";
-        forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
-        echo "</FONT>";
-        print_simple_box_end();
-        echo "<BR>";
+        echo "<BR><IMG SRC=\"../pix/spacer.gif\" WIDTH=210 HEIGHT=1>";
     }
-    
-    // Print all the recent activity
-    print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-    print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-    print_recent_activity($course);
-    print_simple_box_end();
 
     echo "</TD></TR></TABLE>\n";
 
index 7faa92c..8f37ecc 100644 (file)
     }
     echo "</TABLE>";
     
-
-    echo "</TD><TD WIDTH=210>";
-
-    // Print all the news items.
-
-    if ($news) {
-        print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-        print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-        echo "<FONT SIZE=1>";
-        forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
-        echo "</FONT>";
-        print_simple_box_end();
-        echo "<BR>";
-    }
+    if ($news or $course->showrecent) {
+        echo "</TD><TD WIDTH=210>";
+
+        // Print all the news items.
+
+        if ($news) {
+            print_simple_box(get_string("latestnews"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+            echo "<FONT SIZE=1>";
+            forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false);
+            echo "</FONT>";
+            print_simple_box_end();
+            echo "<BR>";
+        }
+        
+        // Print all the recent activity
+        if ($course->showrecent) {
+            print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
+            print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
+            print_recent_activity($course);
+            print_simple_box_end();
+        }
     
-    // Print all the recent activity
-    print_simple_box(get_string("recentactivity"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
-    print_simple_box_start("CENTER", "100%", "#FFFFFF", 3, 0);
-    print_recent_activity($course);
-    print_simple_box_end();
-
-    echo "<BR><IMG SRC=\"../pix/spacer.gif\" WIDTH=210 HEIGHT=1>";
+        echo "<BR><IMG SRC=\"../pix/spacer.gif\" WIDTH=210 HEIGHT=1>";
+    }
 
     echo "</TD></TR></TABLE>\n";
 
diff --git a/lang/en/help/courserecent.html b/lang/en/help/courserecent.html
new file mode 100644 (file)
index 0000000..19add5a
--- /dev/null
@@ -0,0 +1,16 @@
+<P ALIGN=CENTER><B>Recent Activity</B></P>
+
+<P>Moodle can display "recent activity" on the course home page.
+
+<P>This shows the everything that has happened in the course since
+the last time the viewer logged in to the course, including 
+new posts, new users, submitted journals etc.
+
+<P>It is highly recommended you leave this feature enabled in 
+your courses, as it helps give a sense of activity in the course.
+Knowing what everyone else is doing also helps to promote a 
+collaborative atmosphere in the class.
+
+<P>You might want to disable this feature for extremely large or 
+heavily used courses, as it may slow down the display of 
+the course page.
index 788aab2..d073f20 100644 (file)
@@ -421,6 +421,7 @@ $string['showallweeks'] = "Show all weeks";
 $string['showlistofcourses'] = "Show list of courses";
 $string['showonlytopic'] = "Show only topic \$a";
 $string['showonlyweek'] = "Show only week \$a";
+$string['showrecent'] = "Show recent activity";
 $string['showtheselogs'] = "Show these logs";
 $string['socialheadline'] = "Social forum - latest topics";
 $string['showallcourses'] = "Show all courses";
index 9ffedfe..8df4660 100644 (file)
@@ -193,6 +193,10 @@ function main_upgrade($oldversion=0) {
         print_simple_box_end();
     }
 
+    if ($oldversion < 2002111200) {
+        execute_sql(" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` ");
+    }
+
 
     return true;
 }
index 5319924..724495f 100644 (file)
@@ -44,6 +44,7 @@ CREATE TABLE `course` (
   `guest` tinyint(2) unsigned NOT NULL default '0',
   `startdate` int(10) unsigned NOT NULL default '0',
   `numsections` smallint(5) unsigned NOT NULL default '1',
+  `showrecent` smallint(5) unsigned NOT NULL default '1',
   `marker` int(10) unsigned NOT NULL default '0',
   `timecreated` int(10) unsigned NOT NULL default '0',
   `timemodified` int(10) unsigned NOT NULL default '0',
index 78ffb75..ab8c629 100644 (file)
@@ -5,7 +5,7 @@
 // database to determine whether upgrades should
 // be performed (see lib/db/*.php)
 
-$version = 2002111100;   // The current version is a date (YYYYMMDDXX)
+$version = 2002111200;   // The current version is a date (YYYYMMDDXX)
 
 $release = "1.0.6.2";  // User-friendly version number