diff --git a/mod/scorm/lang/en/scorm.php b/mod/scorm/lang/en/scorm.php
index 4f25b7011cea9..99f55ac0496b3 100644
--- a/mod/scorm/lang/en/scorm.php
+++ b/mod/scorm/lang/en/scorm.php
@@ -47,6 +47,9 @@
$string['assetlaunched'] = 'Asset - Viewed';
$string['attempt'] = 'Attempt';
$string['attempts'] = 'Attempts';
+$string['attemptstatusall'] = 'My home and entry page';
+$string['attemptstatusmy'] = 'My home only';
+$string['attemptstatusentry'] = 'Entry page only';
$string['attemptsx'] = '{$a} attempts';
$string['attempt1'] = '1 attempt';
$string['attr_error'] = 'Bad value for attribute ({$a->attr}) in tag {$a->tag}.';
@@ -85,7 +88,7 @@
$string['disabled'] = 'Disabled';
$string['display'] = 'Display package';
$string['displayattemptstatus'] = 'Display attempt status';
-$string['displayattemptstatus_help'] = 'If enabled, scores and grades for attempts are displayed on the SCORM outline page.';
+$string['displayattemptstatus_help'] = 'This preference allows a summary of the users attempts to show in the course overview block in My home and/or the SCORM entry page.';
$string['displayattemptstatusdesc'] = 'This preference sets the default value for the display attempt status setting';
$string['displaycoursestructure'] = 'Display course structure on entry page';
$string['displaycoursestructure_help'] = 'If enabled, the table of contents is displayed on the SCORM outline page.';
diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php
index 535fce184b3ad..849dcdd5c1988 100644
--- a/mod/scorm/lib.php
+++ b/mod/scorm/lib.php
@@ -41,6 +41,12 @@
define('SCORM_13', 2);
define('SCORM_AICC', 3);
+// List of possible attemptstatusdisplay options.
+define('SCORM_DISPLAY_ATTEMPTSTATUS_NO', 0);
+define('SCORM_DISPLAY_ATTEMPTSTATUS_ALL', 1);
+define('SCORM_DISPLAY_ATTEMPTSTATUS_MY', 2);
+define('SCORM_DISPLAY_ATTEMPTSTATUS_ENTRY', 3);
+
/**
* Return an array of status options
*
@@ -1104,7 +1110,8 @@ function scorm_print_overview($courses, &$htmlarray) {
if ($scorm->timeclose) {
$str .= '
'.$strduedate.': '.userdate($scorm->timeclose).'
';
}
- if ($scorm->displayattemptstatus == 1) {
+ if ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ALL ||
+ $scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_MY) {
require_once($CFG->dirroot.'/mod/scorm/locallib.php');
$str .= ''.scorm_get_attempt_status($USER, $scorm).'
';
}
diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php
index de433a3bd4888..c82777829593d 100644
--- a/mod/scorm/locallib.php
+++ b/mod/scorm/locallib.php
@@ -166,6 +166,19 @@ function scorm_get_attempts_array() {
return $attempts;
}
+
+/**
+ * Returns an array of the attempt status options
+ *
+ * @return array an array of attempt status options
+ */
+function scorm_get_attemptstatus_array() {
+ return array(SCORM_DISPLAY_ATTEMPTSTATUS_NO => get_string('no'),
+ SCORM_DISPLAY_ATTEMPTSTATUS_ALL => get_string('attemptstatusall', 'scorm'),
+ SCORM_DISPLAY_ATTEMPTSTATUS_MY => get_string('attemptstatusmy', 'scorm'),
+ SCORM_DISPLAY_ATTEMPTSTATUS_ENTRY => get_string('attemptstatusentry', 'scorm'));
+}
+
/**
* Extracts scrom package, sets up all variables.
* Called whenever scorm changes
diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php
index 4b0837cb1630d..3d620d0e6b55f 100644
--- a/mod/scorm/mod_form.php
+++ b/mod/scorm/mod_form.php
@@ -195,7 +195,7 @@ function definition() {
$mform->setAdvanced('whatgrade', $cfg_scorm->whatgrade_adv);
// Display attempt status
- $mform->addElement('selectyesno', 'displayattemptstatus', get_string('displayattemptstatus', 'scorm'));
+ $mform->addElement('select', 'displayattemptstatus', get_string('displayattemptstatus', 'scorm'), scorm_get_attemptstatus_array());
$mform->addHelpButton('displayattemptstatus', 'displayattemptstatus', 'scorm');
$mform->setDefault('displayattemptstatus', $cfg_scorm->displayattemptstatus);
$mform->setAdvanced('displayattemptstatus', $cfg_scorm->displayattemptstatus_adv);
diff --git a/mod/scorm/view.php b/mod/scorm/view.php
index fa6d290b9ea48..e9027d1275ec6 100644
--- a/mod/scorm/view.php
+++ b/mod/scorm/view.php
@@ -137,7 +137,8 @@
// Print the main part of the page
echo $OUTPUT->heading(format_string($scorm->name));
$attemptstatus = '';
-if ($scorm->displayattemptstatus == 1 && empty($launch)) {
+if (empty($launch) && ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ALL ||
+ $scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ENTRY)) {
$attemptstatus = scorm_get_attempt_status($USER, $scorm, $cm);
}
echo $OUTPUT->box(format_module_intro('scorm', $scorm, $cm->id).$attemptstatus, 'generalbox boxaligncenter boxwidthwide', 'intro');