return true;
}
-function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
+function scorm_get_toc($user,$scorm,$toclink=TOCJSLINK,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
global $CFG, $DB, $PAGE, $OUTPUT;
$strexpand = get_string('expcoll','scorm');
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
- $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
+
$thisscoidstr = '&scoid='.$sco->id;
- //$link = $CFG->wwwroot.'/mod/scorm/loadSCO.php?a='.$scorm->id.$thisscoidstr.$modestr;
$link = 'a='.$scorm->id.$thisscoidstr.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
- //$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
- //$result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- if ($sco->launch) {
- $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- }
- else {
- $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+
+ if ($toclink == TOCFULLURL) { //display toc with urls for structure page
+ $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
+ $result->toc .= $statusicon.' <a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
+ } else {
+ if ($sco->launch) {
+ $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
+ } else {
+ $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+ }
}
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
} else {
return eval('return '.implode($stack).';');
}
-function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
+function scorm_get_toc($user,$scorm,$toclink=TOCJSLINK,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
global $CFG, $DB, $PAGE, $OUTPUT;
$strexpand = get_string('expcoll','scorm');
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
- // $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
$thisscoidstr = '&scoid='.$sco->id;
- //$link = $CFG->wwwroot.'/mod/scorm/loadSCO.php?a='.$scorm->id.$thisscoidstr.$modestr;
$link = 'a='.$scorm->id.$thisscoidstr.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
- //$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."\n";
- //$result->toc .= $startbold.'<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>'.$endbold."\n";
- if ($sco->launch) {
- $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- }
- else {
- $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+ if ($toclink == TOCFULLURL) { //display toc with urls for structure page
+ $url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
+ $result->toc .= $statusicon.' <a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
+ } else { //display toc for inside scorm player
+ if ($sco->launch) {
+ $result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
+ } else {
+ $result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
+ }
}
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
} else {
<?php
-function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
+function scorm_get_toc($user,$scorm,$toclink=TOCJSLINK,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false, $tocheader=false) {
global $CFG, $DB, $PAGE, $OUTPUT;
$strexpand = get_string('expcoll','scorm');
if ($sco->id == $scoid) {
$result->prerequisites = true;
}
+
+ if ($toclink == TOCFULLURL) { //display toc with urls for structure page
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid='.$sco->id;
- $thisscoidstr = '&scoid='.$sco->id;
- //$link = $CFG->wwwroot.'/mod/scorm/loadSCO.php?a='.$scorm->id.$thisscoidstr.$modestr;
- $link = 'a='.$scorm->id.$thisscoidstr.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
- //$result->toc .= $statusicon.' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
- //$result->toc .= '<li><a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>'."</li>\n";
+ $result->toc .= $statusicon.' <a href="'.$url.'">'.format_string($sco->title).'</a>'.$score."\n";
+ } else {
if ($sco->launch) {
+ $link = 'a='.$scorm->id.'&scoid='.$sco->id.'¤torg='.$currentorg.$modestr.'&attempt='.$attempt;
$result->toc .= '<a title="'.$link.'">'.$statusicon.' '.format_string($sco->title).' '.$score.'</a>';
- }
- else {
+ } else {
$result->toc .= '<span>'.$statusicon.' '.format_string($sco->title).'</span>';
}
- $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
+ }
+ $tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
} else {
if ($sco->id == $scoid) {
$result->prerequisites = false;
define('FIRSTATTEMPT', '2');
define('LASTATTEMPT', '3');
+define('TOCJSLINK', 1);
+define('TOCFULLURL', 2);
+
/// Local Library of functions for module scorm
/**
}
require_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php');
- $result = scorm_get_toc($user,$scorm,'structlist',$orgidentifier);
+ $result = scorm_get_toc($user,$scorm,TOCFULLURL,$orgidentifier);
$incomplete = $result->incomplete;
// do we want the TOC to be displayed?
}
$attemptstr = '&attempt=' . $attempt;
- $result = scorm_get_toc($USER, $scorm, 'structurelist', $currentorg, $scoid, $mode, $attempt, true, true);
+ $result = scorm_get_toc($USER, $scorm, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, true);
$sco = $result->sco;
if (($mode == 'browse') && ($scorm->hidebrowse == 1)) {
$result = true;
$request = null;
if (has_capability('mod/scorm:savetrack', get_context_instance(CONTEXT_MODULE,$cm->id))) {
- $result = scorm_get_toc($USER,$scorm,'structurelist',$currentorg,$scoid,$mode,$attempt,true, false);
+ $result = scorm_get_toc($USER,$scorm,TOCJSLINK,$currentorg,$scoid,$mode,$attempt,true, false);
echo $result->toc;
}
}