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
/**
18
 * A layout contains information on how to display data.
19
 *
20
 * @package    block_dash
21
 * @copyright  2019 bdecent gmbh <https://bdecent.de>
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
namespace block_dash\local\layout;
26
 
27
use block_dash\local\data_grid\data\data_collection_interface;
28
use block_dash\local\data_grid\data\strategy\data_strategy_interface;
29
use block_dash\local\data_source\data_source_interface;
30
/**
31
 * A layout contains information on how to display data.
32
 *
33
 * @package block_dash
34
 */
35
interface layout_interface {
36
 
37
    /**
38
     * Get data source for this layout.
39
     *
40
     * @return data_source_interface
41
     */
42
    public function get_data_source();
43
 
44
    /**
45
     * Get mustache template name.
46
     *
47
     * @return string
48
     */
49
    public function get_mustache_template_name();
50
 
51
    /**
52
     * If the data source fields can be hidden or shown conditionally.
53
     *
54
     * @return bool
55
     */
56
    public function supports_field_visibility();
57
 
58
    /**
59
     * If the data source should display filters (does not affect conditions).
60
     *
61
     * @return bool
62
     */
63
    public function supports_filtering();
64
 
65
    /**
66
     * If the data source should display pagination links.
67
     *
68
     * @return bool
69
     */
70
    public function supports_pagination();
71
 
72
    /**
73
     * If the layout supports field sorting.
74
     *
75
     * @return mixed
76
     */
77
    public function supports_sorting();
78
 
79
    /**
80
     * Get data strategy.
81
     *
82
     * @return data_strategy_interface
83
     */
84
    public function get_data_strategy();
85
 
86
    /**
87
     * Modify objects before data is retrieved in the data source. This allows the layout to make decisions on the
88
     * data source and data grid.
89
     */
90
    public function before_data();
91
 
92
    /**
93
     * Modify objects after data is retrieved in the data source. This allows the layout to make decisions on the
94
     * data source and data grid.
95
     *
96
     * @param data_collection_interface $datacollection
97
     */
98
    public function after_data(data_collection_interface $datacollection);
99
 
100
    /**
101
     * Add form elements to the preferences form when a user is configuring a block.
102
     *
103
     * This extends the form built by the data source. When a user chooses a layout, specific form elements may be
104
     * displayed after a quick refresh of the form.
105
     *
106
     * Be sure to call parent::build_preferences_form() if you override this method.
107
     *
108
     * @param \moodleform $form
109
     * @param \MoodleQuickForm $mform
110
     * @throws \coding_exception
111
     */
112
    public function build_preferences_form(\moodleform $form, \MoodleQuickForm $mform);
113
 
114
    /**
115
     * Allows layout to modified preferences values before exporting to mustache template.
116
     *
117
     * @param array $preferences
118
     * @return array
119
     */
120
    public function process_preferences(array $preferences);
121
 
122
    /**
123
     * Get data for layout mustache template.
124
     *
125
     * @param \renderer_base $output
126
     * @return array|\stdClass
127
     * @throws \coding_exception
128
     */
129
    public function export_for_template(\renderer_base $output);
130
}