mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-65653 book: Display hidden chapters in WS when user has capability
This commit is contained in:
parent
8e9e9a5f7e
commit
794604db6d
2 changed files with 3 additions and 1 deletions
|
@ -489,6 +489,7 @@ class core_course_external extends external_api {
|
|||
VALUE_OPTIONAL),
|
||||
'repositorytype' => new external_value(PARAM_PLUGIN, 'The repository type for external files.',
|
||||
VALUE_OPTIONAL),
|
||||
'ishidden' => new external_value(PARAM_BOOL, 'Whether the content is hidden.', VALUE_OPTIONAL),
|
||||
|
||||
// copyright related info
|
||||
'userid' => new external_value(PARAM_INT, 'User who added this content to moodle'),
|
||||
|
|
|
@ -570,7 +570,7 @@ function book_export_contents($cm, $baseurl) {
|
|||
$currentchapter = 0;
|
||||
|
||||
foreach ($chapters as $chapter) {
|
||||
if ($chapter->hidden) {
|
||||
if ($chapter->hidden && !has_capability('mod/book:viewhiddenchapters', $context)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -612,6 +612,7 @@ function book_export_contents($cm, $baseurl) {
|
|||
$chapterindexfile['author'] = null;
|
||||
$chapterindexfile['license'] = null;
|
||||
$chapterindexfile['tags'] = \core_tag\external\util::get_item_tags('mod_book', 'book_chapters', $chapter->id);
|
||||
$chapterindexfile['ishidden'] = (bool) $chapter->hidden;
|
||||
$contents[] = $chapterindexfile;
|
||||
|
||||
// Chapter files (images usually).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue