MDL-51565 webservice: Fix return types definitions

This commit also format the activity name via external_format_string in
some cases
This commit is contained in:
Juan Leyva 2015-10-12 13:24:49 +02:00
parent 74fad2ce3d
commit 5b587c7570
3 changed files with 11 additions and 10 deletions

View File

@ -543,7 +543,7 @@ class mod_chat_external extends external_api {
$chatdetails['id'] = $chat->id;
$chatdetails['coursemodule'] = $chat->coursemodule;
$chatdetails['course'] = $chat->course;
$chatdetails['name'] = $chat->name;
$chatdetails['name'] = external_format_string($chat->name, $chatcontext->id);
// Format intro.
list($chatdetails['intro'], $chatdetails['introformat']) =
external_format_text($chat->intro, $chat->introformat, $chatcontext->id, 'mod_chat', 'intro', null);
@ -586,16 +586,16 @@ class mod_chat_external extends external_api {
array(
'id' => new external_value(PARAM_INT, 'Chat id'),
'coursemodule' => new external_value(PARAM_INT, 'Course module id'),
'course' => new external_value(PARAM_TEXT, 'Course id'),
'name' => new external_value(PARAM_TEXT, 'Chat name'),
'course' => new external_value(PARAM_INT, 'Course id'),
'name' => new external_value(PARAM_RAW, 'Chat name'),
'intro' => new external_value(PARAM_RAW, 'The Chat intro'),
'introformat' => new external_format_value('intro'),
'chatmethod' => new external_value(PARAM_ALPHA, 'chat method (sockets, daemon)', VALUE_OPTIONAL),
'keepdays' => new external_value(PARAM_INT, 'keep days', VALUE_OPTIONAL),
'studentlogs' => new external_value(PARAM_INT, 'student logs visible to everyone', VALUE_OPTIONAL),
'chattime' => new external_value(PARAM_RAW, 'chat time', VALUE_OPTIONAL),
'chattime' => new external_value(PARAM_INT, 'chat time', VALUE_OPTIONAL),
'schedule' => new external_value(PARAM_INT, 'schedule type', VALUE_OPTIONAL),
'timemodified' => new external_value(PARAM_RAW, 'time of last modification', VALUE_OPTIONAL),
'timemodified' => new external_value(PARAM_INT, 'time of last modification', VALUE_OPTIONAL),
'section' => new external_value(PARAM_INT, 'course section id', VALUE_OPTIONAL),
'visible' => new external_value(PARAM_BOOL, 'visible', VALUE_OPTIONAL),
'groupmode' => new external_value(PARAM_INT, 'group mode', VALUE_OPTIONAL),

View File

@ -124,7 +124,7 @@ class mod_data_external extends external_api {
$newdb['id'] = $database->id;
$newdb['coursemodule'] = $database->coursemodule;
$newdb['course'] = $database->course;
$newdb['name'] = $database->name;
$newdb['name'] = external_format_string($database->name, $datacontext->id);
// Format intro.
list($newdb['intro'], $newdb['introformat']) =
external_format_text($database->intro, $database->introformat,
@ -188,8 +188,8 @@ class mod_data_external extends external_api {
array(
'id' => new external_value(PARAM_INT, 'Database id'),
'coursemodule' => new external_value(PARAM_INT, 'Course module id'),
'course' => new external_value(PARAM_TEXT, 'Course id'),
'name' => new external_value(PARAM_TEXT, 'Database name'),
'course' => new external_value(PARAM_INT, 'Course id'),
'name' => new external_value(PARAM_RAW, 'Database name'),
'intro' => new external_value(PARAM_RAW, 'The Database intro'),
'introformat' => new external_format_value('intro'),
'comments' => new external_value(PARAM_BOOL, 'comments enabled', VALUE_OPTIONAL),

View File

@ -86,6 +86,7 @@ class mod_forum_external extends external_api {
continue;
}
$forum->name = external_format_string($forum->name, $context->id);
// Format the intro before being returning using the format setting.
list($forum->intro, $forum->introformat) = external_format_text($forum->intro, $forum->introformat,
$context->id, 'mod_forum', 'intro', 0);
@ -113,9 +114,9 @@ class mod_forum_external extends external_api {
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Forum id'),
'course' => new external_value(PARAM_TEXT, 'Course id'),
'course' => new external_value(PARAM_INT, 'Course id'),
'type' => new external_value(PARAM_TEXT, 'The forum type'),
'name' => new external_value(PARAM_TEXT, 'Forum name'),
'name' => new external_value(PARAM_RAW, 'Forum name'),
'intro' => new external_value(PARAM_RAW, 'The forum intro'),
'introformat' => new external_format_value('intro'),
'assessed' => new external_value(PARAM_INT, 'Aggregate type'),