Step 24 – cmi.suspend_data and cmi.launch_data

Nearly there! If you take a look at the table of mandatory data elements that I presented in Step 19, you’ll see that I only have 2 elements left in my list:

  • cmi.suspend_data
  • cmi.launch_data

These elements store the information that the SCO (again, if you don’t know what an SCO is, please refer to this page) needs to re-start after being suspended, and start for the first time respectively.

The first of these – cmi.suspend_data – is very easy to deal with. It’s initially blank (obviously, because I can’t re-start a SCO until a SCO has started for the first time!) and the contents of the element are generated by the SCO and stored in the database using the LMSSetValue() API call.

cmi.launch_data – is a little more difficult. It’s a read-only element that holds information that the SCO needs to start for the first time. And, like the mastery score that I discussed in my last post, this information is stored in the IMS manifest file which would have been read by the LMS when the content aggregation package (what many of us would commonly call a course package) was imported and installed. So, I’ll modify my initialize.php code like this assuming that the launch data is just an empty string (I’ll deal with reading the IMS manifest file later).

// if not set, cmi.launch_data should be set to either 
// a value from the IMS manifest file (adlcp:datafromlms), or an empty string
$result = mysql_query("select varValue from scormvars where (varName='cmi.launch_data')",$link);
list($value) = mysql_fetch_row($result);
if (! $value) { 
  mysql_query("delete from scormvars where (varName='cmi.launch_data')",$link);
  mysql_query("insert into scormvars (varName,varValue) values ('cmi.launch_data','')",$link);
}

So I test out my course again, and it runs successfully all of the way through to completion. Here’s a typical snapshot of the database during the run.

varName varValue
adlcp:masteryscore 90
cmi.core.credit credit
cmi.core.entry ab initio
cmi.core.lesson_location 3
cmi.core.lesson_status failed
cmi.core.score.raw 13
cmi.core.session_time 00:02:30
cmi.core.total_time 0000:00:00
cmi.launch_data  
cmi.suspend_data D01BA000CA%7E%24LS%2A3A2gC110 …

It might not prove that I’ve implemented everything successfully, but it suggests that I haven’t broken anything!

Be Sociable, Share!
This entry was posted in Run Time Environment. Bookmark the permalink.

One Response to Step 24 – cmi.suspend_data and cmi.launch_data

  1. Pingback: Desarrollando un LMS(con soporte de SCORM) « Jorge Dieguez Blog

Leave a Reply

Your email address will not be published. Required fields are marked *