if (isset($bigbluebuttonbn)) { bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED, $bigbluebuttonbn, $context, $cm); } $callback_response['status'] = "true"; $callback_response_data = json_encode($callback_response); echo "{$params['callback']}({$callback_response_data});"; } else { error_log("ERROR: User not authorized to execute unpublish command"); header("HTTP/1.0 401 Unauthorized. User not authorized to execute unpublish command"); } break; case 'recording_delete': if ($bbbsession['managerecordings']) { //Retrieve the array of imported recordings $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL); $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported); if (isset($recordings_indexed[$params['id']])) { // Execute unpublish on imported recording link bigbluebuttonbn_bbb_broker_do_delete_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id); } else { // As the recordingid was not identified as imported recording link, execute delete on a real recording // First: Delete imported links associated to the recording $recordings_imported_all = bigbluebuttonbn_getRecordingsImportedAllInstances($params['id']); if (count($recordings_imported_all) > 0) { foreach ($recordings_imported_all as $key => $record) { // Execute delete $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key)); } } // Second: Execute the real delete $meeting_info = bigbluebuttonbn_bbb_broker_do_delete_recording($params['id']);
function bigbluebuttonbn_import_exlcude_recordings_already_imported($courseID, $bigbluebuttonbnID, $recordings) { $recordings_already_imported = bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID); $recordings_already_imported_indexed = bigbluebuttonbn_index_recordings($recordings_already_imported); foreach ($recordings as $key => $recording) { if (isset($recordings_already_imported_indexed[$recording['recordID']])) { unset($recordings[$key]); } } return $recordings; }
$PAGE->set_cacheable(false); $PAGE->set_heading($course->fullname); $PAGE->set_pagelayout('incourse'); $output .= $OUTPUT->header(); $output .= '<h4>Import recording links</h4>'; $options = bigbluebuttonbn_import_get_courses_for_select($bbbsession); $selected = bigbluebuttonbn_selected_course($options, $tc); if (empty($options)) { $output .= html_writer::tag('div', get_string('view_error_import_no_courses', 'bigbluebuttonbn')); } else { $output .= html_writer::tag('div', html_writer::select($options, 'import_recording_links_select', $selected)); $recordings = bigbluebuttonbn_getRecordingsArrayByCourse($selected, $bbbsession['endpoint'], $bbbsession['shared_secret']); //exclude the ones that are already imported $recordings = bigbluebuttonbn_import_exlcude_recordings_already_imported($bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id, $recordings); //store remaining recordings (indexed) in a session variable $SESSION->bigbluebuttonbn_importrecordings = bigbluebuttonbn_index_recordings($recordings); if (empty($recordings)) { $output .= html_writer::tag('div', get_string('view_error_import_no_recordings', 'bigbluebuttonbn')); } else { $output .= html_writer::tag('span', '', ['id' => 'import_recording_links_table', 'name' => 'import_recording_links_table']); $output .= bigbluebutton_output_recording_table($bbbsession, $recordings, ['importing']); } $output .= html_writer::start_tag('br'); $output .= html_writer::tag('input', '', array('type' => 'button', 'value' => get_string('view_recording_button_return', 'bigbluebuttonbn'), 'onclick' => 'window.location=\'' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $cm->id . '\'')); $jsvars = array('bn' => $bn, 'tc' => $selected, 'locales' => bigbluebuttonbn_get_locales_for_ui()); $PAGE->requires->data_for_js('bigbluebuttonbn', $jsvars); $jsmodule = array('name' => 'mod_bigbluebuttonbn', 'fullpath' => '/mod/bigbluebuttonbn/module.js', 'requires' => array('datasource-get', 'datasource-jsonschema', 'datasource-polling')); $PAGE->requires->js_init_call('M.mod_bigbluebuttonbn.import_view_init', array(), false, $jsmodule); } $output .= $OUTPUT->footer(); // finally, render the output