//print_r($courses);
$oldscoes = $DB->get_records('scorm_scoes', array('scorm'=>$scorm->id));
-
+
$launch = 0;
if (isset($courses)) {
foreach ($courses as $course) {
$sco->scorm = $scorm->id;
$sco->organization = $course->id;
$sco->title = $element->title;
-
+
if (!isset($element->parent) || strtolower($element->parent) == 'root') {
$sco->parent = '/';
} else {
function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false) {
global $CFG, $DB;
-
+
$strexpand = get_string('expcoll','scorm');
$modestr = '';
if ($mode == 'browse') {
$modestr = '&mode='.$mode;
- }
+ }
$scormpixdir = $CFG->modpixpath.'/scorm/pix';
-
+
$result = new stdClass();
$result->toc = "<ul id='s0' class='$liststyle'>\n";
$tocmenus = array();
$result->prerequisites = true;
$incomplete = false;
-
+
//
// Get the current organization infos
//
if ($scoes = scorm_get_scoes($scorm->id, $currentorg)){
//
// Retrieve user tracking data for each learning object
- //
+ //
$usertracks = array();
foreach ($scoes as $sco) {
if (!empty($sco->launch)) {
$nextid = 0;
$findnext = false;
$parents[$level]='/';
-
+
foreach ($scoes as $pos => $sco) {
$isvisible = false;
$sco->title = $sco->title;
}
$result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
} else if ($isvisible) {
- $result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" alt="spacer" />';
+ $result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" alt="" />';
}
if (empty($sco->title)) {
$sco->title = $sco->identifier;
} 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)) {
$shownext = isset($sco->next) ? $sco->next : 0;
$showprev = isset($sco->previous) ? $sco->previous : 0;
}
-
+
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
if (!empty($sco->launch)) {
$previd = $sco->id;
for ($i=0;$i<$level;$i++) {
$result->toc .= "\t\t</ul></li>\n";
}
-
+
if ($play) {
$sco = scorm_get_sco($scoid);
$sco->previd = $previd;
//]]>
</script>'."\n";
}
-
+
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid=';
$result->tocmenu = popup_form($url,$tocmenus, "tocmenu", $sco->id, '', '', '', true);
* @return boolean
*/
function scorm_eval_prerequisites($prerequisites, $usertracks) {
-
- // this is really a little language parser - AICC_SCRIPT is the reference
+
+ // this is really a little language parser - AICC_SCRIPT is the reference
// see 2.3.2.5.1. Sequencing/Navigation Today - from the SCORM 1.2 spec
$element = '';
$stack = array();
'b' => 'browsed',
'n' => 'notattempted'
);
- $i=0;
+ $i=0;
// expand the amp entities
$prerequisites = preg_replace('/&/', '&', $prerequisites);
if (!preg_match('/^(&&|\|\||\(|\))$/', $element)) {
// create each individual expression
// search for ~ = <> X*{}
-
+
// sets like 3*{S34, S36, S37, S39}
if (preg_match('/^(\d+)\*\{(.+)\}$/', $element, $matches)) {
$repeat = $matches[1];
} else {
$element = 'false';
}
-
+
// ~ Not
} else if ($element == '~') {
$element = '!';
-
+
// = | <>
} else if (preg_match('/^(.+)(\=|\<\>)(.+)$/', $element, $matches)) {
$element = trim($matches[1]);
} else {
$element = 'false';
}
-
+
// everything else must be an element defined like S45 ...
} else {
if (isset($usertracks[$element]) &&
$element = 'false';
}
}
-
+
}
$stack []= ' '.$element.' ';
}
function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false) {
global $CFG, $DB;
-
+
$strexpand = get_string('expcoll','scorm');
$modestr = '';
if ($mode == 'browse') {
$modestr = '&mode='.$mode;
- }
+ }
$scormpixdir = $CFG->modpixpath.'/scorm/pix';
-
+
$result = new stdClass();
$result->toc = "<ul id='s0' class='$liststyle'>\n";
$tocmenus = array();
$result->prerequisites = true;
$incomplete = false;
-
+
//
// Get the current organization infos
//
$nextid = 0;
$findnext = false;
$parents[$level]='/';
-
+
foreach ($scoes as $pos => $sco) {
$isvisible = false;
$sco->title = $sco->title;
}
$result->toc .= '<a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');"><img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
} else if ($isvisible) {
- $result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" alt="spacer" />';
+ $result->toc .= '<img src="'.$scormpixdir.'/spacer.gif" alt="" />';
}
if (empty($sco->title)) {
$sco->title = $sco->identifier;
} 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)) {
$shownext = isset($sco->next) ? $sco->next : 0;
$showprev = isset($sco->previous) ? $sco->previous : 0;
}
-
+
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
if (!empty($sco->launch)) {
$previd = $sco->id;
for ($i=0;$i<$level;$i++) {
$result->toc .= "\t\t</ul></li>\n";
}
-
+
if ($play) {
// it is possible that scoid is still not set, in this case we dont want an empty object
if ($scoid) {
//]]>
</script>'."\n";
}
-
+
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid=';
$result->tocmenu = popup_form($url,$tocmenus, "tocmenu", $sco->id, '', '', '', true);
$modestr = '';
if ($mode == 'browse') {
$modestr = '&mode='.$mode;
- }
+ }
$scormpixdir = $CFG->modpixpath.'/scorm/pix';
-
+
$result = new stdClass();
$result->toc = "<ul id='s0' class='$liststyle'>\n";
$tocmenus = array();
$result->prerequisites = true;
$incomplete = false;
-
+
//
// Get the current organization infos
//
if ($scoes = scorm_get_scoes($scorm->id, $currentorg)){
//
// Retrieve user tracking data for each learning object
- //
-
+ //
+
$usertracks = array();
foreach ($scoes as $sco) {
if (!empty($sco->launch)) {
if (!isset($nextsco->isvisible) || (isset($nextsco->isvisible) && ($nextsco->isvisible == 'true'))) {
$nextisvisible = true;
}
- if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) &&
+ if ($nextisvisible && ($nextsco !== false) && ($sco->parent != $nextsco->parent) &&
(($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
$icon = 'minus';
$result->toc .= "\t\t".'<li><a href="javascript:expandCollide(\'img'.$sublist.'\',\'s'.$sublist.'\','.$nextsco->id.');">'.
'<img id="img'.$sublist.'" src="'.$scormpixdir.'/'.$icon.'.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
} else if ($isvisible) {
- $result->toc .= "\t\t".'<li><img src="'.$scormpixdir.'/spacer.gif" alt="spacer" />';
+ $result->toc .= "\t\t".'<li><img src="'.$scormpixdir.'/spacer.gif" alt="" />';
}
if (empty($sco->title)) {
$sco->title = $sco->identifier;
} 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)) {
$shownext = isset($sco->next) ? $sco->next : 0;
$showprev = isset($sco->prev) ? $sco->prev : 0;
}
-
+
if (($nextid == 0) && (scorm_count_launchable($scorm->id,$currentorg) > 1) && ($nextsco!==false) && (!$findnext)) {
if (!empty($sco->launch)) {
$previd = $sco->id;
for ($i=0;$i<$level;$i++) {
$result->toc .= "\t\t</ul></li>\n";
}
-
+
if ($play) {
$sco = $DB->get_record('scorm_scoes', array('id'=>$scoid));
$sco->previd = $previd;
//]]>
</script>'."\n";
}
-
+
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.$modestr.'&scoid=';
$result->tocmenu = popup_form($url,$tocmenus, "tocmenu", $sco->id, '', '', '', true);