Step 21 – Progress and Completion – Setting Values

The course can change any of the following elements that relate to course progress and completion tracking:

  • cmi.core.lesson_location
  • cmi.core.lesson_status
  • cmi.core.exit

In other words, it can tell the LMS where it is, whether the course is completed/passed/failed/incomplete … and how the course was exited. Nothing for me to do here – this is all handled by the LMSSetValue() API call and the associated setValue.php script on the server.

Note that the cmi.core.entry element isn’t listed here because it can’t be changed by the course. However, it could be changed by the LMS when the LMSFinish() API call is invoked. This element tells the course how it should re-start when the student next returns.

According to the SCORM specification, it should be initialized to ‘ab initio’ when a course first starts (I’ve already set that up – see my last post for more details). Then, when LMSFinish() is called, the LMS should follow a very simple rule:

  • If cmi.core.exit has already been set to ‘suspend’ when the course exits, then cmi.core.entry should be set to ‘resume’.
  • In all other cases, cmi.core.entry should be set to ” (an empty string).

This is pretty simple to implement in my finish.php code like this.

// clear existing value
mysql_query("delete from scormvars where (varName='cmi.core.entry')",$link);

// new entry value depends on exit value
$result = mysql_query("select varValue from scormvars where (varName='cmi.core.exit')",$link);
list($value) = mysql_fetch_row($result);
if ($value == 'suspend') {
	mysql_query("insert into scormvars (varName,varValue) values ('cmi.core.entry','resume')",$link);
}
else {
	mysql_query("insert into scormvars (varName,varValue) values ('cmi.core.entry','')",$link);
}

So far, so good. But there’s one critical thing missing here … the course and/or the LMS can change the value of cmi.core.lesson_status. Unfortunately, the SCORM standard’s rules for doing this are pretty complex. So – next time – I’m going to devote an entire post to this one subject.

This entry was posted in Run Time Environment. Bookmark the permalink.

6 Responses to Step 21 – Progress and Completion – Setting Values

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

  2. Pingback: Desarrollando un LMS(con soporte de SCORM)

  3. Cheryl Novalis-Marine says:

    Thanks so much for this awesome step-by-step. Out of curiosity, wondering why you first deleted the ‘cmi.core.entry’ record and then inserted again. Why not just update the varValue in the DB using an UPDATE statement? Thanks again!

  4. Steve Addison says:

    Wow … it’s been a LONG time since I worked on this project. I believe this is what I was thinking when I wrote that code.

    If you’re not sure whether or not an element exists in the database, you could test for its existence and then do an INSERT or an UPDATE depending on the result of the test. Alternatively, you can do a DELETE then an INSERT which always works. The final result is the same – I guess I just prefer the second method.

  5. CandaceID says:

    Thank you, Steve, for keeping an eye on this site. Many of us DO return again and again.

  6. Arnon Segal says:

    Or beter yet – use REPLACE INTO… which is INSERT if record doesn’t exist, and UPDATE if exists.

Leave a Reply

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