14bfba8428bd7aea1a8b694dbec619f7ee972973
[moodle.git] / admin / tool / policy / templates / page_agreedocs.mustache
1 {{!
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/>.
16 }}
17 {{!
18     @template tool_policy/page_agreedocs
20     Template for showing to the user the policy docs to agree.
22     Classes required for JS:
23     * policyactions
25     Data attributes required for JS:
26     -
28     Context variables required for this template:
29     * pluginbaseurl
30     * myurl
31     * sesskey
32     * policies - policy array
33     * behalfuser - If behalfid is defined and valid, full name of the behalf user with a link to his/her profile; null otherwise
36     Example context (json):
37     {
38         "myurl": "/admin/tool/policy/index.php",
39         "sesskey": "123456",
40         "behalfuser": "Sam Student",
41         "policies": [
42             {
43                 "id": 1,
44                 "name": "Terms &amp; conditions",
45                 "policymodal": "<a href=\"#\">Terms &amp; conditions</a>",
46                 "summary": "Policy <u>summary</u>",
47                 "versionagreed": false,
48                 "versionlangsagreed": "Agreed",
49                 "versionbehalfsagreed": ""
50             }
51         ]
52     }
54 }}
56 {{#messages}}{{{.}}}{{/messages}}
58 <form id="agreedocsform" method="post" action="{{myurl}}">
59     <input type="hidden" name="sesskey" value="{{sesskey}}">
61 {{#behalfuser}}
62 <div class="clearfix">
63     <div class="pull-right mb-2">
64         {{# str }} viewconsentpageforuser, tool_policy, {{{ . }}} {{/ str }}
65     </div>
66 </div>
67 {{/behalfuser}}
69 <div class="clearfix">
70     <div class="pull-left">
71         <h2>{{# str }}consentpagetitle, tool_policy{{/ str }}</h2>
72     </div>
73 </div>
75 <div class="clearfix mt-2">
76     <h3>{{# str }}agreepolicies, tool_policy {{/ str }}</h3>
77 </div>
78 <hr>
81 {{#policies}}
83 <input value="{{id}}" name="listdoc[]" type="hidden">
85 <div class="agreedoc-policy clearfix mt-2 mb-1">
86     <h3>{{{name}}}</h3>
87     <div class="agreedoc-content">
88         <div class="agreedoc-summary mb-2">
89           {{{summary}}}
90         </div>
91         <div class="agreedoc-msg">
92             {{# str }}refertofullpolicytext, tool_policy, {{{policymodal}}} {{/ str }}
93         </div>
94         <div class="agreedoc-form mt-1">
95             {{#optional}}
96             <div class="agreedoc-radios">
97                 <div class="agreedoc-radios-1">
98                     <label>
99                         <input type="radio" name="status{{id}}" value="1" {{#versionagreed}}checked="{{.}}"{{/versionagreed}}>
100                         {{# str }}iagree, tool_policy, {{{name}}} {{/ str }}
101                     </label>
102                 </div>
103                 <div class="agreedoc-radios-0">
104                     <label>
105                         <input type="radio" name="status{{id}}" value="0" {{#versiondeclined}}checked="{{.}}"{{/versiondeclined}}>
106                         {{# str }}idontagree, tool_policy, {{{name}}} {{/ str }}
107                     </label>
108                 </div>
109             </div>
110             {{/optional}}
111             {{^optional}}
112             <div class="agreedoc-checkbox">
113                 <label>
114                     <input value="1" name="status{{id}}" {{#versionagreed}}checked="{{.}}"{{/versionagreed}} type="checkbox">
115                     {{# str }}iagree, tool_policy, {{{name}}} {{/ str }}
116                     <i class="icon fa fa-exclamation-circle text-danger fa-fw" title="{{# str }} required {{/ str }}" ></i>
117                 </label>
118             </div>
119             <ul class="agreedoc-msg list-unstyled">
120                     {{#versionlangsagreed}}
121                         <li><small>{{{.}}}</small></li>
122                     {{/versionlangsagreed}}
123                     {{#versionbehalfsagreed}}
124                         <li><small>{{{.}}}</small></li>
125                     {{/versionbehalfsagreed}}
126             </ul>
127             {{/optional}}
128         </div>
129     </div>
130 </div>
132 {{/policies}}
134 {{# str }}somefieldsrequired, form, <i class="icon fa fa-exclamation-circle text-danger fa-fw" title="{{# str }} required {{/ str }}" ></i>{{/ str }}
135 <hr>
137 <input type="submit" class="btn btn-primary" name="submit" value={{#quote}}{{#str}} next {{/str}}{{/quote}}>
138 {{#cancancel}}
139 <input type="submit" class="btn btn-secondary" name="cancel" value={{#quote}}{{#str}} cancel {{/str}}{{/quote}}>
140 {{/cancancel}}
141 </form>
143 {{#js}}
144 // Initialise the JS for the modal window which displays the policy versions.
145 require(['tool_policy/policyactions'], function(ActionsMod) {
146     ActionsMod.init();
147 });
148 {{/js}}