From cb6d5c7e13c0eee799b0e9fcb42432eaad674117 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 9 May 2019 19:09:36 +0400 Subject: Added sort fields Signed-off-by: Valentin Popov --- classes/local/api.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'classes/local/api.php') diff --git a/classes/local/api.php b/classes/local/api.php index d25d383..c937aa5 100644 --- a/classes/local/api.php +++ b/classes/local/api.php @@ -126,17 +126,18 @@ final class api { /** * Get list records from the database. * - * @param array|null $conditions - * @param int|null $limitfrom - * @param int|null $limitnum + * @param array|null $conditions + * @param string|null $sort + * @param int|null $from + * @param int|null $limit * - * @return \local_webhooks\local\record[] + * @return array * @throws \dml_exception */ - public static function get_services(array $conditions = null, int $limitfrom = null, int $limitnum = null): array { + public static function get_services(array $conditions = null, string $sort = null, int $from = null, int $limit = null): array { global $DB; - $records = $DB->get_records(LW_TABLE_SERVICES, $conditions ?? [], '', '*', $limitfrom ?? 0, $limitnum ?? 0); + $records = $DB->get_records(LW_TABLE_SERVICES, $conditions ?? [], $sort ?? '', '*', $from ?? 0, $limit ?? 0); $services = []; foreach ($records as $record) { -- cgit v1.2.3