From 82f5802a94a26a839d57ad5066225929a52da97f Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Fri, 4 Nov 2016 11:01:23 +0000 Subject: [PATCH] MDL-56754 course: Stealth sections should be handled Right now this WS is returning all the sections without advising if is a stealth section or not, this have some implications (in the mobile app right now the stealth sections are displayed) --- course/externallib.php | 4 ++++ course/upgrade.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/course/externallib.php b/course/externallib.php index 999f71adaea..32214693cbe 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -160,6 +160,7 @@ class core_course_external extends external_api { //retrieve sections $modinfo = get_fast_modinfo($course); $sections = $modinfo->get_section_info_all(); + $coursenumsections = course_get_format($course)->get_course()->numsections; //for each sections (first displayed to last displayed) $modinfosections = $modinfo->get_sections(); @@ -201,6 +202,7 @@ class core_course_external extends external_api { external_format_text($section->summary, $section->summaryformat, $context->id, 'course', 'section', $section->id, $options); $sectionvalues['section'] = $section->section; + $sectionvalues['hiddenbynumsections'] = $section->section > $coursenumsections ? 1 : 0; $sectioncontents = array(); //for each module of the section @@ -329,6 +331,8 @@ class core_course_external extends external_api { 'summary' => new external_value(PARAM_RAW, 'Section description'), 'summaryformat' => new external_format_value('summary'), 'section' => new external_value(PARAM_INT, 'Section number inside the course', VALUE_OPTIONAL), + 'hiddenbynumsections' => new external_value(PARAM_INT, 'Whether is a section hidden in the course format', + VALUE_OPTIONAL), 'modules' => new external_multiple_structure( new external_single_structure( array( diff --git a/course/upgrade.txt b/course/upgrade.txt index b9309b15b7a..047e0be2083 100644 --- a/course/upgrade.txt +++ b/course/upgrade.txt @@ -4,6 +4,7 @@ information provided here is intended especially for developers. === 3.2 === * External function core_course_external::get_course_contents now returns the section's number in the course (new section field). + * External function core_course_external::get_course_contents now returns if a section is hidden in the course format. * External functions that were returning file information now return the following file fields: filename, filepath, mimetype, filesize, timemodified and fileurl. Those fields are now marked as VALUE_OPTIONAL for backwards compatibility. -- 2.43.0