Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 61 | Revision 165 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php
        //$Id: dist.class.php 109 2008-05-09 22:19:52Z lars $
        /**
         * @author Lars Tiefland
         * @copyright 2007
         * @package     openvz_admin
         **/
        class Dist
        {
                protected $dist_name;
                protected $id;
                protected $template;
                function __construct($dist=NULL)
                {
                        global $db;
                        if(!is_null($dist))
                        {
                                $sql="SELECT * FROM distributions WHERE dist_id=$dist";
                                $res=$db->query($sql);
                                $row=$res->fetchRow();
                                $this->id=$row["dist_id"];
                                $this->dist_name=$row["dist_name"];
                                $this->template=$row["dist_template"];
                        }
                        else
                        {
                                $this->dist_name="";
                        }
                }
                
                function toArray()
                {
                        $out["dist_id"]=$this->id;
                        $out["dist_name"]=$this->dist_name;
                        $out["template"]=$this->template;
                        return $out;
                }

                static function getDists()              
                {
                        global $db;
                        $sql="SELECT dist_id, dist_name FROM distributions";
                        $res=$db->query($sql);
                        $out[-1]="Bitte w&auml;hlen!";
                        while($row=$res->fetchRow())
                        {
                                $out[$row["dist_id"]]=$row["dist_name"];
                        }
                        return $out;
                }
        }
?>