Source for file view_configuration_notecard.php

Documentation is available at view_configuration_notecard.php

  1. <html>
  2. <head>
  3.  <title></title>
  4. </head>
  5. <body>
  6. <?php
  7.     /**
  8.     * Displays the text for a configuration notecard.
  9.     * This page is expected to be shown in a small popup window.
  10.     * It ensures the user has the capability to manage activities in the context of the given module.
  11.     *
  12.     * @package sloodle
  13.     * @copyright Copyright (c) 2008 Sloodle (various contributors)
  14.     * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  15.     *
  16.     * @contributor Peter R. Bloomfield
  17.     *
  18.     */
  19.     
  20.     /** Sloodle/Moodle configuration script. */
  21.     require_once('../sl_config.php');
  22.     /** Sloodle core library functionality */
  23.     require_once(SLOODLE_DIRROOT.'/lib.php');
  24.     /** General Sloodle functions. */
  25.     require_once(SLOODLE_LIBROOT.'/general.php');
  26.     
  27.     
  28.     // Fetch our request parameters
  29.     $s required_param('s'PARAM_INT)// Sloodle instance ID
  30.     
  31.     // Fetch string table text
  32.     $strsloodle get_string('modulename''sloodle');
  33.     $strsloodles get_string('modulenameplural''sloodle');
  34.         
  35.     // Attempt to fetch the course module instance
  36.     if ($s{
  37.         if ($cm get_coursemodule_from_instance('sloodle'$s)) {
  38.             error("Instance ID was incorrect");
  39.         }
  40.     else {
  41.         error('Must specify a Sloodle module instance');
  42.     }
  43.     
  44.     // Ensure the user is logged-in
  45.     if (!isloggedin()) {
  46.         error(get_string('loggedinnot'));
  47.         exit();
  48.     }
  49.     
  50.     // Make sure the user has the appropriate capability in the current context
  51.     $context get_context_instance(CONTEXT_MODULE$cm->id);
  52.     require_capability('moodle/course:manageactivities'$context);
  53.     
  54.     
  55.     // Fetch the appropriate data
  56.     if (!$sloodle get_record('sloodle''id'$s)) error(get_string('databasequeryfailed','sloodle'));
  57.     if (!$controller get_record('sloodle_controller''sloodleid'$s)) error(get_string('databasequeryfailed','sloodle'));
  58.     
  59.     // Construct and render the appropriate data
  60.     $cfgtext '';
  61.     $cfgtext .= "set:sloodleserverroot|{$CFG->wwwroot}\n";
  62.     $cfgtext .= "set:pwd|{$controller->password}\n";
  63.     $cfgtext .= "set:sloodle_courseid|{$sloodle->course}";    
  64.     
  65.     // Get the string table text
  66.     $strcfgheader get_string('cfgnotecard:header''sloodle');
  67.     $strcfginstructions get_string('cfgnotecard:instructions''sloodle');
  68.     $strcfgsecurity get_string('cfgnotecard:security''sloodle');
  69.     $strcfgsetnote get_string('cfgnotecard:setnote''sloodle');
  70.     
  71.     echo <<<XXXEODXXX
  72.  <div style="text-align:center; font-family:sans-serif;">
  73.   <h3>$strcfgheader</h3>
  74.   <p>$strcfginstructions</p>
  75.   <p>$strcfgsecurity</p>
  76.   <textarea cols="60" rows="4" readonly="true">set:sloodleserverroot|{$CFG->wwwroot}
  77. set:sloodlepwd|{$controller->password}
  78. set:sloodlecontrollerid|{$cm->id}</textarea>
  79.   <p>$strcfgsetnote</p>
  80.  </div>
  81. XXXEODXXX;
  82. ?>
  83.  
  84. </body>
  85. </html>

Documentation generated on Mon, 16 Jun 2008 15:57:07 +0100 by phpDocumentor 1.4.0