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_lpmigrate/migrate_frameworks_results
19
20    Migrate frameworks results.
21
22    Classes required for JS:
23    * none
24
25    Data attributes required for JS:
26    * data-action="competency-dialogue"
27    * data-id
28    * data-region="migration-results"
29
30    Context variables required for this template:
31    * coursesfound
32    * cmsfound
33    * ccmigrationscount
34    * ccremovalscount
35    * mcmigrationscount
36    * mcremovalscount
37    * mappingsmissingcount
38    * warningcount
39    * errorcount
40
41    Example context (json):
42    {
43        "ccmigrationscount": 2,
44        "ccremovalscount": 3,
45        "cmsfound": 4,
46        "coursesfound": 3,
47        "errorcount": 1,
48        "errors": [{
49            "message": "This is a generic error",
50            "course": "The course A",
51            "cm": "The course module B",
52            "competency": "The competency C",
53            "competencyid": "1"
54        }],
55        "frameworkfrom": {
56            "id": 1,
57            "shortname": "Framework X"
58        },
59        "frameworkto": {
60            "id": 2,
61            "shortname": "Framework Y"
62        },
63        "hasunmappedfrom": 1,
64        "hasunmappedto": 1,
65        "mappingsmissingcount": 1,
66        "mcmigrationscount": 4,
67        "mcremovalscount": 5,
68        "unmappedfrom": [{
69            "id": 2,
70            "shortname": "Competency U1",
71            "idnumber": "CU1"
72        }],
73        "unmappedto": [{
74            "id": 3,
75            "shortname": "Competency Z2",
76            "idnumber": "CZ2"
77        }],
78        "warningcount": 1,
79        "warnings": [{
80            "message": "This is a generic warning",
81            "course": "The course D",
82            "cm": "The course module E",
83            "competency": "The competency F",
84            "competencyid": "1"
85        }]
86    }
87
88}}
89
90<div data-region="migration-results">
91    <h3>{{#str}}results, tool_lpmigrate{{/str}}</h3>
92    <dl>
93        <dt>{{#str}}coursesfound, tool_lpmigrate{{/str}}</dt>
94        <dd>{{coursesfound}}</dd>
95        <dt>{{#str}}coursemodulesfound, tool_lpmigrate{{/str}}</dt>
96        <dd>{{cmsfound}}</dd>
97        <dt>{{#str}}coursecompetencymigrations, tool_lpmigrate{{/str}}</dt>
98        <dd>+{{ccmigrationscount}} -{{ccremovalscount}}</dd>
99        <dt>{{#str}}coursemodulecompetencymigrations, tool_lpmigrate{{/str}}</dt>
100        <dd>+{{mcmigrationscount}} -{{mcremovalscount}}</dd>
101        <dt>{{#str}}missingmappings, tool_lpmigrate{{/str}}</dt>
102        <dd>{{mappingsmissingcount}}</dd>
103        <dt>{{#str}}warnings, tool_lpmigrate{{/str}}</dt>
104        <dd>{{warningcount}}</dd>
105        <dt>{{#str}}errors, tool_lpmigrate{{/str}}</dt>
106        <dd>{{errorcount}}</dd>
107    </dl>
108
109    {{#hasunmappedfrom}}
110    <h4>{{#str}}unmappedin, tool_lpmigrate, {{frameworkfrom.shortname}}{{/str}}</h4>
111    <ul>
112        {{#unmappedfrom}}
113            <li><a href="#" data-id="{{id}}" data-action="competency-dialogue" data-includecourses="true">{{{shortname}}}</a> <em>{{idnumber}}</em></li>
114        {{/unmappedfrom}}
115    </ul>
116    {{/hasunmappedfrom}}
117
118    {{#hasunmappedto}}
119    <h4>{{#str}}unmappedin, tool_lpmigrate, {{frameworkto.shortname}}{{/str}}</h4>
120    <ul>
121        {{#unmappedto}}
122            <li><a href="#" data-id="{{id}}" data-action="competency-dialogue" data-includecourses="true">{{{shortname}}}</a> <em>{{idnumber}}</em></li>
123        {{/unmappedto}}
124    </ul>
125    {{/hasunmappedto}}
126
127    {{#warningcount}}
128    <h4>{{#str}}warnings, tool_lpmigrate{{/str}}</h4>
129    <ul>
130        {{#warnings}}
131            <li>
132                <p>
133                    {{message}}<br>
134                    <small>{{course}} {{#cm}} - {{cm}} {{/cm}} - <a href="#" data-id="{{competencyid}}" data-action="competency-dialogue" data-includecourses="true">{{competency}}</a></small>
135                </p>
136            </li>
137        {{/warnings}}
138    </ul>
139    {{/warningcount}}
140
141    {{#errorcount}}
142    <h4>{{#str}}errors, tool_lpmigrate{{/str}}</h4>
143    <ul>
144        {{#errors}}
145            <li>
146                <p>
147                    {{message}}<br>
148                    <small>{{course}} {{#cm}} - {{cm}} {{/cm}} - <a href="#" data-id="{{competencyid}}" data-action="competency-dialogue" data-includecourses="true">{{competency}}</a></small>
149                </p>
150            </li>
151        {{/errors}}
152    </ul>
153    {{/errorcount}}
154</div>
155<div>
156    <p>
157        <a href="{{pluginbaseurl}}/frameworks.php" class="btn btn-primary">{{#str}}migratemore, tool_lpmigrate{{/str}}</a>
158        <a href="{{frameworksurl}}" class="btn">{{#str}}continuetoframeworks, tool_lpmigrate{{/str}}</a>
159    </p>
160</div>
161{{#js}}
162require(['tool_lp/competencydialogue'], function(Compdialogue) {
163    Compdialogue.init();
164});
165{{/js}}
166