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
 * Resize a column
24
 *
25
 * This will add an action menu item which will be enhanced by javascript in user_actions.js to show the resize 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_resize extends column_action_base {
34
    /** @var string Label for the resize action. */
35
    protected string $resize;
36
 
37
    protected function init(): void {
38
        $this->resize = get_string('resize', 'qbank_columnsortorder');
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/twoway', ''),
45
            $this->resize,
46
            [
47
                'title' => get_string('resizecolumn', 'qbank_columnsortorder', $column->get_title()),
48
                'data-action' => 'resize',
49
                'data-column' => get_class($column),
50
            ]
51
        );
52
    }
53
}