mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 21:45:37 +02:00
Added multi attempt management
Readded popup menu structure mode Fixed autocontinue/nav.event with XHTML code
This commit is contained in:
parent
b449858177
commit
aedbddfd31
@ -3,7 +3,7 @@ SCORM Module by Roberto "Bobo" Pinna
|
||||
This module is a SCORM player that import SCORM packages in .zip or .pif format
|
||||
(they are the same thing).
|
||||
At this time the SCORM module import packages in SCORM1.2, SCORM1.3 (aka SCORM2004) and AICC.
|
||||
It plays SCORM1.2 and launch AICC packages.
|
||||
The SCORM 1.3 support still under development use it carefully.
|
||||
|
||||
Moodle SCORM Module is SCORM Version 1.2 Run-Time Environment Conformant -
|
||||
Minimum with All Optional Data Model Elements (LMS-RTE3)
|
||||
@ -12,21 +12,30 @@ SCORM MODULE IS JAVA FREE.
|
||||
|
||||
================================================================
|
||||
|
||||
FIX TO DO:
|
||||
Autocontinue & nav.event call
|
||||
|
||||
================================================================
|
||||
|
||||
ROAD MAP
|
||||
|
||||
Moodle 1.6
|
||||
A popup window display mode. DONE (needs some javascript fixing)
|
||||
New Moodle course format: SCORM. DONE (needs to check CSS)
|
||||
Complete AICC conformance.
|
||||
A popup window display mode. DONE
|
||||
New Moodle course format: SCORM. DONE
|
||||
Add prerequisites support to SCORM 1.2. DONE
|
||||
Customizable player page. DONE
|
||||
Multiple attempt management.
|
||||
Complete AICC conformance.
|
||||
|
||||
|
||||
Moodle 1.7
|
||||
Customizable detailed report page.
|
||||
Complete conformity to SCORM 2004 RTE.
|
||||
Support of SCORM 2004's sequencing and navigation.
|
||||
New package validation subsystem.
|
||||
|
||||
Moodle 2.0
|
||||
Many GREAT new features that NOW we can't think about.
|
||||
The BIG Boh?!
|
||||
|
||||
================================================================
|
||||
|
||||
@ -72,4 +81,4 @@ loadSCO.php |
|
||||
|
||||
|
||||
================================================================
|
||||
Updated to April 19 2005
|
||||
Updated January 9th 2006
|
||||
|
@ -24,18 +24,8 @@
|
||||
if (isset($SESSION->scorm_status)) {
|
||||
$status = $SESSION->scorm_status;
|
||||
}
|
||||
if (isset($SESSION->newattempt)) {
|
||||
$newattempt = $SESSION->newattempt;
|
||||
$SESSION->newattempt = '';
|
||||
} else {
|
||||
$newattempt = '';
|
||||
}
|
||||
if ($lastattempt = get_record('scorm_scoes_track', 'userid', $USER->id, 'scorm', $scorm->id, 'scoid', $scoid,'max(attempt) as a')) {
|
||||
if ($newattempt == 'new') {
|
||||
$attempt = $lastattempt->a + 1;
|
||||
} else {
|
||||
$attempt = $lastattempt->a;
|
||||
}
|
||||
if (isset($SESSION->attempt)) {
|
||||
$attempt = $SESSION->attempt;
|
||||
} else {
|
||||
$attempt = 1;
|
||||
}
|
||||
@ -58,7 +48,7 @@
|
||||
if ($status != 'Running') {
|
||||
echo "error = 101\nerror_text = Terminated\n";
|
||||
} else {
|
||||
if ($usertrack=scorm_get_tracks($scoid,$USER->id)) {
|
||||
if ($usertrack=scorm_get_tracks($scoid,$USER->id,$attempt)) {
|
||||
$userdata = $usertrack;
|
||||
} else {
|
||||
$userdata->status = '';
|
||||
|
@ -7,7 +7,7 @@
|
||||
$a = optional_param('a', '', PARAM_INT); // scorm ID
|
||||
$scoid = required_param('scoid', '', PARAM_INT); // sco ID
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA); // navigation mode
|
||||
$attempt = optional_param('attempt', '', PARAM_ALPHA); // new attempt
|
||||
$attempt = required_param('attempt', '', PARAM_INT); // new attempt
|
||||
|
||||
if (!empty($id)) {
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
if ($usertrack=scorm_get_tracks($scoid,$USER->id)) {
|
||||
if ($usertrack=scorm_get_tracks($scoid,$USER->id,$attempt)) {
|
||||
$userdata = $usertrack;
|
||||
} else {
|
||||
$userdata->status = '';
|
||||
@ -78,7 +78,6 @@
|
||||
?>
|
||||
|
||||
var errorCode = "0";
|
||||
|
||||
function underscore(str) {
|
||||
return str.replace(/\./g,"__");
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||
$a = optional_param('a', '', PARAM_INT); // scorm ID
|
||||
$scoid = required_param('scoid', '', PARAM_INT); // sco ID
|
||||
$newattempt = optional_param('attempt', '', PARAM_ALPHA); // new attempt ?
|
||||
$attempt = required_param('attempt', '', PARAM_INT); // attempt number
|
||||
|
||||
if (!empty($id)) {
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
@ -32,19 +32,10 @@
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
|
||||
if (confirm_sesskey() && (!empty($scoid))) {
|
||||
$result = true;
|
||||
if (isstudent($course->id) || (isteacher($course->id) && !isadmin())) {
|
||||
if ($lastattempt = get_record('scorm_scoes_track', 'userid', $USER->id, 'scorm', $scorm->id, 'scoid', $scoid,'max(attempt) as a')) {
|
||||
if ($newattempt == 'new') {
|
||||
$attempt = $lastattempt->a + 1;
|
||||
} else {
|
||||
$attempt = $lastattempt->a;
|
||||
}
|
||||
} else {
|
||||
$attempt = 1;
|
||||
}
|
||||
foreach ($_POST as $element => $value) {
|
||||
if (substr($element,0,3) == 'cmi') {
|
||||
$element = str_replace('__','.',$element);
|
||||
|
@ -196,13 +196,13 @@ function SCORMapi1_2() {
|
||||
result = StoreData(cmi,true);
|
||||
if (nav.event != '') {
|
||||
if (nav.event == 'continue') {
|
||||
setTimeout('top.nextSCO();',500);
|
||||
setTimeout('top.document.location=top.next;',500);
|
||||
} else {
|
||||
setTimeout('top.prevSCO();',500);
|
||||
setTimeout('top.document.location=top.prev;',500);
|
||||
}
|
||||
} else {
|
||||
if (<?php echo $scorm->auto ?> == 1) {
|
||||
setTimeout('top.nextSCO();',500);
|
||||
setTimeout('top.document.location=top.next;',500);
|
||||
}
|
||||
}
|
||||
return "true";
|
||||
@ -528,13 +528,9 @@ function SCORMapi1_2() {
|
||||
} else {
|
||||
datastring = CollectData(data,'cmi');
|
||||
}
|
||||
datastring += '&attempt=<?php echo $attempt ?>';
|
||||
datastring += '&scoid=<?php echo $sco->id ?>';
|
||||
<?php
|
||||
if (!empty($attempt)) {
|
||||
echo "datastring += '&attempt=$attempt';";
|
||||
}
|
||||
?>
|
||||
//popupwin(datastring);
|
||||
|
||||
var myRequest = NewHttpReq();
|
||||
result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/datamodel.php","id=<?php p($id) ?>&sesskey=<?php p($USER->sesskey) ?>"+datastring);
|
||||
results = result.split('\n');
|
||||
|
@ -256,9 +256,9 @@ function scorm_eval_prerequisites($prerequisites,$usertracks) {
|
||||
}
|
||||
|
||||
|
||||
function scorm_insert_track($userid,$scormid,$scoid,$element,$value) {
|
||||
function scorm_insert_track($userid,$scormid,$scoid,$attempt,$element,$value) {
|
||||
$id = null;
|
||||
if ($track = get_record_select('scorm_scoes_track',"userid='$userid' AND scormid='$scormid' AND scoid='$scoid' AND element='$element'")) {
|
||||
if ($track = get_record_select('scorm_scoes_track',"userid='$userid' AND scormid='$scormid' AND scoid='$scoid' AND attempt='$attempt' AND element='$element'")) {
|
||||
$track->value = $value;
|
||||
$track->timemodified = time();
|
||||
$id = update_record('scorm_scoes_track',$track);
|
||||
@ -266,6 +266,7 @@ function scorm_insert_track($userid,$scormid,$scoid,$element,$value) {
|
||||
$track->userid = $userid;
|
||||
$track->scormid = $scormid;
|
||||
$track->scoid = $scoid;
|
||||
$track->attempt = $attempt;
|
||||
$track->element = $element;
|
||||
$track->value = addslashes($value);
|
||||
$track->timemodified = time();
|
||||
@ -348,8 +349,9 @@ function scorm_grade_user($scoes, $userid, $grademethod=VALUESCOES) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$attempt = scorm_get_last_attempt(current($scoes)->scorm, $userid);
|
||||
foreach ($scoes as $sco) {
|
||||
if ($userdata=scorm_get_tracks($sco->id, $userid)) {
|
||||
if ($userdata=scorm_get_tracks($sco->id, $userid,$attempt)) {
|
||||
if (($userdata->status == 'completed') || ($userdata->status == 'passed')) {
|
||||
$scores->scoes++;
|
||||
}
|
||||
@ -384,13 +386,14 @@ function scorm_count_launchable($scormid,$organization) {
|
||||
return count_records_select('scorm_scoes',"scorm=$scormid AND organization='$organization' AND launch<>''");
|
||||
}
|
||||
|
||||
function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$play=false) {
|
||||
function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='normal',$attempt='',$play=false) {
|
||||
global $CFG;
|
||||
|
||||
$strexpand = get_string('expcoll','scorm');
|
||||
|
||||
$result = new stdClass();
|
||||
$result->toc = "<ul id='0' class='$liststyle'>\n";
|
||||
$tocmenus = array();
|
||||
$result->prerequisites = true;
|
||||
$incomplete = false;
|
||||
$organizationsql = '';
|
||||
@ -398,25 +401,26 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||
if (!empty($currentorg)) {
|
||||
if (($organizationtitle = get_field('scorm_scoes','title','scorm',$scorm->id,'identifier',$currentorg)) != '') {
|
||||
$result->toc .= "\t<li>$organizationtitle</li>\n";
|
||||
$tocmenus[] = $organizationtitle;
|
||||
}
|
||||
$organizationsql = "AND organization='$currentorg'";
|
||||
}
|
||||
if (empty($attempt)) {
|
||||
$attempt = scorm_get_last_attempt($scorm->id, $user->id);
|
||||
}
|
||||
$result->attemptleft = $scorm->maxattempt - $attempt;
|
||||
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' $organizationsql order by id ASC")){
|
||||
$usertracks = array();
|
||||
$maxattempt = 0;
|
||||
foreach ($scoes as $sco) {
|
||||
if (!empty($sco->launch)) {
|
||||
if ($usertrack=scorm_get_tracks($sco->id,$user->id)) {
|
||||
if ($usertrack=scorm_get_tracks($sco->id,$user->id,$attempt)) {
|
||||
if ($usertrack->status == '') {
|
||||
$usertrack->status = 'notattempted';
|
||||
}
|
||||
$attempt = scorm_get_last_attempt($sco->id, $user->id);
|
||||
$maxattempt = $attempt > $maxattempt ? $attempt : $maxattempt;
|
||||
$usertracks[$sco->identifier] = $usertrack;
|
||||
}
|
||||
}
|
||||
}
|
||||
$result->attemptleft = $scorm->maxattempt - $maxattempt;
|
||||
|
||||
$level=0;
|
||||
$sublist=1;
|
||||
@ -508,7 +512,9 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = true;
|
||||
}
|
||||
$result->toc .= ' '.$startbold.'<a href="'.$CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'¤torg='.$currentorg.'&mode='.$mode.'&scoid='.$sco->id.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.'&mode='.$mode.'&scoid='.$sco->id;
|
||||
$result->toc .= ' '.$startbold.'<a href="'.$url.'">'.format_string($sco->title).'</a>'.$score.$endbold."</li>\n";
|
||||
$tocmenus[$sco->id] = scorm_repeater('−',$level) . '>' . format_string($sco->title);
|
||||
} else {
|
||||
if ($sco->id == $scoid) {
|
||||
$result->prerequisites = false;
|
||||
@ -540,12 +546,15 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||
}
|
||||
$result->toc .= "\t</ul>\n";
|
||||
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'&currentorg='.$currentorg.'&mode='.$mode.'&scoid=';
|
||||
$result->tocmenu = popup_form($url,$tocmenus, "tocmenu", $sco->id, '', '', '', true);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function scorm_get_last_attempt($scoid, $userid) {
|
||||
/// Find the last attempt number for the given user id and sco
|
||||
if ($lastattempt = get_record('scorm_scoes_track', 'userid', $userid, 'scoid', $scoid, '', '', 'max(attempt) as a')) {
|
||||
function scorm_get_last_attempt($scormid, $userid) {
|
||||
/// Find the last attempt number for the given user id and scorm id
|
||||
if ($lastattempt = get_record('scorm_scoes_track', 'userid', $userid, 'scormid', $scormid, '', '', 'max(attempt) as a')) {
|
||||
if (empty($lastattempt->a)) {
|
||||
return '1';
|
||||
} else {
|
||||
@ -554,11 +563,18 @@ function scorm_get_last_attempt($scoid, $userid) {
|
||||
}
|
||||
}
|
||||
|
||||
function scorm_get_tracks($scoid,$userid) {
|
||||
function scorm_get_tracks($scoid,$userid,$attempt='') {
|
||||
/// Gets all tracks of specified sco and user
|
||||
global $CFG;
|
||||
|
||||
$attemptsql = ' AND attempt=' . scorm_get_last_attempt($scoid, $userid);
|
||||
if (empty($attempt)) {
|
||||
if ($scormid = get_field('scorm_scoes','scorm','id',$scoid)) {
|
||||
$attempt = scorm_get_last_attempt($scormid,$userid);
|
||||
} else {
|
||||
$attempt = 1;
|
||||
}
|
||||
}
|
||||
$attemptsql = ' AND attempt=' . $attempt;
|
||||
if ($tracks = get_records_select('scorm_scoes_track',"userid=$userid AND scoid=$scoid".$attemptsql,'element ASC')) {
|
||||
$usertrack->userid = $userid;
|
||||
$usertrack->scoid = $scoid;
|
||||
@ -1021,6 +1037,156 @@ function scorm_parse_scorm($pkgdir,$scormid) {
|
||||
return $launch;
|
||||
}
|
||||
|
||||
function scorm_course_format_display($user,$course) {
|
||||
global $CFG;
|
||||
|
||||
$strupdate = get_string('update');
|
||||
$strmodule = get_string('modulename','scorm');
|
||||
|
||||
echo '<div class="mod-scorm">';
|
||||
if ($scorms = get_all_instances_in_course('scorm', $course)) {
|
||||
// The module SCORM activity with the least id is the course
|
||||
$scorm = current($scorms);
|
||||
if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
$colspan = '';
|
||||
$headertext = '<table width="100%"><tr><td class="title">'.get_string('name').': <b>'.format_string($scorm->name).'</b>';
|
||||
if (isteacher($course->id, $user->id, true)) {
|
||||
if (isediting($course->id)) {
|
||||
// Display update icon
|
||||
$path = $CFG->wwwroot.'/course';
|
||||
$headertext .= '<span class="commands">'.
|
||||
'<a title="'.$strupdate.'" href="'.$path.'/mod.php?update='.$cm->id.'&sesskey='.sesskey().'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" hspace="2" height="11" width="11" border="0" alt="'.$strupdate.'" /></a></span>';
|
||||
}
|
||||
$headertext .= '</td>';
|
||||
// Display report link
|
||||
$trackedusers = get_record('scorm_scoes_track', 'scormid', $scorm->id, '', '', '', '', 'count(distinct(userid)) as c');
|
||||
if ($trackedusers->c > 0) {
|
||||
$headertext .= '<td class="reportlink">'.
|
||||
'<a target="'.$CFG->framename.'" href="'.$CFG->wwwroot.'/mod/scorm/report.php?id='.$cm->id.'">'.
|
||||
get_string('viewallreports','scorm',$trackedusers->c).'</a>';
|
||||
} else {
|
||||
$headertext .= '<td class="reportlink">'.get_string('noreports','scorm');
|
||||
}
|
||||
$colspan = ' colspan="2"';
|
||||
}
|
||||
$headertext .= '</td></tr><tr><td'.$colspan.'>'.format_text(get_string('summary').':<br />'.$scorm->summary).'</td></tr></table>';
|
||||
print_simple_box($headertext,'','100%');
|
||||
scorm_view_display($user, $scorm, 'view.php?id='.$course->id, $cm);
|
||||
} else {
|
||||
if (isteacheredit($course->id, $user->id)) {
|
||||
// Create a new activity
|
||||
redirect('mod.php?id='.$course->id.'&section=0&sesskey='.sesskey().'&add=scorm');
|
||||
} else {
|
||||
notify('Could not find a scorm course here');
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function scorm_view_display ($user, $scorm, $action, $cm) {
|
||||
global $CFG;
|
||||
|
||||
$organization = optional_param('organization', '', PARAM_INT);
|
||||
|
||||
print_simple_box_start('center','100%');
|
||||
?>
|
||||
<div class="structurehead"><?php print_string('coursestruct','scorm') ?></div>
|
||||
<?php
|
||||
if (empty($organization)) {
|
||||
$organization = $scorm->launch;
|
||||
}
|
||||
if ($orgs = get_records_select_menu('scorm_scoes',"scorm='$scorm->id' AND organization='' AND launch=''",'id','id,title')) {
|
||||
if (count($orgs) > 1) {
|
||||
?>
|
||||
<div class='center'>
|
||||
<?php print_string('organizations','scorm') ?>
|
||||
<form name='changeorg' method='post' action='<?php echo $action ?>'>
|
||||
<?php choose_from_menu($orgs, 'organization', "$organization", '','submit()') ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
$orgidentifier = '';
|
||||
if ($org = get_record('scorm_scoes','id',$organization)) {
|
||||
if (($org->organization == '') && ($org->launch == '')) {
|
||||
$orgidentifier = $org->identifier;
|
||||
} else {
|
||||
$orgidentifier = $org->organization;
|
||||
}
|
||||
}
|
||||
$result = scorm_get_toc($user,$scorm,'structlist',$orgidentifier);
|
||||
$incomplete = $result->incomplete;
|
||||
echo $result->toc;
|
||||
print_simple_box_end();
|
||||
?>
|
||||
<div class="center">
|
||||
<form name="theform" method="post" action="<?php echo $CFG->wwwroot ?>/mod/scorm/player.php?id=<?php echo $cm->id ?>"<?php echo $scorm->popup == 1?' target="newwin"':'' ?>>
|
||||
<?php
|
||||
if ($scorm->hidebrowse == 0) {
|
||||
print_string("mode","scorm");
|
||||
echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">'.get_string('browse','scorm').'</label>'."\n";
|
||||
if ($incomplete === true) {
|
||||
echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">'.get_string('normal','scorm')."</label>\n";
|
||||
} else {
|
||||
echo '<input type="radio" id="r" name="mode" value="review" checked="checked" /><label for="r">'.get_string('review','scorm')."</label>\n";
|
||||
}
|
||||
} else {
|
||||
if ($incomplete === true) {
|
||||
echo '<input type="hidden" name="mode" value="normal" />'."\n";
|
||||
} else {
|
||||
echo '<input type="hidden" name="mode" value="review" />'."\n";
|
||||
}
|
||||
}
|
||||
if (($incomplete === false) && ($result->attemptleft > 0)) {
|
||||
?>
|
||||
<br />
|
||||
<input type="checkbox" id="a" name="newattempt" />
|
||||
<label for="a"><?php print_string('newattempt','scorm') ?></label>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<br />
|
||||
<input type="hidden" name="scoid" />
|
||||
<input type="hidden" name="currentorg" value="<?php echo $orgidentifier ?>" />
|
||||
<input type="submit" value="<? print_string('entercourse','scorm') ?>" />
|
||||
</form>
|
||||
</div>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function expandCollide(which,list) {
|
||||
var nn=document.ids?true:false
|
||||
var w3c=document.getElementById?true:false
|
||||
var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all.";
|
||||
var mid=w3c?").style":".style";
|
||||
|
||||
if (eval(beg+list+mid+".display") != "none") {
|
||||
which.src = "<?php echo $CFG->wwwroot ?>/mod/scorm/pix/plus.gif";
|
||||
eval(beg+list+mid+".display='none';");
|
||||
} else {
|
||||
which.src = "<?php echo $CFG->wwwroot ?>/mod/scorm/pix/minus.gif";
|
||||
eval(beg+list+mid+".display='block';");
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
function scorm_repeater($what, $times) {
|
||||
if ($times <= 0) {
|
||||
return null;
|
||||
}
|
||||
$return = '';
|
||||
for ($i=0; $i<$times;$i++) {
|
||||
$return .= $what;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/* Usage
|
||||
Grab some XML data, either from a file, URL, etc. however you want. Assume storage in $strYourXML;
|
||||
|
@ -24,6 +24,9 @@
|
||||
if (empty($form->maxgrade)) {
|
||||
$form->maxgrade = '';
|
||||
}
|
||||
if (empty($form->maxattempt)) {
|
||||
$form->maxattempt = '1';
|
||||
}
|
||||
if (empty($form->grademethod)) {
|
||||
$form->grademethod = '0';
|
||||
}
|
||||
@ -229,6 +232,18 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string('maximumattempts','scorm') ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$attempts[$i] = $i;
|
||||
}
|
||||
choose_from_menu($attempts, 'maxattempt', $form->maxattempt, '','','0',false);
|
||||
helpbutton('maxattempt', get_string('maximumattempts'), 'scorm');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="2"><hr /></td></tr>
|
||||
|
||||
<tr>
|
||||
@ -273,8 +288,9 @@
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
$options[0]=get_string('no');
|
||||
$options[1]=get_string('yes');
|
||||
$options[1]=get_string('hidden','scorm');
|
||||
$options[0]=get_string('sided','scorm');
|
||||
$options[2]=get_string('popupmenu','scorm');
|
||||
choose_from_menu ($options, 'hidetoc', $form->hidetoc, '');
|
||||
?>
|
||||
</td>
|
||||
|
@ -13,19 +13,7 @@
|
||||
$scoid = required_param('scoid', '', PARAM_INT); // sco ID
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA); // navigation mode
|
||||
$currentorg = optional_param('currentorg', '', PARAM_RAW); // selected organization
|
||||
|
||||
$modestring = '';
|
||||
$scoidstring = '';
|
||||
$currentorgstring = '';
|
||||
if (!empty($mode)) {
|
||||
$modestring = '&mode='.$mode;
|
||||
}
|
||||
if (!empty($scoid)) {
|
||||
$scoidstring = '&scoid='.$scoid;
|
||||
}
|
||||
if (!empty($currentorg)) {
|
||||
$currentorgstring = '¤torg='.$currentorg;
|
||||
}
|
||||
$newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt
|
||||
|
||||
if (!empty($id)) {
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
@ -77,16 +65,27 @@
|
||||
//
|
||||
// TOC processing
|
||||
//
|
||||
$result = scorm_get_toc($USER,$scorm,'structurelist',$currentorg,$scoid,$mode,true);
|
||||
$attempt = scorm_get_last_attempt($scorm->id, $USER->id);
|
||||
if (($newattempt=='on') && ($attempt < $scorm->maxattempt)) {
|
||||
$attempt++;
|
||||
if ($mode == 'review') {
|
||||
$mode = 'normal';
|
||||
}
|
||||
}
|
||||
$attemptstr = '&attempt=' . $attempt;
|
||||
|
||||
$result = scorm_get_toc($USER,$scorm,'structurelist',$currentorg,$scoid,$mode,$attempt,true);
|
||||
$sco = $result->sco;
|
||||
|
||||
if (($mode == 'browse') && ($scorm->hidebrowse == 1)) {
|
||||
$mode = 'normal';
|
||||
}
|
||||
if ($mode == 'normal') {
|
||||
if ($trackdata = scorm_get_tracks($USER->id,$sco->id)) {
|
||||
if (($mode == 'normal') || ($mode == 'review')) {
|
||||
if ($trackdata = scorm_get_tracks($sco->id,$USER->id,$attempt)) {
|
||||
if (($trackdata->status == 'completed') || ($trackdata->status == 'passed') || ($trackdata->status == 'failed')) {
|
||||
$mode = 'review';
|
||||
} else {
|
||||
$mode = 'normal';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,14 +96,11 @@
|
||||
$scoidpop = '&scoid='.$sco->id;
|
||||
$modestr = '&mode='.$mode;
|
||||
$modepop = '&mode='.$mode;
|
||||
$attemptstr = '';
|
||||
if ((!$result->incomplete) && ($result->attemptleft > 0)) {
|
||||
$attemptstr = '&attempt=new';
|
||||
}
|
||||
|
||||
$SESSION->scorm_scoid = $sco->id;
|
||||
$SESSION->scorm_status = 'Not Initialized';
|
||||
$SESSION->scorm_mode = $mode;
|
||||
$SESSION->attempt = $attempt;
|
||||
|
||||
//
|
||||
// Print the page header
|
||||
@ -149,6 +145,15 @@
|
||||
?>
|
||||
<div id="scormbox"<?php echo $class ?>>
|
||||
<?php
|
||||
$orgstr = '¤torg='.$currentorg;
|
||||
if (($sco->previd != 0) && ($sco->previous == 0)) {
|
||||
$scostr = '&scoid='.$sco->previd;
|
||||
echo '<script language="javascript">var prev="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr.'";</script>';
|
||||
}
|
||||
if (($sco->nextid != 0) && ($sco->next == 0)) {
|
||||
$scostr = '&scoid='.$sco->nextid;
|
||||
echo '<script language="javascript">var next="'.$CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr.'";</script>';
|
||||
}
|
||||
// This very big test check if is necessary the "scormtop" div
|
||||
if (
|
||||
($mode != 'normal') || // We are not in normal mode so review or browse text will displayed
|
||||
@ -162,7 +167,8 @@
|
||||
(
|
||||
($sco->nextid != 0) && // This is not the last learning object of the package
|
||||
($sco->next == 0) // Moodle must manage the next link
|
||||
)
|
||||
) ||
|
||||
($scorm->hidetoc == 2) // Teacher want to display toc in a small popup menu
|
||||
)
|
||||
)
|
||||
) {
|
||||
@ -179,14 +185,17 @@
|
||||
if (($sco->previd != 0) && ($sco->previous == 0)) {
|
||||
/// Print the prev LO link
|
||||
$scostr = '&scoid='.$sco->previd;
|
||||
$prevlink = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
||||
echo '<a href="'.$prevlink.'">< '.get_string('prev','scorm').'</a>';
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
||||
echo '<a href="'.$url.'">< '.get_string('prev','scorm').'</a>';
|
||||
}
|
||||
if ($scorm->hidetoc == 2) {
|
||||
echo $result->tocmenu;
|
||||
}
|
||||
if (($sco->nextid != 0) && ($sco->next == 0)) {
|
||||
/// Print the next LO link
|
||||
$scostr = '&scoid='.$sco->nextid;
|
||||
$nextlink = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
||||
echo ' <a href="'.$nextlink.'">'.get_string('next','scorm').' ></a>';
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modestr.$scostr;
|
||||
echo ' <a href="'.$url.'">'.get_string('next','scorm').' ></a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -24,21 +24,22 @@ function NewHttpReq() {
|
||||
function DoRequest(httpReq,url,param) {
|
||||
|
||||
// httpReq.open (Method("get","post"), URL(string), Asyncronous(true,false))
|
||||
|
||||
//popupwin(url+"\n"+param);
|
||||
httpReq.open("POST", url,false);
|
||||
httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
httpReq.send(param);
|
||||
httpReq.send(param)
|
||||
if (httpReq.status == 200) {
|
||||
//popupwin(url+"\n"+param+"\n"+httpReq.responseText);
|
||||
return httpReq.responseText;
|
||||
} else {
|
||||
return httpReq.status;
|
||||
}
|
||||
}
|
||||
|
||||
/*function popupwin(content) {
|
||||
function popupwin(content) {
|
||||
var op = window.open();
|
||||
op.document.open('text/plain');
|
||||
op.document.write(content);
|
||||
op.document.close();
|
||||
}*/
|
||||
//-->
|
||||
}
|
||||
//-->
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||
$a = optional_param('a', '', PARAM_INT); // scorm ID
|
||||
$organization = optional_param('organization', '', PARAM_INT); // organization ID
|
||||
//$organization = optional_param('organization', '', PARAM_INT); // organization ID
|
||||
|
||||
if (!empty($id)) {
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
@ -79,91 +79,7 @@
|
||||
print_heading(format_string($scorm->name));
|
||||
|
||||
print_simple_box(format_text($scorm->summary), 'center', '70%', '', 5, 'generalbox', 'intro');
|
||||
|
||||
print_simple_box_start('center');
|
||||
?>
|
||||
<div class="structurehead"><?php print_string('coursestruct','scorm') ?></div>
|
||||
<?php
|
||||
if (empty($organization)) {
|
||||
$organization = $scorm->launch;
|
||||
}
|
||||
if ($orgs = get_records_select_menu('scorm_scoes',"scorm='$scorm->id' AND organization='' AND launch=''",'id','id,title')) {
|
||||
if (count($orgs) > 1) {
|
||||
?>
|
||||
<div class='center'>
|
||||
<?php print_string('organizations','scorm') ?>
|
||||
<form name='changeorg' method='post' action='view.php?id=<?php echo $cm->id ?>'>
|
||||
<?php choose_from_menu($orgs, 'organization', "$organization", '','submit()') ?>
|
||||
<noscript>
|
||||
<input type="submit" value=">" />
|
||||
</noscript>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
$orgidentifier = '';
|
||||
if ($org = get_record('scorm_scoes','id',$organization)) {
|
||||
if (($org->organization == '') && ($org->launch == '')) {
|
||||
$orgidentifier = $org->identifier;
|
||||
} else {
|
||||
$orgidentifier = $org->organization;
|
||||
}
|
||||
}
|
||||
$result = scorm_get_toc($USER,$scorm,'structurelist',$orgidentifier);
|
||||
$incomplete = $result->incomplete;
|
||||
echo $result->toc;
|
||||
print_simple_box_end();
|
||||
?>
|
||||
<div class="center">
|
||||
<form name="theform" method="post" action="player.php?id=<?php echo $cm->id ?>">
|
||||
<?php
|
||||
if ($scorm->hidebrowse == 0) {
|
||||
print_string("mode","scorm");
|
||||
echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">'.get_string('browse','scorm').'</label>'."\n";
|
||||
if ($incomplete === true) {
|
||||
echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">'.get_string('normal','scorm')."</label>\n";
|
||||
} else {
|
||||
echo '<input type="radio" id="r" name="mode" value="review" checked="checked" /><label for="r">'.get_string('review','scorm')."</label>\n";
|
||||
}
|
||||
} else {
|
||||
if ($incomplete === true) {
|
||||
echo '<input type="hidden" name="mode" value="normal" />'."\n";
|
||||
} else {
|
||||
echo '<input type="hidden" name="mode" value="review" />'."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<br />
|
||||
<input type="hidden" name="scoid" />
|
||||
<input type="hidden" name="currentorg" value="<?php echo $orgidentifier ?>" />
|
||||
<input type="submit" value="<?php print_string('entercourse','scorm') ?>" />
|
||||
</form>
|
||||
</div>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function playSCO(scoid) {
|
||||
document.theform.scoid.value = scoid;
|
||||
document.theform.submit();
|
||||
}
|
||||
|
||||
function expandCollide(which,list) {
|
||||
var nn=document.ids?true:false
|
||||
var w3c=document.getElementById?true:false
|
||||
var beg=nn?"document.ids.":w3c?"document.getElementById(":"document.all.";
|
||||
var mid=w3c?").style":".style";
|
||||
|
||||
if (eval(beg+list+mid+".display") != "none") {
|
||||
which.src = "<?php echo $CFG->wwwroot ?>/mod/scorm/pix/plus.gif";
|
||||
eval(beg+list+mid+".display='none';");
|
||||
} else {
|
||||
which.src = "<?php echo $CFG->wwwroot ?>/mod/scorm/pix/minus.gif";
|
||||
eval(beg+list+mid+".display='block';");
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
<?php
|
||||
scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm);
|
||||
print_footer($course);
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user