Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

   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   * Library functions used by question/preview.php.
  19   *
  20   * @package    core_question
  21   * @subpackage questionengine
  22   * @copyright  2010 The Open University
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   * @deprecated since Moodle 4.0
  25   * @see qbank_previewquestion\form\preview_options_form
  26   * @see qbank_previewquestion\output\question_preview_options
  27   */
  28  
  29  use qbank_previewquestion\question_preview_options;
  30  
  31  /**
  32   * Called via pluginfile.php -> question_pluginfile to serve files belonging to
  33   * a question in a question_attempt when that attempt is a preview.
  34   *
  35   * @package  core_question
  36   * @category files
  37   * @param stdClass $course course settings object
  38   * @param stdClass $context context object
  39   * @param string $component the name of the component we are serving files for.
  40   * @param string $filearea the name of the file area.
  41   * @param int $qubaid the question_usage this image belongs to.
  42   * @param int $slot the relevant slot within the usage.
  43   * @param array $args the remaining bits of the file path.
  44   * @param bool $forcedownload whether the user must be forced to download the file.
  45   * @param array $fileoptions
  46   * @return void false if file not found, does not return if found - justsend the file
  47   * @deprecated since Moodle 4.0
  48   * @see qbank_previewquestion\helper::question_preview_question_pluginfile()
  49   * @todo Final deprecation on Moodle 4.4 MDL-72438
  50   */
  51  function question_preview_question_pluginfile($course, $context, $component,
  52          $filearea, $qubaid, $slot, $args, $forcedownload, $fileoptions) {
  53      debugging('Function question_preview_question_pluginfile() has been deprecated and moved to qbank_previewquestion plugin,
  54       please use qbank_previewquestion\helper::question_preview_question_pluginfile() instead.', DEBUG_DEVELOPER);
  55      qbank_previewquestion\helper::question_preview_question_pluginfile($course, $context,
  56              $component, $filearea, $qubaid, $slot, $args, $forcedownload, $fileoptions);
  57  }
  58  
  59  /**
  60   * The the URL to use for actions relating to this preview.
  61   * @param int $questionid the question being previewed.
  62   * @param int $qubaid the id of the question usage for this preview.
  63   * @param question_preview_options $options the options in use.
  64   * @param context $context
  65   * @deprecated since Moodle 4.0
  66   * @see qbank_previewquestion\helper::question_preview_action_url()
  67   * @todo Final deprecation on Moodle 4.4 MDL-72438
  68   */
  69  function question_preview_action_url($questionid, $qubaid,
  70          question_preview_options $options, $context) {
  71      debugging('Function question_preview_action_url() has been deprecated and moved to qbank_previewquestion plugin,
  72       please use qbank_previewquestion\helper::question_preview_action_url() instead.', DEBUG_DEVELOPER);
  73      qbank_previewquestion\helper::question_preview_action_url($questionid, $qubaid, $options, $context);
  74  }
  75  
  76  /**
  77   * The the URL to use for actions relating to this preview.
  78   * @param int $questionid the question being previewed.
  79   * @param context $context the current moodle context.
  80   * @param int $previewid optional previewid to sign post saved previewed answers.
  81   * @deprecated since Moodle 4.0
  82   * @see qbank_previewquestion\helper::question_preview_form_url()
  83   * @todo Final deprecation on Moodle 4.4 MDL-72438
  84   */
  85  function question_preview_form_url($questionid, $context, $previewid = null) {
  86      debugging('Function question_preview_form_url() has been deprecated and moved to qbank_previewquestion plugin,
  87       please use qbank_previewquestion\helper::question_preview_form_url() instead.', DEBUG_DEVELOPER);
  88      qbank_previewquestion\helper::question_preview_form_url($questionid, $context, $previewid);
  89  }
  90  
  91  /**
  92   * Delete the current preview, if any, and redirect to start a new preview.
  93   * @param int $previewid
  94   * @param int $questionid
  95   * @param object $displayoptions
  96   * @param object $context
  97   * @deprecated since Moodle 4.0
  98   * @see qbank_previewquestion\helper::restart_preview()
  99   * @todo Final deprecation on Moodle 4.4 MDL-72438
 100   */
 101  function restart_preview($previewid, $questionid, $displayoptions, $context) {
 102      debugging('Function restart_preview() has been deprecated and moved to qbank_previewquestion plugin,
 103       please use qbank_previewquestion\helper::restart_preview() instead.', DEBUG_DEVELOPER);
 104      qbank_previewquestion\helper::restart_preview($previewid, $questionid, $displayoptions, $context);
 105  }