diff options
| author | Antonio Gallo <tonicucoz@gmail.com> | 2012-04-01 21:53:55 +0000 | 
|---|---|---|
| committer | Antonio Gallo <tonicucoz@gmail.com> | 2012-04-01 21:53:55 +0000 | 
| commit | 6c46783c344d72bf6f96e071b9c5cb0c3836d0c5 (patch) | |
| tree | 6f4d7230cf7f44c775bc29e4906ea568bb1df2c2 | |
| parent | a2c4e647b694b1d1aa0cd9bca1c23549f7b6ce09 (diff) | |
improved comm_year allowed values
6 files changed, 17 insertions, 6 deletions
diff --git a/h-source/Application/Controllers/NotebooksController.php b/h-source/Application/Controllers/NotebooksController.php index e05fd75..20d3156 100644 --- a/h-source/Application/Controllers/NotebooksController.php +++ b/h-source/Application/Controllers/NotebooksController.php @@ -47,7 +47,7 @@ class NotebooksController extends GenericController  			"+checkIsStrings|".Notebooks::compatibilityList() 	=> 	"compatibility",  			"checkLength|99"	=>						"model",  			"+checkLength|299"							=>	"distribution", -			"++checkIsStrings|".Notebooks::$commYear	=> 	"comm_year", +			"++checkIsStrings|".Hardware::getCommYears()	=> 	"comm_year",  			"+++checkIsStrings|".Notebooks::$subtypeSelect	=> 	"subtype",  			"++++checkIsStrings|".Notebooks::wifiList() 	=> 	"wifi_works",  			"+++++checkIsStrings|".Notebooks::videoList() 	=> 	"video_card_works", diff --git a/h-source/Application/Controllers/PrintersController.php b/h-source/Application/Controllers/PrintersController.php index 0260032..baedda8 100644 --- a/h-source/Application/Controllers/PrintersController.php +++ b/h-source/Application/Controllers/PrintersController.php @@ -47,7 +47,7 @@ class PrintersController extends GenericController  			"checkLength|99"	=>	"model",  			"+checkLength|299"	=>	"distribution",  			"+checkIsStrings|".Printer::compatibilityList() 	=> 	"compatibility", -			"++checkIsStrings|".Printer::$commYear	=> 	"comm_year", +			"++checkIsStrings|".Hardware::getCommYears()	=> 	"comm_year",  			"+++checkIsStrings|".Printer::$interface	=> 	"interface",  			"++++checkIsStrings|".Printer::$subtype	=> 	"subtype",  			"+++++checkIsStrings|".Printer::$trackSelect	=> 	"it_tracks_users", diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php index 0071ab6..bc25ff7 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -160,7 +160,18 @@ class Hardware  		return null;  	} -	public static $commYear = 'not-specified,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992'; +	//get the list of the allowed years of commercialization +	public static function getCommYears() +	{ +		$currentYear = (int)date("Y"); +		$allowed = 'not-specified'; +		 +		for ($i=$currentYear;$i>1991;$i--) +		{ +			$allowed .= ",$i"; +		} +		return $allowed; +	}  	public static $trackSelect = 'not-specified,no,yes'; diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php index 7978593..16d6117 100644 --- a/h-source/Application/Models/HardwareModel.php +++ b/h-source/Application/Models/HardwareModel.php @@ -81,7 +81,7 @@ class HardwareModel extends Model_Map {  			"+checkMatch|".Hardware::$regExpressions['vendorid_productid']	=>	"pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",  			"checkLength|99"	=>	"model",  			"+checkLength|299"	=>	"distribution", -			"++checkIsStrings|".Wifi::$commYear	=> 	"comm_year", +			"++checkIsStrings|".Hardware::getCommYears()	=> 	"comm_year",  			"+++checkIsStrings|".$worksOptions 	=> 	$worksField,  			"++++checkIsStrings|".$interfaceOptions	=> 	"interface",  		); diff --git a/h-source/Application/Views/Desktop/Notebooks/form.php b/h-source/Application/Views/Desktop/Notebooks/form.php index 1bfd64f..5c0c027 100644 --- a/h-source/Application/Views/Desktop/Notebooks/form.php +++ b/h-source/Application/Views/Desktop/Notebooks/form.php @@ -72,7 +72,7 @@  				<div class="form_entry">  					<div class="entry_label"><?php echo gtext("year of commercialization");?>:</div> -					<?php echo Html_Form::select('comm_year',$values['comm_year'],Notebooks::$commYear,"select_entry");?> +					<?php echo Html_Form::select('comm_year',$values['comm_year'],Hardware::getCommYears(),"select_entry");?>  				</div>  				<div class="form_entry td_with_distribution_checkboxes"> diff --git a/h-source/Application/Views/Desktop/form.php b/h-source/Application/Views/Desktop/form.php index 5bef769..0ddf44d 100644 --- a/h-source/Application/Views/Desktop/form.php +++ b/h-source/Application/Views/Desktop/form.php @@ -63,7 +63,7 @@  				<div class="form_entry">  					<div class="entry_label"><?php echo gtext("year of commercialization");?></div> -					<?php echo Html_Form::select('comm_year',$values['comm_year'],Notebooks::$commYear,"select_entry");?> +					<?php echo Html_Form::select('comm_year',$values['comm_year'],Hardware::getCommYears(),"select_entry");?>  				</div>  				<div class="form_entry">  | 
