Permalink
Browse files

MDL-33755 mod/scorm: directview scorm activity

Enable direct view of scorm activity from the course
overview page

Conflicts:

	mod/scorm/view.js
  • Loading branch information...
1 parent 02ed0df commit 35cfa9e62ce0e7c35676afbdaf354ec8f6708454 @piersharding piersharding committed with danmarsden Jun 14, 2012
Showing with 52 additions and 7 deletions.
  1. +8 −3 mod/scorm/player.php
  2. +1 −0 mod/scorm/styles.css
  3. +17 −1 mod/scorm/view.js
  4. +26 −3 mod/scorm/view.php
View
@@ -180,9 +180,14 @@
$PAGE->set_button($exitlink);
}
-$PAGE->requires->data_for_js('scormplayerdata', Array('cwidth'=>$scorm->width,
- 'cheight'=>$scorm->height,
- 'popupoptions' => $scorm->options), true);
+$PAGE->requires->data_for_js('scormplayerdata', Array('launch' => 0,
+ 'currentorg' => '',
+ 'sco' => 0,
+ 'scorm' => 0,
+ 'courseid' => $scorm->course,
+ 'cwidth' => $scorm->width,
+ 'cheight' => $scorm->height,
+ 'popupoptions' => $scorm->options), true);
$PAGE->requires->js('/mod/scorm/request.js', true);
$PAGE->requires->js('/lib/cookies.js', true);
$PAGE->requires->css('/mod/scorm/styles.css');
View
@@ -13,6 +13,7 @@
#page-mod-scorm-player #scormpage #toctree {position:relative;width:100%;overflow-x: auto;overflow-y: auto;}
#page-mod-scorm-player #tocbox {position: relative;left: 0px;width: 100%;height: 100%;font-size: 0.8em;}
#page-mod-scorm-player #tochead {position: relative;text-align: center;top: 3px;height: 30px;}
+#page-mod-scorm-player #scormpage .scoframe {frameborder: 0;}
#page-mod-scorm-player .toc,
#page-mod-scorm-player .no-toc {width: 100%;}
View
@@ -4,6 +4,14 @@ M.mod_scormform.init = function(Y) {
var cwidth = scormplayerdata.cwidth;
var cheight = scormplayerdata.cheight;
var poptions = scormplayerdata.popupoptions;
+ var courseid = scormplayerdata.courseid;
+ 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;
+
if ((cwidth==100) && (cheight==100)) {
poptions = poptions+',width='+screen.availWidth+',height='+screen.availHeight+',left=0,top=0';
} else {
@@ -15,5 +23,13 @@ M.mod_scormform.init = function(Y) {
}
poptions = poptions+',width='+cwidth+',height='+cheight;
}
- scormform.onsubmit = function() {window.open('', 'Popup', poptions); this.target='Popup';};
+
+ if (launch != 0) {
+ if (launch == 2) {
+ launch_url = launch_url+"&display=popup";
+ }
+ window.open(launch_url,'Popup', poptions);
+ parent.window.location = course_url;
+ }
+ scormform.onsubmit = function() {window.open('', 'Popup', poptions); this.target='Popup'; parent.window.location = course_url;};
}
View
@@ -59,9 +59,32 @@
require_login($course, false, $cm);
if (!empty($scorm->popup)) {
- $PAGE->requires->data_for_js('scormplayerdata', Array('cwidth'=>$scorm->width,
- 'cheight'=>$scorm->height,
- 'popupoptions' => $scorm->options), true);
+ $launch = 0;
+ $orgidentifier = '';
+ $scoid = 0;
+ if ($scorm->skipview >= 1) {
+ // do we launch immediately and redirect the parent back ?
+ if ($scorm->skipview == 2 || (scorm_get_tracks($scoes[0]->id, $USER->id) === false)) {
+ $orgidentifier = '';
+ if ($sco = scorm_get_sco($scorm->launch, SCO_ONLY)) {
+ if (($sco->organization == '') && ($sco->launch == '')) {
+ $orgidentifier = $sco->identifier;
+ } else {
+ $orgidentifier = $sco->organization;
+ }
+ $scoid = $sco->id;
+ }
+ $launch = $scorm->skipview;
+ }
+ }
+ $PAGE->requires->data_for_js('scormplayerdata', Array('launch' => $launch,
+ 'currentorg' => $orgidentifier,
+ 'sco' => $scoid,
+ 'scorm' => $scorm->id,
+ 'courseid' => $scorm->course,
+ 'cwidth' => $scorm->width,
+ 'cheight' => $scorm->height,
+ 'popupoptions' => $scorm->options), true);
$PAGE->requires->js('/mod/scorm/view.js', true);
}

0 comments on commit 35cfa9e

Please sign in to comment.