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
 
19
      @template tool_supporter/user_detail
20
      Template which outputs detailed data about a user.
21
 
22
      Classes required for JS:
23
      * dataTables
24
 
25
      Context variables required for this template:
26
      * uniqueparentcategory - array: An array of unique parent categories for filtering.
27
      * uniquecategoryname - array: An array of unique categiry names for filtering.
28
      * userscourses - array of arrays: courses in which the user is enrolled in with further information
29
      * userinformation - array: Data of the user
30
      * loginaslink - array: Link to login as the user
31
      * profilelink - array: Link to the profile of the user
32
      * edituserlink - array: Link to editing the user
33
 
34
Example context (json):
35
[
36
  {
37
    "userinformation": {
38
      "id": 2,
39
      "username": "admin",
40
      "firstname": "Something",
41
      "lastname": "Something",
42
      "email": "hasbvdjh@sabdhadbvsdaj.de",
43
      "timecreated": "01.01.1970 01:01",
44
      "timemodified": "29.08.2018 08:02",
45
      "lastlogin": "07.01.2019 01:04",
46
      "lang": "de",
47
      "auth": "manual",
48
      "idnumber": "378910"
49
    },
50
    "config": {
51
      "showusername": true,
52
      "showidnumber": true,
53
      "showfirstname": true,
54
      "showlastname": true,
55
      "showmailadress": true,
56
      "showtimecreated": true,
57
      "showtimemodified": true,
58
      "showlastlogin": true
59
    },
60
    "userscourses": [
61
      {
62
        "id": 4,
63
        "category": 1,
64
        "shortname": "Kurs3",
65
        "fullname": "Kurs3",
66
        "startdate": 1535544894,
67
        "visible": 1,
68
        "level_one": "Verschiedenes",
69
        "level_two": "",
70
        "roles": [
71
          "Manager/in",
72
          "Trainer/in",
73
          "Adobe Connect-Host"
74
        ],
75
        "enrol_id": 1
76
      },
77
      {
78
        "id": 3,
79
        "category": 1,
80
        "shortname": "Kurs2",
81
        "fullname": "Kurs2",
82
        "startdate": 1535544879,
83
        "visible": 1,
84
        "level_one": "Verschiedenes",
85
        "level_two": "",
86
        "roles": [
87
          "Trainer/in ohne Bearbeitungsrecht"
88
        ],
89
        "enrol_id": 27
90
      }
91
    ],
92
    "loginaslink": "http://127.0.0.1/course/loginas.php?id=1&user=2&sesskey=H7BoGwKh63",
93
    "profilelink": "http://127.0.0.1/user/profile.php?id=2",
94
    "edituserlink": "http://127.0.0.1/user/editadvanced.php?id=2",
95
    "usernotificationpreferenceslink": "http://127.0.0.1/message/notificationpreferences.php?userid=2",
96
    "deleteuserlink": "http://127.0.0.1/admin/user.php?delete=2&sesskey=H7BoGwKh63",
97
    "uniquelevelones": [
98
      "Verschiedenes",
99
      "WiSe 2017/2018"
100
    ],
101
    "uniqueleveltwoes": [
102
      "FB 01"
103
    ],
104
    "isallowedtoupdateusers": true,
105
    "label_level_1": "Semester",
106
    "label_level_2": "Fachbereich"
107
  }
108
]
109
 
110
}}
111
<!--View details after clicking on a user in user table.  -->
112
<div style="display: none; padding-bottom: 15px" id = "user_details" data-region="user_details">
113
	<div class="card">
114
		<div class="card-header">
115
            <div class = "float-left">
116
                <a href="{{profilelink}}" target="_blank">
117
                    {{#userinformation}}
118
						<h3>{{firstname}} {{lastname}}</h3>
119
					{{/userinformation}}
120
                </a>
121
            </div>
122
 
123
			<div class="btn-group mr-2 float-right">
124
				{{#loginaslink}}
125
					<a href="{{loginaslink}}" target="_blank" class="btn btn-xs btn-secondary p-1" role="button" data-toggle="tooltip" title="{{#str}}loginas{{/str}}">
126
						{{#pix}}i/signin, tool_supporter, {{#str}}loginas{{/str}}{{/pix}}
127
					</a>
128
				{{/loginaslink}}
129
				{{#isallowedtoupdateusers}}
130
					<a href="{{edituserlink}}" target="_blank" class="btn btn-xs btn-secondary p-1" role="button" data-toggle="tooltip" title="{{#str}}edituser{{/str}}">
131
						{{#pix}} i/edit, core, {{#str}}edituser{{/str}} {{/pix}}
132
					</a>
133
					<a href="{{deleteuserlink}}" target="_blank" class="btn btn-xs btn-secondary p-1" role="button" data-toggle="tooltip" title="{{#str}}deleteuser, admin{{/str}}">
134
						{{#pix}} i/delete, core, {{#str}}deleteuser, admin{{/str}} {{/pix}}
135
					</a>
136
					<a href="{{usernotificationpreferenceslink}}" target="_blank" class="btn btn-xs btn-secondary p-1" role="button" data-toggle="tooltip" title="{{#str}}notificationpreferences, message{{/str}}">
137
						{{#pix}} i/notifications, core, {{#str}}notificationpreferences, message{{/str}} {{/pix}}
138
					</a>
139
				{{/isallowedtoupdateusers}}
140
				<a href="#" class="btn btn-xs btn-secondary p-1" role="button" id="btn_hide_user_details" data-toggle="tooltip" title="{{#str}}hide{{/str}}">
141
					{{#pix}}i/minus, tool_supporter, {{#str}}collapse{{/str}} {{/pix}}
142
				</a>
143
				<a data-toggle="tooltip" title="{{#str}}show{{/str}}" href="#" class="btn btn-xs btn-secondary p-1" id="btn_show_user_details" style="display: none">
144
					{{#pix}}i/plus, tool_supporter, {{#str}}show{{/str}} {{/pix}}
145
				</a>
146
			</div>
147
		</div>
148
 
149
	    <div class="card-block" id="user_details_body">
150
			<!-- Enrol the user into the course -->
151
			<br>
152
	        {{> tool_supporter/enrolusersection}}
153
			<br>
154
 
155
			<!-- Show user details  -->
156
	        <table class = "table borderless">
157
                <tbody>
158
                {{#userinformation}}{{#config}}
159
                    <tr><th>ID</th><td id="selecteduserid">{{id}}</td></tr>
160
                    {{#showusername}}<tr><th>{{#str}}username{{/str}}</th><td>{{username}}</td></tr>{{/showusername}}
161
                    {{#showidnumber}}<tr><th>{{#str}}idnumbermod{{/str}}</th><td>{{idnumber}}</td></tr>{{/showidnumber}}
162
                    {{#showfirstname}}<tr><th>{{#str}}firstname{{/str}}</th><td>{{firstname}}</td></tr>{{/showfirstname}}
163
                    {{#showlastname}}<tr><th>{{#str}}lastname{{/str}}</th><td>{{lastname}}</td></tr>{{/showlastname}}
164
                    {{#showmailadress}}<tr><th>{{#str}}email{{/str}}</th><td>{{email}}</td></tr>{{/showmailadress}}
165
                    {{#showtimecreated}}<tr><th>{{#str}}eventusercreated{{/str}}</th><td>{{timecreated}}</td></tr>{{/showtimecreated}}
166
                    {{#showtimemodified}}<tr><th>{{#str}}lastmodified{{/str}}</th><td>{{timemodified}}</td></tr>{{/showtimemodified}}
167
                    {{#showlastlogin}}<tr><th>{{#str}}lastlogin{{/str}}</th><td>{{lastlogin}}</td></tr>{{/showlastlogin}}
168
                    {{#showsuspension}}<tr><th>{{#str}}suspended{{/str}}</th><td>{{suspended}}</td></tr>{{/showsuspension}}
169
                    {{#showauthtype}}<tr><th>{{#str}}authentication{{/str}}</th><td>{{auth}}</td></tr>{{/showauthtype}}
170
                {{/config}}{{/userinformation}}
171
                </tbody>
172
	        </table>
173
	        <hr>
174
 
175
	        <!-- Navigation for users course table -->
176
	          <ul class="nav nav-tabs nav-justified">
177
	            <li class = "nav-item"><a class = "nav-link"><b>{{#str}}courses{{/str}}</b></a></li>
178
	            <!--filter course list by selecting wanted first level category -->
179
	            <li class="nav-item dropdown" {{^showlevel1}}hidden{{/showlevel1}}>
180
	              <a class = "nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">{{label_level_1}}<span class="caret"></span></a>
181
	              <ul class="dropdown-menu" id="user_detail_levelonedropdown">
182
	                {{#uniquelevelones}}
183
	                <li class = "dropdown-item"><input type="checkbox" value="{{{.}}}" name="user_detail_levelonecheckbox" id="user_detail_levelonecheckbox"> {{{.}}}</li>
184
	                {{/uniquelevelones}}
185
	              </ul>
186
	            </li>
187
	            <li class="nav-item dropdown" {{^showlevel2}}hidden{{/showlevel2}}>
188
	              <a class = "nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">{{label_level_2}}<span class="caret"></span></a>
189
	              <!--filter course list by selecting wanted second level category-->
190
	              <ul class="dropdown-menu" id="user_detail_leveltwodropdown">
191
	                {{#uniqueleveltwoes}}
192
	                <li class = "dropdown-item"><input type="checkbox" value="{{{.}}}" name="user_detail_leveltwocheckbox"  id="user_detail_leveltwocheckbox"> {{{.}}}</li>
193
	                {{/uniqueleveltwoes}}
194
	              </ul>
195
	            </li>
196
                  <li class="nav-item dropdown" {{^showlevel3}}hidden{{/showlevel3}}>
197
                      <a class = "nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">{{label_level_3}}<span class="caret"></span></a>
198
                      <!--filter course list by selecting wanted third level category-->
199
                      <ul class="dropdown-menu" id="user_detail_levelthreedropdown">
200
                          {{#uniquelevelthrees}}
201
                              <li class = "dropdown-item"><input type="checkbox" value="{{{.}}}" name="user_detail_levelthreecheckbox"  id="user_detail_levelthreecheckbox"> {{{.}}}</li>
202
                          {{/uniquelevelthrees}}
203
                      </ul>
204
                  </li>
205
                  <li class="nav-item dropdown" {{^showlevel4}}hidden{{/showlevel4}}>
206
                      <a class = "nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">{{label_level_4}}<span class="caret"></span></a>
207
                      <!--filter course list by selecting wanted fourth level category-->
208
                      <ul class="dropdown-menu" id="user_detail_levelfourdropdown">
209
                          {{#uniquelevelfours}}
210
                              <li class = "dropdown-item"><input type="checkbox" value="{{{.}}}" name="user_detail_levelfourcheckbox"  id="user_detail_levelfourcheckbox"> {{{.}}}</li>
211
                          {{/uniquelevelfours}}
212
                      </ul>
213
                  </li>
214
                  <li class="nav-item dropdown" {{^showlevel5}}hidden{{/showlevel5}}>
215
                      <a class = "nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">{{label_level_5}}<span class="caret"></span></a>
216
                      <!--filter course list by selecting wanted fifth level category-->
217
                      <ul class="dropdown-menu" id="user_detail_levelfivedropdown">
218
                          {{#uniquelevelfives}}
219
                              <li class = "dropdown-item"><input type="checkbox" value="{{{.}}}" name="user_detail_levelfivecheckbox"  id="user_detail_levelfivecheckbox"> {{{.}}}</li>
220
                          {{/uniquelevelfives}}
221
                      </ul>
222
                  </li>
223
	         </ul>
224
 
225
	        <!--Table showing users courses-->
226
            <div class="table table-responsive">
227
                <table class = "table stripe hover row-border" id="userdetailcourses">
228
	              <thead>
229
	                <tr>
230
	                  <th>ID</th>
231
	                  <th>{{#str}}fullnamecourse{{/str}}</th>
232
	                  <th>{{label_level_1}}</th>
233
	                  <th>{{label_level_2}}</th>
234
	                  <th>{{#str}}roles{{/str}}</th>
235
	                  <th>{{#str}}visible{{/str}}</th>
236
	                  <th></th>
237
	                </tr>
238
	              </thead>
239
	              <tbody>
240
	                {{#userscourses}}
241
	                <tr>
242
                        <td>{{id}}</td>
243
                        <td>{{fullname}}</td>
244
                        <td>{{level_one}}</td> <!-- TUD intern: Semester -->
245
                        <td>{{level_two}}</td> <!-- TUD intern: Fachbereiche -->
246
                        <td>{{roles}}</td>
247
                        <td>{{visible}}</td>
248
                        <td>
249
                            <a href="{{wwwroot}}/enrol/unenroluser.php?id={{id}}&ue={{enrol_id}}" target="_blank">
250
                                {{#pix}} i/delete, core, {{#str}}unenrol, enrol{{/str}}{{/pix}}
251
                            </a>
252
                        </td>
253
	                </tr>
254
	                {{/userscourses}}
255
	              </tbody>
256
	            </table>
257
			</div>
258
 
259
	    </div>
260
	</div>
261
</div>
262
 
263
{{#js}}
264
require(['tool_supporter/table_filter', 'tool_supporter/table_sort', 'tool_supporter/datatables',
265
         'tool_supporter/load_information'],
266
    function(search, sort, dataTable, loadInformation) {
267
 
268
        // Convert table to DataTable and add filter functionality to dropdown-menu.
269
        dataTable.useDataTable('#userdetailcourses', [['user_detail_levelonecheckbox', '#user_detail_levelonedropdown', 2],
270
                                                       ['user_detail_leveltwocheckbox', '#user_detail_leveltwodropdown', 3]]);
271
 
272
        // Load information about the clicked course.
273
        loadInformation.clickOnCourse('#userdetailcourses');
274
 
275
        loadInformation.toggleUserDetails();
276
    });
277
{{/js}}