Added the new features MDL-4482 and MDL-6534 (Course structure view.php skip)

This commit is contained in:
bobopinna 2006-09-26 14:40:00 +00:00
parent 57d52eebfa
commit 8e45ba4522
5 changed files with 74 additions and 5 deletions

View File

@ -23,8 +23,8 @@ Moodle 1.6
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.
Customizable player page. DONE
Multiple attempt management. DONE
Complete AICC conformance.

View File

@ -425,8 +425,12 @@ function scorm_grade_user($scorm, $userid, $time=false) {
}
}
function scorm_count_launchable($scormid,$organization) {
return count_records_select('scorm_scoes',"scorm=$scormid AND organization='$organization' AND launch<>''");
function scorm_count_launchable($scormid,$organization='') {
$strorganization = '';
if (!empty($organization)) {
$strorganization = " AND organization='$organization'";
}
return count_records_select('scorm_scoes',"scorm=$scormid$strorganization AND launch<>''");
}
function scorm_get_last_attempt($scormid, $userid) {
@ -565,6 +569,24 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
<?php
}
function scorm_simple_play($scorm,$user) {
$result = false;
$scoes = get_records_select('scorm_scoes','scorm='.$scorm->id.' AND launch<>""');
if (count($scoes) == 1) {
if ($scorm->skipview >= 1) {
$sco = current($scoes);
if (scorm_get_tracks($sco->id,$user->id) === false) {
header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id);
$result = true;
} else if ($scorm->skipview == 2) {
header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id);
$result = true;
}
}
}
return $result;
}
function scorm_parse($scorm) {
global $CFG,$repositoryconfigfile;

View File

@ -12,6 +12,9 @@
if (!isset($form->launch)) {
$form->launch = '';
}
if (!isset($form->skipview)) {
$form->skipview = 1;
}
if (!isset($form->auto)) {
$form->auto = '';
}
@ -299,6 +302,19 @@
<td colspan="2">
<div id="advancedsettings">
<table align="center">
<tr>
<td align="right"><b><?php print_string('skipview','scorm') ?>:</b></td>
<td>
<?php
$options = array();
$options[0]=get_string('never');
$options[1]=get_string('firstaccess','scorm');
$options[2]=get_string('always');
choose_from_menu ($options, 'skipview', (int) $form->skipview,'');
helpbutton('skipview', get_string('skipview','scorm'), 'scorm', true);
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string('autocontinue','scorm') ?>:</b></td>
<td>
@ -311,6 +327,20 @@
?>
</td>
</tr>
<!--
<tr>
<td align="right"><b><?php print_string('hidereview','scorm') ?>:</b></td>
<td>
<?php
$options = array();
$options[0]=get_string('no');
$options[1]=get_string('yes');
choose_from_menu ($options, 'hidereview', (int) $form->hidereview, '');
helpbutton('reviewmode', get_string('hidereview','scorm'), 'scorm', true);
?>
</td>
</tr>
-->
<tr>
<td align="right"><b><?php print_string('hidebrowse','scorm') ?>:</b></td>
<td>
@ -346,6 +376,19 @@
?>
</td>
</tr>
<!--
<tr>
<td align="right"><b><?php print_string('hideexit','scorm') ?>:</b></td>
<td>
<?php
$options = array();
$options[0]=get_string('no');
$options[1]=get_string('yes');
choose_from_menu ($options, 'hideexit', (int) $form->hideexit, '');
?>
</td>
</tr>
-->
</table>
</div>
</td>

View File

@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2006091201; // The (date) version of this module
$module->version = 2006102601; // The (date) version of this module
$module->requires = 2006080900; // The version of Moodle that is required
$module->cron = 0; // How often should cron check this module (seconds)?

View File

@ -59,6 +59,10 @@
add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id");
if ((has_capability('mod/scorm:skipview', get_context_instance(CONTEXT_MODULE,$cm->id))) && scorm_simple_play($scorm,$USER)) {
exit;
}
//
// Print the page header
//