From 75be1868c47b7b9455eef65a7b1e33e447e61ee5 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 3 Feb 2011 07:54:14 +0000 Subject: improved search --- h-source/Application/Include/hardware.php | 76 +++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) (limited to 'h-source/Application/Include/hardware.php') diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php index 9d6fadc..e4fc3e2 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -33,6 +33,82 @@ class Hardware '0300' => 'videocards', ); + public static $icons = array( + 'notebook' => 'H2O/computer-laptop_22.png', + 'wifi' => 'H2O/network-wireless_22.png', + 'videocard' => 'Crystal/1282042976_hardware.png', + 'printer' => 'H2O/printer_22.png', + 'scanner' => 'H2O/scanner_22.png', + '3G-card' => 'Crystal/usb_22.png', + 'soundcard' => 'H2O/audio-card_22.png', + ); + + public static $typeToController = array( + 'notebook' => 'notebooks', + 'wifi' => 'wifi', + 'videocard' => 'videocards', + 'printer' => 'printers', + 'scanner' => 'scanners', + '3G-card' => 'threegcards', + 'soundcard' => 'soundcards', + ); + + public static function getControllerFromType($type) + { + if (array_key_exists($type,self::$typeToController)) + { + return self::$typeToController[$type]; + } + return null; + } + + //get the type from the controller + public static function getTypeFromController($controller) + { + $temp = array_flip(self::$typeToController); + if (array_key_exists($controller,$temp)) + { + return $temp[$controller]; + } + return null; + } + + public static function getTypeFromClass($class) + { + if (array_key_exists($class,self::$deviceClasses)) + { + return self::getTypeFromController(self::$deviceClasses[$class]); + } + return null; + } + + public static function getIconFromType($type) + { + if (array_key_exists($type,self::$icons)) + { + return "http://".DOMAIN_NAME."/Public/Img/".self::$icons[$type]; + } + return null; + } + + public static function getIconFromController($controller) + { + if ($type = self::getTypeFromController($controller)) + { + return self::getIconFromType($type); + } + return null; + } + + public static function getIconFromClass($class) + { + if (array_key_exists($class,self::$deviceClasses)) + { + return self::getIconFromController(self::$deviceClasses[$class]); + } + return null; + } + public static $commYear = 'not-specified,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992'; } -- cgit v1.2.3