diff --git a/lang/en_utf8/help/scorm/displayattemptstatus.html b/lang/en_utf8/help/scorm/displayattemptstatus.html new file mode 100644 index 00000000000..1bc89a71ab7 --- /dev/null +++ b/lang/en_utf8/help/scorm/displayattemptstatus.html @@ -0,0 +1,4 @@ +
Display attempt status controls whether the status of SCORM attempts by a student are displayed on the SCORM outline page.
+The status displays attempts, the scores, and grade passed to the Gradebook
diff --git a/lang/en_utf8/help/scorm/displaycoursestructure.html b/lang/en_utf8/help/scorm/displaycoursestructure.html new file mode 100644 index 00000000000..0089ba76595 --- /dev/null +++ b/lang/en_utf8/help/scorm/displaycoursestructure.html @@ -0,0 +1,3 @@ +Display course structure controls whether the SCORM table of contents gets displayed on the SCORM outline page.
diff --git a/lang/en_utf8/help/scorm/forcecompleted.html b/lang/en_utf8/help/scorm/forcecompleted.html new file mode 100644 index 00000000000..465abc4dbd7 --- /dev/null +++ b/lang/en_utf8/help/scorm/forcecompleted.html @@ -0,0 +1,4 @@ +Force completed will ensure that the status of the current attempt is forced to "completed" if cmi.core.score.raw has been issued, and as such is only relevant for SCORM 1.2 packages.
+This is usefull if the SCORM package does not handle revisiting an attempt correctly, in review or browse mode, or otherwise incorrectly issues the completion status.
diff --git a/lang/en_utf8/help/scorm/forcenewattempt.html b/lang/en_utf8/help/scorm/forcenewattempt.html new file mode 100644 index 00000000000..ddbeee524c5 --- /dev/null +++ b/lang/en_utf8/help/scorm/forcenewattempt.html @@ -0,0 +1,3 @@ +Force new attempt will make every visit to a SCORM package a new attempt.
diff --git a/lang/en_utf8/help/scorm/lastattemptlock.html b/lang/en_utf8/help/scorm/lastattemptlock.html new file mode 100644 index 00000000000..b714b89ff16 --- /dev/null +++ b/lang/en_utf8/help/scorm/lastattemptlock.html @@ -0,0 +1,4 @@ +This enables the locking of the SCORM player after a student has used all of their allocated attempts.
+The student will still be able to visit the course outline page and view the attempts status information (if enabled), but will not beable to select "Enter" to launch the player.
diff --git a/lang/en_utf8/scorm.php b/lang/en_utf8/scorm.php index 8cf989ed517..cd91df31b9e 100644 --- a/lang/en_utf8/scorm.php +++ b/lang/en_utf8/scorm.php @@ -38,6 +38,8 @@ $string['details'] = 'Track details'; $string['directories'] = 'Show the directory links'; $string['display'] = 'Display package'; $string['domxml'] = 'DOMXML external library'; +$string['displayattemptstatus'] = 'Display attempt status'; +$string['displaycoursestructure'] = 'Display course structure'; $string['element'] = 'Element'; $string['entercourse'] = 'Enter course'; $string['enter'] = 'Enter'; @@ -56,9 +58,12 @@ $string['frameheight'] = 'This preference set the default height for stage frame $string['framewidth'] = 'This preference set the default width for stage frame or window'; $string['fullscreen'] = 'Fill the whole screen'; $string['general'] = 'General data'; +$string['forcenewattempt'] = 'Force new attempt'; +$string['forcecompleted'] = 'Force completed'; $string['gradeaverage'] = 'Average grade'; $string['gradehighest'] = 'Highest grade'; $string['grademethod'] = 'Grading method'; +$string['gradereported'] = 'Grade reported'; $string['gradescoes'] = 'Learning Objects'; $string['gradesum'] = 'Sum grade'; $string['height'] = 'Height'; @@ -78,6 +83,7 @@ $string['invalidactivity'] = 'Scorm activity is incorrect'; $string['last'] = 'Last accessed on'; $string['lastaccess'] = 'Last access'; $string['lastattempt'] = 'Last attempt'; +$string['lastattemptlock'] = 'Lock after final attempt'; $string['location'] = 'Show the location bar'; $string['max'] = 'Max score'; $string['maximumattempts'] = 'Number of attempts'; @@ -176,4 +182,8 @@ $string['activityloading'] = "You will be automatically redirected to the activi $string['activitypleasewait'] = "Activity loading, please wait ...."; $string['scormloggingon'] = "API Logging is On"; $string['scormloggingoff'] = "API Logging is Off"; +$string['noattemptsallowed'] = "Number of attempts allowed"; +$string['noattemptsmade'] = "Number of attempts you have made"; +$string['gradeforattempt'] = "Grade for attempt"; +$string['exceededmaxattempts'] = "You have reached the maximum number of attempts."; ?> \ No newline at end of file diff --git a/mod/scorm/datamodel.php b/mod/scorm/datamodel.php index 19d4905b15e..a10875b7457 100755 --- a/mod/scorm/datamodel.php +++ b/mod/scorm/datamodel.php @@ -43,7 +43,7 @@ $element = str_replace('__','.',$element); if (substr($element,0,3) == 'cmi') { $netelement = preg_replace('/\.N(\d+)\./',"\.\$1\.",$element); - $result = scorm_insert_track($USER->id, $scorm->id, $scoid, $attempt, $netelement, $value) && $result; + $result = scorm_insert_track($USER->id, $scorm->id, $scoid, $attempt, $element, $value, $scorm->forcecompleted) && $result; } if (substr($element,0,15) == 'adl.nav.request') { // SCORM 2004 Sequencing Request diff --git a/mod/scorm/db/install.xml b/mod/scorm/db/install.xml index 12642de474d..dabb226add7 100644 --- a/mod/scorm/db/install.xml +++ b/mod/scorm/db/install.xml @@ -16,8 +16,13 @@'.get_string('noattemptsallowed', 'scorm').': ';
+ if ($scorm->maxattempt > 0) {
+ $result .= $scorm->maxattempt . '
';
+ } else {
+ $result .= get_string('unlimited').'
';
+ }
+ $result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '
';
+
+ $gradereported = 0;
+ $gradesum = 0;
+ switch ($scorm->grademethod) {
+ case GRADEHIGHEST:
+ $grademethod = get_string('gradehighest', 'scorm');
+ break;
+ case GRADEAVERAGE:
+ $grademethod = get_string('gradeaverage', 'scorm');
+ break;
+ case GRADESUM:
+ $grademethod = get_string('gradesum', 'scorm');
+ break;
+ case GRADESCOES:
+ $grademethod = get_string('gradescoes', 'scorm');
+ break;
+ }
+
+ if(!empty($attempts)) {
+ foreach($attempts as $attempt) {
+ $gradereported = scorm_grade_user_attempt($scorm, $user->id, $attempt->attemptnumber);
+ $result .= get_string('gradeforattempt', 'scorm').' ' . $attempt->attemptnumber . ': ' . $attempt->grade .'%
';
+ }
+ }
+
+ $result .= get_string('grademethod', 'scorm'). ': ' . $grademethod;
+ if(empty($attempts)) {
+ $result .= '
' . get_string('gradereported','scorm') . ': ' . get_string('none') . '
';
+ } else {
+ $result .= '
' . get_string('gradereported','scorm') . ': ' . $gradereported . ($scorm->grademethod == GRADESCOES ? '' : '%') .'
';
+ }
+ $result .= '
'.get_string('exceededmaxattempts','scorm').'
'; + } + return $result; +} + +/** +* Get SCORM attempt count +* +* @param object $user Current context user +* @param object $scorm a moodle scrom object - mdl_scorm +* @return int - no. of attempts so far +*/ +function scorm_get_attempt_count($user, $scorm) { + global $DB; + $attemptcount = 0; + $element = 'cmi.core.score.raw'; + if ($scorm->version == 'scorm1_3') { + $element = 'cmi.score.raw'; + } + $attempts = $DB->get_records_select('scorm_scoes_track',"element=? AND userid=? AND scormid=?", array($element, $user->id, $scorm->id),'attempt','attempt AS attemptnumber, value AS grade'); + if(!empty($attempts)) { + $attemptcount = count($attempts); + } + return $attemptcount; +} ?> \ No newline at end of file diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index 399edc37506..4d1453dc6aa 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -103,6 +103,34 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->setHelpButton('maxattempt', array('maxattempt',get_string('maximumattempts', 'scorm'), 'scorm')); $mform->setDefault('maxattempt', 1); +// Display attempt status + $mform->addElement('selectyesno', 'displayattemptstatus', get_string('displayattemptstatus', 'scorm')); + $mform->setHelpButton('displayattemptstatus', array('displayattemptstatus',get_string('displayattemptstatus', 'scorm'), 'scorm')); + $mform->setDefault('displayattemptstatus', 1); + +// Display course structure + $mform->addElement('selectyesno', 'displaycoursestructure', get_string('displaycoursestructure', 'scorm')); + $mform->setHelpButton('displaycoursestructure', array('displaycoursestructure',get_string('displaycoursestructure', 'scorm'), 'scorm')); + $mform->setDefault('displaycoursestructure', 1); + +// Force completed + $mform->addElement('selectyesno', 'forcecompleted', get_string('forcecompleted', 'scorm')); + $mform->setHelpButton('forcecompleted', array('forcecompleted',get_string('forcecompleted', 'scorm'), 'scorm')); + $mform->setDefault('forcecompleted', 0); + $mform->setAdvanced('forcecompleted'); + +// Force new attempt + $mform->addElement('selectyesno', 'forcenewattempt', get_string('forcenewattempt', 'scorm')); + $mform->setHelpButton('forcenewattempt', array('forcenewattempt',get_string('forcenewattempt', 'scorm'), 'scorm')); + $mform->setDefault('forcenewattempt', 0); + $mform->setAdvanced('forcenewattempt'); + +// Last attempt lock - lock the enter button after the last available attempt has been made + $mform->addElement('selectyesno', 'lastattemptlock', get_string('lastattemptlock', 'scorm')); + $mform->setHelpButton('lastattemptlock', array('lastattemptlock',get_string('lastattemptlock', 'scorm'), 'scorm')); + $mform->setDefault('lastattemptlock', 0); + $mform->setAdvanced('lastattemptlock'); + // What Grade $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), $SCORM_WHAT_GRADE); $mform->disabledIf('whatgrade', 'maxattempt','eq',1); diff --git a/mod/scorm/version.php b/mod/scorm/version.php index 3abb85dc734..febd804a2ae 100755 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -10,7 +10,7 @@ // catch up now, so until 27th October please only increment in very tiny steps // in HEAD, until we get past that date.. -$module->version = 2008090304; // The (date) version of this module +$module->version = 2008090305; // The (date) version of this module $module->requires = 2008090108; // The version of Moodle that is required $module->cron = 300; // How often should cron check this module (seconds)? diff --git a/mod/scorm/view.php b/mod/scorm/view.php index 1cfc00d25ce..4ccdc3c5798 100755 --- a/mod/scorm/view.php +++ b/mod/scorm/view.php @@ -82,7 +82,11 @@ // Print the main part of the page print_heading(format_string($scorm->name)); - print_box(format_text($scorm->summary), 'generalbox', 'intro'); + $attemptstatus = ''; + if($scorm->displayattemptstatus == 1) { + $attemptstatus = scorm_get_attempt_status($USER,$scorm); + } + print_simple_box(format_text($scorm->summary).$attemptstatus, 'center', '70%', '', 5, 'generalbox', 'intro'); scorm_view_display($USER, $scorm, 'view.php?id='.$cm->id, $cm); print_footer($course); ?>