<!DOCTYPE html>
<html>

<head>
<?php
include "layout_header.inc.php";
?>
</head>

<?php
$publicHomeUrl = $publicHomeUrl ?? ($urlbase . "index.php?sz=home&language=" . urlencode($language));
$publicLoginUrl = $publicLoginUrl ?? ($urlbase . "index.php?sz=area-riservata&language=" . urlencode($language));
$publicRegisterUrl = $publicRegisterUrl ?? ($urlbase . "index.php?sz=registrazione&language=" . urlencode($language));
$publicPrivacyUrl = $publicPrivacyUrl ?? ($urlbase . "index.php?sz=privacy&language=" . urlencode($language));
$publicCookieUrl = $publicCookieUrl ?? ($urlbase . "index.php?sz=cookie&language=" . urlencode($language));

$publicBrandTitle = $publicBrandTitle ?? trim(strip_tags($_titlews ?? $_title0 ?? "4DayWeek"));
$publicBrandDescription = $publicBrandDescription ?? trim(strip_tags($_description ?? $_description0 ?? ""));
$publicFooterHtml = $publicFooterHtml ?? ($_footer ?? "");

if ($publicBrandTitle === "") {
    $publicBrandTitle = "4DayWeek";
}
if ($publicBrandDescription === "") {
    $publicBrandDescription = "Piattaforma per accesso, registrazione e consultazione dei contenuti pubblici.";
}
?>

<body class="public-layout">

    <?php if (isset($_cookiesbanner) && $_cookiesbanner): ?>
    <div id="cookiesbanner" style="<?= $stylecb ?>">
        <img
            src="main/contents/immagini/closebc.png"
            class="fright cliccabile"
            onclick="hidelayer('cookiesbanner');"
            hspace="3"
            alt="Chiudi" />
        <?= $_cookiesbanner ?>
    </div>
    <?php endif; ?>

    <div id="container" class="public-site-shell">
        <header class="public-header">
            <div id="supertop" class="<?= $supertopclass ?>">
                <div class="content public-meta">
                    <div id="menutop" class="public-meta__nav">
                        <?php include $incpath . 'contents/menutop.php'; ?>
                    </div>

                    <div id="menurtop" class="public-meta__actions">
                        <?php if ($logged == '1') { ?>
                        <a href="javascript:logout()" id="logoutLabel" class="public-meta__logout">
                            <i class="bi bi-box-arrow-right"></i>
                            <?= $lang['Esci'] ?? 'Esci' ?>
                        </a>
                        <?php } ?>
                    </div>
                </div>
            </div>

            <div id="top" class="public-toolbar">
                <div class="content public-toolbar__inner">
                    <div id="logo" class="public-brand">
                        <a href="<?= $publicHomeUrl ?>" title="<?= htmlspecialchars($_title ?? $publicBrandTitle, ENT_QUOTES, 'UTF-8') ?>">
                            <?php WriteMedia("logo", $language); ?>
                        </a>
                    </div>

                    <div class="public-toolbar__nav">
                        <div id="toolbar" class="public-nav">
                            <?php
                            $mode = "top";
                            include $incpath . 'contents/menu.php';
                            ?>
                        </div>

                        <div class="public-toolbar__cta">
                            <a href="<?= $publicLoginUrl ?>" class="btn btn-accent">Accedi</a>
                        </div>

                        <div id="toolbar2" class="public-nav-toggle">
                            <button
                                type="button"
                                id="icotoolbar2"
                                class="icon-btn"
                                onclick="showhidelayer('dropdownmenu')"
                                aria-expanded="false"
                                aria-controls="dropdownmenu"
                                aria-label="Apri menu">
                                <i class="bi bi-list"></i>
                            </button>

                            <div id="dropdownmenu" style="display:none">
                                <?php
                                $mode = "topdown";
                                include $incpath . 'contents/menu.php';
                                ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </header>

        <main id="contents" class="public-main">
            <div class="content public-content">
                <?php
                if (!isset($content)) {
                    $content = $incpath . "contents/404.php";
                }
                include $content;
                ?>
            </div>
        </main>

        <footer id="footer" class="public-footer">
            <div class="content">
                <div class="footer-columns">
                    <div class="colonnafoo">
                        <span class="titolofoo"><?= htmlspecialchars($publicBrandTitle, ENT_QUOTES, 'UTF-8') ?></span>
                        <p class="testofoo">
                            <?= htmlspecialchars($publicBrandDescription, ENT_QUOTES, 'UTF-8') ?>
                        </p>
                    </div>

                    <div class="colonnafoo">
                        <span class="titolofoo">Navigazione</span>
                        <p class="testofoo">
                            <a class="nodec" href="<?= $publicHomeUrl ?>">Home</a><br>
                            <a class="nodec" href="<?= $publicLoginUrl ?>">Accedi</a><br>
                            <a class="nodec" href="<?= $publicRegisterUrl ?>">Registrati</a>
                        </p>
                    </div>

                    <div class="colonnafoo">
                        <span class="titolofoo">Informazioni</span>
                        <p class="testofoo">
                            <a class="nodec" href="<?= $publicPrivacyUrl ?>">Privacy policy</a><br>
                            <a class="nodec" href="<?= $publicCookieUrl ?>">Cookie policy</a>
                        </p>

                        <?php if (!empty($publicFooterHtml)) { ?>
                        <div class="testofoo footer-note">
                            <?= $publicFooterHtml ?>
                        </div>
                        <?php } ?>
                    </div>
                </div>

                <div id="foocreditscnt">
                    <small class="testofoo">
                        &copy; <?= date('Y') ?> <?= htmlspecialchars($publicBrandTitle, ENT_QUOTES, 'UTF-8') ?>
                    </small>
                </div>
            </div>
        </footer>
    </div>

<?php
include "layout_common.inc.php";
?>

</body>
</html>
