Revision 20 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?php//$Id: hardware.class.php 6 2008-05-10 16:29:22Z lars $/*** @package Inventar Datenbank* @author Lars Tiefland <ltiefland@gmail.com>* @copyright 2008**/class computer_hardware{private $id;private $comp_id;private $hardware_id;private $value;function __construct($id=0){if($id){$res=$GLOBALS["db"]->query("SELECT * FROM computer_hardware WHERE id=$id");$this->id=$id;$row=$res->fetchRow();$this->comp_id=$row["comp_id"];$this->hardware_id=$row["hardware_id"];$this->value=$row["value"];}else{$this->id=0;$this->value='';$this->hardware_id=0;$this->comp_id=0;}}function toArray(){$ret["id"]=$this->id;$ret["comp_id"]=$this->comp_id;$ret["hw_id"]=$this->hardware_id;$hw=new hardware($this->hardware_id);$ret["hw_name"]=$hw->getName();$ret["value"]=$this->value;return $ret;}static function getHardware($c_id=0){$query="SELECT * FROM computer_hardware WHERE comp_id=$c_id";$res=$GLOBALS["db"]->query($query);while($row=$res->fetchRow()){$h=new computer_hardware($row["id"]);$hw=$h->toArray();$ret[]=$hw;}return $ret;}}?>