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 |
* Load zoom meeting.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_zoom
|
|
|
21 |
* @copyright 2015 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(__DIR__ . '/locallib.php');
|
|
|
27 |
|
|
|
28 |
require_login();
|
|
|
29 |
|
|
|
30 |
// Course_module ID.
|
|
|
31 |
$id = required_param('id', PARAM_INT);
|
|
|
32 |
if ($id) {
|
|
|
33 |
$context = context_module::instance($id);
|
|
|
34 |
$PAGE->set_context($context);
|
|
|
35 |
|
|
|
36 |
// Call load meeting function (note: this is where additional access checks happen).
|
|
|
37 |
$meetinginfo = zoom_load_meeting($id, $context);
|
|
|
38 |
|
|
|
39 |
// Redirect if available, otherwise deny access.
|
|
|
40 |
if ($meetinginfo['nexturl']) {
|
|
|
41 |
redirect($meetinginfo['nexturl']);
|
|
|
42 |
} else {
|
|
|
43 |
// Get redirect URL.
|
|
|
44 |
$unavailabilityurl = new moodle_url('/mod/zoom/view.php', ['id' => $id]);
|
|
|
45 |
|
|
|
46 |
// Redirect the user back to the activity overview page.
|
|
|
47 |
redirect($unavailabilityurl, $meetinginfo['error'], null, \core\output\notification::NOTIFY_ERROR);
|
|
|
48 |
}
|
|
|
49 |
} else {
|
|
|
50 |
throw new moodle_exception('zoomerr_id_missing', 'mod_zoom');
|
|
|
51 |
}
|