Merge branch 'master_MDL-34848' of git://github.com/danmarsden/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2012-10-09 00:02:41 +02:00
commit 5d3559f7b5
5 changed files with 29 additions and 5 deletions

View File

@ -47,6 +47,9 @@ $string['asset'] = 'Asset';
$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['directories'] = 'Show the directory links';
$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.';

View File

@ -41,6 +41,12 @@ define('SCORM_12', 1);
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
*
@ -1093,7 +1099,8 @@ function scorm_print_overview($courses, &$htmlarray) {
if ($scorm->timeclose) {
$str .= '<div class="info">'.$strduedate.': '.userdate($scorm->timeclose).'</div>';
}
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 .= '<div class="details">'.scorm_get_attempt_status($USER, $scorm).'</div>';
}
@ -1346,4 +1353,4 @@ function scorm_set_completion($scorm, $userid, $completionstate = COMPLETION_COM
$completion->update_state($cm, $completionstate, $userid);
}
}
}
}

View File

@ -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

View File

@ -195,7 +195,7 @@ class mod_scorm_mod_form extends moodleform_mod {
$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);

View File

@ -137,7 +137,8 @@ require($CFG->dirroot . '/mod/scorm/tabs.php');
// 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');