See Release Notes
Long Term Support Release
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. 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 namespace mod_bigbluebuttonbn\local\bigbluebutton\recordings; 18 19 use mod_bigbluebuttonbn\instance; 20 use mod_bigbluebuttonbn\recording; 21 use mod_bigbluebuttonbn\local\config; 22 23 /** 24 * Collection of helper methods for handling recordings actions in Moodle. 25 * 26 * Utility class for meeting actions 27 * 28 * @package mod_bigbluebuttonbn 29 * @copyright 2021 onwards, Blindside Networks Inc 30 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 31 */ 32 class recording_action { 33 /** 34 * Import recording 35 * 36 * @param recording $recording 37 * @param instance $targetinstance 38 */ 39 public static function import(recording $recording, instance $targetinstance): void { 40 $recording->create_imported_recording($targetinstance); 41 } 42 43 /** 44 * Helper for performing delete on recordings. 45 * 46 * @param recording $recording 47 */ 48 public static function delete(recording $recording): void { 49 // As the recordingid was not identified as imported recording link, execute delete on a real recording. 50 // Step 1, delete imported links associated to the recording. 51 $recordingstodelete = recording::get_records(['recordingid' => $recording->get('recordingid'), 52 'imported' => true]); 53 foreach ($recordingstodelete as $rec) { 54 $rec->delete(); 55 } 56 $recording->delete(); 57 } 58 59 /** 60 * Helper for performing edit on recordings. 61 * 62 * @param recording $recording 63 */ 64 public static function edit(recording $recording): void { 65 $recording->update(); 66 } 67 68 /** 69 * Helper for performing unprotect on recordings. 70 * 71 * @param recording $recording 72 */ 73 public static function unprotect(recording $recording): void { 74 if (!(boolean) config::get('recording_protect_editable')) { 75 // Recording protect action through UI is disabled, there is no need to do anything else. 76 throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'unprotect'); 77 } 78 if ($recording->get('imported')) { 79 // Imported recordings can not be unprotected. There is no need to do anything else. 80 throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'unprotect'); 81 } 82 $recording->set('protected', false); 83 $recording->update(); 84 } 85 86 /** 87 * Helper for performing protect on recordings. 88 * 89 * @param recording $recording 90 */ 91 public static function protect(recording $recording): void { 92 if (!(boolean) config::get('recording_protect_editable')) { 93 // Recording protect action through UI is disabled, there is no need to do anything else. 94 throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'protect'); 95 } 96 if ($recording->get('imported')) { 97 // Imported recordings can not be unprotected. There is no need to do anything else. 98 throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'protect'); 99 } 100 $recording->set('protected', true); 101 $recording->update(); 102 } 103 104 /** 105 * Helper for performing unpublish on recordings. 106 * 107 * @param recording $recording 108 */ 109 public static function unpublish(recording $recording): void { 110 if ($recording->get('imported')) { 111 /* Since the recording link is the one fetched from the BBB server, imported recordings can not be 112 * unpublished. There is no need to do anything else. 113 */ 114 throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'unpublish'); 115 } 116 $recording->set('published', false); 117 $recording->update(); 118 } 119 120 /** 121 * Helper for performing publish on recordings. 122 * 123 * @param recording $recording 124 */ 125 public static function publish(recording $recording): void { 126 if ($recording->get('imported')) { 127 /* Since the recording link is the one fetched from the BBB server, imported recordings can not be 128 * unpublished. There is no need to do anything else. 129 */ 130 throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'publish'); 131 } 132 $recording->set('published', true); 133 $recording->update(); 134 } 135 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body