Permalink
Browse files

MDL-38489 SCORM: added check for course display format

  • Loading branch information...
1 parent 83f26f6 commit 011ae52a91d6ed9d73b69a642d5b34551a8b6e7a @vmonaco vmonaco committed with danmarsden May 10, 2013
Showing with 17 additions and 1 deletion.
  1. +2 −1 mod/scorm/view.js
  2. +15 −0 mod/scorm/view.php
View
3 mod/scorm/view.js
@@ -5,12 +5,13 @@ M.mod_scormform.init = function(Y) {
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+"&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)) {
poptions = poptions+',width='+screen.availWidth+',height='+screen.availHeight+',left=0,top=0';
View
15 mod/scorm/view.php
@@ -83,11 +83,26 @@
$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,
'currentorg' => $orgidentifier,
'sco' => $scoid,
'scorm' => $scorm->id,
'courseid' => $scorm->course,
+ 'sectionid' => $sectionid,
'cwidth' => $scorm->width,
'cheight' => $scorm->height,
'popupoptions' => $scorm->options), true);

0 comments on commit 011ae52

Please sign in to comment.