Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
    /**
4
     * @package   Content-management
5
     * @author    Webagentur Niewerth <tiefland@weban.de>
6
     * @copyright 2011 Webagentur Niewerth
7
     * @license   propietary http://www.weban.de
8
     * @version   $Rev: 768 $
9
     * @filesource
10
     *
11
     */
12
 
13
    /**
14
     *
15
     * @package   Content-management
16
     * @author    Webagentur Niewerth <tiefland@weban.de>
17
     * @copyright 2011 Webagentur Niewerth
18
     */
19
 
20
    // SVN: $Id: preise.php 768 2011-10-28 06:34:37Z tiefland $
21
 
22
    require_once "../toolbox/common.php";
23
    $sql = "SELECT
24
            id,
25
            name,
26
            `database`
27
        FROM
28
            shops
29
        WHERE
30
            `database` != ''
31
    ";
32
    $res = mysql_query( $sql );
33
    $shops[0] = "--- Bitte wählen! ---";
34
    while ( $row = mysql_fetch_assoc( $res ) )
35
    {
36
        $shops[$row["id"]] = $row["name"];
37
        $shop_infos[$row["id"]] = $row;
38
    }
39
    if ( $_GET["login"] )
40
    {
41
        $login_id = Weban_Utils::clean_global_input( "login", "get", "int" );
42
        $sql = "SELECT
43
                pl.id,
44
                login_id,
45
                artikel_id,
46
                shop_id,
47
                name,
48
                preis,
49
                `database`
50
            FROM
51
                preise_to_login pl,
52
                shops s
53
            WHERE
54
                login_id=" . $login_id . "
55
            AND
56
                s.id=pl.shop_id
57
        ";
58
        $res = mysql_query( $sql );
59
        while ( $row = mysql_fetch_assoc( $res ) )
60
        {
61
            $sql_a = "SELECT
62
                    a.kurzbezeichnung,
63
                    preis1
64
                FROM
65
                    " . $row["database"] . ".artikel a
66
                WHERE
67
                    a.id=" . $row["artikel_id"] . "
68
            ";
69
            $res_a = mysql_query( $sql_a );
70
            $row_a = mysql_fetch_assoc( $res_a );
71
            if ( !is_array( $row_a ) )
72
            {
73
                $row_a["kurzbezeichnung"] = "";
74
            }
75
            $row["preis"] = unserialize( $row["preis"] );
76
 
77
            $daten["artikel"][] = array_merge( $row, $row_a );
78
        }
79
        $sql_l = "SELECT
80
                CONCAT(Vorname, ' ', Name1) AS login_name
81
            FROM
82
                Logins
83
            WHERE
84
                id=$login_id
85
        ";
86
        $res_l = mysql_query( $sql_l );
87
        $row_l = mysql_fetch_assoc( $res_l );
88
        $daten["login_name"] = $row_l["login_name"];
89
        $GLOBALS["ui"]->assign( "login_id", $login_id );
90
        $tpl_file = "preise.tpl";
91
    }
92
    else
93
    {
94
        $a_id = Weban_Utils::clean_get_input( "a_id", "int" );
95
        $s_id = Weban_Utils::clean_get_input( "s_id", "int" );
96
        $db = $webs["datenbank"];
97
        if ( $s_id )
98
        {
99
            $db = $shop_infos[$s_id]["database"];
100
        }
101
        $sql_a = "SELECT
102
                a.kurzbezeichnung,
103
                preis1
104
            FROM
105
                " . $db . ".artikel a
106
            WHERE
107
                a.id=" . $a_id . "
108
        ";
109
        $res_a = mysql_query( $sql_a );
110
        $row_a = mysql_fetch_assoc( $res_a );
111
        if ( !is_array( $row_a ) )
112
        {
113
            $row_a["kurzbezeichnung"] = "";
114
        }
115
        $sql = "SELECT
116
                pl.id,
117
                login_id,
118
                CONCAT(Vorname, ' ', Name1) AS login_name,
119
                shop_id,
120
                name,
121
                preis
122
            FROM
123
                preise_to_login pl,
124
                shops s,
125
                Logins l
126
            WHERE
127
                artikel_id=" . $a_id . "
128
            AND
129
                s.id=pl.shop_id
130
            AND
131
                l.id=pl.login_id
132
        ";
133
        $res = mysql_query( $sql );
134
        while ( $row = mysql_fetch_assoc( $res ) )
135
        {
136
            $row["preis"] = unserialize( $row["preis"] );
137
 
138
            $daten["logins"][] = array_merge( $row, $row_a );
139
        }
140
        $daten["artikel"] = $row_a;
141
        $GLOBALS["ui"]->assign( "a_id", $a_id );
142
        $GLOBALS["ui"]->assign( "s_id", $s_id );
143
        $tpl_file = "artikel.tpl";
144
    }
145
    $GLOBALS["ui"]->assign( "daten", $daten );
146
    $GLOBALS["ui"]->assign( "shops", $shops );
147
    $GLOBALS["ui"]->display( $tpl_file );
148
?>