43 |
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 local_listcoursefiles/view
|
|
|
19 |
|
|
|
20 |
List course files layout template.
|
|
|
21 |
|
|
|
22 |
Context variables required for this template:
|
|
|
23 |
* course_selection_html - HTML snippet for course select drop-down menu
|
|
|
24 |
* component_selection_html - HTML snippet for file component select drop-down menu
|
|
|
25 |
* file_type_selection_html - HTML snippet for file type select drop-down menu
|
|
|
26 |
* paging_bar_html - HTML paging bar snippet from OUTPUT
|
|
|
27 |
* url - Form post URL
|
|
|
28 |
* sesskey - Sesskey string
|
|
|
29 |
* files - array of files.
|
|
|
30 |
* files_exist - boolean
|
|
|
31 |
* change_license_allowed - boolean, can the user change the file license
|
|
|
32 |
* download_allowed - boolean, can the user download files
|
|
|
33 |
* license_select_html - HTML snippet for license select drop-down menu
|
|
|
34 |
|
|
|
35 |
Example context (json):
|
|
|
36 |
{
|
|
|
37 |
"course_selection_html" : "",
|
|
|
38 |
"component_selection_html" : "",
|
|
|
39 |
"file_type_selection_html" : "",
|
|
|
40 |
"paging_bar_html" : "",
|
|
|
41 |
"url" : "https://mymoodle.invalid/local/listcoursefiles/index.php?courseid=34",
|
|
|
42 |
"sesskey" : "lDMLz7xAGt",
|
|
|
43 |
"files" : [{
|
|
|
44 |
"fileexpired" : 0,
|
|
|
45 |
"filename" : "my_picture.png",
|
|
|
46 |
"fileurl" : "",
|
|
|
47 |
"filesize" : "516.1KB",
|
|
|
48 |
"filecomponent" : "Course",
|
|
|
49 |
"filecomponenturl" : "",
|
|
|
50 |
"filetype" : "Image",
|
|
|
51 |
"filelicense" : "Creative Commons - NoDerivs",
|
|
|
52 |
"fileuploader" : "Admin User",
|
|
|
53 |
"fileused" : "Yes"
|
|
|
54 |
}],
|
|
|
55 |
"files_exist" : 3,
|
|
|
56 |
"change_license_allowed" : 1,
|
|
|
57 |
"download_allowed" : 1,
|
|
|
58 |
"license_select_html" : ""
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
}}
|
|
|
62 |
<div class="local_listcoursefiles_menu">
|
|
|
63 |
<div class="local_listcoursefiles_selection">
|
|
|
64 |
{{#str}}mycourses{{/str}}: {{{course_selection_html}}}
|
|
|
65 |
</div>
|
|
|
66 |
<div class="local_listcoursefiles_selection">
|
|
|
67 |
{{#str}}filter_components,local_listcoursefiles{{/str}}: {{{component_selection_html}}}
|
|
|
68 |
</div>
|
|
|
69 |
<div class="local_listcoursefiles_selection">
|
|
|
70 |
{{#str}}filter_filetype,local_listcoursefiles{{/str}}: {{{file_type_selection_html}}}
|
|
|
71 |
</div>
|
|
|
72 |
</div>
|
|
|
73 |
|
|
|
74 |
<div class="local_listcoursefiles_description">
|
|
|
75 |
{{#str}}description,local_listcoursefiles{{/str}}
|
|
|
76 |
</div>
|
|
|
77 |
|
|
|
78 |
{{#files_exist}}
|
|
|
79 |
{{{paging_bar_html}}}
|
|
|
80 |
|
|
|
81 |
<a href="javascript:void(0);" class="local_listcoursefiles_check_uncheck_all">{{#str}}check_uncheck_all,local_listcoursefiles{{/str}}</a>
|
|
|
82 |
<form action="{{{url}}}" method="post" id="filelist">
|
|
|
83 |
<input name="sesskey" type="hidden" value="{{{sesskey}}}" />
|
|
|
84 |
|
|
|
85 |
<table class="local_listcoursefiles_table generaltable">
|
|
|
86 |
<thead>
|
|
|
87 |
<tr>
|
|
|
88 |
<th class="header c0" scope="col"></th>
|
|
|
89 |
<th class="header c1" scope="col">{{#str}}filename,local_listcoursefiles{{/str}}</th>
|
|
|
90 |
<th class="header c2" scope="col">{{#str}}filesize,local_listcoursefiles{{/str}}</th>
|
|
|
91 |
<th class="header c3" scope="col">{{#str}}component,local_listcoursefiles{{/str}}</th>
|
|
|
92 |
<th class="header c4" scope="col">{{#str}}mimetype,local_listcoursefiles{{/str}}</th>
|
|
|
93 |
<th class="header c5" scope="col">{{#str}}license,local_listcoursefiles{{/str}}</th>
|
|
|
94 |
<th class="header c6" scope="col">{{#str}}uploader,local_listcoursefiles{{/str}}</th>
|
|
|
95 |
<th class="header c7 lastcol" scope="col">{{#str}}used,local_listcoursefiles{{/str}}</th>
|
|
|
96 |
</tr>
|
|
|
97 |
</thead>
|
|
|
98 |
<tbody>
|
|
|
99 |
{{#files}}
|
|
|
100 |
<tr>
|
|
|
101 |
<td class="cell c0" style="text-align:left;">
|
|
|
102 |
<input type="checkbox" class="local_listcoursefiles_filecheckbox" name="file[{{fileid}}]" />
|
|
|
103 |
{{#fileexpired}}
|
|
|
104 |
<span class="local_listcoursefiles_file_expired">
|
|
|
105 |
{{#pix}}i/warning, core, {{#str}}file_expired,local_listcoursefiles{{/str}}{{/pix}}
|
|
|
106 |
</span>
|
|
|
107 |
{{/fileexpired}}
|
|
|
108 |
</td>
|
|
|
109 |
<td class="cell c1">
|
|
|
110 |
{{#fileurl}}
|
|
|
111 |
<a href="{{{fileurl}}}">{{filename}}</a>
|
|
|
112 |
{{/fileurl}}
|
|
|
113 |
{{^fileurl}}
|
|
|
114 |
{{filename}}
|
|
|
115 |
{{/fileurl}}
|
|
|
116 |
</td>
|
|
|
117 |
<td class="cell c2">{{filesize}}</td>
|
|
|
118 |
<td class="cell c3">
|
|
|
119 |
{{#filecomponenturl}}
|
|
|
120 |
<a href="{{{filecomponenturl}}}">{{filecomponent}}</a>
|
|
|
121 |
{{/filecomponenturl}}
|
|
|
122 |
{{^filecomponenturl}}
|
|
|
123 |
{{filecomponent}}
|
|
|
124 |
{{/filecomponenturl}}
|
|
|
125 |
{{#fileediturl}}<a href="{{fileediturl}}"><i class="icon fa fa-cog fa-fw" aria-hidden="true"></i></a>{{/fileediturl}}
|
|
|
126 |
</td>
|
|
|
127 |
<td class="cell c4">{{filetype}}</td>
|
|
|
128 |
<td class="cell c5">{{{filelicense}}}</td>
|
|
|
129 |
<td class="cell c6">{{fileuploader}}</td>
|
|
|
130 |
<td class="cell c7 lastcol"><span class="fileused">{{fileused}}</span></td>
|
|
|
131 |
</tr>
|
|
|
132 |
{{/files}}
|
|
|
133 |
</table>
|
|
|
134 |
|
|
|
135 |
{{{paging_bar_html}}}
|
|
|
136 |
|
|
|
137 |
<div class="local_listcoursefiles_files_actions">
|
|
|
138 |
{{#download_allowed}}
|
|
|
139 |
<div class="local_listcoursefiles_files_action">
|
|
|
140 |
<button class="btn btn-secondary" type="submit" name="action" value="download">
|
|
|
141 |
{{#str}}zip_download,local_listcoursefiles{{/str}}
|
|
|
142 |
</button>
|
|
|
143 |
</div>
|
|
|
144 |
{{/download_allowed}}
|
|
|
145 |
{{#change_license_allowed}}
|
|
|
146 |
<div class="local_listcoursefiles_files_action">
|
|
|
147 |
<button class="btn btn-secondary" type="submit" name="action" value="change_license">
|
|
|
148 |
{{#str}}change_license,local_listcoursefiles{{/str}}
|
|
|
149 |
</button>
|
|
|
150 |
{{{license_select_html}}}
|
|
|
151 |
</div>
|
|
|
152 |
{{/change_license_allowed}}
|
|
|
153 |
|
|
|
154 |
</div>
|
|
|
155 |
|
|
|
156 |
</form>
|
|
|
157 |
|
|
|
158 |
{{/files_exist}}
|
|
|
159 |
{{^files_exist}}
|
|
|
160 |
<b>{{#str}}nothingfound,local_listcoursefiles{{/str}}</b>
|
|
|
161 |
{{/files_exist}}
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
{{#js}}
|
|
|
165 |
require(['jquery'], function($) {
|
|
|
166 |
var nextstatus = true;
|
|
|
167 |
$('.local_listcoursefiles_check_uncheck_all').click(function() {
|
|
|
168 |
$('input:checkbox').prop('checked', nextstatus);
|
|
|
169 |
nextstatus = !nextstatus;
|
|
|
170 |
});
|
|
|
171 |
});
|
|
|
172 |
{{/js}}
|