Documentation Index
Fetch the complete documentation index at: https://mintlify.com/exelearning/mod_exelearning/llms.txt
Use this file to discover all available pages before exploring further.
mod_exelearning_save_track is the web-service counterpart of track.php. It accepts per-iDevice scores and an optional overall SCORM status, re-shapes them into the internal payload format, and delegates entirely to the shared track::ingest() pipeline — so the server-side safeguards are identical to the browser-based track.php path. Only the authenticated user ($USER) can be graded; a client cannot submit scores on behalf of another user.
Function details
| Field | Value |
|---|---|
| Function name | mod_exelearning_save_track |
| Class::method | mod_exelearning\external\save_track::execute |
| Type | write |
| Service | MOODLE_OFFICIAL_MOBILE_SERVICE |
| Capability | mod/exelearning:savetrack |
Parameters
The ID of the
exelearning activity instance (the id column in the exelearning table, returned as id by get_exelearnings_by_courses). This is not the course-module ID.The tracking payload for this submission.
Returns
true when track::ingest() accepted and recorded the submission. false when the submission was rejected (e.g. status-only no-op, or maxattempt cap reached). Check warnings for the reason when status is false.The attempt number that was written (
1-based). 0 when the submission was rejected and no attempt was recorded.The server-side overall grade after aggregation across all per-iDevice scores. This is the value written to the gradebook — the client’s own overall score value is never trusted.
Contains one warning when
maxattempt is hit. Empty on a successful submission.Server-side safeguards
All of the following are enforced bytrack::ingest() and apply equally to this function and to the web track.php path:
| Safeguard | Behaviour |
|---|---|
Always grades $USER | The authenticated user is always the target. No parameter can change this. |
| Unknown objectids ignored | An objectid not registered for this activity instance is silently discarded — it does not cause an error or a spurious grade column. |
| Overall recomputed server-side | The server recalculates the overall score from per-iDevice scores. The client’s scoreraw / scoremax values are used for SCORM CMI bookkeeping only. |
| Scores clamped | Scores are clamped to [grademin, grademax] as configured on the instance. |
| Attempt cap enforced | When maxattempt > 0 and the user has already reached that many attempts, the submission is rejected and a maxattemptsreached warning is returned. |
| Status-only no-op | When scoreraw is null the submission is a no-op — no 0-score attempt row is created and no attempt slot is consumed. |
The web
track.php endpoint returns HTTP 409 Conflict when the attempt cap is reached. This function returns status: false with a maxattemptsreached warning in the warnings array instead — it does not throw an exception. Check warnings whenever status is false.Security model
The function enforces the following checks in order:validate_parameters()— sanitises all inputs.validate_context()— establishes the module context.require_capability('mod/exelearning:savetrack', $context)— the caller must hold the save-track capability.- Preview mode is always disabled for web-service calls — scores are always persisted when the submission is accepted.
Example request — full submission
Example response — accepted
Example response — attempt cap reached
Example — status-only commit (no score)
A status-only commit is useful to report completion without submitting a score (e.g. when the content only tracks completion, not a numeric grade). Omitscoreraw or set it to null:
status: false (no attempt was written) and an empty warnings array — the no-op is silent and expected.