MDL-38489 SCORM: use course_get_format to obtain info

This commit is contained in:
Dan Marsden 2013-08-29 14:44:36 +12:00
parent 011ae52a91
commit b98dcd7dd6
2 changed files with 5 additions and 14 deletions

View file

@ -4,14 +4,12 @@ M.mod_scormform.init = function(Y) {
var cwidth = scormplayerdata.cwidth;
var cheight = scormplayerdata.cheight;
var poptions = scormplayerdata.popupoptions;
var courseid = scormplayerdata.courseid;
var sectionid = scormplayerdata.sectionid;
var launch = scormplayerdata.launch;
var currentorg = scormplayerdata.currentorg;
var sco = scormplayerdata.sco;
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 course_url = M.cfg.wwwroot+"/course/view.php?id="+courseid+"&sectionid="+sectionid+"&sesskey="+M.cfg.sesskey;
var course_url = scormplayerdata.courseurl;
if ((cwidth==100) && (cheight==100)) {
poptions = poptions+',width='+screen.availWidth+',height='+screen.availHeight+',left=0,top=0';

View file

@ -83,26 +83,19 @@ if (!empty($scorm->popup)) {
$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 {
$courseformat = course_get_format($course)->get_course();
$sectionid = '';
if (isset($courseformat->coursedisplay) && $courseformat->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
$sectionid = $cm->section;
}
$PAGE->requires->data_for_js('scormplayerdata', Array('launch' => $launch,
'currentorg' => $orgidentifier,
'sco' => $scoid,
'scorm' => $scorm->id,
'courseid' => $scorm->course,
'sectionid' => $sectionid,
'courseurl' => course_get_url($course, $sectionid)->out(false),
'cwidth' => $scorm->width,
'cheight' => $scorm->height,
'popupoptions' => $scorm->options), true);