|
28 | 28 | require_once($CFG->libdir . '/gradelib.php'); |
29 | 29 | require_once(__DIR__ . '/uploadvideo_form.php'); |
30 | 30 |
|
31 | | -use block_opencast\local\apibridge; |
| 31 | +use tool_opencast\local\apibridge; |
32 | 32 | use tool_opencast\local\settings_api; |
33 | | -use block_opencast\local\upload_helper; |
| 33 | +use tool_opencast\local\upload_helper; |
34 | 34 |
|
35 | 35 | global $PAGE, $OUTPUT, $USER, $DB; |
36 | 36 |
|
|
48 | 48 |
|
49 | 49 | $context = context_module::instance($cm->id); |
50 | 50 | $coursecontext = context_course::instance($course->id); |
51 | | -// As we are doing the upload using the block_opencast, we have to use its capability as well. |
52 | | -require_capability('block/opencast:addvideo', $coursecontext); |
| 51 | +// As we are doing the upload using the tool_opencast, we have to use its capability as well. |
| 52 | +require_capability('tool/opencast:addvideo', $coursecontext); |
53 | 53 |
|
54 | 54 | $PAGE->set_pagelayout('frametop'); |
55 | 55 | $PAGE->set_context($context); |
|
62 | 62 | // Getting all the oc instances. |
63 | 63 | $ocinstances = settings_api::get_ocinstances(); |
64 | 64 | // Getting user defaults. |
65 | | -$userdefaultsrecord = $DB->get_record('block_opencast_user_default', ['userid' => $USER->id]); |
| 65 | +$userdefaultsrecord = $DB->get_record('tool_opencast_user_default', ['userid' => $USER->id]); |
66 | 66 | $userdefaults = $userdefaultsrecord ? json_decode($userdefaultsrecord->defaults, true) : []; |
67 | 67 | $usereventdefaults = (!empty($userdefaults['event'])) ? $userdefaults['event'] : []; |
68 | 68 | // Getting medatadata catalogs based on the ocinstances. |
|
128 | 128 | // Saving and getting the file. |
129 | 129 | $newitemid = rand(1000000, 9999999); |
130 | 130 | file_save_draft_area_files($moduleinstance->uploaddraftitemid, $coursecontext->id, |
131 | | - 'block_opencast', upload_helper::OC_FILEAREA, $newitemid); |
| 131 | + 'tool_opencast', upload_helper::OC_FILEAREA, $newitemid); |
132 | 132 | $fs = get_file_storage(); |
133 | | - $files = $fs->get_area_files($coursecontext->id, 'block_opencast', upload_helper::OC_FILEAREA, $newitemid, '', false); |
| 133 | + $files = $fs->get_area_files($coursecontext->id, 'tool_opencast', upload_helper::OC_FILEAREA, $newitemid, '', false); |
134 | 134 | $savedvideofile = null; |
135 | 135 | if ($files) { |
136 | 136 | $savedvideofile = reset($files); |
|
142 | 142 | redirect($redirecturl, get_string('uploadmissingfile', 'mod_opencast'), null, \core\output\notification::NOTIFY_ERROR); |
143 | 143 | } else { |
144 | 144 | $coursecontext = context_course::instance($course->id); |
145 | | - \block_opencast\local\file_deletionmanager::track_draftitemid($coursecontext->id, $savedvideofile->get_itemid()); |
| 145 | + \tool_opencast\local\file_deletionmanager::track_draftitemid($coursecontext->id, $savedvideofile->get_itemid()); |
146 | 146 | } |
147 | 147 |
|
148 | 148 | $flavorfieldname = 'flavor_' . $ocinstanceid; |
|
234 | 234 | \core\notification::warning($e->getMessage()); |
235 | 235 | } |
236 | 236 | } |
237 | | - $blockopencastlink = new moodle_url('/blocks/opencast/index.php', |
| 237 | + $indexopencastlink = new moodle_url('/admin/tool/opencast/index.php', |
238 | 238 | ['courseid' => $course->id, 'ocinstanceid' => $ocinstanceid]); |
239 | 239 | redirect($redirecturl, |
240 | | - get_string('uploadsaved', 'mod_opencast', $blockopencastlink->out()), null, \core\output\notification::NOTIFY_SUCCESS); |
| 240 | + get_string('uploadsaved', 'mod_opencast', $indexopencastlink->out()), null, \core\output\notification::NOTIFY_SUCCESS); |
241 | 241 | } |
242 | 242 |
|
243 | 243 | $PAGE->set_title(get_string('uploadformtitle', 'mod_opencast')); |
|
0 commit comments