From 13beeacbcd28bda88ba7909f2bf69ff65e73595f Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 12 Nov 2002 04:26:16 +0000 Subject: [PATCH] New course option to enable/disable display of "recent activity" --- course/edit.html | 10 ++++++++ course/topics.php | 40 +++++++++++++++++------------- course/weeks.php | 45 ++++++++++++++++++---------------- lang/en/help/courserecent.html | 16 ++++++++++++ lang/en/moodle.php | 1 + lib/db/mysql.php | 4 +++ lib/db/mysql.sql | 1 + version.php | 2 +- 8 files changed, 80 insertions(+), 39 deletions(-) create mode 100644 lang/en/help/courserecent.html diff --git a/course/edit.html b/course/edit.html index 9813a31dc6..0edd2db411 100644 --- a/course/edit.html +++ b/course/edit.html @@ -98,6 +98,16 @@ formerr($err["numsections"]); ?> + +

: + showrecent, ""); + helpbutton("courserecent", get_string("showrecent")); ?> + +

: diff --git a/course/topics.php b/course/topics.php index 82df112dba..0a84899412 100644 --- a/course/topics.php +++ b/course/topics.php @@ -207,25 +207,31 @@ echo ""; - echo ""; - -/// Print all the news items. + if ($news or $course->showrecent) { + echo ""; + + /// 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 ""; + forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); + echo ""; + print_simple_box_end(); + echo "
"; + } + + /// 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 ""; - forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); - echo ""; - print_simple_box_end(); - echo "
"; + echo "
"; } - - // 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 "\n"; diff --git a/course/weeks.php b/course/weeks.php index 7faa92cfdf..8f37ecc166 100644 --- a/course/weeks.php +++ b/course/weeks.php @@ -201,28 +201,31 @@ } echo ""; - - echo ""; - - // 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 ""; - forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); - echo ""; - print_simple_box_end(); - echo "
"; - } + if ($news or $course->showrecent) { + echo ""; + + // 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 ""; + forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "DESC", false); + echo ""; + print_simple_box_end(); + echo "
"; + } + + // 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 "
"; + echo "
"; + } echo "\n"; diff --git a/lang/en/help/courserecent.html b/lang/en/help/courserecent.html new file mode 100644 index 0000000000..19add5ac72 --- /dev/null +++ b/lang/en/help/courserecent.html @@ -0,0 +1,16 @@ +

Recent Activity

+ +

Moodle can display "recent activity" on the course home page. + +

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. + +

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. + +

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. diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 788aab2865..d073f20ec3 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -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"; diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 9ffedfe4bf..8df46602e4 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -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; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 53199240f3..724495f643 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -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', diff --git a/version.php b/version.php index 78ffb75a0f..ab8c629b73 100644 --- a/version.php +++ b/version.php @@ -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 -- 2.39.5