Subversion-Projekte lars-tiefland.shop_ns

Revision

Revision 18 | Revision 22 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
    /**
3
     * @package shop
4
     * @author Lars Tiefland <ltiefland@gmail.com>
5
     * @copyright 2012
6
     * @version $Id$
7
     */
8
 
9
    /**
10
     * @package shop
11
     * @author Lars Tiefland <ltiefland@gmail.com>
12
     * @copyright 2012
13
     * @version $Id$
14
     */
15
    namespace Weban;
16
    class directory
17
    {
20 lars 18
        public $id;
2 lars 19
        public $name;
20 lars 20
        public $description;
2 lars 21
        public $link;
18 lars 22
        public $artikelstamm;
20 lars 23
        public $bilder;
2 lars 24
 
25
        public function __construct( $id = null )
26
        {
27
            $sql = "SELECT
28
                    id,
29
                    name,
30
                    beschreibung AS description,
31
		    artikelstamm
32
                FROM
33
                    directory
34
                WHERE
35
                    id = $id
36
                AND
37
                    language='" . $GLOBALS["INI"]["language"] . "'
38
            ";
39
            $res = $GLOBALS["db"]->query( $sql );
40
            $row = $res->fetchRow();
41
            $this->id = $row["id"];
42
            $this->name = $row["name"];
43
            $this->description = $row["description"];
44
            $this->link = "/index.php?navigation=" . $this->id;
18 lars 45
            $this->bilder = directory_bild::Liste( $this->id );
46
            $this->artikelstamm = $row["artikelstamm"];
2 lars 47
        }
48
 
20 lars 49
        public static function Liste( $father, $order="kennung" )
2 lars 50
        {
51
            $items = array();
52
            $sql = "SELECT
53
                    id
54
                FROM
55
                    directory
56
                WHERE
57
                    father = $father
58
                AND
59
                    status = 0
60
                AND
20 lars 61
                    artikelstamm=0
62
                AND
2 lars 63
                    language='" . $GLOBALS["INI"]["language"] . "'
20 lars 64
                ORDER BY
65
                    $order
2 lars 66
            ";
67
            $res = $GLOBALS["db"]->query( $sql );
68
            while ( $row = $res->fetchRow() )
69
            {
70
                $items[] = new directory( $row["id"] );
71
            }
72
            return $items;
73
        }
74
    }
75
?>