MDL-45982: Implement displaying of non error messages from a provider.

This commit is contained in:
Tim Lock 2014-06-13 09:16:24 +09:30
parent 337075d17b
commit 1dbc4f2894

View File

@ -31,6 +31,7 @@ $courseid = required_param('course', PARAM_INT);
$instanceid = optional_param('instanceid', 0, PARAM_INT); $instanceid = optional_param('instanceid', 0, PARAM_INT);
$errormsg = optional_param('lti_errormsg', '', PARAM_RAW); $errormsg = optional_param('lti_errormsg', '', PARAM_RAW);
$msg = optional_param('lti_msg', '', PARAM_RAW);
$unsigned = optional_param('unsigned', '0', PARAM_INT); $unsigned = optional_param('unsigned', '0', PARAM_INT);
$launchcontainer = optional_param('launch_container', LTI_LAUNCH_CONTAINER_WINDOW, PARAM_INT); $launchcontainer = optional_param('launch_container', LTI_LAUNCH_CONTAINER_WINDOW, PARAM_INT);
@ -47,7 +48,7 @@ if (!empty($instanceid)) {
require_login($course); require_login($course);
if (!empty($errormsg)) { if (!empty($errormsg) || !empty($msg)) {
$url = new moodle_url('/mod/lti/return.php', array('course' => $courseid)); $url = new moodle_url('/mod/lti/return.php', array('course' => $courseid));
$PAGE->set_url($url); $PAGE->set_url($url);
@ -66,7 +67,9 @@ if (!empty($errormsg)) {
if (!empty($lti) and !empty($context)) { if (!empty($lti) and !empty($context)) {
echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context))); echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context)));
} }
}
if (!empty($errormsg)) {
echo get_string('lti_launch_error', 'lti'); echo get_string('lti_launch_error', 'lti');
echo htmlspecialchars($errormsg); echo htmlspecialchars($errormsg);
@ -90,6 +93,12 @@ if (!empty($errormsg)) {
} }
echo $OUTPUT->footer(); echo $OUTPUT->footer();
} else if (!empty($msg)) {
echo htmlspecialchars($msg);
echo $OUTPUT->footer();
} else { } else {
$courseurl = new moodle_url('/course/view.php', array('id' => $courseid)); $courseurl = new moodle_url('/course/view.php', array('id' => $courseid));
$url = $courseurl->out(); $url = $courseurl->out();