<div class="alert-wrapper">
    <?php

    global $msg;

    if(isset($msg) && $msg != ''){
        echo $msg;
    }
    ?>
</div>
<script type="text/javascript">
    <!--

    /* ========================================================================
     * Confirmation de suppression de notification
     * ======================================================================== */
    function confirmDelete(id)
    {
        if(confirm("Supprimer cette notification?")){
            document.location.href="<?php echo Webcollectivites::get_page_url('webco', array('showModule' => 'notifications')); ?>&action=delete&id="+id;
        };
    }

    -->
</script>
<div class="paramietreA111-liste">
    <div class="container-fluid">
        <h3>Liste des notifications</h3>
        <?php

        if(!empty($listeNotifications)):


            ?>
            <div class="col-md-10">
                <table id="tableParametres" class="table table-striped">
                    <thead>
                    <tr>
                        <td valign="top">Status</td>
                        <td valign="top">Contenu</td>
                        <td valign="top">Date début</td>
                        <td valign="top">Date fin</td>
                        <td valign="top">Destinataire</td>
                        <td valign="top">Actions</td>
                    </tr>
                    </thead>
                    <tfoot>
                    <tr>
                        <td valign="top">Status</td>
                        <td valign="top">Contenu</td>
                        <td valign="top">Date début</td>
                        <td valign="top">Date fin</td>
                        <td valign="top">Destinataire</td>
                        <td valign="top">Actions</td>
                    </tr>
                    </tfoot>
                    <tbody>
                    <?php


                    foreach($listeNotifications as $result)
                    {
                        $text = str_replace("\'", "'", $result->text);
                        $text = str_replace('\"', '"', $text);
                        echo"<tr>";
                        ?>
                        <?php
                        echo "<td>".$result->statut."</td>\n";
                        echo "<td>".$text."</td>\n";
                        echo "<td>".$result->date_debut."</td>\n";
                        echo "<td>".$result->date_fin."</td>\n";
                        echo "<td>";
//                        if($result->is_dismissible == false){
//                            echo 'Non';
//                        }else{
//                            echo 'Oui';
//                        }
                        if($result->destinataire != '') {
                            echo $result->destinataire;
                        }else{
                            echo 'Ce site';
                        }
                        echo "</td>\n";
                        echo '<td>
                            <a onclick="confirmDelete(\''.$result->id.'\')" title="Supprimer cette notifications?"><span class="dashicons dashicons-no"></span></a>
                        </td>';
                        echo "</tr>\n";
                    }

                    ?>
                    </tr>
                    </tbody>
                </table>
            </div>
        <?php
        else:
            ?>

            Il n'y a aucune notification pour l'instant

        <?php endif; ?>
    </div>
</div>
<hr />