mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
Some bug fixes, added new score view (thanks Matt) and added a new validation procedure
This commit is contained in:
parent
485913f784
commit
1a12b1f1d1
16 changed files with 487 additions and 235 deletions
|
@ -145,7 +145,7 @@ function SCORMapi() {
|
||||||
var parsedtime = value.match(/^([0-9]{2,4}):([0-9]{2}):([0-9]{2})(\.[0-9]{1,2})?$/);
|
var parsedtime = value.match(/^([0-9]{2,4}):([0-9]{2}):([0-9]{2})(\.[0-9]{1,2})?$/);
|
||||||
if (parsedtime != null) {
|
if (parsedtime != null) {
|
||||||
//top.alert(parsedtime);
|
//top.alert(parsedtime);
|
||||||
if (((parsedtime.length == 4) || (parsedtime.length == 5)) && (parsedtime[2]>=0) && (parsedtime[2]<=59) && (parsedtime[3]>=0) && (parsedtime[3]<=59)) {
|
if (((parsedtime.length == 4) || (parsedtime.length == 5)) && (parsedtime[3]>=0) && (parsedtime[3]<=59)) {
|
||||||
eval(param+'="'+value+'";');
|
eval(param+'="'+value+'";');
|
||||||
errorCode = "0";
|
errorCode = "0";
|
||||||
return "true";
|
return "true";
|
||||||
|
@ -291,15 +291,7 @@ function SCORMapi() {
|
||||||
} else {
|
} else {
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
errorCode = "0";
|
errorCode = "0";
|
||||||
cmi.core.total_time = AddTime(cmi.core.total_time, cmi.core.session_time);
|
|
||||||
//top.alert(cmi.core.total_time);
|
|
||||||
if (<?php echo $navObj ?>cmi.document.theform) {
|
|
||||||
cmiform = <?php echo $navObj ?>cmi.document.forms[0];
|
|
||||||
cmiform.scoid.value = "<?php echo $sco->id; ?>";
|
|
||||||
cmiform.cmi_core_total_time.value = cmi.core.total_time;
|
|
||||||
cmiform.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
if (nav.event != "") {
|
if (nav.event != "") {
|
||||||
<?php
|
<?php
|
||||||
if ($sco != $last) {
|
if ($sco != $last) {
|
||||||
|
@ -344,19 +336,13 @@ function SCORMapi() {
|
||||||
var change = 0;
|
var change = 0;
|
||||||
|
|
||||||
var secs = (Math.round((parseFloat(sFirst[2],10)+parseFloat(sSecond[2],10))*100))/100; //Seconds
|
var secs = (Math.round((parseFloat(sFirst[2],10)+parseFloat(sSecond[2],10))*100))/100; //Seconds
|
||||||
if (secs > 60) {
|
change = Math.floor(secs / 60);
|
||||||
secs = secs - 60;
|
secs = secs - (change * 60);
|
||||||
change = 1;
|
|
||||||
} else {
|
|
||||||
change = 0;
|
|
||||||
}
|
|
||||||
if (Math.floor(secs) < 10) secs = "0" + secs.toString();
|
if (Math.floor(secs) < 10) secs = "0" + secs.toString();
|
||||||
|
|
||||||
mins = parseInt(sFirst[1],10)+parseInt(sSecond[1],10)+change; //Minutes
|
mins = parseInt(sFirst[1],10)+parseInt(sSecond[1],10)+change; //Minutes
|
||||||
if (mins > 60)
|
change = Math.floor(mins / 60);
|
||||||
change = 1;
|
mins = mins - (change * 60);
|
||||||
else
|
|
||||||
change = 0;
|
|
||||||
if (mins < 10) mins = "0" + mins.toString();
|
if (mins < 10) mins = "0" + mins.toString();
|
||||||
|
|
||||||
hours = parseInt(sFirst[0],10)+parseInt(sSecond[0],10)+change; //Hours
|
hours = parseInt(sFirst[0],10)+parseInt(sSecond[0],10)+change; //Hours
|
||||||
|
@ -365,6 +351,21 @@ function SCORMapi() {
|
||||||
return hours + ":" + mins + ":" + secs;
|
return hours + ":" + mins + ":" + secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SaveTotalTime() {
|
||||||
|
cmi.core.total_time = AddTime(cmi.core.total_time, cmi.core.session_time);
|
||||||
|
//top.alert(cmi.core.total_time);
|
||||||
|
if (<?php echo $navObj ?>cmi.document.forms[0]) {
|
||||||
|
cmiform = <?php echo $navObj ?>cmi.document.forms[0];
|
||||||
|
cmiform.reset();
|
||||||
|
cmiform.scoid.value = "<?php echo $sco->id; ?>";
|
||||||
|
cmiform.cmi_core_total_time.value = cmi.core.total_time;
|
||||||
|
cmiform.submit();
|
||||||
|
//top.alert(cmi.core.total_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.SaveTotalTime = SaveTotalTime;
|
||||||
|
|
||||||
this.LMSInitialize = LMSInitialize;
|
this.LMSInitialize = LMSInitialize;
|
||||||
this.LMSGetValue = LMSGetValue;
|
this.LMSGetValue = LMSGetValue;
|
||||||
this.LMSSetValue = LMSSetValue;
|
this.LMSSetValue = LMSSetValue;
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
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("MAXGRADE",4,false,$scorm->reference));
|
||||||
|
fwrite ($bf,full_tag("GRADEMETHOD",4,false,$scorm->reference));
|
||||||
fwrite ($bf,full_tag("DATADIR",4,false,$scorm->datadir));
|
fwrite ($bf,full_tag("DATADIR",4,false,$scorm->datadir));
|
||||||
fwrite ($bf,full_tag("LAUNCH",4,false,$scorm->launch));
|
fwrite ($bf,full_tag("LAUNCH",4,false,$scorm->launch));
|
||||||
fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary));
|
fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary));
|
||||||
|
@ -87,11 +89,14 @@
|
||||||
$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("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("TYPE",6,false,$sco->type));
|
fwrite ($bf,full_tag("TYPE",6,false,$sco->type));
|
||||||
fwrite ($bf,full_tag("TITLE",6,false,$sco->title));
|
fwrite ($bf,full_tag("TITLE",6,false,$sco->title));
|
||||||
|
fwrite ($bf,full_tag("DATAFROMLMS",6,false,$sco->datafromlms));
|
||||||
fwrite ($bf,full_tag("NEXT",6,false,$sco->next));
|
fwrite ($bf,full_tag("NEXT",6,false,$sco->next));
|
||||||
fwrite ($bf,full_tag("PREVIOUS",6,false,$sco->previous));
|
fwrite ($bf,full_tag("PREVIOUS",6,false,$sco->previous));
|
||||||
//End sco
|
//End sco
|
||||||
|
@ -130,7 +135,6 @@
|
||||||
fwrite ($bf,full_tag("CMI_CORE_SESSION_TIME",6,false,$sco_user->cmi_core_session_time));
|
fwrite ($bf,full_tag("CMI_CORE_SESSION_TIME",6,false,$sco_user->cmi_core_session_time));
|
||||||
fwrite ($bf,full_tag("CMI_CORE_SCORE_RAW",6,false,$sco_user->cmi_core_score_raw));
|
fwrite ($bf,full_tag("CMI_CORE_SCORE_RAW",6,false,$sco_user->cmi_core_score_raw));
|
||||||
fwrite ($bf,full_tag("CMI_SUSPEND_DATA",6,false,$sco_user->cmi_suspend_data));
|
fwrite ($bf,full_tag("CMI_SUSPEND_DATA",6,false,$sco_user->cmi_suspend_data));
|
||||||
fwrite ($bf,full_tag("CMI_LAUNCH_DATA",6,false,$sco_user->cmi_launch_data));
|
|
||||||
//End sco
|
//End sco
|
||||||
$status =fwrite ($bf,end_tag("SCO_USER",5,true));
|
$status =fwrite ($bf,end_tag("SCO_USER",5,true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,61 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("../../config.php");
|
require_once('../../config.php');
|
||||||
require_once("lib.php");
|
require_once('lib.php');
|
||||||
|
|
||||||
optional_variable($id); // Course Module ID, or
|
optional_variable($id); // Course Module ID, or
|
||||||
optional_variable($a); // scorm ID
|
optional_variable($a); // scorm ID
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
if (! $cm = get_record('course_modules', 'id', $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 (! $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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require_login($course->id);
|
require_login($course->id);
|
||||||
|
if (!empty($_POST['scoid'])) {
|
||||||
if (!empty($_POST["scoid"])) {
|
//echo 'scoid: '.$_POST['scoid']."\n";
|
||||||
if (!empty($_POST["cmi_core_lesson_location"])) {
|
if (!empty($_POST['cmi_core_lesson_location'])) {
|
||||||
set_field("scorm_sco_users","cmi_core_lesson_location",$_POST["cmi_core_lesson_location"],"scoid",$_POST["scoid"],"userid",$USER->id);
|
set_field('scorm_sco_users','cmi_core_lesson_location',$_POST['cmi_core_lesson_location'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
||||||
|
//echo 'cmi_core_lesson_location: '.$_POST['cmi_core_lesson_location']."\n";
|
||||||
}
|
}
|
||||||
if (!empty($_POST["cmi_core_lesson_status"])) {
|
if (!empty($_POST['cmi_core_lesson_status'])) {
|
||||||
set_field("scorm_sco_users","cmi_core_lesson_status",$_POST["cmi_core_lesson_status"],"scoid",$_POST["scoid"],"userid",$USER->id);
|
set_field('scorm_sco_users','cmi_core_lesson_status',$_POST['cmi_core_lesson_status'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
||||||
|
//echo 'cmi_core_lesson_status: '.$_POST['cmi_core_lesson_status']."\n";
|
||||||
}
|
}
|
||||||
if (!empty($_POST["cmi_core_exit"])) {
|
if (!empty($_POST['cmi_core_exit'])) {
|
||||||
set_field("scorm_sco_users","cmi_core_exit",$_POST["cmi_core_exit"],"scoid",$_POST["scoid"],"userid",$USER->id);
|
set_field('scorm_sco_users','cmi_core_exit',$_POST['cmi_core_exit'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
||||||
|
//echo 'cmi_core_exit: '.$_POST['cmi_core_exit']."\n";
|
||||||
}
|
}
|
||||||
if (!empty($_POST["cmi_core_total_time"])) {
|
if (!empty($_POST['cmi_core_score_raw'])) {
|
||||||
set_field("scorm_sco_users","cmi_core_total_time",$_POST["cmi_core_total_time"],"scoid",$_POST["scoid"],"userid",$USER->id);
|
set_field('scorm_sco_users','cmi_core_score_raw',$_POST['cmi_core_score_raw'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
||||||
|
//echo 'cmi_core_score_raw: '.$_POST['cmi_core_score_raw']."\n";
|
||||||
}
|
}
|
||||||
if (!empty($_POST["cmi_core_score_raw"])) {
|
if (!empty($_POST['cmi_suspend_data'])) {
|
||||||
set_field("scorm_sco_users","cmi_core_score_raw",$_POST["cmi_core_score_raw"],"scoid",$_POST["scoid"],"userid",$USER->id);
|
set_field('scorm_sco_users','cmi_suspend_data',$_POST['cmi_suspend_data'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
||||||
|
//echo 'cmi_suspend_data: '.$_POST['cmi_suspend_data']."\n";
|
||||||
}
|
}
|
||||||
if (!empty($_POST["cmi_suspend_data"])) {
|
if (!empty($_POST['cmi_core_total_time'])) {
|
||||||
set_field("scorm_sco_users","cmi_suspend_data",$_POST["cmi_suspend_data"],"scoid",$_POST["scoid"],"userid",$USER->id);
|
set_field('scorm_sco_users','cmi_core_total_time',$_POST['cmi_core_total_time'],'scoid',$_POST['scoid'],'userid',$USER->id);
|
||||||
|
//echo 'cmi_core_total_time: '.$_POST['cmi_core_total_time']."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -63,10 +69,10 @@
|
||||||
<input type="hidden" name="cmi_core_lesson_location" />
|
<input type="hidden" name="cmi_core_lesson_location" />
|
||||||
<input type="hidden" name="cmi_core_lesson_status" />
|
<input type="hidden" name="cmi_core_lesson_status" />
|
||||||
<input type="hidden" name="cmi_core_exit" />
|
<input type="hidden" name="cmi_core_exit" />
|
||||||
<input type="hidden" name="cmi_core_session_time" />
|
|
||||||
<input type="hidden" name="cmi_core_total_time" />
|
<input type="hidden" name="cmi_core_total_time" />
|
||||||
<input type="hidden" name="cmi_core_score_raw" />
|
<input type="hidden" name="cmi_core_score_raw" />
|
||||||
<input type="hidden" name="cmi_suspend_data" />
|
<input type="hidden" name="cmi_suspend_data" />
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -2,17 +2,36 @@
|
||||||
|
|
||||||
<table cellpadding=9 cellspacing=0 >
|
<table cellpadding=9 cellspacing=0 >
|
||||||
<tr valign=top>
|
<tr valign=top>
|
||||||
<td align=right><p>scorm_framesize:</td>
|
<td align=right><p>scorm_validate:</td>
|
||||||
<td>
|
<td>
|
||||||
<input name=scorm_framesize type=text size=5 value="<?php p($CFG->scorm_framesize) ?>">
|
<?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>
|
||||||
|
<td align=right><p>scorm_framesize:</td>
|
||||||
|
<td>
|
||||||
|
<input name=scorm_framesize type=text size=5 value="<?php p($CFG->scorm_framesize) ?>">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php print_string("configframesize", "scorm") ?>
|
<?php print_string("configframesize", "scorm") ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr valign=top>
|
<tr valign=top>
|
||||||
<td align=right><p>scorm_popup:</td>
|
<td align=right><p>scorm_popup:</td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
unset($choices);
|
unset($choices);
|
||||||
$choices[""] = get_string("no");
|
$choices[""] = get_string("no");
|
||||||
|
@ -43,7 +62,8 @@
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=3 align=center>
|
<td colspan=3 align=center>
|
||||||
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
<input type="submit" value="<?php print_string("savechanges") ?>">
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,14 @@ function scorm_upgrade($oldversion) {
|
||||||
table_column("scorm_scoes", "", "datafromlms", "TEXT", "", "", "", "NOT NULL", "title");
|
table_column("scorm_scoes", "", "datafromlms", "TEXT", "", "", "", "NOT NULL", "title");
|
||||||
modify_database("", "ALTER TABLE `{$CFG->prefix}scorm_sco_users` DROP `cmi_launch_data`;");
|
modify_database("", "ALTER TABLE `{$CFG->prefix}scorm_sco_users` DROP `cmi_launch_data`;");
|
||||||
}
|
}
|
||||||
|
if ($oldversion < 2004071700) {
|
||||||
|
table_column("scorm_scoes", "", "manifest", "VARCHAR", "255", "", "", "NOT NULL", "scorm");
|
||||||
|
table_column("scorm_scoes", "", "organization", "VARCHAR", "255", "", "", "NOT NULL", "manifest");
|
||||||
|
}
|
||||||
|
if ($oldversion < 2004071900) {
|
||||||
|
table_column("scorm", "", "maxgrade", "FLOAT", "3", "", "0", "NOT NULL", "reference");
|
||||||
|
table_column("scorm", "", "grademethod", "TINYINT", "2", "", "0", "NOT NULL", "maxgrade");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ CREATE TABLE prefix_scorm (
|
||||||
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 '',
|
||||||
reference varchar(255) NOT NULL default '',
|
reference varchar(255) NOT NULL default '',
|
||||||
|
maxgrade float(3) NOT NULL default '0',
|
||||||
|
grademethod tinyint(2) NOT NULL default '0',
|
||||||
datadir varchar(255) NOT NULL default '',
|
datadir varchar(255) NOT NULL default '',
|
||||||
launch int(10) unsigned NOT NULL default 0,
|
launch int(10) unsigned NOT NULL default 0,
|
||||||
summary text NOT NULL,
|
summary text NOT NULL,
|
||||||
|
@ -20,6 +22,8 @@ CREATE TABLE prefix_scorm (
|
||||||
CREATE TABLE prefix_scorm_scoes (
|
CREATE TABLE prefix_scorm_scoes (
|
||||||
id int(10) unsigned NOT NULL auto_increment,
|
id int(10) unsigned NOT NULL auto_increment,
|
||||||
scorm int(10) unsigned NOT NULL default '0',
|
scorm int(10) unsigned NOT NULL default '0',
|
||||||
|
manifest 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 '',
|
||||||
|
|
|
@ -18,6 +18,14 @@ function scorm_upgrade($oldversion) {
|
||||||
table_column("scorm_scoes", "", "datafromlms", "TEXT", "", "", "", "NOT NULL", "title");
|
table_column("scorm_scoes", "", "datafromlms", "TEXT", "", "", "", "NOT NULL", "title");
|
||||||
modify_database("", "ALTER TABLE `{$CFG->prefix}scorm_sco_users` DROP `cmi_launch_data`;");
|
modify_database("", "ALTER TABLE `{$CFG->prefix}scorm_sco_users` DROP `cmi_launch_data`;");
|
||||||
}
|
}
|
||||||
|
if ($oldversion < 2004071700) {
|
||||||
|
table_column("scorm_scoes", "", "manifest", "VARCHAR", "255", "", "", "NOT NULL", "scorm");
|
||||||
|
table_column("scorm_scoes", "", "organization", "VARCHAR", "255", "", "", "NOT NULL", "manifest");
|
||||||
|
}
|
||||||
|
if ($oldversion < 2004071900) {
|
||||||
|
table_column("scorm", "", "maxgrade", "real", "3", "", "0", "NOT NULL", "reference");
|
||||||
|
table_column("scorm", "", "grademethod", "integer", "", "", "0", "NOT NULL", "maxgrade");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ CREATE TABLE prefix_scorm (
|
||||||
course integer NOT NULL default '0',
|
course integer NOT NULL default '0',
|
||||||
name varchar(255) NOT NULL default '',
|
name varchar(255) NOT NULL default '',
|
||||||
reference varchar(255) NOT NULL default '',
|
reference varchar(255) NOT NULL default '',
|
||||||
|
maxgrade real NOT NULL default '0',
|
||||||
|
grademethod integer NOT NULL default '0',
|
||||||
datadir varchar(255) NOT NULL default '',
|
datadir varchar(255) NOT NULL default '',
|
||||||
launch integer NOT NULL default '0',
|
launch integer NOT NULL default '0',
|
||||||
summary text NOT NULL default '',
|
summary text NOT NULL default '',
|
||||||
|
@ -18,6 +20,8 @@ CREATE TABLE prefix_scorm (
|
||||||
CREATE TABLE prefix_scorm_scoes (
|
CREATE TABLE prefix_scorm_scoes (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
scorm integer NOT NULL default '0',
|
scorm integer NOT NULL default '0',
|
||||||
|
manifest 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 '',
|
||||||
|
|
|
@ -53,10 +53,12 @@
|
||||||
$result = "datadir";
|
$result = "datadir";
|
||||||
}
|
}
|
||||||
$errorlogs = '';
|
$errorlogs = '';
|
||||||
if ($result != "regular") {
|
if (($result != "regular") && ($result != "found")) {
|
||||||
/*foreach ($error_array as $errormsg) {
|
if ($CFG->scorm_validate == 'domxml') {
|
||||||
$errorlogs .= get_string($errormsg->type,"scorm",$errormsg->data) . "\n";
|
foreach ($errors as $error) {
|
||||||
}*/
|
$errorlogs .= get_string($error->type,"scorm",$error->data) . ".\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Delete files and temporary directory
|
// Delete files and temporary directory
|
||||||
//
|
//
|
||||||
|
@ -83,16 +85,25 @@
|
||||||
echo " <tr><td align=\"right\" nowrap><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n";
|
echo " <tr><td align=\"right\" nowrap><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n";
|
||||||
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n";
|
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n";
|
||||||
if ($errorlogs != '') {
|
if ($errorlogs != '') {
|
||||||
//$lines = round(count($error_array)/4);
|
$lines = round(count($errors)/4);
|
||||||
//echo " <tr><td align=\"right\" nowrap><p><b>".get_string("errorlogs","scorm").":</b></p></td><td><textarea rows=\"".$lines."\" readonly>".$errorlogs."</textarea></a></td></tr>\n";
|
if ($lines < 5) {
|
||||||
|
$lines = 5;
|
||||||
|
}
|
||||||
|
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("errorlogs","scorm").":</b></p></td><td><textarea rows=\"".$lines."\" cols=\"30\" readonly>".$errorlogs."</textarea></a></td></tr>\n";
|
||||||
}
|
}
|
||||||
if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance)))
|
if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance)))
|
||||||
echo " <tr><td align=\"center\" colspan=\"2\" nowrap><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n";
|
echo " <tr><td align=\"center\" colspan=\"2\" nowrap><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
if ($result == "regular") {
|
if (($result == "regular") || ($result == "found")){
|
||||||
if (empty($form->auto)) {
|
if (empty($form->auto)) {
|
||||||
$form->auto = "";
|
$form->auto = "";
|
||||||
}
|
}
|
||||||
|
if (empty($form->maxgrade)) {
|
||||||
|
$form->maxgrade = "";
|
||||||
|
}
|
||||||
|
if (empty($form->grademethod)) {
|
||||||
|
$form->grademethod = "0";
|
||||||
|
}
|
||||||
echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
|
echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
|
||||||
|
|
||||||
//$form->popup = $CFG->scorm_popup;
|
//$form->popup = $CFG->scorm_popup;
|
||||||
|
@ -139,12 +150,39 @@
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<table cellpadding="5" align="center">
|
<table cellpadding="5" align="center">
|
||||||
|
<tr valign=top>
|
||||||
|
<td align=right><p><b><?php print_string("grademethod", "scorm") ?>:</b></p></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$options = array();
|
||||||
|
$options[0] = get_string("gradescoes", "scorm");
|
||||||
|
$options[1] = get_string("gradehighest", "scorm");
|
||||||
|
$options[2] = get_string("gradeaverage", "scorm");
|
||||||
|
choose_from_menu($SCORM_GRADE_METHOD, "grademethod", "$form->grademethod", "");
|
||||||
|
helpbutton("grademethod", get_string("grademethod","scorm"), "scorm");
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr valign=top>
|
||||||
|
<td align=right><p><b><?php print_string("maximumgrade") ?>:</b></p></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
for ($i=100; $i>=1; $i--) {
|
||||||
|
$grades[$i] = $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
choose_from_menu($grades, "maxgrade", "$form->maxgrade", "");
|
||||||
|
helpbutton("maxgrade", get_string("maximumgrade"), "scorm");
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr valign=top>
|
<tr valign=top>
|
||||||
<td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
|
<td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$options[]=get_string("no");
|
$options = array();
|
||||||
$options[]=get_string("yes");
|
$options[0]=get_string("no");
|
||||||
|
$options[1]=get_string("yes");
|
||||||
choose_from_menu ($options, "auto", $form->auto);
|
choose_from_menu ($options, "auto", $form->auto);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -3,27 +3,46 @@
|
||||||
/// Library of functions and constants for module scorm
|
/// Library of functions and constants for module scorm
|
||||||
/// (replace scorm with the name of your module and delete this line)
|
/// (replace scorm with the name of your module and delete this line)
|
||||||
|
|
||||||
$SCORM_WINDOW_OPTIONS = array("resizable", "scrollbars", "status", "height", "width");
|
define('VALUESCOES', '0');
|
||||||
|
define('VALUEHIGHEST', '1');
|
||||||
|
define('VALUEAVERAGE', '2');
|
||||||
|
define('VALUESUM', '3');
|
||||||
|
$SCORM_GRADE_METHOD = array (VALUESCOES => get_string("gradescoes", "scorm"),
|
||||||
|
VALUEHIGHEST => get_string("gradehighest", "scorm"),
|
||||||
|
VALUEAVERAGE => get_string("gradeaverage", "scorm"),
|
||||||
|
VALUESUM => get_string("gradesum", "scorm"));
|
||||||
|
|
||||||
|
$SCORM_WINDOW_OPTIONS = array('resizable', 'scrollbars', 'status', 'height', 'width');
|
||||||
|
|
||||||
if (!isset($CFG->scorm_popup)) {
|
if (!isset($CFG->scorm_popup)) {
|
||||||
set_config("scorm_popup", "");
|
set_config('scorm_popup', '');
|
||||||
}
|
}
|
||||||
|
if (!isset($CFG->scorm_validate)) {
|
||||||
|
$scorm_validate = 'none';
|
||||||
|
if (extension_loaded('domxml')) {
|
||||||
|
$scorm_validate = 'domxml';
|
||||||
|
}
|
||||||
|
if (version_compare(phpversion(),'5.0.0','>=')) {
|
||||||
|
$scorm_validate = 'php5';
|
||||||
|
}
|
||||||
|
set_config('scorm_validate', $scorm_validate);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($SCORM_WINDOW_OPTIONS as $popupoption) {
|
foreach ($SCORM_WINDOW_OPTIONS as $popupoption) {
|
||||||
$popupoption = "scorm_popup$popupoption";
|
$popupoption = "scorm_popup$popupoption";
|
||||||
if (!isset($CFG->$popupoption)) {
|
if (!isset($CFG->$popupoption)) {
|
||||||
if ($popupoption == "scorm_popupheight") {
|
if ($popupoption == 'scorm_popupheight') {
|
||||||
set_config($popupoption, 450);
|
set_config($popupoption, 450);
|
||||||
} else if ($popupoption == "scorm_popupwidth") {
|
} else if ($popupoption == 'scorm_popupwidth') {
|
||||||
set_config($popupoption, 620);
|
set_config($popupoption, 620);
|
||||||
} else {
|
} else {
|
||||||
set_config($popupoption, "checked");
|
set_config($popupoption, 'checked');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($CFG->scorm_framesize)) {
|
if (!isset($CFG->scorm_framesize)) {
|
||||||
set_config("scorm_framesize", 140);
|
set_config('scorm_framesize', 140);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scorm_add_instance($scorm) {
|
function scorm_add_instance($scorm) {
|
||||||
|
@ -37,23 +56,23 @@ function scorm_add_instance($scorm) {
|
||||||
# May have to add extra stuff in here #
|
# May have to add extra stuff in here #
|
||||||
global $SCORM_WINDOW_OPTIONS;
|
global $SCORM_WINDOW_OPTIONS;
|
||||||
|
|
||||||
$scorm->popup = "";
|
$scorm->popup = '';
|
||||||
|
|
||||||
$optionlist = array();
|
$optionlist = array();
|
||||||
foreach ($SCORM_WINDOW_OPTIONS as $option) {
|
foreach ($SCORM_WINDOW_OPTIONS as $option) {
|
||||||
if (isset($scorm->$option)) {
|
if (isset($scorm->$option)) {
|
||||||
$optionlist[] = $option."=".$scorm->$option;
|
$optionlist[] = $option.'='.$scorm->$option;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$scorm->popup = implode(',', $optionlist);
|
$scorm->popup = implode(',', $optionlist);
|
||||||
|
|
||||||
|
|
||||||
if ($scorm->popup != "") {
|
if ($scorm->popup != '') {
|
||||||
$scorm->popup .= ',location=0,menubar=0,toolbar=0';
|
$scorm->popup .= ',location=0,menubar=0,toolbar=0';
|
||||||
$scorm->auto = '0';
|
$scorm->auto = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return insert_record("scorm", $scorm);
|
return insert_record('scorm', $scorm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,21 +87,21 @@ function scorm_update_instance($scorm) {
|
||||||
# May have to add extra stuff in here #
|
# May have to add extra stuff in here #
|
||||||
global $SCORM_WINDOW_OPTIONS;
|
global $SCORM_WINDOW_OPTIONS;
|
||||||
|
|
||||||
$scorm->popup = "";
|
$scorm->popup = '';
|
||||||
|
|
||||||
$optionlist = array();
|
$optionlist = array();
|
||||||
foreach ($SCORM_WINDOW_OPTIONS as $option) {
|
foreach ($SCORM_WINDOW_OPTIONS as $option) {
|
||||||
if (isset($scorm->$option)) {
|
if (isset($scorm->$option)) {
|
||||||
$optionlist[] = $option."=".$scorm->$option;
|
$optionlist[] = $option.'='.$scorm->$option;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$scorm->popup = implode(',', $optionlist);
|
$scorm->popup = implode(',', $optionlist);
|
||||||
|
|
||||||
if ($scorm->popup != "") {
|
if ($scorm->popup != '') {
|
||||||
$scorm->popup .= ',location=0,menubar=0,toolbar=0';
|
$scorm->popup .= ',location=0,menubar=0,toolbar=0';
|
||||||
$scorm->auto = '0';
|
$scorm->auto = '0';
|
||||||
}
|
}
|
||||||
return update_record("scorm", $scorm);
|
return update_record('scorm', $scorm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,23 +112,23 @@ function scorm_delete_instance($id) {
|
||||||
|
|
||||||
require('../config.php');
|
require('../config.php');
|
||||||
|
|
||||||
if (! $scorm = get_record("scorm", "id", "$id")) {
|
if (! $scorm = get_record('scorm', 'id', $id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
# Delete any dependent files #
|
# Delete any dependent files #
|
||||||
scorm_delete_files($CFG->dataroot."/".$scorm->course."/moddata/scorm".$scorm->datadir);
|
scorm_delete_files($CFG->dataroot.'/'.$scorm->course.'/moddata/scorm'.$scorm->datadir);
|
||||||
|
|
||||||
# Delete any dependent records here #
|
# Delete any dependent records here #
|
||||||
if (! delete_records("scorm_sco_users", "scormid", "$scorm->id")) {
|
if (! delete_records('scorm_sco_users', 'scormid', $scorm->id)) {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
if (! delete_records("scorm_scoes", "scorm", "$scorm->id")) {
|
if (! delete_records('scorm_scoes', 'scorm', $scorm->id)) {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
if (! delete_records("scorm", "id", "$scorm->id")) {
|
if (! delete_records('scorm', 'id', $scorm->id)) {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,44 +182,84 @@ function scorm_grades($scormid) {
|
||||||
|
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
if (!$return->maxgrade = count_records_select("scorm_scoes","scorm='$scormid' AND launch<>''")) {
|
if (!$scorm = get_record("scorm", "id", $scormid)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$return->grades = NULL;
|
if ($scorm->grademethod == VALUESCOES) {
|
||||||
if ($sco_users=get_records_select("scorm_sco_users", "scormid='$scormid' GROUP BY userid")) {
|
if (!$return->maxgrade = count_records_select('scorm_scoes',"scorm='$scormid' AND launch<>''")) {
|
||||||
foreach ($sco_users as $sco_user) {
|
return NULL;
|
||||||
$user_data=get_records_select("scorm_sco_users","scormid='$scormid' AND userid='$sco_user->userid'");
|
}
|
||||||
$scores->completed=0;
|
|
||||||
$scores->browsed=0;
|
$return->grades = NULL;
|
||||||
$scores->incomplete=0;
|
if ($sco_users=get_records_select('scorm_sco_users', "scormid='$scormid' GROUP BY userid")) {
|
||||||
$scores->failed=0;
|
foreach ($sco_users as $sco_user) {
|
||||||
$scores->notattempted=0;
|
$user_data=get_records_select('scorm_sco_users',"scormid='$scormid' AND userid='$sco_user->userid'");
|
||||||
$result="";
|
$scores->completed=0;
|
||||||
$data = current($user_data);
|
$scores->browsed=0;
|
||||||
foreach ($user_data as $data) {
|
$scores->incomplete=0;
|
||||||
if ($data->cmi_core_lesson_status=="passed")
|
$scores->failed=0;
|
||||||
$scores->completed++;
|
$scores->notattempted=0;
|
||||||
else
|
$result='';
|
||||||
$scores->{scorm_remove_spaces($data->cmi_core_lesson_status)}++;
|
$data = current($user_data);
|
||||||
|
foreach ($user_data as $data) {
|
||||||
}
|
if ($data->cmi_core_lesson_status=='passed')
|
||||||
if ($scores->completed)
|
$scores->completed++;
|
||||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/completed.gif\" alt=\"".get_string("completed","scorm")."\" title=\"".get_string("completed","scorm")."\"> $scores->completed ";
|
else
|
||||||
if ($scores->incomplete)
|
$scores->{scorm_remove_spaces($data->cmi_core_lesson_status)}++;
|
||||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/incomplete.gif\" alt=\"".get_string("incomplete","scorm")."\" title=\"".get_string("incomplete","scorm")."\"> $scores->incomplete ";
|
}
|
||||||
if ($scores->failed)
|
if ($scores->completed)
|
||||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/failed.gif\" alt=\"".get_string("failed","scorm")."\" title=\"".get_string("failed","scorm")."\"> $scores->failed ";
|
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/completed.gif\" alt=\"".get_string('completed','scorm')."\" title=\"".get_string('completed','scorm')."\"> $scores->completed ";
|
||||||
if ($scores->browsed)
|
if ($scores->incomplete)
|
||||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/browsed.gif\" alt=\"".get_string("browsed","scorm")."\" title=\"".get_string("browsed","scorm")."\"> $scores->browsed ";
|
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/incomplete.gif\" alt=\"".get_string('incomplete','scorm')."\" title=\"".get_string('incomplete','scorm')."\"> $scores->incomplete ";
|
||||||
if ($scores->notattempted)
|
if ($scores->failed)
|
||||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" title=\"".get_string("notattempted","scorm")."\"> $scores->notattempted ";
|
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/failed.gif\" alt=\"".get_string('failed','scorm')."\" title=\"".get_string('failed','scorm')."\"> $scores->failed ";
|
||||||
|
if ($scores->browsed)
|
||||||
|
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/browsed.gif\" alt=\"".get_string('browsed','scorm')."\" title=\"".get_string('browsed','scorm')."\"> $scores->browsed ";
|
||||||
|
if ($scores->notattempted)
|
||||||
|
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/notattempted.gif\" alt=\"".get_string('notattempted','scorm')."\" title=\"".get_string('notattempted','scorm')."\"> $scores->notattempted ";
|
||||||
|
|
||||||
$return->grades[$sco_user->userid]=$result;
|
$return->grades[$sco_user->userid]=$result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$grades = get_records_select("scorm_sco_users", "scormid=$scormid AND cmi_core_score_raw>0","","id,userid,cmi_core_score_raw");
|
||||||
|
//$grades = get_records_menu("scorm_sco_users", "scormid",$scormid,"","userid,cmi_core_score_raw");
|
||||||
|
$valutations = array();
|
||||||
|
foreach ($grades as $grade) {
|
||||||
|
if (!isset($valutations[$grade->userid])) {
|
||||||
|
if ($scorm->grademethod == VALUEAVERAGE) {
|
||||||
|
$values = array();
|
||||||
|
$values[$grade->userid]->grade = 0;
|
||||||
|
$values[$grade->userid]->values = 0;
|
||||||
|
}
|
||||||
|
$valutations[$grade->userid] = 0;
|
||||||
|
}
|
||||||
|
switch ($scorm->grademethod) {
|
||||||
|
case VALUEHIGHEST:
|
||||||
|
if ($grade->cmi_core_score_raw > $valutations[$grade->userid]) {
|
||||||
|
$valutations[$grade->userid] = $grade->cmi_core_score_raw;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VALUEAVERAGE:
|
||||||
|
$values[$grade->userid]->grade += $grade->cmi_core_score_raw;
|
||||||
|
$values[$grade->userid]->values++;
|
||||||
|
break;
|
||||||
|
case VALUESUM:
|
||||||
|
$valutations[$grade->userid] += $grade->cmi_core_score_raw;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($scorm->grademethod == VALUEAVERAGE) {
|
||||||
|
foreach($values as $userid => $value) {
|
||||||
|
$valutations[$userid] = $value->grade/$value->values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//print_r($grades);
|
||||||
|
$return->grades = $valutations;
|
||||||
|
$return->maxgrade = $scorm->maxgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,12 +269,13 @@ function scorm_grades($scormid) {
|
||||||
/// starts with scorm_
|
/// starts with scorm_
|
||||||
|
|
||||||
|
|
||||||
function scorm_randstring($len = "8")
|
function scorm_randstring($len = '8')
|
||||||
{
|
{
|
||||||
$rstring = NULL;
|
$rstring = NULL;
|
||||||
|
$lchar = '';
|
||||||
for($i=0; $i<$len; $i++) {
|
for($i=0; $i<$len; $i++) {
|
||||||
$char = chr(rand(48,122));
|
$char = chr(rand(48,122));
|
||||||
while (!ereg("[a-zA-Z0-9]", $char)){
|
while (!ereg('[a-zA-Z0-9]', $char)){
|
||||||
if($char == $lchar) continue;
|
if($char == $lchar) continue;
|
||||||
$char = chr(rand(48,90));
|
$char = chr(rand(48,90));
|
||||||
}
|
}
|
||||||
|
@ -226,16 +286,16 @@ function scorm_randstring($len = "8")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function scorm_datadir($strPath, $existingdir="", $prefix = "SCORM")
|
function scorm_datadir($strPath, $existingdir='', $prefix = 'SCORM')
|
||||||
{
|
{
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
if (($existingdir!="") && (is_dir($strPath.$existingdir)))
|
if (($existingdir!='') && (is_dir($strPath.$existingdir)))
|
||||||
return $strPath.$existingdir;
|
return $strPath.$existingdir;
|
||||||
|
|
||||||
if (is_dir($strPath)) {
|
if (is_dir($strPath)) {
|
||||||
do {
|
do {
|
||||||
$datadir="/".$prefix.scorm_randstring();
|
$datadir='/'.$prefix.scorm_randstring();
|
||||||
} while (file_exists($strPath.$datadir));
|
} while (file_exists($strPath.$datadir));
|
||||||
mkdir($strPath.$datadir, $CFG->directorypermissions);
|
mkdir($strPath.$datadir, $CFG->directorypermissions);
|
||||||
@chmod($strPath.$datadir, $CFG->directorypermissions); // Just in case mkdir didn't do it
|
@chmod($strPath.$datadir, $CFG->directorypermissions); // Just in case mkdir didn't do it
|
||||||
|
@ -245,15 +305,64 @@ function scorm_datadir($strPath, $existingdir="", $prefix = "SCORM")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($CFG->scorm_validate == 'domxml') {
|
||||||
|
require_once('validatordomxml.php');
|
||||||
|
}
|
||||||
|
|
||||||
function scorm_validate($manifest)
|
function scorm_validate($manifest)
|
||||||
{
|
{
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
|
global $item_idref_array;
|
||||||
|
global $idres_array;
|
||||||
|
global $def_org_array;
|
||||||
|
global $id_org_array;
|
||||||
|
|
||||||
if (is_file ($manifest)) {
|
if (is_file ($manifest)) {
|
||||||
if (file_exists($manifest))
|
if (file_exists($manifest)) {
|
||||||
{
|
if ($CFG->scorm_validate == 'domxml') {
|
||||||
return "regular";
|
$manifest_string = file_get_contents($manifest);
|
||||||
}
|
|
||||||
|
/* Elimino i caratteri speciali di spaziatura e ritorno a capo dal file xml */
|
||||||
|
|
||||||
|
$spec = array('\n', '\r', '\t', '\0', '\x0B');
|
||||||
|
$content = str_replace($spec, '', $manifest_string);
|
||||||
|
|
||||||
|
if ($xmldoc = domxml_open_mem($content)) {
|
||||||
|
$root = $xmldoc->document_element();
|
||||||
|
if (!testRoot($root)) {
|
||||||
|
return 'syntax';
|
||||||
|
}
|
||||||
|
if (testNode($root)) {
|
||||||
|
// Nel corpo di questo if si controllano le corrispondenze fra gli attributi
|
||||||
|
// Nello Standard SCORM ad ogni attributo idRef di <item> deve corrispondere
|
||||||
|
// un attributo ID di <resource>
|
||||||
|
// Gli array degli attributi sono stati dichiarati globali in validator.php
|
||||||
|
// pertanto possono essere utilizzati direttamente all'interno di main.php
|
||||||
|
|
||||||
|
foreach($item_idref_array as $elem_it) {
|
||||||
|
if (array_search($elem_it, $idres_array) === false) {
|
||||||
|
return 'mismatch';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($def_org_array as $elem_def) {
|
||||||
|
if (array_search($elem_it, $id_org_array) === false) {
|
||||||
|
return 'mismatch';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return 'badmanifest';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'regular';
|
||||||
|
} else {
|
||||||
|
return 'found';
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return "nomanifest";
|
return 'nomanifest';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,53 +373,66 @@ function scorm_delete_files($directory)
|
||||||
$handle=opendir($directory);
|
$handle=opendir($directory);
|
||||||
while (($file = readdir($handle)) != '')
|
while (($file = readdir($handle)) != '')
|
||||||
{
|
{
|
||||||
if ($file != "." && $file != "..")
|
if ($file != '.' && $file != '..')
|
||||||
{
|
{
|
||||||
if (!is_dir($directory."/".$file))
|
if (!is_dir($directory.'/'.$file)) {
|
||||||
unlink($directory."/".$file);
|
//chmod($directory.'/'.$file,0777);
|
||||||
else
|
unlink($directory.'/'.$file);
|
||||||
scorm_delete_files($directory."/".$file);
|
} else {
|
||||||
}
|
scorm_delete_files($directory.'/'.$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rmdir($directory);
|
rmdir($directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scorm_startElement($parser, $name, $attrs) {
|
function scorm_startElement($parser, $name, $attrs) {
|
||||||
global $manifest,$i,$resources,$parent,$level;
|
global $scoes,$i,$resources,$parent,$level,$organization,$manifest,$defaultorg;
|
||||||
if ($name == "ITEM") {
|
if ($name == 'ITEM') {
|
||||||
$i++;
|
$i++;
|
||||||
$manifest[$i]["identifier"] = $attrs["IDENTIFIER"];
|
$scoes[$i]['manifest'] = $manifest;
|
||||||
if (empty($attrs["IDENTIFIERREF"]))
|
$scoes[$i]['organization'] = $organization;
|
||||||
$attrs["IDENTIFIERREF"] = "";
|
$scoes[$i]['identifier'] = $attrs['IDENTIFIER'];
|
||||||
$manifest[$i]["identifierref"] = $attrs["IDENTIFIERREF"];
|
if (empty($attrs['IDENTIFIERREF']))
|
||||||
if (empty($attrs["ISVISIBLE"]))
|
$attrs['IDENTIFIERREF'] = '';
|
||||||
$attrs["ISVISIBLE"] = "";
|
$scoes[$i]['identifierref'] = $attrs['IDENTIFIERREF'];
|
||||||
$manifest[$i]["isvisible"] = $attrs["ISVISIBLE"];
|
if (empty($attrs['ISVISIBLE']))
|
||||||
$manifest[$i]["parent"] = $parent[$level];
|
$attrs['ISVISIBLE'] = '';
|
||||||
|
$scoes[$i]['isvisible'] = $attrs['ISVISIBLE'];
|
||||||
|
$scoes[$i]['parent'] = $parent[$level];
|
||||||
$level++;
|
$level++;
|
||||||
$parent[$level] = $attrs["IDENTIFIER"];
|
$parent[$level] = $attrs['IDENTIFIER'];
|
||||||
}
|
}
|
||||||
if ($name == "RESOURCE") {
|
if ($name == 'RESOURCE') {
|
||||||
$resources[$attrs["IDENTIFIER"]]["href"]=$attrs["HREF"];
|
if (!isset($attrs['HREF'])) {
|
||||||
$resources[$attrs["IDENTIFIER"]]["type"]=$attrs["ADLCP:SCORMTYPE"];
|
$attrs['HREF'] = '';
|
||||||
|
}
|
||||||
|
$resources[$attrs['IDENTIFIER']]['href']=$attrs['HREF'];
|
||||||
|
$resources[$attrs['IDENTIFIER']]['type']=$attrs['ADLCP:SCORMTYPE'];
|
||||||
|
}
|
||||||
|
if ($name == 'ORGANIZATION') {
|
||||||
|
$organization = $attrs['IDENTIFIER'];
|
||||||
|
}
|
||||||
|
if ($name == 'MANIFEST') {
|
||||||
|
$manifest = $attrs['IDENTIFIER'];
|
||||||
|
}
|
||||||
|
if ($name == 'ORGANIZATIONS') {
|
||||||
|
$defaultorg = $attrs['DEFAULT'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scorm_endElement($parser, $name) {
|
function scorm_endElement($parser, $name) {
|
||||||
global $manifest,$i,$level,$datacontent,$navigation;
|
global $scoes,$i,$level,$datacontent,$navigation;
|
||||||
if ($name == "ITEM") {
|
if ($name == 'ITEM') {
|
||||||
$level--;
|
$level--;
|
||||||
}
|
}
|
||||||
if ($name == "TITLE" && $level>0) {
|
if ($name == 'TITLE' && $level>0)
|
||||||
$manifest[$i]["title"] = $datacontent;
|
$scoes[$i]['title'] = $datacontent;
|
||||||
}
|
if ($name == 'ADLCP:HIDERTSUI')
|
||||||
if ($name == "ADLCP:HIDERTSUI") {
|
$scoes[$i][$datacontent] = 1;
|
||||||
$manifest[$i][$datacontent] = 1;
|
if ($name == 'ADLCP:DATAFROMLMS')
|
||||||
}
|
$scoes[$i]['datafromlms'] = $datacontent;
|
||||||
if ($name == "ORGANIZATION") {
|
|
||||||
$level = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function scorm_characterData($parser, $data) {
|
function scorm_characterData($parser, $data) {
|
||||||
|
@ -319,26 +441,28 @@ function scorm_characterData($parser, $data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function scorm_parse($basedir,$file,$scorm_id) {
|
function scorm_parse($basedir,$file,$scorm_id) {
|
||||||
global $manifest,$i,$resources,$parent,$level;
|
global $scoes,$i,$resources,$parent,$level,$defaultorg;
|
||||||
$datacontent = "";
|
$datacontent = '';
|
||||||
$manifest[][] = "";
|
$scoes[][] = '';
|
||||||
$resources[] = "";
|
$resources[] = '';
|
||||||
|
$organization = '';
|
||||||
|
$defaultorg = '';
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$level = 0;
|
$level = 0;
|
||||||
$parent[$level] = "/";
|
$parent[$level] = '/';
|
||||||
|
|
||||||
$xml_parser = xml_parser_create();
|
$xml_parser = xml_parser_create();
|
||||||
// use case-folding so we are sure to find the tag in $map_array
|
// use case-folding so we are sure to find the tag in $map_array
|
||||||
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
|
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
|
||||||
xml_set_element_handler($xml_parser, "scorm_startElement", "scorm_endElement");
|
xml_set_element_handler($xml_parser, 'scorm_startElement', 'scorm_endElement');
|
||||||
xml_set_character_data_handler($xml_parser, "scorm_characterData");
|
xml_set_character_data_handler($xml_parser, 'scorm_characterData');
|
||||||
if (!($fp = fopen($basedir.$file, "r"))) {
|
if (!($fp = fopen($basedir.$file, 'r'))) {
|
||||||
die("could not open XML input");
|
die('could not open XML input');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($data = fread($fp, 4096)) {
|
while ($data = fread($fp, 4096)) {
|
||||||
if (!xml_parse($xml_parser, $data, feof($fp))) {
|
if (!xml_parse($xml_parser, $data, feof($fp))) {
|
||||||
die(sprintf("XML error: %s at line %d",
|
die(sprintf('XML error: %s at line %d',
|
||||||
xml_error_string(xml_get_error_code($xml_parser)),
|
xml_error_string(xml_get_error_code($xml_parser)),
|
||||||
xml_get_current_line_number($xml_parser)));
|
xml_get_current_line_number($xml_parser)));
|
||||||
}
|
}
|
||||||
|
@ -347,45 +471,62 @@ function scorm_parse($basedir,$file,$scorm_id) {
|
||||||
$launch = 0;
|
$launch = 0;
|
||||||
|
|
||||||
$sco->scorm = $scorm_id;
|
$sco->scorm = $scorm_id;
|
||||||
delete_records("scorm_scoes","scorm",$scorm_id);
|
delete_records('scorm_scoes','scorm',$scorm_id);
|
||||||
delete_records("scorm_sco_users","scormid",$scorm_id);
|
delete_records('scorm_sco_users','scormid',$scorm_id);
|
||||||
|
|
||||||
for ($j=1; $j<=$i; $j++) {
|
if (isset($scoes[1])) {
|
||||||
$sco->identifier = $manifest[$j]["identifier"];
|
for ($j=1; $j<=$i; $j++) {
|
||||||
$sco->parent = $manifest[$j]["parent"];
|
$sco->identifier = $scoes[$j]['identifier'];
|
||||||
$sco->title = $manifest[$j]["title"];
|
$sco->parent = $scoes[$j]['parent'];
|
||||||
if (!isset($manifest[$j]["datafromlms"])) {
|
$sco->title = $scoes[$j]['title'];
|
||||||
$manifest[$j]["datafromlms"] = "";
|
$sco->organization = $scoes[$j]['organization'];
|
||||||
}
|
if (!isset($scoes[$j]['datafromlms'])) {
|
||||||
$sco->datafromlms = $manifest[$j]["datafromlms"];
|
$scoes[$j]['datafromlms'] = '';
|
||||||
|
}
|
||||||
|
$sco->datafromlms = $scoes[$j]['datafromlms'];
|
||||||
|
|
||||||
if (!isset($resources[($manifest[$j]["identifierref"])]["href"])) {
|
if (!isset($resources[($scoes[$j]['identifierref'])]['href'])) {
|
||||||
$resources[($manifest[$j]["identifierref"])]["href"] = "";
|
$resources[($scoes[$j]['identifierref'])]['href'] = '';
|
||||||
}
|
}
|
||||||
$sco->launch = $resources[($manifest[$j]["identifierref"])]["href"];
|
$sco->launch = $resources[($scoes[$j]['identifierref'])]['href'];
|
||||||
|
|
||||||
if (!isset($resources[($manifest[$j]["identifierref"])]["type"])) {
|
if (!isset($resources[($scoes[$j]['identifierref'])]['type'])) {
|
||||||
$resources[($manifest[$j]["identifierref"])]["type"] = "";
|
$resources[($scoes[$j]['identifierref'])]['type'] = '';
|
||||||
}
|
}
|
||||||
$sco->type = $resources[($manifest[$j]["identifierref"])]["type"];
|
$sco->type = $resources[($scoes[$j]['identifierref'])]['type'];
|
||||||
|
|
||||||
if (!isset($manifest[$j]["previous"])) {
|
if (!isset($scoes[$j]['previous'])) {
|
||||||
$manifest[$j]["previous"] = 0;
|
$scoes[$j]['previous'] = 0;
|
||||||
}
|
}
|
||||||
$sco->previous = $manifest[$j]["previous"];
|
$sco->previous = $scoes[$j]['previous'];
|
||||||
|
|
||||||
if (!isset($manifest[$j]["continue"])) {
|
if (!isset($scoes[$j]['continue'])) {
|
||||||
$manifest[$j]["continue"] = 0;
|
$scoes[$j]['continue'] = 0;
|
||||||
}
|
}
|
||||||
$sco->next = $manifest[$j]["continue"];
|
$sco->next = $scoes[$j]['continue'];
|
||||||
|
|
||||||
if (scorm_remove_spaces($manifest[$j]["isvisible"]) != "false") {
|
if (scorm_remove_spaces($scoes[$j]['isvisible']) != 'false') {
|
||||||
$id = insert_record("scorm_scoes",$sco);
|
$id = insert_record('scorm_scoes',$sco);
|
||||||
}
|
}
|
||||||
|
if (($launch==0) && (isset($sco->launch)) && ($defaultorg==$sco->organization)) {
|
||||||
if ($launch==0 && $sco->launch) {
|
$launch = $id;
|
||||||
$launch = $id;
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($resources as $label => $resource) {
|
||||||
|
if ((isset($resource['type'])) && ($resource['type'] == 'sco')) {
|
||||||
|
$sco->identifier = $label;
|
||||||
|
$sco->title = $label;
|
||||||
|
$sco->parent = '/';
|
||||||
|
$sco->launch = $resource['href'];
|
||||||
|
$sco->type = $resource['type'];
|
||||||
|
$id = insert_record('scorm_scoes',$sco);
|
||||||
|
|
||||||
|
if ($launch == 0) {
|
||||||
|
$launch = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $launch;
|
return $launch;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +547,7 @@ function scorm_get_scoes_records($sco_user) {
|
||||||
|
|
||||||
function scorm_remove_spaces($sourcestr) {
|
function scorm_remove_spaces($sourcestr) {
|
||||||
// Remove blank space from a string
|
// Remove blank space from a string
|
||||||
$newstr="";
|
$newstr='';
|
||||||
for( $i=0; $i<strlen($sourcestr); $i++) {
|
for( $i=0; $i<strlen($sourcestr); $i++) {
|
||||||
if ($sourcestr[$i]!=' ')
|
if ($sourcestr[$i]!=' ')
|
||||||
$newstr .=$sourcestr[$i];
|
$newstr .=$sourcestr[$i];
|
||||||
|
@ -418,7 +559,7 @@ function scorm_string_round($stringa) {
|
||||||
// Crop a string to $len character and set an anchor title to the full string
|
// Crop a string to $len character and set an anchor title to the full string
|
||||||
$len=11;
|
$len=11;
|
||||||
if ( strlen($stringa)>$len ) {
|
if ( strlen($stringa)>$len ) {
|
||||||
return "<A name=\"\" title=\"$stringa\">".substr($stringa,0,$len-4)."...".substr($stringa,strlen($stringa)-1,1)."</A>";
|
return "<A name=\"\" title=\"$stringa\">".substr($stringa,0,$len-4).'...'.substr($stringa,strlen($stringa)-1,1).'</A>';
|
||||||
} else
|
} else
|
||||||
return $stringa;
|
return $stringa;
|
||||||
}
|
}
|
||||||
|
@ -427,19 +568,19 @@ function scorm_external_link($link) {
|
||||||
// check if a link is external
|
// check if a link is external
|
||||||
$result = false;
|
$result = false;
|
||||||
$link = strtolower($link);
|
$link = strtolower($link);
|
||||||
if (substr($link,0,7) == "http://")
|
if (substr($link,0,7) == 'http://')
|
||||||
$result = true;
|
$result = true;
|
||||||
else if (substr($link,0,8) == "https://")
|
else if (substr($link,0,8) == 'https://')
|
||||||
$result = true;
|
$result = true;
|
||||||
else if (substr($link,0,4) == "www.")
|
else if (substr($link,0,4) == 'www.')
|
||||||
$result = true;
|
$result = true;
|
||||||
/*else if (substr($link,0,7) == "rstp://")
|
/*else if (substr($link,0,7) == 'rstp://')
|
||||||
$result = true;
|
$result = true;
|
||||||
else if (substr($link,0,6) == "rtp://")
|
else if (substr($link,0,6) == 'rtp://')
|
||||||
$result = true;
|
$result = true;
|
||||||
else if (substr($link,0,6) == "ftp://")
|
else if (substr($link,0,6) == 'ftp://')
|
||||||
$result = true;
|
$result = true;
|
||||||
else if (substr($link,0,9) == "gopher://")
|
else if (substr($link,0,9) == 'gopher://')
|
||||||
$result = true; */
|
$result = true; */
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
<input type="hidden" name=launch value="<?php p($form->launch) ?>">
|
<input type="hidden" name=launch value="<?php p($form->launch) ?>">
|
||||||
<input type="hidden" name=popup value="<?php p($form->popup) ?>">
|
<input type="hidden" name=popup value="<?php p($form->popup) ?>">
|
||||||
<input type="hidden" name=auto value="<?php p($form->auto) ?>">
|
<input type="hidden" name=auto value="<?php p($form->auto) ?>">
|
||||||
|
<input type="hidden" name="maxgrade" value="<?php p($form->maxgrade) ?>" />
|
||||||
|
<input type="hidden" name="grademethod" value="<?php p($form->grademethod) ?>" />
|
||||||
<input type="hidden" name=section value="<?php p($form->section) ?>">
|
<input type="hidden" name=section value="<?php p($form->section) ?>">
|
||||||
<input type="hidden" name=module value="<?php p($form->module) ?>">
|
<input type="hidden" name=module value="<?php p($form->module) ?>">
|
||||||
<input type="hidden" name=modulename value="<?php p($form->modulename) ?>">
|
<input type="hidden" name=modulename value="<?php p($form->modulename) ?>">
|
||||||
|
|
|
@ -68,9 +68,13 @@
|
||||||
//
|
//
|
||||||
// Print the page header
|
// Print the page header
|
||||||
//
|
//
|
||||||
|
$bodyscripts = "";
|
||||||
|
if ($scorm->popup != "") {
|
||||||
|
$bodyscripts = "onLoad='SCOInitialize();' onUnload='API.SaveTotalTime(); closeMain();' onbeforeUnload='API.SaveTotalTime();'";
|
||||||
|
}
|
||||||
print_header($pagetitle, "$course->fullname",
|
print_header($pagetitle, "$course->fullname",
|
||||||
"$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>",
|
"$navigation <a target=\"{$CFG->framename}\" href=\"view.php?id=$cm->id\" title=\"$scorm->summary\">$scorm->name</a>",
|
||||||
"", "", true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm, '_top'));
|
"", "", true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm, '_top'),"",$bodyscripts);
|
||||||
|
|
||||||
echo "<table width=\"100%\">\n <tr><td align=\"center\">".text_to_html($scorm->summary, true, false)."</td>\n";
|
echo "<table width=\"100%\">\n <tr><td align=\"center\">".text_to_html($scorm->summary, true, false)."</td>\n";
|
||||||
if ($mode == "browse")
|
if ($mode == "browse")
|
||||||
|
@ -241,15 +245,6 @@
|
||||||
</td>\n";
|
</td>\n";
|
||||||
|
|
||||||
echo "</tr>\n</table>\n";
|
echo "</tr>\n</table>\n";
|
||||||
|
|
||||||
if ($scorm->popup != "") {
|
|
||||||
?>
|
|
||||||
<script language="Javascript">
|
|
||||||
SCOInitialize();
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</body>\n</html>\n";
|
echo "</body>\n</html>\n";
|
||||||
} else {
|
} else {
|
||||||
if ($scorm->popup == "") {
|
if ($scorm->popup == "") {
|
||||||
|
@ -259,7 +254,7 @@
|
||||||
echo "<html>\n";
|
echo "<html>\n";
|
||||||
echo "<head><title>$course->shortname: $scorm->name</title></head>\n";
|
echo "<head><title>$course->shortname: $scorm->name</title></head>\n";
|
||||||
echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$mode.$scoid."\"></script>\n";
|
echo "<script id=\"scormAPI\" language=\"JavaScript\" type=\"text/javascript\" src=\"scormAPI.php?id=$cm->id&mode=".$mode.$scoid."\"></script>\n";
|
||||||
echo "<frameset rows=\"$CFG->scorm_framesize,*\" onLoad=\"SCOInitialize();\">\n";
|
echo "<frameset rows=\"$CFG->scorm_framesize,*\" onLoad=\"SCOInitialize();\" onUnload=\"API.SaveTotalTime();\" onbeforeUnload=\"API.SaveTotalTime();\">\n";
|
||||||
echo "\t <frame name=\"navigation\" src=\"playscorm.php?id=$cm->id&mode=".$mode."&frameset=top\">\n";
|
echo "\t <frame name=\"navigation\" src=\"playscorm.php?id=$cm->id&mode=".$mode."&frameset=top\">\n";
|
||||||
echo "\t <frame name=\"main\" src=\"\">\n";
|
echo "\t <frame name=\"main\" src=\"\">\n";
|
||||||
echo "</frameset>\n";
|
echo "</frameset>\n";
|
||||||
|
|
|
@ -79,8 +79,12 @@
|
||||||
|
|
||||||
foreach ($sco_users as $sco_user) {
|
foreach ($sco_users as $sco_user) {
|
||||||
$user_data=scorm_get_scoes_records($sco_user);
|
$user_data=scorm_get_scoes_records($sco_user);
|
||||||
$picture = print_user_picture($sco_user->userid, $course->id, $user_data->picture, false, true);
|
$userpict = "";
|
||||||
$row="";
|
if (isset($user_data->picture)) {
|
||||||
|
$userpict = $user_data->picture;
|
||||||
|
}
|
||||||
|
$picture = print_user_picture($sco_user->userid, $course->id, $userpict, false, true);
|
||||||
|
$row="";
|
||||||
$row[] = $picture;
|
$row[] = $picture;
|
||||||
if (is_array($user_data)) {
|
if (is_array($user_data)) {
|
||||||
$data = current($user_data);
|
$data = current($user_data);
|
||||||
|
@ -98,7 +102,7 @@
|
||||||
.$data->cmi_core_total_time.$scoreview;
|
.$data->cmi_core_total_time.$scoreview;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$table->data[] = $row;
|
$table->data[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_table($table);
|
print_table($table);
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
$scorm->course = $restore->course_id;
|
$scorm->course = $restore->course_id;
|
||||||
$scorm->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
|
$scorm->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
|
||||||
$scorm->reference = backup_todb($info['MOD']['#']['REFERENCE']['0']['#']);
|
$scorm->reference = backup_todb($info['MOD']['#']['REFERENCE']['0']['#']);
|
||||||
|
$scorm->reference = backup_todb($info['MOD']['#']['MAXGRADE']['0']['#']);
|
||||||
|
$scorm->reference = backup_todb($info['MOD']['#']['GRADEMETHOD']['0']['#']);
|
||||||
$scorm->datadir = backup_todb($info['MOD']['#']['DATADIR']['0']['#']);
|
$scorm->datadir = backup_todb($info['MOD']['#']['DATADIR']['0']['#']);
|
||||||
$scorm->launch = backup_todb($info['MOD']['#']['LAUNCH']['0']['#']);
|
$scorm->launch = backup_todb($info['MOD']['#']['LAUNCH']['0']['#']);
|
||||||
$scorm->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
|
$scorm->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
|
||||||
|
@ -110,11 +112,14 @@
|
||||||
|
|
||||||
//Now, build the scorm_scoes record structure
|
//Now, build the scorm_scoes record structure
|
||||||
$sco->scorm = $scorm_id;
|
$sco->scorm = $scorm_id;
|
||||||
|
$sco->manifest = backup_todb($sub_info['#']['MANIFEST']['0']['#']);
|
||||||
|
$sco->organization = backup_todb($sub_info['#']['ORGANIZATION']['0']['#']);
|
||||||
$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->type = backup_todb($sub_info['#']['TYPE']['0']['#']);
|
$sco->type = backup_todb($sub_info['#']['TYPE']['0']['#']);
|
||||||
$sco->title = backup_todb($sub_info['#']['TITLE']['0']['#']);
|
$sco->title = backup_todb($sub_info['#']['TITLE']['0']['#']);
|
||||||
|
$sco->datafromlms = backup_todb($sub_info['#']['DATAFROMLMS']['0']['#']);
|
||||||
$sco->next = backup_todb($sub_info['#']['NEXT']['0']['#']);
|
$sco->next = backup_todb($sub_info['#']['NEXT']['0']['#']);
|
||||||
$sco->previous = backup_todb($sub_info['#']['PREVIOUS']['0']['#']);
|
$sco->previous = backup_todb($sub_info['#']['PREVIOUS']['0']['#']);
|
||||||
|
|
||||||
|
@ -173,7 +178,6 @@
|
||||||
$sco_user->cmi_core_session_time = backup_todb($sub_info['#']['CMI_CORE_SESSION_TIME']['0']['#']);
|
$sco_user->cmi_core_session_time = backup_todb($sub_info['#']['CMI_CORE_SESSION_TIME']['0']['#']);
|
||||||
$sco_user->cmi_core_score_raw = backup_todb($sub_info['#']['CMI_CORE_SCORE_RAW']['0']['#']);
|
$sco_user->cmi_core_score_raw = backup_todb($sub_info['#']['CMI_CORE_SCORE_RAW']['0']['#']);
|
||||||
$sco_user->cmi_suspend_data = backup_todb($sub_info['#']['CMI_SUSPEND_DATA']['0']['#']);
|
$sco_user->cmi_suspend_data = backup_todb($sub_info['#']['CMI_SUSPEND_DATA']['0']['#']);
|
||||||
$sco_user->cmi_launch_data = backup_todb($sub_info['#']['CMI_LAUNCH_DATA']['0']['#']);
|
|
||||||
|
|
||||||
//We have to recode the userid field
|
//We have to recode the userid field
|
||||||
$user = backup_getid($restore->backup_unique_code,"user",$sco_user->userid);
|
$user = backup_getid($restore->backup_unique_code,"user",$sco_user->userid);
|
||||||
|
|
|
@ -177,17 +177,30 @@ function SCOInitialize() {
|
||||||
echo "\t top.main.location=\"$result\";\n";
|
echo "\t top.main.location=\"$result\";\n";
|
||||||
echo "\t hilightcurrent(".$navObj."document.navform.courseStructure);\n";
|
echo "\t hilightcurrent(".$navObj."document.navform.courseStructure);\n";
|
||||||
} else {
|
} else {
|
||||||
echo "\t top.main = window.open('$result','main','$scorm->popup');\n";
|
$popuplocation = '';
|
||||||
|
if (isset($_COOKIE["SCORMpopup"])) {
|
||||||
|
$popuplocation = $_COOKIE["SCORMpopup"];
|
||||||
|
}
|
||||||
|
echo "\t top.main = window.open('$result','main','$scorm->popup$popuplocation');\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeSco(direction) {
|
function changeSco(direction) {
|
||||||
if (direction == "previous")
|
if (direction == "previous")
|
||||||
<?php echo $navObj ?>document.navform.scoid.value="<?php echo $prevsco; ?>";
|
<?php echo $navObj ?>document.navform.scoid.value="<?php echo $prevsco; ?>";
|
||||||
else
|
else
|
||||||
<?php echo $navObj ?>document.navform.scoid.value="<?php echo $nextsco; ?>";
|
<?php echo $navObj ?>document.navform.scoid.value="<?php echo $nextsco; ?>";
|
||||||
|
|
||||||
//alert ("Prev: <?php echo $prevsco; ?>\nNext: <?php echo $nextsco; ?>\nNew SCO: "+<?php echo $navObj ?>document.navform.scoid.value);
|
//alert ("Prev: <?php echo $prevsco; ?>\nNext: <?php echo $nextsco; ?>\nNew SCO: "+<?php echo $navObj ?>document.navform.scoid.value);
|
||||||
<?php echo $navObj ?>document.navform.submit();
|
<?php echo $navObj ?>document.navform.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeMain() {
|
||||||
|
if (document.all) {
|
||||||
|
document.cookie = "SCORMpopup=" + escape(",top="+top.main.screenTop+",left="+top.main.screenLeft);
|
||||||
|
} else {
|
||||||
|
document.cookie = "SCORMpopup=" + escape(",top="+top.main.screenY+",left="+top.main.screenX);
|
||||||
|
}
|
||||||
|
top.main.close();
|
||||||
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$module->version = 2004070800; // The (date) version of this module
|
$module->version = 2004071900; // The (date) version of this module
|
||||||
$module->requires = 2004051600; // The version of Moodle that is required
|
$module->requires = 2004051600; // 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