3 require_once("../../config.php");
4 require_once("lib.php");
6 $params = new stdClass();
7 $params->action
= required_param('action', PARAM_ALPHA
);
8 $params->course
= required_param('course', PARAM_INT
);
9 $params->reference
= required_param('reference', PARAM_PATH
);
11 require_login($params->course
);
13 if (!has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE
, $params->course
))) {
14 error("You are not allowed to view this page!");
16 if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM
, SITEID
))) {
17 $params->location
= optional_param('location', HOTPOT_LOCATION_COURSEFILES
, PARAM_INT
);
19 $params->location
= HOTPOT_LOCATION_COURSEFILES
;
21 $title = get_string($params->action
, 'hotpot').': '.$params->reference
;
22 print_header($title, $title);
23 hotpot_print_show_links($params->course
, $params->location
, $params->reference
);
25 <script type
="text/javascript">
27 // http://www.krikkit.net/howto_javascript_copy_clipboard.html
28 function copy_contents(id
) {
33 if (document
.getElementById
) {
34 obj
= document
.getElementById(id
);
36 if (obj
&& window
.clipboardData
) {
37 window
.clipboardData
.setData("Text", obj
.innerText
);
38 alert('<?php print_string('copiedtoclipboard
', 'hotpot
') ?>');
41 document
.write('<span class="helplink"> <a href="javascript:copy_contents()"><?php print_string('copytoclipboard
', 'hotpot
') ?></A></span>');
45 print_simple_box_start("center", "96%");
46 if($hp = new hotpot_xml_quiz($params)) {
47 print '<pre id="contents">';
48 switch ($params->action
) {
50 print htmlspecialchars($hp->source
);
53 if (isset($hp->xml
)) {
57 case 'showhtmlsource':
58 print htmlspecialchars($hp->html
);
66 print_simple_box("Could not open Hot Potatoes XML file", "center", "", "#FFBBBB");
68 print_simple_box_end();
70 close_window_button();