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
{{!
1441 ariadna 18
    @template tool_lp/manage_templates_page
19
 
1 efrain 20
    Manage learning plan templates template.
21
 
22
    Classes required for JS:
23
    * drag-parentnode
24
    * drag-samenode
25
    * templateactions
26
 
27
    Data attibutes required for JS:
28
    * data-region = managetemplates
29
    * data-templateid = id
30
    * data-action = deletetemplate
31
 
32
    Context variables required for this template:
33
    * templates - array of objects containing id, shortname, visible, canmanage, contextname
34
    * navigation - array of strings containing buttons for navigation
1441 ariadna 35
 
36
    Example context (json):
37
    {
38
        "templates": {
39
            "id": 1,
40
            "shortname": "Template1",
41
            "visible": true,
42
            "contextnamenoprefix": "System",
43
            "cohortscount": 12,
44
            "planscount": 6,
45
            "pluginbaseurl": "https://example.com",
46
            "pagecontextid": 1
47
        },
48
        "canmanage": true
49
    }
1 efrain 50
}}
51
<div data-region="managetemplates">
1441 ariadna 52
<div class="float-start">
1 efrain 53
    {{#navigation}}
54
    {{{.}}}
55
    {{/navigation}}
56
</div>
57
<table class="generaltable fullwidth managetemplates">
58
    <caption>{{#str}}listtemplatescaption, tool_lp{{/str}}</caption>
59
    <thead>
60
        <tr>
61
            <th scope="col">{{#str}}templatename, tool_lp{{/str}}</th>
62
            <th scope="col">{{#str}}category, tool_lp{{/str}}</th>
63
            <th scope="col">{{#str}}cohorts, core_cohort{{/str}}</th>
64
            <th scope="col">{{#str}}userplans, core_competency{{/str}}</th>
65
            {{#canmanage}}
66
            <th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
67
            {{/canmanage}}
68
        </tr>
69
    </thead>
70
    <tbody class="drag-parentnode">
71
        {{#templates}}
72
        <tr class="drag-samenode" data-templateid="{{id}}">
73
            <td><a href="{{pluginbaseurl}}/templatecompetencies.php?templateid={{id}}&amp;pagecontextid={{pagecontextid}}">{{{shortname}}}</a></span> {{^visible}}{{#str}}hiddenhint, tool_lp{{/str}}{{/visible}}</td>
74
            <td>{{contextnamenoprefix}}</td>
75
            <td><a class="template-cohorts" href="{{pluginbaseurl}}/template_cohorts.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">{{cohortscount}}</a></td>
76
            <td><a class="template-userplans" href="{{pluginbaseurl}}/template_plans.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">{{planscount}}</a></td>
77
            <td>
78
            {{#canmanage}}
79
            <ul class="templateactions">
80
                <li>
81
                    <a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
82
                    <ul class="dropdown dropdown-menu">
83
                        <li class="dropdown-item">
84
                            <a href="{{pluginbaseurl}}/edittemplate.php?id={{id}}&amp;pagecontextid={{pagecontextid}}&amp;return=templates">
1441 ariadna 85
                                {{#pix}}i/settings{{/pix}} {{#str}}edit{{/str}}
1 efrain 86
                            </a>
87
                        </li>
88
                        <li class="dropdown-item">
89
                            <a data-action="duplicatetemplate" data-templateid="{{id}}" href="#">
90
                                {{#pix}}t/copy{{/pix}} {{#str}}duplicate{{/str}}
91
                            </a>
92
                        </li>
93
                        <li class="dropdown-item">
94
                            <a href="{{pluginbaseurl}}/template_plans.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">
95
                                {{#pix}}t/add{{/pix}} {{#str}}createlearningplans, tool_lp{{/str}}
96
                            </a>
97
                        </li>
98
                        <li class="dropdown-item">
99
                            <a href="{{pluginbaseurl}}/template_cohorts.php?id={{id}}&amp;pagecontextid={{pagecontextid}}">
100
                                {{#pix}}t/add{{/pix}} {{#str}}addcohortstosync, tool_lp{{/str}}
101
                            </a>
102
                        </li>
103
                        <li class="dropdown-item">
104
                            <a data-action="deletetemplate" data-templateid="{{id}}" href="#">
105
                                {{#pix}}t/delete{{/pix}} {{#str}}delete{{/str}}
106
                            </a>
107
                        </li>
108
                    </ul>
109
                </li>
110
            </ul>
111
            {{/canmanage}}
112
            </td>
113
        </tr>
114
        {{/templates}}
115
    </tbody>
116
</table>
117
{{^templates}}
118
<p class="alert alert-info">
119
    {{#str}}notemplates, tool_lp{{/str}}
120
</p>
121
{{/templates}}
122
 
123
{{#js}}
124
// Initialise the JS.
125
require(['tool_lp/templateactions',
126
         'tool_lp/menubar'],
127
        function(actionsMod, menubar) {
128
 
129
    actionsMod.init({{pagecontextid}});
130
 
131
    menubar.enhance('.templateactions', {
132
        '[data-action="deletetemplate"]': actionsMod.deleteHandler,
133
        '[data-action="duplicatetemplate"]': actionsMod.duplicateHandler
134
    });
135
});
136
 
137
{{/js}}
138
 
139
</div>