Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
/question/ -> edit.php (source)

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 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  use core\event\question_category_viewed;
  27  use core_question\output\qbank_action_menu;
  28  use core_question\local\bank\view;
  29  
  30  require_once(__DIR__ . '/../config.php');
  31  require_once($CFG->dirroot . '/question/editlib.php');
  32  
  33  list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
  34          question_edit_setup('questions', '/question/edit.php');
  35  
  36  $actionurl = new moodle_url($thispageurl);
  37  if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
  38      $thispageurl->param('lastchanged', $lastchanged);
  39  }
  40  $PAGE->set_url($thispageurl);
  41  
  42  if ($PAGE->course->id == $SITE->id) {
  43      $PAGE->set_primary_active_tab('home');
  44  }
  45  
  46  $thispageurl->param('deleteall', 1);
  47  $questionbank = new view($contexts, $thispageurl, $COURSE, $cm, $pagevars);
  48  
  49  $context = $contexts->lowest();
  50  $streditingquestions = get_string('editquestions', 'question');
  51  $PAGE->set_title($streditingquestions);
  52  $PAGE->set_heading($COURSE->fullname);
  53  $PAGE->activityheader->disable();
  54  
  55  echo $OUTPUT->header();
  56  
  57  // Print horizontal nav if needed.
  58  $renderer = $PAGE->get_renderer('core_question', 'bank');
  59  
  60  // Render the selection action.
  61  $qbankaction = new qbank_action_menu($actionurl);
  62  echo $renderer->render($qbankaction);
  63  
  64  // Print the question area.
  65  $questionbank->display();
  66  
  67  // Log the view of this category.
  68  list($categoryid, $contextid) = explode(',', $pagevars['cat']);
  69  $category = new stdClass();
  70  $category->id = $categoryid;
  71  $catcontext = context::instance_by_id($contextid);
  72  $event = question_category_viewed::create_from_question_category_instance($category, $catcontext);
  73  $event->trigger();
  74  
  75  echo $OUTPUT->footer();