<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';

if (isset($_COOKIE['userData'])) {
    $userDataEncoded = $_COOKIE['userData'];
    $userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif

    $email = $userData['email'];
    $name = $userData['name'];
    $familyName = $userData['familyName'];
    $role = $userData['role'];
} else {
    echo "Cookie 'userData' non trouvé.";
}
?>

<footer class="site-footer">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 col-md-6">
                <h6>à propos</h6>
                <p class="text-justify">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quo consequatur illum,
                    officiis nisi porro minus voluptates impedit unde perspiciatis commodi? Mollitia dolores dolore
                    deserunt. Numquam officia ex vitae, ipsum veritatis atque recusandae accusantium consequatur
                    dolorum.</p>
            </div>

            <div class="col-xs-6 col-md-3">
                <h6>Catégories</h6>
                <ul class="footer-links">
                    <li><a href="../../../">Accueil</a></li>
                    <li><a href="../../../events">Évènements</a></li>
                </ul>
            </div>

            <div class="col-xs-6 col-md-3">
                <h6>Liens rapides</h6>
                <ul class="footer-links">
                    <li><a href="https://grond.iut-fbleau.fr/balocchi/SAE_web" target="_blank">Code source du site</a>
                    </li>
                    <li>
                        <?php if (isset($_COOKIE['userData'])) {
                            echo "<a href='/account/profile'>Mon profil</a>";
                        } else {
                            echo "<a href='/account/login'>Connexion</a>";
                        } ?>
                    </li>
                </ul>
            </div>
        </div>
        <hr>
    </div>
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-sm-6 col-xs-12">
                <p class="copyright-text">Copyright &copy; 2024
                    <a href="#">Juliette & Loris</a>.
                </p>
            </div>

            <div class="col-md-4 col-sm-6 col-xs-12">
                <!-- <ul class="social-icons">
                    <li><a class="facebook" href="#"><i class="fa fa-facebook"></i></a></li>
                    <li><a class="twitter" href="#"><i class="fa fa-twitter"></i></a></li>
                    <li><a class="dribbble" href="#"><i class="fa fa-dribbble"></i></a></li>
                    <li><a class="linkedin" href="#"><i class="fa fa-linkedin"></i></a></li>
                </ul> -->
            </div>
        </div>
    </div>
</footer>