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_search/result
|
|
|
19 |
|
|
|
20 |
Template which shows a search result.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Data attributes required for JS:
|
|
|
26 |
* none
|
|
|
27 |
|
|
|
28 |
Context variables required for this template:
|
|
|
29 |
* courseurl
|
|
|
30 |
* coursefullname
|
|
|
31 |
* title
|
|
|
32 |
* docurl
|
|
|
33 |
* contexturl
|
|
|
34 |
|
|
|
35 |
Optional context variables for this template:
|
|
|
36 |
* content
|
|
|
37 |
* userurl
|
|
|
38 |
* userfullname
|
|
|
39 |
* description1
|
|
|
40 |
* description2
|
|
|
41 |
* filename
|
|
|
42 |
* multiplefiles
|
|
|
43 |
* filenames
|
|
|
44 |
* itemid
|
|
|
45 |
* contextid
|
|
|
46 |
* userid
|
|
|
47 |
* timemodified
|
|
|
48 |
|
|
|
49 |
Example context (json):
|
|
|
50 |
{
|
|
|
51 |
"courseurl": "https://example.com/course/view.php?id=2",
|
|
|
52 |
"coursefullname": "Example course",
|
|
|
53 |
"title": "Example title",
|
|
|
54 |
"docurl": "https://example.com/mod/example/view.php?id=4",
|
|
|
55 |
"content": "I am content",
|
|
|
56 |
"contexturl": "https://example.com/mod/example/view.php?id=2",
|
|
|
57 |
"userurl": "https://example.com/user/profile.php?id=3",
|
|
|
58 |
"userfullname": "Example User Full Name",
|
|
|
59 |
"multiplefiles": true,
|
|
|
60 |
"filenames":
|
|
|
61 |
[
|
|
|
62 |
"file1.txt",
|
|
|
63 |
"file2.txt"
|
|
|
64 |
]
|
|
|
65 |
}
|
|
|
66 |
}}
|
|
|
67 |
<div class="result">
|
|
|
68 |
<h4 class="result-title">
|
|
|
69 |
{{#icon}}<img class="icon" alt="" src="{{{icon}}}">{{/icon}}<a href="{{{docurl}}}">{{{title}}}</a>
|
|
|
70 |
</h4>
|
|
|
71 |
{{#content}}
|
|
|
72 |
<div class="result-content">{{{content}}}</div>
|
|
|
73 |
{{/content}}
|
|
|
74 |
{{#description1}}
|
|
|
75 |
<div class="result-content">{{{description1}}}</div>
|
|
|
76 |
{{/description1}}
|
|
|
77 |
{{#description2}}
|
|
|
78 |
<div class="result-content">{{{description2}}}</div>
|
|
|
79 |
{{/description2}}
|
|
|
80 |
{{#filename}}
|
|
|
81 |
<div class="result-content-filename">
|
|
|
82 |
{{#str}}matchingfile, search, {{{filename}}}{{/str}}
|
|
|
83 |
</div>
|
|
|
84 |
{{/filename}}
|
|
|
85 |
{{#multiplefiles}}
|
|
|
86 |
<div class="result-content-filenames">
|
|
|
87 |
{{#str}}matchingfiles, search{{/str}}<br>
|
|
|
88 |
<ul class="list">
|
|
|
89 |
{{#filenames}}
|
|
|
90 |
<li><span class="filename">{{.}}</span></li>
|
|
|
91 |
{{/filenames}}
|
|
|
92 |
</ul>
|
|
|
93 |
</div>
|
|
|
94 |
{{/multiplefiles}}
|
|
|
95 |
<div class="result-context-info">
|
|
|
96 |
<a href="{{{contexturl}}}">{{#str}}viewresultincontext, search{{/str}}</a> -
|
|
|
97 |
<a href="{{{courseurl}}}">{{#str}}incourse, search, {{{coursefullname}}}{{/str}}</a>
|
|
|
98 |
{{#userfullname}}
|
|
|
99 |
- <a href="{{{userurl}}}">{{#str}}byname, moodle, {{{userfullname}}}{{/str}}</a>
|
|
|
100 |
{{/userfullname}}
|
|
|
101 |
</div>
|
|
|
102 |
</div>
|