Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

   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   * This page allows the configuration of external tools that meet the LTI specification.
  19   *
  20   * @package    mod_lti
  21   * @copyright  2015 Ryan Wyllie <ryan@moodle.com>
  22   * @author     Ryan Wyllie
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  require_once('../../config.php');
  27  require_once($CFG->libdir.'/adminlib.php');
  28  require_once($CFG->dirroot.'/mod/lti/lib.php');
  29  require_once($CFG->dirroot.'/mod/lti/locallib.php');
  30  
  31  $cartridgeurl = optional_param('cartridgeurl', '', PARAM_URL);
  32  
  33  // No guest autologin.
  34  require_login(0, false);
  35  admin_externalpage_setup('ltitoolconfigure');
  36  
  37  if ($cartridgeurl) {
  38      $type = new stdClass();
  39      $data = new stdClass();
  40      $type->state = LTI_TOOL_STATE_CONFIGURED;
  41      $data->lti_coursevisible = 1;
  42      lti_load_type_from_cartridge($cartridgeurl, $data);
  43      lti_add_type($type, $data);
  44  }
  45  
  46  $pageurl = new moodle_url('/mod/lti/toolconfigure.php');
  47  $PAGE->set_url($pageurl);
  48  $PAGE->set_title(get_string('toolregistration', 'mod_lti'));
  49  $PAGE->requires->string_for_js('success', 'moodle');
  50  $PAGE->requires->string_for_js('error', 'moodle');
  51  $PAGE->requires->string_for_js('successfullycreatedtooltype', 'mod_lti');
  52  $PAGE->requires->string_for_js('failedtocreatetooltype', 'mod_lti');
  53  $output = $PAGE->get_renderer('mod_lti');
  54  
  55  echo $output->header();
  56  
  57  $page = new \mod_lti\output\tool_configure_page();
  58  echo $output->render($page);
  59  
  60  echo $output->footer();