Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/question/ -> edit.php (source)

Differences Between: [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   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   * Page to edit the question bank
  19   *
  20   * @package    moodlecore
  21   * @subpackage questionbank
  22   * @copyright  1999 onwards Martin Dougiamas {@link http://moodle.com}
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  
  27  require_once(__DIR__ . '/../config.php');
  28  require_once($CFG->dirroot . '/question/editlib.php');
  29  
  30  list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
  31          question_edit_setup('questions', '/question/edit.php');
  32  
  33  $url = new moodle_url($thispageurl);
  34  if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
  35      $url->param('lastchanged', $lastchanged);
  36  }
  37  $PAGE->set_url($url);
  38  
  39  $questionbank = new core_question\bank\view($contexts, $thispageurl, $COURSE, $cm);
  40  $questionbank->process_actions();
  41  
  42  $context = $contexts->lowest();
  43  $streditingquestions = get_string('editquestions', 'question');
  44  $PAGE->set_title($streditingquestions);
  45  $PAGE->set_heading($COURSE->fullname);
  46  echo $OUTPUT->header();
  47  
  48  // Print horizontal nav if needed.
  49  $renderer = $PAGE->get_renderer('core_question', 'bank');
  50  echo $renderer->extra_horizontal_navigation();
  51  
  52  echo '<div class="questionbankwindow boxwidthwide boxaligncenter">';
  53  $questionbank->display('questions', $pagevars['qpage'], $pagevars['qperpage'],
  54          $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'],
  55          $pagevars['qbshowtext'], $pagevars['qtagids']);
  56  echo "</div>\n";
  57  
  58  // Log the view of this category.
  59  list($categoryid, $contextid) = explode(',', $pagevars['cat']);
  60  $category = new stdClass();
  61  $category->id = $categoryid;
  62  $catcontext = \context::instance_by_id($contextid);
  63  $event = \core\event\question_category_viewed::create_from_question_category_instance($category, $catcontext);
  64  $event->trigger();
  65  
  66  echo $OUTPUT->footer();