Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Produces a sample page using JQuery.
  19   *
  20   * @package    core
  21   * @copyright  20014 Petr Skoda
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  require(__DIR__ . '/../../../config.php');
  26  
  27  require_login();
  28  $context = context_system::instance();
  29  require_capability('moodle/site:config', $context);
  30  
  31  $PAGE->set_url('/lib/tests/other/jquerypage.php');
  32  $PAGE->set_context($context);
  33  $PAGE->set_title('jQuery library test');
  34  $PAGE->set_heading('jQuery library test');
  35  
  36  $PAGE->requires->jquery();
  37  $PAGE->requires->jquery_plugin('ui');
  38  $PAGE->requires->jquery_plugin('ui-css');
  39  
  40  echo $OUTPUT->header();
  41  
  42  // Note: the examples were copied from http://jqueryui.com/accordion/, and
  43  // http://jqueryui.com/progressbar/#label.
  44  
  45  ?>
  46  
  47  <script>
  48      $(function() {
  49          $( "#accordion" ).accordion();
  50          $( "#progressbar" ).progressbar({
  51              value: false
  52          });
  53      });
  54  </script>
  55  <style>
  56    .ui-progressbar {
  57      position: relative;
  58    }
  59    .progress-label {
  60      position: absolute;
  61      left: 50%;
  62      top: 4px;
  63      font-weight: bold;
  64      text-shadow: 1px 1px 0 #fff;
  65    }
  66  </style>
  67  
  68  <div id="progressbar"><div class="progress-label">Loading...</div></div>
  69  
  70  <div id="accordion">
  71    <h3>Section 1</h3>
  72    <div>
  73      <p>
  74  Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
  75      ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
  76      amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
  77      odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
  78      </p>
  79    </div>
  80    <h3>Section 2</h3>
  81    <div>
  82      <p>
  83  Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
  84      purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
  85      velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
  86      suscipit faucibus urna.
  87      </p>
  88    </div>
  89    <h3>Section 3</h3>
  90    <div>
  91      <p>
  92  Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
  93  Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
  94      ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
  95      lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
  96      </p>
  97      <ul>
  98        <li>List item one</li>
  99        <li>List item two</li>
 100        <li>List item three</li>
 101      </ul>
 102    </div>
 103    <h3>Section 4</h3>
 104    <div>
 105      <p>
 106  Cras dictum. Pellentesque habitant morbi tristique senectus et netus
 107      et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
 108      faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
 109      mauris vel est.
 110      </p>
 111      <p>
 112  Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
 113      Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
 114      inceptos himenaeos.
 115      </p>
 116    </div>
 117  </div>
 118  
 119  <?php
 120  echo $OUTPUT->footer();