From 10bbe357616c36e86ae3c3c7a26840b0c1973756 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Wed, 2 Feb 2011 14:29:55 +0000 Subject: improved search --- .../Application/Controllers/SearchController.php | 19 +++++++++++++++++++ h-source/Application/Include/hardware.php | 1 + h-source/Application/Include/languages.php | 3 +++ .../Application/Views/Search/lspci_results.php | 22 +++++++++++++++++++--- 4 files changed, 42 insertions(+), 3 deletions(-) (limited to 'h-source/Application') diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php index 21b3a2e..a65ba62 100644 --- a/h-source/Application/Controllers/SearchController.php +++ b/h-source/Application/Controllers/SearchController.php @@ -236,6 +236,25 @@ class SearchController extends BaseController } $whereString = "'".implode("','",$vendorIDProductIDArray)."'"; $data['table'] = $this->m['HardwareModel']->select()->where(array('pci_id'=>"in($whereString)"))->send(); + + $foundPciidArray = $this->m['HardwareModel'] + ->select('pci_id') + ->where(array('pci_id'=>"in($whereString)")) + ->toList('pci_id') + ->send(); + + $notFoundDevices = array(); + + foreach ($lspciFiltered as $device) + { + if (!in_array($device['vendorId'].":".$device['deviceId'],$foundPciidArray)) + { + $notFoundDevices[] = $device; + } + } + + $data['notFoundDevices'] = $notFoundDevices; + } $this->append($data); $this->cleverLoad('lspci_results'); diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php index 11d12df..9d6fadc 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -26,6 +26,7 @@ class Hardware public static $controllers = array('notebooks','wifi','videocards','printers','scanners','threegcards','soundcards'); //used by UsersController::login() + //classId => controller public static $deviceClasses = array( '0403' => 'soundcards', '0280' => 'wifi', diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 0952da8..810fac1 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -151,6 +151,9 @@ class Lang "the text submitted by you does not seem the lspci -vmmnn output. Please check the text and try again" => "il testo che hai inviato non sembra l'output del comando lspci -vmmnn. Per favore ricontrolla il testo e riprova", "Search form" => "Form della ricerca", "write here the output of lspci -vmmnn" => "scrivi qui l'output del comando lspci -vmmnn", + "The following devices has been found in the database" => "I seguenti device sono stati trovati nel database", + "yes" => "sì", + "The following devices has not been found in the database" => "I seguenti device non sono stati trovati nel database", ), 'es' => array ( diff --git a/h-source/Application/Views/Search/lspci_results.php b/h-source/Application/Views/Search/lspci_results.php index a23d505..57e728c 100644 --- a/h-source/Application/Views/Search/lspci_results.php +++ b/h-source/Application/Views/Search/lspci_results.php @@ -38,30 +38,46 @@ "> + + 0) { ?> +
+ : +
+
- ".$row['hardware']['type']." - ".$row['hardware']['model'];?> + ".$row['hardware']['type']." - ".$row['hardware']['model']."";?>
".$row['hardware']['wifi_works'].""; + echo gtext("does it work with free software?"). " ".gtext($row['hardware']['wifi_works']).""; break; case 'videocard': echo gtext("does it work with free software?"). " ".gtext(Videocard::$videoReverse[$row['hardware']['video_card_works']]).""; break; case 'soundcard': - echo gtext("does it work with free software?"). " ".$row['hardware']['sound_card_works'].""; + echo gtext("does it work with free software?"). " ".gtext($row['hardware']['sound_card_works']).""; break; } ?>
+ + 0) { ?> +
+ : +
+ + + + + -- cgit v1.2.3