Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   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 restore 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  defined('MOODLE_INTERNAL') || die();
  28  
  29  require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/restore_bigbluebuttonbn_stepslib.php');
  30  
  31  /**
  32   * Restore task that provides all the settings and steps to perform one complete restore of the activity.
  33   *
  34   * @package   mod_bigbluebuttonbn
  35   * @copyright 2010 onwards, Blindside Networks Inc
  36   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  37   */
  38  class restore_bigbluebuttonbn_activity_task extends restore_activity_task {
  39      /**
  40       * Define (add) particular settings this activity can have.
  41       *
  42       * @return void
  43       */
  44      protected function define_my_settings() {
  45          // No particular settings for this activity.
  46      }
  47  
  48      /**
  49       * Define (add) particular steps this activity can have.
  50       *
  51       * @return void
  52       */
  53      protected function define_my_steps() {
  54          // BigBlueButtonBN only has one structure step.
  55          $this->add_step(new restore_bigbluebuttonbn_activity_structure_step('bigbluebuttonbn_structure', 'bigbluebuttonbn.xml'));
  56      }
  57  
  58      /**
  59       * Define the contents in the activity that must be processed by the link decoder.
  60       *
  61       * @return array
  62       */
  63      public static function define_decode_contents() {
  64          $contents = [];
  65          $contents[] = new restore_decode_content('bigbluebuttonbn', ['intro'], 'bigbluebuttonbn');
  66          $contents[] = new restore_decode_content('bigbluebuttonbn_logs', ['log'], 'bigbluebuttonbn_logs');
  67          $contents[] = new restore_decode_content('bigbluebuttonbn_recordings', ['importeddata'], 'bigbluebuttonbn_recordings');
  68          return $contents;
  69      }
  70  
  71      /**
  72       * Define the decoding rules for links belonging to the activity to be executed by the link decoder.
  73       *
  74       * @return array
  75       */
  76      public static function define_decode_rules() {
  77          $rules = [];
  78          $rules[] = new restore_decode_rule('BIGBLUEBUTTONBNVIEWBYID', '/mod/bigbluebuttonbn/view.php?id=$1', 'course_module');
  79          $rules[] = new restore_decode_rule('BIGBLUEBUTTONBNINDEX', '/mod/bigbluebuttonbn/index.php?id=$1', 'course');
  80          return $rules;
  81      }
  82  
  83      /**
  84       * Define the restoring rules for logs belonging to the activity to be executed by the link decoder.
  85       *
  86       * @return array
  87       */
  88      public static function define_restore_log_rules() {
  89          $rules = [];
  90          $rules[] = new restore_log_rule('bigbluebuttonbn', 'add', 'view.php?id={course_module}', '{bigbluebuttonbn}');
  91          $rules[] = new restore_log_rule('bigbluebuttonbn', 'update', 'view.php?id={course_module}', '{bigbluebuttonbn}');
  92          $rules[] = new restore_log_rule('bigbluebuttonbn', 'view', 'view.php?id={course_module}', '{bigbluebuttonbn}');
  93          $rules[] = new restore_log_rule('bigbluebuttonbn', 'report', 'report.php?id={course_module}', '{bigbluebuttonbn}');
  94          return $rules;
  95      }
  96  
  97      /**
  98       * Define the restoring rules for course associated to the activity to be executed by the link decoder.
  99       *
 100       * @return array
 101       */
 102      public static function define_restore_log_rules_for_course() {
 103          $rules = [];
 104          $rules[] = new restore_log_rule('bigbluebuttonbn', 'view all', 'index.php?id={course}', null);
 105          return $rules;
 106      }
 107  }