mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-37143 External_warnings: developer should be able to modify the item/itemid/errorcode description
This commit is contained in:
parent
4bd6f71bad
commit
8118dbd02f
@ -598,15 +598,15 @@ class external_warnings extends external_multiple_structure {
|
||||
*
|
||||
* @since Moodle 2.3
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct($itemdesc = 'item', $itemiddesc = 'item id',
|
||||
$warningcodedesc = 'the warning code can be used by the client app to implement specific behaviour') {
|
||||
|
||||
parent::__construct(
|
||||
new external_single_structure(
|
||||
array(
|
||||
'item' => new external_value(PARAM_TEXT, 'item', VALUE_OPTIONAL),
|
||||
'itemid' => new external_value(PARAM_INT, 'item id', VALUE_OPTIONAL),
|
||||
'warningcode' => new external_value(PARAM_ALPHANUM,
|
||||
'the warning code can be used by the client app to implement specific behaviour'),
|
||||
'item' => new external_value(PARAM_TEXT, $itemdesc, VALUE_OPTIONAL),
|
||||
'itemid' => new external_value(PARAM_INT, $itemiddesc, VALUE_OPTIONAL),
|
||||
'warningcode' => new external_value(PARAM_ALPHANUM, $warningcodedesc),
|
||||
'message' => new external_value(PARAM_TEXT,
|
||||
'untranslated english message to explain the warning')
|
||||
), 'warning'),
|
||||
|
@ -184,7 +184,9 @@ class mod_assign_external extends external_api {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'assignments' => new external_multiple_structure(self::assign_grades(), 'list of assignment grade information'),
|
||||
'warnings' => new external_warnings()
|
||||
'warnings' => new external_warnings('item is always \'assignment\'',
|
||||
'when errorcode is 3 then itemid is an assignment id. When errorcode is 1, itemid is a course module instance id',
|
||||
'errorcode can be 3 (no grades found) or 1 (no permission to get grades)')
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -425,7 +427,9 @@ class mod_assign_external extends external_api {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'courses' => new external_multiple_structure(self::get_assignments_course_structure(), 'list of courses'),
|
||||
'warnings' => new external_warnings()
|
||||
'warnings' => new external_warnings('item can be \'course\' (errorcode 1 or 2) or \'module\' (errorcode 1)',
|
||||
'When item is a course then itemid is a course id. When the item is a module then itemid is a module id',
|
||||
'errorcode can be 1 (no access rights) or 2 (not enrolled or no permissions)')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user