Permalink
Browse files

Added the new features MDL-4482 and MDL-6534 (Course structure view.p…

…hp skip)
  • Loading branch information...
1 parent 57d52ee commit 8e45ba4522f39558294c3102eb949e7c3085ac43 bobopinna committed Sep 26, 2006
Showing with 74 additions and 5 deletions.
  1. +2 −2 mod/scorm/README.txt
  2. +24 −2 mod/scorm/locallib.php
  3. +43 −0 mod/scorm/mod.html
  4. +1 −1 mod/scorm/version.php
  5. +4 −0 mod/scorm/view.php
@@ -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.
@@ -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
@@ -12,6 +12,9 @@
if (!isset($form->launch)) {
$form->launch = '';
}
+ if (!isset($form->skipview)) {
+ $form->skipview = 1;
+ }
if (!isset($form->auto)) {
$form->auto = '';
}
@@ -300,6 +303,19 @@
<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>
<?php
@@ -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>
@@ -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
@@ -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
//

0 comments on commit 8e45ba4

Please sign in to comment.