<!-- vues/partage/v_publicationUser.php -->
<main>
    <h1>Mes publications :</h1>

    <?php if (!empty($publicationUserData1) && is_array($publicationUserData1)): ?>
        <h2>Mes Astuces :</h2>
        <div class="summary-container">
            <?php foreach ($publicationUserData1 as $publicationUser): ?>
                <div class="summary"> 
                    <h1><?php echo $publicationUser['titre']; ?></h1>
                    <h3><?php echo $publicationUser['descriptionn']; ?></h3>
                    <p><?php echo $publicationUser['contenu']; ?></p>
                    <?php 
                        // Formater la date
                        $datePublication = date("d-m-Y H:i", strtotime($publicationUser['datePublication']));
                    ?>
                    <p>Publié par : <?php echo $publicationUser['nom'] . ' ' . $publicationUser['prenom']; ?>, le <?php echo $datePublication; ?></p>
                    <a href="index.php?url=partage/supprimer&categorie=astuce&publication_numero=<?php echo $publicationUser['numero']; ?>" class="delete-btn">Supprimer</a>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>

    <?php if (!empty($publicationUserData2) && is_array($publicationUserData2)): ?>
        <h2>Ma Culture :</h2>
        <div class="summary-container">
            <?php foreach ($publicationUserData2 as $publicationUser): ?>
                <div class="summary">
                    <h1><?php echo $publicationUser['titre']; ?></h1>
                    <h3><?php echo $publicationUser['descriptionn']; ?></h3>
                    <p><?php echo $publicationUser['contenu']; ?></p>
                    <?php 
                        // Formater la date
                        $datePublication = date("d-m-Y H:i", strtotime($publicationUser['datePublication']));
                    ?>
                    <p>Publié par : <?php echo $publicationUser['nom'] . ' ' . $publicationUser['prenom']; ?>, le <?php echo $datePublication; ?></p>
                    <a href="index.php?url=partage/supprimer&categorie=culture&publication_numero=<?php echo $publicationUser['numero']; ?>" class="delete-btn">Supprimer</a>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>

    <?php if (!empty($publicationUserData3) && is_array($publicationUserData3)): ?>
        <h2>Mes Idées :</h2>
        <div class="summary-container">
            <?php foreach ($publicationUserData3 as $publicationUser): ?>
                <div class="summary">
                    <h1><?php echo $publicationUser['titre']; ?></h1>
                    <h3><?php echo $publicationUser['descriptionn']; ?></h3>
                    <p><?php echo $publicationUser['contenu']; ?></p>
                    <?php 
                        // Formater la date
                        $datePublication = date("d-m-Y H:i", strtotime($publicationUser['datePublication']));
                    ?>
                    <p>Publié par : <?php echo $publicationUser['nom'] . ' ' . $publicationUser['prenom']; ?>, le <?php echo $datePublication; ?></p>
                    <a href="index.php?url=partage/supprimer&categorie=idee&publication_numero=<?php echo $publicationUser['numero']; ?>" class="delete-btn">Supprimer</a>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>
    <br/><br/><br/>
</main>

