Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 33 | Revision 38 | 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
			{
33 lars 20
				$sql="SELECT * FROM distributions WHERE 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);
46
			while($row=$res->fetchRow())
47
			{
48
				$out[$row["dist_id"]]=$row["dist_name"];
49
			}
37 lars 50
			$out[-1]="Bitte wählen!";
30 lars 51
			return $out;
52
		}
53
	}
54
?>