aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-01-31 18:36:25 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-01-31 18:36:25 +0000
commit3b289dfbfd66fe63b1b596d9c451c848d1302840 (patch)
tree1e88b600468426b67bdfa5ec683246051f418388 /h-source/Application/Controllers
parent3a60b2a5bf93cdff491a0840606f3cf2c4cff151 (diff)
improved search page
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/SearchController.php39
1 files changed, 26 insertions, 13 deletions
diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php
index b35ee45..21b3a2e 100644
--- a/h-source/Application/Controllers/SearchController.php
+++ b/h-source/Application/Controllers/SearchController.php
@@ -110,13 +110,13 @@ class SearchController extends BaseController
$data['notice'] = null;
$lspci = $this->request->post('lspci','','sanitizeHtml');
+ $lspciResult = array();
+ $flag = false;
+
if (strlen($lspci)<10000)
{
- $flag = false;
-
$lspci = nl2br($lspci);
$lspciArray = explode('<br />',$lspci);
- $lspciResult = array();
reset($lspciArray);
while(current($lspciArray) !== false)
{
@@ -208,25 +208,38 @@ class SearchController extends BaseController
}
next($lspciArray);
}
+ if (count($lspciResult) === 0)
+ {
+ $data['notice'] = "<div class='alert'>".gtext('the text submitted by you does not seem the lspci -vmmnn output. Please check the text and try again')."</div>\n";
+ }
}
else
{
$data['notice'] = "<div class='alert'>the lspci output is too long</div>\n";
}
+
+ $data['flag'] = $flag;
+
+ $data['table'] = array();
if ($flag)
{
- echo "<pre>";
- print_r($lspciResult);
- echo "</pre>";
+ $lspciFiltered = array();
+ $vendorIDProductIDArray = array();
+ foreach ($lspciResult as $device)
+ {
+ if (array_key_exists($device['classId'],Hardware::$deviceClasses))
+ {
+ $vendorIDProductIDArray[] = sanitizePciid($device['vendorId'].":".$device['deviceId']);
+ $lspciFiltered[] = $device;
+ }
+ }
+ $whereString = "'".implode("','",$vendorIDProductIDArray)."'";
+ $data['table'] = $this->m['HardwareModel']->select()->where(array('pci_id'=>"in($whereString)"))->send();
}
-// $clean['pciid'] = $this->request->post('lspci','','sanitizePciid');
-// $data['table'] = $this->m['HardwareModel']->clear()->select()->where(array('pci_id'=>$clean['pciid']))->send();
-// $data['recordNumber'] = 0;
-//
-// $this->append($data);
-// $this->cleverLoad('results');
-// $this->right();
+ $this->append($data);
+ $this->cleverLoad('lspci_results');
+ $this->right();
}
}
} \ No newline at end of file