Merge branch 'wip_MDL-57590_master_forum_search' of https://github.com/mchurchward...
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 18 Jan 2017 00:36:58 +0000 (08:36 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 18 Jan 2017 00:36:58 +0000 (08:36 +0800)
mod/forum/classes/output/big_search_form.php
mod/forum/templates/big_search_form.mustache
theme/boost/templates/mod_forum/big_search_form.mustache

index 6a983d6..e2bd7ce 100644 (file)
@@ -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)) {
index 373694e..ffdc388 100644 (file)
     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}}
                     <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}}
index 18ddbc6..3e96080 100644 (file)
     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}}
                     <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}}