Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 109 | Revision 165 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

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