From 03d38b9207fa02592ccee9128eed828769f5ad56 Mon Sep 17 00:00:00 2001 From: Yang Date: Tue, 15 May 2012 13:40:58 +0800 Subject: [PATCH 1/2] MDL-32998 add warnings structure --- lib/externallib.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/externallib.php b/lib/externallib.php index 3eb1f1fce7d..ab7ebbbce8e 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -581,4 +581,33 @@ function external_delete_descriptions($component) { "functionname IN (SELECT name FROM {external_functions} WHERE component = ?)", $params); $DB->delete_records('external_services', array('component'=>$component)); $DB->delete_records('external_functions', array('component'=>$component)); +} + +/** + * Description of warning messages with external_multiple_structure. + * + * @package core_webservice + * @copyright 2012 Yang Yang + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since Moodle 2.3 + */ +class external_warnings { + + /** + * Creates a warnings external_multiple_structure + * + * @return external_multiple_structure + * @since Moodle 2.3 + */ + public function warnings() { + return new external_multiple_structure( + new external_single_structure( array( + 'element' => new external_value(PARAM_TEXT, 'element'), + 'elementid' => new external_value(PARAM_INT, 'element id'), + 'warningcode' => new external_value(PARAM_ALPHANUM, 'the warning code can be used by + the client app to implement specific behaviour (e.g. "missingcourse")'), + 'message' => new external_value(PARAM_TEXT, 'untranslated english message to explain the warning') + ), 'warning'), 'list of warnings' + ); + } } \ No newline at end of file From 50f9449faa6d410a304ffb6ae24368c51f975306 Mon Sep 17 00:00:00 2001 From: Jerome Mouneyrac Date: Tue, 15 May 2012 18:40:06 +0800 Subject: [PATCH 2/2] MDL-32998 add warnings structure --- lib/externallib.php | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/lib/externallib.php b/lib/externallib.php index ab7ebbbce8e..9ef3b12a9ac 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -584,30 +584,19 @@ function external_delete_descriptions($component) { } /** - * Description of warning messages with external_multiple_structure. + * Creates a warnings external_multiple_structure * - * @package core_webservice - * @copyright 2012 Yang Yang - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @return external_multiple_structure * @since Moodle 2.3 */ -class external_warnings { - - /** - * Creates a warnings external_multiple_structure - * - * @return external_multiple_structure - * @since Moodle 2.3 - */ - public function warnings() { - return new external_multiple_structure( - new external_single_structure( array( - 'element' => new external_value(PARAM_TEXT, 'element'), - 'elementid' => new external_value(PARAM_INT, 'element id'), - 'warningcode' => new external_value(PARAM_ALPHANUM, 'the warning code can be used by - the client app to implement specific behaviour (e.g. "missingcourse")'), - 'message' => new external_value(PARAM_TEXT, 'untranslated english message to explain the warning') - ), 'warning'), 'list of warnings' - ); - } -} \ No newline at end of file +function external_warnings() { + return new external_multiple_structure( + 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'), + 'message' => new external_value(PARAM_TEXT, 'untranslated english message to explain the warning') + ), 'warning'), 'list of warnings', VALUE_OPTIONAL + ); +}