Revision 63 | Revision 82 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?Class Genre{var $id;var $name;function __construct($id=0){global $db, $prefix, $common;if ($id){$sql="SELECT * FROM $prefix"."genres WHERE g_id=$id";$res=$db->query($sql);$row=$res->fetchRow();$this->id=$id;$this->name=stripslashes(($row["g_id"]!=1)?$row["g_name"]:$common["various"]);}else{$this->id=0;$this->name="";}return $this;}function Genre($id=0){$this->__construct($id);}function update($a_name){$this->name=$a_name;}function save($mode="save"){global $db, $prefix;switch ($mode){case "save":$sql="INSERT INTO $prefix"."genres (g_name) VALUES ('$this->name')";break;case "update":$sql="UPDATE $prefix"."genres SET g_name='$this->name' WHERE g_id=$this->id";break;case "del":break;}return $db->query($sql);}function Liste($start=0,$anz=0){global $db, $prefix, $common;$sql="SELECT * FROM $prefix"."genres";if ($anz > 0){$res=$db->limitquery($sql,$start,$anz);$id=0;$ret=array(array());while ($row=$res->fetchRow()){$ret[$id]["link_id"]=$row["g_id"];$ret[$id]["g_name"]=stripslashes(($row["g_id"]!=1)?$row["g_name"]:$common["various"]);$id++;}return $ret;}else{$res=$db->query($sql);return $res->numRows();}}function getGenres(){global $db, $prefix, $common;$sql="SELECT * FROM $prefix"."genres ORDER by g_name";$res=$db->query($sql);$ret["-1"]=$common["please_select"];while ($row=$res->fetchRow()){$g_id=$row["g_id"];$ret["$g_id"]=stripslashes(($g_id!=1)?$row["g_name"]:$common["various"]);}$ret["1"]=$common["various"];return $ret;}}?>