]> git.mjollnir.org Git - moodle.git/commitdiff
Added the new features MDL-4482 and MDL-6534 (Course structure view.php skip)
authorbobopinna <bobopinna>
Tue, 26 Sep 2006 14:40:00 +0000 (14:40 +0000)
committerbobopinna <bobopinna>
Tue, 26 Sep 2006 14:40:00 +0000 (14:40 +0000)
mod/scorm/README.txt
mod/scorm/locallib.php
mod/scorm/mod.html
mod/scorm/version.php
mod/scorm/view.php

index e31eb70547cc857fc0e4eae46ae6079e19fc71e8..4f619b333adef3466ecea5b9acacbb2961d423bf 100644 (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.
 
 
index eb15905448dd063787bb8118707abd635a7b73f7..138521fe49ba2d2a9909cc0bc1f0e76eee026d1a 100755 (executable)
@@ -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;
 
index 60c5d93a9581d6020a7fd73eec2f5b0d67212f29..97a57ab2f275f8360ade3a4402b236b5b4db3aee 100755 (executable)
@@ -12,6 +12,9 @@
     if (!isset($form->launch)) {
         $form->launch = '';
     }
+    if (!isset($form->skipview)) {
+        $form->skipview = 1;
+    }
     if (!isset($form->auto)) {
         $form->auto = '';
     }
             <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>
                             ?>
                             </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>
                             ?>
                             </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>
index 1091a5c35599ee367152f91bda6ea20a53a16b47..6245400f813ca40eb1de34b72d3b9ed4926f3e41 100755 (executable)
@@ -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)?
 
index 4f83bff7956e6ddfba146c51802deb1a5cf99e0c..03908ee18d57588980457e57eb148969a3562fc6 100755 (executable)
 
     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
     //