[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/mod/hotpot/ -> show.php (source)

   1  <?php // $Id: show.php,v 1.15.2.1 2008/05/02 04:07:32 dongsheng Exp $
   2  
   3      require_once("../../config.php");
   4      require_once ("lib.php");
   5  
   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);
  10  
  11      require_login($params->course);
  12  
  13      if (!has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $params->course))) {
  14          error("You are not allowed to view this page!");
  15      }
  16      if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM))) {
  17          $params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES, PARAM_INT);
  18      } else {
  19          $params->location = HOTPOT_LOCATION_COURSEFILES;
  20      }
  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);
  24  ?>
  25  <script type="text/javascript">
  26  //<![CDATA[
  27      // http://www.krikkit.net/howto_javascript_copy_clipboard.html
  28      function copy_contents(id) {
  29          if (id==null) {
  30              id = 'contents';
  31          }
  32          var obj = null;
  33          if (document.getElementById) {
  34              obj = document.getElementById(id);
  35          }
  36          if (obj && window.clipboardData) {
  37              window.clipboardData.setData("Text", obj.innerText);
  38              alert('<?php print_string('copiedtoclipboard', 'hotpot') ?>');
  39          }
  40      }
  41      document.write('<span class="helplink"> &nbsp; <a href="javascript:copy_contents()"><?php print_string('copytoclipboard', 'hotpot') ?></A></span>');
  42  //]]>
  43  </script>
  44  <?php
  45      print_simple_box_start("center", "96%");
  46      if($hp = new hotpot_xml_quiz($params)) {
  47          print '<pre id="contents">';
  48          switch ($params->action) {
  49              case 'showxmlsource':
  50                  print htmlspecialchars($hp->source);
  51                  break;
  52              case 'showxmltree':
  53                  if (isset($hp->xml)) {
  54                      print_r($hp->xml);
  55                  }
  56                  break;
  57              case 'showhtmlsource':
  58                  print htmlspecialchars($hp->html);
  59                  break;
  60              case 'showhtmlquiz':
  61                  print $hp->html;
  62                  break;
  63          }
  64          print '</pre>';
  65      } else {
  66          print_simple_box("Could not open Hot Potatoes XML file", "center", "", "#FFBBBB");
  67      }
  68      print_simple_box_end();
  69      print '<br />';
  70      close_window_button();
  71  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7