Example #1
0
}
if ($action == 'afficher_destinataires' && $nb_ids) {
    $champs = $profil != 'parent' ? 'CONCAT(user_nom," ",user_prenom) AS texte , user_id AS valeur' : 'CONCAT(parent.user_nom," ",parent.user_prenom," (",enfant.user_nom," ",enfant.user_prenom,")") AS texte , parent.user_id AS valeur';
    $DB_TAB = DB_STRUCTURE_ADMINISTRATEUR::DB_lister_users_cibles(implode(',', $tab_ids), 'user_id AS valeur, CONCAT(user_nom," ",user_prenom) AS texte', '');
    exit(HtmlForm::afficher_select($DB_TAB, 'f_destinataires', FALSE, FALSE, '', TRUE));
}
// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Ajouter un nouveau message
// ////////////////////////////////////////////////////////////////////////////////////////////////////
if ($action == 'ajouter' && $date_debut_fr && $date_fin_fr && $message_contenu && $nb_destinataires) {
    $date_debut_mysql = convert_date_french_to_mysql($date_debut_fr);
    $date_fin_mysql = convert_date_french_to_mysql($date_fin_fr);
    if ($date_fin_mysql < $date_debut_mysql) {
        exit('Date de fin antérieure à la date de début !');
    }
    $message_id = DB_STRUCTURE_COMMUN::DB_ajouter_message($_SESSION['USER_ID'], $date_debut_mysql, $date_fin_mysql, $message_contenu, $tab_destinataires);
    // Notifications (rendues visibles ultérieurement)
    if (!$mode_discret) {
        $listing_abonnes = DB_STRUCTURE_NOTIFICATION::DB_lister_destinataires_listing_id($abonnement_ref, implode(',', $tab_destinataires));
        if ($listing_abonnes) {
            $notification_date = TODAY_MYSQL < $date_debut_mysql ? $date_debut_mysql : NULL;
            $notification_contenu = 'Message de ' . afficher_identite_initiale($_SESSION['USER_NOM'], FALSE, $_SESSION['USER_PRENOM'], TRUE, $_SESSION['USER_GENRE']) . ' :' . "\r\n\r\n" . make_lien($message_contenu, 'mail') . "\r\n";
            $tab_abonnes = explode(',', $listing_abonnes);
            foreach ($tab_abonnes as $abonne_id) {
                DB_STRUCTURE_NOTIFICATION::DB_ajouter_log_attente($abonne_id, $abonnement_ref, $message_id, $notification_date, $notification_contenu);
            }
        }
    }
    // Afficher le retour
    $destinataires_nombre = $nb_destinataires > 1 ? $nb_destinataires . ' destinataires' : $nb_destinataires . ' destinataire';
    echo '<tr id="id_' . $message_id . '" class="new">';