Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Revision 559 | Revision 561 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
533 lars 3
    namespace App\Http\Controllers\online_shop;
2 lars 4
 
533 lars 5
    use App\Http\Controllers\Controller;
6
    use App\Models\Item;
534 lars 7
    use Illuminate\Contracts\Foundation\Application;
8
    use Illuminate\Contracts\View\Factory;
9
    use Illuminate\Contracts\View\View;
533 lars 10
    use Illuminate\Http\Request;
2 lars 11
 
533 lars 12
    class ItemController extends Controller
13
    {
14
        //
15
 
559 lars 16
        public function __construct()
17
        {
18
            $gesperrte_felder = array();
19
            if ( $GLOBALS["web_rechte"]["online_shop"]["artikel"]["klonen_gesperrte_felder"] )
20
            {
21
                $gesperrte_felder = explode( ";", strtolower( $GLOBALS["web_rechte"]["online_shop"]["artikel"]["klonen_gesperrte_felder"] ) );
22
            }
23
            $preise = explode( ";", $GLOBALS["web_rechte"]["online_shop"]["artikel"]["preise"] );
24
            foreach ( $preise as $id => $preis )
25
            {
26
                $pos = strpos( $preis, "," );
27
                //if ( $pos !== false )
28
                {
29
                    //list( $name, $config ) = explode( ",", $preis,2 );
30
                    $tmp = explode( ",", $preis );
31
                    $name = $tmp[0];
32
                    unset( $config );
33
                    unset( $tmp[0] );
34
                    foreach ( $tmp as $str )
35
                    {
36
                        list( $key, $value ) = explode( "=", $str );
37
                        if ( $value === null )
38
                        {
39
                            $value = 1;
40
                        }
41
                        $config[$key] = $value;
42
                    }
43
                    $cfg[$id + 1] = $config;
44
                    $preise[$id + 1] = $name;
45
                }
46
            }
47
            $preis_anz = count( $preise );
560 lars 48
            \View::share( "preise", $preise );
49
            \View::share( "cfg", $cfg );
559 lars 50
            \View::share( "preis_anz", $preis_anz );
51
            \View::share( "gesperrte_felder", $gesperrte_felder );
52
        }
53
 
534 lars 54
        public function edit( Item $item ): Factory|View|Application
533 lars 55
        {
557 lars 56
            $item->load( "medium.medium", "manufacturer", "price" );
535 lars 57
            return view( "online_shop.item_edit", [
533 lars 58
                "item" => $item,
59
            ] );
60
        }
61
    }