[svn r10437] Added handling of the parameters attribute in imsmanifest <item> element

skala
Yannick Warnier 19 years ago
parent 4276fe19f4
commit fd509e1ed0
  1. 9
      main/newscorm/learnpath.class.php
  2. 6
      main/newscorm/scorm.class.php
  3. 14
      main/newscorm/scormItem.class.php
  4. 3
      main/newscorm/scorm_update_db.php
  5. 11
      main/newscorm/scorm_update_db_alter.php

@ -2769,7 +2769,7 @@ class learnpath {
$lp_pref = Database::get_course_table_prefix();
$lp_table = $lp_db.'.'.$lp_pref.'lp';
$lp_item_table = $lp_db.'.'.$lp_pref.'lp_item';
$sel = "SELECT l.lp_type as ltype, l.path as lpath, li.item_type as litype, li.path as lipath " .
$sel = "SELECT l.lp_type as ltype, l.path as lpath, li.item_type as litype, li.path as lipath, li.parameters as liparams " .
"FROM $lp_table l, $lp_item_table li WHERE li.id = $item_id AND li.lp_id = l.id";
if($this->debug>2){error_log('New LP - In learnpath::get_link() - selecting item '.$sel,0);}
$res = api_sql_query($sel);
@ -2781,6 +2781,11 @@ class learnpath {
$lp_path = $row['lpath'];
$lp_item_type = $row['litype'];
$lp_item_path = $row['lipath'];
$lp_item_params = $row['liparams'];
//add ? if none - left commented to give freedom to scorm implementation
//if(substr($lp_item_params,0,1)!='?'){
// $lp_item_params = '?'.$lp_item_params;
//}
if($type == 'http'){
$course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
}else{
@ -2826,6 +2831,8 @@ class learnpath {
//prerequisites did not match
//$file = 'blank.php';
//}
//We want to use parameters if they were defined in the imsmanifest
$file.= $lp_item_params;
}else{
$file = 'lp_content.php?type=dir';
}

@ -438,12 +438,14 @@ class scorm extends learnpath {
"(lp_id,item_type,ref,title," .
"path,min_score,max_score, $field_add" .
"parent_item_id,previous_item_id,next_item_id," .
"prerequisite,display_order) " .
"prerequisite,display_order,launch_data," .
"parameters) " .
"VALUES " .
"($lp_id, '$type','".$identifier."','".$title."'," .
"'$path',0,100, $value_add" .
"$parent, $previous, 0, " .
"'$prereq', ".$item['rel_order'] .
"'$prereq', ".$item['rel_order'] .", '".$item['datafromlms']."'," .
"'".$item['parameters']."'" .
")";
$res_item = api_sql_query($sql_item);
if($this->debug>1){error_log('New LP - In import_manifest(), inserting item : '.$sql_item.' : '.mysql_error(),0);}

@ -19,7 +19,7 @@ class scormItem extends learnpathItem{
//var $prerequisites = ''; - defined in learnpathItem.class.php
var $maxtimeallowed = '00:00:00';
var $timelimitaction = '';
var $datafromims = '';
var $datafromlms = '';
var $masteryscore = '';
var $scorm_contact;
@ -80,11 +80,11 @@ class scormItem extends learnpathItem{
$this->timelimitaction = $tmp_children[0]->content;
}
break;
case 'datafromims':
case 'datafromlms':
$tmp_children = $child->children();
if(count($tmp_children)==1 and $tmp_children[0]->content!='' )
{
$this->datafromims = $tmp_children[0]->content;
$this->datafromlms = $tmp_children[0]->content;
}
break;
case 'masteryscore':
@ -186,13 +186,13 @@ class scormItem extends learnpathItem{
$this->timelimitaction = $child->firstChild->nodeValue;
}
break;
case 'datafromims':
case 'adlcp:datafromims':
case 'datafromlms':
case 'adlcp:datafromlms':
$tmp_children = $child->childNodes;
//if(count($tmp_children)==1 and $tmp_children[0]->textContent!='' )
if($tmp_children->length==1 and $child->firstChild->nodeValue!='' )
{
$this->datafromims = $child->firstChild->nodeValue;
$this->datafromlms = $child->firstChild->nodeValue;
}
break;
case 'masteryscore':
@ -262,7 +262,7 @@ class scormItem extends learnpathItem{
{
$list[] = array(
'abs_order' => $abs_order,
'datafromims' => $this->datafromims,
'datafromlms' => $this->datafromlms,
'identifier' => $this->identifier,
'identifierref' => $this->identifierref,
'isvisible' => $this->isvisible,

@ -62,7 +62,8 @@ $create_lp_item = "CREATE TABLE IF NOT EXISTS XXX_$new_lp_item (" .
"next_item_id int unsigned not null default 0," . //the item after this one in the sequential learning order (MySQL id)
"display_order int unsigned not null default 0," . //this is needed for ordering items under the same parent (previous_item_id doesn't give correct order after reordering)
"prerequisite char(64) null," . //prerequisites in AICC scripting language as defined in the SCORM norm (allow logical operators)
"launch_data text not null default ''" . //data from imsmanifest <item>
"launch_data text not null default '', " . //data from imsmanifest <item adlcp:datafromlms>
"parameters text not null default ''" . //data from imsmanifest <item parameters="...">
")";
//table replacing the learnpath_user table
$new_lp_item_view = 'lp_item_view';

@ -31,6 +31,11 @@ $alter_lp_view = "ALTER TABLE XXX_$new_lp_view ADD COLUMN " .
"progress int unsigned default 0" .
"";
//table replacing the learnpath_user table
$new_lp_item = 'lp_item';
$alter_lp_item = "ALTER TABLE XXX_$new_lp_item ADD COLUMN " .
"parameters text null default ''" .
"";
//table replacing the learnpath_user table
$new_lp_item_view = 'lp_item_view';
$alter_lp_item_view = "ALTER TABLE XXX_$new_lp_item_view ADD COLUMN " .
"lesson_location text null default ''" .
@ -98,6 +103,12 @@ while ($row = Database::fetch_array($res))
echo "$create_table<br />\n";
api_sql_query($create_table);
}
if (mysql_query("SELECT parameters FROM $new_lp_item")==false)
{
$create_table = str_replace('XXX_',$dbname,$alter_lp_item);
echo "$create_table<br />\n";
api_sql_query($create_table);
}
if (mysql_query("SELECT lesson_location FROM $new_lp_item_view")==false)
{
$create_table = str_replace('XXX_',$dbname,$alter_lp_item_view);

Loading…
Cancel
Save