Skip to content

Commit

Permalink
MDL-45712 mod_scorm: add results column to interactions report.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathagey authored and danmarsden committed Dec 16, 2015
1 parent 0dfcc25 commit 3ef6e46
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
19 changes: 19 additions & 0 deletions mod/scorm/report/interactions/classes/report.php
Expand Up @@ -59,15 +59,18 @@ public function display($scorm, $cm, $course, $download) {
$includeqtext = $fromform->qtext;
$includeresp = $fromform->resp;
$includeright = $fromform->right;
$includeresult = $fromform->result;
set_user_preference('scorm_report_pagesize', $pagesize);
set_user_preference('scorm_report_interactions_qtext', $includeqtext);
set_user_preference('scorm_report_interactions_resp', $includeresp);
set_user_preference('scorm_report_interactions_right', $includeright);
set_user_preference('scorm_report_interactions_result', $includeresult);
} else {
$pagesize = get_user_preferences('scorm_report_pagesize', 0);
$includeqtext = get_user_preferences('scorm_report_interactions_qtext', 0);
$includeresp = get_user_preferences('scorm_report_interactions_resp', 1);
$includeright = get_user_preferences('scorm_report_interactions_right', 0);
$includeresult = get_user_preferences('scorm_report_interactions_result', 0);
}
if ($pagesize < 1) {
$pagesize = SCORM_REPORT_DEFAULT_PAGE_SIZE;
Expand All @@ -79,6 +82,7 @@ public function display($scorm, $cm, $course, $download) {
$displayoptions['qtext'] = $includeqtext;
$displayoptions['resp'] = $includeresp;
$displayoptions['right'] = $includeright;
$displayoptions['result'] = $includeresult;

$mform->set_data($displayoptions + array('pagesize' => $pagesize));
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used.
Expand Down Expand Up @@ -204,6 +208,10 @@ public function display($scorm, $cm, $course, $download) {
$columns[] = 'right' . $id;
$headers[] = get_string('rightanswerx', 'scormreport_interactions', $id);
}
if ($displayoptions['result']) {
$columns[] = 'result' . $id;
$headers[] = get_string('resultx', 'scormreport_interactions', $id);
}
}

if (!$download) {
Expand Down Expand Up @@ -239,6 +247,9 @@ public function display($scorm, $cm, $course, $download) {
if ($displayoptions['right']) {
$table->no_sorting('right'.$id);
}
if ($displayoptions['result']) {
$table->no_sorting('result'.$id);
}
}

foreach ($scoes as $sco) {
Expand Down Expand Up @@ -526,6 +537,14 @@ public function display($scorm, $cm, $course, $download) {
$row[] = '&nbsp;';
}
}
if ($displayoptions['result']) {
$element = 'cmi.interactions_'.$i.'.result';
if (isset($trackdata->$element)) {
$row[] = s($trackdata->$element);
} else {
$row[] = '&nbsp;';
}
}
}
// End of interaction data.
} else {
Expand Down
Expand Up @@ -29,7 +29,9 @@
$string['questionx'] = 'Question {$a}';
$string['responsex'] = 'Response {$a}';
$string['rightanswerx'] = 'Right answer {$a}';
$string['resultx'] = 'Result {$a}';
$string['summaryofquestiontext'] = 'Summary of question';
$string['summaryofresponse'] = 'Summary of responses';
$string['summaryofrightanswer'] = 'Summary of right answer';
$string['summaryofresult'] = 'Summary of result';

1 change: 1 addition & 0 deletions mod/scorm/report/interactions/responsessettings_form.php
Expand Up @@ -43,6 +43,7 @@ public function definition() {
$mform->addElement('advcheckbox', 'qtext', '', get_string('summaryofquestiontext', 'scormreport_interactions'));
$mform->addElement('advcheckbox', 'resp', '', get_string('summaryofresponse', 'scormreport_interactions'));
$mform->addElement('advcheckbox', 'right', '', get_string('summaryofrightanswer', 'scormreport_interactions'));
$mform->addElement('advcheckbox', 'result', '', get_string('summaryofresult', 'scormreport_interactions'));

// -------------------------------------------------------------------------------
$mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'scorm'));
Expand Down
2 changes: 1 addition & 1 deletion mod/scorm/report/interactions/version.php
Expand Up @@ -25,6 +25,6 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX)
$plugin->version = 2015121600; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2015111000; // Requires this Moodle version.
$plugin->component = 'scormreport_interactions'; // Full name of the plugin (used for diagnostics).

0 comments on commit 3ef6e46

Please sign in to comment.