Commit 3dc33059 authored by Andrew Nicols's avatar Andrew Nicols
Browse files

Merge branch 'wip_MDL-57590_master_forum_search' of https://github.com/mchurchward/moodle

parents c5bd22b1 d679a45f
......@@ -53,6 +53,8 @@ class big_search_form implements renderable, templatable {
public $subject;
public $user;
public $words;
/** @var string The URL of the search form. */
public $actionurl;
/**
* Constructor.
......@@ -65,6 +67,7 @@ class big_search_form implements renderable, templatable {
$this->course = $course;
$this->scripturl = new moodle_url('/mod/forum/forum.js');
$this->showfullwords = $DB->get_dbfamily() == 'mysql' || $DB->get_dbfamily() == 'postgres';
$this->actionurl = new moodle_url('/mod/forum/search.php');
$forumoptions = ['' => get_string('allforums', 'forum')] + forum_menu_list($course);
$this->forumoptions = array_map(function($option) use ($forumoptions) {
......@@ -161,6 +164,7 @@ class big_search_form implements renderable, templatable {
$data->subject = $this->subject;
$data->user = $this->user;
$data->showfullwords = $this->showfullwords;
$data->actionurl = $this->actionurl->out(false);
$datefrom = $this->datefrom;
if (empty($datefrom)) {
......
......@@ -15,7 +15,38 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template mod_forum/big_search_form
Big search form.
Example context (json):
{
"scripturl": "https://example.com/mod/forum/forum.js",
"actionurl": "https://example.com/mod/forum/search.php",
"courseid": "2",
"words": "apples",
"phrase": "Lorem ipsum dolor",
"notwords": "Not these words",
"showfullwords": [
{
"fullwords": "Exactly"
}
],
"datefromchecked": 1,
"datetochecked": "",
"forumoptions": [
{
"name": "Forum One",
"value": "23"
},
{
"name": "Forum Two",
"value": "34"
}
],
"subject": "Help me please",
"user": "Helpy McUser"
}
}}
<div id="intro" class="box searchbox boxaligncenter">
{{#str}}searchforumintro, forum{{/str}}
......@@ -92,7 +123,7 @@
<label for="menuforumid">{{#str}}searchwhichforums, forum{{/str}}</label>
</td>
<td class="c1">
<select name="menuforumid" id="menuforumid">
<select name="forumid" id="menuforumid">
{{#forumoptions}}
<option value="{{value}}">{{name}}</option>
{{/forumoptions}}
......
......@@ -15,7 +15,38 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template mod_forum/big_search_form
Big search form.
Example context (json):
{
"scripturl": "https://example.com/mod/forum/forum.js",
"actionurl": "https://example.com/mod/forum/search.php",
"courseid": "2",
"words": "apples",
"phrase": "Lorem ipsum dolor",
"notwords": "Not these words",
"showfullwords": [
{
"fullwords": "Exactly"
}
],
"datefromchecked": 1,
"datetochecked": "",
"forumoptions": [
{
"name": "Forum One",
"value": "23"
},
{
"name": "Forum Two",
"value": "34"
}
],
"subject": "Help me please",
"user": "Helpy McUser"
}
}}
<div id="intro" class="box searchbox boxaligncenter">
{{#str}}searchforumintro, forum{{/str}}
......@@ -92,7 +123,7 @@
<label for="menuforumid">{{#str}}searchwhichforums, forum{{/str}}</label>
</td>
<td class="c1">
<select name="menuforumid" id="menuforumid" class="form-control">
<select name="forumid" id="menuforumid" class="form-control">
{{#forumoptions}}
<option value="{{value}}">{{name}}</option>
{{/forumoptions}}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment