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
    @template core_grades/user_selector
19
 
20
    The user selector trigger element.
21
 
22
    Context variables required for this template:
23
    * name - The name of the user selector element
24
    * userid - The value of the user selector element (id of the preselected user)
25
    * courseid - The course ID.
26
    * groupid - The group ID.
27
    * selectedoption - (optional) Object containing information about the selected option.
28
        * image - The image corresponding to the selected option.
29
        * text - The text of the selected option.
30
        * additionaltext - (optional) Additional text displayed below the selected option (e.g. the user email)
31
 
32
    Example context (json):
33
    {
34
        "name": "userid",
35
        "userid": "21",
36
        "courseid": "2",
37
        "groupid": "2",
38
        "selectedoption": {
39
            "image": "<img src=\"http://example.com/pluginfile.php/14/user/icon/boost/f2\" class=\"userpicture\" width=\"40\" alt=\"\">",
40
            "text": "John Doe",
41
            "additionaltext": "johndoe@example.com"
42
        }
43
    }
44
}}
45
<div class="search-widget dropdown d-flex" data-searchtype="user">
46
    <div
47
        tabindex="0"
48
        aria-expanded="false"
49
        role="combobox"
50
        aria-haspopup="dialog"
51
        aria-controls="dialog-{{uniqid}}"
52
        data-toggle="dropdown"
53
        class="btn dropdown-toggle d-flex text-left align-items-center p-0"
54
        data-courseid="{{courseid}}"
55
        data-groupid="{{groupid}}"
56
        aria-label="{{#cleanstr}} selectauser, core_grades {{/cleanstr}}"
57
        data-input-element="input-{{uniqid}}"
58
    >
59
        <div class="align-items-center d-flex">
60
            {{#selectedoption}}
61
                <div class="selected-option-img d-block mr-2" aria-hidden="true">
62
                    {{#image}}
63
                        {{{image}}}
64
                    {{/image}}
65
                    {{^image}}
66
                        <span class="userinitials"></span>
67
                    {{/image}}
68
                </div>
69
                <div class="selected-option-info d-block pr-3 text-truncate">
70
                    <span class="selected-option-text p-0 font-weight-bold">
71
                        {{text}}
72
                    </span>
73
                    {{#additionaltext}}
74
                        <span class="d-block small">
75
                            {{additionaltext}}
76
                        </span>
77
                    {{/additionaltext}}
78
                </div>
79
            {{/selectedoption}}
80
            {{^selectedoption}}
81
                <div class="d-block">
82
                    <span class="userinitials"></span>
83
                </div>
84
                <div class="user-info d-block pl-2 pr-3">
85
                    {{#str}} selectauser, core_grades {{/str}}
86
                </div>
87
            {{/selectedoption}}
88
        </div>
89
    </div>
90
    <div class="dropdown-menu wide" id="dialog-{{uniqid}}" role="dialog" aria-modal="true" aria-label="{{#cleanstr}} selectauser, core_grades {{/cleanstr}}">
91
    </div>
92
    <input type="hidden" name="{{name}}" value="{{userid}}" id="input-{{uniqid}}" />
93
</div>