Assignments - C0D3D3V/Moodle-DL GitHub Wiki

To download files from assignments, you must first determine which assignments there are. The course content already gives you an overview of the assignments and how they are arranged in the course. To get a list of the files stored in the assignments you can use mod_assign_get_assignments. This way we get only the assignments for the first time. To get also the submissions, which were submitted by the student or teacher, the call of mod_assign_get_submission_status is necessary.

Area Name Introduced in Description
mod_assign mod_assign_get_assignments 2.4 (2012120300) Returns the courses and assignments for the users capability
mod_assign mod_assign_get_submission_status 3.1 (2016052300) Returns information about an assignment submission status for a given user.

mod_assign_get_assignments

courseids is an array of all course IDs from which you want to receive the assignments. If this parameter is omitted, assignments of all courses are output.

Parameter
Funktion
Returns
Structures

Example output:

{
   "courses":[
      {
         "id":23569,
         "fullname":"Einf\u00fchrung in die Kryptographie (141022-WiSe19\/20)",
         "shortname":"Einf\u00fchrung in die Kryptographie (141022-WiSe19\/20)",
         "timemodified":1569934149,
         "assignments":[
            {
               "id":20711,
               "cmid":1004737,
               "course":23569,
               "name":"\u00dcbung 7 (aktualisiert 29.11.2019, 20 Uhr)",
               "nosubmissions":0,
               "submissiondrafts":0,
               "sendnotifications":0,
               "sendlatenotifications":0,
               "sendstudentnotifications":1,
               "duedate":1575544500,
               "allowsubmissionsfromdate":1574945100,
               "grade":100,
               "timemodified":1575053543,
               "completionsubmit":1,
               "cutoffdate":1575544500,
               "gradingduedate":0,
               "teamsubmission":1,
               "requireallteammemberssubmit":0,
               "teamsubmissiongroupingid":1106,
               "blindmarking":0,
               "revealidentities":0,
               "attemptreopenmethod":"none",
               "maxattempts":-1,
               "markingworkflow":1,
               "markingallocation":0,
               "requiresubmissionstatement":1,
               "preventsubmissionnotingroup":1,
               "submissionstatement":"Diese Arbeit ist meine eigene Leistung. Sofern ich fremde Quellen verwendet habe, sind die Stellen entsprechend gekennzeichnet.",
               "submissionstatementformat":1,
               "configs":[
                  {
                     "plugin":"file",
                     "subtype":"assignsubmission",
                     "name":"enabled",
                     "value":"1"
                  },...
               ],
               "intro":"<p>Grundlagen von Erweiterungsk\u00f6rpern, Multiplikation und Inversion in GF(2<sup>m<\/sup>) und Addition, Subtraktion und Multiplikation in GF(p<sup>m<\/sup>).<\/p><p><br \/><\/p><p>Update (29.11.2019, 20 Uhr): Aufgabe 1 hinsichtlich Primzahlk\u00f6rper pr\u00e4zisiert.<\/p>",
               "introformat":1,
               "introfiles":[

               ],
               "introattachments":[
                  {
                     "filename":"Uebung_7_EK1_WS1920.pdf",
                     "filepath":"\/",
                     "filesize":50113,
                     "fileurl":"https:\/\/moodle.uni.de\/m\/webservice\/pluginfile.php\/1540276\/mod_assign\/introattachment\/0\/Uebung_7_EK1_WS1920.pdf",
                     "timemodified":1575053454,
                     "mimetype":"application\/pdf",
                     "isexternalfile":false
                  },...
               ]
            },...
         ]
      },...
   ],
   "warnings":[
      {
         "item":"module",
         "itemid":1016464,
         "warningcode":"1",
         "message":"No access rights in module context"
      },...
   ]
}

mod_assign_get_submission_status

assignid and userid are necessary parameters!

Parameter
Funktion
Returns

Example output:

{ 
   "lastattempt":{ 
      "submission":{ 
         "id":567446,
         "userid":686094,
         "attemptnumber":0,
         "timecreated":1579173255,
         "timemodified":1579173255,
         "status":"submitted",
         "groupid":0,
         "assignment":20957,
         "latest":1,
         "plugins":[ 
            { 
               "type":"file",
               "name":"Dateiabgabe",
               "fileareas":[ 
                  { 
                     "area":"submission_files",
                     "files":[ 

                     ]
                  }
               ]
            },
            { 
               "type":"comments",
               "name":"Abgabekommentare"
            }
         ]
      },
      "teamsubmission":{ 
         "id":567394,
         "userid":0,
         "attemptnumber":0,
         "timecreated":1579169954,
         "timemodified":1579173255,
         "status":"submitted",
         "groupid":42031,
         "assignment":20957,
         "latest":1,
         "plugins":[ 
            { 
               "type":"file",
               "name":"Dateiabgabe",
               "fileareas":[ 
                  { 
                     "area":"submission_files",
                     "files":[ 
                        { 
                           "filename":"HA11.pdf",
                           "filepath":"\/",
                           "filesize":78968,
                           "fileurl":"https:\/\/moodle.uni.de\/m\/webservice\/pluginfile.php\/1555802\/assignsubmission_file\/submission_files\/567394\/HA11.pdf",
                           "timemodified":1579173255,
                           "mimetype":"application\/pdf",
                           "isexternalfile":false
                        }
                     ]
                  }
               ]
            },
            { 
               "type":"comments",
               "name":"Abgabekommentare"
            }
         ]
      },
      "submissiongroup":42031,
      "submissiongroupmemberswhoneedtosubmit":[ 

      ],
      "submissionsenabled":true,
      "locked":false,
      "graded":true,
      "canedit":false,
      "caneditowner":false,
      "cansubmit":false,
      "extensionduedate":0,
      "blindmarking":false,
      "gradingstatus":"released",
      "usergroups":[ 
         42031
      ]
   },
   "feedback":{ 
      "grade":{ 
         "id":282388,
         "assignment":20957,
         "userid":686094,
         "attemptnumber":0,
         "timecreated":1579263089,
         "timemodified":1579263090,
         "grader":90976,
         "grade":"35.00000"
      },
      "gradefordisplay":"35,00&nbsp;\/&nbsp;100,00",
      "gradeddate":1579263090,
      "plugins":[ 
         { 
            "type":"comments",
            "name":"Feedback als Kommentar",
            "editorfields":[ 
               { 
                  "name":"comments",
                  "description":"Feedback als Kommentar",
                  "text":"<p>1) 30\/40<br>2) 5\/20<br>3) 0\/40<br><\/p>",
                  "format":0
               }
            ]
         },
         { 
            "type":"editpdf",
            "name":"Anmerkungen im PDF",
            "fileareas":[ 
               { 
                  "area":"download",
                  "files":[ 
                     { 
                        "filename":"User_8894397_0.pdf",
                        "filepath":"\/",
                        "filesize":158448,
                        "fileurl":"https:\/\/moodle.uni.de\/m\/webservice\/pluginfile.php\/1555802\/assignfeedback_editpdf\/download\/282388\/User_8894397_0.pdf",
                        "timemodified":1579263090,
                        "mimetype":"application\/pdf",
                        "isexternalfile":false
                     }
                  ]
               }
            ]
         },
         { 
            "type":"file",
            "name":"Feedbackdateien",
            "fileareas":[ 
               { 
                  "area":"feedback_files",
                  "files":[ 

                  ]
               }
            ]
         },
         { 
            "type":"offline",
            "name":"Offline-Bewertungstabelle"
         }
      ]
   },
   "warnings":[ 

   ]
}

get_submissions would be a great alternative, because all assignments can be loaded at once, this has not been tested successfully yet.

⚠️ **GitHub.com Fallback** ⚠️