I’m going to get started on the mandatory ‘progress and completion’ elements:
- cmi.core.lesson_location
- cmi.core.credit
- cmi.core.lesson_status
- cmi.core.entry
- cmi.core.exit
Of these, only the 3 shown above in bold need to be initialized with specified values. So I’ll modify my initialize.php code to include the following lines:
// if not set, cmi.core.credit should be set to 'credit' $result = mysql_query("select varValue from scormvars where (varName='cmi.core.credit')",$link); list($value) = mysql_fetch_row($result); if (! $value) { mysql_query("delete from scormvars where (varName='cmi.core.credit')",$link); mysql_query("insert into scormvars (varName,varValue) values ('cmi.core.credit','credit')",$link); } // if not set, cmi.core.lesson_status should be set to 'not attempted' $result = mysql_query("select varValue from scormvars where (varName='cmi.core.lesson_status')",$link); list($value) = mysql_fetch_row($result); if (! $value) { mysql_query("delete from scormvars where (varName='cmi.core.lesson_status')",$link); mysql_query("insert into scormvars (varName,varValue) values ('cmi.core.lesson_status','not attempted')",$link); } // if not set, cmi.core.entry should be set to 'ab initio' $result = mysql_query("select varValue from scormvars where (varName='cmi.core.entry')",$link); list($value) = mysql_fetch_row($result); if (! $value) { mysql_query("delete from scormvars where (varName='cmi.core.entry')",$link); mysql_query("insert into scormvars (varName,varValue) values ('cmi.core.entry','ab initio')",$link); }
You’ll see that I’ve chosen the value ‘credit’ as the initial value for cmi.core.credit. The SCORM specification says that this is a read-only element that wil be set by the LMS. For my “imaginary” LMS, I’m going to assume that any course I come across is going to be done for credit (and this is probably going to be the case in the vast majority of real applications!).
Now, when I start my test course running, this is what my ‘scormvars’ table contains:
varName | varValue |
cmi.core.credit | credit |
cmi.core.entry | ab initio |
cmi.core.lesson_location | 2 |
cmi.core.lesson_status | failed |
cmi.core.score.raw | 13 |
cmi.core.session_time | 00:04:02 |
cmi.core.total_time | 0000:00:00 |
cmi.suspend_data | C01BA000BA%7E%24KS%2A7XNDF110BBBB1B1B1G |
You’ll see that the course has already changed the value of cmi.core.lesson_status to ‘failed’ – I’ll look at the handling of cmi.core.lesson_status later – but it all looks pretty good so far. Now to examine what happens when the course sets element values … and that’s where things get a little more tricky.