MDL-80249 course: Hide secondary menu and add breadcrumb to section page
This commit is contained in:
@@ -44,10 +44,12 @@ class block_section_links extends block_base {
|
||||
* @return array
|
||||
*/
|
||||
public function applicable_formats() {
|
||||
return array(
|
||||
return [
|
||||
'course-view-weeks' => true,
|
||||
'course-view-topics' => true
|
||||
);
|
||||
'course-view-topics' => true,
|
||||
'section-view-weeks' => true,
|
||||
'section-view-topics' => true,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,5 +181,3 @@ class block_section_links extends block_base {
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2028,4 +2028,14 @@ abstract class base {
|
||||
public function get_required_jsfiles(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether section items can be removed from the navigation, just like the breadcrumb feature seen on activity pages.
|
||||
* By default, it returns false but can be overridden by the course format to change the behaviour.
|
||||
*
|
||||
* @return bool True if sections can be removed, false otherwise.
|
||||
*/
|
||||
public function can_sections_be_removed_from_navigation(): bool {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class controlmenu implements named_templatable, renderable {
|
||||
* @return array of edit control items
|
||||
*/
|
||||
public function section_control_items() {
|
||||
global $USER;
|
||||
global $USER, $PAGE;
|
||||
|
||||
$format = $this->format;
|
||||
$section = $this->section;
|
||||
@@ -135,13 +135,18 @@ class controlmenu implements named_templatable, renderable {
|
||||
$baseurl = course_get_url($course, $sectionreturn);
|
||||
$baseurl->param('sesskey', sesskey());
|
||||
|
||||
$controls['view'] = [
|
||||
'url' => new moodle_url('/course/section.php', ['id' => $section->id]),
|
||||
'icon' => 'i/viewsection',
|
||||
'name' => get_string('view'),
|
||||
'pixattr' => ['class' => ''],
|
||||
'attr' => ['class' => 'icon view'],
|
||||
];
|
||||
$controls = [];
|
||||
|
||||
// Only show the view link if we are not already in the section view page.
|
||||
if ($PAGE->pagetype !== 'section-view-' . $course->format) {
|
||||
$controls['view'] = [
|
||||
'url' => new moodle_url('/course/section.php', ['id' => $section->id]),
|
||||
'icon' => 'i/viewsection',
|
||||
'name' => get_string('view'),
|
||||
'pixattr' => ['class' => ''],
|
||||
'attr' => ['class' => 'icon view'],
|
||||
];
|
||||
}
|
||||
|
||||
if (!$isstealth && has_capability('moodle/course:update', $coursecontext, $user)) {
|
||||
$params = ['id' => $section->id];
|
||||
@@ -177,6 +182,9 @@ class controlmenu implements named_templatable, renderable {
|
||||
|
||||
if ($section->section) {
|
||||
$url = clone($baseurl);
|
||||
if (!is_null($sectionreturn)) {
|
||||
$url->param('sectionid', $format->get_sectionid());
|
||||
}
|
||||
if (!$isstealth) {
|
||||
if (has_capability('moodle/course:sectionvisibility', $coursecontext, $user)) {
|
||||
$strhidefromothers = get_string('hidefromothers', 'format_' . $course->format);
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
}}
|
||||
<li id="section-{{num}}"
|
||||
class="section course-section main {{#onlysummary}} section-summary {{/onlysummary}} clearfix
|
||||
{{#ishidden}} hidden {{/ishidden}} {{#iscurrent}} current {{/iscurrent}}
|
||||
{{#ishidden}} hidden {{/ishidden}} {{#iscurrent}}{{^displayonesection}} current {{/displayonesection}}{{/iscurrent}}
|
||||
{{#isstealth}} orphaned {{/isstealth}}"
|
||||
data-sectionid="{{num}}"
|
||||
data-sectionreturnid="{{sectionreturnid}}"
|
||||
|
||||
@@ -123,29 +123,33 @@
|
||||
{{/displayonesection}}
|
||||
{{/collapsemenu}}
|
||||
{{#controlmenu}}
|
||||
{{$ core_courseformat/local/content/section/controlmenu }}
|
||||
{{> core_courseformat/local/content/section/controlmenu }}
|
||||
{{/ core_courseformat/local/content/section/controlmenu }}
|
||||
{{^displayonesection}}
|
||||
{{$ core_courseformat/local/content/section/controlmenu }}
|
||||
{{> core_courseformat/local/content/section/controlmenu }}
|
||||
{{/ core_courseformat/local/content/section/controlmenu }}
|
||||
{{/displayonesection}}
|
||||
{{/controlmenu}}
|
||||
{{#header}}
|
||||
{{#headerdisplaymultipage}}
|
||||
{{^controlmenu}}
|
||||
<div class="section_goto bulk-hidden ml-auto" data-sectionid="{{id}}">
|
||||
<a href="{{{url}}}"
|
||||
class="btn btn-icon d-flex align-items-center justify-content-center icon-no-margin"
|
||||
title="{{#str}}gotosection, course, {{name}}{{/str}}">
|
||||
<span class="dir-rtl-hide">
|
||||
{{#pix}}t/right, moodle{{/pix}}
|
||||
</span>
|
||||
<span class="dir-ltr-hide">
|
||||
{{#pix}}t/left, moodle, {{#str}}gotosection, course, {{name}}{{/str}}{{/pix}}
|
||||
</span>
|
||||
<span class="sr-only">
|
||||
{{#str}}gotosection, course, {{name}}{{/str}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{{/controlmenu}}
|
||||
{{^displayonesection}}
|
||||
{{^controlmenu}}
|
||||
<div class="section_goto bulk-hidden ml-auto" data-sectionid="{{id}}">
|
||||
<a href="{{{url}}}"
|
||||
class="btn btn-icon d-flex align-items-center justify-content-center icon-no-margin"
|
||||
title="{{#str}}gotosection, course, {{name}}{{/str}}">
|
||||
<span class="dir-rtl-hide">
|
||||
{{#pix}}t/right, moodle{{/pix}}
|
||||
</span>
|
||||
<span class="dir-ltr-hide">
|
||||
{{#pix}}t/left, moodle, {{#str}}gotosection, course, {{name}}{{/str}}{{/pix}}
|
||||
</span>
|
||||
<span class="sr-only">
|
||||
{{#str}}gotosection, course, {{name}}{{/str}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
{{/controlmenu}}
|
||||
{{/displayonesection}}
|
||||
{{/headerdisplaymultipage}}
|
||||
{{/header}}
|
||||
</div>
|
||||
|
||||
@@ -36,9 +36,11 @@
|
||||
{{/ core_courseformat/local/content/section/bulkselect }}
|
||||
{{/sectionbulk}}
|
||||
{{#headerdisplaymultipage}}
|
||||
<h3 id="sectionid-{{id}}-title" class="h4 sectionname">
|
||||
{{{title}}}
|
||||
</h3>
|
||||
{{^displayonesection}}
|
||||
<h3 id="sectionid-{{id}}-title" class="h4 sectionname">
|
||||
{{{title}}}
|
||||
</h3>
|
||||
{{/displayonesection}}
|
||||
{{/headerdisplaymultipage}}
|
||||
{{^headerdisplaymultipage}}
|
||||
{{#sitehome}}
|
||||
@@ -47,11 +49,6 @@
|
||||
</h2>
|
||||
{{/sitehome}}
|
||||
{{^sitehome}}
|
||||
{{#displayonesection}}
|
||||
<h3 id="sectionid-{{id}}-title" class="h4 sectionname mb-0">
|
||||
{{{title}}}
|
||||
</h3>
|
||||
{{/displayonesection}}
|
||||
{{^displayonesection}}
|
||||
<div class="d-flex align-items-start position-relative">
|
||||
<a role="button"
|
||||
|
||||
@@ -880,6 +880,24 @@ class base_test extends advanced_testcase {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test can_sections_be_removed_from_navigation().
|
||||
*
|
||||
* @covers ::can_sections_be_removed_from_navigation
|
||||
*/
|
||||
public function test_can_sections_be_removed_from_navigation(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
|
||||
$course = $generator->create_course();
|
||||
$format = course_get_format($course);
|
||||
$this->assertFalse($format->can_sections_be_removed_from_navigation());
|
||||
|
||||
$course = $generator->create_course(['format' => 'testformatsections']);
|
||||
$format = course_get_format($course);
|
||||
$this->assertTrue($format->can_sections_be_removed_from_navigation());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -923,6 +941,10 @@ class format_testformatsections extends core_courseformat\base {
|
||||
public function uses_sections() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function can_sections_be_removed_from_navigation(): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,7 @@ Feature: Single section course page
|
||||
But I am on "Course 1" course homepage
|
||||
And I open section "0" edit menu
|
||||
And I click on "View" "link" in the "General" "section"
|
||||
And I should see "General" in the "region-main" "region"
|
||||
And I should see "General" in the "page" "region"
|
||||
And I should see "Activity sample 0.1" in the "region-main" "region"
|
||||
And I should not see "Activity sample 1.1" in the "region-main" "region"
|
||||
And I should not see "Activity sample 1.2" in the "region-main" "region"
|
||||
@@ -81,5 +81,6 @@ Feature: Single section course page
|
||||
And I should not see "Activity sample 2.1" in the "region-main" "region"
|
||||
And I should not see "Activity sample 2.1" in the "region-main" "region"
|
||||
# The section viewed has been trigered.
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Reports > Live logs" in current page administration
|
||||
And I should see "Section viewed"
|
||||
|
||||
@@ -110,7 +110,11 @@ class controlmenu extends controlmenu_base {
|
||||
$format = $this->format;
|
||||
$section = $this->section;
|
||||
$course = $format->get_course();
|
||||
$sectionreturn = $format->get_sectionnum();
|
||||
$url = $this->get_course_url();
|
||||
if (!is_null($sectionreturn)) {
|
||||
$url->param('sectionid', $format->get_sectionid());
|
||||
}
|
||||
|
||||
$highlightoff = get_string('highlightoff');
|
||||
$highlighton = get_string('highlight');
|
||||
@@ -125,6 +129,7 @@ class controlmenu extends controlmenu_base {
|
||||
'attr' => [
|
||||
'class' => 'editing_highlight',
|
||||
'data-action' => 'sectionUnhighlight',
|
||||
'data-sectionreturn' => $sectionreturn,
|
||||
'data-id' => $section->id,
|
||||
'data-swapname' => $highlighton,
|
||||
'data-swapicon' => 'i/marker',
|
||||
@@ -140,6 +145,7 @@ class controlmenu extends controlmenu_base {
|
||||
'attr' => [
|
||||
'class' => 'editing_highlight',
|
||||
'data-action' => 'sectionHighlight',
|
||||
'data-sectionreturn' => $sectionreturn,
|
||||
'data-id' => $section->id,
|
||||
'data-swapname' => $highlightoff,
|
||||
'data-swapicon' => 'i/marked',
|
||||
|
||||
@@ -33,7 +33,7 @@ Feature: Sections can be edited and deleted in custom sections format
|
||||
When I edit the section "0" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the general section |
|
||||
Then I should see "This is the general section" in the "This is the general section" "section"
|
||||
Then I should see "This is the general section" in the "page" "region"
|
||||
|
||||
Scenario: View the default name of the second section in custom sections format
|
||||
When I edit the section "2"
|
||||
@@ -43,13 +43,13 @@ Feature: Sections can be edited and deleted in custom sections format
|
||||
Scenario: Edit section summary in custom sections format
|
||||
When I edit the section "2" and I fill the form with:
|
||||
| Description | Welcome to section 2 |
|
||||
Then I should see "Welcome to section 2" in the "Topic 2" "section"
|
||||
Then I should see "Welcome to section 2" in the "page" "region"
|
||||
|
||||
Scenario: Edit section default name in custom sections format
|
||||
When I edit the section "2" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the second topic |
|
||||
Then I should see "This is the second topic" in the "This is the second topic" "section"
|
||||
Then I should see "This is the second topic" in the "page" "region"
|
||||
And I should not see "Topic 2" in the "region-main" "region"
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -32,7 +32,7 @@ Feature: Sections can be edited and deleted in weekly sections format
|
||||
When I edit the section "0" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the general section |
|
||||
Then I should see "This is the general section" in the "This is the general section" "section"
|
||||
Then I should see "This is the general section" in the "page" "region"
|
||||
|
||||
Scenario: View the default name of the second section in weeks format
|
||||
When I edit the section "2"
|
||||
@@ -42,14 +42,14 @@ Feature: Sections can be edited and deleted in weekly sections format
|
||||
Scenario: Edit section summary in weeks format
|
||||
When I edit the section "2" and I fill the form with:
|
||||
| Description | Welcome to section 2 |
|
||||
Then I should see "Welcome to section 2" in the "8 May - 14 May" "section"
|
||||
Then I should see "Welcome to section 2" in the "page" "region"
|
||||
|
||||
Scenario: Edit section default name in weeks format
|
||||
Given I should see "8 May - 14 May" in the "8 May - 14 May" "section"
|
||||
When I edit the section "2" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the second week |
|
||||
Then I should see "This is the second week" in the "This is the second week" "section"
|
||||
Then I should see "This is the second week" in the "page" "region"
|
||||
And I should not see "8 May - 14 May"
|
||||
|
||||
@javascript
|
||||
|
||||
+21
-8
@@ -46,6 +46,7 @@ $course = get_course($section->course);
|
||||
// Fix course format if it is no longer installed.
|
||||
$format = course_get_format($course);
|
||||
$course->format = $format->get_format();
|
||||
$format->set_sectionid($section->id);
|
||||
|
||||
// When the course format doesn't support sections, redirect to course page.
|
||||
if (!course_format_uses_sections($course->format)) {
|
||||
@@ -62,18 +63,18 @@ require_login($course);
|
||||
|
||||
// Must set layout before getting section info. See MDL-47555.
|
||||
$PAGE->set_pagelayout('course');
|
||||
$PAGE->add_body_class('limitedwidth');
|
||||
$PAGE->add_body_classes(['limitedwidth', 'single-section-page']);
|
||||
|
||||
// Get section details and check it exists.
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
$coursesections = $modinfo->get_section_info($section->section, MUST_EXIST);
|
||||
$sectioninfo = $modinfo->get_section_info($section->section, MUST_EXIST);
|
||||
|
||||
// Check user is allowed to see it.
|
||||
if (!$coursesections->uservisible) {
|
||||
if (!$sectioninfo->uservisible) {
|
||||
// Check if coursesection has conditions affecting availability and if
|
||||
// so, output availability info.
|
||||
if ($coursesections->visible && $coursesections->availableinfo) {
|
||||
$sectionname = get_section_name($course, $coursesections);
|
||||
if ($sectioninfo->visible && $sectioninfo->availableinfo) {
|
||||
$sectionname = get_section_name($course, $sectioninfo);
|
||||
$message = get_string('notavailablecourse', '', $sectionname);
|
||||
redirect(course_get_url($course), $message, null, \core\output\notification::NOTIFY_ERROR);
|
||||
} else {
|
||||
@@ -84,7 +85,7 @@ if (!$coursesections->uservisible) {
|
||||
}
|
||||
}
|
||||
|
||||
$PAGE->set_pagetype('course-view-' . $course->format);
|
||||
$PAGE->set_pagetype('section-view-' . $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');
|
||||
@@ -141,7 +142,20 @@ if (!empty($bulkbutton)) {
|
||||
$PAGE->add_header_action($bulkbutton);
|
||||
}
|
||||
|
||||
$PAGE->set_heading($course->fullname);
|
||||
// Add to the header the control menu for the section.
|
||||
if ($format->show_editor()) {
|
||||
$sectionclass = new \core_courseformat\output\local\content\section($format, $sectioninfo);
|
||||
$renderable = $sectionclass->export_for_template($renderer);
|
||||
$controlmenuhtml = $renderable->controlmenu->menu;
|
||||
$PAGE->add_header_action($controlmenuhtml);
|
||||
$sectionheading = $OUTPUT->render($format->inplace_editable_render_section_name($sectioninfo, false));
|
||||
$PAGE->set_heading($sectionheading, false, false);
|
||||
} else {
|
||||
$PAGE->set_heading($sectiontitle);
|
||||
}
|
||||
|
||||
$PAGE->set_secondary_navigation(false);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Show communication room status notification.
|
||||
@@ -168,7 +182,6 @@ echo $renderer->container_start('course-content');
|
||||
// Include course AJAX.
|
||||
include_course_ajax($course, $modinfo->get_used_module_names());
|
||||
|
||||
$format->set_sectionid($section->id);
|
||||
$outputclass = $format->get_output_classname('content');
|
||||
$widget = new $outputclass($format);
|
||||
echo $renderer->render($widget);
|
||||
|
||||
@@ -61,15 +61,14 @@ Feature: Course activity controls works as expected
|
||||
And I should see "Edited test forum name 2"
|
||||
# General section can't be hidden. Check this part using always the first section.
|
||||
And I am on the "Course 1" course page
|
||||
And I open section "1" edit menu
|
||||
And I click on "View" "link" in the <firstsection> "section"
|
||||
And I hide section "1"
|
||||
And <belowpage> "section" should not exist
|
||||
And section "1" should be hidden
|
||||
And all activities in section "1" should be hidden
|
||||
And I show section "1"
|
||||
And <belowpage> "section" should not exist
|
||||
And section "1" should be visible
|
||||
And I open section "1" edit menu
|
||||
And I click on "View" "link" in the <firstsection> "section"
|
||||
And <belowpage> "section" should not exist
|
||||
And the following config values are set as admin:
|
||||
| unaddableblocks | | theme_boost|
|
||||
And I add the "Section links" block
|
||||
@@ -129,9 +128,6 @@ Feature: Course activity controls works as expected
|
||||
And I should see "Edited test forum name 2"
|
||||
# General section can't be hidden. Check this part using always the first section.
|
||||
And I am on the "Course 1" course page
|
||||
And I turn editing mode off
|
||||
And I click on <firstsection> "link" in the "region-main" "region"
|
||||
And I turn editing mode on
|
||||
And I hide section "1"
|
||||
And section "1" should be hidden
|
||||
And all activities in section "1" should be hidden
|
||||
|
||||
@@ -16,15 +16,15 @@ Feature: Course paged mode
|
||||
And I click on <section2> "link" in the <section2> "section"
|
||||
And I am on "Course 1" course homepage
|
||||
When I click on <general> "link" in the <general> "section"
|
||||
Then I should see <general> in the "div.single-section" "css_element"
|
||||
Then I should see <general> in the "div.page-context-header" "css_element"
|
||||
And I should see <section1> in the ".single-section div.nextsection" "css_element"
|
||||
And I should not see <prevunexistingsection> in the ".single-section" "css_element"
|
||||
And I click on <section1> "link" in the ".single-section" "css_element"
|
||||
And I should see <section1> in the "div.single-section" "css_element"
|
||||
And I should see <section1> in the "div.page-context-header" "css_element"
|
||||
And I should see <general> in the ".single-section div.prevsection" "css_element"
|
||||
And I should see <section2> in the ".single-section div.nextsection" "css_element"
|
||||
And I click on <section2> "link" in the ".single-section" "css_element"
|
||||
And I should see <section2> in the "div.single-section" "css_element"
|
||||
And I should see <section2> in the "div.page-context-header" "css_element"
|
||||
And I should not see <general> in the ".single-section .section-navigation" "css_element"
|
||||
And I should not see <prevunexistingsection> in the ".single-section" "css_element"
|
||||
And I should not see <nextunexistingsection> in the ".single-section" "css_element"
|
||||
@@ -46,10 +46,7 @@ Feature: Course paged mode
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I open section <sectionnumber1> edit menu
|
||||
And I click on "View" "link" in the <section1> "section"
|
||||
And I should see <section1> in the "div.single-section" "css_element"
|
||||
And I should see <section2> in the ".single-section div.nextsection" "css_element"
|
||||
And I should not see <prevunexistingsection> in the ".single-section" "css_element"
|
||||
Then I should see <section1> in the "div.single-section" "css_element"
|
||||
Then I should see <section1> in the "div.page-context-header" "css_element"
|
||||
And I should see <section2> in the ".single-section div.nextsection" "css_element"
|
||||
And I should not see <prevunexistingsection> in the ".single-section" "css_element"
|
||||
|
||||
@@ -69,15 +66,15 @@ Feature: Course paged mode
|
||||
And I click on <section2> "link" in the <section2> "section"
|
||||
And I am on "Course 1" course homepage
|
||||
And I click on <general> "link" in the <general> "section"
|
||||
And I should see <general> in the "div.single-section" "css_element"
|
||||
And I should see <general> in the "div.page-context-header" "css_element"
|
||||
And I should see <section1> in the ".single-section div.nextsection" "css_element"
|
||||
And I should not see <prevunexistingsection> in the ".single-section" "css_element"
|
||||
And I click on <section1> "link" in the ".single-section" "css_element"
|
||||
And I should see <section1> in the "div.single-section" "css_element"
|
||||
And I should see <section1> in the "div.page-context-header" "css_element"
|
||||
And I should see <general> in the ".single-section div.prevsection" "css_element"
|
||||
And I should see <section2> in the ".single-section div.nextsection" "css_element"
|
||||
And I click on <section2> "link" in the ".single-section" "css_element"
|
||||
And I should see <section2> in the "div.single-section" "css_element"
|
||||
And I should see <section2> in the "div.page-context-header" "css_element"
|
||||
And I should not see <general> in the ".single-section .section-navigation" "css_element"
|
||||
And I should not see <prevunexistingsection> in the ".single-section" "css_element"
|
||||
And I should not see <nextunexistingsection> in the ".single-section" "css_element"
|
||||
|
||||
@@ -28,17 +28,15 @@ Feature: Section 0 default/custom title
|
||||
Scenario: Editing section 0 title
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I edit the section "0" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | Edited section 0 |
|
||||
And I should see "Edited section 0" in the "li#section-0" "css_element"
|
||||
And I set the field "Edit section name" in the "li#section-0" "css_element" to "Edited section 0"
|
||||
And I should see "Edited section 0" in the "page" "region"
|
||||
When I set the field "Edit section name" in the "li#section-0" "css_element" to ""
|
||||
Then I should not see "Edited section 0" in the "li#section-0" "css_element"
|
||||
And I should see "General" in the "li#section-0" "css_element"
|
||||
And "New name for section" "field" should not exist
|
||||
And I set the field "Edit section name" in the "li#section-0" "css_element" to "Edited section 0"
|
||||
And I should see "Edited section 0" in the "li#section-0" "css_element"
|
||||
And I should see "Edited section 0" in the "page" "region"
|
||||
And I edit the section "0" and I fill the form with:
|
||||
| Custom | 0 |
|
||||
And I should not see "Edited section 0" in the "li#section-0" "css_element"
|
||||
And I should see "General" in the "li#section-0" "css_element"
|
||||
And I should not see "Edited section 0" in the "page" "region"
|
||||
And I should see "General" in the "page" "region"
|
||||
|
||||
+18
-1
@@ -202,11 +202,28 @@ if ($PAGE->user_allowed_editing()) {
|
||||
if (has_capability('moodle/course:sectionvisibility', $context)) {
|
||||
if ($hide && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $hide, '0');
|
||||
redirect($PAGE->url);
|
||||
if ($sectionid) {
|
||||
redirect(course_get_url($course, $section, ['navigation' => true]));
|
||||
} else {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
|
||||
if ($show && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $show, '1');
|
||||
if ($sectionid) {
|
||||
redirect(course_get_url($course, $section, ['navigation' => true]));
|
||||
} else {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($marker >= 0 && confirm_sesskey()) {
|
||||
course_set_marker($course->id, $marker);
|
||||
if ($sectionid) {
|
||||
redirect(course_get_url($course, $section, ['navigation' => true]));
|
||||
} else {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1422,9 +1422,10 @@ class moodle_page {
|
||||
*
|
||||
* @param string $heading the main heading that should be displayed at the top of the <body>.
|
||||
* @param bool $applyformatting apply format_string() - by default true.
|
||||
* @param bool $clean whether the heading should be cleaned or not when no formatting is applied - by default true.
|
||||
*/
|
||||
public function set_heading($heading, bool $applyformatting = true) {
|
||||
$this->_heading = $applyformatting ? format_string($heading) : clean_text($heading);
|
||||
public function set_heading($heading, bool $applyformatting = true, bool $clean = true) {
|
||||
$this->_heading = $applyformatting ? format_string($heading) : ($clean ? clean_text($heading) : $heading);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -321,8 +321,12 @@ class moodle_page_test extends \advanced_testcase {
|
||||
$this->assertSame('a heading edit', $this->testpage->heading);
|
||||
|
||||
// Without formatting the tags are preserved but cleaned.
|
||||
$this->testpage->set_heading('a heading <a href="#">edit</a><p>', false);
|
||||
$this->assertSame('a heading <a href="#">edit</a><p></p>', $this->testpage->heading);
|
||||
$this->testpage->set_heading('<div data-param1="value1">a heading <a href="#">edit</a><p></div>', false);
|
||||
$this->assertSame('<div>a heading <a href="#">edit</a><p></p></div>', $this->testpage->heading);
|
||||
|
||||
// Without formatting nor clean.
|
||||
$this->testpage->set_heading('<div data-param1="value1">a heading <a href="#">edit</a><p></div>', false, false);
|
||||
$this->assertSame('<div data-param1="value1">a heading <a href="#">edit</a><p></div>', $this->testpage->heading);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,6 +53,8 @@ information provided here is intended especially for developers.
|
||||
It was originally deprecated in Moodle 2.0.
|
||||
* The smiley option for format_text has been removed. It was deprecated in Moodle 2.0.
|
||||
* The nocache option for format_text has been removed. It was deprecated in Moodle 2.3.
|
||||
* The set_heading() method has a new parameter, $clean, to define whether the heading should be cleaned or not when no formatting
|
||||
is applied.
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
|
||||
@@ -79,7 +79,9 @@ class boostnavbar implements \renderable {
|
||||
$this->remove($item->key, \breadcrumb_navigation_node::TYPE_CATEGORY);
|
||||
}
|
||||
// Remove the course breadcrumb node.
|
||||
$this->remove($this->page->course->id, \breadcrumb_navigation_node::TYPE_COURSE);
|
||||
if (!str_starts_with($this->page->pagetype, 'section-view-')) {
|
||||
$this->remove($this->page->course->id, \breadcrumb_navigation_node::TYPE_COURSE);
|
||||
}
|
||||
// Remove the navbar nodes that already exist in the secondary navigation menu.
|
||||
$this->remove_items_that_exist_in_navigation($PAGE->secondarynav);
|
||||
|
||||
@@ -111,11 +113,8 @@ class boostnavbar implements \renderable {
|
||||
// Remove if it is a course category breadcrumb node.
|
||||
$this->remove($item->key, \breadcrumb_navigation_node::TYPE_CATEGORY);
|
||||
}
|
||||
$courseformat = course_get_format($this->page->course)->get_course();
|
||||
// Section items can be only removed if a course layout (coursedisplay) is not explicitly set in the
|
||||
// given course format or the set course layout is not 'One section per page'.
|
||||
$removesections = !isset($courseformat->coursedisplay) ||
|
||||
$courseformat->coursedisplay != COURSE_DISPLAY_MULTIPAGE;
|
||||
$courseformat = course_get_format($this->page->course);
|
||||
$removesections = $courseformat->can_sections_be_removed_from_navigation();
|
||||
if ($removesections) {
|
||||
// If the course sections are removed, we need to add the anchor of current section to the Course.
|
||||
$coursenode = $this->get_item($this->page->course->id);
|
||||
|
||||
@@ -343,10 +343,6 @@
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.course-content .single-section {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.course-content .single-section .section-navigation {
|
||||
display: block;
|
||||
padding: 0.5em;
|
||||
@@ -430,6 +426,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
.course-content .single-section ul.topics li.section,
|
||||
.course-content .single-section ul.weeks li.section {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
@include media-breakpoint-down(sm) {
|
||||
body:not(.editing) {
|
||||
.course-content ul.topics,
|
||||
@@ -570,6 +571,10 @@ li.section.hidden span.commands a.editing_show {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.single-section-page .header-action {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
input.titleeditor {
|
||||
width: 330px;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
@@ -28183,10 +28183,6 @@ table.calendartable caption {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.course-content .single-section {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.course-content .single-section .section-navigation {
|
||||
display: block;
|
||||
padding: 0.5em;
|
||||
@@ -28270,6 +28266,11 @@ table.calendartable caption {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.course-content .single-section ul.topics li.section,
|
||||
.course-content .single-section ul.weeks li.section {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
body:not(.editing) .course-content ul.topics li.section .left,
|
||||
body:not(.editing) .course-content ul.topics li.section .right,
|
||||
@@ -28384,6 +28385,10 @@ li.section.hidden span.commands a.editing_show {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.single-section-page .header-action {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
input.titleeditor {
|
||||
width: 330px;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
@@ -28183,10 +28183,6 @@ table.calendartable caption {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.course-content .single-section {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.course-content .single-section .section-navigation {
|
||||
display: block;
|
||||
padding: 0.5em;
|
||||
@@ -28270,6 +28266,11 @@ table.calendartable caption {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.course-content .single-section ul.topics li.section,
|
||||
.course-content .single-section ul.weeks li.section {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
body:not(.editing) .course-content ul.topics li.section .left,
|
||||
body:not(.editing) .course-content ul.topics li.section .right,
|
||||
@@ -28384,6 +28385,10 @@ li.section.hidden span.commands a.editing_show {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.single-section-page .header-action {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
input.titleeditor {
|
||||
width: 330px;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
Reference in New Issue
Block a user