Step 15 – cmi.core.student_id and cmi.core.student_name

According to the SCORM specification, cmi.core.student_name and cmi.core.student_id are read-only data elements. They simply return the name of the student as stored by the LMS (in lastname, firstname format), and an ID number for the student stored by the LMS.

This is pretty easy to implement in my “imaginary” LMS since I simply modify the getValue.php code like this.



VS SCORM - getValue.php 
Rev 2.1 - Monday, July 06, 2009
Copyright (C) 2009, Addison Robson LLC

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.


//  database login information
require "config.php";

// connect to the database
$link = mysql_connect($dbhost,$dbuser,$dbpass);

// read GET variable
$varname = trim($_REQUEST['varname']);

// determine value to be returned
switch ($varname) {

  // no variable name supplied
  case "":
    $varvalue = "";

  // cmi.core._children is always the same
  case "cmi.core._children":
    $varvalue = "student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,exit,session_time";

  // cmi.core.student_name is a read-only element
  // Note: in a real application, read from the main LMS student database
  case "cmi.core.student_name":
    $varvalue = "Addison, Steve";

  // cmi.core.student_id is a read-only element
  // Note: in a real application, read from the main LMS student database
  case "cmi.core.student_id":
    $varvalue = "007";

  // all other variable names

    // make safe for database
    $safevarname = mysql_escape_string($varname);
    $varvalue = "";

    // read data from the 'scormvars' table
    $result = mysql_query("select varValue from scormvars where (varName='$safevarname')",$link);
    list($varvalue) = mysql_fetch_row($result);


// return variable value to the calling program
print $varvalue;


For the purposes of this project, this should work fine. However, in a real application, I’d obviously want to replace lines 52 and 58 with calls to the main LMS database tables where the student information is stored.

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

1 Response to Step 15 – cmi.core.student_id and cmi.core.student_name

  1. Akuma says:

    No issue with the second part.The first, hovewer, well may be prescient in a couple years, but for now SCORM is the only real game in town. The base of applications and content isn’t going to disappear all that quickly. Anyone looking to adopt TinCan/xAPI would surely be better served with an LMS/LRS combination.One advantage the more restrictive SCORM specification has over TinCan/xAPI is reporting everything is defined, so reporting can quickly be robust. Reporting on LRS data is going to be a challenge(i.e. I want to see everyone who learned something but completed’ can be reported as took’, finished’, done’, completed’, passed’, and acheived’ depending on the content they went through how can I create a report on those terms?)Overall, agreed that SCORM is good to a point, but it is limiting. I don’t think we’ll see TinCan supplant it this year though, especially in areas where SCORM is working out just fine.

Leave a Reply

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