Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
781 views
in Technique[技术] by (71.8m points)

javascript - Cannot retrieve previously saved data from LMS - SCORM 2004

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:

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...