diff options
| author | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-03 07:54:14 +0000 | 
|---|---|---|
| committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-03 07:54:14 +0000 | 
| commit | 75be1868c47b7b9455eef65a7b1e33e447e61ee5 (patch) | |
| tree | ff9c536599ae40487aed75686b87e118368dc973 /h-source/Application | |
| parent | 10bbe357616c36e86ae3c3c7a26840b0c1973756 (diff) | |
improved search
Diffstat (limited to 'h-source/Application')
| -rw-r--r-- | h-source/Application/Include/hardware.php | 76 | ||||
| -rw-r--r-- | h-source/Application/Include/languages.php | 19 | ||||
| -rw-r--r-- | h-source/Application/Views/Search/lspci_results.php | 14 | 
3 files changed, 88 insertions, 21 deletions
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';  } diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 810fac1..f09b809 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -488,25 +488,6 @@ class MyStrings  		'soundcard'	=>	'soundcards',  	); -	public static $images = 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 function getHardIcon($type) -	{ -		if (array_key_exists($type,self::$images)) -		{ -			return "http://".DOMAIN_NAME."/Public/Img/".self::$images[$type]; -		} -		return null; -	} -	  	public static function getTypes()  	{  		return implode(',',array_keys(self::$reverse)); diff --git a/h-source/Application/Views/Search/lspci_results.php b/h-source/Application/Views/Search/lspci_results.php index 57e728c..5d1dfa4 100644 --- a/h-source/Application/Views/Search/lspci_results.php +++ b/h-source/Application/Views/Search/lspci_results.php @@ -48,7 +48,7 @@  			<?php foreach ($table as $row) { ?>  			<div class="lspci_item_found">  				<div class="lspci_item_found_model"> -					<img align="top" class="catalogue_item_icon" src="<?php echo MyStrings::getHardIcon($row['hardware']['type']);?>"> <span class="search_result_model_name"><?php echo "<b>".$row['hardware']['type']."</b> - <a href='".$this->baseUrl."/".MyStrings::$reverse[$row['hardware']['type']]."/view/$lang/".$row['hardware']['id_hard']."/".encodeUrl($row['hardware']['model'])."'>".$row['hardware']['model']."</a>";?></span> +					<img align="top" class="catalogue_item_icon" src="<?php echo Hardware::getIconFromType($row['hardware']['type']);?>"> <span class="search_result_model_name"><?php echo "<b>".$row['hardware']['type']."</b> - <a href='".$this->baseUrl."/".Hardware::getControllerFromType($row['hardware']['type'])."/view/$lang/".$row['hardware']['id_hard']."/".encodeUrl($row['hardware']['model'])."'>".$row['hardware']['model']."</a>";?></span>  				</div>  				<div class="lspci_item_found_compat">  				<?php @@ -76,7 +76,17 @@  			<?php }?>  			<?php foreach ($notFoundDevices as $device) { ?> - +			<div class="lspci_item_not_found"> +				<div class="lspci_item_found_model"> +					<img align="top" class="catalogue_item_icon" src="<?php echo Hardware::getIconFromClass($device['classId']);?>"> <span class="search_result_model_name"><?php echo "<b>".Hardware::getTypeFromClass($device['classId'])."</b> - ".$device['deviceName'];?></span> +					<div class="lspci_item_found_compat"> +						<ul> +							<li><b>vendor name:</b><?php echo $device['vendorName'];?></li> +							<li><b>vendorid:productid</b> code: <?php echo $device['vendorId'].":".$device['deviceId'];?></li> +						</ul> +					</div> +				</div> +			</div>  			<?php } ?>  		</div>  | 
