1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of the Zoom plugin for 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 |
* Console page to output the results of the CLI to get the Zoom meeting reports.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_zoom
|
|
|
21 |
* @copyright 2020 UC Regents
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
require(__DIR__ . '/../../../config.php');
|
|
|
26 |
require_once($CFG->libdir . '/moodlelib.php');
|
|
|
27 |
|
|
|
28 |
// Force debugging errors.
|
|
|
29 |
error_reporting(E_ALL);
|
|
|
30 |
ini_set('display_errors', '1');
|
|
|
31 |
|
|
|
32 |
$courseid = required_param('courseid', PARAM_INT);
|
|
|
33 |
$startdate = optional_param('start', date('Y-m-d', strtotime('-3 days')), PARAM_ALPHANUMEXT);
|
|
|
34 |
$enddate = optional_param('end', date('Y-m-d'), PARAM_ALPHANUMEXT);
|
|
|
35 |
|
|
|
36 |
$course = $DB->get_record('course', ['id' => $courseid], '*', MUST_EXIST);
|
|
|
37 |
|
|
|
38 |
require_course_login($course);
|
|
|
39 |
|
|
|
40 |
$context = context_course::instance($course->id);
|
|
|
41 |
require_capability('mod/zoom:view', $context);
|
|
|
42 |
require_capability('mod/zoom:refreshsessions', $context);
|
|
|
43 |
|
|
|
44 |
// Set up the moodle page.
|
|
|
45 |
$PAGE->set_url('/mod/zoom/console/');
|
|
|
46 |
|
|
|
47 |
echo html_writer::tag('h1', get_string('getmeetingreports', 'mod_zoom'));
|
|
|
48 |
$output = null;
|
|
|
49 |
exec("php $CFG->dirroot/mod/zoom/cli/get_meeting_report.php --start=$startdate --end=$enddate --courseid=$courseid", $output);
|
|
|
50 |
echo '<pre>';
|
|
|
51 |
echo implode("\n", $output);
|
|
|
52 |
echo '</pre>';
|