. if (!defined('EG')) die('Direct access not allowed!'); class Distributions { public static $allowed = array(); public static function getList() { return implode(' , ',array_keys(self::$allowed)); } //fill the $allowed property with the list of allowed distros from the distros MySQL table public static function setAllowedList() { $distros = new DistrosModel(); self::$allowed = $distros->clear()->toList("clean_name","full_name")->orderBy("id_order")->send(); } 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; } }