Gitlab CSE Unil

tool_generic.php 2.33 KB
Newer Older
M. Chardon's avatar
M. Chardon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * This file contains the annotation class for the assignfeedback_editpdfplus plugin
 *
 * @package   assignfeedback_editpdfplus
 * @copyright  2016 Université de Lausanne
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

namespace assignfeedback_editpdfplus\bdd;

/**
 * Description of tool
 *
 * @author kury
 */
class tool_generic extends tool {

    const DISPLAY_CLASS_BUTTON = array(
        "highlight" => "fa fa-paint-brush",
        "line" => "fa fa-minus",
        "oval" => "fa fa-circle-o",
        "pen" => "fa fa-pencil",
        "rectangle" => "fa fa-square-o",
        "drag" => "fa fa-hand-paper-o",
        "select" => "fa fa-mouse-pointer",
43
44
45
        "annotationcolour" => "fa fa-tint",
        "rotateleft" => "fa fa-undo",
        "rotateright" => "fa fa-undo fa-flip-horizontal"
M. Chardon's avatar
M. Chardon committed
46
47
    );

M. Chardon's avatar
M. Chardon committed
48
49
50
51
52
    /**
     * Get elements (display label, parameters) to render a button in HTML
     * @param bool $disabled if the button must be disabled
     * @return array
     */
M. Chardon's avatar
M. Chardon committed
53
54
    public function getRendererBoutonHTMLDisplay($disabled = false) {
        $iconhtml = \html_writer::tag("i", "", array('class' => self::DISPLAY_CLASS_BUTTON[$this->label], 'aria-hidden' => 'true'));
M. Chardon's avatar
M. Chardon committed
55
56
        $iconparams = array(
            'data-tool' => $this->label,
57
            'class' => $this->label . 'button generictoolbarbutton btn btn-light',
M. Chardon's avatar
M. Chardon committed
58
59
60
61
62
            'type' => 'button'
        );
        if ($this->id) {
            $iconparams['id'] = 'ctbutton' . $this->id;
        }
M. Chardon's avatar
M. Chardon committed
63
64
65
66
67
68
69
70
71
72
        if ($disabled) {
            $iconparams['disabled'] = 'true';
        }
        return array(
            'content' => $iconhtml,
            'parameters' => $iconparams
        );
    }

}