Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are 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    workshopeval
  20   * @subpackage best
  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  /**
  26   * restore subplugin class that provides the necessary information
  27   * needed to restore one workshopeval_best subplugin.
  28   */
  29  class restore_workshopeval_best_subplugin extends restore_subplugin {
  30  
  31      ////////////////////////////////////////////////////////////////////////////
  32      // mappings of XML paths to the processable methods
  33      ////////////////////////////////////////////////////////////////////////////
  34  
  35      /**
  36       * Returns the paths to be handled by the subplugin at workshop level
  37       */
  38      protected function define_workshop_subplugin_structure() {
  39  
  40          $paths = array();
  41  
  42          $elename = $this->get_namefor('setting');
  43          $elepath = $this->get_pathfor('/workshopeval_best_settings'); // we used get_recommended_name() so this works
  44          $paths[] = new restore_path_element($elename, $elepath);
  45  
  46          return $paths; // And we return the interesting paths
  47      }
  48  
  49      ////////////////////////////////////////////////////////////////////////////
  50      // defined path elements are dispatched to the following methods
  51      ////////////////////////////////////////////////////////////////////////////
  52  
  53      /**
  54       * Processes one workshopeval_best_settings element
  55       */
  56      public function process_workshopeval_best_setting($data) {
  57          global $DB;
  58  
  59          $data = (object)$data;
  60          $data->workshopid = $this->get_new_parentid('workshop');
  61          $DB->insert_record('workshopeval_best_settings', $data);
  62      }
  63  }