Beispiel #1
0
function affiche_notice_privee_groupe_jour($id_groupe, $date_jour)
{
    $retour = "";
    $timestamp_debut = timestamp_from_date_jour($date_jour);
    $timestamp_fin = $timestamp_debut + 24 * 3600 - 1;
    // Date de la notice précédente/suivante
    $precedent = "";
    $suivant = "";
    $sql = "SELECT * FROM ct_private_entry WHERE id_groupe='{$id_groupe}' AND contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct < '" . $timestamp_debut . "'\n\t\t\t\tORDER BY date_ct DESC;";
    //echo "$sql<br />\n";
    $res_prec = mysqli_query($GLOBALS["mysqli"], $sql);
    if (mysqli_num_rows($res_prec) > 0) {
        $lig = mysqli_fetch_object($res_prec);
        $precedent = $lig->date_ct;
    }
    /*
    echo "\$precedent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=$precedent&nbsp;&nbsp;";
    if($precedent!="") {echo date_from_timestamp($precedent);}
    echo "<br />";
    */
    $sql = "SELECT * FROM ct_private_entry WHERE id_groupe='{$id_groupe}' AND contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct > '" . $timestamp_fin . "'\n\t\t\t\tORDER BY date_ct ASC;";
    //echo "$sql<br />\n";
    $res_suiv = mysqli_query($GLOBALS["mysqli"], $sql);
    if (mysqli_num_rows($res_suiv) > 0) {
        $lig = mysqli_fetch_object($res_suiv);
        $suivant = $lig->date_ct;
    }
    /*
    echo "\$suivant&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=$suivant&nbsp;&nbsp;";
    if($suivant!="") {echo date_from_timestamp($suivant);}
    echo "<br />";
    */
    if ($suivant != '' || $precedent != '') {
        $retour .= "<div style='float: left; width: 20px; margin-top: 0.5em;'>\n";
        if ($precedent != '') {
            //$retour.="<a href=\"javascript: getWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe=$id_groupe&today=$precedent',{ onComplete:function(transport) {initWysiwyg();}});\" title=\"Notice privée précédente\"><img src='../images/up.png' width='18' height='18' /></a>";
            $retour .= "<a href=\"javascript: getWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe={$id_groupe}&today={$precedent}');\" title=\"Notice privée précédente\"><img src='../images/up.png' width='18' height='18' /></a>";
            $retour .= "<br />\n";
        } else {
            $retour .= "<div style='width: 18px; height: 18px;'>&nbsp;</div>\n";
        }
        if ($suivant != '') {
            //$retour.="<a href=\"javascript: getWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe=$id_groupe&today=$suivant',{ onComplete:function(transport) {initWysiwyg();}});\" title=\"Notice privée suivante\"><img src='../images/down.png' width='18' height='18' /></a>";
            $retour .= "<a href=\"javascript: getWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe={$id_groupe}&today={$suivant}');\" title=\"Notice privée suivante\"><img src='../images/down.png' width='18' height='18' /></a>";
        }
        $retour .= "</div>\n";
    }
    $tab_champs = array('classes');
    $current_group = get_group($id_groupe, $tab_champs);
    $info_groupe = $current_group['name'] . " (<em>" . $current_group['description'] . "</em>) en " . $current_group['classlist_string'];
    $sql = "SELECT * FROM ct_private_entry WHERE id_groupe='{$id_groupe}' AND contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct >= '" . $timestamp_debut . "'\n\t\t\t\tAND date_ct <= '" . $timestamp_fin . "'\n\t\t\t\tORDER BY date_ct;";
    //echo "$sql<br />\n";
    $res = mysqli_query($GLOBALS["mysqli"], $sql);
    if (mysqli_num_rows($res) > 0) {
        while ($lig = mysqli_fetch_object($res)) {
            //
            //$retour.="<div style='border: 1px solid black; margin: 0.5em; background-color:".$couleur_cellule['p']."'>\n";
            $retour .= "<div style='border: 1px solid black; margin: 0.5em; margin-left:25px; background-color: #f6f3a8'>\n";
            $retour .= "<div style='float: right; width: 4em; margin-right: 1.5em;'>" . date_from_timestamp($lig->date_ct) . "</div>\n";
            $retour .= $lig->contenu;
            $retour .= "</div>\n";
        }
    } else {
        $retour .= "Aucune Notice Privée pour cet enseignement (" . $info_groupe . ") le {$date_jour}.";
    }
    return $retour;
}
Beispiel #2
0
function affiche_notice_privee_groupe_jour($id_groupe, $date_jour)
{
    $retour = "";
    $timestamp_debut = timestamp_from_date_jour($date_jour);
    $timestamp_fin = $timestamp_debut + 24 * 3600 - 1;
    // Date de la notice précédente/suivante
    $precedent = "";
    $suivant = "";
    $sql = "SELECT * FROM ct_private_entry WHERE id_groupe='{$id_groupe}' AND contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct < '" . $timestamp_debut . "'\n\t\t\t\tORDER BY date_ct DESC;";
    //echo "$sql<br />\n";
    $res_prec = mysqli_query($GLOBALS["mysqli"], $sql);
    if (mysqli_num_rows($res_prec) > 0) {
        $lig = mysqli_fetch_object($res_prec);
        $precedent = $lig->date_ct;
    }
    /*
    echo "\$precedent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=$precedent&nbsp;&nbsp;";
    if($precedent!="") {echo date_from_timestamp($precedent);}
    echo "<br />";
    */
    $sql = "SELECT * FROM ct_private_entry WHERE id_groupe='{$id_groupe}' AND contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct > '" . $timestamp_fin . "'\n\t\t\t\tORDER BY date_ct ASC;";
    //echo "$sql<br />\n";
    $res_suiv = mysqli_query($GLOBALS["mysqli"], $sql);
    if (mysqli_num_rows($res_suiv) > 0) {
        $lig = mysqli_fetch_object($res_suiv);
        $suivant = $lig->date_ct;
    }
    /*
    echo "\$suivant&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=$suivant&nbsp;&nbsp;";
    if($suivant!="") {echo date_from_timestamp($suivant);}
    echo "<br />";
    */
    if ($suivant != '' || $precedent != '') {
        $retour .= "<div style='float: left; width: 20px; margin-top: 0.5em;'>\n";
        if ($precedent != '') {
            $retour .= "<a href=\"javascript: getWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe={$id_groupe}&today={$precedent}');\" title=\"Notice privée précédente\"><img src='../images/up.png' width='18' height='18' /></a>";
            $retour .= "<br />\n";
        } else {
            $retour .= "<div style='width: 18px; height: 18px;'>&nbsp;</div>\n";
        }
        if ($suivant != '') {
            $retour .= "<a href=\"javascript: getWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe={$id_groupe}&today={$suivant}');\" title=\"Notice privée suivante\"><img src='../images/down.png' width='18' height='18' /></a>";
        }
        $retour .= "</div>\n";
    }
    $tab_champs = array('classes');
    $current_group = get_group($id_groupe, $tab_champs);
    $info_groupe = $current_group['name'] . " (<em>" . $current_group['description'] . "</em>) en " . $current_group['classlist_string'];
    $sql = "SELECT * FROM ct_private_entry WHERE id_groupe='{$id_groupe}' AND contenu != ''\n\t\t\t\tAND date_ct != ''\n\t\t\t\tAND date_ct >= '" . $timestamp_debut . "'\n\t\t\t\tAND date_ct <= '" . $timestamp_fin . "'\n\t\t\t\tORDER BY date_ct;";
    //echo "$sql<br />\n";
    $res = mysqli_query($GLOBALS["mysqli"], $sql);
    if (mysqli_num_rows($res) > 0) {
        while ($lig = mysqli_fetch_object($res)) {
            $notice_privee = CahierTexteNoticePriveePeer::retrieveByPK($lig->id_ct);
            //$retour.="<div style='border: 1px solid black; margin: 0.5em; background-color:".$couleur_cellule['p']."'>\n";
            $retour .= "<div style='border: 1px solid black; margin: 0.5em; margin-left:25px; background-color: #f6f3a8'>\n";
            $retour .= "<div style='float: right; width: 4em; margin-right: 2em;'>" . date_from_timestamp($lig->date_ct) . "</div>\n";
            if (my_strtoupper($lig->id_login) == my_strtoupper($_SESSION['login'])) {
                $retour .= '<div style="margin: 0px; float: left;">';
                $retour .= "<a href=\"#\" onclick=\"javascript:\n\t\t\t\t\t\tid_groupe = '" . $lig->id_groupe . "';\n\t\t\t\t\t\tgetWinEditionNotice().setAjaxContent('ajax_edition_notice_privee.php?id_ct=" . $lig->id_ct . "',{ onComplete: function() {\tinitWysiwyg();}});\n\t\t\t\t\t\tupdateCalendarWithUnixDate(" . $lig->date_ct . ");\n\t\t\t\t\t\tgetWinListeNotices();\n\t\t\t\t\t\tnew Ajax.Updater('affichage_liste_notice', './ajax_affichages_liste_notices.php?id_groupe=" . $lig->id_groupe . "',{ onComplete:function() {updateDivModification();}});\n\t\t\t\t\t\tobject_en_cours_edition = 'notice_privee';\n\t\t\t\t\t";
                $retour .= "\">";
                $retour .= "<img style=\"border: 0px;\" src=\"../images/edit16.png\" alt=\"modifier\" title=\"modifier\" /></a>\n";
                $retour .= " ";
                if ($notice_privee != null) {
                    $retour .= "<a href=\"#\" onclick=\"javascript:\n\t\t\t\t\t\t\tcontenu_a_copier = '" . addslashes(htmlspecialchars($lig->contenu)) . "';\n\t\t\t\t\t\t\tct_a_importer_class='" . get_class($notice_privee) . "';\n\t\t\t\t\t\t\tid_ct_a_importer='" . $lig->id_ct . "';\n\t\t\t\t\t\t\tnew Ajax.Updater('affichage_liste_notice', './ajax_affichages_liste_notices.php?id_groupe=" . $lig->id_groupe . "&ct_a_importer_class=" . get_class($notice_privee) . "&id_ct_a_importer=" . $lig->id_ct . "',{ onComplete:function() {updateDivModification();} });\n\t\t\t\t\t\t\tgetWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe=" . $lig->id_groupe . "&today={$lig->date_ct}');\n\t\t\t\t\t\t\t\"><img style=\"border: 0px;\" src=\"";
                    if (isset($_SESSION['ct_a_importer']) && $_SESSION['ct_a_importer'] == $notice_privee) {
                        $retour .= "../images/icons/copy-16-gold.png";
                    } else {
                        $retour .= "../images/icons/copy-16.png";
                    }
                    $retour .= "\" alt=\"Copier\" title=\"Copier\" /></a>\n";
                }
                $retour .= " ";
                $retour .= "<a href=\"#\" onclick=\"javascript:\n\t\t\t\t\tsuppressionNoticePrivee('" . strftime("%A %d %B %Y", $lig->date_ct) . "','" . $lig->id_ct . "', '" . $lig->id_groupe . "','" . add_token_in_js_func() . "');\n\t\t\t\t\tnew Ajax.Updater('affichage_derniere_notice', 'ajax_affichage_dernieres_notices.php', {onComplete : function () {updateDivModification();}});\n\t\t\t\t\tgetWinListeNoticesPrivees().setAjaxContent('./ajax_liste_notices_privees.php?id_groupe=" . $lig->id_groupe . "&today=all');\n\t\t\t\t\treturn false;\n\t\t\t\t\t\"><img style=\"border: 0px;\" src=\"../images/delete16.png\" alt=\"supprimer\" title=\"supprimer\" /></a>\n";
                $retour .= '</div>';
            }
            $retour .= $lig->contenu;
            $retour .= "</div>\n";
        }
    } else {
        $retour .= "Aucune Notice Privée pour cet enseignement (" . $info_groupe . ") le {$date_jour}.";
    }
    return $retour;
}