Subversion-Projekte lars-tiefland.inventar

Revision

Revision 5 | Revision 7 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

        //$Id: comp.class.php 6 2008-05-10 16:29:22Z lars $
        
/**
 * @author Lars Tiefland <ltiefland@gmail.com>
 * @copyright 2008
 * @project Inventar Datenbank
 *
 */

        class comp{
                private $id;
                private $name;
                private $os_id;
                
                function __construct($id=0)
                {
                        if($id)
                        {
                                $res=$GLOBALS["db"]->query("SELECT * FROM computer WHERE id=$id");
                                $this->id=$id;
                                $row=$res->fetchRow();
                                $this->name=$row["name"];       
                        }
                        else
                        {
                                $this->id=0;
                                $this->name='';
                                $this->os_id=1;
                        }
                }
                static function get_computers($start=0,$limit=0)
                {
                        $sql="SELECT * FROM computer";
                        if($limit)
                        {
                                $res=$GLOBALS["db"]->limiquery($sql,$start,$limit);
                        }
                        else
                        {
                                $res=$GLOBALS["db"]->query($sql);
                        }
                        while($row=$res->fetchRow())
                        {
                                $comp[]=$row;
                        }
                        return $comp;
                }
        }

?>