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 tool_brickfield\local\tool;
18
 
19
use tool_brickfield\manager;
20
 
21
/**
22
 * Class advanced.
23
 *
24
 * @package tool_brickfield
25
 * @copyright  2020 onward: Brickfield Education Labs, www.brickfield.ie
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
class advanced extends tool {
29
 
30
    /**
31
     * Provide a name for this tool, suitable for display on pages.
32
     * @return mixed|string
33
     * @throws \coding_exception
34
     */
35
    public static function toolname() {
36
        return get_string('advanced:toolname', 'tool_brickfield');
37
    }
38
 
39
    /**
40
     * Provide a short name for this tool, suitable for menus and selectors.
41
     * @return mixed|string
42
     * @throws \coding_exception
43
     */
44
    public static function toolshortname() {
45
        return get_string('advanced:toolshortname', 'tool_brickfield');
46
    }
47
 
48
    /**
49
     * Provide a lowercase name identifying this plugin. Should really be the same as the directory name.
50
     * @return string
51
     */
52
    public function pluginname() {
53
        return 'advanced';
54
    }
55
 
56
    /**
57
     * Builds context data used to render a single grid item on the advanced page.
58
     * @param string $icon
59
     * @param string $heading
60
     * @param string $content
61
     * @return array
62
     */
63
    protected function get_grid_item_context(string $icon, string $heading, string $content): array {
64
        return [
65
            "icon" => "pix/i/$icon.png",
66
            "iconalt" => get_string("icon:$icon", manager::PLUGINNAME),
67
            "heading" => get_string($heading, manager::PLUGINNAME),
68
            "content" => get_string($content, manager::PLUGINNAME)
69
        ];
70
    }
71
 
72
    /**
73
     * Return the data for renderer / template display.
74
     * @return \stdClass
75
     */
76
    protected function fetch_data(): \stdClass {
77
        $data = (object)[
78
            'griditems' => [
79
                $this->get_grid_item_context("analytics-custom", "headingone", "contentone"),
80
                $this->get_grid_item_context("tools-custom", "headingtwo", "contenttwo"),
81
                $this->get_grid_item_context("file-edit-custom", "headingthree", "contentthree"),
82
                $this->get_grid_item_context("search-plus-custom", "headingfour", "contentfour"),
83
                $this->get_grid_item_context("wand-magic-custom", "headingfive", "contentfive"),
84
                $this->get_grid_item_context("hands-helping-custom", "headingsix", "contentsix"),
85
            ],
86
            'valid' => true,
87
            'error' => '',
88
        ];
89
 
90
        return $data;
91
    }
92
}