Retrieving user uploaded work en masse

Retrieving user uploaded work en masse

by Sebastian Tennant -
Number of replies: 4

Hi devs,

We run courses that are divided into modules and sometimes one or two years pass between someone completing one module and starting the next.  By this time, the completed course is often no longer accessible to students, so I often get asked to retrieve all of a particular student's uploaded work.

In Moodle 1.9, this is easy.  CourseIDs and UserIDs are easily visible from URLs and then all I have to do is issue a find command like this:

  # CourseID=12, UserID=24
  #
  find dataroot -type f -regex '/12/.*/24/' -print

and I get a nice listing of all the uploaded work by a particular student on a particular course.  I can then zip them all up and send them to the student and everyone is happy.

I fear, things are not going to be so simple in Moodle 2.X due to the opaque nature of the Moodle 2.X filesystem.

Can anyone think of a way of doing this in Moodle 2.0?  Is it even possible?

Presumably the first step will have to be a database query since there must be a way of mapping the human name (stored in the database) to the silicon name (used on disk).

Thanks in advance.

Average of ratings: -
In reply to Sebastian Tennant

Re: Retrieving user uploaded work en masse

by Dan Poltawski -
You'll need to create/use a plugin to achieve this, probably an admin report. The files on disk can not be interrogated like this any more (and in fact one file might belong to 100 users).

This is unfortunate, but it brings many other advantages for Moodle, someone could even create a plugin which extracts the data into a datastructure like you sugges.t
In reply to Dan Poltawski

Re: Retrieving user uploaded work en masse

by Sebastian Tennant -

Hi Dan,

Thanks for your prompt reply.

> You'll need to create/use a plugin to achieve this, probably an admin
> report. The files on disk can not be interrogated like this any more [...].

Is there any documentation for the internals of the Moodle 2.X filesystem?  I'm not a PHP programmer but I'm comfortable with SQL so what I'd really like to know is how the database maps silicon file names to human file names.

> [...] Someone could even create a plugin which extracts the data into
> a datastructure like you suggest.

My work on the SQL side of things could form the basis for such a datastructure and I'd be happy to collabortate with a PHP guy in turning it into a plugin.

In reply to Sebastian Tennant

Re: Retrieving user uploaded work en masse

by Sebastian Tennant -

To answer my own question, the File API is well documented here:

 http://docs.moodle.org/dev/File_API_internals

In reply to Sebastian Tennant

Re: Retrieving user uploaded work en masse

by Andrew James -

Hi Sebastian,

Did you manage to create a plugin? If not, I'm looking for small projects to build up a portfolio of Moodle work, so would be happy to create an admin report that would list all the student's submitted work and allow either the download of each file or a zip download of all of it. Would that be any use?