aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMichael Große <grosse@cosmocode.de>2018-03-19 17:56:23 +0100
committerMichael Große <grosse@cosmocode.de>2018-03-19 17:56:23 +0100
commit427ed988282f72cb160d09b0830f843d462cc93a (patch)
tree07394987b6d940d3de477f113aaa410f70eb2946
parent21fcef82b754bee0920be30454d93aca097b5b00 (diff)
downloaddokuwiki-427ed988282f72cb160d09b0830f843d462cc93a.tar.gz
dokuwiki-427ed988282f72cb160d09b0830f843d462cc93a.zip
feat(Search): Add search form on results page
Add the search form on the results page itself. This form will be used to add more options to refine the search further.
-rw-r--r--inc/Ui/Search.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/inc/Ui/Search.php b/inc/Ui/Search.php
index da030d5a2..bff33cae5 100644
--- a/inc/Ui/Search.php
+++ b/inc/Ui/Search.php
@@ -2,6 +2,8 @@
namespace dokuwiki\Ui;
+use \dokuwiki\Form\Form;
+
class Search extends Ui
{
protected $query;
@@ -38,6 +40,8 @@ class Search extends Ui
{
$searchHTML = '';
+ $searchHTML .= $this->getSearchFormHTML($this->query);
+
$searchHTML .= $this->getSearchIntroHTML($this->query);
$searchHTML .= $this->getPageLookupHTML($this->pageLookupResults);
@@ -48,6 +52,28 @@ class Search extends Ui
}
/**
+ * Get a form which can be used to adjust/refine the search
+ *
+ * @param string $query
+ *
+ * @return string
+ */
+ protected function getSearchFormHTML($query)
+ {
+ global $lang;
+
+ $searchForm = (new Form())->attrs(['method' => 'get']);
+ $searchForm->setHiddenField('do', 'search');
+
+ $searchForm->addFieldsetOpen();
+ $searchForm->addTextInput('id', '')->val($query);
+ $searchForm->addButton('', $lang['btn_search'])->attr('type', 'submit');
+ $searchForm->addFieldsetClose();
+
+ return $searchForm->toHTML();
+ }
+
+ /**
* Build the intro text for the search page
*
* @param string $query the search query
@@ -69,7 +95,6 @@ class Search extends Ui
return $intro;
}
-
/**
* Build HTML for a list of pages with matching pagenames
*