MDL-54734 user: Add tests to demonstrate multi-user issues
[moodle.git] / admin / webservice / documentation.php
blob9c727eaf9ac19b11d75d2e044ac8af19701223ae
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Web services API documentation
21 * @package webservice
22 * @copyright 2011 Moodle Pty Ltd (http://moodle.com)
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 * @author Jerome Mouneyrac
26 require_once('../../config.php');
27 require_once($CFG->libdir . '/adminlib.php');
28 require($CFG->dirroot . '/webservice/lib.php');
30 admin_externalpage_setup('webservicedocumentation');
32 // get all the function descriptions
33 $functions = $DB->get_records('external_functions', array(), 'name');
34 $functiondescs = array();
35 foreach ($functions as $function) {
36 $functiondescs[$function->name] = external_api::external_function_info($function);
39 //display the documentation for all documented protocols,
40 //regardless if they are activated or not
41 $protocols = array();
42 $protocols['rest'] = true;
43 $protocols['xmlrpc'] = true;
45 /// Check if we are in printable mode
46 $printableformat = optional_param('print', false, PARAM_BOOL);
48 /// OUTPUT
49 echo $OUTPUT->header();
51 $renderer = $PAGE->get_renderer('core', 'webservice');
52 echo $renderer->documentation_html($functiondescs,
53 $printableformat, $protocols, array(), $PAGE->url);
55 /// trigger browser print operation
56 if (!empty($printableformat)) {
57 $PAGE->requires->js_function_call('window.print', array());
60 echo $OUTPUT->footer();