* @return array an array of hide table of contents options
*/
function scorm_get_hidetoc_array() {
- return array(0 =>get_string('sided', 'scorm'),
- 1 => get_string('hidden', 'scorm'),
- 2 => get_string('popupmenu', 'scorm'));
+ return array(SCORM_TOC_SIDE => get_string('sided', 'scorm'),
+ SCORM_TOC_HIDDEN => get_string('hidden', 'scorm'),
+ SCORM_TOC_POPUP => get_string('popupmenu', 'scorm'),
+ SCORM_TOC_DISABLED => get_string('disabled', 'scorm'));
}
/**
if ($scorm->grademethod == GRADESCOES) {
$element = 'cmi.core.lesson_status';
}
- if ($scorm->version == 'scorm1_3') {
+ if ($scorm->version == 'scorm_13' || $scorm->version == 'SCORM_1.3') {
$element = 'cmi.score.raw';
}
$attempts = $DB->get_records_select('scorm_scoes_track', "element=? AND userid=? AND scormid=?", array($element, $userid, $scorm->id), 'attempt', 'DISTINCT attempt AS attemptnumber');
M.mod_scorm = {};
M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launch_sco) {
-
- if (hide_nav == 0) {
- scorm_hide_nav = false;
- }
- else {
- scorm_hide_nav = true;
- }
+ var scorm_disable_toc = false;
+ var scorm_hide_nav = true;
+ var scorm_hide_toc = true;
if (hide_toc == 0) {
+ scorm_hide_nav = false;
scorm_hide_toc = false;
- }
- else {
- scorm_hide_toc = true;
+ } else if (hide_toc == 3) {
+ scorm_disable_toc = true;
}
var scorm_layout_widget;
YAHOO.widget.LayoutUnit.prototype.STR_COLLAPSE = M.str.moodle.hide;
YAHOO.widget.LayoutUnit.prototype.STR_EXPAND = M.str.moodle.show;
- scorm_layout_widget = new YAHOO.widget.Layout('scorm_layout', {
- minWidth: 255,
- minHeight: 600,
- units: [
- { position: 'left', body: 'scorm_toc', header: toc_title, width: 250, resize: true, gutter: '2px 5px 5px 2px', collapse: true, minWidth:250, maxWidth: 590},
- { position: 'center', body: '<div id="scorm_content"></div>', gutter: '2px 5px 5px 2px', scroll: true}
- ]
- });
+ if (scorm_disable_toc) {
+ scorm_layout_widget = new YAHOO.widget.Layout('scorm_layout', {
+ minWidth: 255,
+ minHeight: 600,
+ units: [
+ { position: 'left', body: 'scorm_toc', header: toc_title, width: 0, resize: true, gutter: '0px 0px 0px 0px', collapse: false},
+ { position: 'center', body: '<div id="scorm_content"></div>', gutter: '0px 0px 0px 0px', scroll: true}
+ ]
+ });
+ } else {
+ scorm_layout_widget = new YAHOO.widget.Layout('scorm_layout', {
+ minWidth: 255,
+ minHeight: 600,
+ units: [
+ { position: 'left', body: 'scorm_toc', header: toc_title, width: 250, resize: true, gutter: '2px 5px 5px 2px', collapse: true, minWidth:250, maxWidth: 590},
+ { position: 'center', body: '<div id="scorm_content"></div>', gutter: '2px 5px 5px 2px', scroll: true}
+ ]
+ });
+ }
+
scorm_layout_widget.render();
var left = scorm_layout_widget.getUnitByPosition('left');
- left.on('collapse', function() {
- scorm_resize_frame();
- });
- left.on('expand', function() {
- scorm_resize_frame();
- });
-
+ if (!scorm_disable_toc) {
+ left.on('collapse', function() {
+ scorm_resize_frame();
+ });
+ left.on('expand', function() {
+ scorm_resize_frame();
+ });
+ }
// ugly resizing hack that works around problems with resizing of iframes and objects
left._resize.on('startResize', function() {
var obj = YAHOO.util.Dom.get('scorm_object');
});
// hide the TOC if that is the default
- if (scorm_hide_toc == true) {
- left.collapse();
+ if (!scorm_disable_toc) {
+ if (scorm_hide_toc == true) {
+ left.collapse();
+ }
}
-
// TOC tree
var tree = new YAHOO.widget.TreeView('scorm_tree');
scorm_tree_node = tree;
scorm_bloody_labelclick = true;
}
});
- tree.subscribe('collapse', function(node) {
- if (scorm_bloody_labelclick) {
- scorm_bloody_labelclick = false;
- return false;
- }
- });
- tree.subscribe('expand', function(node) {
- if (scorm_bloody_labelclick) {
- scorm_bloody_labelclick = false;
- return false;
- }
- });
+ if (!scorm_disable_toc) {
+ tree.subscribe('collapse', function(node) {
+ if (scorm_bloody_labelclick) {
+ scorm_bloody_labelclick = false;
+ return false;
+ }
+ });
+ tree.subscribe('expand', function(node) {
+ if (scorm_bloody_labelclick) {
+ scorm_bloody_labelclick = false;
+ return false;
+ }
+ });
+ }
tree.expandAll();
tree.render();