mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
Splitted scoes optional data in a new table
This commit is contained in:
parent
9c03bbaa04
commit
b3659259fd
19 changed files with 633 additions and 378 deletions
|
@ -30,7 +30,7 @@
|
||||||
$attempt = 1;
|
$attempt = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sco = get_record('scorm_scoes','id',$scoid)) {
|
if ($sco = scorm_get_sco($scoid, SCO_ONLY)) {
|
||||||
if (!$scorm = get_record('scorm','id',$sco->scorm)) {
|
if (!$scorm = get_record('scorm','id',$sco->scorm)) {
|
||||||
error('Invalid script call');
|
error('Invalid script call');
|
||||||
}
|
}
|
||||||
|
@ -63,12 +63,12 @@
|
||||||
$userdata->credit = 'no-credit';
|
$userdata->credit = 'no-credit';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sco = get_record('scorm_scoes','id',$scoid)) {
|
if ($sco = scorm_get_sco($scoid)) {
|
||||||
$userdata->course_id = $sco->identifier;
|
$userdata->course_id = $sco->identifier;
|
||||||
$userdata->datafromlms = $sco->datafromlms;
|
$userdata->datafromlms = isset($sco->datafromlms)?$sco->datafromlms:'';
|
||||||
$userdata->masteryscore = $sco->masteryscore;
|
$userdata->masteryscore = isset($sco->masteryscore)?$sco->masteryscore:'';
|
||||||
$userdata->maxtimeallowed = $sco->maxtimeallowed;
|
$userdata->maxtimeallowed = isset($sco->maxtimeallowed)?$sco->maxtimeallowed:'';
|
||||||
$userdata->timelimitaction = $sco->timelimitaction;
|
$userdata->timelimitaction = isset($sco->timelimitaction)?$sco->timelimitaction:'';
|
||||||
|
|
||||||
echo "error = 0\nerror_text = Successful\naicc_data=\n";
|
echo "error = 0\nerror_text = Successful\naicc_data=\n";
|
||||||
echo "[Core]\n";
|
echo "[Core]\n";
|
||||||
|
|
|
@ -57,18 +57,9 @@
|
||||||
} else {
|
} else {
|
||||||
$userdata->credit = 'no-credit';
|
$userdata->credit = 'no-credit';
|
||||||
}
|
}
|
||||||
if ($sco = get_record('scorm_scoes','id',$scoid)) {
|
if ($scodatas = scorm_get_sco($scoid, SCO_DATA)) {
|
||||||
if (!empty($sco->datafromlms)) {
|
foreach ($scodatas as $key => $value) {
|
||||||
$userdata->datafromlms = $sco->datafromlms;
|
$userdata->$key = $value;
|
||||||
}
|
|
||||||
if (!empty($sco->masteryscore)) {
|
|
||||||
$userdata->masteryscore = $sco->masteryscore;
|
|
||||||
}
|
|
||||||
if (!empty($sco->maxtimeallowed)) {
|
|
||||||
$userdata->maxtimeallowed = $sco->maxtimeallowed;
|
|
||||||
}
|
|
||||||
if (!empty($sco->timelimitaction)) {
|
|
||||||
$userdata->timelimitaction = $sco->timelimitaction;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error('Sco not found');
|
error('Sco not found');
|
||||||
|
|
|
@ -5,17 +5,17 @@
|
||||||
//This is the "graphical" structure of the scorm mod:
|
//This is the "graphical" structure of the scorm mod:
|
||||||
//
|
//
|
||||||
// scorm
|
// scorm
|
||||||
// (CL,pk->id)---------------------
|
// (CL,pk->id)-------------------------------------
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// scorm_scoes |
|
// scorm_scoes scorm_scoes_data |
|
||||||
// (UL,pk->id, fk->scorm) |
|
// (UL,pk->id, fk->scorm)-------(UL,pk->id, fk->scoid) |
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// scorm_scoes_track |
|
// scorm_scoes_track |
|
||||||
// (UL,k->id, fk->scormid, fk->scoid, k->element)---
|
// (UL,k->id, fk->scormid, fk->scoid, k->element)-------------------
|
||||||
//
|
//
|
||||||
// Meaning: pk->primary key field of the table
|
// Meaning: pk->primary key field of the table
|
||||||
// fk->foreign key to link with parent
|
// fk->foreign key to link with parent
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
$status = true;
|
$status = true;
|
||||||
|
|
||||||
//Iterate over scorm table
|
//Iterate over scorm table
|
||||||
$scorms = get_records ("scorm","course",$preferences->backup_course,"id");
|
$scorms = get_records ('scorm','course',$preferences->backup_course,'id');
|
||||||
if ($scorms) {
|
if ($scorms) {
|
||||||
foreach ($scorms as $scorm) {
|
foreach ($scorms as $scorm) {
|
||||||
if (backup_mod_selected($preferences,'scorm',$scorm->id)) {
|
if (backup_mod_selected($preferences,'scorm',$scorm->id)) {
|
||||||
|
@ -52,27 +52,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//Start mod
|
//Start mod
|
||||||
fwrite ($bf,start_tag("MOD",3,true));
|
fwrite ($bf,start_tag('MOD',3,true));
|
||||||
//Print scorm data
|
//Print scorm data
|
||||||
fwrite ($bf,full_tag("ID",4,false,$scorm->id));
|
fwrite ($bf,full_tag('ID',4,false,$scorm->id));
|
||||||
fwrite ($bf,full_tag("MODTYPE",4,false,"scorm"));
|
fwrite ($bf,full_tag('MODTYPE',4,false,'scorm'));
|
||||||
fwrite ($bf,full_tag("NAME",4,false,$scorm->name));
|
fwrite ($bf,full_tag('NAME',4,false,$scorm->name));
|
||||||
fwrite ($bf,full_tag("REFERENCE",4,false,$scorm->reference));
|
fwrite ($bf,full_tag('REFERENCE',4,false,$scorm->reference));
|
||||||
fwrite ($bf,full_tag("VERSION",4,false,$scorm->version));
|
fwrite ($bf,full_tag('VERSION',4,false,$scorm->version));
|
||||||
fwrite ($bf,full_tag("MAXGRADE",4,false,$scorm->maxgrade));
|
fwrite ($bf,full_tag('MAXGRADE',4,false,$scorm->maxgrade));
|
||||||
fwrite ($bf,full_tag("GRADEMETHOD",4,false,$scorm->grademethod));
|
fwrite ($bf,full_tag('GRADEMETHOD',4,false,$scorm->grademethod));
|
||||||
fwrite ($bf,full_tag("LAUNCH",4,false,$scorm->launch));
|
fwrite ($bf,full_tag('LAUNCH',4,false,$scorm->launch));
|
||||||
fwrite ($bf,full_tag("SKIPVIEW",4,false,$scorm->skipview));
|
fwrite ($bf,full_tag('SKIPVIEW',4,false,$scorm->skipview));
|
||||||
fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary));
|
fwrite ($bf,full_tag('SUMMARY',4,false,$scorm->summary));
|
||||||
fwrite ($bf,full_tag("HIDEBROWSE",4,false,$scorm->hidebrowse));
|
fwrite ($bf,full_tag('HIDEBROWSE',4,false,$scorm->hidebrowse));
|
||||||
fwrite ($bf,full_tag("HIDETOC",4,false,$scorm->hidetoc));
|
fwrite ($bf,full_tag('HIDETOC',4,false,$scorm->hidetoc));
|
||||||
fwrite ($bf,full_tag("HIDENAV",4,false,$scorm->hidenav));
|
fwrite ($bf,full_tag('HIDENAV',4,false,$scorm->hidenav));
|
||||||
fwrite ($bf,full_tag("AUTO",4,false,$scorm->auto));
|
fwrite ($bf,full_tag('AUTO',4,false,$scorm->auto));
|
||||||
fwrite ($bf,full_tag("POPUP",4,false,$scorm->popup));
|
fwrite ($bf,full_tag('POPUP',4,false,$scorm->popup));
|
||||||
fwrite ($bf,full_tag("OPTIONS",4,false,$scorm->options));
|
fwrite ($bf,full_tag('OPTIONS',4,false,$scorm->options));
|
||||||
fwrite ($bf,full_tag("WIDTH",4,false,$scorm->width));
|
fwrite ($bf,full_tag('WIDTH',4,false,$scorm->width));
|
||||||
fwrite ($bf,full_tag("HEIGHT",4,false,$scorm->height));
|
fwrite ($bf,full_tag('HEIGHT',4,false,$scorm->height));
|
||||||
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$scorm->timemodified));
|
fwrite ($bf,full_tag('TIMEMODIFIED',4,false,$scorm->timemodified));
|
||||||
$status = backup_scorm_scoes($bf,$preferences,$scorm->id);
|
$status = backup_scorm_scoes($bf,$preferences,$scorm->id);
|
||||||
|
|
||||||
//if we've selected to backup users info, then execute backup_scorm_scoes_track
|
//if we've selected to backup users info, then execute backup_scorm_scoes_track
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
//End mod
|
//End mod
|
||||||
$status =fwrite ($bf,end_tag("MOD",3,true));
|
$status =fwrite ($bf,end_tag('MOD',3,true));
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,37 +95,59 @@
|
||||||
|
|
||||||
$status = true;
|
$status = true;
|
||||||
|
|
||||||
$scorm_scoes = get_records("scorm_scoes","scorm",$scorm,"id");
|
$scorm_scoes = get_records('scorm_scoes','scorm',$scorm,'id');
|
||||||
//If there is scoes
|
//If there is scoes
|
||||||
if ($scorm_scoes) {
|
if ($scorm_scoes) {
|
||||||
//Write start tag
|
//Write start tag
|
||||||
$status =fwrite ($bf,start_tag("SCOES",4,true));
|
$status =fwrite ($bf,start_tag('SCOES',4,true));
|
||||||
//Iterate over each sco
|
//Iterate over each sco
|
||||||
foreach ($scorm_scoes as $sco) {
|
foreach ($scorm_scoes as $sco) {
|
||||||
//Start sco
|
//Start sco
|
||||||
$status =fwrite ($bf,start_tag("SCO",5,true));
|
$status =fwrite ($bf,start_tag('SCO',5,true));
|
||||||
//Print submission contents
|
//Print submission contents
|
||||||
fwrite ($bf,full_tag("ID",6,false,$sco->id));
|
fwrite ($bf,full_tag('ID',6,false,$sco->id));
|
||||||
fwrite ($bf,full_tag("MANIFEST",6,false,$sco->manifest));
|
fwrite ($bf,full_tag('MANIFEST',6,false,$sco->manifest));
|
||||||
fwrite ($bf,full_tag("ORGANIZATION",6,false,$sco->organization));
|
fwrite ($bf,full_tag('ORGANIZATION',6,false,$sco->organization));
|
||||||
fwrite ($bf,full_tag("PARENT",6,false,$sco->parent));
|
fwrite ($bf,full_tag('PARENT',6,false,$sco->parent));
|
||||||
fwrite ($bf,full_tag("IDENTIFIER",6,false,$sco->identifier));
|
fwrite ($bf,full_tag('IDENTIFIER',6,false,$sco->identifier));
|
||||||
fwrite ($bf,full_tag("LAUNCH",6,false,$sco->launch));
|
fwrite ($bf,full_tag('LAUNCH',6,false,$sco->launch));
|
||||||
fwrite ($bf,full_tag("PARAMETERS",6,false,$sco->parameters));
|
fwrite ($bf,full_tag('SCORMTYPE',6,false,$sco->scormtype));
|
||||||
fwrite ($bf,full_tag("SCORMTYPE",6,false,$sco->scormtype));
|
fwrite ($bf,full_tag('TITLE',6,false,$sco->title));
|
||||||
fwrite ($bf,full_tag("TITLE",6,false,$sco->title));
|
$status = backup_scorm_scoes_data($bf,$preferences,$sco->id);
|
||||||
fwrite ($bf,full_tag("PREREQUISITES",6,false,$sco->prerequisites));
|
|
||||||
fwrite ($bf,full_tag("MAXTIMEALLOWED",6,false,$sco->maxtimeallowed));
|
|
||||||
fwrite ($bf,full_tag("TIMELIMITACTION",6,false,$sco->timelimitaction));
|
|
||||||
fwrite ($bf,full_tag("DATAFROMLMS",6,false,$sco->datafromlms));
|
|
||||||
fwrite ($bf,full_tag("MASTERYSCORE",6,false,$sco->masteryscore));
|
|
||||||
fwrite ($bf,full_tag("NEXT",6,false,$sco->next));
|
|
||||||
fwrite ($bf,full_tag("PREVIOUS",6,false,$sco->previous));
|
|
||||||
//End sco
|
//End sco
|
||||||
$status =fwrite ($bf,end_tag("SCO",5,true));
|
$status =fwrite ($bf,end_tag('SCO',5,true));
|
||||||
}
|
}
|
||||||
//Write end tag
|
//Write end tag
|
||||||
$status =fwrite ($bf,end_tag("SCOES",4,true));
|
$status =fwrite ($bf,end_tag('SCOES',4,true));
|
||||||
|
}
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Backup scorm_scoes_data contents (executed from scorm_backup_scorm_scoes)
|
||||||
|
function backup_scorm_scoes_data ($bf,$preferences,$sco) {
|
||||||
|
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
|
$status = true;
|
||||||
|
|
||||||
|
$scorm_sco_datas = get_records('scorm_scoes_data','scoid',$sco,'id');
|
||||||
|
//If there is data
|
||||||
|
if ($scorm_sco_datas) {
|
||||||
|
//Write start tag
|
||||||
|
$status =fwrite ($bf,start_tag('SCO_DATAS',4,true));
|
||||||
|
//Iterate over each sco
|
||||||
|
foreach ($scorm_sco_datas as $sco_data) {
|
||||||
|
//Start sco track
|
||||||
|
$status =fwrite ($bf,start_tag('SCO_DATA',5,true));
|
||||||
|
//Print track contents
|
||||||
|
fwrite ($bf,full_tag('ID',6,false,$sco_data->id));
|
||||||
|
fwrite ($bf,full_tag('NAME',6,false,$sco_data->name));
|
||||||
|
fwrite ($bf,full_tag('VALUE',6,false,$sco_data->value));
|
||||||
|
//End sco track
|
||||||
|
$status =fwrite ($bf,end_tag('SCO_DATA',5,true));
|
||||||
|
}
|
||||||
|
//Write end tag
|
||||||
|
$status =fwrite ($bf,end_tag('SCO_DATAS',4,true));
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
@ -137,26 +159,26 @@
|
||||||
|
|
||||||
$status = true;
|
$status = true;
|
||||||
|
|
||||||
$scorm_scoes_track = get_records("scorm_scoes_track","scormid",$scorm,"id");
|
$scorm_scoes_track = get_records('scorm_scoes_track','scormid',$scorm,'id');
|
||||||
//If there is track
|
//If there is track
|
||||||
if ($scorm_scoes_track) {
|
if ($scorm_scoes_track) {
|
||||||
//Write start tag
|
//Write start tag
|
||||||
$status =fwrite ($bf,start_tag("SCO_TRACKS",4,true));
|
$status =fwrite ($bf,start_tag('SCO_TRACKS',4,true));
|
||||||
//Iterate over each sco
|
//Iterate over each sco
|
||||||
foreach ($scorm_scoes_track as $sco_track) {
|
foreach ($scorm_scoes_track as $sco_track) {
|
||||||
//Start sco track
|
//Start sco track
|
||||||
$status =fwrite ($bf,start_tag("SCO_TRACK",5,true));
|
$status =fwrite ($bf,start_tag('SCO_TRACK',5,true));
|
||||||
//Print track contents
|
//Print track contents
|
||||||
fwrite ($bf,full_tag("ID",6,false,$sco_track->id));
|
fwrite ($bf,full_tag('ID',6,false,$sco_track->id));
|
||||||
fwrite ($bf,full_tag("USERID",6,false,$sco_track->userid));
|
fwrite ($bf,full_tag('USERID',6,false,$sco_track->userid));
|
||||||
fwrite ($bf,full_tag("SCOID",6,false,$sco_track->scoid));
|
fwrite ($bf,full_tag('SCOID',6,false,$sco_track->scoid));
|
||||||
fwrite ($bf,full_tag("ELEMENT",6,false,$sco_track->element));
|
fwrite ($bf,full_tag('ELEMENT',6,false,$sco_track->element));
|
||||||
fwrite ($bf,full_tag("VALUE",6,false,$sco_track->value));
|
fwrite ($bf,full_tag('VALUE',6,false,$sco_track->value));
|
||||||
//End sco track
|
//End sco track
|
||||||
$status =fwrite ($bf,end_tag("SCO_TRACK",5,true));
|
$status =fwrite ($bf,end_tag('SCO_TRACK',5,true));
|
||||||
}
|
}
|
||||||
//Write end tag
|
//Write end tag
|
||||||
$status =fwrite ($bf,end_tag("SCO_TRACKS",4,true));
|
$status =fwrite ($bf,end_tag('SCO_TRACKS',4,true));
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +193,7 @@
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
//First the course data
|
//First the course data
|
||||||
$info[0][0] = get_string("modulenameplural","scorm");
|
$info[0][0] = get_string('modulenameplural','scorm');
|
||||||
if ($ids = scorm_ids ($course)) {
|
if ($ids = scorm_ids ($course)) {
|
||||||
$info[0][1] = count($ids);
|
$info[0][1] = count($ids);
|
||||||
} else {
|
} else {
|
||||||
|
@ -180,7 +202,7 @@
|
||||||
|
|
||||||
//Now, if requested, the user_data
|
//Now, if requested, the user_data
|
||||||
if ($user_data) {
|
if ($user_data) {
|
||||||
$info[1][0] = get_string("scoes","scorm");
|
$info[1][0] = get_string('scoes','scorm');
|
||||||
if ($ids = scorm_scoes_track_ids_by_course ($course)) {
|
if ($ids = scorm_scoes_track_ids_by_course ($course)) {
|
||||||
$info[1][1] = count($ids);
|
$info[1][1] = count($ids);
|
||||||
} else {
|
} else {
|
||||||
|
@ -194,7 +216,7 @@
|
||||||
$info[$instance->id.'0'][0] = $instance->name;
|
$info[$instance->id.'0'][0] = $instance->name;
|
||||||
$info[$instance->id.'0'][1] = '';
|
$info[$instance->id.'0'][1] = '';
|
||||||
if (!empty($instance->userdata)) {
|
if (!empty($instance->userdata)) {
|
||||||
$info[$instance->id.'1'][0] = get_string("scoes","scorm");
|
$info[$instance->id.'1'][0] = get_string('scoes','scorm');
|
||||||
if ($ids = scorm_scoes_track_ids_by_instance ($instance->id)) {
|
if ($ids = scorm_scoes_track_ids_by_instance ($instance->id)) {
|
||||||
$info[$instance->id.'1'][1] = count($ids);
|
$info[$instance->id.'1'][1] = count($ids);
|
||||||
} else {
|
} else {
|
||||||
|
@ -214,12 +236,12 @@
|
||||||
//First we check to moddata exists and create it as necessary
|
//First we check to moddata exists and create it as necessary
|
||||||
//in temp/backup/$backup_code dir
|
//in temp/backup/$backup_code dir
|
||||||
$status = check_and_create_moddata_dir($preferences->backup_unique_code);
|
$status = check_and_create_moddata_dir($preferences->backup_unique_code);
|
||||||
$status = check_dir_exists($CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/scorm/",true);
|
$status = check_dir_exists($CFG->dataroot.'/temp/backup/'.$preferences->backup_unique_code.'/moddata/scorm/',true);
|
||||||
if ($status) {
|
if ($status) {
|
||||||
//Only if it exists !! Thanks to Daniel Miksik.
|
//Only if it exists !! Thanks to Daniel Miksik.
|
||||||
if (is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm/".$instanceid)) {
|
if (is_dir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$instanceid)) {
|
||||||
$status = backup_copy_file($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm/".$instanceid,
|
$status = backup_copy_file($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$instanceid,
|
||||||
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/scorm/".$instanceid);
|
$CFG->dataroot.'/temp/backup/'.$preferences->backup_unique_code.'/moddata/scorm/'.$instanceid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,14 +261,14 @@
|
||||||
$status = check_and_create_moddata_dir($preferences->backup_unique_code);
|
$status = check_and_create_moddata_dir($preferences->backup_unique_code);
|
||||||
//Now copy the scorm dir
|
//Now copy the scorm dir
|
||||||
if ($status) {
|
if ($status) {
|
||||||
if (is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm")) {
|
if (is_dir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm')) {
|
||||||
$handle = opendir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm");
|
$handle = opendir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm');
|
||||||
while (false!==($item = readdir($handle))) {
|
while (false!==($item = readdir($handle))) {
|
||||||
if ($item != '.' && $item != '..' && is_dir($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/sorm/".$item)
|
if ($item != '.' && $item != '..' && is_dir($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$item)
|
||||||
&& array_key_exists($item,$preferences->mods['scorm']->instances)
|
&& array_key_exists($item,$preferences->mods['scorm']->instances)
|
||||||
&& !empty($preferences->mods['scorm']->instances[$item]->backup)) {
|
&& !empty($preferences->mods['scorm']->instances[$item]->backup)) {
|
||||||
$status = backup_copy_file($CFG->dataroot."/".$preferences->backup_course."/".$CFG->moddata."/scorm/".$item,
|
$status = backup_copy_file($CFG->dataroot.'/'.$preferences->backup_course.'/'.$CFG->moddata.'/scorm/'.$item,
|
||||||
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/moddata/scorm/",$item);
|
$CFG->dataroot.'/temp/backup/'.$preferences->backup_unique_code.'/moddata/scorm/',$item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,25 +11,6 @@
|
||||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
|
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
|
||||||
|
|
||||||
<table cellpadding="9" cellspacing="0" >
|
<table cellpadding="9" cellspacing="0" >
|
||||||
<!--<tr valign="top">
|
|
||||||
<td align="right">scorm_validate:</td>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
unset($choices);
|
|
||||||
$choices[""] = get_string("none");
|
|
||||||
if (extension_loaded('domxml')) {
|
|
||||||
$choices["domxml"] = get_string("domxml","scorm");
|
|
||||||
}
|
|
||||||
if (version_compare(phpversion(),"5.0.0",">=")) {
|
|
||||||
$choices["php5"] = get_string("php5","scorm");
|
|
||||||
}
|
|
||||||
choose_from_menu ($choices, "scorm_validate", $CFG->scorm_validate, "");
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php print_string("validationtype", "scorm") ?>
|
|
||||||
</td>
|
|
||||||
</tr> -->
|
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<td align="right">scorm_framewidth:</td>
|
<td align="right">scorm_framewidth:</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -68,7 +68,7 @@ function SCORMapi1_2() {
|
||||||
'cmi.core.exit':{'defaultvalue':'<?php echo isset($userdata->{'cmi.core.exit'})?$userdata->{'cmi.core.exit'}:'' ?>', 'format':CMIExit, 'mod':'w', 'readerror':'404', 'writeerror':'405'},
|
'cmi.core.exit':{'defaultvalue':'<?php echo isset($userdata->{'cmi.core.exit'})?$userdata->{'cmi.core.exit'}:'' ?>', 'format':CMIExit, 'mod':'w', 'readerror':'404', 'writeerror':'405'},
|
||||||
'cmi.core.session_time':{'format':CMITimespan, 'mod':'w', 'defaultvalue':'00:00:00', 'readerror':'404', 'writeerror':'405'},
|
'cmi.core.session_time':{'format':CMITimespan, 'mod':'w', 'defaultvalue':'00:00:00', 'readerror':'404', 'writeerror':'405'},
|
||||||
'cmi.suspend_data':{'defaultvalue':'<?php echo isset($userdata->{'cmi.suspend_data'})?$userdata->{'cmi.suspend_data'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
'cmi.suspend_data':{'defaultvalue':'<?php echo isset($userdata->{'cmi.suspend_data'})?$userdata->{'cmi.suspend_data'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
||||||
'cmi.launch_data':{'defaultvalue':'<?php echo $userdata->datafromlms ?>', 'mod':'r', 'writeerror':'403'},
|
'cmi.launch_data':{'defaultvalue':'<?php echo isset($userdata->datafromlms)?$userdata->datafromlms:'' ?>', 'mod':'r', 'writeerror':'403'},
|
||||||
'cmi.comments':{'defaultvalue':'<?php echo isset($userdata->{'cmi.comments'})?$userdata->{'cmi.comments'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
'cmi.comments':{'defaultvalue':'<?php echo isset($userdata->{'cmi.comments'})?$userdata->{'cmi.comments'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
||||||
'cmi.comments_from_lms':{'mod':'r', 'writeerror':'403'},
|
'cmi.comments_from_lms':{'mod':'r', 'writeerror':'403'},
|
||||||
'cmi.objectives._children':{'defaultvalue':objectives_children, 'mod':'r', 'writeerror':'402'},
|
'cmi.objectives._children':{'defaultvalue':objectives_children, 'mod':'r', 'writeerror':'402'},
|
||||||
|
@ -80,9 +80,9 @@ function SCORMapi1_2() {
|
||||||
'cmi.objectives.n.score.max':{'defaultvalue':'', 'pattern':CMIIndex, 'format':CMIDecimal, 'range':score_range, 'mod':'rw', 'writeerror':'405'},
|
'cmi.objectives.n.score.max':{'defaultvalue':'', 'pattern':CMIIndex, 'format':CMIDecimal, 'range':score_range, 'mod':'rw', 'writeerror':'405'},
|
||||||
'cmi.objectives.n.status':{'pattern':CMIIndex, 'format':CMIStatus2, 'mod':'rw', 'writeerror':'405'},
|
'cmi.objectives.n.status':{'pattern':CMIIndex, 'format':CMIStatus2, 'mod':'rw', 'writeerror':'405'},
|
||||||
'cmi.student_data._children':{'defaultvalue':student_data_children, 'mod':'r', 'writeerror':'402'},
|
'cmi.student_data._children':{'defaultvalue':student_data_children, 'mod':'r', 'writeerror':'402'},
|
||||||
'cmi.student_data.mastery_score':{'defaultvalue':'<?php echo $userdata->masteryscore ?>', 'mod':'r', 'writeerror':'403'},
|
'cmi.student_data.mastery_score':{'defaultvalue':'<?php echo isset($userdata->masteryscore)?$userdata->masteryscore:'' ?>', 'mod':'r', 'writeerror':'403'},
|
||||||
'cmi.student_data.max_time_allowed':{'defaultvalue':'<?php echo $userdata->maxtimeallowed ?>', 'mod':'r', 'writeerror':'403'},
|
'cmi.student_data.max_time_allowed':{'defaultvalue':'<?php echo isset($userdata->maxtimeallowed)?$userdata->maxtimeallowed:'' ?>', 'mod':'r', 'writeerror':'403'},
|
||||||
'cmi.student_data.time_limit_action':{'defaultvalue':'<?php echo $userdata->timelimitaction ?>', 'mod':'r', 'writeerror':'403'},
|
'cmi.student_data.time_limit_action':{'defaultvalue':'<?php echo isset($userdata->timelimitaction)?$userdata->timelimitaction:'' ?>', 'mod':'r', 'writeerror':'403'},
|
||||||
'cmi.student_preference._children':{'defaultvalue':student_preference_children, 'mod':'r', 'writeerror':'402'},
|
'cmi.student_preference._children':{'defaultvalue':student_preference_children, 'mod':'r', 'writeerror':'402'},
|
||||||
'cmi.student_preference.audio':{'defaultvalue':'0', 'format':CMISInteger, 'range':audio_range, 'mod':'rw', 'writeerror':'405'},
|
'cmi.student_preference.audio':{'defaultvalue':'0', 'format':CMISInteger, 'range':audio_range, 'mod':'rw', 'writeerror':'405'},
|
||||||
'cmi.student_preference.language':{'defaultvalue':'', 'format':CMIString256, 'mod':'rw', 'writeerror':'405'},
|
'cmi.student_preference.language':{'defaultvalue':'', 'format':CMIString256, 'mod':'rw', 'writeerror':'405'},
|
||||||
|
@ -167,7 +167,7 @@ function SCORMapi1_2() {
|
||||||
if (param == "") {
|
if (param == "") {
|
||||||
if (!Initialized) {
|
if (!Initialized) {
|
||||||
<?php
|
<?php
|
||||||
if (($CFG->debug > 7) && (isadmin())) {
|
if (debugging('',DEBUG_DEVELOPER)) {
|
||||||
echo 'alert("Initialized SCORM 1.2");';
|
echo 'alert("Initialized SCORM 1.2");';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -188,7 +188,7 @@ function SCORMapi1_2() {
|
||||||
if (param == "") {
|
if (param == "") {
|
||||||
if (Initialized) {
|
if (Initialized) {
|
||||||
<?php
|
<?php
|
||||||
if (($CFG->debug > 7) && (isadmin())) {
|
if (debugging('',DEBUG_DEVELOPER)) {
|
||||||
echo 'alert("Finished SCORM 1.2");';
|
echo 'alert("Finished SCORM 1.2");';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -233,7 +233,7 @@ function SCORMapi1_2() {
|
||||||
if (subelement == element) {
|
if (subelement == element) {
|
||||||
errorCode = "0";
|
errorCode = "0";
|
||||||
<?php
|
<?php
|
||||||
if (($CFG->debug > 7) && (isadmin())) {
|
if (debugging('',DEBUG_DEVELOPER)) {
|
||||||
echo 'alert(element+": "+eval(element));';
|
echo 'alert(element+": "+eval(element));';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -337,7 +337,7 @@ function SCORMapi1_2() {
|
||||||
eval(element+'="'+value+'";');
|
eval(element+'="'+value+'";');
|
||||||
errorCode = "0";
|
errorCode = "0";
|
||||||
<?php
|
<?php
|
||||||
if (($CFG->debug > 7) && (isadmin())) {
|
if (debugging('',DEBUG_DEVELOPER)) {
|
||||||
echo 'alert(element+":= "+value);';
|
echo 'alert(element+":= "+value);';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -353,7 +353,7 @@ function SCORMapi1_2() {
|
||||||
}
|
}
|
||||||
errorCode = "0";
|
errorCode = "0";
|
||||||
<?php
|
<?php
|
||||||
if (($CFG->debug > 7) && (isadmin())) {
|
if (debugging('',DEBUG_DEVELOPER)) {
|
||||||
echo 'alert(element+":= "+value);';
|
echo 'alert(element+":= "+value);';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -384,7 +384,7 @@ function SCORMapi1_2() {
|
||||||
if (Initialized) {
|
if (Initialized) {
|
||||||
result = StoreData(cmi,false);
|
result = StoreData(cmi,false);
|
||||||
<?php
|
<?php
|
||||||
if (($CFG->debug > 7) && (isadmin())) {
|
if (debugging('',DEBUG_DEVELOPER)) {
|
||||||
echo 'alert("Data Commited");';
|
echo 'alert("Data Commited");';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -539,7 +539,7 @@ function SCORMapi1_2() {
|
||||||
datastring = CollectData(data,'cmi');
|
datastring = CollectData(data,'cmi');
|
||||||
}
|
}
|
||||||
datastring += '&attempt=<?php echo $attempt ?>';
|
datastring += '&attempt=<?php echo $attempt ?>';
|
||||||
datastring += '&scoid=<?php echo $sco->id ?>';
|
datastring += '&scoid=<?php echo $scoid ?>';
|
||||||
|
|
||||||
var myRequest = NewHttpReq();
|
var myRequest = NewHttpReq();
|
||||||
result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/datamodel.php","id=<?php p($id) ?>&sesskey=<?php p($USER->sesskey) ?>"+datastring);
|
result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/datamodel.php","id=<?php p($id) ?>&sesskey=<?php p($USER->sesskey) ?>"+datastring);
|
||||||
|
|
|
@ -81,7 +81,7 @@ function scorm_eval_prerequisites($prerequisites,$usertracks) {
|
||||||
$setelements = explode(',', substr($prerequisites, $open+1, $close-($open+1)-1));
|
$setelements = explode(',', substr($prerequisites, $open+1, $close-($open+1)-1));
|
||||||
$settrue = 0;
|
$settrue = 0;
|
||||||
foreach ($setelements as $setelement) {
|
foreach ($setelements as $setelement) {
|
||||||
if (eval_prerequisites($setelement,$usertracks)) {
|
if (scorm_eval_prerequisites($setelement,$usertracks)) {
|
||||||
$settrue++;
|
$settrue++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,6 +212,12 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
$parents[$level]='/';
|
$parents[$level]='/';
|
||||||
|
|
||||||
foreach ($scoes as $sco) {
|
foreach ($scoes as $sco) {
|
||||||
|
$isvisible = false;
|
||||||
|
if ($optionaldatas = scorm_get_sco($sco->id, SCO_DATA)) {
|
||||||
|
if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {
|
||||||
|
$isvisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($parents[$level]!=$sco->parent) {
|
if ($parents[$level]!=$sco->parent) {
|
||||||
if ($newlevel = array_search($sco->parent,$parents)) {
|
if ($newlevel = array_search($sco->parent,$parents)) {
|
||||||
for ($i=0; $i<($level-$newlevel); $i++) {
|
for ($i=0; $i<($level-$newlevel); $i++) {
|
||||||
|
@ -239,22 +245,31 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
$parents[$level]=$sco->parent;
|
$parents[$level]=$sco->parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($isvisible) {
|
||||||
$result->toc .= "\t\t<li>";
|
$result->toc .= "\t\t<li>";
|
||||||
|
}
|
||||||
$nextsco = next($scoes);
|
$nextsco = next($scoes);
|
||||||
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
|
$nextisvisible = false;
|
||||||
|
if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) {
|
||||||
|
if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {
|
||||||
|
$nextisvisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
|
||||||
$sublist++;
|
$sublist++;
|
||||||
$icon = 'minus';
|
$icon = 'minus';
|
||||||
if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
|
if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
|
||||||
$icon = 'plus';
|
$icon = 'plus';
|
||||||
}
|
}
|
||||||
$result->toc .= '<a href="javascript:expandCollide(img'.$sublist.','.$sublist.','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
|
$result->toc .= '<a href="javascript:expandCollide(img'.$sublist.','.$sublist.','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
|
||||||
} else {
|
} else if ($isvisible) {
|
||||||
$result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" />';
|
$result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" />';
|
||||||
}
|
}
|
||||||
if (empty($sco->title)) {
|
if (empty($sco->title)) {
|
||||||
$sco->title = $sco->identifier;
|
$sco->title = $sco->identifier;
|
||||||
}
|
}
|
||||||
if (!empty($sco->launch)) {
|
if (!empty($sco->launch)) {
|
||||||
|
if ($isvisible) {
|
||||||
$startbold = '';
|
$startbold = '';
|
||||||
$endbold = '';
|
$endbold = '';
|
||||||
$score = '';
|
$score = '';
|
||||||
|
@ -291,15 +306,16 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
$statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
|
$statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
|
||||||
$incomplete = true;
|
$incomplete = true;
|
||||||
} else {
|
} else {
|
||||||
$statusicon .= '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
|
$statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($sco->id == $scoid) {
|
if ($sco->id == $scoid) {
|
||||||
|
$scodata = scorm_get_sco($sco->id, SCO_DATA);
|
||||||
$startbold = '<b>';
|
$startbold = '<b>';
|
||||||
$endbold = '</b>';
|
$endbold = '</b>';
|
||||||
$findnext = true;
|
$findnext = true;
|
||||||
$shownext = $sco->next;
|
$shownext = isset($scodata->next) ? $scodata->next : 0;
|
||||||
$showprev = $sco->previous;
|
$showprev = isset($scodata->previous) ? $scodata->previous : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
|
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
|
||||||
|
@ -318,7 +334,8 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
if ($sco->id == $scoid) {
|
if ($sco->id == $scoid) {
|
||||||
$result->prerequisites = false;
|
$result->prerequisites = false;
|
||||||
}
|
}
|
||||||
$result->toc .= ' '.$sco->title."</li>\n";
|
$result->toc .= $statusicon.' '.$sco->title."</li>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result->toc .= ' '.$sco->title."</li>\n";
|
$result->toc .= ' '.$sco->title."</li>\n";
|
||||||
|
@ -334,7 +351,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($play) {
|
if ($play) {
|
||||||
$sco = get_record('scorm_scoes','id',$scoid);
|
$sco = scorm_get_sco($scoid);
|
||||||
$sco->previd = $previd;
|
$sco->previd = $previd;
|
||||||
$sco->nextid = $nextid;
|
$sco->nextid = $nextid;
|
||||||
$result->sco = $sco;
|
$result->sco = $sco;
|
||||||
|
|
|
@ -1,24 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/* // Added by Pham Minh Duc
|
/* // Added by Pham Minh Duc
|
||||||
case 'ADLNAV:PRESENTATION':
|
|
||||||
$parent = array_pop($parents);
|
|
||||||
array_push($parents, $parent);
|
|
||||||
foreach ($block['children'] as $adlnav) {
|
|
||||||
if ($adlnav['name'] == 'ADLNAV:NAVIGATIONINTERFACE') {
|
|
||||||
foreach ($adlnav['children'] as $adlnavInterface) {
|
|
||||||
if ($adlnavInterface['name'] == 'ADLNAV:HIDELMSUI') {
|
|
||||||
if ($adlnavInterface['tagData'] == 'continue') {
|
|
||||||
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->next = 1;
|
|
||||||
}
|
|
||||||
if ($adlnavInterface['tagData'] == 'previous') {
|
|
||||||
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->previous = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'IMSSS:SEQUENCING':
|
case 'IMSSS:SEQUENCING':
|
||||||
$parent = array_pop($parents);
|
$parent = array_pop($parents);
|
||||||
array_push($parents, $parent);
|
array_push($parents, $parent);
|
||||||
|
@ -373,7 +354,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
//
|
//
|
||||||
|
|
||||||
// Added by Pham Minh Duc
|
// Added by Pham Minh Duc
|
||||||
$suspendedscoid = scorm_get_suspendedscoid($scorm->id,$user->id,$attempt);
|
// $suspendedscoid = scorm_get_suspendedscoid($scorm->id,$user->id,$attempt);
|
||||||
// End add
|
// End add
|
||||||
|
|
||||||
$usertracks = array();
|
$usertracks = array();
|
||||||
|
@ -394,8 +375,13 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
$nextid = 0;
|
$nextid = 0;
|
||||||
$findnext = false;
|
$findnext = false;
|
||||||
$parents[$level]='/';
|
$parents[$level]='/';
|
||||||
|
|
||||||
foreach ($scoes as $sco) {
|
foreach ($scoes as $sco) {
|
||||||
|
$isvisible = false;
|
||||||
|
if ($optionaldatas = scorm_get_sco($sco->id, SCO_DATA)) {
|
||||||
|
if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {
|
||||||
|
$isvisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($parents[$level]!=$sco->parent) {
|
if ($parents[$level]!=$sco->parent) {
|
||||||
if ($newlevel = array_search($sco->parent,$parents)) {
|
if ($newlevel = array_search($sco->parent,$parents)) {
|
||||||
for ($i=0; $i<($level-$newlevel); $i++) {
|
for ($i=0; $i<($level-$newlevel); $i++) {
|
||||||
|
@ -423,22 +409,31 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
$parents[$level]=$sco->parent;
|
$parents[$level]=$sco->parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($isvisible) {
|
||||||
$result->toc .= "\t\t<li>";
|
$result->toc .= "\t\t<li>";
|
||||||
|
}
|
||||||
$nextsco = next($scoes);
|
$nextsco = next($scoes);
|
||||||
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
|
$nextisvisible = false;
|
||||||
|
if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) {
|
||||||
|
if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {
|
||||||
|
$nextisvisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
|
||||||
$sublist++;
|
$sublist++;
|
||||||
$icon = 'minus';
|
$icon = 'minus';
|
||||||
if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
|
if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
|
||||||
$icon = 'plus';
|
$icon = 'plus';
|
||||||
}
|
}
|
||||||
$result->toc .= '<a href="javascript:expandCollide(img'.$sublist.','.$sublist.','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
|
$result->toc .= '<a href="javascript:expandCollide(img'.$sublist.','.$sublist.','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
|
||||||
} else {
|
} else if ($isvisible) {
|
||||||
$result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" />';
|
$result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" />';
|
||||||
}
|
}
|
||||||
if (empty($sco->title)) {
|
if (empty($sco->title)) {
|
||||||
$sco->title = $sco->identifier;
|
$sco->title = $sco->identifier;
|
||||||
}
|
}
|
||||||
if (!empty($sco->launch)) {
|
if (!empty($sco->launch)) {
|
||||||
|
if ($isvisible) {
|
||||||
$startbold = '';
|
$startbold = '';
|
||||||
$endbold = '';
|
$endbold = '';
|
||||||
$score = '';
|
$score = '';
|
||||||
|
@ -510,10 +505,11 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
if ($sco->id == $scoid) {
|
if ($sco->id == $scoid) {
|
||||||
$result->prerequisites = false;
|
$result->prerequisites = false;
|
||||||
}
|
}
|
||||||
$result->toc .= ' '.$sco->title."</li>\n";
|
$result->toc .= ' '.format_string($sco->title)."</li>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result->toc .= ' '.$sco->title."</li>\n";
|
$result->toc .= ' '.format_string($sco->title)."</li>\n";
|
||||||
}
|
}
|
||||||
if (($nextsco !== false) && ($nextid == 0) && ($findnext)) {
|
if (($nextsco !== false) && ($nextid == 0) && ($findnext)) {
|
||||||
if (!empty($nextsco->launch)) {
|
if (!empty($nextsco->launch)) {
|
||||||
|
|
|
@ -177,6 +177,33 @@ function scorm_get_manifest($blocks,$scoes) {
|
||||||
}
|
}
|
||||||
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->masteryscore = addslashes($block['tagData']);
|
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->masteryscore = addslashes($block['tagData']);
|
||||||
break;
|
break;
|
||||||
|
case 'ADLCP:COMPLETIONTHRESHOLD':
|
||||||
|
$parent = array_pop($parents);
|
||||||
|
array_push($parents, $parent);
|
||||||
|
if (!isset($block['tagData'])) {
|
||||||
|
$block['tagData'] = '';
|
||||||
|
}
|
||||||
|
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->threshold = addslashes($block['tagData']);
|
||||||
|
break;
|
||||||
|
case 'ADLNAV:PRESENTATION':
|
||||||
|
$parent = array_pop($parents);
|
||||||
|
array_push($parents, $parent);
|
||||||
|
foreach ($block['children'] as $adlnav) {
|
||||||
|
if ($adlnav['name'] == 'ADLNAV:NAVIGATIONINTERFACE') {
|
||||||
|
foreach ($adlnav['children'] as $adlnavInterface) {
|
||||||
|
if ($adlnavInterface['name'] == 'ADLNAV:HIDELMSUI') {
|
||||||
|
if ($adlnavInterface['tagData'] == 'continue') {
|
||||||
|
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->next = 1;
|
||||||
|
}
|
||||||
|
if ($adlnavInterface['tagData'] == 'previous') {
|
||||||
|
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->previous = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,9 +218,14 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
||||||
|
|
||||||
if (is_file($manifestfile)) {
|
if (is_file($manifestfile)) {
|
||||||
|
|
||||||
$xmlstring = file_get_contents($manifestfile);
|
$xmltext = file_get_contents($manifestfile);
|
||||||
|
|
||||||
|
$pattern = '/&(?!\w{2,6};)/';
|
||||||
|
$replacement = '&';
|
||||||
|
$xmltext = preg_replace($pattern, $replacement, $xmltext);
|
||||||
|
|
||||||
$objXML = new xml2Array();
|
$objXML = new xml2Array();
|
||||||
$manifests = $objXML->parse($xmlstring);
|
$manifests = $objXML->parse($xmltext);
|
||||||
//print_r($manifests);
|
//print_r($manifests);
|
||||||
$scoes = new stdClass();
|
$scoes = new stdClass();
|
||||||
$scoes->version = '';
|
$scoes->version = '';
|
||||||
|
@ -205,13 +237,13 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
||||||
foreach ($organizations as $organization => $items) {
|
foreach ($organizations as $organization => $items) {
|
||||||
foreach ($items as $identifier => $item) {
|
foreach ($items as $identifier => $item) {
|
||||||
// This new db mngt will support all SCORM future extensions
|
// This new db mngt will support all SCORM future extensions
|
||||||
/*$newitem = new stdClass();
|
$newitem = new stdClass();
|
||||||
$newitem->scorm = $scormid;
|
$newitem->scorm = $scormid;
|
||||||
$newitem->manifest = $manifest;
|
$newitem->manifest = $manifest;
|
||||||
$newitem->organization = $organization;
|
$newitem->organization = $organization;
|
||||||
$standarddatas = array('parent', 'identifier', 'launch', 'scormtype', 'title');
|
$standarddatas = array('parent', 'identifier', 'launch', 'scormtype', 'title');
|
||||||
foreach ($standarddatas as $standarddata) {
|
foreach ($standarddatas as $standarddata) {
|
||||||
$newitem->$standarddata = $item->$standarddata;
|
$newitem->$standarddata = addslashes($item->$standarddata);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($olditemid = scorm_array_search('identifier',$newitem->identifier,$olditems)) {
|
if ($olditemid = scorm_array_search('identifier',$newitem->identifier,$olditems)) {
|
||||||
|
@ -224,18 +256,18 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = new stdClass();
|
$data = new stdClass();
|
||||||
$data->scormid = $scormid;
|
|
||||||
$data->scoid = $id;
|
$data->scoid = $id;
|
||||||
$optionaldatas = scorm_optionals_data();
|
if ($optionaldatas = scorm_optionals_data($item,$standarddatas)) {
|
||||||
foreach ($optionalsdatas as $optionaldata) {
|
foreach ($optionaldatas as $optionaldata) {
|
||||||
if (isset($item->$optionaldata)) {
|
if (isset($item->$optionaldata)) {
|
||||||
$data->name = $optionaldata;
|
$data->name = $optionaldata;
|
||||||
$data->value = $item->$optionaldata;
|
$data->value = addslashes($item->$optionaldata);
|
||||||
$dataid = insert_record('scorm_scoes_data');
|
$dataid = insert_record('scorm_scoes_data',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} */
|
|
||||||
|
|
||||||
$item->scorm = $scormid;
|
/*$item->scorm = $scormid;
|
||||||
$item->manifest = $manifest;
|
$item->manifest = $manifest;
|
||||||
$item->organization = $organization;
|
$item->organization = $organization;
|
||||||
if ($olditemid = scorm_array_search('identifier',$item->identifier,$olditems)) {
|
if ($olditemid = scorm_array_search('identifier',$item->identifier,$olditems)) {
|
||||||
|
@ -244,7 +276,7 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
||||||
unset($olditems[$olditemid]);
|
unset($olditems[$olditemid]);
|
||||||
} else {
|
} else {
|
||||||
$id = insert_record('scorm_scoes',$item);
|
$id = insert_record('scorm_scoes',$item);
|
||||||
}
|
} */
|
||||||
|
|
||||||
if (($launch == 0) && ((empty($scoes->defaultorg)) || ($scoes->defaultorg == $identifier))) {
|
if (($launch == 0) && ((empty($scoes->defaultorg)) || ($scoes->defaultorg == $identifier))) {
|
||||||
$launch = $id;
|
$launch = $id;
|
||||||
|
@ -266,6 +298,16 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
||||||
return $launch;
|
return $launch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scorm_optionals_data($item, $standarddata) {
|
||||||
|
$result = array();
|
||||||
|
foreach ($item as $element => $value) {
|
||||||
|
if (! in_array($element, $standarddata)) {
|
||||||
|
$result[] = $element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/* Usage
|
/* Usage
|
||||||
Grab some XML data, either from a file, URL, etc. however you want. Assume storage in $strYourXML;
|
Grab some XML data, either from a file, URL, etc. however you want. Assume storage in $strYourXML;
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@ $mod_scorm_capabilities = array(
|
||||||
'teacher' => CAP_ALLOW,
|
'teacher' => CAP_ALLOW,
|
||||||
'editingteacher' => CAP_ALLOW,
|
'editingteacher' => CAP_ALLOW,
|
||||||
'coursecreator' => CAP_ALLOW,
|
'coursecreator' => CAP_ALLOW,
|
||||||
'admin' => CAP_ALLOW
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<XMLDB PATH="mod/scorm/db" VERSION="20060926" COMMENT="XMLDB file for Moodle mod/scorm"
|
<XMLDB PATH="mod/scorm/db" VERSION="20061121" COMMENT="XMLDB file for Moodle mod/scorm"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||||
>
|
>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
|
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
|
||||||
</INDEXES>
|
</INDEXES>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
<TABLE NAME="scorm_scoes" COMMENT="each SCO part of the SCORM module" PREVIOUS="scorm" NEXT="scorm_scoes_track">
|
<TABLE NAME="scorm_scoes" COMMENT="each SCO part of the SCORM module" PREVIOUS="scorm" NEXT="scorm_scoes_data">
|
||||||
<FIELDS>
|
<FIELDS>
|
||||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="scorm"/>
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="scorm"/>
|
||||||
<FIELD NAME="scorm" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="manifest"/>
|
<FIELD NAME="scorm" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="manifest"/>
|
||||||
|
@ -42,24 +42,30 @@
|
||||||
<FIELD NAME="organization" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="manifest" NEXT="parent"/>
|
<FIELD NAME="organization" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="manifest" NEXT="parent"/>
|
||||||
<FIELD NAME="parent" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="organization" NEXT="identifier"/>
|
<FIELD NAME="parent" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="organization" NEXT="identifier"/>
|
||||||
<FIELD NAME="identifier" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="parent" NEXT="launch"/>
|
<FIELD NAME="identifier" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="parent" NEXT="launch"/>
|
||||||
<FIELD NAME="launch" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="identifier" NEXT="parameters"/>
|
<FIELD NAME="launch" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="identifier" NEXT="scormtype"/>
|
||||||
<FIELD NAME="parameters" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="launch" NEXT="scormtype"/>
|
<FIELD NAME="scormtype" TYPE="char" LENGTH="5" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="launch" NEXT="title"/>
|
||||||
<FIELD NAME="scormtype" TYPE="char" LENGTH="5" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="parameters" NEXT="title"/>
|
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="scormtype"/>
|
||||||
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="scormtype" NEXT="prerequisites"/>
|
|
||||||
<FIELD NAME="prerequisites" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="title" NEXT="maxtimeallowed"/>
|
|
||||||
<FIELD NAME="maxtimeallowed" TYPE="char" LENGTH="19" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="prerequisites" NEXT="timelimitaction"/>
|
|
||||||
<FIELD NAME="timelimitaction" TYPE="char" LENGTH="19" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="maxtimeallowed" NEXT="datafromlms"/>
|
|
||||||
<FIELD NAME="datafromlms" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="timelimitaction" NEXT="masteryscore"/>
|
|
||||||
<FIELD NAME="masteryscore" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="datafromlms" NEXT="next"/>
|
|
||||||
<FIELD NAME="next" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="masteryscore" NEXT="previous"/>
|
|
||||||
<FIELD NAME="previous" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="next"/>
|
|
||||||
</FIELDS>
|
</FIELDS>
|
||||||
<KEYS>
|
<KEYS>
|
||||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for scorm_scoes" NEXT="scorm"/>
|
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for scorm_scoes" NEXT="scorm"/>
|
||||||
<KEY NAME="scorm" TYPE="foreign" FIELDS="scorm" REFTABLE="scorm" REFFIELDS="id" PREVIOUS="primary"/>
|
<KEY NAME="scorm" TYPE="foreign" FIELDS="scorm" REFTABLE="scorm" REFFIELDS="id" PREVIOUS="primary"/>
|
||||||
</KEYS>
|
</KEYS>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
<TABLE NAME="scorm_scoes_track" COMMENT="to track SCOes" PREVIOUS="scorm_scoes">
|
<TABLE NAME="scorm_scoes_data" COMMENT="Contains variable data get from packages" PREVIOUS="scorm_scoes" NEXT="scorm_scoes_track">
|
||||||
|
<FIELDS>
|
||||||
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="scoid"/>
|
||||||
|
<FIELD NAME="scoid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
|
||||||
|
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="scoid" NEXT="value"/>
|
||||||
|
<FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name"/>
|
||||||
|
</FIELDS>
|
||||||
|
<KEYS>
|
||||||
|
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for scorm_scoes_data"/>
|
||||||
|
</KEYS>
|
||||||
|
<INDEXES>
|
||||||
|
<INDEX NAME="dev_scorscoedata_sco_ix" UNIQUE="false" FIELDS="scoid"/>
|
||||||
|
</INDEXES>
|
||||||
|
</TABLE>
|
||||||
|
<TABLE NAME="scorm_scoes_track" COMMENT="to track SCOes" PREVIOUS="scorm_scoes_data">
|
||||||
<FIELDS>
|
<FIELDS>
|
||||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="userid"/>
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="userid"/>
|
||||||
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="scormid"/>
|
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="scormid"/>
|
||||||
|
|
|
@ -6,6 +6,7 @@ CREATE TABLE prefix_scorm (
|
||||||
id int(10) unsigned NOT NULL auto_increment,
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
course int(10) unsigned NOT NULL default '0',
|
course int(10) unsigned NOT NULL default '0',
|
||||||
name varchar(255) NOT NULL default '',
|
name varchar(255) NOT NULL default '',
|
||||||
|
summary text NOT NULL default '',
|
||||||
reference varchar(255) NOT NULL default '',
|
reference varchar(255) NOT NULL default '',
|
||||||
version varchar(9) NOT NULL default '',
|
version varchar(9) NOT NULL default '',
|
||||||
maxgrade float(3) NOT NULL default '0',
|
maxgrade float(3) NOT NULL default '0',
|
||||||
|
@ -13,8 +14,9 @@ CREATE TABLE prefix_scorm (
|
||||||
maxattempt int(10) NOT NULL default '1',
|
maxattempt int(10) NOT NULL default '1',
|
||||||
launch int(10) unsigned NOT NULL default '0',
|
launch int(10) unsigned NOT NULL default '0',
|
||||||
skipview tinyint(1) unsigned NOT NULL default '1',
|
skipview tinyint(1) unsigned NOT NULL default '1',
|
||||||
summary text NOT NULL default '',
|
|
||||||
hidebrowse tinyint(1) NOT NULL default '0',
|
hidebrowse tinyint(1) NOT NULL default '0',
|
||||||
|
hideexit tinyint(1) NOT NULL default '0',
|
||||||
|
hideabandon tinyint(1) NOT NULL default '0',
|
||||||
hidetoc tinyint(1) NOT NULL default '0',
|
hidetoc tinyint(1) NOT NULL default '0',
|
||||||
hidenav tinyint(1) NOT NULL default '0',
|
hidenav tinyint(1) NOT NULL default '0',
|
||||||
auto tinyint(1) unsigned NOT NULL default '0',
|
auto tinyint(1) unsigned NOT NULL default '0',
|
||||||
|
@ -24,7 +26,6 @@ CREATE TABLE prefix_scorm (
|
||||||
height int(10) unsigned NOT NULL default '600',
|
height int(10) unsigned NOT NULL default '600',
|
||||||
timemodified int(10) unsigned NOT NULL default '0',
|
timemodified int(10) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY id (id),
|
|
||||||
KEY course (course)
|
KEY course (course)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
@ -35,22 +36,31 @@ CREATE TABLE prefix_scorm_scoes (
|
||||||
organization varchar(255) NOT NULL default '',
|
organization varchar(255) NOT NULL default '',
|
||||||
parent varchar(255) NOT NULL default '',
|
parent varchar(255) NOT NULL default '',
|
||||||
identifier varchar(255) NOT NULL default '',
|
identifier varchar(255) NOT NULL default '',
|
||||||
launch varchar(255) NOT NULL default '',
|
/* launch varchar(255) NOT NULL default '', */
|
||||||
parameters varchar(255) NOT NULL default '',
|
launch int(10) NOT NULL default '0',
|
||||||
scormtype varchar(5) NOT NULL default '',
|
scormtype varchar(5) NOT NULL default '',
|
||||||
title varchar(255) NOT NULL default '',
|
title varchar(255) NOT NULL default '',
|
||||||
|
/* parameters varchar(255) NOT NULL default '',
|
||||||
prerequisites varchar(200) NOT NULL default '',
|
prerequisites varchar(200) NOT NULL default '',
|
||||||
maxtimeallowed varchar(19) NOT NULL default '',
|
maxtimeallowed varchar(19) NOT NULL default '',
|
||||||
timelimitaction varchar(19) NOT NULL default '',
|
timelimitaction varchar(19) NOT NULL default '',
|
||||||
datafromlms varchar(255) NOT NULL default '',
|
datafromlms varchar(255) NOT NULL default '',
|
||||||
masteryscore varchar(200) NOT NULL default '',
|
masteryscore varchar(200) NOT NULL default '',
|
||||||
next tinyint(1) unsigned NOT NULL default '0',
|
next tinyint(1) unsigned NOT NULL default '0',
|
||||||
previous tinyint(1) unsigned NOT NULL default '0',
|
previous tinyint(1) unsigned NOT NULL default '0', */
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY id (id),
|
|
||||||
KEY scorm (scorm)
|
KEY scorm (scorm)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_scoes_data (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
name varchar(255) NOT NULL default '',
|
||||||
|
value text NOT NULL default '',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE prefix_scorm_scoes_track (
|
CREATE TABLE prefix_scorm_scoes_track (
|
||||||
id int(10) unsigned NOT NULL auto_increment,
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
userid int(10) unsigned NOT NULL default '0',
|
userid int(10) unsigned NOT NULL default '0',
|
||||||
|
@ -68,6 +78,106 @@ CREATE TABLE prefix_scorm_scoes_track (
|
||||||
UNIQUE track (userid, scormid, scoid, attempt, element)
|
UNIQUE track (userid, scormid, scoid, attempt, element)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_sequencing_ruleconditions (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scormid int(10) unsigned NOT NULL default '0',
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
conditioncombination varchar(3) NOT NULL default 'all',
|
||||||
|
ruletype tinyint(2) unsigned NOT NULL default '0',
|
||||||
|
action varchar(25) NOT NULL default '',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE (scormid, scoid,id),
|
||||||
|
KEY scormid (scormid),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_sequencing_rulecondition (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scormid int(10) unsigned NOT NULL default '0',
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
ruleconditionsid int(10) unsigned NOT NULL default '0',
|
||||||
|
refrencedobjective varchar(255) NOT NULL default '',
|
||||||
|
measurethreshold float(11,4) NOT NULL default '0.0000',
|
||||||
|
operator varchar(5) NOT NULL default 'noOp',
|
||||||
|
condition varchar(30) NOT NULL default 'always',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE (scormid, scoid,id,ruleconditionsid),
|
||||||
|
KEY ruleconditionsid (ruleconditionsid),
|
||||||
|
KEY scormid (scormid),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_sequencing_rolluprules (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scormid int(10) unsigned NOT NULL default '0',
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
rollupobjectivesatisfied TINYINT(1) unsigned NOT NULL default '1',
|
||||||
|
rollupprogresscompletion TINYINT(1) unsigned NOT NULL default '1',
|
||||||
|
objectivemeasureweight float(11,4) NOT NULL default '1.0000',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
KEY scormid (scormid),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_sequencing_rolluprule (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scormid int(10) unsigned NOT NULL default '0',
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
rolluprulesid int(10) unsigned NOT NULL default '0',
|
||||||
|
childactivityset varchar(15) NOT NULL default '',
|
||||||
|
minimumcount int(10) unsigned NOT NULL default '0',
|
||||||
|
minimumpercent float(11,4) unsigned NOT NULL default '0.0000',
|
||||||
|
conditioncombination varchar(3) NOT NULL default 'all',
|
||||||
|
action varchar(15) NOT NULL default '',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE (scormid, scoid, rolluprulesid, id),
|
||||||
|
KEY scormid (scormid),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_sequencing_rolluprulecondition (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scormid int(10) unsigned NOT NULL default '0',
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
rollupruleid int(10) unsigned NOT NULL default '0',
|
||||||
|
operator varchar(5) NOT NULL default 'noOp',
|
||||||
|
condition varchar(25) NOT NULL default '',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE (scormid, scoid, rollupruleid, id),
|
||||||
|
KEY scormid (scormid),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_sequencing_objectives (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scormid int(10) unsigned NOT NULL default '0',
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
primary tinyint(1) NOT NULL default '0',
|
||||||
|
objectiveid int(10) unsigned NOT NULL default '0',
|
||||||
|
satisfiedbymeasure tinyint(1) NOT NULL default '1',
|
||||||
|
minnormalizedmeasure float(11,4) unsigned NOT NULL default '1.0',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE (scormid, scoid, id),
|
||||||
|
KEY scormid (scormid),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE prefix_scorm_sequencing_objective (
|
||||||
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
|
scormid int(10) unsigned NOT NULL default '0',
|
||||||
|
scoid int(10) unsigned NOT NULL default '0',
|
||||||
|
objectiveid int(10) unsigned NOT NULL default '0',
|
||||||
|
targetobjectiveid int(10) unsigned NOT NULL default '0',
|
||||||
|
readsatisfiedstatus tinyint(1) NOT NULL default '1',
|
||||||
|
readnormalizedmeasure tinyint(1) NOT NULL default '1',
|
||||||
|
writesatisfiedstatus tinyint(1) NOT NULL default '0',
|
||||||
|
writenormalizedmeasure tinyint(1) NOT NULL default '0',
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE (scormid, scoid, id, objectiveid),
|
||||||
|
KEY scormid (scormid),
|
||||||
|
KEY scoid (scoid)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dumping data for table log_display
|
# Dumping data for table log_display
|
||||||
#
|
#
|
||||||
|
|
|
@ -23,14 +23,61 @@ function xmldb_scorm_upgrade($oldversion=0) {
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
if ($result && $oldversion < 2006103100) {
|
||||||
/// block of code similar to the next one. Please, delete
|
/// Create the new sco optionals data table
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
/// Define table scorm_scoes_data to be created
|
||||||
/// $result = result of "/lib/ddllib.php" function calls
|
$table = new XMLDBTable('scorm_scoes_data');
|
||||||
/// }
|
|
||||||
|
/// Adding fields to table scorm_scoes_data
|
||||||
|
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||||
|
$table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
|
||||||
|
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
|
||||||
|
$table->addFieldInfo('value', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
|
||||||
|
|
||||||
|
/// Adding keys to table scorm_scoes_data
|
||||||
|
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
|
|
||||||
|
/// Adding indexes to table scorm_scoes_data
|
||||||
|
$table->addIndexInfo('scoid', XMLDB_INDEX_NOTUNIQUE, array('scoid'));
|
||||||
|
|
||||||
|
/// Launch create table for scorm_scoes_data
|
||||||
|
$result = $result && create_table($table);
|
||||||
|
|
||||||
|
/// The old fields used in scorm_scoes
|
||||||
|
$fields = array('parameters' => '',
|
||||||
|
'prerequisites' => '',
|
||||||
|
'maxtimeallowed' => '',
|
||||||
|
'timelimitaction' => '',
|
||||||
|
'datafromlms' => '',
|
||||||
|
'masteryscore' => '',
|
||||||
|
'next' => '0',
|
||||||
|
'previous' => '0');
|
||||||
|
|
||||||
|
/// Retrieve old datas
|
||||||
|
if ($olddatas = get_records('scorm_scoes')) {
|
||||||
|
foreach ($olddatas as $olddata) {
|
||||||
|
$newdata = new stdClass();
|
||||||
|
$newdata->scoid = $olddata->id;
|
||||||
|
foreach ($fields as $field => $value) {
|
||||||
|
if ($olddata->$field != $value) {
|
||||||
|
$newdata->name = addslashes($field);
|
||||||
|
$newdata->value = addslashes($olddata->$field);
|
||||||
|
$id = insert_record('scorm_scoes_data', $newdata);
|
||||||
|
$result = $result && ($id != 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove no more used fields
|
||||||
|
$table = new XMLDBTable('scorm_scoes');
|
||||||
|
|
||||||
|
foreach ($fields as $field => $value) {
|
||||||
|
$field = new XMLDBField($field);
|
||||||
|
$result = $result && drop_field($table, $field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ function scorm_add_instance($scorm) {
|
||||||
//sanitize submitted values a bit
|
//sanitize submitted values a bit
|
||||||
$scorm->width = clean_param($scorm->width, PARAM_INT);
|
$scorm->width = clean_param($scorm->width, PARAM_INT);
|
||||||
$scorm->height = clean_param($scorm->height, PARAM_INT);
|
$scorm->height = clean_param($scorm->height, PARAM_INT);
|
||||||
|
|
||||||
|
if (!isset($scorm->whatgrade)) {
|
||||||
|
$scorm->whatgrade = 0;
|
||||||
|
}
|
||||||
$scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod;
|
$scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod;
|
||||||
|
|
||||||
$id = insert_record('scorm', $scorm);
|
$id = insert_record('scorm', $scorm);
|
||||||
|
@ -64,6 +68,9 @@ function scorm_update_instance($scorm) {
|
||||||
$scorm->width = str_replace('%','',$scorm->width);
|
$scorm->width = str_replace('%','',$scorm->width);
|
||||||
$scorm->height = str_replace('%','',$scorm->height);
|
$scorm->height = str_replace('%','',$scorm->height);
|
||||||
|
|
||||||
|
if (!isset($scorm->whatgrade)) {
|
||||||
|
$scorm->whatgrade = 0;
|
||||||
|
}
|
||||||
$scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod;
|
$scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod;
|
||||||
|
|
||||||
// Check if scorm manifest needs to be reparsed
|
// Check if scorm manifest needs to be reparsed
|
||||||
|
@ -124,7 +131,14 @@ function scorm_delete_instance($id) {
|
||||||
if (! delete_records('scorm_scoes_track', 'scormid', $scorm->id)) {
|
if (! delete_records('scorm_scoes_track', 'scormid', $scorm->id)) {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
if (! delete_records('scorm_scoes', 'scorm', $scorm->id)) {
|
if ($scoes = get_records('scorm_scoes','scorm',$scorm->id)) {
|
||||||
|
foreach ($scoes as $sco) {
|
||||||
|
if (! delete_records('scorm_scoes_data', 'scoid', $sco->id)) {
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete_records('scorm_scoes', 'scorm', $scorm->id);
|
||||||
|
} else {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
if (! delete_records('scorm', 'id', $scorm->id)) {
|
if (! delete_records('scorm', 'id', $scorm->id)) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("../../config.php");
|
require_once('../../config.php');
|
||||||
require_once('locallib.php');
|
require_once('locallib.php');
|
||||||
|
|
||||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||||
|
@ -8,23 +8,23 @@
|
||||||
|
|
||||||
if (!empty($id)) {
|
if (!empty($id)) {
|
||||||
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
|
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
|
||||||
error("Course Module ID was incorrect");
|
error('Course Module ID was incorrect');
|
||||||
}
|
}
|
||||||
if (! $course = get_record("course", "id", $cm->course)) {
|
if (! $course = get_record('course', 'id', $cm->course)) {
|
||||||
error("Course is misconfigured");
|
error('Course is misconfigured');
|
||||||
}
|
}
|
||||||
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
|
if (! $scorm = get_record('scorm', 'id', $cm->instance)) {
|
||||||
error("Course module is incorrect");
|
error('Course module is incorrect');
|
||||||
}
|
}
|
||||||
} else if (!empty($a)) {
|
} else if (!empty($a)) {
|
||||||
if (! $scorm = get_record("scorm", "id", $a)) {
|
if (! $scorm = get_record('scorm', 'id', $a)) {
|
||||||
error("Course module is incorrect");
|
error('Course module is incorrect');
|
||||||
}
|
}
|
||||||
if (! $course = get_record("course", "id", $scorm->course)) {
|
if (! $course = get_record('course', 'id', $scorm->course)) {
|
||||||
error("Course is misconfigured");
|
error('Course is misconfigured');
|
||||||
}
|
}
|
||||||
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
|
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
|
||||||
error("Course Module ID was incorrect");
|
error('Course Module ID was incorrect');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error('A required parameter is missing');
|
error('A required parameter is missing');
|
||||||
|
@ -35,10 +35,10 @@
|
||||||
//
|
//
|
||||||
// Direct SCO request
|
// Direct SCO request
|
||||||
//
|
//
|
||||||
if ($sco = get_record("scorm_scoes","id",$scoid)) {
|
if ($sco = scorm_get_sco($scoid)) {
|
||||||
if ($sco->launch == '') {
|
if ($sco->launch == '') {
|
||||||
// Search for the next launchable sco
|
// Search for the next launchable sco
|
||||||
if ($scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>'' AND id>".$sco->id,"id ASC")) {
|
if ($scoes = get_records_select('scorm_scoes','scorm='.$scorm->id." AND launch<>'' AND id>".$sco->id,'id ASC')) {
|
||||||
$sco = current($scoes);
|
$sco = current($scoes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
// If no sco was found get the first of SCORM package
|
// If no sco was found get the first of SCORM package
|
||||||
//
|
//
|
||||||
if (!isset($sco)) {
|
if (!isset($sco)) {
|
||||||
$scoes = get_records_select("scorm_scoes","scorm=".$scorm->id." AND launch<>''","id ASC");
|
$scoes = get_records_select('scorm_scoes','scorm='.$scorm->id." AND launch<>''",'id ASC');
|
||||||
$sco = current($scoes);
|
$sco = current($scoes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,24 +64,28 @@
|
||||||
//
|
//
|
||||||
$connector = '';
|
$connector = '';
|
||||||
$version = substr($scorm->version,0,4);
|
$version = substr($scorm->version,0,4);
|
||||||
if (!empty($sco->parameters) || ($version == 'AICC')) {
|
if ((isset($sco->parameters) && (!empty($sco->parameters))) || ($version == 'AICC')) {
|
||||||
if (stripos($sco->launch,'?') !== false) {
|
if (stripos($sco->launch,'?') !== false) {
|
||||||
$connector = '&';
|
$connector = '&';
|
||||||
} else {
|
} else {
|
||||||
$connector = '?';
|
$connector = '?';
|
||||||
}
|
}
|
||||||
if (!empty($sco->parameters) && ($sco->parameters[0] == '?')) {
|
if ((isset($sco->parameters) && (!empty($sco->parameters))) && ($sco->parameters[0] == '?')) {
|
||||||
$sco->parameters = substr($sco->parameters,1);
|
$sco->parameters = substr($sco->parameters,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($version == 'AICC') {
|
if ($version == 'AICC') {
|
||||||
if (!empty($sco->parameters)) {
|
if (isset($sco->parameters) && (!empty($sco->parameters))) {
|
||||||
$sco->parameters = '&'. $sco->parameters;
|
$sco->parameters = '&'. $sco->parameters;
|
||||||
}
|
}
|
||||||
$launcher = $sco->launch.$connector.'aicc_sid='.sesskey().'&aicc_url='.$CFG->wwwroot.'/mod/scorm/aicc.php'.$sco->parameters;
|
$launcher = $sco->launch.$connector.'aicc_sid='.sesskey().'&aicc_url='.$CFG->wwwroot.'/mod/scorm/aicc.php'.$sco->parameters;
|
||||||
} else {
|
} else {
|
||||||
|
if (isset($sco->parameters) && (!empty($sco->parameters))) {
|
||||||
$launcher = $sco->launch.$connector.$sco->parameters;
|
$launcher = $sco->launch.$connector.$sco->parameters;
|
||||||
|
} else {
|
||||||
|
$launcher = $sco->launch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scorm_external_link($sco->launch)) {
|
if (scorm_external_link($sco->launch)) {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<?php // $Id$
|
<?php // $Id$
|
||||||
|
|
||||||
/// Constants and settings for module scorm
|
/// Constants and settings for module scorm
|
||||||
|
define('SCO_ALL', 0);
|
||||||
|
define('SCO_DATA', 1);
|
||||||
|
define('SCO_ONLY', 2);
|
||||||
|
|
||||||
define('GRADESCOES', '0');
|
define('GRADESCOES', '0');
|
||||||
define('GRADEHIGHEST', '1');
|
define('GRADEHIGHEST', '1');
|
||||||
|
@ -218,6 +221,26 @@ function scorm_validate($packagedir) {
|
||||||
return $validation;
|
return $validation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object containing all datas relative to the given sco ID
|
||||||
|
*
|
||||||
|
* @param integer $id The sco ID
|
||||||
|
* @return mixed (false if sco id does not exists)
|
||||||
|
*/
|
||||||
|
function scorm_get_sco($id,$what=SCO_ALL) {
|
||||||
|
if ($sco = get_record('scorm_scoes','id',$id)) {
|
||||||
|
$sco = ($what == SCO_DATA) ? new stdClass() : $sco;
|
||||||
|
if (($what != SCO_ONLY) && ($scodatas = get_records('scorm_scoes_data','scoid',$id))) {
|
||||||
|
foreach ($scodatas as $scodata) {
|
||||||
|
$sco->{$scodata->name} = $scodata->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $sco;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value) {
|
function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value) {
|
||||||
$id = null;
|
$id = null;
|
||||||
if ($track = get_record_select('scorm_scoes_track',"userid='$userid' AND scormid='$scormid' AND scoid='$scoid' AND attempt='$attempt' AND element='$element'")) {
|
if ($track = get_record_select('scorm_scoes_track',"userid='$userid' AND scormid='$scormid' AND scoid='$scoid' AND attempt='$attempt' AND element='$element'")) {
|
||||||
|
@ -519,11 +542,11 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$orgidentifier = '';
|
$orgidentifier = '';
|
||||||
if ($org = get_record('scorm_scoes','id',$organization)) {
|
if ($sco = scorm_get_sco($organization, SCO_ONLY)) {
|
||||||
if (($org->organization == '') && ($org->launch == '')) {
|
if (($sco->organization == '') && ($sco->launch == '')) {
|
||||||
$orgidentifier = $org->identifier;
|
$orgidentifier = $sco->identifier;
|
||||||
} else {
|
} else {
|
||||||
$orgidentifier = $org->organization;
|
$orgidentifier = $sco->organization;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
|
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
|
||||||
|
|
|
@ -131,13 +131,13 @@
|
||||||
<script language="JavaScript" type="text/javascript" src="api.php?id=<?php echo $cm->id.$scoidstr.$modestr.$attemptstr ?>"></script>
|
<script language="JavaScript" type="text/javascript" src="api.php?id=<?php echo $cm->id.$scoidstr.$modestr.$attemptstr ?>"></script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if (($sco->previd != 0) && ($sco->previous == 0)) {
|
if (($sco->previd != 0) && ((!isset($sco->previous)) || ($sco->previous == 0))) {
|
||||||
$scostr = '&scoid='.$sco->previd;
|
$scostr = '&scoid='.$sco->previd;
|
||||||
echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";
|
echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";
|
||||||
} else {
|
} else {
|
||||||
echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/view.php?id='.$cm->id."\";</script>\n";
|
echo ' <script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/view.php?id='.$cm->id."\";</script>\n";
|
||||||
}
|
}
|
||||||
if (($sco->nextid != 0) && ($sco->next == 0)) {
|
if (($sco->nextid != 0) && ((!isset($sco->next)) || ($sco->next == 0))) {
|
||||||
$scostr = '&scoid='.$sco->nextid;
|
$scostr = '&scoid='.$sco->nextid;
|
||||||
echo ' <script language="javascript">var next="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";
|
echo ' <script language="javascript">var next="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr."\";</script>\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -170,11 +170,11 @@
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
($sco->previd != 0) && // This is not the first learning object of the package
|
($sco->previd != 0) && // This is not the first learning object of the package
|
||||||
($sco->previous == 0) // Moodle must manage the previous link
|
((!isset($sco->previous)) || ($sco->previous == 0)) // Moodle must manage the previous link
|
||||||
) ||
|
) ||
|
||||||
(
|
(
|
||||||
($sco->nextid != 0) && // This is not the last learning object of the package
|
($sco->nextid != 0) && // This is not the last learning object of the package
|
||||||
($sco->next == 0) // Moodle must manage the next link
|
((!isset($sco->next)) || ($sco->next == 0)) // Moodle must manage the next link
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) || ($scorm->hidetoc == 2) // Teacher want to display toc in a small dropdown menu
|
) || ($scorm->hidetoc == 2) // Teacher want to display toc in a small dropdown menu
|
||||||
|
@ -189,7 +189,7 @@
|
||||||
<div id="scormnav" class="right">
|
<div id="scormnav" class="right">
|
||||||
<?php
|
<?php
|
||||||
$orgstr = '&currentorg='.$currentorg;
|
$orgstr = '&currentorg='.$currentorg;
|
||||||
if (($scorm->hidenav == 0) && ($sco->previd != 0) && ($sco->previous == 0)) {
|
if (($scorm->hidenav == 0) && ($sco->previd != 0) && ((!isset($sco->previous)) || ($sco->previous == 0))) {
|
||||||
/// Print the prev LO link
|
/// Print the prev LO link
|
||||||
$scostr = '&scoid='.$sco->previd;
|
$scostr = '&scoid='.$sco->previd;
|
||||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
if ($scorm->hidetoc == 2) {
|
if ($scorm->hidetoc == 2) {
|
||||||
echo $result->tocmenu;
|
echo $result->tocmenu;
|
||||||
}
|
}
|
||||||
if (($scorm->hidenav == 0) && ($sco->nextid != 0) && ($sco->next == 0)) {
|
if (($scorm->hidenav == 0) && ($sco->nextid != 0) && ((!isset($sco->next)) || ($sco->next == 0))) {
|
||||||
/// Print the next LO link
|
/// Print the next LO link
|
||||||
$scostr = '&scoid='.$sco->nextid;
|
$scostr = '&scoid='.$sco->nextid;
|
||||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
||||||
|
|
|
@ -13,30 +13,30 @@
|
||||||
|
|
||||||
if (!empty($id)) {
|
if (!empty($id)) {
|
||||||
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
|
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
|
||||||
error("Course Module ID was incorrect");
|
error('Course Module ID was incorrect');
|
||||||
}
|
}
|
||||||
if (! $course = get_record("course", "id", $cm->course)) {
|
if (! $course = get_record('course', 'id', $cm->course)) {
|
||||||
error("Course is misconfigured");
|
error('Course is misconfigured');
|
||||||
}
|
}
|
||||||
if (! $scorm = get_record("scorm", "id", $cm->instance)) {
|
if (! $scorm = get_record('scorm', 'id', $cm->instance)) {
|
||||||
error("Course module is incorrect");
|
error('Course module is incorrect');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!empty($b)) {
|
if (!empty($b)) {
|
||||||
if (! $sco = get_record("scorm_scoes", "id", $b)) {
|
if (! $sco = get_record('scorm_scoes', 'id', $b)) {
|
||||||
error("Scorm activity is incorrect");
|
error('Scorm activity is incorrect');
|
||||||
}
|
}
|
||||||
$a = $sco->scorm;
|
$a = $sco->scorm;
|
||||||
}
|
}
|
||||||
if (!empty($a)) {
|
if (!empty($a)) {
|
||||||
if (! $scorm = get_record("scorm", "id", $a)) {
|
if (! $scorm = get_record('scorm', 'id', $a)) {
|
||||||
error("Course module is incorrect");
|
error('Course module is incorrect');
|
||||||
}
|
}
|
||||||
if (! $course = get_record("course", "id", $scorm->course)) {
|
if (! $course = get_record('course', 'id', $scorm->course)) {
|
||||||
error("Course is misconfigured");
|
error('Course is misconfigured');
|
||||||
}
|
}
|
||||||
if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
|
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
|
||||||
error("Course Module ID was incorrect");
|
error('Course Module ID was incorrect');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,10 @@
|
||||||
require_login($course->id, false, $cm);
|
require_login($course->id, false, $cm);
|
||||||
|
|
||||||
if (!has_capability('mod/scorm:viewreport', get_context_instance(CONTEXT_MODULE,$cm->id))) {
|
if (!has_capability('mod/scorm:viewreport', get_context_instance(CONTEXT_MODULE,$cm->id))) {
|
||||||
error("You are not allowed to use this script");
|
error('You are not allowed to use this script');
|
||||||
}
|
}
|
||||||
|
|
||||||
add_to_log($course->id, "scorm", "report", "report.php?id=$cm->id", "$scorm->id");
|
add_to_log($course->id, 'scorm', 'report', 'report.php?id='.$cm->id, $scorm->id);
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
$userdata = scorm_get_user_data($user);
|
$userdata = scorm_get_user_data($user);
|
||||||
|
@ -63,23 +63,23 @@
|
||||||
$navigation = '';
|
$navigation = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$strscorms = get_string("modulenameplural", "scorm");
|
$strscorms = get_string('modulenameplural', 'scorm');
|
||||||
$strscorm = get_string("modulename", "scorm");
|
$strscorm = get_string('modulename', 'scorm');
|
||||||
$strreport = get_string("report", "scorm");
|
$strreport = get_string('report', 'scorm');
|
||||||
$strattempt = get_string("attempt", "scorm");
|
$strattempt = get_string('attempt', 'scorm');
|
||||||
$strname = get_string('name');
|
$strname = get_string('name');
|
||||||
if (empty($b)) {
|
if (empty($b)) {
|
||||||
if (empty($a)) {
|
if (empty($a)) {
|
||||||
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
||||||
"$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
|
"$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
|
||||||
-> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a> -> $strreport",
|
-> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a> -> $strreport",
|
||||||
"", "", true);
|
'', '', true);
|
||||||
} else {
|
} else {
|
||||||
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
||||||
"$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
|
"$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
|
||||||
-> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>
|
-> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>
|
||||||
-> <a href=\"report.php?id=$cm->id\">$strreport</a> -> $strattempt $attempt - ".fullname($userdata),
|
-> <a href=\"report.php?id=$cm->id\">$strreport</a> -> $strattempt $attempt - ".fullname($userdata),
|
||||||
"", "", true);
|
'', '', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
-> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>
|
-> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>
|
||||||
-> <a href=\"report.php?id=$cm->id\">$strreport</a>
|
-> <a href=\"report.php?id=$cm->id\">$strreport</a>
|
||||||
-> <a href=\"report.php?a=$a&user=$user&attempt=$attempt\">$strattempt $attempt - ".fullname($userdata)."</a> -> $sco->title",
|
-> <a href=\"report.php?a=$a&user=$user&attempt=$attempt\">$strattempt $attempt - ".fullname($userdata)."</a> -> $sco->title",
|
||||||
"", "", true);
|
'', '', true);
|
||||||
}
|
}
|
||||||
print_heading(format_string($scorm->name));
|
print_heading(format_string($scorm->name));
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
if (empty($b)) {
|
if (empty($b)) {
|
||||||
if (empty($a)) {
|
if (empty($a)) {
|
||||||
// No options, show the global scorm report
|
// No options, show the global scorm report
|
||||||
if ($scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid")) {
|
if ($scousers=get_records_select('scorm_scoes_track', "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid")) {
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->head = array(' ', get_string('name'));
|
$table->head = array(' ', get_string('name'));
|
||||||
$table->align = array('center', 'left');
|
$table->align = array('center', 'left');
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
fullname($userdata).'</a>';
|
fullname($userdata).'</a>';
|
||||||
$row[] = '<a href="report.php?a='.$scorm->id.'&user='.$scouser->userid.'&attempt='.$a.'">'.$a.'</a>';
|
$row[] = '<a href="report.php?a='.$scorm->id.'&user='.$scouser->userid.'&attempt='.$a.'">'.$a.'</a>';
|
||||||
$select = 'scormid = '.$scorm->id.' and userid = '.$scouser->userid.' and attempt = '.$a;
|
$select = 'scormid = '.$scorm->id.' and userid = '.$scouser->userid.' and attempt = '.$a;
|
||||||
$timetracks = get_record_select("scorm_scoes_track", $select,'min(timemodified) as started, max(timemodified) as last');
|
$timetracks = get_record_select('scorm_scoes_track', $select,'min(timemodified) as started, max(timemodified) as last');
|
||||||
$row[] = userdate($timetracks->started, get_string('strftimedaydatetime'));
|
$row[] = userdate($timetracks->started, get_string('strftimedaydatetime'));
|
||||||
$row[] = userdate($timetracks->last, get_string('strftimedaydatetime'));
|
$row[] = userdate($timetracks->last, get_string('strftimedaydatetime'));
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
} else {
|
} else {
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
// User SCORM report
|
// User SCORM report
|
||||||
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' ORDER BY id")) {
|
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' ORDER BY id")) {
|
||||||
if (!empty($userdata)) {
|
if (!empty($userdata)) {
|
||||||
print_simple_box_start('center');
|
print_simple_box_start('center');
|
||||||
echo '<div align="center">'."\n";
|
echo '<div align="center">'."\n";
|
||||||
|
@ -258,6 +258,7 @@
|
||||||
'status' => 'cmi.core.lesson_status',
|
'status' => 'cmi.core.lesson_status',
|
||||||
'time' => 'cmi.core.total_time');
|
'time' => 'cmi.core.total_time');
|
||||||
}
|
}
|
||||||
|
$printedelements = array();
|
||||||
foreach ($elements as $key => $element) {
|
foreach ($elements as $key => $element) {
|
||||||
if (isset($trackdata->$element)) {
|
if (isset($trackdata->$element)) {
|
||||||
$existelements = true;
|
$existelements = true;
|
||||||
|
|
|
@ -174,19 +174,12 @@
|
||||||
$sco->parent = backup_todb($sub_info['#']['PARENT']['0']['#']);
|
$sco->parent = backup_todb($sub_info['#']['PARENT']['0']['#']);
|
||||||
$sco->identifier = backup_todb($sub_info['#']['IDENTIFIER']['0']['#']);
|
$sco->identifier = backup_todb($sub_info['#']['IDENTIFIER']['0']['#']);
|
||||||
$sco->launch = backup_todb($sub_info['#']['LAUNCH']['0']['#']);
|
$sco->launch = backup_todb($sub_info['#']['LAUNCH']['0']['#']);
|
||||||
|
$sco->title = backup_todb($sub_info['#']['TITLE']['0']['#']);
|
||||||
if ($restore->backup_version < 2005031300) {
|
if ($restore->backup_version < 2005031300) {
|
||||||
$sco->scormtype = backup_todb($sub_info['#']['TYPE']['0']['#']);
|
$sco->scormtype = backup_todb($sub_info['#']['TYPE']['0']['#']);
|
||||||
} else {
|
} else {
|
||||||
$sco->scormtype = backup_todb($sub_info['#']['SCORMTYPE']['0']['#']);
|
$sco->scormtype = backup_todb($sub_info['#']['SCORMTYPE']['0']['#']);
|
||||||
}
|
}
|
||||||
$sco->title = backup_todb($sub_info['#']['TITLE']['0']['#']);
|
|
||||||
$sco->prerequisites = backup_todb($sub_info['#']['PREREQUISITES']['0']['#']);
|
|
||||||
$sco->maxtimeallowed = backup_todb($sub_info['#']['MAXTIMEALLOWED']['0']['#']);
|
|
||||||
$sco->timelimitaction = backup_todb($sub_info['#']['TIMELIMITACTION']['0']['#']);
|
|
||||||
$sco->datafromlms = backup_todb($sub_info['#']['DATAFROMLMS']['0']['#']);
|
|
||||||
$sco->masteryscore = backup_todb($sub_info['#']['MASTERYSCORE']['0']['#']);
|
|
||||||
$sco->next = backup_todb($sub_info['#']['NEXT']['0']['#']);
|
|
||||||
$sco->previous = backup_todb($sub_info['#']['PREVIOUS']['0']['#']);
|
|
||||||
|
|
||||||
//The structure is equal to the db, so insert the scorm_scoes
|
//The structure is equal to the db, so insert the scorm_scoes
|
||||||
$newid = insert_record ("scorm_scoes",$sco);
|
$newid = insert_record ("scorm_scoes",$sco);
|
||||||
|
@ -214,6 +207,15 @@
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sco->prerequisites = backup_todb($sub_info['#']['PREREQUISITES']['0']['#']);
|
||||||
|
$sco->maxtimeallowed = backup_todb($sub_info['#']['MAXTIMEALLOWED']['0']['#']);
|
||||||
|
$sco->timelimitaction = backup_todb($sub_info['#']['TIMELIMITACTION']['0']['#']);
|
||||||
|
$sco->datafromlms = backup_todb($sub_info['#']['DATAFROMLMS']['0']['#']);
|
||||||
|
$sco->masteryscore = backup_todb($sub_info['#']['MASTERYSCORE']['0']['#']);
|
||||||
|
$sco->next = backup_todb($sub_info['#']['NEXT']['0']['#']);
|
||||||
|
$sco->previous = backup_todb($sub_info['#']['PREVIOUS']['0']['#']);
|
||||||
|
|
||||||
//This function restores the scorm_scoes_track
|
//This function restores the scorm_scoes_track
|
||||||
function scorm_scoes_tracks_restore_mods($scorm_id,$info,$restore) {
|
function scorm_scoes_tracks_restore_mods($scorm_id,$info,$restore) {
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
// catch up now, so until 27th October please only increment in very tiny steps
|
// catch up now, so until 27th October please only increment in very tiny steps
|
||||||
// in HEAD, until we get past that date..
|
// in HEAD, until we get past that date..
|
||||||
|
|
||||||
$module->version = 2006102702; // The (date) version of this module
|
$module->version = 2006112100; // The (date) version of this module
|
||||||
$module->requires = 2006080900; // The version of Moodle that is required
|
$module->requires = 2006080900; // The version of Moodle that is required
|
||||||
$module->cron = 0; // How often should cron check this module (seconds)?
|
$module->cron = 0; // How often should cron check this module (seconds)?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue