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

Revision

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

Revision Autor Zeilennr. Zeile
9 lars 1
<?php
10 lars 2
    use App\Models\UserProperty;
3
    use App\Models\Web;
4
    use App\Models\WebProperty;
9 lars 5
    setlocale( LC_TIME, 'de_DE.UTF-8' );
6
 
7
    if ( php_sapi_name() == "cli" )
8
    {
9
        return false;
10
    }
11
 
12
    $w = new Web();
13
    $GLOBALS["web"] = $w->where( "domain", "=", env( 'shop' ) )->first();
14
    if ( php_sapi_name() != "cli" )
15
    {
16
        if ( !file_exists( $_SERVER["DOCUMENT_ROOT"] . "/public/styles/" . $GLOBALS["web"]["domain"] . "_styles.css" ) )
17
        {
18
            require_once "styles.php";
19
        }
20
    }
21
    \View::share( "webs", $GLOBALS["web"] );
22
    $c_bestellarten = array();
23
    $c_shops = array();
24
    $d_shops = array();
25
    $ba = OrderType::get();
26
    foreach ( $ba as $ba_id => $bestellart )
27
    {
28
        $c_bestellarten[$bestellart->id] = $bestellart->name;
29
    }
30
    $shops = Shop::get();
31
    View::share( "shops", $shops );
32
    foreach ( $shops as $s_id => $shop )
33
    {
34
        $c_shops[$shop->id] = $shop->name;
35
        $d_shops[$shop->id] = $shop;
36
    }
37
    \View::share( "c_bestellarten", $c_bestellarten );
38
    \View::share( "c_shops", $c_shops );
39
    \View::share( "d_shops", $d_shops );
40
    $_SESSION["loadingGif"] = "/images/navigation/loading.gif";
41
    if ( file_exists( $_SERVER["DOCUMENT_ROOT"] . "/images/webelemente/loading.gif" ) )
42
    {
43
        $_SESSION["loadingGif"] = "/images/webelemente/loading.gif";
44
    }
45
    $webRechte = WebProperty::with( [
46
        "property",
47
        "property.tool",
48
        "property.tool.module"
49
    ] )->where( "web_id", "=", $GLOBALS["web"]->ID )->get();
50
    $navi = Module::with( 'tool' )->orderBy( 'modules.rang' )->get();
51
    \View::share( "navi", $navi );
52
    foreach ( $webRechte as $web_recht )
53
    {
54
        $property = $web_recht->property;
55
        $tool = $property->tool;
56
        $module = $tool->module;
57
        $GLOBALS["web_rechte"][$module->interner_name][$tool->button_name][$property->interner_name] = $web_recht->Bezeichnung;
58
    }
59
    \View::share( "web_rechte", $GLOBALS["web_rechte"] );
60
    if ( isset( $_SESSION["admin"]["uid"] ) )
61
    {
62
        $uId = $_SESSION["admin"]["uid"];
63
        $admin = $_SESSION["admin"]["user"]->admin;
64
        $GLOBALS["user_rechte"] = $GLOBALS["web_rechte"];
65
        if ( !$admin )
66
        {
67
            $GLOBALS["user_rechte"] = UserProperty::with( [
68
                "property",
69
                "tool",
70
                "module"
71
            ] )->where( "backend_user_id", "=", $uId )->get();
72
        }
73
        \View::share( "user_rechte", $GLOBALS["user_rechte"] );
74
    }