| 1 | 
           efrain | 
           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 | 
           /**
  | 
        
        
            | 
            | 
           18 | 
            * Class for the structure used for backup BigBlueButtonBN.
  | 
        
        
            | 
            | 
           19 | 
            *
  | 
        
        
            | 
            | 
           20 | 
            * @package   mod_bigbluebuttonbn
  | 
        
        
            | 
            | 
           21 | 
            * @copyright 2010 onwards, Blindside Networks Inc
  | 
        
        
            | 
            | 
           22 | 
            * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  | 
        
        
            | 
            | 
           23 | 
            * @author    Fred Dixon  (ffdixon [at] blindsidenetworks [dt] com)
  | 
        
        
            | 
            | 
           24 | 
            * @author    Jesus Federico  (jesus [at] blindsidenetworks [dt] com)
  | 
        
        
            | 
            | 
           25 | 
            */
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           /**
  | 
        
        
            | 
            | 
           28 | 
            * Define all the backup steps that will be used by the backup_bigbluebuttonbn_activity_task.
  | 
        
        
            | 
            | 
           29 | 
            *
  | 
        
        
            | 
            | 
           30 | 
            * @package   mod_bigbluebuttonbn
  | 
        
        
            | 
            | 
           31 | 
            * @copyright 2010 onwards, Blindside Networks Inc
  | 
        
        
            | 
            | 
           32 | 
            * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  | 
        
        
            | 
            | 
           33 | 
            */
  | 
        
        
            | 
            | 
           34 | 
           class backup_bigbluebuttonbn_activity_structure_step extends backup_activity_structure_step {
  | 
        
        
            | 
            | 
           35 | 
               /**
  | 
        
        
            | 
            | 
           36 | 
                * Define the complete bigbluebuttonbn structure for backup, with file and id annotations.
  | 
        
        
            | 
            | 
           37 | 
                *
  | 
        
        
            | 
            | 
           38 | 
                * @return object
  | 
        
        
            | 
            | 
           39 | 
                */
  | 
        
        
            | 
            | 
           40 | 
               protected function define_structure() {
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
                   // To know if we are including userinfo.
  | 
        
        
            | 
            | 
           43 | 
                   $userinfo = $this->get_setting_value('userinfo');
  | 
        
        
            | 
            | 
           44 | 
              | 
        
        
            | 
            | 
           45 | 
                   // Define each element separated.
  | 
        
        
            | 
            | 
           46 | 
                   $bigbluebuttonbn = new backup_nested_element('bigbluebuttonbn', ['id'], [
  | 
        
        
            | 
            | 
           47 | 
                       'type', 'course', 'name', 'intro', 'introformat', 'meetingid',
  | 
        
        
            | 
            | 
           48 | 
                       'moderatorpass', 'viewerpass', 'wait', 'record', 'recordallfromstart',
  | 
        
        
            | 
            | 
           49 | 
                       'recordhidebutton', 'welcome', 'voicebridge', 'openingtime', 'closingtime', 'timecreated',
  | 
        
        
            | 
            | 
           50 | 
                       'timemodified', 'presentation', 'participants', 'userlimit',
  | 
        
        
            | 
            | 
           51 | 
                       'recordings_html', 'recordings_deleted', 'recordings_imported', 'recordings_preview',
  | 
        
        
            | 
            | 
           52 | 
                       'clienttype', 'muteonstart', 'completionattendance',
  | 
        
        
            | 
            | 
           53 | 
                       'completionengagementchats', 'completionengagementtalks', 'completionengagementraisehand',
  | 
        
        
            | 
            | 
           54 | 
                       'completionengagementpollvotes', 'completionengagementemojis',
  | 
        
        
           | 1441 | 
           ariadna | 
           55 | 
                       'guestallowed', 'mustapproveuser', 'showpresentation', 'grade']);
  | 
        
        
           | 1 | 
           efrain | 
           56 | 
              | 
        
        
            | 
            | 
           57 | 
                   $logs = new backup_nested_element('logs');
  | 
        
        
            | 
            | 
           58 | 
              | 
        
        
            | 
            | 
           59 | 
                   $log = new backup_nested_element('log', ['id'], [
  | 
        
        
            | 
            | 
           60 | 
                       'courseid', 'bigbluebuttonbnid', 'userid', 'timecreated', 'meetingid', 'log', 'meta']);
  | 
        
        
            | 
            | 
           61 | 
              | 
        
        
            | 
            | 
           62 | 
                   $recordings = new backup_nested_element('recordings');
  | 
        
        
            | 
            | 
           63 | 
              | 
        
        
            | 
            | 
           64 | 
                   $recording = new backup_nested_element('recording', ['id'], [
  | 
        
        
            | 
            | 
           65 | 
                       'courseid', 'bigbluebuttonbnid', 'groupid', 'recordingid', 'headlesss', 'imported', 'status', 'importeddata',
  | 
        
        
            | 
            | 
           66 | 
                       'timecreated']);
  | 
        
        
            | 
            | 
           67 | 
              | 
        
        
            | 
            | 
           68 | 
                   // Build the tree.
  | 
        
        
            | 
            | 
           69 | 
                   $bigbluebuttonbn->add_child($logs);
  | 
        
        
            | 
            | 
           70 | 
                   $logs->add_child($log);
  | 
        
        
            | 
            | 
           71 | 
                   $bigbluebuttonbn->add_child($recordings);
  | 
        
        
            | 
            | 
           72 | 
                   $recordings->add_child($recording);
  | 
        
        
            | 
            | 
           73 | 
              | 
        
        
            | 
            | 
           74 | 
                   // Define sources.
  | 
        
        
            | 
            | 
           75 | 
                   $bigbluebuttonbn->set_source_table('bigbluebuttonbn', ['id' => backup::VAR_ACTIVITYID]);
  | 
        
        
            | 
            | 
           76 | 
              | 
        
        
            | 
            | 
           77 | 
                   // This source definition only happen if we are including user info.
  | 
        
        
            | 
            | 
           78 | 
                   if ($userinfo) {
  | 
        
        
            | 
            | 
           79 | 
                       $log->set_source_table('bigbluebuttonbn_logs', ['bigbluebuttonbnid' => backup::VAR_PARENTID]);
  | 
        
        
            | 
            | 
           80 | 
                       $recording->set_source_table('bigbluebuttonbn_recordings', ['bigbluebuttonbnid' => backup::VAR_PARENTID]);
  | 
        
        
            | 
            | 
           81 | 
                   }
  | 
        
        
            | 
            | 
           82 | 
              | 
        
        
            | 
            | 
           83 | 
                   // Define id annotations.
  | 
        
        
            | 
            | 
           84 | 
                   $log->annotate_ids('user', 'userid');
  | 
        
        
            | 
            | 
           85 | 
              | 
        
        
            | 
            | 
           86 | 
                   // Define file annotations.
  | 
        
        
            | 
            | 
           87 | 
                   $bigbluebuttonbn->annotate_files('mod_bigbluebuttonbn', 'intro', null);
  | 
        
        
            | 
            | 
           88 | 
              | 
        
        
            | 
            | 
           89 | 
                   $this->add_subplugin_structure('bbbext', $bigbluebuttonbn, true);
  | 
        
        
            | 
            | 
           90 | 
                   // Return the root element (bigbluebuttonbn), wrapped into standard activity structure.
  | 
        
        
            | 
            | 
           91 | 
                   return $this->prepare_activity_structure($bigbluebuttonbn);
  | 
        
        
            | 
            | 
           92 | 
               }
  | 
        
        
            | 
            | 
           93 | 
           }
  |