Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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 qbank_columnsortorder\local\bank;
18
 
19
use core_question\local\bank\column_action_base;
20
use core_question\local\bank\column_base;
21
 
22
/**
23
 * Move a column
24
 *
25
 * This will add an action menu item which will be enhanced by javascript in user_actions.js to show the move column modal for the
26
 * current column when clicked.
27
 *
28
 * @package   qbank_columnsortorder
29
 * @copyright 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
30
 * @author    Mark Johnson <mark.johnson@catalyst-eu.net>
31
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 */
33
class column_action_move extends column_action_base {
34
    /** @var string Label for the Move action.  */
35
    protected string $move;
36
 
37
    protected function init(): void {
38
        $this->move = get_string('move');
39
    }
40
 
41
    public function get_action_menu_link(column_base $column): ?\action_menu_link {
42
        return new \action_menu_link_secondary(
43
            new \moodle_url('/question/edit.php'),
44
            new \pix_icon('i/dragdrop', ''),
45
            $this->move,
46
            [
47
                'title' => get_string('movecolumn', 'qbank_columnsortorder', $column->get_title()),
48
                'data-action' => 'move',
49
                'data-column' => get_class($column),
50
            ]
51
        );
52
    }
53
}