.
if (!defined('EG')) die('Direct access not allowed!');
class Distributions
{
	
	public static $allowed = array();
	
	public static $allowed_active = 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();
		self::$allowed_active = $distros->clear()->where(array('active'=>'1'))->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 = "