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
<div class="card">
73
    <div class="card-header">
74
        <ul class="nav nav-tabs card-header-tabs">
75
            <li class="nav-item">
76
                <a class="nav-link {{#modecoursecat}}active{{/modecoursecat}}" href="{{coursecaturl}}">{{#str}}categories{{/str}}</a>
77
            </li>
78
            <li class="nav-item">
79
                <a class="nav-link {{#modecourse}}active{{/modecourse}}" href="{{courseurl}}">{{#str}}courses{{/str}}</a>
80
            </li>
81
            <li class="nav-item">
82
                <a class="nav-link {{#modemodule}}active{{/modemodule}}" href="{{moduleurl}}">{{#str}}activitymodules{{/str}}</a>
83
            </li>
84
            <li class="nav-item">
85
                <a class="nav-link {{#modeblock}}active{{/modeblock}}" href="{{blockurl}}">{{#str}}blocks{{/str}}</a>
86
            </li>
87
        </ul>
88
    </div>
89
    <div class="card-body context-level-view">
90
        <div class="alert alert-primary" role="alert">
91
            {{#str}}defaultsinfo, tool_dataprivacy{{/str}}
92
        </div>
93
        <h4 class="card-title" id="defaults-header">
94
            {{#modecoursecat}}{{#str}}categories{{/str}}{{/modecoursecat}}
95
            {{#modecourse}}{{#str}}courses{{/str}}{{/modecourse}}
96
            {{#modemodule}}{{#str}}activitymodules{{/str}}{{/modemodule}}
97
            {{#modeblock}}{{#str}}blocks{{/str}}{{/modeblock}}
98
        </h4>
99
        <div>
100
            {{> tool_dataprivacy/defaults_display}}
101
            {{#canedit}}
102
                {{#modemodule}}
103
                <button class="btn btn-primary" data-action="new-activity-defaults" data-contextlevel="{{contextlevel}}">
104
                    {{#str}}addnewdefaults, tool_dataprivacy{{/str}}
105
                </button>
106
                {{/modemodule}}
107
            {{/canedit}}
108
            {{#modemodule}}
109
            <table class="mt-1 table table-striped">
110
                <thead>
111
                    <tr>
112
                        <th>&nbsp;</th>
113
                        <th scope="col">{{#str}}category, tool_dataprivacy{{/str}}</th>
114
                        <th scope="col">{{#str}}purpose, tool_dataprivacy{{/str}}</th>
115
                        {{#canedit}}
116
                            <th scope="col">{{#str}}actions{{/str}}</th>
117
                        {{/canedit}}
118
                    </tr>
119
                </thead>
120
                <tbody>
121
                    {{#otherdefaults}}
122
                    <tr>
123
                        <th scope="row">{{name}}</th>
124
                        <td>{{category}}</td>
125
                        <td>{{purpose}}</td>
126
                        {{#canedit}}
127
                            <td>
128
                                {{#actions}}
129
                                    {{> core/action_menu_link}}
130
                                {{/actions}}
131
                            </td>
132
                        {{/canedit}}
133
                    </tr>
134
                    {{/otherdefaults}}
135
                </tbody>
136
            </table>
137
            {{/modemodule}}
138
        </div>
139
    </div>
140
</div>
141
 
142
{{#js}}
143
// Initialise the JS.
144
require(['tool_dataprivacy/defaultsactions'], function(ActionsMod) {
145
    ActionsMod.init();
146
});
147
{{/js}}