Subversion-Projekte lars-tiefland.openvz_admin

Revision

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

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