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.

Differences Between: [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   * Base class class for qbank plugins.
  19   *
  20   * Every qbank plugin must extent this class.
  21   *
  22   * @package    core_question
  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 core_question\local\bank;
  29  
  30  use core\context;
  31  use qbank_columnsortorder\local\qbank\column_action_move;
  32  use qbank_columnsortorder\local\qbank\column_action_remove;
  33  use qbank_columnsortorder\local\qbank\column_action_resize;
  34  
  35  /**
  36   * Class plugin_features_base is the base class for qbank plugins.
  37   *
  38   * @package    core_question
  39   * @copyright  2021 Catalyst IT Australia Pty Ltd
  40   * @author     Safat Shahin <safatshahin@catalyst-au.net>
  41   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  42   */
  43  class plugin_features_base {
  44  
  45      /**
  46       * This method will return the array of objects to be rendered as a part of question bank columns.
  47       *
  48       * @param view $qbank
  49       * @return array
  50       */
  51      public function get_question_columns(view $qbank): ?array {
  52          return [];
  53      }
  54  
  55      /**
  56       * This method will return the array of objects to be rendered as a part of question bank actions.
  57       *
  58       * @param view $qbank
  59       * @return question_action_base[]
  60       */
  61      public function get_question_actions(view $qbank): array {
  62          return [];
  63      }
  64  
  65      /**
  66       * This method will return the object for the navigation node.
  67       *
  68       * @return null|navigation_node_base
  69       */
  70      public function get_navigation_node(): ?navigation_node_base {
  71          return null;
  72      }
  73  
  74      /**
  75       * This method will return the array objects for the bulk actions ui.
  76       *
  77       * @return bulk_action_base[]
  78       */
  79      public function get_bulk_actions() {
  80          return [];
  81      }
  82  
  83      /**
  84       * This method will return a column manager object, if this plugin provides one.
  85       *
  86       * @return ?column_manager_base
  87       */
  88      public function get_column_manager(): ?column_manager_base {
  89          return null;
  90      }
  91  
  92      /**
  93       * This method will return an array of renderable objects, for adding additional controls to the question bank screen.
  94       *
  95       * The array returned can include a numeric index for each object, to indicate the position in which it should be displayed
  96       * relative to other controls. If two plugins return controls with the same position, they will be displayed after one another,
  97       * based on the alphabetical order of the plugin component names.
  98       *
  99       * @param view $qbank The question bank view.
 100       * @param context $context The current context, for permission checks.
 101       * @param int $categoryid The current question category ID.
 102       * @return \renderable[]
 103       */
 104      public function get_question_bank_controls(view $qbank, context $context, int $categoryid): array {
 105          return [];
 106      }
 107  
 108      /**
 109       * Return search conditions for the plugin.
 110       *
 111       * @param view|null $qbank
 112       * @return condition[]
 113       */
 114      public function get_question_filters(view $qbank = null): array {
 115          return [];
 116      }
 117  }