mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
MDL-68935 course: Return context data in get_content WS
This commit is contained in:
parent
d4d798e684
commit
35101a6a2c
@ -261,6 +261,7 @@ class core_course_external extends external_api {
|
||||
$module['id'] = $cm->id;
|
||||
$module['name'] = external_format_string($cm->name, $modcontext->id);
|
||||
$module['instance'] = $cm->instance;
|
||||
$module['contextid'] = $modcontext->id;
|
||||
$module['modname'] = (string) $cm->modname;
|
||||
$module['modplural'] = (string) $cm->modplural;
|
||||
$module['modicon'] = $cm->get_icon_url()->out(false);
|
||||
@ -442,6 +443,7 @@ class core_course_external extends external_api {
|
||||
'url' => new external_value(PARAM_URL, 'activity url', VALUE_OPTIONAL),
|
||||
'name' => new external_value(PARAM_RAW, 'activity module name'),
|
||||
'instance' => new external_value(PARAM_INT, 'instance id', VALUE_OPTIONAL),
|
||||
'contextid' => new external_value(PARAM_INT, 'Activity context id.', VALUE_OPTIONAL),
|
||||
'description' => new external_value(PARAM_RAW, 'activity description', VALUE_OPTIONAL),
|
||||
'visible' => new external_value(PARAM_INT, 'is the module visible', VALUE_OPTIONAL),
|
||||
'uservisible' => new external_value(PARAM_BOOL, 'Is the module visible for the user?',
|
||||
|
@ -1015,6 +1015,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
array('noclean' => true, 'para' => false, 'filter' => false));
|
||||
$this->assertEquals($formattedtext, $module['description']);
|
||||
$this->assertEquals($forumcm->instance, $module['instance']);
|
||||
$this->assertEquals(context_module::instance($forumcm->id)->id, $module['contextid']);
|
||||
$this->assertContains('1 unread post', $module['afterlink']);
|
||||
$this->assertFalse($module['noviewlink']);
|
||||
$this->assertNotEmpty($module['description']); // Module showdescription is on.
|
||||
@ -1025,6 +1026,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
array('noclean' => true, 'para' => false, 'filter' => false));
|
||||
$this->assertEquals($formattedtext, $module['description']);
|
||||
$this->assertEquals($labelcm->instance, $module['instance']);
|
||||
$this->assertEquals(context_module::instance($labelcm->id)->id, $module['contextid']);
|
||||
$this->assertTrue($module['noviewlink']);
|
||||
$this->assertNotEmpty($module['description']); // Label always prints the description.
|
||||
$testexecuted = $testexecuted + 1;
|
||||
|
@ -4,6 +4,7 @@ information provided here is intended especially for developers.
|
||||
=== 3.10 ===
|
||||
|
||||
* The function make_categories_options() has now been deprecated. Please use \core_course_category::make_categories_list() instead.
|
||||
* External function core_course_external::get_course_contents now returns a new field contextid with the module context id.
|
||||
|
||||
=== 3.9 ===
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user