See Release Notes
Long Term Support Release
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 * Submits a request to administrators to add a tool configuration for the requested site. 19 * 20 * @package mod_lti 21 * @copyright Copyright (c) 2011 Moodlerooms Inc. (http://www.moodlerooms.com) 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 * @author Chris Scribner 24 */ 25 26 require_once('../../config.php'); 27 require_once($CFG->dirroot.'/mod/lti/lib.php'); 28 require_once($CFG->dirroot.'/mod/lti/locallib.php'); 29 30 $instanceid = required_param('instanceid', PARAM_INT); 31 32 $lti = $DB->get_record('lti', array('id' => $instanceid)); 33 $course = $DB->get_record('course', array('id' => $lti->course)); 34 $cm = get_coursemodule_from_instance('lti', $lti->id, $lti->course, false, MUST_EXIST); 35 $context = context_module::instance($cm->id); 36 37 require_login($course); 38 39 require_sesskey(); 40 41 require_capability('mod/lti:requesttooladd', context_course::instance($lti->course)); 42 43 $baseurl = lti_get_domain_from_url($lti->toolurl); 44 45 $url = new moodle_url('/mod/lti/request_tool.php', array('instanceid' => $instanceid)); 46 $PAGE->set_url($url); 47 48 $pagetitle = strip_tags($course->shortname); 49 $PAGE->set_title($pagetitle); 50 $PAGE->set_heading($course->fullname); 51 52 $PAGE->set_pagelayout('incourse'); 53 54 echo $OUTPUT->header(); 55 echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context))); 56 57 // Add a tool type if one does not exist already. 58 if (!lti_get_tool_by_url_match($lti->toolurl, $lti->course, LTI_TOOL_STATE_ANY)) { 59 // There are no tools (active, pending, or rejected) for the launch URL. Create a new pending tool. 60 $tooltype = new stdClass(); 61 $toolconfig = new stdClass(); 62 63 $toolconfig->lti_toolurl = lti_get_domain_from_url($lti->toolurl); 64 $toolconfig->lti_typename = $toolconfig->lti_toolurl; 65 66 lti_add_type($tooltype, $toolconfig); 67 68 echo get_string('lti_tool_request_added', 'lti'); 69 } else { 70 echo get_string('lti_tool_request_existing', 'lti'); 71 } 72 73 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body