Revision 46 | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?php/*** @package shop* @author Lars Tiefland <ltiefland@gmail.com>* @copyright 2012* @version $Id$*//*** @package shop* @author Lars Tiefland <ltiefland@gmail.com>* @copyright 2012* @version $Id$*/namespace Weban;require_once "classes/preise.class.php";class artikel{public $id;public $name;public $beschreibung;public $link;public $hersteller;public $bilder;public $kennung;public $ean;public function __construct( $id ){$sql = "SELECTid,kurzbezeichnung AS name,beschreibung,father,hersteller,kennung,eanFROMartikelWHEREid = $idANDlanguage='" . $GLOBALS["INI"]["language"] . "'";$res = $GLOBALS["db"]->query( $sql );$row = $res->fetchRow();if ( $row["id"] ){$this->id = $row["id"];$this->name = $row["name"];$this->beschreibung = $row["beschreibung"];$this->father = $row["father"];$this->kennung = $row["kennung"];$this->ean = $row["ean"];if ( $GLOBALS["INI"]["alias"] == 0 ){$this->link = "/index.php?item=" . $this->id;}else{$path = getPath( $this->father );foreach ( $path as $dir ){$link[] = $dir->id . "-" . str2url( $dir->name );}$link[] = $this->id . "-" . str2url( $this->name ) . ".html";$link = "/" . implode( "/", $link );$this->link = $link;}$fd = new directory( $this->father );$this->artikelstamm = $fd->artikelstamm;$this->hersteller = new hersteller( $row["hersteller"] );$this->bilder = artikel_bild::Liste( $this->id );$staffeln = preise::Liste( $this->id );foreach ( $staffeln as $p_index => $staffel ){$preis = $staffel["preis"][0];unset( $staffel["preis"][0] );unset( $staffel["menge"][0] );$this->preis[$p_index]["preis"] = $preis;$this->preis[$p_index]["staffel"] = $staffel;}if ( count( $this->bilder ) > 1 ){$thumbs = "";foreach ( $this->bilder as $bild ){if ( $bild["typ"] == "Bild" ){$thumbs .= "<li><a href=\"javascript:void(0);\" rel=\"{gallery: 'gal1', smallimage: '/images/Bild_" .$bild["bild_index"] . "/kl/" . $bild["url"] ."', largeimage: '/images/Bild_" . $bild["bild_index"] ."/" . $bild["url"] . "'}\"><img src=\"/images/Bild_" . $bild["bild_index"] ."/mini/" . $bild["url"] . "\" /></a></li>";}}$this->thumbs = $thumbs;}$this->instantConfirm = "/index.php?basket=true&item=$this->id&menge=1";$this->teaser = $this->getTeaser( $this->beschreibung );}}public static function Liste( $father ){$items = array();$sql = "SELECTidFROMartikelWHEREfather = $fatherANDstatus = 0ANDlanguage='" . $GLOBALS["INI"]["language"] . "'";$res = $GLOBALS["db"]->query( $sql );while ( $row = $res->fetchRow() ){$items[] = new artikel( $row["id"] );}return $items;}private function getTeaser ( $beschreibung ){$cut_desc = 110;$teaser = strip_tags( $beschreibung );$str = substr( $teaser, 0, $cut_desc );$spacePos = strripos( $str, " " );$teaser = substr( $str, 0, $spacePos ) . " ...";return $teaser;}}?>