Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 61 | Revision 162 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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