Merge branch 'MDL-81713-main' of https://github.com/junpataleta/moodle
[moodle.git] / mod / bigbluebuttonbn / import_view.php
blobcde4a0393fd60112fbad92f6e38db3ebf32bf77e
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.
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/>.
17 /**
18 * View for importing BigBlueButtonBN recordings.
20 * @package mod_bigbluebuttonbn
21 * @copyright 2010 onwards, Blindside Networks Inc
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 * @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
26 use core\notification;
27 use mod_bigbluebuttonbn\instance;
28 use mod_bigbluebuttonbn\output\import_view;
29 use mod_bigbluebuttonbn\plugin;
31 require(__DIR__ . '/../../config.php');
33 $destbn = required_param('destbn', PARAM_INT);
34 $sourcebn = optional_param('sourcebn', -1, PARAM_INT);
35 $sourcecourseid = optional_param('sourcecourseid', -1, PARAM_INT);
37 $destinationinstance = instance::get_from_instanceid($destbn);
38 if (!$destinationinstance) {
39 throw new moodle_exception('view_error_url_missing_parameters', plugin::COMPONENT);
42 $cm = $destinationinstance->get_cm();
43 $course = $destinationinstance->get_course();
45 require_login($course, true, $cm);
47 if (!(boolean) \mod_bigbluebuttonbn\local\config::importrecordings_enabled()) {
48 notification::add(
49 get_string('view_message_importrecordings_disabled', plugin::COMPONENT),
50 notification::ERROR
52 redirect($destinationinstance->get_view_url());
55 // Print the page header.
56 $PAGE->set_url($destinationinstance->get_import_url());
57 $PAGE->set_title($destinationinstance->get_meeting_name());
58 $PAGE->set_cacheable(false);
59 $PAGE->set_heading($course->fullname);
61 /** @var \mod_bigbluebuttonbn\renderer $renderer */
62 $renderer = $PAGE->get_renderer(plugin::COMPONENT);
64 echo $OUTPUT->header();
65 echo $renderer->render(new import_view($destinationinstance, $sourcecourseid, $sourcebn));
66 echo $OUTPUT->footer();