|
16 | 16 |
|
17 | 17 | namespace report_customsql\external; |
18 | 18 |
|
19 | | -defined('MOODLE_INTERNAL') || die(); |
20 | | - |
21 | | -global $CFG; |
22 | | -require_once($CFG->libdir . '/externallib.php'); |
| 19 | +use core_external\external_api; |
| 20 | +use core_external\external_description; |
| 21 | +use core_external\external_function_parameters; |
| 22 | +use core_external\external_multiple_structure; |
| 23 | +use core_external\external_single_structure; |
| 24 | +use core_external\external_value; |
23 | 25 |
|
24 | 26 | /** |
25 | 27 | * Web service used by form autocomplete to get a list of users with a given capability. |
|
28 | 30 | * @copyright 2020 The Open University |
29 | 31 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
30 | 32 | */ |
31 | | -class get_users extends \external_api { |
| 33 | +class get_users extends external_api { |
32 | 34 | /** |
33 | 35 | * Parameter declaration. |
34 | 36 | * |
35 | | - * @return \external_function_parameters Parameters |
| 37 | + * @return external_function_parameters Parameters |
36 | 38 | */ |
37 | | - public static function execute_parameters(): \external_function_parameters { |
38 | | - return new \external_function_parameters([ |
39 | | - 'query' => new \external_value(PARAM_RAW, 'Contents of the search box.'), |
40 | | - 'capability' => new \external_value(PARAM_CAPABILITY, 'Return only users with this capability in the system context.'), |
| 39 | + public static function execute_parameters(): external_function_parameters { |
| 40 | + return new external_function_parameters([ |
| 41 | + 'query' => new external_value(PARAM_RAW, 'Contents of the search box.'), |
| 42 | + 'capability' => new external_value(PARAM_CAPABILITY, 'Return only users with this capability in the system context.'), |
41 | 43 | ]); |
42 | 44 | } |
43 | 45 |
|
@@ -136,16 +138,16 @@ public static function prepare_result_object(\stdClass $user, array $extrafields |
136 | 138 | /** |
137 | 139 | * Returns type for declaration. |
138 | 140 | * |
139 | | - * @return \external_description Result type |
| 141 | + * @return external_description Result type |
140 | 142 | */ |
141 | | - public static function execute_returns(): \external_description { |
142 | | - return new \external_multiple_structure( |
143 | | - new \external_single_structure([ |
144 | | - 'id' => new \external_value(PARAM_INT, 'User id.'), |
145 | | - 'fullname' => new \external_value(PARAM_RAW, 'User full name.'), |
146 | | - 'identity' => new \external_value(PARAM_RAW, 'Additional user identifying info.'), |
147 | | - 'hasidentity' => new \external_value(PARAM_BOOL, 'Whether identity is non-blank.'), |
148 | | - 'profileimageurlsmall' => new \external_value(PARAM_RAW, 'URL of the user profile image.'), |
| 143 | + public static function execute_returns(): external_description { |
| 144 | + return new external_multiple_structure( |
| 145 | + new external_single_structure([ |
| 146 | + 'id' => new external_value(PARAM_INT, 'User id.'), |
| 147 | + 'fullname' => new external_value(PARAM_RAW, 'User full name.'), |
| 148 | + 'identity' => new external_value(PARAM_RAW, 'Additional user identifying info.'), |
| 149 | + 'hasidentity' => new external_value(PARAM_BOOL, 'Whether identity is non-blank.'), |
| 150 | + 'profileimageurlsmall' => new external_value(PARAM_RAW, 'URL of the user profile image.'), |
149 | 151 | ])); |
150 | 152 | } |
151 | 153 | } |
0 commit comments