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 401 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   * Renderer for adding/editing a question.
  19   *
  20   * This code is based on question/renderer.php by The Open University.
  21   *
  22   * @package    qbank_editquestion
  23   * @copyright  2021 Catalyst IT Australia Pty Ltd
  24   * @author     Safat Shahin <safatshahin@catalyst-au.net>
  25   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26   */
  27  
  28  namespace qbank_editquestion\output;
  29  
  30  /**
  31   * Renderer for add/edit/copy
  32   *
  33   * @package    qbank_editquestion
  34   * @copyright  2021 Catalyst IT Australia Pty Ltd
  35   * @author     Safat Shahin <safatshahin@catalyst-au.net>
  36   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  37   */
  38  class renderer extends \plugin_renderer_base {
  39  
  40      /**
  41       * Render a qbank_chooser.
  42       *
  43       * @param \renderable $qbankchooser The chooser.
  44       * @return string
  45       */
  46      public function render_qbank_chooser (\renderable $qbankchooser) {
  47          return $this->render_from_template('qbank_editquestion/qbank_chooser', $qbankchooser->export_for_template($this));
  48      }
  49  
  50      /**
  51       * Render add question button.
  52       *
  53       * @param array $addquestiondata
  54       * @return bool|string
  55       */
  56      public function render_create_new_question_button ($addquestiondata) {
  57          return $this->render_from_template('qbank_editquestion/add_new_question', $addquestiondata);
  58      }
  59  
  60      /**
  61       * Render question information for edit form.
  62       *
  63       * @param array $questiondata
  64       * @return bool|string
  65       */
  66      public function render_question_info($questiondata) {
  67          return $this->render_from_template('qbank_editquestion/question_info', $questiondata);
  68      }
  69  
  70      /**
  71       * Render status dropdown.
  72       *
  73       * @param array $dropdownoptions
  74       * @return bool|string
  75       */
  76      public function render_status_dropdown($dropdownoptions) {
  77          return $this->render_from_template('qbank_editquestion/question_status_dropdown', $dropdownoptions);
  78      }
  79  }