Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 168 | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php
    //$Id: dist.class.php 169 2011-07-10 19:12:37Z 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;
        }
    }
?>