diff --git a/out/out.Search.php b/out/out.Search.php index bece5aae0..7d0dbad29 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -149,6 +149,27 @@ if($fullsearch) { } } + /* Creation date {{{ */ + $createstartts = null; + $createstartdate = null; + $createendts = null; + $createenddate = null; + if(!empty($_GET["createstart"])) { + $createstartts = makeTsFromDate($_GET["createstart"]); + $createstartdate = array('year'=>(int)date('Y', $createstartts), 'month'=>(int)date('m', $createstartts), 'day'=>(int)date('d', $createstartts), 'hour'=>0, 'minute'=>0, 'second'=>0); + } + if ($createstartdate && !checkdate($createstartdate['month'], $createstartdate['day'], $createstartdate['year'])) { + UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); + } + if(!empty($_GET["createend"])) { + $createendts = makeTsFromDate($_GET["createend"]); + $createenddate = array('year'=>(int)date('Y', $createendts), 'month'=>(int)date('m', $createendts), 'day'=>(int)date('d', $createendts), 'hour'=>23, 'minute'=>59, 'second'=>59); + } + if ($createenddate && !checkdate($createenddate['month'], $createenddate['day'], $createenddate['year'])) { + UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); + } + /* }}} */ + // status if(isset($_GET['status'])) $status = $_GET['status']; @@ -200,7 +221,7 @@ if($fullsearch) { $terms = $index->terms($_GET['query'], $settings->_suggestTerms); } $lucenesearch = $fulltextservice->Search(); - $searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder, 'attributes'=>$attributes), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1)))); + $searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder, 'created_start'=>$createstartts, 'created_end'=>$createendts, 'attributes'=>$attributes), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1)))); if($searchresult === false) { $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm'))); $dcount = 0; diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 532cb4c3c..2ea2d2cc8 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -794,6 +794,14 @@ $(document).ready(function() { ) ); $this->formField(getMLText("under_folder"), $this->getFolderChooserHtml("form1", M_READ, -1, $startfolder, 'folderfullsearchid')); + $this->formField( + getMLText("creation_date")." (".getMLText('from').")", + $this->getDateChooser($createstartdate, "createstart", $this->params['session']->getLanguage()) + ); + $this->formField( + getMLText("creation_date")." (".getMLText('to').")", + $this->getDateChooser($createenddate, "createend", $this->params['session']->getLanguage()) + ); if(!isset($facets['owner'])) { $options = array(); foreach ($allUsers as $currUser) {