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 * Handle the return from the Tool Provider after registering a tool proxy. 19 * 20 * @package mod_lti 21 * @copyright 2014 Vital Source Technologies http://vitalsource.com 22 * @author Stephen Vickers 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->dirroot.'/mod/lti/locallib.php'); 28 29 $top = optional_param('top', 0, PARAM_INT); 30 $msg = optional_param('lti_msg', '', PARAM_TEXT); 31 $err = optional_param('lti_errormsg', '', PARAM_TEXT); 32 $id = optional_param('id', 0, PARAM_INT); 33 34 // No guest autologin. 35 require_sesskey(); 36 require_login(0, false); 37 38 $systemcontext = context_system::instance(); 39 require_capability('moodle/site:config', $systemcontext); 40 41 if (empty($top)) { 42 43 $params = array(); 44 $params['sesskey'] = sesskey(); 45 $params['top'] = '1'; 46 if (!empty($msg)) { 47 $params['lti_msg'] = $msg; 48 } 49 if (!empty($err)) { 50 $params['lti_errormsg'] = $err; 51 } 52 if (!empty($id)) { 53 $params['id'] = $id; 54 } 55 $redirect = new moodle_url('/mod/lti/registrationreturn.php', $params); 56 $redirect = $redirect->out(false); 57 58 $clickhere = get_string('click_to_continue', 'lti', (object)array('link' => $redirect)); 59 $html = <<< EOD 60 <html> 61 <head> 62 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 63 <script type="text/javascript"> 64 //<![CDATA[ 65 top.location.href = '{$redirect}'; 66 //]] 67 </script> 68 </head> 69 <body> 70 <noscript> 71 {$clickhere} 72 </noscript> 73 </body> 74 </html> 75 EOD; 76 77 // We always send the headers because they set the encoding. 78 send_headers('text/html; charset=utf-8', false); 79 echo $html; 80 81 } else if (!empty($msg) && !empty($err)) { 82 83 $params = array(); 84 $params['sesskey'] = sesskey(); 85 $params['top'] = '1'; 86 if (!empty($err)) { 87 $params['lti_errormsg'] = $err; 88 } 89 if (!empty($id)) { 90 $params['id'] = $id; 91 } 92 $redirect = new moodle_url('/mod/lti/registrationreturn.php', $params); 93 $redirect = $redirect->out(false); 94 redirect($redirect, $err); 95 96 } else { 97 98 $redirect = new moodle_url('/mod/lti/toolproxies.php'); 99 if (!empty($id)) { 100 $toolproxy = $DB->get_record('lti_tool_proxies', array('id' => $id)); 101 switch($toolproxy->state) { 102 case LTI_TOOL_PROXY_STATE_ACCEPTED: 103 $redirect->param('tab', 'tp_accepted'); 104 break; 105 case LTI_TOOL_PROXY_STATE_REJECTED: 106 $redirect->param('tab', 'tp_rejected'); 107 break; 108 case LTI_TOOL_PROXY_STATE_PENDING: 109 // Change the status to configured. 110 $toolproxy->state = LTI_TOOL_PROXY_STATE_CONFIGURED; 111 lti_update_tool_proxy($toolproxy); 112 } 113 } 114 115 $redirect = $redirect->out(); 116 117 if (empty($msg)) { 118 $msg = $err; 119 } 120 redirect($redirect, $msg); 121 122 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body