From 232aa1924c8c0f10d87b210b46c9f061af5c844c Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 17 Oct 2010 13:29:57 +0000 Subject: added files --- h-source/Application/Include/distributions.php | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 h-source/Application/Include/distributions.php (limited to 'h-source/Application/Include/distributions.php') diff --git a/h-source/Application/Include/distributions.php b/h-source/Application/Include/distributions.php new file mode 100644 index 0000000..6f5e1ae --- /dev/null +++ b/h-source/Application/Include/distributions.php @@ -0,0 +1,86 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class Distributions +{ + + public static $allowed = array( + 'blag_90001' => 'BLAG 90001', + 'blag_120000' => 'BLAG 120000', + 'dragora_1_1' => 'Dragora 1.1', + 'dynebolic_2_5_2' => 'Dynebolic 2.5.2 DHORUBA', + 'gnewsense_2_3' => 'gNewSense 2.3 Deltah', + 'gnewsense_3_0' => 'gNewSense 3.0 Metad', + 'musix_2_0' => 'Musix GNU+Linux 2.0 R0', + 'trisquel_3_5' => 'Trisquel 3.5 Awen', + 'trisquel_4_0' => 'Trisquel 4.0 Taranis', + 'ututo_xs_2009' => 'UTUTO XS 2009', + 'ututo_xs_2010' => 'UTUTO XS 2010', + 'venenux_0_8' => 'VENENUX 0.8', + ); + + public static function getName($distList = '') + { + $returnString = null; + $returnArray = array(); + $distArray = explode(',',$distList); + foreach ($distArray as $dist) + { + $dist = trim($dist); + if (array_key_exists($dist,self::$allowed)) + { + $returnArray[] = self::$allowed[$dist]; + } + } + return implode("
",$returnArray); + } + + public static function check($distString) + { + $distArray = explode(',',$distString); + + $allowedArray = array_keys(self::$allowed); + + foreach ($distArray as $dist) + { + $dist = trim($dist); + if (!in_array($dist,$allowedArray)) return false; + } + + return true; + } + + public static function getFormHtml() + { + $str = "
"; + $str .= "
"; + foreach (self::$allowed as $value => $label) + { + $str .= "
$label
"; + } + $str .= "
"; + $str .= ""; + $str .= ""; + $str .= "
"; + + return $str; + } + +} \ No newline at end of file -- cgit v1.2.3