add new methode typeahead() which is to replace the restapi method

This commit is contained in:
Uwe Steinmann 2020-11-30 15:41:33 +01:00
parent 5c9ddac11d
commit d64af2b3b1

View File

@ -65,6 +65,26 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
$this->printClickFolderJs();
} /* }}} */
function typeahead() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$query = $this->params['query'];
$entries = $this->params['searchhits'];
$recs = array();
if($entries) {
foreach ($entries as $entry) {
if($entry->isType('document')) {
$recs[] = 'D'.$entry->getName();
} elseif($entry->isType('folder')) {
$recs[] = 'F'.$entry->getName();
}
}
}
array_unshift($recs, ' '.$query);
header('Content-Type: application/json');
echo json_encode($recs);
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];