Moodle

"Collect assignments" enhancement to the assignment module

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 1.9
  • Fix Version/s: 2.0
  • Component/s: Assignment
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Currently each student's assignment is stored in a separate directory under the the user's userid. This means that one cannot simply go directly into the moodledata file and retrieve all assignments in a simple manner. It is generally cumbersome to have to click and download each assignment before viewing them – particularly for large classes.

What I would like to suggest is a "Collect" button on the assignment page, which would iterate through all submitted assignments of a particular assignment instance, gather the most recent version of each and present the entire set to the teacher as a single ZIP file. This could then be downloaded, and all of the files opened at once for viewing, comparison or comments.

  1. devoir2zip.php
    17/Apr/08 7:24 PM
    5 kB
    Patrick Pollet
  2. devoir2zip.php
    16/Apr/08 5:35 PM
    4 kB
    Patrick Pollet

Issue Links

Activity

Hide
Patrick Pollet added a comment -

Hello,

Here is my quick & dirty solution that I am using since Moodle 1.7

1) copy the attached file "devoir2zip.php" in mod/assignment

2) modify mod/assignment /lib.php function near line 1201 to add the lines with '+' below

[root@cipcnet moodle]# diff -U3 cvs/mod/assignment/lib.php mod/assignment/
— cvs/mod/assignment/lib.php 2008-01-10 02:45:11.000000000 +0100
+++ mod/assignment/lib.php 2008-04-11 10:00:44.000000000 +0200
@@ -1201,6 +1201,12 @@
}
}

+//PP link to downlad a zip with all submissions
+$button= link_to_popup_window ('/mod/assignment/devoir2zip.php?id='.
+ $this->cm->id.'&group='.$currentgroup,
+ '','télécharger un zip des devoirs ',400,500,'','none',true);
+echo '<p align="center">'.$button.'(n\'oubliez pas de choisir d\'abord le groupe si nécessaire!)</p>';
+
/// Print quickgrade form around the table
if ($quickgrade){
echo '<form action="submissions.php" name="fastg" method="post">';

3) VERY important : modify lib/pclzip/pclzip.php define for temporary dir
// define( 'PCLZIP_TEMPORARY_DIR', '' );
define ('PCLZIP_TEMPORARY_DIR',"$CFG->dataroot/temp/");

and finally : translate to your language the hard-coded strings )

Hope this help and may find its way in official release after code polishing and translation support

Cheers.

Show
Patrick Pollet added a comment - Hello, Here is my quick & dirty solution that I am using since Moodle 1.7 1) copy the attached file "devoir2zip.php" in mod/assignment 2) modify mod/assignment /lib.php function near line 1201 to add the lines with '+' below [root@cipcnet moodle]# diff -U3 cvs/mod/assignment/lib.php mod/assignment/ — cvs/mod/assignment/lib.php 2008-01-10 02:45:11.000000000 +0100 +++ mod/assignment/lib.php 2008-04-11 10:00:44.000000000 +0200 @@ -1201,6 +1201,12 @@ } } +//PP link to downlad a zip with all submissions +$button= link_to_popup_window ('/mod/assignment/devoir2zip.php?id='. + $this->cm->id.'&group='.$currentgroup, + '','télécharger un zip des devoirs ',400,500,'','none',true); +echo '<p align="center">'.$button.'(n\'oubliez pas de choisir d\'abord le groupe si nécessaire!)</p>'; + /// Print quickgrade form around the table if ($quickgrade){ echo '<form action="submissions.php" name="fastg" method="post">'; 3) VERY important : modify lib/pclzip/pclzip.php define for temporary dir // define( 'PCLZIP_TEMPORARY_DIR', '' ); define ('PCLZIP_TEMPORARY_DIR',"$CFG->dataroot/temp/"); and finally : translate to your language the hard-coded strings ) Hope this help and may find its way in official release after code polishing and translation support Cheers.
Hide
Patrick Pollet added a comment -

a script do create a zip for all submissions to an assignment. Support groups if specified.

Show
Patrick Pollet added a comment - a script do create a zip for all submissions to an assignment. Support groups if specified.
Hide
Thomas Robb added a comment -

Thank you, thank you!! I popped the code into the assignment module, making the adjustments that you specified in other areas, and it works! Wonderful! Wunderbar! Merveilleux! Christmas has come early this year!

It seems that this should go into the current distribution as soon as someone is able to extract the language and place it in the standard lang files. What do you think.

Show
Thomas Robb added a comment - Thank you, thank you!! I popped the code into the assignment module, making the adjustments that you specified in other areas, and it works! Wonderful! Wunderbar! Merveilleux! Christmas has come early this year! It seems that this should go into the current distribution as soon as someone is able to extract the language and place it in the standard lang files. What do you think.
Hide
Patrick Pollet added a comment -

Glad it worked in your place .

>It seems that this should go into the current distribution as soon as someone is able to extract the language and place it in the >standard lang files. What do you think.

... and address some security issues I just noticed when peeking again at the code. I do check that current user has assignment:grade capability when generating the zip file, but not when downloading it ... this would require sending the
assignment id again to the script in "download" mode and check again that current user has that capability .

Cheers.

Show
Patrick Pollet added a comment - Glad it worked in your place . >It seems that this should go into the current distribution as soon as someone is able to extract the language and place it in the >standard lang files. What do you think. ... and address some security issues I just noticed when peeking again at the code. I do check that current user has assignment:grade capability when generating the zip file, but not when downloading it ... this would require sending the assignment id again to the script in "download" mode and check again that current user has that capability . Cheers.
Hide
Patrick Pollet added a comment -

Please find enclosed a revised devoir2zip.php script that addresses the following :

  • checking capabilty in both creation and download mode
  • move hard coded strings into the appropriate file lang/xxxx/assignment.php

See instructions in the comments atop

Cheers.

Show
Patrick Pollet added a comment - Please find enclosed a revised devoir2zip.php script that addresses the following :
  • checking capabilty in both creation and download mode
  • move hard coded strings into the appropriate file lang/xxxx/assignment.php
See instructions in the comments atop Cheers.
Hide
Dan Marsden added a comment -

I think this patch attemps to achieve what my patch in MDL-7206 does - I keep meaning to commit this to core, but haven't got round to it yet.... patches are there for the various different assignment types.

Dan

Show
Dan Marsden added a comment - I think this patch attemps to achieve what my patch in MDL-7206 does - I keep meaning to commit this to core, but haven't got round to it yet.... patches are there for the various different assignment types. Dan
Hide
Patrick Pollet added a comment -

Dan, you are absolutely right. Your patch is more cleaner and conform to Moodle style than my quick & dirty solution.

I shall apply it asap on my 1.7 and 1.8.

Sorry for overlooking MDL-7206

Cheers.

Show
Patrick Pollet added a comment - Dan, you are absolutely right. Your patch is more cleaner and conform to Moodle style than my quick & dirty solution. I shall apply it asap on my 1.7 and 1.8. Sorry for overlooking MDL-7206 Cheers.
Hide
Patrick Pollet added a comment -

but my patch allow for "selective download" for a group only, which is quite convenient with a big class.
and several teachers

Show
Patrick Pollet added a comment - but my patch allow for "selective download" for a group only, which is quite convenient with a big class. and several teachers
Hide
Peter Komka added a comment -

This script is fine. Thank you.

Is there any opinion to change the directory numbers to real names in the archive file?

The current naming is : /assignment/1/4/uploadedfilename
It should be more readable: /assignment/send_a_picture_assignment/John_Smith/uploadedfilename

Thanks

Show
Peter Komka added a comment - This script is fine. Thank you. Is there any opinion to change the directory numbers to real names in the archive file? The current naming is : /assignment/1/4/uploadedfilename It should be more readable: /assignment/send_a_picture_assignment/John_Smith/uploadedfilename Thanks
Hide
Dan Marsden added a comment -

flagging this as a duplicate - please see MDL-7206 for details - this feature is currently in 2.0 and will backported to 1.9 stable at some point. - thanks!

Show
Dan Marsden added a comment - flagging this as a duplicate - please see MDL-7206 for details - this feature is currently in 2.0 and will backported to 1.9 stable at some point. - thanks!

People

Vote (6)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: