first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,80 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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.
//
// 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for backup BigBlueButtonBN.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
*/
defined('MOODLE_INTERNAL') || die;
global $CFG;
require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/backup_bigbluebuttonbn_stepslib.php');
/**
* Backup task that provides all the settings and steps to perform one complete backup of the activity.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_bigbluebuttonbn_activity_task extends backup_activity_task {
/**
* Define (add) particular settings this activity can have.
*
* @return void
*/
protected function define_my_settings() {
// No particular settings for this activity.
}
/**
* Define (add) particular steps this activity can have.
*
* @return void
*/
protected function define_my_steps() {
// Choice only has one structure step.
$this->add_step(new backup_bigbluebuttonbn_activity_structure_step('bigbluebuttonbn_structure', 'bigbluebuttonbn.xml'));
}
/**
* Code the transformations to perform in the activity in order to get transportable (encoded) links.
*
* @param string $content
*
* @return string
*/
public static function encode_content_links($content) {
global $CFG;
$base = preg_quote($CFG->wwwroot.'/mod/bigbluebuttonbn', '#');
// Link to the list of bigbluebuttonbns.
$pattern = '#('.$base."\/index.php\?id\=)([0-9]+)#";
$content = preg_replace($pattern, '$@BIGBLUEBUTTONBNINDEX*$2@$', $content);
// Link to bigbluebuttonbn view by moduleid.
$pattern = '#('.$base."\/view.php\?id\=)([0-9]+)#";
$content = preg_replace($pattern, '$@BIGBLUEBUTTONBNVIEWBYID*$2@$', $content);
return $content;
}
}
@@ -0,0 +1,93 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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.
//
// 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for the structure used for backup BigBlueButtonBN.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
*/
/**
* Define all the backup steps that will be used by the backup_bigbluebuttonbn_activity_task.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_bigbluebuttonbn_activity_structure_step extends backup_activity_structure_step {
/**
* Define the complete bigbluebuttonbn structure for backup, with file and id annotations.
*
* @return object
*/
protected function define_structure() {
// To know if we are including userinfo.
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated.
$bigbluebuttonbn = new backup_nested_element('bigbluebuttonbn', ['id'], [
'type', 'course', 'name', 'intro', 'introformat', 'meetingid',
'moderatorpass', 'viewerpass', 'wait', 'record', 'recordallfromstart',
'recordhidebutton', 'welcome', 'voicebridge', 'openingtime', 'closingtime', 'timecreated',
'timemodified', 'presentation', 'participants', 'userlimit',
'recordings_html', 'recordings_deleted', 'recordings_imported', 'recordings_preview',
'clienttype', 'muteonstart', 'completionattendance',
'completionengagementchats', 'completionengagementtalks', 'completionengagementraisehand',
'completionengagementpollvotes', 'completionengagementemojis',
'guestallowed', 'mustapproveuser']);
$logs = new backup_nested_element('logs');
$log = new backup_nested_element('log', ['id'], [
'courseid', 'bigbluebuttonbnid', 'userid', 'timecreated', 'meetingid', 'log', 'meta']);
$recordings = new backup_nested_element('recordings');
$recording = new backup_nested_element('recording', ['id'], [
'courseid', 'bigbluebuttonbnid', 'groupid', 'recordingid', 'headlesss', 'imported', 'status', 'importeddata',
'timecreated']);
// Build the tree.
$bigbluebuttonbn->add_child($logs);
$logs->add_child($log);
$bigbluebuttonbn->add_child($recordings);
$recordings->add_child($recording);
// Define sources.
$bigbluebuttonbn->set_source_table('bigbluebuttonbn', ['id' => backup::VAR_ACTIVITYID]);
// This source definition only happen if we are including user info.
if ($userinfo) {
$log->set_source_table('bigbluebuttonbn_logs', ['bigbluebuttonbnid' => backup::VAR_PARENTID]);
$recording->set_source_table('bigbluebuttonbn_recordings', ['bigbluebuttonbnid' => backup::VAR_PARENTID]);
}
// Define id annotations.
$log->annotate_ids('user', 'userid');
// Define file annotations.
$bigbluebuttonbn->annotate_files('mod_bigbluebuttonbn', 'intro', null);
$this->add_subplugin_structure('bbbext', $bigbluebuttonbn, true);
// Return the root element (bigbluebuttonbn), wrapped into standard activity structure.
return $this->prepare_activity_structure($bigbluebuttonbn);
}
}
@@ -0,0 +1,107 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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.
//
// 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for restore BigBlueButtonBN.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/restore_bigbluebuttonbn_stepslib.php');
/**
* Restore task that provides all the settings and steps to perform one complete restore of the activity.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_bigbluebuttonbn_activity_task extends restore_activity_task {
/**
* Define (add) particular settings this activity can have.
*
* @return void
*/
protected function define_my_settings() {
// No particular settings for this activity.
}
/**
* Define (add) particular steps this activity can have.
*
* @return void
*/
protected function define_my_steps() {
// BigBlueButtonBN only has one structure step.
$this->add_step(new restore_bigbluebuttonbn_activity_structure_step('bigbluebuttonbn_structure', 'bigbluebuttonbn.xml'));
}
/**
* Define the contents in the activity that must be processed by the link decoder.
*
* @return array
*/
public static function define_decode_contents() {
$contents = [];
$contents[] = new restore_decode_content('bigbluebuttonbn', ['intro'], 'bigbluebuttonbn');
$contents[] = new restore_decode_content('bigbluebuttonbn_logs', ['log'], 'bigbluebuttonbn_logs');
$contents[] = new restore_decode_content('bigbluebuttonbn_recordings', ['importeddata'], 'bigbluebuttonbn_recordings');
return $contents;
}
/**
* Define the decoding rules for links belonging to the activity to be executed by the link decoder.
*
* @return array
*/
public static function define_decode_rules() {
$rules = [];
$rules[] = new restore_decode_rule('BIGBLUEBUTTONBNVIEWBYID', '/mod/bigbluebuttonbn/view.php?id=$1', 'course_module');
$rules[] = new restore_decode_rule('BIGBLUEBUTTONBNINDEX', '/mod/bigbluebuttonbn/index.php?id=$1', 'course');
return $rules;
}
/**
* Define the restoring rules for logs belonging to the activity to be executed by the link decoder.
*
* @return array
*/
public static function define_restore_log_rules() {
$rules = [];
$rules[] = new restore_log_rule('bigbluebuttonbn', 'add', 'view.php?id={course_module}', '{bigbluebuttonbn}');
$rules[] = new restore_log_rule('bigbluebuttonbn', 'update', 'view.php?id={course_module}', '{bigbluebuttonbn}');
$rules[] = new restore_log_rule('bigbluebuttonbn', 'view', 'view.php?id={course_module}', '{bigbluebuttonbn}');
$rules[] = new restore_log_rule('bigbluebuttonbn', 'report', 'report.php?id={course_module}', '{bigbluebuttonbn}');
return $rules;
}
/**
* Define the restoring rules for course associated to the activity to be executed by the link decoder.
*
* @return array
*/
public static function define_restore_log_rules_for_course() {
$rules = [];
$rules[] = new restore_log_rule('bigbluebuttonbn', 'view all', 'index.php?id={course}', null);
return $rules;
}
}
@@ -0,0 +1,121 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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.
//
// 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class for the structure used for restore BigBlueButtonBN.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
*/
/**
* Define all the restore steps that will be used by the restore_url_activity_task.
*
* @package mod_bigbluebuttonbn
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_bigbluebuttonbn_activity_structure_step extends restore_activity_structure_step {
/**
* Structure step to restore one bigbluebuttonbn activity.
*
* @return array
*/
protected function define_structure() {
$paths = [];
$bbb = new restore_path_element('bigbluebuttonbn', '/activity/bigbluebuttonbn');
$paths[] = $bbb;
$paths[] = new restore_path_element('bigbluebuttonbn_logs', '/activity/bigbluebuttonbn/logs/log');
$paths[] = new restore_path_element('bigbluebuttonbn_recordings', '/activity/bigbluebuttonbn/recordings/recording');
$this->add_subplugin_structure('bbbext', $bbb);
// Return the paths wrapped into standard activity structure.
return $this->prepare_activity_structure($paths);
}
/**
* Process a bigbluebuttonbn restore.
*
* @param array $data The data in object form
* @return void
*/
protected function process_bigbluebuttonbn(array $data) {
global $DB;
$data = (object) $data;
$data->course = $this->get_courseid();
$data->timemodified = $this->apply_date_offset($data->timemodified);
// Check if we are in backup::MODE_IMPORT (we set a new meetingid) or backup::MODE_GENERAL (we keep the same meetingid).
if ($this->get_task()->get_info()->mode == backup::MODE_IMPORT || empty($data->meetingid)) {
// We are in backup::MODE_IMPORT, we need to renew the meetingid.
$data->meetingid = \mod_bigbluebuttonbn\meeting::get_unique_meetingid_seed();
}
// Insert the bigbluebuttonbn record.
$newitemid = $DB->insert_record('bigbluebuttonbn', $data);
// Immediately after inserting "activity" record, call this.
$this->apply_activity_instance($newitemid);
}
/**
* Process a bigbluebuttonbn_logs restore (additional table).
*
* @param array $data The data in object form
* @return void
*/
protected function process_bigbluebuttonbn_logs(array $data) {
global $DB;
$data = (object) $data;
// Apply modifications.
$data->courseid = $this->get_mappingid('course', $data->courseid);
$data->bigbluebuttonbnid = $this->get_new_parentid('bigbluebuttonbn');
$data->userid = $this->get_mappingid('user', $data->userid);
$data->timecreated = $this->apply_date_offset($data->timecreated);
// Insert the bigbluebuttonbn_logs record.
$newitemid = $DB->insert_record('bigbluebuttonbn_logs', $data);
// Immediately after inserting associated record, call this.
$this->set_mapping('bigbluebuttonbn_logs', $data->id, $newitemid);
}
/**
* Process a bigbluebuttonbn_recordings restore (additional table).
*
* @param array $data The data in object form
* @return void
*/
protected function process_bigbluebuttonbn_recordings(array $data) {
global $DB;
$data = (object) $data;
// Apply modifications.
$data->courseid = $this->get_mappingid('course', $data->courseid);
$data->bigbluebuttonbnid = $this->get_new_parentid('bigbluebuttonbn');
$data->timecreated = $this->apply_date_offset($data->timecreated);
// Insert the bigbluebuttonbn_recordings record.
$newitemid = $DB->insert_record('bigbluebuttonbn_recordings', $data);
// Immediately after inserting associated record, call this.
$this->set_mapping('bigbluebuttonbn_recordings', $data->id, $newitemid);
}
/**
* Actions to be executed after the restore is completed
*
* @return void
*/
protected function after_execute() {
// Add bigbluebuttonbn related files, no need to match by itemname (just internally handled context).
$this->add_related_files('mod_bigbluebuttonbn', 'intro', null);
}
}