mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-41615 quiz_mod: fix heading levels for usability and accessibility
This commit is contained in:
parent
d214057cad
commit
c544ee92f5
23 changed files with 86 additions and 32 deletions
|
@ -123,7 +123,7 @@ if (!$quizname = $DB->get_field($cm->modname, 'name', array('id' => $cm->instanc
|
|||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
echo $OUTPUT->heading(get_string('addrandomquestiontoquiz', 'quiz', $quizname), 2, 'mdl-left');
|
||||
echo $OUTPUT->heading(get_string('addrandomquestiontoquiz', 'quiz', $quizname), 2);
|
||||
$mform->display();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
|
|
|
@ -50,8 +50,24 @@ add_to_log($attemptobj->get_courseid(), 'quiz', 'manualgrade', 'comment.php?atte
|
|||
|
||||
// Print the page header.
|
||||
$PAGE->set_pagelayout('popup');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($attemptobj->get_question_name($slot)));
|
||||
$PAGE->set_heading($attemptobj->get_course()->fullname);
|
||||
$output = $PAGE->get_renderer('mod_quiz');
|
||||
echo $output->header();
|
||||
|
||||
// Prepare summary information about this question attempt.
|
||||
$summarydata = array();
|
||||
|
||||
// Quiz name.
|
||||
$summarydata['quizname'] = array(
|
||||
'title' => get_string('modulename', 'quiz'),
|
||||
'content' => format_string($attemptobj->get_quiz_name()),
|
||||
);
|
||||
|
||||
// Question name.
|
||||
$summarydata['questionname'] = array(
|
||||
'title' => get_string('question', 'quiz'),
|
||||
'content' => $attemptobj->get_question_name($slot),
|
||||
);
|
||||
|
||||
// Process any data that was submitted.
|
||||
if (data_submitted() && confirm_sesskey()) {
|
||||
|
@ -59,12 +75,15 @@ if (data_submitted() && confirm_sesskey()) {
|
|||
$transaction = $DB->start_delegated_transaction();
|
||||
$attemptobj->process_submitted_actions(time());
|
||||
$transaction->allow_commit();
|
||||
echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
|
||||
echo $output->notification(get_string('changessaved'), 'notifysuccess');
|
||||
close_window(2, true);
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
// Print quiz information.
|
||||
echo $output->review_summary_table($summarydata, 0);
|
||||
|
||||
// Print the comment form.
|
||||
echo '<form method="post" class="mform" id="manualgradingform" action="' .
|
||||
$CFG->wwwroot . '/mod/quiz/comment.php">';
|
||||
|
@ -91,4 +110,4 @@ echo '</form>';
|
|||
$PAGE->requires->js_init_call('M.mod_quiz.init_comment_popup', null, false, quiz_get_js_module());
|
||||
|
||||
// End of the page.
|
||||
echo $OUTPUT->footer();
|
||||
echo $output->footer();
|
||||
|
|
|
@ -56,6 +56,7 @@ $PAGE->set_title($strquizzes);
|
|||
$PAGE->set_button($streditquestions);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strquizzes, 2);
|
||||
|
||||
// Get all the appropriate data.
|
||||
if (!$quizzes = get_all_instances_in_course("quiz", $course)) {
|
||||
|
|
|
@ -80,6 +80,7 @@ $PAGE->set_title($title);
|
|||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
|
||||
if ($override->groupid) {
|
||||
$group = $DB->get_record('groups', array('id' => $override->groupid), 'id, name');
|
||||
|
|
|
@ -194,7 +194,7 @@ $PAGE->set_pagelayout('admin');
|
|||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($pagetitle);
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
|
||||
$mform->display();
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ $PAGE->set_pagelayout('admin');
|
|||
$PAGE->set_title(get_string('overrides', 'quiz'));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
|
||||
// Delete orphaned group overrides.
|
||||
$sql = 'SELECT o.id
|
||||
|
|
|
@ -99,6 +99,8 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||
public function review_question_not_allowed($message) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->heading(format_string($attemptobj->get_quiz_name(), true,
|
||||
array("context" => $attemptobj->get_quizobj()->get_context())));
|
||||
$output .= $this->notification($message);
|
||||
$output .= $this->close_window_button();
|
||||
$output .= $this->footer();
|
||||
|
@ -392,6 +394,8 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||
public function start_attempt_page(quiz $quizobj, mod_quiz_preflight_check_form $mform) {
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->heading(format_string($quizobj->get_quiz_name(), true,
|
||||
array("context" => $quizobj->get_context())));
|
||||
$output .= $this->quiz_intro($quizobj->get_quiz(), $quizobj->get_cm());
|
||||
ob_start();
|
||||
$mform->display();
|
||||
|
@ -879,7 +883,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||
* Generates the table heading.
|
||||
*/
|
||||
public function view_table_heading() {
|
||||
return $this->heading(get_string('summaryofattempts', 'quiz'));
|
||||
return $this->heading(get_string('summaryofattempts', 'quiz'), 3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1052,14 +1056,13 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||
$a->method = quiz_get_grading_option_name($quiz->grademethod);
|
||||
$a->mygrade = quiz_format_grade($quiz, $viewobj->mygrade);
|
||||
$a->quizgrade = quiz_format_grade($quiz, $quiz->grade);
|
||||
$resultinfo .= $this->heading(get_string('gradesofar', 'quiz', $a), 2, 'main');
|
||||
$resultinfo .= $this->heading(get_string('gradesofar', 'quiz', $a), 3);
|
||||
} else {
|
||||
$a = new stdClass();
|
||||
$a->grade = quiz_format_grade($quiz, $viewobj->mygrade);
|
||||
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
|
||||
$a = get_string('outofshort', 'quiz', $a);
|
||||
$resultinfo .= $this->heading(get_string('yourfinalgradeis', 'quiz', $a), 2,
|
||||
'main');
|
||||
$resultinfo .= $this->heading(get_string('yourfinalgradeis', 'quiz', $a), 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1069,11 +1072,11 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||
array('class' => 'overriddennotice'))."\n";
|
||||
}
|
||||
if ($viewobj->gradebookfeedback) {
|
||||
$resultinfo .= $this->heading(get_string('comment', 'quiz'), 3, 'main');
|
||||
$resultinfo .= $this->heading(get_string('comment', 'quiz'), 3);
|
||||
$resultinfo .= html_writer::div($viewobj->gradebookfeedback, 'quizteacherfeedback') . "\n";
|
||||
}
|
||||
if ($viewobj->feedbackcolumn) {
|
||||
$resultinfo .= $this->heading(get_string('overallfeedback', 'quiz'), 3, 'main');
|
||||
$resultinfo .= $this->heading(get_string('overallfeedback', 'quiz'), 3);
|
||||
$resultinfo .= html_writer::div(
|
||||
quiz_feedback_for_grade($viewobj->mygrade, $quiz, $context),
|
||||
'quizgradefeedback') . "\n";
|
||||
|
@ -1157,7 +1160,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
|||
|
||||
$graph = html_writer::empty_tag('img', array('src' => $url, 'alt' => $title));
|
||||
|
||||
return $this->heading($title) . html_writer::tag('div', $graph, array('class' => 'graph'));
|
||||
return $this->heading($title, 3) . html_writer::tag('div', $graph, array('class' => 'graph'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ abstract class quiz_default_report {
|
|||
$PAGE->set_title(format_string($quiz->name));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
$context = context_module::instance($cm->id);
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -276,7 +276,7 @@ class quiz_grading_report extends quiz_default_report {
|
|||
groups_print_activity_menu($this->cm, $this->list_questions_url());
|
||||
}
|
||||
|
||||
echo $OUTPUT->heading(get_string('questionsthatneedgrading', 'quiz_grading'));
|
||||
echo $OUTPUT->heading(get_string('questionsthatneedgrading', 'quiz_grading'), 3);
|
||||
if ($includeauto) {
|
||||
$linktext = get_string('hideautomaticallygraded', 'quiz_grading');
|
||||
} else {
|
||||
|
@ -316,7 +316,7 @@ class quiz_grading_report extends quiz_default_report {
|
|||
}
|
||||
|
||||
if (empty($data)) {
|
||||
echo $OUTPUT->heading(get_string('nothingfound', 'quiz_grading'));
|
||||
echo $OUTPUT->notification(get_string('nothingfound', 'quiz_grading'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ class quiz_grading_report extends quiz_default_report {
|
|||
$a = new stdClass();
|
||||
$a->number = $this->questions[$slot]->number;
|
||||
$a->questionname = format_string($counts->name);
|
||||
echo $OUTPUT->heading(get_string('gradingquestionx', 'quiz_grading', $a));
|
||||
echo $OUTPUT->heading(get_string('gradingquestionx', 'quiz_grading', $a), 3);
|
||||
echo html_writer::tag('p', html_writer::link($this->list_questions_url(),
|
||||
get_string('backtothelistofquestions', 'quiz_grading')),
|
||||
array('class' => 'mdl-align'));
|
||||
|
|
|
@ -310,7 +310,7 @@ class quiz_overview_report extends quiz_attempts_report {
|
|||
*/
|
||||
protected function finish_regrade($nexturl) {
|
||||
global $OUTPUT, $PAGE;
|
||||
echo $OUTPUT->heading(get_string('regradecomplete', 'quiz_overview'));
|
||||
echo $OUTPUT->heading(get_string('regradecomplete', 'quiz_overview'), 3);
|
||||
echo $OUTPUT->continue_button($nexturl);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
|
|
|
@ -233,13 +233,13 @@ class quiz_statistics_report extends quiz_default_report {
|
|||
|
||||
} else {
|
||||
// On-screen display of overview report.
|
||||
echo $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'));
|
||||
echo $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'), 3);
|
||||
echo $this->output_caching_info($quizstats, $quiz->id, $groupstudents, $whichattempts, $reporturl);
|
||||
echo $this->everything_download_options();
|
||||
$quizinfo = $quizstats->get_formatted_quiz_info_data($course, $cm, $quiz);
|
||||
echo $this->output_quiz_info_table($quizinfo);
|
||||
if ($quizstats->s()) {
|
||||
echo $OUTPUT->heading(get_string('quizstructureanalysis', 'quiz_statistics'));
|
||||
echo $OUTPUT->heading(get_string('quizstructureanalysis', 'quiz_statistics'), 3);
|
||||
$this->output_quiz_structure_analysis_table($quizstats->s(), $questionstats, $subquestionstats);
|
||||
$this->output_statistics_graph($quiz->id, $currentgroup, $whichattempts);
|
||||
}
|
||||
|
@ -305,10 +305,10 @@ class quiz_statistics_report extends quiz_default_report {
|
|||
}
|
||||
|
||||
// Display the various bits.
|
||||
echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics'));
|
||||
echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics'), 3);
|
||||
echo html_writer::table($questioninfotable);
|
||||
echo $this->render_question_text($questionstat->question);
|
||||
echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics'));
|
||||
echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics'), 3);
|
||||
echo html_writer::table($questionstatstable);
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ class quiz_statistics_report extends quiz_default_report {
|
|||
$qtable->export_class_instance($exportclass);
|
||||
if (!$this->table->is_downloading()) {
|
||||
// Output an appropriate title.
|
||||
echo $OUTPUT->heading(get_string('analysisofresponses', 'quiz_statistics'));
|
||||
echo $OUTPUT->heading(get_string('analysisofresponses', 'quiz_statistics'), 3);
|
||||
|
||||
} else {
|
||||
// Work out an appropriate title.
|
||||
|
@ -447,7 +447,7 @@ class quiz_statistics_report extends quiz_default_report {
|
|||
|
||||
// XHTML download is a special case.
|
||||
if ($this->table->is_downloading() == 'xhtml') {
|
||||
echo $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'));
|
||||
echo $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'), 3);
|
||||
echo $this->output_quiz_info_table($quizinfo);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
This files describes API changes for quiz report plugins.
|
||||
|
||||
Overview of this plugin type at http://docs.moodle.org/dev/Quiz_reports
|
||||
=== 2.6 ===
|
||||
|
||||
* Improving the display page and heading levels to have a proper nesting.
|
||||
We are reducing the amount of white spaces for the top report by making
|
||||
'separate group' options and attempts to be displayed inline.
|
||||
In grading report, we are changing 'no questions' from using heading to
|
||||
notification message. (MDL-41615)
|
||||
|
||||
=== 2.3 ===
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ $accessmanager = $attemptobj->get_access_manager(time());
|
|||
$options = $attemptobj->get_display_options(true);
|
||||
|
||||
$PAGE->set_pagelayout('popup');
|
||||
$PAGE->set_heading($attemptobj->get_course()->fullname);
|
||||
$output = $PAGE->get_renderer('mod_quiz');
|
||||
|
||||
// Check permissions.
|
||||
|
|
|
@ -48,6 +48,7 @@ $PAGE->set_url($quizobj->view_url());
|
|||
// Check login and sesskey.
|
||||
require_login($quizobj->get_course(), false, $quizobj->get_cm());
|
||||
require_sesskey();
|
||||
$PAGE->set_heading($quizobj->get_course()->fullname);
|
||||
|
||||
// If no questions have been set up yet redirect to edit.php or display an error.
|
||||
if (!$quizobj->has_questions()) {
|
||||
|
|
|
@ -333,8 +333,19 @@ table.quizattemptsummary .noreviewmessage {
|
|||
.quizattemptcounts {
|
||||
clear: left;
|
||||
text-align: center;
|
||||
display:inline;
|
||||
margin-left:20%;
|
||||
}
|
||||
.dir-rtl .quizattemptcounts {
|
||||
margin-left:0;
|
||||
margin-right: 20%;
|
||||
}
|
||||
#page-mod-quiz-view .quizattemptcounts,
|
||||
.dir-rtl #page-mod-quiz-view .quizattemptcounts {
|
||||
display: block;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
/** Mod quiz summary **/
|
||||
#page-mod-quiz-summary #content {
|
||||
text-align: center;
|
||||
|
|
|
@ -2,6 +2,8 @@ This files describes API changes in the quiz code.
|
|||
|
||||
|
||||
=== 2.6 ===
|
||||
* As part of improving the page usability and accessibility, we updated the
|
||||
heading levels for quiz module so it has a proper nesting. (MDL-41615)
|
||||
|
||||
* mod_quiz_renderer::view_best_score has been removed. (It did not do what the
|
||||
name suggested anyway.)
|
||||
|
|
|
@ -138,7 +138,7 @@ class core_question_renderer extends plugin_renderer_base {
|
|||
if (!$numbertext) {
|
||||
return '';
|
||||
}
|
||||
return html_writer::tag('h2', $numbertext, array('class' => 'no'));
|
||||
return html_writer::tag('h3', $numbertext, array('class' => 'no'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,7 +150,7 @@ class core_question_renderer extends plugin_renderer_base {
|
|||
*/
|
||||
protected function add_part_heading($heading, $content) {
|
||||
if ($content) {
|
||||
$content = html_writer::tag('h3', $heading, array('class' => 'accesshide')) . $content;
|
||||
$content = html_writer::tag('h4', $heading, array('class' => 'accesshide')) . $content;
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ class core_question_renderer extends plugin_renderer_base {
|
|||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
return html_writer::tag('h3', get_string('responsehistory', 'question'),
|
||||
return html_writer::tag('h4', get_string('responsehistory', 'question'),
|
||||
array('class' => 'responsehistoryheader')) . html_writer::tag('div',
|
||||
html_writer::table($table, true), array('class' => 'responsehistoryheader'));
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ question_engine::is_manual_grade_in_range.
|
|||
($qa, $options) to ($qa, $behaviouroutput, $options). If you have overridden
|
||||
that method you will need to update your code.
|
||||
|
||||
3) Heading level for number(), add_part_heading() and respond_history()
|
||||
has been lowered by one level. These changes are part of improving the page
|
||||
accessibility and making heading to have proper nesting. (MDL-41615)
|
||||
|
||||
=== Earlier changes ===
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ input#id_externalurl {direction:ltr;}
|
|||
.groupmanagementtable #addselect_wrapper label {font-weight: normal;}
|
||||
.dir-rtl .groupmanagementtable p {text-align: right;}
|
||||
#group-usersummary {width: 14em;}
|
||||
.groupselector {margin-top: 3px;margin-bottom: 3px;}
|
||||
.groupselector {margin-top: 3px;margin-bottom: 3px;display: inline-block;}
|
||||
|
||||
/**
|
||||
* Login
|
||||
|
|
|
@ -51,7 +51,7 @@ body.path-question-type .fitem_fgroup .accesshide {font: inherit;left: 0;positio
|
|||
.dir-rtl .que {text-align: right;}
|
||||
|
||||
.que .info {float: left;width: 7em;padding:0.5em;margin-bottom: 1.8em;background: #eee;}
|
||||
.que h2.no {margin: 0;font-size: 0.8em;line-height: 1;}
|
||||
.que h3.no {margin: 0;font-size: 0.8em;line-height: 1;}
|
||||
.que span.qno {font-size: 1.5em;font-weight:bold;}
|
||||
.que .info > div {font-size: 0.8em;margin-top: 0.7em;}
|
||||
.que .info .questionflag.editable {cursor:pointer;}
|
||||
|
|
|
@ -434,8 +434,11 @@ a.skip:active {
|
|||
.groupselector {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
display: inline-block;
|
||||
}
|
||||
.groupselector label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
// Login
|
||||
.loginbox {
|
||||
margin: 15px;
|
||||
|
|
|
@ -165,7 +165,7 @@ body.path-question-type .fitem_fgroup .accesshide {
|
|||
border: 1px solid darken(spin(@grayLighter, -10), 7%);
|
||||
.border-radius(2px);
|
||||
}
|
||||
.que h2.no {
|
||||
.que h3.no {
|
||||
margin: 0;
|
||||
font-size: 0.8em;
|
||||
line-height: 1;
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue