Subversion-Projekte lars-tiefland.shop_ns

Revision

Revision 18 | Zur aktuellen Revision | 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;
    class directory
    {
        public $id;
        public $name;
        public $description;
        public $link;
        public $artikelstamm;
        public $bilder;

        public function __construct( $id = null )
        {
            $sql = "SELECT
                    id,
                    name,
                    beschreibung AS description,
                    artikelstamm
                FROM
                    directory
                WHERE
                    id = $id                    
                AND
                    language='" . $GLOBALS["INI"]["language"] . "'
            ";
            $res = $GLOBALS["db"]->query( $sql );
            $row = $res->fetchRow();
            $this->id = $row["id"];
            $this->name = $row["name"];
            $this->description = $row["description"];
            $this->link = "/index.php?navigation=" . $this->id;
            $this->bilder = directory_bild::Liste( $this->id );
            $this->artikelstamm = $row["artikelstamm"];
        }

        public static function Liste( $father, $order="kennung" )
        {
            $items = array();
            $sql = "SELECT
                    id
                FROM
                    directory
                WHERE
                    father = $father
                AND
                    status = 0
                AND
                    artikelstamm=0
                AND
                    language='" . $GLOBALS["INI"]["language"] . "'
                ORDER BY
                    $order
            ";
            $res = $GLOBALS["db"]->query( $sql );
            while ( $row = $res->fetchRow() )
            {
                $items[] = new directory( $row["id"] );
            }
            return $items;
        }
    }
?>