]> git.mjollnir.org Git - moodle.git/commitdiff
New feature: Allow students to see their own activity reports.
authormoodler <moodler>
Fri, 31 Oct 2003 05:57:30 +0000 (05:57 +0000)
committermoodler <moodler>
Fri, 31 Oct 2003 05:57:30 +0000 (05:57 +0000)
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.

15 files changed:
backup/backuplib.php
backup/restorelib.php
course/edit.html
course/lib.php
course/loggraph.php
course/user.php
lang/en/help/coursereports.html [new file with mode: 0644]
lang/en/moodle.php
lib/db/mysql.php
lib/db/mysql.sql
lib/db/postgres7.php
lib/db/postgres7.sql
pix/i/report.gif [new file with mode: 0755]
theme/cordoroyblue/pix/i/report.gif [new file with mode: 0755]
version.php

index 25665f8430a6253cbe01a35474abeae10e5df088..d2bd32b0713107ea18cb1590062b6abdea442d3b 100644 (file)
             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));
index dc7d5d3ae40497f3fd9736feb515f2a487ca972f..c1125c9909dbaeeb39f690cabef1e8e3822162b1 100644 (file)
             $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);
                         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;
index 0d9d7d2dc812d52e24f982c8f7768505502f54f8..06556267f15048e794c744b3d58fcc9d9ab2b7d0 100644 (file)
     helpbutton("coursegrades", get_string("grades")); ?>
        </td>
 </tr>
+<tr valign=top>
+       <td><P><?php  print_string("showreports") ?>:</td>
+       <td><?php
+    unset($choices);
+    $choices["0"] = get_string("no");
+    $choices["1"] = get_string("yes");
+    choose_from_menu ($choices, "showreports", $form->showreports, "");
+    helpbutton("coursereports", get_string("activityreport")); ?>
+       </td>
+</tr>
 <tr valign=top>
        <td><P><?php  print_string("maximumupload") ?>:</td>
        <td><?php
index 77a00182629e7a2f1be8f89724550b71bf4d6368..f52ee22b4ed934a36ec7a9020e4a97afa61b87cd 100644 (file)
@@ -868,6 +868,10 @@ function print_course_admin_links($course, $width=180) {
             $admindata[]="<a href=\"grade.php?id=$course->id\">".get_string("grades")."...</a>";
             $adminicon[]="<img src=\"$CFG->pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
         }
+        if ($course->showreports) {
+            $admindata[]="<a href=\"user.php?id=$course->id&user=$USER->id\">".get_string("activityreport")."...</a>";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/report.gif\" height=16 width=16 alt=\"\">";
+        }
         if ($CFG->auth == "email" or $CFG->auth == "none" or $CFG->auth == "manual") {
             $admindata[]="<a href=\"$CFG->wwwroot/login/change_password.php?id=$course->id\">".
                           get_string("changepassword")."...</a>";
@@ -878,8 +882,8 @@ function print_course_admin_links($course, $width=180) {
         }
         if ($CFG->allowunenroll) {
             $admindata[]="<a href=\"unenrol.php?id=$course->id\">".get_string("unenrolme", "", $course->shortname)."...</a>";
+            $adminicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
         }
-        $adminicon[]="<img src=\"$CFG->pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
     } 
 
     if (!empty($admindata)) {
index 439dd5eb2add36537938a7e12879eb5d935db68b..bdc4ffebe321bd48bbf9c375362baf7e86d0e5cd 100644 (file)
 
     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) {
index a4fb8047f8bddf4bb9b4b9ca4af5008df84c2c2e..733646e1ee0cd571cf268a306e3f06edaa155f2a 100644 (file)
@@ -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 (file)
index 0000000..114b685
--- /dev/null
@@ -0,0 +1,18 @@
+<p align="center"><b>Activity Reports</b></p>
+
+<P>Activity reports are available for each partipant 
+   that show what they have done in the current course.</p>
+
+<p>Teachers always have access to these.</p>
+
+<p>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.</p>
+
+<p>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.<p>
index c4a80089a890717ed79d305039c3d5745039edaa..4f6acfc4bc76ad4c6a92b52df2ad1327ec99d404 100644 (file)
@@ -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";
index 3d06b99aef62b0638cef82b58b7c2abb8685be6a..7bbbd34005fa7bb00d66e326efee224e525f5044 100644 (file)
@@ -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;
 
 }
index 47cfb27e37fb6f7eb0fcc78fbfec7d54a90366b5..05e2fb05d87ea0894d2edc35160d2ea4c372a8fa 100644 (file)
@@ -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',
index 92783c14fe670304c7e8c7996bcf475ffc07968d..1aaddf77897b9326b8de2dbab757c3b6a2369c9b 100644 (file)
@@ -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;
 }
index e7a1b49c248ea36b2830c0e2862fe5a8fcd839c2..d7f9febea35e50416835e77220c38af2d4408312 100644 (file)
@@ -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 (executable)
index 0000000..fb12c60
Binary files /dev/null and b/pix/i/report.gif differ
diff --git a/theme/cordoroyblue/pix/i/report.gif b/theme/cordoroyblue/pix/i/report.gif
new file mode 100755 (executable)
index 0000000..fb12c60
Binary files /dev/null and b/theme/cordoroyblue/pix/i/report.gif differ
index e910b68c96ade9eecf7dc32f2812b1604bc80d34..7738c1d060d2862d4aa0e1c6ca1c34fd54b6b8c4 100644 (file)
@@ -5,7 +5,7 @@
 // database to determine whether upgrades should
 // be performed (see lib/db/*.php)
 
-$version = 2003102900;   // The current version is a date (YYYYMMDDXX)
+$version = 2003103100;   // The current version is a date (YYYYMMDDXX)
 
 $release = "1.2 development";   // User-friendly version number