From: bobopinna Date: Tue, 26 Sep 2006 14:40:00 +0000 (+0000) Subject: Added the new features MDL-4482 and MDL-6534 (Course structure view.php skip) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8e45ba4522f39558294c3102eb949e7c3085ac43;p=moodle.git Added the new features MDL-4482 and MDL-6534 (Course structure view.php skip) --- diff --git a/mod/scorm/README.txt b/mod/scorm/README.txt index e31eb70547..4f619b333a 100644 --- a/mod/scorm/README.txt +++ b/mod/scorm/README.txt @@ -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. diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index eb15905448..138521fe49 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -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='') { 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; diff --git a/mod/scorm/mod.html b/mod/scorm/mod.html index 60c5d93a95..97a57ab2f2 100755 --- a/mod/scorm/mod.html +++ b/mod/scorm/mod.html @@ -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 @@
+ + + + + +
: + skipview,''); + helpbutton('skipview', get_string('skipview','scorm'), 'scorm', true); + ?> +
: @@ -311,6 +327,20 @@ ?>
: @@ -346,6 +376,19 @@ ?>
diff --git a/mod/scorm/version.php b/mod/scorm/version.php index 1091a5c355..6245400f81 100755 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -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)? diff --git a/mod/scorm/view.php b/mod/scorm/view.php index 4f83bff795..03908ee18d 100755 --- a/mod/scorm/view.php +++ b/mod/scorm/view.php @@ -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 //