MDL-38489 SCORM: added check for course display format

This commit is contained in:
Vinnie Monaco 2013-05-10 17:05:03 -04:00 committed by Dan Marsden
parent 83f26f6407
commit 011ae52a91
2 changed files with 17 additions and 1 deletions

View File

@ -5,12 +5,13 @@ M.mod_scormform.init = function(Y) {
var cheight = scormplayerdata.cheight; var cheight = scormplayerdata.cheight;
var poptions = scormplayerdata.popupoptions; var poptions = scormplayerdata.popupoptions;
var courseid = scormplayerdata.courseid; var courseid = scormplayerdata.courseid;
var sectionid = scormplayerdata.sectionid;
var launch = scormplayerdata.launch; var launch = scormplayerdata.launch;
var currentorg = scormplayerdata.currentorg; var currentorg = scormplayerdata.currentorg;
var sco = scormplayerdata.sco; var sco = scormplayerdata.sco;
var scorm = scormplayerdata.scorm; var scorm = scormplayerdata.scorm;
var launch_url = M.cfg.wwwroot+"/mod/scorm/player.php?a="+scorm+"&currentorg="+currentorg+"&scoid="+sco+"&sesskey="+M.cfg.sesskey; var launch_url = M.cfg.wwwroot+"/mod/scorm/player.php?a="+scorm+"&currentorg="+currentorg+"&scoid="+sco+"&sesskey="+M.cfg.sesskey;
var course_url = M.cfg.wwwroot+"/course/view.php?id="+courseid+"&sesskey="+M.cfg.sesskey; var course_url = M.cfg.wwwroot+"/course/view.php?id="+courseid+"&sectionid="+sectionid+"&sesskey="+M.cfg.sesskey;
if ((cwidth==100) && (cheight==100)) { if ((cwidth==100) && (cheight==100)) {
poptions = poptions+',width='+screen.availWidth+',height='+screen.availHeight+',left=0,top=0'; poptions = poptions+',width='+screen.availWidth+',height='+screen.availHeight+',left=0,top=0';

View File

@ -83,11 +83,26 @@ if (!empty($scorm->popup)) {
$launch = true; $launch = true;
} }
} }
// Redirect back to the section with one section per page ?
if (! $coursedisplay = $DB->get_record('course_format_options', array('courseid'=>$scorm->course, 'name'=>'coursedisplay'))) {
print_error('courseformatnotfound', 'error', null, 'coursedisplay');
}
if ($coursedisplay->value == COURSE_DISPLAY_MULTIPAGE) {
// $cm->section references course_sections(id) NOT course_sections(section).
// Better to use this since this takes priority in course view.php.
$sectionid = $cm->section;
} else {
$sectionid = '';
}
$PAGE->requires->data_for_js('scormplayerdata', Array('launch' => $launch, $PAGE->requires->data_for_js('scormplayerdata', Array('launch' => $launch,
'currentorg' => $orgidentifier, 'currentorg' => $orgidentifier,
'sco' => $scoid, 'sco' => $scoid,
'scorm' => $scorm->id, 'scorm' => $scorm->id,
'courseid' => $scorm->course, 'courseid' => $scorm->course,
'sectionid' => $sectionid,
'cwidth' => $scorm->width, 'cwidth' => $scorm->width,
'cheight' => $scorm->height, 'cheight' => $scorm->height,
'popupoptions' => $scorm->options), true); 'popupoptions' => $scorm->options), true);