Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * @package   mod_page
  20   * @category  backup
  21   * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
  22   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die;
  26  
  27  /**
  28   * Define all the backup steps that will be used by the backup_page_activity_task
  29   */
  30  
  31  /**
  32   * Define the complete page structure for backup, with file and id annotations
  33   */
  34  class backup_page_activity_structure_step extends backup_activity_structure_step {
  35  
  36      protected function define_structure() {
  37  
  38          // To know if we are including userinfo
  39          $userinfo = $this->get_setting_value('userinfo');
  40  
  41          // Define each element separated
  42          $page = new backup_nested_element('page', array('id'), array(
  43              'name', 'intro', 'introformat', 'content', 'contentformat',
  44              'legacyfiles', 'legacyfileslast', 'display', 'displayoptions',
  45              'revision', 'timemodified'));
  46  
  47          // Build the tree
  48          // (love this)
  49  
  50          // Define sources
  51          $page->set_source_table('page', array('id' => backup::VAR_ACTIVITYID));
  52  
  53          // Define id annotations
  54          // (none)
  55  
  56          // Define file annotations
  57          $page->annotate_files('mod_page', 'intro', null); // This file areas haven't itemid
  58          $page->annotate_files('mod_page', 'content', null); // This file areas haven't itemid
  59  
  60          // Return the root element (page), wrapped into standard activity structure
  61          return $this->prepare_activity_structure($page);
  62      }
  63  }