See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Web service to fetch section data. 19 * 20 * @package block_accessreview 21 * @copyright 2020 onward Brickfield Education Labs Ltd, https://www.brickfield.ie 22 * @author 2020 Max Larkin <max@brickfieldlabs.ie> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 namespace block_accessreview\external; 26 27 use external_api; 28 use external_function_parameters; 29 use external_multiple_structure; 30 use external_single_structure; 31 use external_value; 32 use tool_brickfield\manager; 33 34 defined('MOODLE_INTERNAL') || die(); 35 require_once($CFG->libdir . '/externallib.php'); 36 37 /** 38 * Web service to fetch section data. 39 * 40 * @package block_accessreview 41 * @copyright 2020 onward Brickfield Education Labs Ltd, https://www.brickfield.ie 42 * @author 2020 Max Larkin <max@brickfieldlabs.ie> 43 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 44 */ 45 class get_section_data extends external_api { 46 /** 47 * Describes the parameters. 48 * 49 * @return external_function_parameters 50 */ 51 public static function execute_parameters() { 52 return new external_function_parameters([ 53 'courseid' => new external_value(PARAM_INT, 'The course id to obtain results for.', VALUE_REQUIRED), 54 ]); 55 } 56 57 /** 58 * Execute the service. 59 * 60 * @param int $courseid 61 * @return array 62 */ 63 public static function execute($courseid) { 64 [ 65 'courseid' => $courseid, 66 ] = self::validate_parameters(self::execute_parameters(), [ 67 'courseid' => $courseid, 68 ]); 69 70 $context = \context_course::instance($courseid); 71 self::validate_context($context); 72 73 require_capability('block/accessreview:view', $context); 74 75 return array_values(manager::get_section_summary_for_course($courseid)); 76 } 77 78 /** 79 * Describes the return structure of the service.. 80 * 81 * @return external_multiple_structure 82 */ 83 public static function execute_returns() { 84 return new external_multiple_structure( 85 new external_single_structure( 86 [ 87 'section' => new external_value(PARAM_INT, 'ID'), 88 'numerrors' => new external_value(PARAM_INT, 'Number of errors.'), 89 'numchecks' => new external_value(PARAM_INT, 'Number of checks.'), 90 ] 91 ) 92 ); 93 } 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body