The web service 'local_webhooks_get_list_records' has been expanded

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
Valentin Popov 2018-03-12 14:48:20 +04:00
parent 422cbfd57d
commit f220e057bd
Signed by: Valentin Popov
GPG Key ID: 269A00ACA90A8EA3

View File

@ -248,23 +248,32 @@ class local_webhooks_external extends external_api {
* @since Moodle 2.2 * @since Moodle 2.2
*/ */
public static function get_list_records_parameters() { public static function get_list_records_parameters() {
return new external_function_parameters(array()); return new external_function_parameters(
array(
"limitfrom" => new external_value(PARAM_INT, "Where to start results from."),
"limitnum" => new external_value(PARAM_INT, "How many results to return.")
)
);
} }
/** /**
* Get all records from the database. * Get all records from the database.
* *
* @param number $limitfrom
* @param number $limitnum
* @return array * @return array
* @since Moodle 2.9 Options available * @since Moodle 2.9 Options available
* @since Moodle 2.2 * @since Moodle 2.2
*/ */
public static function get_list_records() { public static function get_list_records($limitfrom, $limitnum) {
$parameters = self::validate_parameters(self::get_list_records_parameters(), array("limitfrom" => $limitfrom, "limitnum" => $limitnum));
$context = context_system::instance(); $context = context_system::instance();
self::validate_context($context); self::validate_context($context);
$result = array(); $result = array();
if ($listrecords = local_webhooks_get_list_records()) { if ($listrecords = local_webhooks_get_list_records($parameters["limitfrom"], $parameters["limitnum"])) {
$result = self::formation_list($listrecords); $result = self::formation_list($listrecords);
} }