2 This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 @template mod_forum/big_search_form
22 Example context (json):
24 "actionurl": "https://example.com/mod/forum/search.php",
27 "phrase": "Lorem ipsum dolor",
28 "notwords": "Not these words",
31 "fullwords": "Exactly"
46 "subject": "Help me please",
47 "user": "Helpy McUser"
50 <div id="intro" class="box searchbox boxaligncenter">
51 {{#str}}searchforumintro, forum{{/str}}
53 <div class="box generalbox boxaligncenter">
54 <form id="searchform" action="{{actionurl}}" method="get">
55 <table class="searchbox table" id="form">
58 <label for="words">{{#str}}searchwords, forum{{/str}}</label>
59 <input type="hidden" value="{{courseid}}" name="id">
62 <input type="text" size="35" name="words" id="words" value="{{words}}">
67 <label for="phrase">{{#str}}searchphrase, forum{{/str}}</label>
70 <input type="text" size="35" name="phrase" id="phrase" value="{{phrase}}">
75 <label for="notwords">{{#str}}searchnotwords, forum{{/str}}</label>
78 <input type="text" size="35" name="notwords" id="notwords" value="{{notwords}}">
84 <label for="fullwords">{{#str}}searchfullwords, forum{{/str}}</label>
87 <input type="text" size="35" name="fullwords" id="fullwords" value="{{fullwords}}">
93 {{#str}}searchdatefrom, forum{{/str}}
96 <input type="checkbox" name="timefromrestrict" value="1" {{#datefromchecked}}checked{{/datefromchecked}}>
98 <input type="hidden" name="hfromday" value="0">
99 <input type="hidden" name="hfrommonth" value="0">
100 <input type="hidden" name="hfromyear" value="0">
101 <input type="hidden" name="hfromhour" value="0">
102 <input type="hidden" name="hfromminute" value="0">
107 {{#str}}searchdateto, forum{{/str}}
110 <input type="checkbox" name="timetorestrict" value="1" {{#datetochecked}}checked{{/datetochecked}}>
112 <input type="hidden" name="htoday" value="0">
113 <input type="hidden" name="htomonth" value="0">
114 <input type="hidden" name="htoyear" value="0">
115 <input type="hidden" name="htohour" value="0">
116 <input type="hidden" name="htominute" value="0">
121 <label for="menuforumid">{{#str}}searchwhichforums, forum{{/str}}</label>
124 <select name="forumid" id="menuforumid">
126 <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
133 <label for="subject">{{#str}}searchsubject, forum{{/str}}</label>
136 <input type="text" size="35" name="subject" id="subject" value="{{subject}}">
141 <label for="user">{{#str}}searchuser, forum{{/str}}</label>
144 <input type="text" size="35" name="user" id="user" value="{{user}}">
150 <label for="tags">{{#str}}searchtags, forum{{/str}}</label>
153 <select class="custom-select" name="tags[]"
156 <option value="{{value}}" {{#selected}}selected{{/selected}}>{{{text}}}</option>
163 <td colspan="2" class="submit">
164 <div class="text-center">
165 <input type="submit" value={{#quote}}{{#str}}searchforums, forum{{/str}}{{/quote}}>
173 require(['jquery'], function($) {
174 var toggleDateFields = function(prefix, disabled) {
175 $('#searchform select[name^=' + prefix + ']').prop('disabled', disabled);
176 $('#searchform input[name^=h' + prefix + ']').val(disabled ? 1 : 0);
179 toggleDateFields('from', !$("#searchform input[name='timefromrestrict']").prop('checked'));
180 $("#searchform input[name='timefromrestrict']").click(function() {
181 toggleDateFields('from', !this.checked);
184 toggleDateFields('to', !$("#searchform input[name='timetorestrict']").prop('checked'));
185 $("#searchform input[name='timetorestrict']").click(function() {
186 toggleDateFields('to', !this.checked);