Quiz Archives
This pages describes the archives generated by the quiz activity archiving driver.
Archive contents
Generated quiz archives can contain the following files:
| Filetype | Example | Description |
|---|---|---|
| Attempt report (PDF) | attempt-17-jdoe.pdf |
PDF report of the quiz attempt. |
| Attempt report (HTML) | attempt-17-jdoe.html |
Raw HTML that was used to generate the PDF report of the quiz attempt. |
| File checksum | attempt-17-jdoe.pdf.sha256 |
SHA256 checksum of each file in the archive. |
| Attempt attachment | essay.pdf |
Files uploaded by the student as part of their attempt. |
| Archive metadata (CSV) | attempts_metadata.csv |
Tabular file containing metadata about the quiz attempts inside the archive. |
Naming patterns
When creating a new quiz archive, the Advanced settings section contains three options for naming the files inside an archive and the archive itself:
- Archive name controls the name of the final archive file.
- Attempt folder name controls the names of the folders created for each attempt when using the hierarchical file structure.
- Attempt name controls the names of the PDF reports generated for individual quiz attempts. If HTML source files are enabled, they use the same base name.
Patterns can be composed of plain text and variables. Variables must use the ${variablename} syntax. The file
extension is added automatically, so do not add an extension yourself.
Info
Attempt folder name has no effect when Flatten export archive is enabled because all files are placed in the root of the resulting archive. See File structure for details.
The variables are available for use within the respective name patterns:
| Variable | Description | Archive name | Attempt folder name | Attempt name |
|---|---|---|---|---|
${courseid} |
Course ID | ✅ | ✅ | ✅ |
${coursename} |
Course name | ✅ | ✅ | ✅ |
${courseshortname} |
Course short name | ✅ | ✅ | ✅ |
${cmid} |
Course module ID | ✅ | ✅ | ✅ |
${quizid} |
Quiz ID | ✅ | ✅ | ✅ |
${quizname} |
Quiz name | ✅ | ✅ | ✅ |
${opendatetime} |
Quiz opening (YYYY-MM-DD_HH-MM-SS) |
❌ | ✅ | ✅ |
${closedatetime} |
Quiz closing (YYYY-MM-DD_HH-MM-SS) |
❌ | ✅ | ✅ |
${attemptid} |
Attempt ID | ❌ | ✅ | ✅ |
${username} |
Student username | ❌ | ✅ | ✅ |
${firstname} |
Student first name | ❌ | ✅ | ✅ |
${lastname} |
Student last name | ❌ | ✅ | ✅ |
${email} |
Student email address | ❌ | ✅ | ✅ |
${idnumber} |
Student ID number | ❌ | ✅ | ✅ |
${groupids} |
IDs of the student's groups | ❌ | ✅ | ✅ |
${groupidnumbers} |
ID numbers of the student's groups | ❌ | ✅ | ✅ |
${groupnames} |
Names of the student's groups | ❌ | ✅ | ✅ |
${timestart} |
Attempt start Unix timestamp | ❌ | ✅ | ✅ |
${timefinish} |
Attempt finish Unix timestamp | ❌ | ✅ | ✅ |
${startdatetime} |
Attempt start (YYYY-MM-DD_HH-MM-SS) |
❌ | ✅ | ✅ |
${finishdatetime} |
Attempt finish (YYYY-MM-DD_HH-MM-SS) |
❌ | ✅ | ✅ |
${date} |
Current date (YYYY-MM-DD) |
✅ | ✅ | ✅ |
${time} |
Current time (HH-MM-SS) |
✅ | ✅ | ✅ |
${timestamp} |
Current Unix timestamp | ✅ | ✅ | ✅ |
Info
This list may not be exhaustive. Please check the help text of the respective option in Moodle itself. It will always contain an up-to-date list of all variables that your current plugin version supports.
File structure
Archives can be created either hierarchical or flat. By default, hierarchical archives with sub-folders are created. The Flatten export archive checkbox determines how files are placed inside the archive:
- When it is not selected, the archive uses a hierarchical structure with separate directories. The Attempt folder name setting determines the directory used for each attempt.
- When it is selected, the archive uses a flat structure. All files are placed directly in the root of the archive. Prefixes are added to file names to distinguish reports belonging to different attempts and to prevent name collisions. The Attempt folder name setting is ignored.
Example: Hierarchical
For example, with an attempt folder pattern of ${username}/${attemptid} and an attempt name pattern of
attempt-${attemptid}-${username}, a hierarchical archive may contain entries like:
/
├── attempts/
│ └── jdoe/
│ └── 17/
│ ├── attachments/
│ │ └── 0/
│ │ ├── essay.pdf
│ │ └── essay.pdf.sha256
│ ├── attempt-17-jdoe.pdf
│ └── attempt-17-jdoe.pdf.sha256
├── attempts_metadata.csv
└── attempts_metadata.csv.sha256
Example: Flat
The equivalent flat archive to the example above keeps the same files at its top level and uses prefixes to retain their association with the attempt:
/
├── attempt_17.attempt-17-jdoe.pdf
├── attempt_17.attempt-17-jdoe.pdf.sha256
├── attempt_17.attempt-17-jdoe.attachment.0.essay.pdf
├── attempt_17.attempt-17-jdoe.attachment.0.essay.pdf.sha256
├── attempts_metadata.csv
└── attempts_metadata.csv.sha256