From b98dcd7dd68f09823c666bbdabcfbe9633273522 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 29 Aug 2013 14:44:36 +1200 Subject: [PATCH] MDL-38489 SCORM: use course_get_format to obtain info --- mod/scorm/view.js | 4 +--- mod/scorm/view.php | 15 ++++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/mod/scorm/view.js b/mod/scorm/view.js index c1709987352..9884d0a75b3 100644 --- a/mod/scorm/view.js +++ b/mod/scorm/view.js @@ -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+"¤torg="+currentorg+"&scoid="+sco+"&sesskey="+M.cfg.sesskey; - var course_url = M.cfg.wwwroot+"/course/view.php?id="+courseid+"§ionid="+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'; diff --git a/mod/scorm/view.php b/mod/scorm/view.php index d0bb257db0d..24d03644992 100644 --- a/mod/scorm/view.php +++ b/mod/scorm/view.php @@ -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. + $courseformat = course_get_format($course)->get_course(); + $sectionid = ''; + if (isset($courseformat->coursedisplay) && $courseformat->coursedisplay == COURSE_DISPLAY_MULTIPAGE) { $sectionid = $cm->section; - } else { - $sectionid = ''; } $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);