diff --git a/mod/quiz/report/attemptsreport_form.php b/mod/quiz/report/attemptsreport_form.php
index 11a6c8f369c..286bd1f04df 100644
--- a/mod/quiz/report/attemptsreport_form.php
+++ b/mod/quiz/report/attemptsreport_form.php
@@ -88,4 +88,17 @@ abstract class mod_quiz_attempt_report_form extends moodleform {
* @param MoodleQuickForm $mform the form we are building.
*/
protected abstract function definition_inner(MoodleQuickForm $mform);
+
+ /**
+ * Create the standard checkbox for the 'include highest graded only' option.
+ *
+ * @param MoodleQuickForm $mform the form we are building.
+ */
+ protected function create_qmfilter_checkbox(MoodleQuickForm $mform) {
+ $gm = html_writer::tag('span', quiz_get_grading_option_name(
+ $this->_customdata['quiz']->grademethod), array('class' => 'highlight'));
+ return $mform->createElement('advcheckbox', 'qmfilter',
+ get_string('showattempts', 'quiz_overview'),
+ get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1));
+ }
}
diff --git a/mod/quiz/report/overview/overviewsettings_form.php b/mod/quiz/report/overview/overviewsettings_form.php
index 5c45048ca85..6c2638ab65e 100644
--- a/mod/quiz/report/overview/overviewsettings_form.php
+++ b/mod/quiz/report/overview/overviewsettings_form.php
@@ -38,12 +38,7 @@ class quiz_overview_settings_form extends mod_quiz_attempt_report_form {
protected function definition_inner(MoodleQuickForm $mform) {
$showattemptsgrp = array();
if ($this->_customdata['qmsubselect']) {
- $gm = '' .
- quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) .
- '';
- $showattemptsgrp[] = $mform->createElement('advcheckbox', 'qmfilter',
- get_string('showattempts', 'quiz_overview'),
- get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1));
+ $showattemptsgrp[] = $this->create_qmfilter_checkbox($mform);
}
if (has_capability('mod/quiz:regrade', $this->_customdata['context'])) {
$showattemptsgrp[] = $mform->createElement('advcheckbox', 'regradefilter',
diff --git a/mod/quiz/report/responses/responsessettings_form.php b/mod/quiz/report/responses/responsessettings_form.php
index f30878b9319..80746fc7928 100644
--- a/mod/quiz/report/responses/responsessettings_form.php
+++ b/mod/quiz/report/responses/responsessettings_form.php
@@ -37,12 +37,7 @@ require_once($CFG->dirroot . '/mod/quiz/report/attemptsreport_form.php');
class quiz_responses_settings_form extends mod_quiz_attempt_report_form {
protected function definition_inner(MoodleQuickForm $mform) {
if ($this->_customdata['qmsubselect']) {
- $gm = '' .
- quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) .
- '';
- $mform->addElement('advcheckbox', 'qmfilter',
- get_string('showattempts', 'quiz_overview'),
- get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1));
+ $mform->addElement($this->create_qmfilter_checkbox($mform));
}
$colsgroup = array();