Subversion-Projekte lars-tiefland.shop_ns

Revision

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

<?php

    /**
     * @author Lars Tiefland
     * @copyright 2012
     */
    namespace Weban;
    class randelement
    {
        public function __construct( $id )
        {
            $sql = "SELECT
                    id,
                    ueberschrift AS titel,
                    text AS inhalt,
                    typ,
                    untertyp,
                    bild_url,
                    bild_link,
                    position
                FROM
                    sonderkasten
                WHERE
                    id = $id
            ";
            $res = $GLOBALS["db"]->query( $sql );
            $row = $res->fetchRow();
            foreach ( $row as $feld => $wert )
            {
                $this->$feld = $wert;
            }
        }

        public static function Liste( $position )
        {
            $sql = "SELECT
                    id
                FROM
                    sonderkasten
                WHERE
                    position LIKE '%$position%'
                AND
                    language = '" . $GLOBALS["INI"]["language"] . "'
                AND
                    shops_ID = '" . $GLOBALS["INI"]["shops_ID"] . "'
            ";
            $res = $GLOBALS["db"]->query( $sql );
            while ( $row = $res->fetchRow() )
            {
                $ret[] = new randelement( $row["id"] );
            }
            return $ret;
        }
    }

?>