mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-77690 mod_lesson: Lesson accessibility fixes
* Set the heading levels of lesson pages appropriately to avoid skipped heading issues. * Add appropriate labels for tertiary navigation select menus.
This commit is contained in:
parent
213223d162
commit
14d4f0aed3
@ -60,6 +60,7 @@ class edit_action_area implements templatable, renderable {
|
||||
* @return array Said data.
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output): array {
|
||||
global $PAGE;
|
||||
|
||||
$viewurl = new moodle_url('/mod/lesson/edit.php', ['id' => $this->cmid, 'mode' => 'collapsed']);
|
||||
$fullviewurl = new moodle_url('/mod/lesson/edit.php', ['id' => $this->cmid, 'mode' => 'full']);
|
||||
@ -69,14 +70,18 @@ class edit_action_area implements templatable, renderable {
|
||||
];
|
||||
|
||||
$selectmenu = new \url_select($menu, $this->currenturl->out(false), null, 'mod_lesson_navigation_select');
|
||||
$selectmenu->label = get_string('displaymode', 'mod_lesson');
|
||||
$selectmenu->labelattributes = ['class' => 'sr-only'];
|
||||
|
||||
$headinglevel = $PAGE->activityheader->get_heading_level();
|
||||
return [
|
||||
'back' => [
|
||||
'text' => get_string('back', 'core'),
|
||||
'link' => (new moodle_url('/mod/lesson/view.php', ['id' => $this->cmid]))->out(false)
|
||||
],
|
||||
'viewselect' => $selectmenu->export_for_template($output),
|
||||
'heading' => get_string('editinglesson', 'mod_lesson')
|
||||
'heading' => get_string('editinglesson', 'mod_lesson'),
|
||||
'headinglevel' => $headinglevel,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,10 @@ class override_action_menu implements templatable, renderable {
|
||||
$userlink->out(false) => get_string('useroverrides', 'mod_lesson'),
|
||||
$grouplink->out(false) => get_string('groupoverrides', 'mod_lesson'),
|
||||
];
|
||||
return new \url_select($menu, $this->currenturl->out(false), null, 'mod_lesson_override_select');
|
||||
$selectmenu = new \url_select($menu, $this->currenturl->out(false), null, 'mod_lesson_override_select');
|
||||
$selectmenu->label = get_string('manageoverrides', 'mod_lesson');
|
||||
$selectmenu->labelattributes = ['class' => 'sr-only'];
|
||||
return $selectmenu;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,6 +82,8 @@ class override_action_menu implements templatable, renderable {
|
||||
* @return array Said data.
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output): array {
|
||||
global $PAGE;
|
||||
|
||||
$type = $this->currenturl->get_param('mode');
|
||||
if ($type == 'user') {
|
||||
$text = get_string('addnewuseroverride', 'mod_lesson');
|
||||
@ -100,6 +105,7 @@ class override_action_menu implements templatable, renderable {
|
||||
];
|
||||
}
|
||||
$data['heading'] = get_string($type == 'user' ? 'useroverrides' : 'groupoverrides', 'mod_lesson');
|
||||
$data['headinglevel'] = $PAGE->activityheader->get_heading_level();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ class report_action_menu implements templatable, renderable {
|
||||
* @return array The data for the template.
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output): array {
|
||||
global $PAGE;
|
||||
|
||||
$overviewlink = new moodle_url('/mod/lesson/report.php', ['id' => $this->lessonid, 'action' => 'reportoverview']);
|
||||
$fulllink = new moodle_url('/mod/lesson/report.php', ['id' => $this->lessonid, 'action' => 'reportdetail']);
|
||||
$menu = [
|
||||
@ -67,9 +69,13 @@ class report_action_menu implements templatable, renderable {
|
||||
$fulllink->out(false) => get_string('detailedstats', 'mod_lesson')
|
||||
];
|
||||
$reportselect = new \url_select($menu, $this->url->out(false), null, 'lesson-report-select');
|
||||
$reportselect->label = get_string('selectreport', 'mod_lesson');
|
||||
$reportselect->labelattributes = ['class' => 'sr-only'];
|
||||
|
||||
$data = [
|
||||
'reportselect' => $reportselect->export_for_template($output),
|
||||
'heading' => $menu[$reportselect->selected] ?? ''
|
||||
'heading' => $menu[$reportselect->selected] ?? '',
|
||||
'headinglevel' => $PAGE->activityheader->get_heading_level(),
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ $mform->set_data($data);
|
||||
]);
|
||||
$PAGE->add_body_class('limitedwidth');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading_with_help($strimportquestions, 'importquestions', 'lesson', '', '', 3);
|
||||
$headinglevel = $PAGE->activityheader->get_heading_level();
|
||||
echo $OUTPUT->heading_with_help($strimportquestions, 'importquestions', 'lesson', '', '', $headinglevel);
|
||||
|
||||
if ($data = $mform->get_data()) {
|
||||
|
||||
|
@ -168,6 +168,7 @@ $string['displayleftif'] = 'Minimum grade to display menu';
|
||||
$string['displayleftif_help'] = 'This setting determines whether a student must obtain a certain grade before viewing the lesson menu. This forces the student to go through the entire lesson on their first attempt, then after obtaining the required grade they can use the menu for review.';
|
||||
$string['displayleftmenu'] = 'Display menu';
|
||||
$string['displayleftmenu_help'] = 'If enabled, a menu allowing users to navigate through the list of pages is displayed.';
|
||||
$string['displaymode'] = 'Display mode';
|
||||
$string['displayofgrade'] = 'Display of grade (for students only)';
|
||||
$string['displayreview'] = 'Provide option to try a question again';
|
||||
$string['displayreview_help'] = 'If enabled, when a question is answered incorrectly, the student is given the option to try it again for no point credit, or continue with the lesson. If the student clicks to move on to another question then the selected (wrong) answer will be followed. By default wrong answer jumps are set to "this page" and have a score of 0, so it is recommended that you set the wrong answer jump to a different page to avoid confusion with your students.';
|
||||
@ -318,6 +319,7 @@ $string['linkedmedia'] = 'Linked media';
|
||||
$string['loginfail'] = 'Login failed, please try again...';
|
||||
$string['lowscore'] = 'Low score';
|
||||
$string['lowtime'] = 'Low time';
|
||||
$string['manageoverrides'] = 'Manage overrides';
|
||||
$string['manualgrading'] = 'Grade essays';
|
||||
$string['matchesanswer'] = 'Matches with answer';
|
||||
$string['matching'] = 'Matching';
|
||||
@ -542,6 +544,7 @@ $string['search:activity'] = 'Lesson - activity information';
|
||||
$string['secondpluswrong'] = 'Not quite. Would you like to try again?';
|
||||
$string['selectaqtype'] = 'Select a question type';
|
||||
$string['selectallattempts'] = 'Select all attempts';
|
||||
$string['selectreport'] = 'Select report';
|
||||
$string['sent'] = 'Sent';
|
||||
$string['shortanswer'] = 'Short answer';
|
||||
$string['showanunansweredpage'] = 'Show an unanswered page';
|
||||
|
@ -81,7 +81,8 @@ switch ($action) {
|
||||
$title = $DB->get_field("lesson_pages", "title", array("id" => $pageid));
|
||||
|
||||
echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('moving', 'lesson', format_String($title)));
|
||||
echo $OUTPUT->heading(get_string("moving", "lesson", format_string($title)), 3);
|
||||
$headinglevel = $PAGE->activityheader->get_heading_level();
|
||||
echo $OUTPUT->heading(get_string("moving", "lesson", format_string($title)), $headinglevel);
|
||||
|
||||
$params = array ("lessonid" => $lesson->id, "prevpageid" => 0);
|
||||
if (!$page = $DB->get_record_select("lesson_pages", "lessonid = :lessonid AND prevpageid = :prevpageid", $params)) {
|
||||
|
@ -113,8 +113,10 @@ class lesson_page_type_branchtable extends lesson_page {
|
||||
if ($this->lesson->slideshow) {
|
||||
$output .= $renderer->slideshow_start($this->lesson);
|
||||
}
|
||||
// We are using level 3 header because the page title is a sub-heading of lesson title (MDL-30911).
|
||||
$output .= $renderer->heading(format_string($this->properties->title), 3);
|
||||
|
||||
// The heading level depends on whether the theme's activity header displays a heading (usually the activity name).
|
||||
$headinglevel = $PAGE->activityheader->get_heading_level();
|
||||
$output .= $renderer->heading(format_string($this->properties->title), $headinglevel);
|
||||
$output .= $renderer->box($this->get_contents(), 'contents');
|
||||
|
||||
$buttons = array();
|
||||
|
@ -368,10 +368,10 @@ class mod_lesson_renderer extends plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function add_first_page_links(lesson $lesson) {
|
||||
global $CFG;
|
||||
$prevpageid = 0;
|
||||
|
||||
$output = $this->output->heading(get_string("whatdofirst", "lesson"), 3);
|
||||
$headinglevel = $this->page->activityheader->get_heading_level(3);
|
||||
$output = $this->output->heading(get_string("whatdofirst", "lesson"), $headinglevel);
|
||||
$links = array();
|
||||
|
||||
$importquestionsurl = new moodle_url('/mod/lesson/import.php',array('id'=>$this->page->cm->id, 'pageid'=>$prevpageid));
|
||||
@ -567,8 +567,8 @@ class mod_lesson_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
if ($data->gradelesson) {
|
||||
// We are using level 3 header because the page title is a sub-heading of lesson title (MDL-30911).
|
||||
$output .= $this->heading(get_string("congratulations", "lesson"), 3);
|
||||
$headinglevel = $this->page->activityheader->get_heading_level();
|
||||
$output .= $this->heading(get_string("congratulations", "lesson"), $headinglevel);
|
||||
$output .= $this->box_start('generalbox boxaligncenter');
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,9 @@
|
||||
]}],
|
||||
"disabled": false,
|
||||
"title": "Some cool title"
|
||||
}
|
||||
},
|
||||
"headinglevel": 3,
|
||||
"heading": "Some heading"
|
||||
}
|
||||
|
||||
}}
|
||||
@ -80,4 +82,4 @@
|
||||
{{/viewselect}}
|
||||
</div>
|
||||
</div>
|
||||
<h3>{{heading}}</h3>
|
||||
<h{{headinglevel}}>{{heading}}</h{{headinglevel}}>
|
||||
|
@ -64,7 +64,9 @@
|
||||
"addoverride": {
|
||||
"link": "https://moodle.org",
|
||||
"text": "Add override"
|
||||
}
|
||||
},
|
||||
"headinglevel": 3,
|
||||
"heading": "Some heading"
|
||||
}
|
||||
|
||||
}}
|
||||
@ -82,4 +84,4 @@
|
||||
{{/addoverride}}
|
||||
</div>
|
||||
</div>
|
||||
<h3>{{heading}}</h3>
|
||||
<h{{headinglevel}}>{{heading}}</h{{headinglevel}}>
|
||||
|
@ -58,7 +58,9 @@
|
||||
{"name": "Item 4", "isgroup": false, "value": "4"}
|
||||
]}],
|
||||
"disabled": false,
|
||||
"title": "Some cool title"
|
||||
"title": "Some cool title",
|
||||
"headinglevel": 3,
|
||||
"heading": "Some heading"
|
||||
}
|
||||
|
||||
}}
|
||||
@ -71,4 +73,4 @@
|
||||
</div>
|
||||
{{/reportselect}}
|
||||
</div>
|
||||
<h3>{{heading}}</h3>
|
||||
<h{{headinglevel}}>{{heading}}</h{{headinglevel}}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user