Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{{!
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
    @template core_reportbuilder/local/dynamictabs/editor
19
 
20
    Template for the custom report editor
21
 
22
    Example context (json):
23
    {
24
        "id": 1,
25
        "type": 1,
26
        "table": "table",
27
        "editmode": true,
28
        "attributes": [{
29
            "name": "data-custom",
30
            "value": "1"
31
        }],
32
        "sidebarmenucards": [{
33
            "menucards": [{
34
                "name": "General",
35
                "items": [{
36
                    "name": "Manually added users",
37
                    "identifier": "core_reportbuilder:users"
38
                }]
39
            }]
40
        }],
41
        "conditions": [{
42
            "hasavailableconditions": true,
43
            "availableconditions": [{
44
                "optiongroup": [{
45
                    "text": "User",
46
                    "values": [{
47
                        "value": 1,
48
                        "visiblename": "User name"
49
                    }]
50
                }]
51
            }],
52
            "hasactiveconditions": true,
53
            "activeconditionsform": "form"
54
        }],
55
        "filters": [{
56
            "hasavailablefilters": true,
57
            "availablefilters": [{
58
                "optiongroup": [{
59
                    "text": "User",
60
                    "values": [{
61
                        "value": 1,
62
                        "visiblename": "User name"
63
                    }]
64
                }]
65
            }],
66
            "hasactivefilters": true,
67
            "activefilters": [{
68
                "heading": "Email address",
69
                "entityname": "user",
70
                "headingeditable": "Email address"
71
            }]
72
        }],
73
        "sorting": [{
74
            "hassortablecolumns": true,
75
            "sortablecolumns": [{
76
                "id": 1,
77
                "title": "Email address",
78
                "sortdirection": "4",
79
                "sortenabled": true,
1441 ariadna 80
                "sortenabledtitle": "Disable initial sorting for column 'Email address'",
1 efrain 81
                "sortorder": 1,
82
                "sorticon": [{
1441 ariadna 83
                    "key": "t/sort_asc",
84
                    "component": "moodle",
85
                    "title": "Change initial sorting for column 'Email address' to descending"
1 efrain 86
                }],
1441 ariadna 87
                "movetitle": "Move sorting for column 'Email address'",
1 efrain 88
                "heading": "Email address"
89
            }]
90
        }],
91
        "cardview": {
92
            "form": "form"
93
        }
94
    }
95
}}
1441 ariadna 96
<h2 class="visually-hidden">{{#str}} editor, core_reportbuilder {{/str}}</h2>
1 efrain 97
<div class="reportbuilder-report"
1441 ariadna 98
     id="reportbuilder-report-{{uniqid}}"
1 efrain 99
     data-region="core_reportbuilder/report"
100
     data-report-id="{{id}}"
101
     data-report-type="{{type}}"
1441 ariadna 102
     data-report-parameters=""
1 efrain 103
     {{#editmode}}data-editing{{/editmode}}
104
     {{#attributes}}{{name}}="{{value}}" {{/attributes}}>
105
    <div class="reportbuilder-wrapper d-flex flex-column flex-lg-row">
106
        {{#editmode}}
107
            {{! Menu sidebar }}
108
            {{> core_reportbuilder/local/sidebar-menu/area}}
109
        {{/editmode}}
110
        {{! Report }}
111
        <div class="reportbuilder-report-container">
112
            <div class="{{#editmode}}p-2 border{{/editmode}}">
113
                <div data-region="core_reportbuilder/report-header" class="dropdown d-flex justify-content-end">
114
                    {{! Preview/Edit button }}
115
                    <button data-action="toggle-edit-preview" class="btn btn-outline-secondary"
116
                        {{#editmode}}
117
                            data-edit-mode="1" title="{{#str}} switchpreview, core_reportbuilder {{/str}}"
118
                        {{/editmode}}
119
                        {{^editmode}}
120
                            data-edit-mode="0" title="{{#str}} switchedit, core_reportbuilder {{/str}}"
121
                        {{/editmode}}
122
                    >
123
                        {{#editmode}}
124
                            {{#pix}} i/preview, core {{/pix}}
125
                            {{#str}} preview, core {{/str}}
126
                        {{/editmode}}
127
                        {{^editmode}}
128
                            {{#pix}} t/editstring, core {{/pix}}
129
                            {{#str}} edit, core {{/str}}
130
                        {{/editmode}}
131
                    </button>
132
                    {{^editmode}}
133
                        {{! Filters }}
134
                        {{#filterspresent}}
135
                            {{>core_reportbuilder/local/filters/area}}
136
                        {{/filterspresent}}
137
                    {{/editmode}}
138
                </div>
139
                <div class="reportbuilder-editor-table-container mt-2">
140
                    {{! Table }}
141
                    {{{table}}}
142
                </div>
143
            </div>
144
        </div>
145
        {{#editmode}}
146
            {{! Settings sidebar }}
147
            {{> core_reportbuilder/local/settings/area}}
148
        {{/editmode}}
149
    </div>
150
</div>
151
 
152
{{#js}}
153
    require(['core_reportbuilder/editor', 'core_reportbuilder/report'],
154
    function(editor, report) {
155
        editor.init();
156
        report.init();
157
    });
158
{{/js}}