mirror of
https://github.com/moodle/moodle.git
synced 2025-02-01 05:18:06 +01:00
MDL-32322 quiz reports: eliminate more duplication.
This commit is contained in:
parent
5bf8a1695d
commit
5ca45fddab
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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 = '<span class="highlight">' .
|
||||
quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) .
|
||||
'</span>';
|
||||
$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',
|
||||
|
@ -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 = '<span class="highlight">' .
|
||||
quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) .
|
||||
'</span>';
|
||||
$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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user