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 |
* Adding, updating, and deleting zoom meeting recordings.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_zoom
|
|
|
21 |
* @copyright 2020 UC Regents
|
|
|
22 |
* @author 2021 Jwalit Shah <jwalitshah@catalyst-au.net>
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
require(__DIR__ . '/../../config.php');
|
|
|
27 |
require_once(__DIR__ . '/lib.php');
|
|
|
28 |
require_once(__DIR__ . '/locallib.php');
|
|
|
29 |
|
|
|
30 |
[$course, $cm, $zoom] = zoom_get_instance_setup();
|
|
|
31 |
|
|
|
32 |
require_login($course, true, $cm);
|
|
|
33 |
|
|
|
34 |
if (!get_config('zoom', 'viewrecordings')) {
|
|
|
35 |
throw new moodle_exception('recordingnotvisible', 'mod_zoom', get_string('recordingnotvisible', 'zoom'));
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
$context = context_module::instance($cm->id);
|
|
|
39 |
// Set up the page.
|
|
|
40 |
$params = ['id' => $cm->id];
|
|
|
41 |
$url = new moodle_url('/mod/zoom/recordings.php', $params);
|
|
|
42 |
$PAGE->set_url($url);
|
|
|
43 |
|
|
|
44 |
$strname = $zoom->name;
|
|
|
45 |
$PAGE->set_title("$course->shortname: $strname");
|
|
|
46 |
$PAGE->set_heading($course->fullname);
|
|
|
47 |
$PAGE->set_pagelayout('incourse');
|
|
|
48 |
|
|
|
49 |
echo $OUTPUT->header();
|
|
|
50 |
echo $OUTPUT->heading($strname);
|
|
|
51 |
|
|
|
52 |
$iszoommanager = has_capability('mod/zoom:addinstance', $context);
|
|
|
53 |
|
|
|
54 |
// Set up html table.
|
|
|
55 |
$table = new html_table();
|
|
|
56 |
$table->attributes['class'] = 'generaltable mod_view';
|
|
|
57 |
if ($iszoommanager) {
|
|
|
58 |
$table->align = ['left', 'left', 'left', 'left'];
|
|
|
59 |
$table->head = [
|
|
|
60 |
get_string('recordingdate', 'mod_zoom'),
|
|
|
61 |
get_string('recordinglink', 'mod_zoom'),
|
|
|
62 |
get_string('recordingpasscode', 'mod_zoom'),
|
|
|
63 |
get_string('recordingshowtoggle', 'mod_zoom'),
|
|
|
64 |
];
|
|
|
65 |
} else {
|
|
|
66 |
$table->align = ['left', 'left', 'left'];
|
|
|
67 |
$table->head = [
|
|
|
68 |
get_string('recordingdate', 'mod_zoom'),
|
|
|
69 |
get_string('recordinglink', 'mod_zoom'),
|
|
|
70 |
get_string('recordingpasscode', 'mod_zoom'),
|
|
|
71 |
];
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
// Find all entries for this meeting in the database.
|
|
|
75 |
$recordings = zoom_get_meeting_recordings_grouped($zoom->id);
|
|
|
76 |
if (empty($recordings)) {
|
|
|
77 |
$cell = new html_table_cell();
|
|
|
78 |
$cell->colspan = count($table->head);
|
|
|
79 |
$cell->text = get_string('norecordings', 'mod_zoom');
|
|
|
80 |
$cell->style = 'text-align: center';
|
|
|
81 |
$row = new html_table_row([$cell]);
|
|
|
82 |
$table->data = [$row];
|
|
|
83 |
} else {
|
|
|
84 |
foreach ($recordings as $grouping) {
|
|
|
85 |
// Output the related recordings into the same row.
|
|
|
86 |
$recordingdate = '';
|
|
|
87 |
$recordinghtml = '';
|
|
|
88 |
$recordingpasscode = '';
|
|
|
89 |
$recordingshowhtml = '';
|
|
|
90 |
foreach ($grouping as $recording) {
|
|
|
91 |
// If zoom admin -> show all recordings.
|
|
|
92 |
// Or if visible to students.
|
|
|
93 |
if ($iszoommanager || intval($recording->showrecording) === 1) {
|
|
|
94 |
if (empty($recordingdate)) {
|
|
|
95 |
$recordingdate = date('F j, Y, g:i:s a \P\T', $recording->recordingstart);
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
if (empty($recordingpasscode)) {
|
|
|
99 |
$recordingpasscode = $recording->passcode;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
if ($iszoommanager && empty($recordingshowhtml)) {
|
|
|
103 |
$isrecordinghidden = intval($recording->showrecording) === 0;
|
|
|
104 |
$urlparams = [
|
|
|
105 |
'id' => $cm->id,
|
|
|
106 |
'meetinguuid' => $recording->meetinguuid,
|
|
|
107 |
'recordingstart' => $recording->recordingstart,
|
|
|
108 |
'showrecording' => ($isrecordinghidden) ? 1 : 0,
|
|
|
109 |
'sesskey' => sesskey(),
|
|
|
110 |
];
|
|
|
111 |
// If the user is a zoom admin, show the button to toggle whether students can see the recording or not.
|
|
|
112 |
$recordingshowurl = new moodle_url('/mod/zoom/showrecording.php', $urlparams);
|
|
|
113 |
$recordingshowtext = get_string('recordinghide', 'mod_zoom');
|
|
|
114 |
if ($isrecordinghidden) {
|
|
|
115 |
$recordingshowtext = get_string('recordingshow', 'mod_zoom');
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
$btnclass = 'btn btn-';
|
|
|
119 |
$btnclass .= $isrecordinghidden ? 'dark' : 'primary';
|
|
|
120 |
$recordingshowbutton = html_writer::div($recordingshowtext, $btnclass);
|
|
|
121 |
$recordingshowbuttonhtml = html_writer::link($recordingshowurl, $recordingshowbutton);
|
|
|
122 |
$recordingshowhtml = html_writer::div($recordingshowbuttonhtml);
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
$recordingname = trim($recording->name) . ' (' . zoom_get_recording_type_string($recording->recordingtype) . ')';
|
|
|
126 |
$params = ['id' => $cm->id, 'recordingid' => $recording->id];
|
|
|
127 |
$recordingurl = new moodle_url('/mod/zoom/loadrecording.php', $params);
|
|
|
128 |
$recordinglink = html_writer::link($recordingurl, $recordingname);
|
|
|
129 |
$recordinglinkhtml = html_writer::span($recordinglink, 'recording-link', ['style' => 'margin-right:1rem']);
|
|
|
130 |
$recordinghtml .= html_writer::div($recordinglinkhtml, 'recording', ['style' => 'margin-bottom:.5rem']);
|
|
|
131 |
}
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
// Output only one row per grouping.
|
|
|
135 |
$table->data[] = [$recordingdate, $recordinghtml, $recordingpasscode, $recordingshowhtml];
|
|
|
136 |
}
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
/**
|
|
|
140 |
* Get the display name for a Zoom recording type.
|
|
|
141 |
*
|
|
|
142 |
* @package mod_zoom
|
|
|
143 |
* @param string $recordingtype Zoom recording type.
|
|
|
144 |
* @return string
|
|
|
145 |
*/
|
|
|
146 |
function zoom_get_recording_type_string($recordingtype) {
|
|
|
147 |
$recordingtypestringmap = [
|
|
|
148 |
'active_speaker' => 'recordingtype_active_speaker',
|
|
|
149 |
'audio_interpretation' => 'recordingtype_audio_interpretation',
|
|
|
150 |
'audio_only' => 'recordingtype_audio_only',
|
|
|
151 |
'audio_transcript' => 'recordingtype_audio_transcript',
|
|
|
152 |
'chat_file' => 'recordingtype_chat',
|
|
|
153 |
'closed_caption' => 'recordingtype_closed_caption',
|
|
|
154 |
'gallery_view' => 'recordingtype_gallery',
|
|
|
155 |
'poll' => 'recordingtype_poll',
|
|
|
156 |
'production_studio' => 'recordingtype_production_studio',
|
|
|
157 |
'shared_screen' => 'recordingtype_shared',
|
|
|
158 |
'shared_screen_with_gallery_view' => 'recordingtype_shared_gallery',
|
|
|
159 |
'shared_screen_with_speaker_view' => 'recordingtype_shared_speaker',
|
|
|
160 |
'shared_screen_with_speaker_view(CC)' => 'recordingtype_shared_speaker_cc',
|
|
|
161 |
'sign_interpretation' => 'recordingtype_sign',
|
|
|
162 |
'speaker_view' => 'recordingtype_speaker',
|
|
|
163 |
'summary' => 'recordingtype_summary',
|
|
|
164 |
'summary_next_steps' => 'recordingtype_summary_next_steps',
|
|
|
165 |
'summary_smart_chapters' => 'recordingtype_summary_smart_chapters',
|
|
|
166 |
'timeline' => 'recordingtype_timeline',
|
|
|
167 |
];
|
|
|
168 |
|
|
|
169 |
// Return some default string in case new recordingtype values are added in the future.
|
|
|
170 |
if (empty($recordingtypestringmap[$recordingtype])) {
|
|
|
171 |
return $recordingtype;
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
return get_string($recordingtypestringmap[$recordingtype], 'mod_zoom');
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
echo html_writer::table($table);
|
|
|
178 |
|
|
|
179 |
echo $OUTPUT->footer();
|