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)
This commit is contained in:
Juan Leyva 2016-11-04 11:01:23 +00:00
parent 7eb34671c1
commit 82f5802a94
2 changed files with 5 additions and 0 deletions

View File

@ -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(

View File

@ -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.