Merge branch 'master_MDL-33755' of git://github.com/danmarsden/moodle
This commit is contained in:
@@ -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' => false,
|
||||
'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');
|
||||
|
||||
@@ -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%;}
|
||||
|
||||
+17
-1
@@ -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+"¤torg="+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 != false) {
|
||||
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;};
|
||||
}
|
||||
|
||||
+36
-10
@@ -58,16 +58,42 @@ 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);
|
||||
$PAGE->requires->js('/mod/scorm/view.js', true);
|
||||
}
|
||||
|
||||
$context = context_course::instance($course->id);
|
||||
$contextmodule = context_module::instance($cm->id);
|
||||
|
||||
$launch = false; // Does this automatically trigger a launch based on skipview.
|
||||
if (!empty($scorm->popup)) {
|
||||
$orgidentifier = '';
|
||||
$scoid = 0;
|
||||
if ($scorm->skipview >= 1 &&
|
||||
has_capability('mod/scorm:skipview', $contextmodule) &&
|
||||
!has_capability('mod/scorm:viewreport', $contextmodule)) { // Don't skip users with the capability to view reports.
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
if (isset($SESSION->scorm)) {
|
||||
unset($SESSION->scorm);
|
||||
}
|
||||
@@ -80,7 +106,7 @@ $pagetitle = strip_tags($shortname.': '.format_string($scorm->name));
|
||||
|
||||
add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id", $cm->id);
|
||||
|
||||
if ((has_capability('mod/scorm:skipview', $contextmodule))) {
|
||||
if (empty($launch) && (has_capability('mod/scorm:skipview', $contextmodule))) {
|
||||
scorm_simple_play($scorm, $USER, $contextmodule, $cm->id);
|
||||
}
|
||||
|
||||
@@ -111,7 +137,7 @@ require($CFG->dirroot . '/mod/scorm/tabs.php');
|
||||
// Print the main part of the page
|
||||
echo $OUTPUT->heading(format_string($scorm->name));
|
||||
$attemptstatus = '';
|
||||
if ($scorm->displayattemptstatus == 1) {
|
||||
if ($scorm->displayattemptstatus == 1 && empty($launch)) {
|
||||
$attemptstatus = scorm_get_attempt_status($USER, $scorm, $cm);
|
||||
}
|
||||
echo $OUTPUT->box(format_module_intro('scorm', $scorm, $cm->id).$attemptstatus, 'generalbox boxaligncenter boxwidthwide', 'intro');
|
||||
@@ -126,7 +152,7 @@ if (!empty($scorm->timeclose) && $timenow > $scorm->timeclose) {
|
||||
echo $OUTPUT->box(get_string("expired", "scorm", userdate($scorm->timeclose)), "generalbox boxaligncenter");
|
||||
$scormopen = false;
|
||||
}
|
||||
if ($scormopen) {
|
||||
if ($scormopen && empty($launch)) {
|
||||
scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);
|
||||
}
|
||||
if (!empty($forcejs)) {
|
||||
|
||||
Reference in New Issue
Block a user