| 1 | 
           efrain | 
           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 | 
                *
  | 
        
        
           | 1441 | 
           ariadna | 
           77 | 
                * @param view $qbank
  | 
        
        
           | 1 | 
           efrain | 
           78 | 
                * @return bulk_action_base[]
  | 
        
        
            | 
            | 
           79 | 
                */
  | 
        
        
           | 1441 | 
           ariadna | 
           80 | 
               public function get_bulk_actions(view $qbank): array {
  | 
        
        
           | 1 | 
           efrain | 
           81 | 
                   return [];
  | 
        
        
            | 
            | 
           82 | 
               }
  | 
        
        
            | 
            | 
           83 | 
              | 
        
        
            | 
            | 
           84 | 
               /**
  | 
        
        
            | 
            | 
           85 | 
                * This method will return a column manager object, if this plugin provides one.
  | 
        
        
            | 
            | 
           86 | 
                *
  | 
        
        
            | 
            | 
           87 | 
                * @return ?column_manager_base
  | 
        
        
            | 
            | 
           88 | 
                */
  | 
        
        
            | 
            | 
           89 | 
               public function get_column_manager(): ?column_manager_base {
  | 
        
        
            | 
            | 
           90 | 
                   return null;
  | 
        
        
            | 
            | 
           91 | 
               }
  | 
        
        
            | 
            | 
           92 | 
              | 
        
        
            | 
            | 
           93 | 
               /**
  | 
        
        
            | 
            | 
           94 | 
                * This method will return an array of renderable objects, for adding additional controls to the question bank screen.
  | 
        
        
            | 
            | 
           95 | 
                *
  | 
        
        
            | 
            | 
           96 | 
                * The array returned can include a numeric index for each object, to indicate the position in which it should be displayed
  | 
        
        
            | 
            | 
           97 | 
                * relative to other controls. If two plugins return controls with the same position, they will be displayed after one another,
  | 
        
        
            | 
            | 
           98 | 
                * based on the alphabetical order of the plugin component names.
  | 
        
        
            | 
            | 
           99 | 
                *
  | 
        
        
            | 
            | 
           100 | 
                * @param view $qbank The question bank view.
  | 
        
        
            | 
            | 
           101 | 
                * @param context $context The current context, for permission checks.
  | 
        
        
            | 
            | 
           102 | 
                * @param int $categoryid The current question category ID.
  | 
        
        
            | 
            | 
           103 | 
                * @return \renderable[]
  | 
        
        
            | 
            | 
           104 | 
                */
  | 
        
        
            | 
            | 
           105 | 
               public function get_question_bank_controls(view $qbank, context $context, int $categoryid): array {
  | 
        
        
            | 
            | 
           106 | 
                   return [];
  | 
        
        
            | 
            | 
           107 | 
               }
  | 
        
        
            | 
            | 
           108 | 
              | 
        
        
            | 
            | 
           109 | 
               /**
  | 
        
        
            | 
            | 
           110 | 
                * Return search conditions for the plugin.
  | 
        
        
            | 
            | 
           111 | 
                *
  | 
        
        
           | 1441 | 
           ariadna | 
           112 | 
                * This is used by question bank view classes to get the list of available filters to display in the filter UI.
  | 
        
        
            | 
            | 
           113 | 
                *
  | 
        
        
            | 
            | 
           114 | 
                * This is also used to get the list of available filters for other purposes, for example resolving the list of questions
  | 
        
        
            | 
            | 
           115 | 
                * selected by a set of filters, in which case the `$qbank` argument may be `null`
  | 
        
        
            | 
            | 
           116 | 
                * {@see filter_condition_manager::get_condition_classes()}.
  | 
        
        
            | 
            | 
           117 | 
                *
  | 
        
        
            | 
            | 
           118 | 
                * @param view|null $qbank The current question bank view the filters are being rendered for, for example the main question
  | 
        
        
            | 
            | 
           119 | 
                *     bank page, or the random question view.
  | 
        
        
           | 1 | 
           efrain | 
           120 | 
                * @return condition[]
  | 
        
        
            | 
            | 
           121 | 
                */
  | 
        
        
           | 1441 | 
           ariadna | 
           122 | 
               public function get_question_filters(?view $qbank = null): array {
  | 
        
        
           | 1 | 
           efrain | 
           123 | 
                   return [];
  | 
        
        
            | 
            | 
           124 | 
               }
  | 
        
        
            | 
            | 
           125 | 
           }
  |