MDL-82009 course: Course blocks should be displayed in section page too

This commit is contained in:
Sara Arjona 2024-05-24 18:37:23 +02:00
parent bcd8e0d6ed
commit 0240478571
No known key found for this signature in database
5 changed files with 15 additions and 5 deletions

View File

@ -47,8 +47,8 @@ class block_section_links extends block_base {
return [
'course-view-weeks' => true,
'course-view-topics' => true,
'section-view-weeks' => true,
'section-view-topics' => true,
'course-view-section-weeks' => true,
'course-view-section-topics' => true,
];
}

View File

@ -166,7 +166,7 @@ class controlmenu implements named_templatable, renderable {
$controls = [];
// Only show the view link if we are not already in the section view page.
if ($PAGE->pagetype !== 'section-view-' . $course->format) {
if ($PAGE->pagetype !== 'course-view-section-' . $course->format) {
$controls['view'] = [
'url' => new moodle_url('/course/section.php', ['id' => $section->id]),
'icon' => 'i/viewsection',

View File

@ -100,3 +100,13 @@ Feature: Single section course page
And I click on "View" "link" in the "Section 1" "section"
When I set the field "Edit section name" in the "page-header" "region" to "Custom section name"
Then "Custom section name" "text" should exist in the ".breadcrumb" "css_element"
Scenario: Blocks are displayed in section page too
Given I log out
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| online_users | Course | C1 | course-view-* | site-pre |
When I am on the "C1" "Course" page logged in as "teacher1"
Then I should see "Online users"
And I am on the "Course 1 > Section 1" "course > section" page
And I should see "Online users"

View File

@ -107,7 +107,7 @@ if (!$sectioninfo->uservisible) {
}
}
$PAGE->set_pagetype('section-view-' . $course->format);
$PAGE->set_pagetype('course-view-section-' . $course->format);
$PAGE->set_other_editing_capability('moodle/course:update');
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_other_editing_capability('moodle/course:activityvisibility');

View File

@ -79,7 +79,7 @@ class boostnavbar implements \renderable {
$this->remove($item->key, \breadcrumb_navigation_node::TYPE_CATEGORY);
}
// Remove the course breadcrumb node.
if (!str_starts_with($this->page->pagetype, 'section-view-')) {
if (!str_starts_with($this->page->pagetype, 'course-view-section-')) {
$this->remove($this->page->course->id, \breadcrumb_navigation_node::TYPE_COURSE);
}
// Remove the navbar nodes that already exist in the secondary navigation menu.