From 3f125001bcf5c675d58c615072946cd2b710462b Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 31 Oct 2003 05:57:30 +0000 Subject: [PATCH] New feature: Allow students to see their own activity reports. This is a course setting. By default it is off. When on, there is a new link in the course admin menu for students, and they can browse the same report that teachers see. The report icon is temporary. --- backup/backuplib.php | 1 + backup/restorelib.php | 4 ++++ course/edit.html | 10 ++++++++++ course/lib.php | 6 +++++- course/loggraph.php | 6 ++---- course/user.php | 2 +- lang/en/help/coursereports.html | 18 ++++++++++++++++++ lang/en/moodle.php | 1 + lib/db/mysql.php | 4 ++++ lib/db/mysql.sql | 1 + lib/db/postgres7.php | 4 ++++ lib/db/postgres7.sql | 1 + pix/i/report.gif | Bin 0 -> 99 bytes theme/cordoroyblue/pix/i/report.gif | Bin 0 -> 99 bytes version.php | 2 +- 15 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 lang/en/help/coursereports.html create mode 100755 pix/i/report.gif create mode 100755 theme/cordoroyblue/pix/i/report.gif diff --git a/backup/backuplib.php b/backup/backuplib.php index 25665f8430..d2bd32b071 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -559,6 +559,7 @@ fwrite ($bf,full_tag("NUMSECTIONS",3,false,$course->numsections)); fwrite ($bf,full_tag("SHOWRECENT",3,false,$course->showrecent)); fwrite ($bf,full_tag("MAXBYTES",3,false,$course->maxbytes)); + fwrite ($bf,full_tag("SHOWREPORTS",3,false,$course->showreports)); fwrite ($bf,full_tag("MARKER",3,false,$course->marker)); fwrite ($bf,full_tag("VISIBLE",3,false,$course->visible)); fwrite ($bf,full_tag("TIMECREATED",3,false,$course->timecreated)); diff --git a/backup/restorelib.php b/backup/restorelib.php index dc7d5d3ae4..c1125c9909 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -318,6 +318,7 @@ $course->numsections = addslashes($course_header->course_numsections); $course->showrecent = addslashes($course_header->course_showrecent); $course->maxbytes = addslashes($course_header->course_maxbytes); + $course->showreports = addslashes($course_header->course_showreports); $course->marker = addslashes($course_header->course_marker); $course->visible = addslashes($course_header->course_visible); $course->timecreated = addslashes($course_header->course_timecreated); @@ -1264,6 +1265,9 @@ case "MAXBYTES": $this->info->course_maxbytes = $this->getContents(); break; + case "SHOWREPORTS": + $this->info->course_showreports = $this->getContents(); + break; case "MARKER": $this->info->course_marker = $this->getContents(); break; diff --git a/course/edit.html b/course/edit.html index 0d9d7d2dc8..06556267f1 100644 --- a/course/edit.html +++ b/course/edit.html @@ -127,6 +127,16 @@ helpbutton("coursegrades", get_string("grades")); ?> + +

: + showreports, ""); + helpbutton("coursereports", get_string("activityreport")); ?> + +

: id\">".get_string("grades")."..."; $adminicon[]="pixpath/i/grades.gif\" height=16 width=16 alt=\"\">"; } + if ($course->showreports) { + $admindata[]="id&user=$USER->id\">".get_string("activityreport")."..."; + $adminicon[]="pixpath/i/report.gif\" height=16 width=16 alt=\"\">"; + } if ($CFG->auth == "email" or $CFG->auth == "none" or $CFG->auth == "manual") { $admindata[]="wwwroot/login/change_password.php?id=$course->id\">". get_string("changepassword")."..."; @@ -878,8 +882,8 @@ function print_course_admin_links($course, $width=180) { } if ($CFG->allowunenroll) { $admindata[]="id\">".get_string("unenrolme", "", $course->shortname)."..."; + $adminicon[]="pixpath/i/user.gif\" height=16 width=16 alt=\"\">"; } - $adminicon[]="pixpath/i/user.gif\" height=16 width=16 alt=\"\">"; } if (!empty($admindata)) { diff --git a/course/loggraph.php b/course/loggraph.php index 439dd5eb2a..bdc4ffebe3 100644 --- a/course/loggraph.php +++ b/course/loggraph.php @@ -16,10 +16,8 @@ require_login($course->id); - if (!isteacher($course->id)) { - if (! ($type == "usercourse.png" and $user == $USER->id) ) { - error("Sorry, you aren't allowed to see this."); - } + if (! (isteacher($course->id) or ($course->showreports and $USER->id == $user))) { + error("Sorry, you aren't allowed to see this."); } if ($user) { diff --git a/course/user.php b/course/user.php index a4fb8047f8..733646e1ee 100644 --- a/course/user.php +++ b/course/user.php @@ -19,7 +19,7 @@ error("Course id is incorrect."); } - if (!isteacher($course->id)) { + if (! (isteacher($course->id) or ($course->showreports and $USER->id == $user))) { error("You are not allowed to look at this page"); } diff --git a/lang/en/help/coursereports.html b/lang/en/help/coursereports.html new file mode 100644 index 0000000000..114b685c77 --- /dev/null +++ b/lang/en/help/coursereports.html @@ -0,0 +1,18 @@ +

Activity Reports

+ +

Activity reports are available for each partipant + that show what they have done in the current course.

+ +

Teachers always have access to these.

+ +

Student access to their own reports is an optional course + setting set by the teacher. For some courses these + reports can be a useful tool for a student to reflect + on their involvement and appearance within the online + environment, but for some courses this may not be + necessary.

+ +

Another reason for turning it off is that the report + can place a bit of load on the server while being + generated. For large or long classes it may be more + efficient to keep it off.

diff --git a/lang/en/moodle.php b/lang/en/moodle.php index c4a80089a8..4f6acfc4bc 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -692,6 +692,7 @@ $string['showlistofcourses'] = "Show list of courses"; $string['showonlytopic'] = "Show only topic \$a"; $string['showonlyweek'] = "Show only week \$a"; $string['showrecent'] = "Show recent activity"; +$string['showreports'] = "Show activity reports"; $string['showtheselogs'] = "Show these logs"; $string['showallcourses'] = "Show all courses"; $string['site'] = "Site"; diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 3d06b99aef..7bbbd34005 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -556,6 +556,10 @@ function main_upgrade($oldversion=0) { $db->debug = true; } + if ($oldversion < 2003103100) { + table_column("course", "", "showreports", "integer", "4", "unsigned", "0", "", "maxbytes"); + } + return $result; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 47cfb27e37..05e2fb05d8 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -49,6 +49,7 @@ CREATE TABLE `prefix_course` ( `showrecent` smallint(5) unsigned NOT NULL default '1', `marker` int(10) unsigned NOT NULL default '0', `maxbytes` int(10) unsigned NOT NULL default '0', + `showreports` int(4) unsigned NOT NULL default '0', `visible` int(10) unsigned NOT NULL default '1', `timecreated` int(10) unsigned NOT NULL default '0', `timemodified` int(10) unsigned NOT NULL default '0', diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 92783c14fe..1aaddf7789 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -305,6 +305,10 @@ function main_upgrade($oldversion=0) { $db->debug = true; } + if ($oldversion < 2003103100) { + table_column("course", "", "showreports", "integer", "4", "unsigned", "0", "", "maxbytes"); + } + return $result; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index e7a1b49c24..d7f9febea3 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -27,6 +27,7 @@ CREATE TABLE prefix_course ( showrecent integer NOT NULL default '1', marker integer NOT NULL default '0', maxbytes integer NOT NULL default '0', + showreports integer NOT NULL default '0', visible integer NOT NULL default '1', timecreated integer NOT NULL default '0', timemodified integer NOT NULL default '0' diff --git a/pix/i/report.gif b/pix/i/report.gif new file mode 100755 index 0000000000000000000000000000000000000000..fb12c602c432460aa9d5be9933a9dd91b70e0e11 GIT binary patch literal 99 zcmZ?wbhEHb6krfwn8?6z;J|_Z|NoykbB2L|LGdRGBamXy0TCd11}2jueVnI-`R^y5 zcC|RN;2T@0=W+A8-tt_