| 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 | namespace core_question\local\bank;
 | 
        
           |  |  | 18 |   | 
        
           |  |  | 19 | /**
 | 
        
           |  |  | 20 |  * Default column manager class
 | 
        
           |  |  | 21 |  *
 | 
        
           |  |  | 22 |  * This class defines stub methods that can be overridden by a plugin defining its own column manager.
 | 
        
           |  |  | 23 |  *
 | 
        
           |  |  | 24 |  * @package   core_question
 | 
        
           |  |  | 25 |  * @copyright 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
 | 
        
           |  |  | 26 |  * @author    Mark Johnson <mark.johnson@catalyst-eu.net>
 | 
        
           |  |  | 27 |  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 28 |  */
 | 
        
           |  |  | 29 | class column_manager_base {
 | 
        
           |  |  | 30 |     /**
 | 
        
           |  |  | 31 |      * Sort the list of columns
 | 
        
           |  |  | 32 |      *
 | 
        
           |  |  | 33 |      * Sort the provided list of columns into the order implemented in this column manager.
 | 
        
           |  |  | 34 |      *
 | 
        
           |  |  | 35 |      * @param array $unsortedcolumns Unordered array of columns
 | 
        
           |  |  | 36 |      * @return array Columns in the desired order.
 | 
        
           |  |  | 37 |      */
 | 
        
           |  |  | 38 |     public function get_sorted_columns(array $unsortedcolumns): array {
 | 
        
           |  |  | 39 |         return $unsortedcolumns;
 | 
        
           |  |  | 40 |     }
 | 
        
           |  |  | 41 |   | 
        
           |  |  | 42 |     /**
 | 
        
           |  |  | 43 |      * Given an array of columns, set the isvisible attribute.
 | 
        
           |  |  | 44 |      *
 | 
        
           |  |  | 45 |      * This base class leave all columns visible.
 | 
        
           |  |  | 46 |      *
 | 
        
           |  |  | 47 |      * @param column_base[] $columns
 | 
        
           |  |  | 48 |      * @return array
 | 
        
           |  |  | 49 |      */
 | 
        
           |  |  | 50 |     public function set_columns_visibility(array $columns): array {
 | 
        
           |  |  | 51 |         return $columns;
 | 
        
           |  |  | 52 |     }
 | 
        
           |  |  | 53 |   | 
        
           |  |  | 54 |     /**
 | 
        
           |  |  | 55 |      * Return a list of actions to display in an action menu for each column.
 | 
        
           |  |  | 56 |      *
 | 
        
           |  |  | 57 |      * @param view $qbank Question bank view.
 | 
        
           |  |  | 58 |      * @return column_action_base[] A list of column actions.
 | 
        
           |  |  | 59 |      */
 | 
        
           |  |  | 60 |     public function get_column_actions(view $qbank): array {
 | 
        
           |  |  | 61 |         return [];
 | 
        
           |  |  | 62 |     }
 | 
        
           |  |  | 63 |   | 
        
           |  |  | 64 |     /**
 | 
        
           |  |  | 65 |      * Given a column, return a value for its width CSS property.
 | 
        
           |  |  | 66 |      *
 | 
        
           |  |  | 67 |      * @param column_base $column
 | 
        
           |  |  | 68 |      * @return string CSS width property value.
 | 
        
           |  |  | 69 |      */
 | 
        
           |  |  | 70 |     public function get_column_width(column_base $column): string {
 | 
        
           |  |  | 71 |         return $column->get_default_width() . 'px';
 | 
        
           |  |  | 72 |     }
 | 
        
           |  |  | 73 | }
 |