\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nexport default class {\n\n /**\n * Class constructor.\n *\n * @param {CourseEditor} reactive the course editor object\n */\n constructor(reactive) {\n this.reactive = reactive;\n }\n\n /**\n * Generate the course export data from the state.\n *\n * @param {Object} state the current state.\n * @returns {Object}\n */\n course(state) {\n // Collect section information from the state.\n const data = {\n sections: [],\n editmode: this.reactive.isEditing,\n highlighted: state.course.highlighted ?? '',\n };\n const sectionlist = state.course.sectionlist ?? [];\n sectionlist.forEach(sectionid => {\n const sectioninfo = state.section.get(sectionid) ?? {};\n const section = this.section(state, sectioninfo);\n data.sections.push(section);\n });\n data.hassections = (data.sections.length != 0);\n\n return data;\n }\n\n /**\n * Generate a section export data from the state.\n *\n * @param {Object} state the current state.\n * @param {Object} sectioninfo the section state data.\n * @returns {Object}\n */\n section(state, sectioninfo) {\n const section = {\n ...sectioninfo,\n cms: [],\n isactive: true,\n };\n const cmlist = sectioninfo.cmlist ?? [];\n cmlist.forEach(cmid => {\n const cminfo = state.cm.get(cmid);\n const cm = this.cm(state, cminfo);\n section.cms.push(cm);\n });\n section.hascms = (section.cms.length != 0);\n\n return section;\n }\n\n /**\n * Generate a cm export data from the state.\n *\n * @param {Object} state the current state.\n * @param {Object} cminfo the course module state data.\n * @returns {Object}\n */\n cm(state, cminfo) {\n const cm = {\n ...cminfo,\n isactive: false,\n };\n return cm;\n }\n\n /**\n * Generate a dragable cm data structure.\n *\n * This method is used by any draggable course module element to generate drop data\n * for its reactive/dragdrop instance.\n *\n * @param {*} state the state object\n * @param {*} cmid the cours emodule id\n * @returns {Object|null}\n */\n cmDraggableData(state, cmid) {\n const cminfo = state.cm.get(cmid);\n if (!cminfo) {\n return null;\n }\n\n // Drop an activity over the next activity is the same as doing anything.\n let nextcmid;\n const section = state.section.get(cminfo.sectionid);\n const currentindex = section?.cmlist.indexOf(cminfo.id);\n if (currentindex !== undefined) {\n nextcmid = section?.cmlist[currentindex + 1];\n }\n\n return {\n type: 'cm',\n id: cminfo.id,\n name: cminfo.name,\n nextcmid,\n };\n }\n\n /**\n * Generate a dragable cm data structure.\n *\n * This method is used by any draggable section element to generate drop data\n * for its reactive/dragdrop instance.\n *\n * @param {*} state the state object\n * @param {*} sectionid the cours section id\n * @returns {Object|null}\n */\n sectionDraggableData(state, sectionid) {\n const sectioninfo = state.section.get(sectionid);\n if (!sectioninfo) {\n return null;\n }\n return {\n type: 'section',\n id: sectioninfo.id,\n name: sectioninfo.name,\n number: sectioninfo.number,\n };\n }\n}\n"],"file":"exporter.min.js"}
\ No newline at end of file
diff --git a/course/format/amd/src/local/courseeditor/exporter.js b/course/format/amd/src/local/courseeditor/exporter.js
index cb738e8d445d2..60fde91d22006 100644
--- a/course/format/amd/src/local/courseeditor/exporter.js
+++ b/course/format/amd/src/local/courseeditor/exporter.js
@@ -44,6 +44,7 @@ export default class {
const data = {
sections: [],
editmode: this.reactive.isEditing,
+ highlighted: state.course.highlighted ?? '',
};
const sectionlist = state.course.sectionlist ?? [];
sectionlist.forEach(sectionid => {
diff --git a/course/format/classes/base.php b/course/format/classes/base.php
index dc8f584765841..63a05e13c01c1 100644
--- a/course/format/classes/base.php
+++ b/course/format/classes/base.php
@@ -454,6 +454,15 @@ public function get_default_section_name($section) {
return self::get_section_name($section);
}
+ /**
+ * Returns the name for the highlighted section.
+ *
+ * @return string The name for the highlighted section based on the given course format.
+ */
+ public function get_section_highlighted_name(): string {
+ return get_string('highlighted');
+ }
+
/**
* Set if the current format instance will show multiple sections or an individual one.
*
diff --git a/course/format/classes/output/local/state/course.php b/course/format/classes/output/local/state/course.php
index efcf477cd0460..cd936cf71ffd8 100644
--- a/course/format/classes/output/local/state/course.php
+++ b/course/format/classes/output/local/state/course.php
@@ -57,6 +57,7 @@ public function export_for_template(\renderer_base $output): stdClass {
'numsections' => $format->get_last_section_number(),
'sectionlist' => [],
'editmode' => $format->show_editor(),
+ 'highlighted' => $format->get_section_highlighted_name(),
];
$sections = $modinfo->get_section_info_all();
diff --git a/course/format/templates/local/courseindex/section.mustache b/course/format/templates/local/courseindex/section.mustache
index 96ba678a52711..345ed159dd7a7 100644
--- a/course/format/templates/local/courseindex/section.mustache
+++ b/course/format/templates/local/courseindex/section.mustache
@@ -89,6 +89,9 @@
>
{{{title}}}
+
+ {{highlighted}}
+
{{#pix}}i/dragdrop{{/pix}}
coursename} by {$a->username}';
diff --git a/theme/boost/scss/moodle/courseindex.scss b/theme/boost/scss/moodle/courseindex.scss
index f14faa3b303ca..aa7305ec8c5d0 100644
--- a/theme/boost/scss/moodle/courseindex.scss
+++ b/theme/boost/scss/moodle/courseindex.scss
@@ -57,8 +57,18 @@ $courseindex-item-current: $primary !default;
}
.courseindex-section {
+
+ .current-badge {
+ line-height: $line-height-base;
+ display: none;
+ }
+
&.current {
border-left: solid 3px $courseindex-item-current;
+
+ .current-badge {
+ display: inline-block;
+ }
}
&.dropready .courseindex-item-content {
diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css
index da3f0252c4947..7916c077f9c39 100644
--- a/theme/boost/style/moodle.css
+++ b/theme/boost/style/moodle.css
@@ -20431,8 +20431,14 @@ div.editor_atto_toolbar button .icon {
.courseindex .courseindex-sectioncontent .courseindex-item {
padding-left: calc(1rem * 2 + 0.5rem); }
+.courseindex .courseindex-section .current-badge {
+ line-height: 1.5;
+ display: none; }
+
.courseindex .courseindex-section.current {
border-left: solid 3px #0f6fc5; }
+ .courseindex .courseindex-section.current .current-badge {
+ display: inline-block; }
.courseindex .courseindex-section.dropready .courseindex-item-content {
/* Extra dropzone space */
diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css
index 53f25ae27c9e3..a5cd42215bcd5 100644
--- a/theme/classic/style/moodle.css
+++ b/theme/classic/style/moodle.css
@@ -20377,8 +20377,14 @@ div.editor_atto_toolbar button .icon {
.courseindex .courseindex-sectioncontent .courseindex-item {
padding-left: calc(1rem * 2 + 0.5rem); }
+.courseindex .courseindex-section .current-badge {
+ line-height: 1.5;
+ display: none; }
+
.courseindex .courseindex-section.current {
border-left: solid 3px #0f6fc5; }
+ .courseindex .courseindex-section.current .current-badge {
+ display: inline-block; }
.courseindex .courseindex-section.dropready .courseindex-item-content {
/* Extra dropzone space */