The SCORM API wrapper (v1.1.7) has been updated to automatically set the initial course status and the exit status.
The point of my SCORM API wrapper is to make working with SCORM easier. These two new functions are intended to ensure you follow best practices with your SCORM code while reducing the amount of tedious code you will need to write for your course.
Setting the initial course status
Even though there are many ways to use SCORM, one task every course should handle is changing SCORM’s initial state of “not attempted” (or sometimes “unknown”) to “incomplete”. The logic being that if the learner launched the SCO, the lesson can be considered ‘started’ but not completed yet. To meet this need, the following logic has been added to the wrapper:
- Upon connection to the LMS, the wrapper will automatically request the course status.
- If the course status is “not attempted” or “unknown”, the wrapper will instruct the LMS to set the status to “incomplete”.
- If the reported status was anything other than “not attempted” or “unknown”, the wrapper will not make any changes.
The wrapper does not automatically handle setting a completion status at the end of a course.
This feature is compatible with both SCORM 1.2 and SCORM 2004, and is enabled by default.
In some cases, you might not want the course to be set to incomplete until after some kind of action has been taken within the course. If that’s the case, you can disable the feature by simply adding this line of code to your JavaScript before calling pipwerks.SCORM.init()
:
pipwerks.SCORM.handleCompletionStatus = false;
Code language: JavaScript (javascript)
Setting the exit status
As I mentioned in my previous post, using cmi.core.exit (SCORM 1.2) and cmi.exit (SCORM 2004) is a good idea, and one that’s easily overlooked. If you don’t explicitly set the exit status to “suspend” for an incomplete course, the LMS is supposed to consider the course complete, and make the suspend_data unavailable. Simply stated, forgetting to set the exit status can really muck things up!
To help ensure your exit status is always set, I’ve added the following logic to the wrapper:
Upon terminating the course session (pipwerks.SCORM.quit()
):
- If the exit status has already been set by the course, do nothing.
- If the exit status has not been set, check the course status, then:
- If the course has been set to completed (and/or “passed” in SCORM 1.2), then automatically set the exit mode to “logout” (SCORM 1.2) or “normal” (SCORM 2004).
- If the course has not been set to completed (and/or “passed” in SCORM 1.2), we assume the learner will be coming back to complete the course at a later time. Therefore, we will automatically set the exit mode to “suspend”.
This feature is compatible with both SCORM 1.2 and SCORM 2004, and is enabled by default. If you wish to disable the feature for any reason, simply add this line of JavaScript to your code before calling pipwerks.SCORM.init()
:
pipwerks.SCORM.handleExitMode = false;
Code language: JavaScript (javascript)
Get the latest version of the wrapper
You can download the latest version of the wrapper (and other goodies) from GitHub.
Comments
Michael wrote on January 15, 2010 at 10:07 am:
Thanks for this wrapper Philip, it has made integrating SCORM into this lesson for my client much simpler than I thought it was going to be.
I do have one question on it however. When the trainee closes the page via the 'X' button or alt-f4 etc, I want to set certain parameters in the lms (session_time, exit, etc). I have an onUnload event calling a function that calls some of the function in the SCORM wrapper, but nothing seems to save. (I am testing in the Reload player).
I was wondering if you had any pointers to get this to work? Also, if this is not a "standard" implementation (this is the first time Ive worked with SCORM) how would something like this be handled?
Thanks
philip wrote on January 15, 2010 at 9:45 pm:
Hi Michael
We can probably help you sort that out over on the <a href="http://groups.google.com/group/elearning-technology-and-development" rel="nofollow ugc">E-Learning Technology and Development Google Group</a>. Try posting your question there.
Kurt Melander wrote on March 17, 2010 at 12:46 pm:
Michael,
If your targeting the IE browser, such as used by DoD as the standard, you can use a BeforeUnload event to do a Setvalue of your variables and then commit, although an LMS finish/terminate is by default considered a commit action, sometimes onunload events are lost in transit as the LMS is closing the SCO session. For in IE, I believe the BeforeUnload event must fire before the OnUnload event, this gives the browser enough time to help ensure all cmi.data is committed properly. Just a suggestion.
philip wrote on March 17, 2010 at 12:49 pm:
Some other browsers have started supporting onbeforeunload, too. <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload" rel="nofollow ugc">Mozilla Dev Center: window.onbeforeunload</a>
Guy Losing Hair wrote on September 23, 2010 at 4:44 pm:
Can I use "passed" for completion when using SCORM 2004?
philip wrote on September 23, 2010 at 11:59 pm:
'passed' is only accepted when using cmi.success_status, not cmi.completion_status. see the official SCORM RTE documentation on the ADL site for specifics.
Emiliano wrote on January 28, 2011 at 4:44 am:
hi philip!
Im trying the Scorm 2004 with Flash AS3 for Moodle.
It works great! But I have a problem to set the total time.
In flash I have a timer, and when you click a "Finish" bottom I put:success=scorm.set("cmi.session_time","myTimer");
console("scorm.set('cmi.session_time', 'myTimer'): " +success);In the console appers – session_time – false.
Do you know how it works?
GRACIAS !
Emiliano – Argentina
philip wrote on January 29, 2011 at 5:35 pm:
@emiliano
My guess is that you may have formatted the time incorrectly (SCORM 2004 requires a very specific format for session time). For details on how to use session time, check out the SCORM documentation on the <a href="https://www.adlnet.gov/adl-research/scorm/" rel="nofollow ugc">ADL site</a> and/or <a href="http://scorm.com/scorm-explained/technical-scorm/run-time/" rel="nofollow ugc">scorm.com</a>.If you have further questions you can try posting to the <a href="http://groups.google.com/group/elearning-technology-and-development" rel="nofollow ugc">E-Learning Technology and Development Google Group</a>.
Thanks for this wrapper Philip, it has made integrating SCORM into this lesson for my client much simpler than I thought it was going to be.
I do have one question on it however. When the trainee closes the page via the ‘X’ button or alt-f4 etc, I want to set certain parameters in the lms (session_time, exit, etc). I have an onUnload event calling a function that calls some of the function in the SCORM wrapper, but nothing seems to save. (I am testing in the Reload player).
I was wondering if you had any pointers to get this to work? Also, if this is not a “standard” implementation (this is the first time Ive worked with SCORM) how would something like this be handled?
Thanks
Hi Michael
We can probably help you sort that out over on the E-Learning Technology and Development Google Group. Try posting your question there.
Michael,
If your targeting the IE browser, such as used by DoD as the standard, you can use a BeforeUnload event to do a Setvalue of your variables and then commit, although an LMS finish/terminate is by default considered a commit action, sometimes onunload events are lost in transit as the LMS is closing the SCO session. For in IE, I believe the BeforeUnload event must fire before the OnUnload event, this gives the browser enough time to help ensure all cmi.data is committed properly. Just a suggestion.
Some other browsers have started supporting onbeforeunload, too. Mozilla Dev Center: window.onbeforeunload
Can I use “passed” for completion when using SCORM 2004?
‘passed’ is only accepted when using cmi.success_status, not cmi.completion_status. see the official SCORM RTE documentation on the ADL site for specifics.
hi philip!
Im trying the Scorm 2004 with Flash AS3 for Moodle.
It works great! But I have a problem to set the total time.
In flash I have a timer, and when you click a “Finish” bottom I put:
success=scorm.set(“cmi.session_time”,”myTimer”);
console(“scorm.set(‘cmi.session_time’, ‘myTimer’): ” +success);
In the console appers – session_time – false.
Do you know how it works?
GRACIAS !
Emiliano – Argentina
@emiliano
My guess is that you may have formatted the time incorrectly (SCORM 2004 requires a very specific format for session time). For details on how to use session time, check out the SCORM documentation on the ADL site and/or scorm.com.
If you have further questions you can try posting to the E-Learning Technology and Development Google Group.