Implement an actual search for the search autocomplete

feature/core
Sven Slootweg 11 years ago
parent b6d0d9eb14
commit aca2f4543c

@ -13,6 +13,8 @@
if(!isset($_APP)) { die("Unauthorized."); } if(!isset($_APP)) { die("Unauthorized."); }
$sNodes = Node::CreateFromQuery("SELECT * FROM nodes WHERE `LatestRevision` = 1 AND `Name` LIKE :Name", array("Name" => "%{$_GET['q']}%"));
$sOriginalData = array( $sOriginalData = array(
array( array(
"name" => "ChicagoVPS", "name" => "ChicagoVPS",
@ -36,12 +38,12 @@ $sOriginalData = array(
$sData = array(); $sData = array();
foreach($sOriginalData as $sEntry) foreach($sNodes as $sNode)
{
if(strpos(strtolower($sEntry['name']), strtolower($_GET['q'])) !== false)
{ {
$sData[] = $sEntry; $sData[] = array(
} "name" => $sNode->sName,
"description" => $sNode->sNotes,
"value" => $sNode->sId,
"created" => local_from_unix($sNode->sCreationDate, $locale->date_short)
);
} }
sleep(1);

Loading…
Cancel
Save