Download student assignment uploads for Moodle 1.9 in one fell swoop. What a time-saver!

5
2015

Totara LMS supports the work of Frankie Kam as he explores the many possibilities of Moodle for fun and to improve his college’s course site.

Do you use the Assignment activity for your students to upload their work?
Do you have relatively large numbers of assignments to laboriously download and grade? If you answered “yes!” to both questions, then you will love this Moodle 1.9 Assignment activity hack by  T. A. Prilianto. Thanks to John Holmes of Jakarta International School for sharing this with the Moodle community.

This hack (or plugin) allows you, the teacher, to download a single zipped file containing all students’ uploaded assignments of an assignment activity. This sure beats downloading individual assignment links for class of thirty to fifty students!

Here’s a typical link to assignment submissions:

Clicking on submitted assignment work.

Here’s what a typical assignment screen would like like without the plugin. No surprises here. So in the example, you have only 8 submissions. But 8 submissions still means 8 individual clicks of the mouse to download the student work. What if you had 50 submitted assignments? Imagine the amount of work (and mouse clicks) required if you were to individually download 50 student uploaded files!

Now the same screen, but this time with the download hack installed. Check out the red zone:

Ah, did you notice the extra link?

Now that’s NEW! Click on that very link and the below box (sample only) will appear on your screen:

Just in case you’re confused, the name of my assignment, in this example, is “SFB – Upload Excel Exercise Pg15 (Data = labels, constants and formulae)”. You would have to right-click on the blue download link and choose “Save as” to save the zipped file  to your computer.

After the zipped file has been downloaded to your computer, you can explore or extract its contents to your heart’s content:

Would you like to watch a video of this hack  in action? Check out this video by John Holmes that shows the teacher bulk download feature in action:

http://dragontales.jisedu.or.id/?c=343&k=1353a903e0


Installation Steps :

1. Download the hack from https://www1.jisedu.or.id/webapps/moodlex/downloadupload.zip

2. Edit  moodle/downloadupload/db.php.
Locate line4 where it says

require_once(‘../config1.php’);

and delete the 1 so that the line reads as:

require_once(‘../config.php’);

Therefore db.php should now look like this:

<?php

//ini_set("display_errors","on");
require_once('../config.php');

$dbprefix = $CFG->prefix;

if(!$conn = mysql_connect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass))
{
   die("Couldn't connect to database");
}
if(!mysql_select_db($CFG->dbname))
{
   die("Database not exist");
}
?>

2. Extract the zip file and put on your Moodle folder. You’ll see folder downloadupload under Moodle folder. Make sure this folder writeable.

3. Open the file <your Moodle>/mod/assignment/lib.php

4. Go to line 1065 or around that line. Find scripts like below :

if (has_capability('gradereport/grader:view', $course_context)
   && has_capability('moodle/grade:viewall',
   $course_context))
{
   echo '<div><a href="' . $CFG->wwwroot .
   '/grade/report/grader/index.php?id=' . $course->id . '">'
   . get_string('seeallcoursegrades', 'grades') .
   '</a></div>';
}


5. Replace with this script:

if (has_capability('gradereport/grader:view', $course_context)
   && has_capability('moodle/grade:viewall',
   $course_context)) 
{
   echo '<div>';
   echo '<a target="_blank" href="' . $CFG->wwwroot .
   '/downloadupload/download.php?c=' . $course->id .
   '&a='.$assignment->id.'&g='.$groupid.'&t='
   .$USER->id.'">Download Assignment Files</a> | ';

   echo '<a target="_blank" href="' . $CFG->wwwroot .
   '/downloadupload/upload.php?c=' . $course->id .
   '&a='.$assignment->id.'&g='
   .$groupid.'&t='.$USER->id.'">Upload Responses
   Files</a> | ';

   echo '<a href="' . $CFG->wwwroot .
   '/grade/report/grader/index.php?id=' . $course->id . '">'
   . get_string('seeallcoursegrades', 'grades') .
   '</a></div>';
}

So that’s how it’s done.

Why not try investing 30 minutes to implement this hack? If successful, then sit back, relax and bask in the satisfaction of knowing that the job of grading assignments with Moodle just got a whole lot easier.

If you have successfully implemented this hack and you like it, then why not post a comment here? It would encourage met. Knowing that it has helped someone on the Moodle Community will bring me great joy.

Happy downloading
Frankie Kam.

  • The zip file at the link
    has been updated.

    Step2. Edit moodle/downloadupload/db.php.
    is no longer needed as the code at line of db.php does not contain the digit 1. Line 4 now reads as:

    require_once(‘../config.php’);

    So Step2 in the above post is redundant.
    Frankie Kam

  • Part II of this post is on the Upload feature.

  • For an cool and simpler, alternative method, check out Marty Soupcoff’s great post at:
    https://www.moodlenews.com/2012/download-student-assignment-uploads-alternative/

  • i am going to appear for a online test from a moodle site..
    is there any chance to hack pls help me it is the matter of life.. they will provide me a login 2 days before my test.
    pls reply….

  • Joseph Thibault

    why but of course! It’s called Studying and it’s the best way to “hack” the system. http://en.wikipedia.org/wiki/Study_skills