I'm trying to retrieve previously saved data from Moodle LMS but seems like something is not working. This is what I'm doing:
I load the SCORM (v2004) package into Moodle and perform some actions (like save navigation data or set completion status):
// Completion status always "unknown" at first time so I try to change it to incomplete:
API_1484_11.SetValue('cmi.completion_status', 'incomplete'); // "true"
...
API_1484_11.SetValue('cmi.location', '{"page":2}'); // "true"
Then later on commit these changes:
API_1484_11.Commit(''); // true
Request/Response:
When I leave and reenter the activity and try to retrieve this data again the API returns an empty string or the default initial value.
// I've already initialized the API at this point.
API_1484_11.GetValue('cmi.completion_status'); // "unknown"
...
API_1484_11.GetValue('cmi.location'); // ""
Am I missing something?
Do I need to call any other method to retrieve data from the server or something like that?
Or maybe I misunderstood the purpose of those methods?
I would appreciate any help on this topic. Thanks in advance.
Commit is important. Make sure you are setting cmi.exit to "suspend". SCORM 2004 in moodle isn't probably full featured unless someone finished it. Last I heard the Dev working on it gave up. So you may be dealing with a SCORM 1.2 implementation. I'm on a mobile device so I hope that gives you enough hints to troubleshoot. Good luck.
来源:https://stackoverflow.com/questions/46008375/cannot-retrieve-previously-saved-data-from-lms-scorm-2004