2 This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 Manage learning plan templates template.
20 Classes required for JS:
25 Data attibutes required for JS:
26 * data-region = managetemplates
27 * data-templateid = id
28 * data-action = deletetemplate
30 Context variables required for this template:
31 * templates - array of objects containing id, shortname, visible, canmanage, contextname
32 * navigation - array of strings containing buttons for navigation
34 <div data-region="managetemplates">
35 <div class="pull-left">
40 <table class="generaltable fullwidth managetemplates">
41 <caption>{{#str}}listtemplatescaption, tool_lp{{/str}}</caption>
44 <th scope="col">{{#str}}templatename, tool_lp{{/str}}</th>
45 <th scope="col">{{#str}}category, tool_lp{{/str}}</th>
46 <th scope="col">{{#str}}cohorts, core_cohort{{/str}}</th>
47 <th scope="col">{{#str}}userplans, core_competency{{/str}}</th>
49 <th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
53 <tbody class="drag-parentnode">
55 <tr class="drag-samenode" data-templateid="{{id}}">
56 <td><a href="{{pluginbaseurl}}/templatecompetencies.php?templateid={{id}}&pagecontextid={{pagecontextid}}">{{{shortname}}}</a></span> {{^visible}}{{#str}}hiddenhint, tool_lp{{/str}}{{/visible}}</td>
57 <td>{{contextnamenoprefix}}</td>
58 <td><a class="template-cohorts" href="{{pluginbaseurl}}/template_cohorts.php?id={{id}}&pagecontextid={{pagecontextid}}">{{cohortscount}}</a></td>
59 <td><a class="template-userplans" href="{{pluginbaseurl}}/template_plans.php?id={{id}}&pagecontextid={{pagecontextid}}">{{planscount}}</a></td>
62 <ul class="templateactions">
64 <a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
65 <ul class="dropdown dropdown-menu">
66 <li class="dropdown-item">
67 <a href="{{pluginbaseurl}}/edittemplate.php?id={{id}}&pagecontextid={{pagecontextid}}&return=templates">
68 {{#pix}}t/edit{{/pix}} {{#str}}edit{{/str}}
71 <li class="dropdown-item">
72 <a data-action="duplicatetemplate" data-templateid="{{id}}" href="#">
73 {{#pix}}t/copy{{/pix}} {{#str}}duplicate{{/str}}
76 <li class="dropdown-item">
77 <a href="{{pluginbaseurl}}/template_plans.php?id={{id}}&pagecontextid={{pagecontextid}}">
78 {{#pix}}t/add{{/pix}} {{#str}}createlearningplans, tool_lp{{/str}}
81 <li class="dropdown-item">
82 <a href="{{pluginbaseurl}}/template_cohorts.php?id={{id}}&pagecontextid={{pagecontextid}}">
83 {{#pix}}t/add{{/pix}} {{#str}}addcohortstosync, tool_lp{{/str}}
86 <li class="dropdown-item">
87 <a data-action="deletetemplate" data-templateid="{{id}}" href="#">
88 {{#pix}}t/delete{{/pix}} {{#str}}delete{{/str}}
101 <p class="alert alert-info">
102 {{#str}}notemplates, tool_lp{{/str}}
107 // Initialise the JS.
108 require(['tool_lp/templateactions',
110 function(actionsMod, menubar) {
112 actionsMod.init({{pagecontextid}});
114 menubar.enhance('.templateactions', {
115 '[data-action="deletetemplate"]': actionsMod.deleteHandler,
116 '[data-action="duplicatetemplate"]': actionsMod.duplicateHandler