Proyectos de Subversion Moodle

Rev

| 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 tool_dataprivacy/defaults_page
19
 
20
    Manage data registry defaults.
21
 
22
    Classes required for JS:
23
 
24
    Data attributes required for JS:
25
 
26
    Context variables required for this template:
27
    * contextlevel Number - The context level.
28
    * modecoursecat Boolean - Whether we're displaying defaults for course categories.
29
    * modecourse Boolean - Whether we're displaying defaults for courses.
30
    * modemodule Boolean - Whether we're displaying defaults for activity modules.
31
    * modeblock Boolean - Whether we're displaying defaults for blocks.
32
    * coursecaturl String - The URL for the course category defaults tab.
33
    * courseurl String - The URL for the course defaults tab.
34
    * moduleurl String - The URL for the activity module defaults tab.
35
    * blockurl String - The URL for the block defaults tab.
36
    * purposeid Number - The purpose ID for this context level.
37
    * canedit Boolean - Whether this is being rendered for editing purposes.
38
    * categoryid Number - The ID of the default category for this context level.
39
    * purposeid Number - The ID of the default purpose for this context level.
40
    * category String - The category name.
41
    * purpose String - The purpose name.
42
    * otherdefaults Array - An array containing the defaults for the activity modules.
43
 
44
    Example context (json):
45
    {
46
        "contextlevel": 70,
47
        "modecoursecat": false,
48
        "modecourse": false,
49
        "modemodule": true,
50
        "modeblock": false,
51
        "coursecaturl": "#",
52
        "courseurl": "#",
53
        "moduleurl": "#",
54
        "blockurl": "#",
55
        "category": "Awesome default category",
56
        "purpose": "Awesome default purpose",
57
        "canedit": true,
58
        "otherdefaults": [
59
            {
60
                "name": "Assignment",
61
                "category": "Category for activity modules",
62
                "purpose": "Assessments"
63
            },
64
            {
65
                "name": "Forum",
66
                "category": "Category for activity modules",
67
                "purpose": "Social interactions"
68
            }
69
        ]
70
    }
71
}}
72
 
73
    <ul class="nav nav-tabs mt-4">
74
        <li class="nav-item">
75
            <a class="nav-link {{#modecoursecat}}active{{/modecoursecat}}" href="{{coursecaturl}}">{{#str}}categories{{/str}}</a>
76
        </li>
77
        <li class="nav-item">
78
            <a class="nav-link {{#modecourse}}active{{/modecourse}}" href="{{courseurl}}">{{#str}}courses{{/str}}</a>
79
        </li>
80
        <li class="nav-item">
81
            <a class="nav-link {{#modemodule}}active{{/modemodule}}" href="{{moduleurl}}">{{#str}}activitymodules{{/str}}</a>
82
        </li>
83
        <li class="nav-item">
84
            <a class="nav-link {{#modeblock}}active{{/modeblock}}" href="{{blockurl}}">{{#str}}blocks{{/str}}</a>
85
        </li>
86
    </ul>
87
 
88
    <div class="mt-3">
89
        <div class="alert alert-primary" role="alert">
90
            {{#str}}defaultsinfo, tool_dataprivacy{{/str}}
91
        </div>
92
 
93
        <fieldset class="mb-0 fieldset-styled">
94
        <legend id="defaults-header">
95
            {{#modecoursecat}}{{#str}}categories{{/str}}{{/modecoursecat}}
96
            {{#modecourse}}{{#str}}courses{{/str}}{{/modecourse}}
97
            {{#modemodule}}{{#str}}activitymodules{{/str}}{{/modemodule}}
98
            {{#modeblock}}{{#str}}blocks{{/str}}{{/modeblock}}
99
        </legend>
100
        <div>
101
 
102
            <div>
103
                {{> tool_dataprivacy/defaults_display}}
104
                {{#canedit}}
105
                    {{#modemodule}}
106
                    <button class="btn btn-primary mt-4" data-action="new-activity-defaults" data-contextlevel="{{contextlevel}}">
107
                        {{#str}}addnewdefaults, tool_dataprivacy{{/str}}
108
                    </button>
109
                    {{/modemodule}}
110
                {{/canedit}}
111
            </div>
112
 
113
            {{#modemodule}}
114
            <table class="mt-1 generaltable table-striped">
115
                <thead>
116
                    <tr>
117
                        <th>&nbsp;</th>
118
                        <th scope="col">{{#str}}category, tool_dataprivacy{{/str}}</th>
119
                        <th scope="col">{{#str}}purpose, tool_dataprivacy{{/str}}</th>
120
                        {{#canedit}}
121
                            <th scope="col">{{#str}}actions{{/str}}</th>
122
                        {{/canedit}}
123
                    </tr>
124
                </thead>
125
                <tbody>
126
                    {{#otherdefaults}}
127
                    <tr>
128
                        <th scope="row">{{name}}</th>
129
                        <td>{{category}}</td>
130
                        <td>{{purpose}}</td>
131
                        {{#canedit}}
132
                            <td class="lastcol">
133
                                {{#actions}}
134
                                    {{> core/action_menu_link}}
135
                                {{/actions}}
136
                            </td>
137
                        {{/canedit}}
138
                    </tr>
139
                    {{/otherdefaults}}
140
                </tbody>
141
            </table>
142
            {{/modemodule}}
143
        </div>
144
        </fieldset>
145
 
146
    </div>
147
</div>
148
 
149
{{#js}}
150
// Initialise the JS.
151
require(['tool_dataprivacy/defaultsactions'], function(ActionsMod) {
152
    ActionsMod.init();
153
});
154
{{/js}}