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 * A question bank column which gathers together all the actions into a menu. 19 * 20 * @package core_question 21 * @copyright 2019 The Open University 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace core_question\local\bank; 26 27 use \core\plugininfo\qbank; 28 29 /** 30 * A question bank column which gathers together all the actions into a menu. 31 * 32 * This question bank column, if added to the question bank, will 33 * replace all of the other columns which implement the 34 * {@see menu_action_column_base} interface and replace them with a single 35 * column containing an Edit menu. 36 * 37 * @copyright 2019 The Open University 38 * @author 2021 Safat Shahin <safatshahin@catalyst-au.net> 39 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 40 */ 41 class edit_menu_column extends column_base { 42 public function get_title() { 43 return get_string('actions'); 44 } 45 46 public function get_name(): string { 47 return 'editmenu'; 48 } 49 50 protected function display_content($question, $rowclasses): void { 51 global $OUTPUT; 52 $actions = $this->qbank->get_question_actions(); 53 54 $menu = new \action_menu(); 55 $menu->set_menu_trigger(get_string('edit')); 56 foreach ($actions as $action) { 57 $action = $action->get_action_menu_link($question); 58 if ($action) { 59 $menu->add($action); 60 } 61 } 62 63 $qtypeactions = \question_bank::get_qtype($question->qtype, false) 64 ->get_extra_question_bank_actions($question); 65 foreach ($qtypeactions as $action) { 66 $menu->add($action); 67 } 68 69 echo $OUTPUT->render($menu); 70 } 71 72 public function get_required_fields():array { 73 return ['q.qtype']; 74 } 75 76 /** 77 * Get menuable actions. 78 * 79 * @return menu_action_column_base Menuable actions. 80 */ 81 public function get_actions(): array { 82 return $this->actions; 83 } 84 85 public function get_extra_classes(): array { 86 return ['pr-3']; 87 } 88 89 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body