Step 14 – cmi.core._children

When (if) the course issues the LMSGetValue(‘cmi.core._children’) call, it expects to see a value returned from the LMS. But what is that value?

The SCORM standard says that the cmi.core._children data element should store a list of the other data elements in the cmi.core.* set that are supported by the LMS. Since I’m planning to support the mandatory variables – and only the mandatory elements – that’s simply:

"student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,exit,session_time"

The specification also says that this is a read-only data element so the course can’t set it and I don’t have to worry about it changing as we run the course. So I can incorporate this in my code by modifying the getValue.php code like this.

<?php 

/*

VS SCORM - getValue.php 
Rev 2.0 - Sunday, July 05, 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
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);
mysql_select_db($dbname,$link);

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

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

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

  // 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";
    break;

  // all other variable names
  default:

    // 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;

?>

That was easy. Now onto some slightly more complicated elements.

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

2 Responses to Step 14 – cmi.core._children

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

  2. Abercombie says:

    Our company is a stlouion provider, rather than an app developer. We have found the best option is to use a good LMS with a good eCommerce suite, rather than re-inventing the wheel.One example of this is using Magento and NetDimensions’ Enterprise Knowledge Platform. This allows eCommerce for more than just eLearning.We’ve also integrated EKP with OS Commerce and another proprietary eCommerce software.

Leave a Reply

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