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.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

   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  // This file is part of BasicLTI4Moodle
  18  //
  19  // BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)
  20  // consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web
  21  // based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI
  22  // specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS
  23  // are already supporting or going to support BasicLTI. This project Implements the consumer
  24  // for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.
  25  // BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem
  26  // at the GESSI research group at UPC.
  27  // SimpleLTI consumer for Moodle is an implementation of the early specification of LTI
  28  // by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a
  29  // Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.
  30  //
  31  // BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
  32  // of the Universitat Politecnica de Catalunya http://www.upc.edu
  33  // Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu.
  34  
  35  /**
  36   * This file contains the lti module restore class
  37   *
  38   * @package mod_lti
  39   * @copyright  2009 Marc Alier, Jordi Piguillem, Nikolas Galanis
  40   *  marc.alier@upc.edu
  41   * @copyright  2009 Universitat Politecnica de Catalunya http://www.upc.edu
  42   * @author     Marc Alier
  43   * @author     Jordi Piguillem
  44   * @author     Nikolas Galanis
  45   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  46   */
  47  
  48  defined('MOODLE_INTERNAL') || die();
  49  
  50  require_once($CFG->dirroot . '/mod/lti/backup/moodle2/restore_lti_stepslib.php');
  51  
  52  /**
  53   * basiclti restore task that provides all the settings and steps to perform one
  54   * complete restore of the activity
  55   */
  56  class restore_lti_activity_task extends restore_activity_task {
  57  
  58      /**
  59       * Define (add) particular settings this activity can have
  60       */
  61      protected function define_my_settings() {
  62          // No particular settings for this activity.
  63      }
  64  
  65      /**
  66       * Define (add) particular steps this activity can have
  67       */
  68      protected function define_my_steps() {
  69          // Label only has one structure step.
  70          $this->add_step(new restore_lti_activity_structure_step('lti_structure', 'lti.xml'));
  71      }
  72  
  73      /**
  74       * Define the contents in the activity that must be
  75       * processed by the link decoder
  76       */
  77      static public function define_decode_contents() {
  78          $contents = array();
  79  
  80          $contents[] = new restore_decode_content('lti', array('intro'), 'lti');
  81  
  82          return $contents;
  83      }
  84  
  85      /**
  86       * Define the decoding rules for links belonging
  87       * to the activity to be executed by the link decoder
  88       */
  89      static public function define_decode_rules() {
  90          $rules = array();
  91  
  92          $rules[] = new restore_decode_rule('LTIVIEWBYID', '/mod/lti/view.php?id=$1', 'course_module');
  93          $rules[] = new restore_decode_rule('LTIINDEX', '/mod/lti/index.php?id=$1', 'course');
  94  
  95          return $rules;
  96  
  97      }
  98  
  99      /**
 100       * Define the restore log rules that will be applied
 101       * by the {@link restore_logs_processor} when restoring
 102       * basiclti logs. It must return one array
 103       * of {@link restore_log_rule} objects
 104       */
 105      static public function define_restore_log_rules() {
 106          $rules = array();
 107  
 108          $rules[] = new restore_log_rule('lti', 'add', 'view.php?id={course_module}', '{lti}');
 109          $rules[] = new restore_log_rule('lti', 'update', 'view.php?id={course_module}', '{lti}');
 110          $rules[] = new restore_log_rule('lti', 'view', 'view.php?id={course_module}', '{lti}');
 111  
 112          return $rules;
 113      }
 114  
 115      /**
 116       * Define the restore log rules that will be applied
 117       * by the {@link restore_logs_processor} when restoring
 118       * course logs. It must return one array
 119       * of {@link restore_log_rule} objects
 120       *
 121       * Note this rules are applied when restoring course logs
 122       * by the restore final task, but are defined here at
 123       * activity level. All them are rules not linked to any module instance (cmid = 0)
 124       */
 125      static public function define_restore_log_rules_for_course() {
 126          $rules = array();
 127  
 128          $rules[] = new restore_log_rule('lti', 'view all', 'index.php?id={course}', null);
 129  
 130          return $rules;
 131      }
 132  }