Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 38 | Revision 59 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
30 lars 1
<?php
2
	//$Id$
3
/**
4
 * @author Lars Tiefland
5
 * @copyright 2007
6
 
7
 */
8
 
9
 
31 lars 10
	class Dist
30 lars 11
	{
12
		protected $dist_name;
13
		protected $id;
14
		protected $template;
15
		function __construct($dist=NULL)
16
		{
33 lars 17
			global $db;
18
			if(!is_null($dist))
30 lars 19
			{
50 lars 20
				$sql="SELECT * FROM distributions WHERE dist_id=$dist";
30 lars 21
				$res=$db->query($sql);
22
				$row=$res->fetchRow();
23
				$this->id=$row["dist_id"];
24
				$this->dist_name=$row["dist_name"];
25
				$this->template=$row["template_name"];
26
			}
27
			else
28
			{
29
				$this->dist_name="";
30
			}
31
		}
32
 
33
		function toArray()
34
		{
35
			$out["dist_id"]=$this->id;
36
			$out["dist_name"]=$this->dist_name;
37
			$out["template"]=$this->template;
38
			return $out;
39
		}
40
 
41
		static function getDists()
42
		{
43
			global $db;
33 lars 44
			$sql="SELECT dist_id, dist_name FROM distributions";
30 lars 45
			$res=$db->query($sql);
38 lars 46
			$out[-1]="Bitte w&auml;hlen!";
30 lars 47
			while($row=$res->fetchRow())
48
			{
49
				$out[$row["dist_id"]]=$row["dist_name"];
50
			}
51
			return $out;
52
		}
53
	}
54
?>