forked from lushonline/moodle2-skillsoft-activity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssopreloader.php
55 lines (48 loc) · 1.75 KB
/
ssopreloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/*
* @package mod-skillsoft
* @author $Author$
* @version SVN: $Header$
* @copyright 2009-2014 Martin Holden
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
require_once($CFG->dirroot.'/mod/skillsoft/locallib.php');
$a = required_param('a', PARAM_INT); //activity id
if (!empty($a)) {
if (! $skillsoft = $DB->get_record('skillsoft', array('id'=> $a))) {
print_error('Skillsoft asset is incorrect');
}
if (! $course = $DB->get_record('course', array('id'=> $skillsoft->course))) {
print_error('Course is misconfigured');
}
if (! $cm = get_coursemodule_from_instance('skillsoft', $skillsoft->id, $course->id)) {
print_error('Course Module ID was incorrect');
}
} else {
print_error('A required parameter is missing');
}
require_login($course->id, false, $cm);
$target = new moodle_url('/mod/skillsoft/sso.php', array('a'=>$a));
$htmlbody = '<p>'.get_string('skillsoft_ssoloading', 'skillsoft').' ';
$htmlbody .= '<img src="'. $OUTPUT->pix_url('wait', 'skillsoft').'" class="icon" alt="'.get_string('skillsoft_waitingalt','skillsoft').'" /><br/>';
$htmlbody .= '</p>';
//$target = $CFG->wwwroot.'/mod/skillsoft/sso.php?a='.$a;
//$skillsoftpixdir = $CFG->modpixpath.'/skillsoft/pix';
?>
<html>
<head>
<title><?php echo get_string('skillsoft_ssotitle', 'skillsoft');?></title>
<script type="text/javascript">
//<![CDATA[
function doredirect() {
document.body.innerHTML = '<?php echo $htmlbody ?>';
document.location = '<?php echo $target ?>';
}
//]]>
</script>
</head>
<body onload="doredirect();">
<p><?php echo get_string('skillsoft_ssoloading', 'skillsoft');?></p>
</body>
</html>