Trying to use Pipwerks SCORM 1.2 wrapper with Moodle

446 views
Skip to first unread message

Alan Z

unread,
Aug 16, 2010, 1:45:08 PM8/16/10
to eLearning Technology and Development
I am trying to do something that would seem quite simple but I am
facing a few problems. Maybe someone here can help this newbee.
I want to place the initialize() call on the first course page and the
terminate() call on the last page. The pages themselves navigate the
course... when you reach the end you have passed, and so we just want
to set the status to completed at that point. We don't care about any
communication between the user and the LMS during the interim, and we
do not need to support restarting the course where the user left off.
I figured I would just adapt the excellent, simple example that Philip
Hutchison provided (a one page "course") since the changes I would
need to make didn't seem to be that great. BUT... I am messing up
somewhere.
What I find is that--
1. When I call terminate() from the last page there is no Active
connection and the call fails. How do I keep the connection made in
the first page of the course alive until the end? All the above is on
my own localhost Apache system running Moodle, so I am talking about
code, not network performance, here.
2. If I abort the course in the middle, before any chance that I have
actually reached the last page, and I then reenter the course-- the
completionStatus returned from the API in the initialize() call in the
first page is "completed", not "incomplete" ! What could be setting
the competion status to "completed"? Might this be a Moodle problem? I
will ask in the Moodle boards but if any readers of thie group are
Moodle adepts, perhaps they have encountered this issue. (The course
is a SCORM-format course and the grading method was set to Learning
Objects.)
All suggestions welcome!
Alan
PS/ One other small problem: the initialize() function gets back an
initial completionStatus from the API as "not attempted", and so the
line "if (completionStatus)" is evaluating false. I changed it to test
against "==null" and force the "not attempted" to "incomplete" to get
around this. Question: is this correct?

Estes Ethan

unread,
Aug 16, 2010, 2:07:07 PM8/16/10
to elearning-technolo...@googlegroups.com
Alan, well for one if your course is not setting the lesson_status to some value-incomplete, passed, failed, completed. Then when the session ends the LMS must set lesson_status to completed. So most likely when you leave in the middle lesson_status was never changed from what the LMS set it to on the first entry, so the LMS sees that and follows the spec and sets it to completed.

Best thing to do is on your start page after your initialize call is returned successfully you should set the lesson_status to incomplete. That way you know you changed the value and the LMS won't override.
-EÆ

--
You received this message because you are subscribed to the Google Groups "eLearning Technology and Development" group.
To post to this group, send email to elearning-technolo...@googlegroups.com.
To unsubscribe from this group, send email to elearning-technology-and...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/elearning-technology-and-development?hl=en.


Philip Hutchison

unread,
Aug 16, 2010, 2:21:59 PM8/16/10
to elearning-technolo...@googlegroups.com
hi guys

the wrapper has a built-in completionStatus handler that will automatically set the status to incomplete on when the course loads *unless* it is told not to (pipwerks.SCORM.handleCompletionStatus = false) or if the completion status is already 'completed'.

alan mentioned in his PS that he modified the built-in completionStatus handler. i suggest putting it back how it was:

if(scorm.handleCompletionStatus){
   completionStatus = pipwerks.SCORM.status("get");
   if(completionStatus){
      //using a 'switch' in case you want to add handlers for other status strings
      switch(completionStatus){
         case "not attempted": pipwerks.SCORM.status("set", "incomplete"); break;
         case "unknown" : pipwerks.SCORM.status("set", "incomplete"); break;          
      }                      
   }                      
}

This code gets the current status from the LMS.  if it returns a string value (including "not attempted"), the if clause will evaluate true, allowing the code inside the if clause to execute. in alan's case, the returned value is "not attempted". this is fine, the code will do the following:

   case "not attempted": pipwerks.SCORM.status("set", "incomplete"); break;

alan, try reverting to the default code and see if you still encounter the early termination problem.

- philip

Cor

unread,
Aug 16, 2010, 2:48:13 PM8/16/10
to elearning-technolo...@googlegroups.com

I had the same problem, and it is due to Moodle.

Moodle uses sessions to keep track of that status.

I force Moodle to suspend:

                               //---------------------------  s a v e A n d K i l l L M S C o n n e c t i o n  -------------------------

                               private function saveAndKillLMSConnection():void {

                                               /******************************************************************************************************************

                                               * Once Moodle gets the server-side code fixed, you should remove the scorm.set("cmi.core.exit", "suspend") code. *

                                               *****************************************************************************************************************/

                                               bSuspend = scorm.set("cmi.core.exit", "suspend");

                                               scorm.save();

                                               scorm.disconnect();

                                               lmsConnected = false;

                               }//end killLMSConnection

 

HTH

Cor

Geen virus gevonden in het binnenkomende-bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 9.0.851 / Virusdatabase: 271.1.1/3074 - datum van uitgifte: 08/15/10 20:35:00

Philip Hutchison

unread,
Aug 16, 2010, 2:58:41 PM8/16/10
to elearning-technolo...@googlegroups.com
In Alan's case, he isn't interested in resuming the course, so he should set cmi.core.exit to "logout" instead of "suspend".  if exit is set to "logout", it means the next time the learner launches the course, the LMS will treat it like a brand-new attempt, with no traces of the previous launch.  clean slate.

BTW, the wrapper also handles the cmi.core.exit status automatically (based on the course's completion status), so you shouldn't need to manually specify it.  However, should you decide to specify it yourself, the wrapper respects your choice and will not make any further changes to the exit status.  No need to modify the wrapper.

- philip



On Mon, Aug 16, 2010 at 11:48 AM, Cor <cor.va...@gmail.com> wrote:

I had the same problem, and it is due to Moodle.

Moodle uses sessions to keep track of that status.

I force Moodle to suspend:

                               //---------------------------  s a v e A n d K i l l L M S C o n n e c t i o n  -------------------------

                               private function saveAndKillLMSConnection():void {

                                               /******************************************************************************************************************

                                               * Once Moodle gets the server-side code fixed, you should remove the scorm.set("cmi.core.exit", "suspend") code. *

                                               *****************************************************************************************************************/

                                               bSuspend = scorm.set("cmi.core.exit", "suspend");

                                               scorm.save();

                                               scorm.disconnect();

                                               lmsConnected = false;

                               }//end killLMSConnection

 

HTH

Cor

 

From: elearning-technolo...@googlegroups.com [mailto:elearning-technolo...@googlegroups.com] On Behalf Of Philip Hutchison
Sent: maandag 16 augustus 2010 20:22
To: elearning-technolo...@googlegroups.com
Subject: Re: [elearning tech & dev] Trying to use Pipwerks SCORM 1.2 wrapper with Moodle

 

hi guys

Geen virus gevonden in het binnenkomende-bericht.


Gecontroleerd door AVG - www.avg.com
Versie: 9.0.851 / Virusdatabase: 271.1.1/3074 - datum van uitgifte: 08/15/10 20:35:00

--

Cor

unread,
Aug 16, 2010, 3:52:50 PM8/16/10
to elearning-technolo...@googlegroups.com

I didn’t go in depth of Alan’s case, but I had this issue with Moodle and thought to recognize it in the previous mail.

 

But in spite of the wrapper I had to do the suspend work around because I use a single SCO  Flash app.

Alan Z

unread,
Aug 16, 2010, 4:48:26 PM8/16/10
to eLearning Technology and Development
Thank you all for your speedy and helpful replies!

Philip, I will restore the original test of completionStatus -- no
doubt it was
pilot error that led me to believe that it evaluated false when the
string was
"not attempted".

But I confess that I am still not sure of the other suggestion, viz.
(Cor) to
explicitly set the cms.core.exit to "logout" or to "suspend" in an
saveAndKillLMSConnection method or (Philip) to rely on the wrapper.
Please
indulge me by helping with a bit more explanation:

I can add an "onunload" handler to the first page which will
explicitly set this
status and then disconnect as in your saveAndKillLMSConnection
example, Cor. But
wouldn't that mean that the last page (that uses terminate) must once
again call
initialize to connect? That seems wrong in principle if the
connection is
supposed to be persistent through the life of the execution of the
Scorm course.
It seems somewhat odd to launch the course and then tear down the
connection
throughout the life of the course until the end where it is recreated.
Maybe I
misunderstood how you meant to use the saveAndKillLMSConnection
method.

Another idea-- should I have the onunload handler execute

scorm.set("cmi.core.exit","logout")
scorm.save()
but not

scorm.disconnect()
lmsConnected=false;
Would this be enough to keep Moodle from setting the completion status
to
"completed"?

Finally, is it also a Moodle problem why I find at present (without
adding the
above methods) that there is no active connection available when I
finally get
to the last page of the course?

Again, my thanks to you all.

Alan

Philip Hutchison

unread,
Aug 16, 2010, 5:08:49 PM8/16/10
to elearning-technolo...@googlegroups.com
once terminate is invoked, you cannot re-initialize without closing and re-launching your course.

you shouldn't need to specify cmi.core.exit because the wrapper handles it for you.

if you use the pipwerks wrapper with the default settings and do the following:
  • in your first page you invoke pipwerks.SCORM.init()
  • in your last page you invoke pipwerks.SCORM.quit()

the expected result is:
on first page:
  • LMS connection will initialize
  • status will be automatically set to 'incomplete'

on last page:
  • exit will be automatically set to 'resume'
  • LMS connection will terminate

test it and see if it works for you.  then, if you want to flesh it out more, start adding other commands.

if you use the pipwerks wrapper with the default settings and do the following:

  • in your first page you invoke pipwerks.SCORM.init()
  • in your second page you invoke pipwerks.SCORM.set("cmi.core.lesson_status", "completed"); immediately followed by pipwerks.SCORM.save();
  • in your last page you invoke pipwerks.SCORM.quit()

the expected result is:

on first page:
  • LMS connection will initialize
  • status will be automatically set to 'incomplete'
on second page:
  • course status will be changed to 'completed'
  • the LMS will persist (save) this new status
on last page:
  • exit will be automatically set to 'logout' (because status was set to 'completed')
  • LMS connection will terminate

this barebones code is all you need to do what you're asking.

- philip



--

Alan Z

unread,
Aug 18, 2010, 10:38:55 AM8/18/10
to eLearning Technology and Development
I have stripped everything down to bare bones, but the API does not
stay active when I move from the first page to the second.
In pg1 I call init() and all seems well.
In the onunload handler for pg2 I try to call
pipwerks.SCORM.set("cmi.core.lesson_status", "completed");
pipwerks.SCORM.save();
but the code in SCORM_API_wrapper for the set function fails with "API
connection is inactive".
Needless to say the call to terminate() on pg2 (the last page of the
"course") fails as well.

How do I keep the API active from page to page? Do I need to
serialize, save, and restore an API object on each page-to-page
transition? I am not sure how I would do that in Javascript anyway,
but wouldn't the built-in Moodle SCORM player know to do that?

Note that the page to page transitions are being done with a hardcoded
HTML link. Is that the problem?

Thanks for any and all help!

If anyone cares to look at the files I would be only too happy to
share them. :)

Alan Z

unread,
Aug 18, 2010, 11:15:28 AM8/18/10
to eLearning Technology and Development
silly me. i found what i believe is the answer elsewhere in this
forum, viz. that i need a frameset in which to maintain state.

Philip Hutchison

unread,
Aug 18, 2010, 12:31:14 PM8/18/10
to elearning-technolo...@googlegroups.com
i was just about to ask if you're using a frameset (or iframe)... if you don't, the entire page changes and you lose all your JavaScript.  :)


On Wed, Aug 18, 2010 at 8:15 AM, Alan Z <alanza...@yahoo.com> wrote:
silly me. i found what i believe is the answer elsewhere in this
forum, viz. that i need a frameset in which to maintain state.

Alan Zaitchik

unread,
Aug 18, 2010, 4:20:06 PM8/18/10
to elearning-technolo...@googlegroups.com
I decided that the best thing was to avoid frames altogether and just use one file after all. The various content pages which were in separate files are now various DIVs whose visibility I control through Javascript as the user clicks on Next or Prev. And the SCORM calls are now working! (They too are controlled through the same logic that manipulates the visibility of the DIVs.) Very kludgy but it works for this course, which has juts a few screens in it.
I know I must learn how to build more robust frameset based SCORM solutions, but that will have to wait for the while...
Thanks for your patient help, Philip!
Alan


From: Philip Hutchison <plate...@gmail.com>
To: elearning-technolo...@googlegroups.com
Sent: Wed, August 18, 2010 12:31:14 PM
Subject: Re: [elearning tech & dev] Re: Trying to use Pipwerks SCORM 1.2 wrapper with Moodle
Reply all
Reply to author
Forward
0 new messages