-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetolsadata.php
85 lines (76 loc) · 3.14 KB
/
getolsadata.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/*
* @package mod-skillsoftmi
* @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/skillsoftmi/locallib.php');
require_once($CFG->dirroot.'/mod/skillsoftmi/olsalib.php');
require_login();
$id = required_param('assetid', PARAM_TEXT); // AssetID
if (empty($id)) {
error('A required parameter is missing');
}
if (strtolower($id) != 'sso') {
$response = AI_GetXmlAssetMetaDatami($id);
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title><?php echo get_string('skillsoft_metadatatitle', 'skillsoftmi');?></title>
<script type="text/javascript">
//<![CDATA[
function doit() {
<?php
if (strtolower($id) != 'sso') {
if ($response->success) {
print "window.opener.document.getElementById('id_name').value=".'"'.olsadatatohtmlmi($response->result->title->_).'";';
print "window.opener.document.getElementById('id_launch').value=".'"'.$response->result->launchurl->_.'";';
print "window.opener.document.getElementById('id_duration').value=".'"'.$response->result->duration.'";';
print "window.opener.setTextArea(window.opener,'introeditor',".'"'.olsadatatohtmlmi($response->result->description->_).'");';
print "window.opener.setTextArea(window.opener,'audience',".'"'.olsadatatohtmlmi($response->result->audience).'");';
print "window.opener.setTextArea(window.opener,'prereq',".'"'.olsadatatohtmlmi($response->result->prerequisites).'");';
print "window.close();";
} else {
print "document.getElementById('waitingmessage').style.display = 'none';";
print "document.getElementById('errormessage').style.display = 'block';";
}
} else {
if (!$CFG->skillsoftmi_trackingmode == TRACK_TO_LMSmi) {
print "window.opener.document.getElementById('id_name').value=".'"'.get_string('skillsoft_ssoassettitle', 'skillsoftmi').'";';
print "window.opener.document.getElementById('id_launch').value=".'"'.$CFG->skillsoftmi_ssourl.'";';
print "window.opener.document.getElementById('id_duration').value='0';";
print "window.opener.setTextArea(window.opener,'introeditor',".'"'.get_string('skillsoft_ssoassetsummary', 'skillsoftmi').'");';
print "window.opener.setTextArea(window.opener,'audience','');";
print "window.opener.setTextArea(window.opener,'prereq','');";
print "window.close();";
} else {
print "document.getElementById('waitingmessage').style.display = 'none';";
print "document.getElementById('errormessage').style.display = 'block';";
}
}
?>
}
//]]>
</script>
</head>
<body onload="doit();">
<div id="waitingmessage"><p><?php echo get_string('skillsoft_metadatasetting', 'skillsoftmi');?></p></div>
<div id="errormessage" style="display:none;"><p>
<?php
if (strtolower($id) != 'sso') {
print '<p>'.get_string('skillsoft_metadataerror', 'skillsoftmi').'</p>';
print '<p>'.$response->errormessage.'</p>';
} else {
if ($CFG->skillsoftmi_trackingmode == TRACK_TO_LMSmi) {
print '<p>'.get_string('skillsoft_ssomodeerror', 'skillsoftmi').'</p>';
}
}
?>
</p></div>
</body>
</html>