MDL-33755 mod/scorm: directview scorm activity

Enable direct view of scorm activity from the course
overview page

Conflicts:

	mod/scorm/view.js
This commit is contained in:
Piers Harding 2012-06-15 11:34:34 +12:00 committed by Dan Marsden
parent 02ed0df5ae
commit 35cfa9e62c
4 changed files with 52 additions and 7 deletions

View File

@ -180,9 +180,14 @@ if (empty($scorm->popup) || $displaymode=='popup') {
$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 File

@ -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 File

@ -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 File

@ -59,9 +59,32 @@ if (!empty($forcejs)) {
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);
}