mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Added multiorg display and patched some typo
This commit is contained in:
parent
358910a485
commit
2c508ab9b1
@ -208,8 +208,16 @@ function SCORMapi() {
|
||||
errorCode = "0";
|
||||
return "true";
|
||||
break;
|
||||
case "cmi.suspend_data":
|
||||
case "cmi.comments":
|
||||
if ((value.length + cmi.comments.length) > 4096) {
|
||||
errorCode = "405";
|
||||
return "false";
|
||||
}
|
||||
eval(param+'=cmi.comments + "'+value+'";');
|
||||
errorCode = "0";
|
||||
return "true";
|
||||
break;
|
||||
case "cmi.suspend_data":
|
||||
if (value.length > 4096) {
|
||||
errorCode = "405";
|
||||
return "false";
|
||||
|
@ -388,7 +388,9 @@ function scorm_delete_files($directory)
|
||||
}
|
||||
|
||||
function scorm_startElement($parser, $name, $attrs) {
|
||||
|
||||
global $scoes,$i,$resources,$parent,$level,$organization,$manifest,$defaultorg;
|
||||
|
||||
if ($name == 'ITEM') {
|
||||
$i++;
|
||||
$scoes[$i]['manifest'] = $manifest;
|
||||
@ -409,15 +411,30 @@ function scorm_startElement($parser, $name, $attrs) {
|
||||
$attrs['HREF'] = '';
|
||||
}
|
||||
$resources[$attrs['IDENTIFIER']]['href']=$attrs['HREF'];
|
||||
if (!isset($attrs['ADLCP:SCORMTYPE'])) {
|
||||
$attrs['ADLCP:SCORMTYPE'] = '';
|
||||
}
|
||||
$resources[$attrs['IDENTIFIER']]['type']=$attrs['ADLCP:SCORMTYPE'];
|
||||
}
|
||||
if ($name == 'ORGANIZATION') {
|
||||
$i++;
|
||||
$scoes[$i]['manifest'] = $manifest;
|
||||
$scoes[$i]['organization'] = '';
|
||||
$scoes[$i]['identifier'] = $attrs['IDENTIFIER'];
|
||||
$scoes[$i]['identifierref'] = '';
|
||||
$scoes[$i]['isvisible'] = '';
|
||||
$scoes[$i]['parent'] = $parent[$level];
|
||||
$level++;
|
||||
$parent[$level] = $attrs['IDENTIFIER'];
|
||||
$organization = $attrs['IDENTIFIER'];
|
||||
}
|
||||
if ($name == 'MANIFEST') {
|
||||
$manifest = $attrs['IDENTIFIER'];
|
||||
}
|
||||
if ($name == 'ORGANIZATIONS') {
|
||||
if (!isset($attrs['DEFAULT'])) {
|
||||
$attrs['DEFAULT'] = '';
|
||||
}
|
||||
$defaultorg = $attrs['DEFAULT'];
|
||||
}
|
||||
}
|
||||
@ -427,12 +444,23 @@ function scorm_endElement($parser, $name) {
|
||||
if ($name == 'ITEM') {
|
||||
$level--;
|
||||
}
|
||||
if ($name == 'TITLE' && $level>0)
|
||||
//if ($name == 'TITLE' && $level>0) {
|
||||
if ($name == 'TITLE') {
|
||||
$scoes[$i]['title'] = $datacontent;
|
||||
if ($name == 'ADLCP:HIDERTSUI')
|
||||
}
|
||||
if ($name == 'ADLCP:HIDERTSUI') {
|
||||
$scoes[$i][$datacontent] = 1;
|
||||
if ($name == 'ADLCP:DATAFROMLMS')
|
||||
}
|
||||
if ($name == 'ADLCP:DATAFROMLMS') {
|
||||
$scoes[$i]['datafromlms'] = $datacontent;
|
||||
}
|
||||
if ($name == 'ORGANIZATION') {
|
||||
$organization = '';
|
||||
$level--;
|
||||
}
|
||||
if ($name == 'MANIFEST') {
|
||||
$manifest = '';
|
||||
}
|
||||
}
|
||||
|
||||
function scorm_characterData($parser, $data) {
|
||||
@ -508,7 +536,8 @@ function scorm_parse($basedir,$file,$scorm_id) {
|
||||
if (scorm_remove_spaces($scoes[$j]['isvisible']) != 'false') {
|
||||
$id = insert_record('scorm_scoes',$sco);
|
||||
}
|
||||
if (($launch==0) && (isset($sco->launch)) && ($defaultorg==$sco->organization)) {
|
||||
//if (($launch==0) && (isset($sco->launch)) && ($defaultorg==$sco->organization)) {
|
||||
if (($launch==0) && ($defaultorg==$sco->identifier)) {
|
||||
$launch = $id;
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,9 @@
|
||||
|
||||
if (!empty($_POST["scoid"]))
|
||||
$scoid = "&scoid=".$_POST["scoid"];
|
||||
if (!empty($_POST['currentorg'])) {
|
||||
$currentorg = $_POST['currentorg'];
|
||||
}
|
||||
if (($scorm->popup != "") && (!empty($_POST["mode"])))
|
||||
$mode = $_POST["mode"];
|
||||
if (($scorm->popup == "") && (!empty($_GET["mode"])))
|
||||
@ -121,7 +124,7 @@
|
||||
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
|
||||
echo " <tr><td nowrap>\n<ul class=\"scormlist\"'>\n";
|
||||
$incomplete = false;
|
||||
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
|
||||
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' AND organization='$currentorg' order by id ASC")){
|
||||
$level=0;
|
||||
$sublist=0;
|
||||
$parents[$level]="/";
|
||||
@ -137,7 +140,7 @@
|
||||
$closelist .= " </ul></li>\n";
|
||||
$i--;
|
||||
}
|
||||
if (($i == 0) && ($sco->parent != "/")) {
|
||||
if (($i == 0) && ($sco->parent != $currentorg)) {
|
||||
echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
|
||||
$level++;
|
||||
} else {
|
||||
@ -168,6 +171,7 @@
|
||||
$startbold = '-> <b>';
|
||||
$endbold = '</b> <-';
|
||||
}
|
||||
$score = "";
|
||||
if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) {
|
||||
if ( $sco_user->cmi_core_lesson_status == "")
|
||||
$sco_user->cmi_core_lesson_status = "not attempted";
|
||||
@ -180,13 +184,13 @@
|
||||
$endbold = '</b> <-';
|
||||
}
|
||||
}
|
||||
if ($sco_user->cmi_core_score_raw > 0) {
|
||||
$score = "(".get_string("score","scorm").": ".$sco_user->cmi_core_score_raw.")";
|
||||
}
|
||||
} else {
|
||||
echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
|
||||
$incomplete = true;
|
||||
}
|
||||
$score = "";
|
||||
if ($sco_user->cmi_core_score_raw > 0)
|
||||
$score = "(".get_string("score","scorm").": ".$sco_user->cmi_core_score_raw.")";
|
||||
echo " $startbold<a href=\"javascript:playSCO(".$sco->id.");\">$sco->title</a> $score$endbold\n </li>\n";
|
||||
} else {
|
||||
echo " $sco->title\n </li>\n";
|
||||
@ -207,11 +211,16 @@
|
||||
<iframe name=\"cmi\" width=\"1\" height=\"1\" src=\"cmi.php?id=$cm->id\" style=\"visibility: hidden\"></iframe>
|
||||
<form name=\"navform\" method=\"POST\" action=\"playscorm.php?id=$cm->id\" target=\"_top\">
|
||||
<input name=\"scoid\" type=\"hidden\" />
|
||||
<input name=\"currentorg\" type=\"hidden\" value=\"$currentorg\" />
|
||||
<input name=\"mode\" type=\"hidden\" value=\"".$mode."\" />
|
||||
<input name=\"prev\" type=\"button\" value=\"".get_string("prev","scorm")."\" onClick=\"top.changeSco('previous');\" /> \n";
|
||||
|
||||
if ($scorm->popup == "") {
|
||||
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
|
||||
$currentorg = '';
|
||||
if (isset($_GET['currentorg'])) {
|
||||
$currentorg = $_GET['currentorg'];
|
||||
}
|
||||
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' AND organization='$currentorg' order by id ASC")){
|
||||
$level=0;
|
||||
$parents[$level]="/";
|
||||
foreach ($scoes as $sco) {
|
||||
@ -223,7 +232,7 @@
|
||||
while (($i > 0) && ($parents[$level] != $sco->parent)) {
|
||||
$i--;
|
||||
}
|
||||
if (($i == 0) && ($sco->parent != "/")) {
|
||||
if (($i == 0) && ($sco->parent != $currentorg)) {
|
||||
$level++;
|
||||
} else {
|
||||
$level = $i;
|
||||
@ -245,7 +254,11 @@
|
||||
</td>\n";
|
||||
|
||||
echo "</tr>\n</table>\n";
|
||||
if ($scorm->popup == "") {
|
||||
echo "</body>\n</html>\n";
|
||||
} else {
|
||||
print_footer($course);
|
||||
}
|
||||
} else {
|
||||
if ($scorm->popup == "") {
|
||||
//
|
||||
@ -255,7 +268,7 @@
|
||||
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 "<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.'¤torg='.$currentorg."&frameset=top\">\n";
|
||||
echo "\t <frame name=\"main\" src=\"\">\n";
|
||||
echo "</frameset>\n";
|
||||
echo "</html>\n";
|
||||
|
@ -93,9 +93,28 @@
|
||||
print_simple_box_start("CENTER");
|
||||
echo "<table>\n";
|
||||
echo " <tr><th>".get_string("coursestruct","scorm")."</th></tr>\n";
|
||||
$organization = $scorm->launch;
|
||||
if ($orgs = get_records_select_menu('scorm_scoes',"scorm='$scorm->id' AND organization='' AND launch=''",'id','id,title')) {
|
||||
if (count($orgs) > 1) {
|
||||
if (isset($_POST['organization'])) {
|
||||
$organization = $_POST['organization'];
|
||||
}
|
||||
echo "<tr><td align='center'><form name='changeorg' method='POST' action='view.php?id=$cm->id'>".get_string('organizations','scorm').": \n";
|
||||
choose_from_menu($orgs, 'organization', "$organization", '','submit()');
|
||||
echo "</form></td></tr>\n";
|
||||
}
|
||||
}
|
||||
$orgidentifier = '';
|
||||
if ($org = get_record('scorm_scoes','id',$organization)) {
|
||||
if (($org->organization == '') && ($org->launch == '')) {
|
||||
$orgidentifier = $org->identifier;
|
||||
} else {
|
||||
$orgidentifier = $org->organization;
|
||||
}
|
||||
}
|
||||
echo " <tr><td nowrap>\n<ul class=\"scormlist\"'>\n";
|
||||
$incomplete = false;
|
||||
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' order by id ASC")){
|
||||
if ($scoes = get_records_select("scorm_scoes","scorm='$scorm->id' AND organization='$orgidentifier' order by id ASC")){
|
||||
$level=0;
|
||||
$sublist=0;
|
||||
$parents[$level]="/";
|
||||
@ -111,7 +130,7 @@
|
||||
$closelist .= " </ul></li>\n";
|
||||
$i--;
|
||||
}
|
||||
if (($i == 0) && ($sco->parent != "/")) {
|
||||
if (($i == 0) && ($sco->parent != $orgidentifier)) {
|
||||
echo " <li><ul id='".$sublist."' class=\"scormlist\"'>\n";
|
||||
$level++;
|
||||
} else {
|
||||
@ -131,6 +150,7 @@
|
||||
echo " <img src=\"pix/spacer.gif\" />\n";
|
||||
}
|
||||
if ($sco->launch) {
|
||||
$score = "";
|
||||
if ($sco_user=get_record("scorm_sco_users","scoid",$sco->id,"userid",$USER->id)) {
|
||||
if ( $sco_user->cmi_core_lesson_status == "") {
|
||||
$sco_user->cmi_core_lesson_status = "not attempted";
|
||||
@ -139,14 +159,13 @@
|
||||
if (($sco_user->cmi_core_lesson_status == "not attempted") || ($sco_user->cmi_core_lesson_status == "incomplete")) {
|
||||
$incomplete = true;
|
||||
}
|
||||
if ($sco_user->cmi_core_score_raw > 0) {
|
||||
$score = "(".get_string("score","scorm").": ".$sco_user->cmi_core_score_raw.")";
|
||||
}
|
||||
} else {
|
||||
echo " <img src=\"pix/notattempted.gif\" alt=\"".get_string("notattempted","scorm")."\" />";
|
||||
$incomplete = true;
|
||||
}
|
||||
$score = "";
|
||||
if ($sco_user->cmi_core_score_raw > 0) {
|
||||
$score = "(".get_string("score","scorm").": ".$sco_user->cmi_core_score_raw.")";
|
||||
}
|
||||
echo " <a href=\"javascript:playSCO(".$sco->id.")\">$sco->title</a> $score\n </li>\n";
|
||||
} else {
|
||||
echo " $sco->title\n </li>\n";
|
||||
@ -170,6 +189,7 @@
|
||||
}
|
||||
echo "</td>\n</tr>\n<tr><td align=\"center\">";
|
||||
echo '<input type="hidden" name="scoid" />
|
||||
<input type="hidden" name="currentorg" value="'.$orgidentifier.'" />
|
||||
<input type="submit" value="'.get_string("entercourse","scorm").'" />';
|
||||
echo "\n</td>\n</tr>\n</table>\n</form><br />";
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user