mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +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
|
@ -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.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.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_from_lms':{'mod':'r', 'writeerror':'403'},
|
||||
'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.status':{'pattern':CMIIndex, 'format':CMIStatus2, 'mod':'rw', 'writeerror':'405'},
|
||||
'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.max_time_allowed':{'defaultvalue':'<?php echo $userdata->maxtimeallowed ?>', 'mod':'r', 'writeerror':'403'},
|
||||
'cmi.student_data.time_limit_action':{'defaultvalue':'<?php echo $userdata->timelimitaction ?>', '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 isset($userdata->maxtimeallowed)?$userdata->maxtimeallowed:'' ?>', '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.audio':{'defaultvalue':'0', 'format':CMISInteger, 'range':audio_range, '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 (!Initialized) {
|
||||
<?php
|
||||
if (($CFG->debug > 7) && (isadmin())) {
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Initialized SCORM 1.2");';
|
||||
}
|
||||
?>
|
||||
|
@ -188,7 +188,7 @@ function SCORMapi1_2() {
|
|||
if (param == "") {
|
||||
if (Initialized) {
|
||||
<?php
|
||||
if (($CFG->debug > 7) && (isadmin())) {
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Finished SCORM 1.2");';
|
||||
}
|
||||
?>
|
||||
|
@ -233,7 +233,7 @@ function SCORMapi1_2() {
|
|||
if (subelement == element) {
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (($CFG->debug > 7) && (isadmin())) {
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert(element+": "+eval(element));';
|
||||
}
|
||||
?>
|
||||
|
@ -337,7 +337,7 @@ function SCORMapi1_2() {
|
|||
eval(element+'="'+value+'";');
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (($CFG->debug > 7) && (isadmin())) {
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert(element+":= "+value);';
|
||||
}
|
||||
?>
|
||||
|
@ -353,7 +353,7 @@ function SCORMapi1_2() {
|
|||
}
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (($CFG->debug > 7) && (isadmin())) {
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert(element+":= "+value);';
|
||||
}
|
||||
?>
|
||||
|
@ -384,7 +384,7 @@ function SCORMapi1_2() {
|
|||
if (Initialized) {
|
||||
result = StoreData(cmi,false);
|
||||
<?php
|
||||
if (($CFG->debug > 7) && (isadmin())) {
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Data Commited");';
|
||||
}
|
||||
?>
|
||||
|
@ -539,7 +539,7 @@ function SCORMapi1_2() {
|
|||
datastring = CollectData(data,'cmi');
|
||||
}
|
||||
datastring += '&attempt=<?php echo $attempt ?>';
|
||||
datastring += '&scoid=<?php echo $sco->id ?>';
|
||||
datastring += '&scoid=<?php echo $scoid ?>';
|
||||
|
||||
var myRequest = NewHttpReq();
|
||||
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));
|
||||
$settrue = 0;
|
||||
foreach ($setelements as $setelement) {
|
||||
if (eval_prerequisites($setelement,$usertracks)) {
|
||||
if (scorm_eval_prerequisites($setelement,$usertracks)) {
|
||||
$settrue++;
|
||||
}
|
||||
}
|
||||
|
@ -212,6 +212,12 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
|||
$parents[$level]='/';
|
||||
|
||||
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 ($newlevel = array_search($sco->parent,$parents)) {
|
||||
for ($i=0; $i<($level-$newlevel); $i++) {
|
||||
|
@ -239,86 +245,97 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
|||
$parents[$level]=$sco->parent;
|
||||
}
|
||||
}
|
||||
$result->toc .= "\t\t<li>";
|
||||
if ($isvisible) {
|
||||
$result->toc .= "\t\t<li>";
|
||||
}
|
||||
$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++;
|
||||
$icon = 'minus';
|
||||
if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
|
||||
$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>';
|
||||
} else {
|
||||
} else if ($isvisible) {
|
||||
$result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" />';
|
||||
}
|
||||
if (empty($sco->title)) {
|
||||
$sco->title = $sco->identifier;
|
||||
}
|
||||
if (!empty($sco->launch)) {
|
||||
$startbold = '';
|
||||
$endbold = '';
|
||||
$score = '';
|
||||
if (empty($scoid) && ($mode != 'normal')) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if (isset($usertracks[$sco->identifier])) {
|
||||
$usertrack = $usertracks[$sco->identifier];
|
||||
$strstatus = get_string($usertrack->status,'scorm');
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/'.$usertrack->status.'.gif" alt="'.$strstatus.'" title="'.$strstatus.'" />';
|
||||
} else {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/assetc.gif" alt="'.get_string('assetlauched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
|
||||
if ($isvisible) {
|
||||
$startbold = '';
|
||||
$endbold = '';
|
||||
$score = '';
|
||||
if (empty($scoid) && ($mode != 'normal')) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if (isset($usertracks[$sco->identifier])) {
|
||||
$usertrack = $usertracks[$sco->identifier];
|
||||
$strstatus = get_string($usertrack->status,'scorm');
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/'.$usertrack->status.'.gif" alt="'.$strstatus.'" title="'.$strstatus.'" />';
|
||||
} else {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/assetc.gif" alt="'.get_string('assetlauched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
|
||||
}
|
||||
|
||||
if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) {
|
||||
$incomplete = true;
|
||||
if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) {
|
||||
$incomplete = true;
|
||||
if ($play && empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
}
|
||||
if ($usertrack->score_raw != '') {
|
||||
$score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')';
|
||||
}
|
||||
$strsuspended = get_string('suspended','scorm');
|
||||
if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
|
||||
}
|
||||
} else {
|
||||
if ($play && empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
|
||||
$incomplete = true;
|
||||
} else {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
|
||||
}
|
||||
}
|
||||
if ($usertrack->score_raw != '') {
|
||||
$score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')';
|
||||
if ($sco->id == $scoid) {
|
||||
$scodata = scorm_get_sco($sco->id, SCO_DATA);
|
||||
$startbold = '<b>';
|
||||
$endbold = '</b>';
|
||||
$findnext = true;
|
||||
$shownext = isset($scodata->next) ? $scodata->next : 0;
|
||||
$showprev = isset($scodata->previous) ? $scodata->previous : 0;
|
||||
}
|
||||
$strsuspended = get_string('suspended','scorm');
|
||||
if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
|
||||
}
|
||||
} else {
|
||||
if ($play && empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon= '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
|
||||
$incomplete = true;
|
||||
} else {
|
||||
$statusicon .= '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
|
||||
}
|
||||
}
|
||||
if ($sco->id == $scoid) {
|
||||
$startbold = '<b>';
|
||||
$endbold = '</b>';
|
||||
$findnext = true;
|
||||
$shownext = $sco->next;
|
||||
$showprev = $sco->previous;
|
||||
}
|
||||
|
||||
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
|
||||
if (!empty($sco->launch)) {
|
||||
$previd = $sco->id;
|
||||
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
|
||||
if (!empty($sco->launch)) {
|
||||
$previd = $sco->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = true;
|
||||
if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = true;
|
||||
}
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
|
||||
$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
|
||||
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
|
||||
} else {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = false;
|
||||
}
|
||||
$result->toc .= $statusicon.' '.$sco->title."</li>\n";
|
||||
}
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
|
||||
$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
|
||||
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
|
||||
} else {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = false;
|
||||
}
|
||||
$result->toc .= ' '.$sco->title."</li>\n";
|
||||
}
|
||||
} else {
|
||||
$result->toc .= ' '.$sco->title."</li>\n";
|
||||
|
@ -334,7 +351,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
|||
}
|
||||
|
||||
if ($play) {
|
||||
$sco = get_record('scorm_scoes','id',$scoid);
|
||||
$sco = scorm_get_sco($scoid);
|
||||
$sco->previd = $previd;
|
||||
$sco->nextid = $nextid;
|
||||
$result->sco = $sco;
|
||||
|
|
|
@ -1,24 +1,5 @@
|
|||
<?php
|
||||
/* // 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':
|
||||
$parent = array_pop($parents);
|
||||
array_push($parents, $parent);
|
||||
|
@ -373,7 +354,7 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
|||
//
|
||||
|
||||
// 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
|
||||
|
||||
$usertracks = array();
|
||||
|
@ -394,8 +375,13 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
|||
$nextid = 0;
|
||||
$findnext = false;
|
||||
$parents[$level]='/';
|
||||
|
||||
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 ($newlevel = array_search($sco->parent,$parents)) {
|
||||
for ($i=0; $i<($level-$newlevel); $i++) {
|
||||
|
@ -423,97 +409,107 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
|||
$parents[$level]=$sco->parent;
|
||||
}
|
||||
}
|
||||
$result->toc .= "\t\t<li>";
|
||||
if ($isvisible) {
|
||||
$result->toc .= "\t\t<li>";
|
||||
}
|
||||
$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++;
|
||||
$icon = 'minus';
|
||||
if (isset($_COOKIE['hide:SCORMitem'.$nextsco->id])) {
|
||||
$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>';
|
||||
} else {
|
||||
} else if ($isvisible) {
|
||||
$result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" />';
|
||||
}
|
||||
if (empty($sco->title)) {
|
||||
$sco->title = $sco->identifier;
|
||||
}
|
||||
if (!empty($sco->launch)) {
|
||||
$startbold = '';
|
||||
$endbold = '';
|
||||
$score = '';
|
||||
if (empty($scoid) && ($mode != 'normal')) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if (isset($usertracks[$sco->identifier])) {
|
||||
$usertrack = $usertracks[$sco->identifier];
|
||||
$strstatus = get_string($usertrack->status,'scorm');
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/'.$usertrack->status.'.gif" alt="'.$strstatus.'" title="'.$strstatus.'" />';
|
||||
} else {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/assetc.gif" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
|
||||
if ($isvisible) {
|
||||
$startbold = '';
|
||||
$endbold = '';
|
||||
$score = '';
|
||||
if (empty($scoid) && ($mode != 'normal')) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
|
||||
if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) {
|
||||
$incomplete = true;
|
||||
if (isset($usertracks[$sco->identifier])) {
|
||||
$usertrack = $usertracks[$sco->identifier];
|
||||
$strstatus = get_string($usertrack->status,'scorm');
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/'.$usertrack->status.'.gif" alt="'.$strstatus.'" title="'.$strstatus.'" />';
|
||||
} else {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/assetc.gif" alt="'.get_string('assetlaunched','scorm').'" title="'.get_string('assetlaunched','scorm').'" />';
|
||||
}
|
||||
|
||||
if (($usertrack->status == 'notattempted') || ($usertrack->status == 'incomplete') || ($usertrack->status == 'browsed')) {
|
||||
$incomplete = true;
|
||||
if ($play && empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
}
|
||||
if ($usertrack->score_raw != '') {
|
||||
$score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')';
|
||||
}
|
||||
$strsuspended = get_string('suspended','scorm');
|
||||
if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
|
||||
}
|
||||
} else {
|
||||
if ($play && empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
|
||||
$incomplete = true;
|
||||
} else {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
|
||||
}
|
||||
}
|
||||
if ($usertrack->score_raw != '') {
|
||||
$score = '('.get_string('score','scorm').': '.$usertrack->score_raw.')';
|
||||
}
|
||||
$strsuspended = get_string('suspended','scorm');
|
||||
if (isset($usertrack->{'cmi.core.exit'}) && ($usertrack->{'cmi.core.exit'} == 'suspend')) {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/suspend.gif" alt="'.$strstatus.' - '.$strsuspended.'" title="'.$strstatus.' - '.$strsuspended.'" />';
|
||||
}
|
||||
} else {
|
||||
if ($play && empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if ($sco->scormtype == 'sco') {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/notattempted.gif" alt="'.get_string('notattempted','scorm').'" title="'.get_string('notattempted','scorm').'" />';
|
||||
$incomplete = true;
|
||||
} else {
|
||||
$statusicon = '<img src="'.$scormpixdir.'/asset.gif" alt="'.get_string('asset','scorm').'" title="'.get_string('asset','scorm').'" />';
|
||||
}
|
||||
}
|
||||
|
||||
if ($sco->id == $scoid) {
|
||||
$startbold = '<b>';
|
||||
$endbold = '</b>';
|
||||
$findnext = true;
|
||||
$shownext = $sco->next;
|
||||
$showprev = $sco->previous;
|
||||
}
|
||||
if ($sco->id == $scoid) {
|
||||
$startbold = '<b>';
|
||||
$endbold = '</b>';
|
||||
$findnext = true;
|
||||
$shownext = $sco->next;
|
||||
$showprev = $sco->previous;
|
||||
}
|
||||
|
||||
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
|
||||
if (!empty($sco->launch)) {
|
||||
$previd = $sco->id;
|
||||
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
|
||||
if (!empty($sco->launch)) {
|
||||
$previd = $sco->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = true;
|
||||
if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = true;
|
||||
}
|
||||
// Modified by Pham Minh Duc
|
||||
// if (scorm_isChoice($scorm->id,$sco->id) == 1) {
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
|
||||
$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
|
||||
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
|
||||
// } else {
|
||||
// $result->toc .= ' '.$startbold.format_string($sco->title).$score.$endbold."</li>\n";
|
||||
// $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
|
||||
// }
|
||||
// End modify
|
||||
} else {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = false;
|
||||
}
|
||||
$result->toc .= ' '.format_string($sco->title)."</li>\n";
|
||||
}
|
||||
// Modified by Pham Minh Duc
|
||||
// if (scorm_isChoice($scorm->id,$sco->id) == 1) {
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
|
||||
$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
|
||||
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
|
||||
// } else {
|
||||
// $result->toc .= ' '.$startbold.format_string($sco->title).$score.$endbold."</li>\n";
|
||||
// $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
|
||||
// }
|
||||
// End modify
|
||||
} else {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = false;
|
||||
}
|
||||
$result->toc .= ' '.$sco->title."</li>\n";
|
||||
}
|
||||
} else {
|
||||
$result->toc .= ' '.$sco->title."</li>\n";
|
||||
$result->toc .= ' '.format_string($sco->title)."</li>\n";
|
||||
}
|
||||
if (($nextsco !== false) && ($nextid == 0) && ($findnext)) {
|
||||
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']);
|
||||
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)) {
|
||||
|
||||
$xmlstring = file_get_contents($manifestfile);
|
||||
$xmltext = file_get_contents($manifestfile);
|
||||
|
||||
$pattern = '/&(?!\w{2,6};)/';
|
||||
$replacement = '&';
|
||||
$xmltext = preg_replace($pattern, $replacement, $xmltext);
|
||||
|
||||
$objXML = new xml2Array();
|
||||
$manifests = $objXML->parse($xmlstring);
|
||||
$manifests = $objXML->parse($xmltext);
|
||||
//print_r($manifests);
|
||||
$scoes = new stdClass();
|
||||
$scoes->version = '';
|
||||
|
@ -205,13 +237,13 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
|||
foreach ($organizations as $organization => $items) {
|
||||
foreach ($items as $identifier => $item) {
|
||||
// This new db mngt will support all SCORM future extensions
|
||||
/*$newitem = new stdClass();
|
||||
$newitem = new stdClass();
|
||||
$newitem->scorm = $scormid;
|
||||
$newitem->manifest = $manifest;
|
||||
$newitem->organization = $organization;
|
||||
$standarddatas = array('parent', 'identifier', 'launch', 'scormtype', 'title');
|
||||
foreach ($standarddatas as $standarddata) {
|
||||
$newitem->$standarddata = $item->$standarddata;
|
||||
$newitem->$standarddata = addslashes($item->$standarddata);
|
||||
}
|
||||
|
||||
if ($olditemid = scorm_array_search('identifier',$newitem->identifier,$olditems)) {
|
||||
|
@ -224,18 +256,18 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
|||
}
|
||||
|
||||
$data = new stdClass();
|
||||
$data->scormid = $scormid;
|
||||
$data->scoid = $id;
|
||||
$optionaldatas = scorm_optionals_data();
|
||||
foreach ($optionalsdatas as $optionaldata) {
|
||||
if (isset($item->$optionaldata)) {
|
||||
$data->name = $optionaldata;
|
||||
$data->value = $item->$optionaldata;
|
||||
$dataid = insert_record('scorm_scoes_data');
|
||||
if ($optionaldatas = scorm_optionals_data($item,$standarddatas)) {
|
||||
foreach ($optionaldatas as $optionaldata) {
|
||||
if (isset($item->$optionaldata)) {
|
||||
$data->name = $optionaldata;
|
||||
$data->value = addslashes($item->$optionaldata);
|
||||
$dataid = insert_record('scorm_scoes_data',$data);
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
$item->scorm = $scormid;
|
||||
/*$item->scorm = $scormid;
|
||||
$item->manifest = $manifest;
|
||||
$item->organization = $organization;
|
||||
if ($olditemid = scorm_array_search('identifier',$item->identifier,$olditems)) {
|
||||
|
@ -244,7 +276,7 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
|||
unset($olditems[$olditemid]);
|
||||
} else {
|
||||
$id = insert_record('scorm_scoes',$item);
|
||||
}
|
||||
} */
|
||||
|
||||
if (($launch == 0) && ((empty($scoes->defaultorg)) || ($scoes->defaultorg == $identifier))) {
|
||||
$launch = $id;
|
||||
|
@ -266,6 +298,16 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
|||
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
|
||||
Grab some XML data, either from a file, URL, etc. however you want. Assume storage in $strYourXML;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue