This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathedit_form.php
50 lines (43 loc) · 2.33 KB
/
edit_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/* Copyright Panopto 2009 - 2013 / With contributions from Spenser Jones ([email protected])
*
* This file is part of the Panopto plugin for Moodle.
*
* The Panopto plugin for Moodle is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Panopto plugin for Moodle is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Panopto plugin for Moodle. If not, see <http://www.gnu.org/licenses/>.
*/
require_once("lib/panopto_data.php");
class block_panopto_edit_form extends block_edit_form {
protected function specific_definition($mform) {
global $COURSE, $CFG;
// Construct the Panopto data proxy object
$panopto_data = new panopto_data($COURSE->id);
if(!empty($panopto_data->servername) && !empty($panopto_data->instancename) && !empty($panopto_data->applicationkey)) {
$mform->addElement('header', 'configheader', get_string('block_edit_header', 'block_panopto'));
$params = new stdClass;
$params->course_id = $COURSE->id;
$params->return_url = $_SERVER['REQUEST_URI'];
$query_string = http_build_query($params, '', '&');
$provision_url = "$CFG->wwwroot/blocks/panopto/provision_course.php?" . $query_string;
$add_to_panopto = get_string('add_to_panopto', 'block_panopto');
$or = get_string('or', 'block_panopto');
$mform->addElement('html', "<a href='$provision_url'>$add_to_panopto</a><br><br>-- $or --<br><br>");
$course_list = $panopto_data->get_course_options();
$mform->addElement('selectgroups', 'config_course', get_string('existing_course', 'block_panopto'), $course_list['courses']);
$mform->setDefault('config_course', $course_list['selected']);
} else {
$mform->addElement('static', 'error', '', get_string('block_edit_error', 'block_panopto'));
}
}
}
/* End of file edit_form.php */