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 |
@template core_grades/user_heading
|
|
|
19 |
|
|
|
20 |
Custom user heading.
|
|
|
21 |
|
|
|
22 |
Context variables required for this template:
|
|
|
23 |
* image - HTML img element representing the avatar of the user.
|
|
|
24 |
* userprofileurl - The URL to the user profile page.
|
|
|
25 |
* name - The name of the user
|
|
|
26 |
* buttons - List of buttons to be displayed in the heading for the user report (e.g. 'message', 'add user to contacts')
|
|
|
27 |
|
|
|
28 |
Example context (json):
|
|
|
29 |
{
|
|
|
30 |
"image": "<img src=\"http://example.com/pluginfile.php/14/user/icon/boost/f2\" class=\"userpicture\" width=\"50\" alt=\"\">",
|
|
|
31 |
"userprofileurl": "http://example.com/user/view.php?id=6&course=8",
|
|
|
32 |
"name": "John Doe",
|
|
|
33 |
"buttons": [
|
|
|
34 |
{
|
|
|
35 |
"linkattributes": [
|
|
|
36 |
{
|
|
|
37 |
"name": "role",
|
|
|
38 |
"value": "button"
|
|
|
39 |
},
|
|
|
40 |
{
|
|
|
41 |
"name": "data-userid",
|
|
|
42 |
"value": "3"
|
|
|
43 |
}
|
|
|
44 |
],
|
|
|
45 |
"title": "Message",
|
|
|
46 |
"url": "http://example.com/message/index.php?user1=2&user2=3&addcontact=3",
|
|
|
47 |
"icon": {
|
|
|
48 |
"name": "t/message",
|
|
|
49 |
"component": "core"
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
]
|
|
|
53 |
}
|
|
|
54 |
}}
|
|
|
55 |
<div class="user-heading d-flex align-items-center">
|
|
|
56 |
<div class="d-flex m-0">
|
|
|
57 |
{{{image}}}
|
|
|
58 |
</div>
|
|
|
59 |
<div class="d-flex ml-2">
|
|
|
60 |
<a class="h4 m-0" href="{{userprofileurl}}">{{name}}</a>
|
|
|
61 |
</div>
|
|
|
62 |
<div class="d-inline-flex ml-4">
|
|
|
63 |
{{#buttons}}
|
|
|
64 |
<a {{#linkattributes}} {{name}}="{{value}}" {{/linkattributes}} aria-label="{{title}}" href="{{url}}">
|
|
|
65 |
{{#icon}}
|
|
|
66 |
<span>
|
|
|
67 |
{{#pix}} {{name}}, {{component}}, {{title}} {{/pix}}
|
|
|
68 |
</span>
|
|
|
69 |
{{/icon}}
|
|
|
70 |
</a>
|
|
|
71 |
{{/buttons}}
|
|
|
72 |
</div>
|
|
|
73 |
</div>
|