Example #1
0
function affiche_calendrier_saisie_date($user_login, $year, $mois, $type_debut_fin)
{
    $jour_today = date('j');
    $jour_today_name = date('D');
    $first_jour_mois_timestamp = mktime(0, 0, 0, $mois, 1, $year);
    $last_jour_mois_timestamp = mktime(0, 0, 0, $mois + 1, 0, $year);
    $mois_name = date_fr('F', $first_jour_mois_timestamp);
    $first_jour_mois_rang = date('w', $first_jour_mois_timestamp);
    // jour de la semaine en chiffre (0=dim , 6=sam)
    $last_jour_mois_rang = date('w', $last_jour_mois_timestamp);
    // jour de la semaine en chiffre (0=dim , 6=sam)
    $nb_jours_mois = ($last_jour_mois_timestamp - $first_jour_mois_timestamp + 60 * 60 * 12) / (24 * 60 * 60);
    // + 60*60 *12 for f*****g DST
    if ($first_jour_mois_rang == 0) {
        $first_jour_mois_rang = 7;
    }
    // jour de la semaine en chiffre (1=lun , 7=dim)
    if ($last_jour_mois_rang == 0) {
        $last_jour_mois_rang = 7;
    }
    // jour de la semaine en chiffre (1=lun , 7=dim)
    echo '<table class="calendrier_saisie_date_debut" cellpadding="0" cellspacing="0">
        <thead>
        <tr align="center" bgcolor="' . $_SESSION['config']['light_grey_bgcolor'] . '">
        <td colspan=7 class="titre"> ' . $mois_name . ' ' . $year . ' </td>
        </tr>
        <tr bgcolor="' . $_SESSION['config']['light_grey_bgcolor'] . '">
        <td class="cal-saisie2">' . _('lundi_1c') . '</td>
        <td class="cal-saisie2">' . _('mardi_1c') . '</td>
        <td class="cal-saisie2">' . _('mercredi_1c') . '</td>
        <td class="cal-saisie2">' . _('jeudi_1c') . '</td>
        <td class="cal-saisie2">' . _('vendredi_1c') . '</td>
        <td class="cal-saisie2">' . _('samedi_1c') . '</td>
        <td class="cal-saisie2">' . _('dimanche_1c') . '</td>
        </tr>
        </thead>
        <tbody>';
    $start_nb_day_before = $first_jour_mois_rang - 1;
    $stop_nb_day_before = 7 - $last_jour_mois_rang;
    for ($i = -$start_nb_day_before; $i <= $nb_jours_mois + $stop_nb_day_before; $i++) {
        if (($i + $start_nb_day_before) % 7 == 0) {
            echo '<tr>';
        }
        $j_timestamp = mktime(0, 0, 0, $mois, $i + 1, $year);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if ($i < 0 || $i > $nb_jours_mois) {
            echo '<td class="' . $td_second_class . '">-</td>';
        } else {
            affiche_cellule_jour_cal_saisie($user_login, $j_timestamp, $td_second_class, $type_debut_fin);
        }
        if (($i + $start_nb_day_before) % 7 == 6) {
            echo '<tr>';
        }
    }
    echo '</tbody></table>';
}
Example #2
0
function affiche_jour_hors_mois($mois, $i, $year, $tab_year)
{
    $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
    $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
    return "<td class=\"cal-saisie2 month-out {$td_second_class}\">&nbsp;</td>\n";
}
Example #3
0
function affichage_calendrier($year, $mois, $first_jour, $timestamp_today, $printable, $selected, $tab_type_absence, $select_groupe, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    global $content;
    // recup du tableau des types de conges (seulement les conges)
    $tab_type_cong = recup_tableau_types_conges($DEBUG);
    if ($_SESSION['config']['gestion_conges_exceptionnels']) {
        $tab_type_cong_excep = recup_tableau_types_conges_exceptionnels($DEBUG);
    }
    /*****************************************/
    /** Récupération des users à afficher:  **/
    $tab_all_users = recup_tableau_des_users_a_afficher($select_groupe, $DEBUG);
    if ($_SESSION['config']['gestion_groupes'] && $select_groupe != 0) {
        $tab_logins = array_keys($tab_all_users);
        $tab_logins = array_map("SQL::quote", $tab_logins);
    } else {
        $tab_logins = false;
    }
    /** FIN de Récupération des users à afficher:  **/
    /************************************************/
    /*************************/
    /**  AFFICHAGE TABLEAU  **/
    if ($printable != 1) {
        // si version ecran :
        $content .= "<table cellpadding=\"1\" class=\"tablo-cal\" width=\"80%\">\n";
    } else {
        // si version imprimable :
        $content .= "<table cellpadding=\"1\" cellspacing=\"0\" border=\"1\" width=\"80%\">\n";
    }
    /*************************************/
    // affichage premiere ligne (semaines)
    $content .= "<tr align=\"center\">\n";
    // affichage nom prenom quotité
    $nb_colonnes = 3;
    $content .= "\t<td class=\"cal-user\" rowspan=\"2\">" . _('divers_nom_maj') . "</td>\n\n";
    $content .= "\t<td class=\"cal-user\" rowspan=\"2\">" . _('divers_prenom_maj') . "</td>\n\n";
    $content .= "\t<td class=\"cal-user\" rowspan=\"2\">%</td>";
    // affichage des semaines
    // ... du premier jour voulu à la fin du mois
    for ($j = $first_jour; checkdate($mois, $j, $year); $j++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
        $j_num_semaine = date_fr("W", $j_timestamp);
        // attention date_fr("w", $j_timestamp) renvoit 0 pour dimanche !
        if (date_fr("w", $j_timestamp) == 0) {
            $j_num_jour_semaine = 7;
        } else {
            $j_num_jour_semaine = date_fr("w", $j_timestamp);
        }
        //DEBUG : $content .= "<td class=\"cal-day\" >$j_num_jour_semaine / $j_num_semaine</td>";
        if ($j == $first_jour) {
            $colspan = 8 - $j_num_jour_semaine;
            $content .= "<td class=\"cal-day-first\" colspan=\"{$colspan}\" >" . _('divers_semaine') . " {$j_num_semaine}</td>\n";
        } else {
            // on affiche que les lundi
            if ($j_num_jour_semaine == 1) {
                $content .= "<td class=\"cal-day\" colspan=\"7\" >" . _('divers_semaine') . " {$j_num_semaine}</td>\n";
            }
        }
    }
    // ... si le premier jour voulu n'etait pas le premier du mois, on va jusqu'à la meme date du mois suivant.
    if ($first_jour != 1) {
        for ($j = 1; $j < $first_jour; $j++) {
            if ($mois == 12) {
                $mois_select = 1;
                $year_select = $year + 1;
            } else {
                $mois_select = $mois + 1;
                $year_select = $year;
            }
            $j_timestamp = mktime(0, 0, 0, $mois_select, $j, $year_select);
            $j_num_jour_semaine = date_fr("w", $j_timestamp);
            $j_num_semaine = date_fr("W", $j_timestamp);
            // attention date_fr("w", $j_timestamp) renvoit 0 pour dimanche !
            if (date_fr("w", $j_timestamp) == 0) {
                $j_num_jour_semaine = 7;
            } else {
                $j_num_jour_semaine = date_fr("w", $j_timestamp);
            }
            //DEBUG : $content .= "<td class=\"cal-day\" >$j_num_jour_semaine / $j_num_semaine</td>";
            if ($j == $first_jour) {
                $colspan = 8 - $j_num_jour_semaine;
                $content .= "<td class=\"cal-day-first\" colspan=\"{$colspan}\" >" . _('divers_semaine') . " {$j_num_semaine}</td>\n";
            } else {
                // on affiche que les lundi
                if ($j_num_jour_semaine == 1) {
                    $content .= "<td class=\"cal-day\" colspan=\"7\" >" . _('divers_semaine') . " {$j_num_semaine}</td>\n";
                }
            }
        }
    }
    //		if( $_SESSION['config']['affiche_soldes_calendrier'] || is_resp($_SESSION['userlogin']) || is_hr($_SESSION['userlogin']) || is_admin($_SESSION['userlogin']) )
    //		{
    //			// affichage des libellé des conges
    //			foreach($tab_type_cong as $id => $libelle)
    //			{
    //					$content .= "<td class=\"cal-user\" rowspan=\"2\">". _('divers_solde') ." $libelle</td>\n";
    //					$nb_colonnes=$nb_colonnes+1;
    //			}
    //
    //
    //			if ($_SESSION['config']['gestion_conges_exceptionnels'])
    //			{
    //				foreach($tab_type_cong_excep as $id => $libelle)
    //				{
    //					$content .= "<td class=\"cal-user\" rowspan=\"2\">". _('divers_solde') ." $libelle</td>\n";
    //					$nb_colonnes=$nb_colonnes+1;
    //				}
    //			}
    //		}
    $content .= "</tr>\n\n";
    /*************************************/
    // affichage 2ieme ligne (dates)
    $content .= "<tr align=\"center\">\n";
    // on affiche pas car on a fait de "rowspan" à la ligne supérieure
    // affichage d'une cellule vide sous les titres
    //$content .= "	<td class=\"cal-user\" colspan=\"$nb_colonnes\">&nbsp;</td>\n";
    //dernier jour = dimanche ?
    $last = 7;
    // affichage des dates
    // ... du premier jour voulu à la fin du mois
    for ($j = $first_jour; checkdate($mois, $j, $year); $j++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
        $j_name = date_fr("D", $j_timestamp);
        $last = date("N", $j_timestamp);
        $j_date_fr = date_fr("d-m-Y", $j_timestamp);
        $j_num_semaine = date_fr("W", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        // on affiche en gras le jour d'aujourd'hui
        if ($j_timestamp == $timestamp_today) {
            $text_titre_date = "<b>{$j_name} <br>{$j}</b>";
        } else {
            $text_titre_date = "{$j_name} <br>{$j}";
        }
        // on regarde si c'est la premiere cellule ou non
        if ($j == $first_jour) {
            $cal_day = "cal-day-first";
        } else {
            $cal_day = "cal-day";
        }
        // on affiche le titre -date (la date du jour)
        $content .= "<td class=\"{$cal_day} {$td_second_class}\" title=\"{$j_date_fr} / " . _('divers_semaine') . " {$j_num_semaine}\">{$text_titre_date}</td>";
    }
    // ... si le premier jour voulu n'etait pas le premier du mois, on va jusqu'à la meme date du mois suivant.
    if ($first_jour != 1) {
        for ($j = 1; $j < $first_jour; $j++) {
            if ($mois == 12) {
                $mois_select = 1;
                $year_select = $year + 1;
            } else {
                $mois_select = $mois + 1;
                $year_select = $year;
            }
            $j_timestamp = mktime(0, 0, 0, $mois_select, $j, $year_select);
            $last = date("N", $j_timestamp);
            $j_name = date_fr("D", $j_timestamp);
            $j_date_fr = date_fr("d-m-Y", $j_timestamp);
            $j_num_semaine = date_fr("W", $j_timestamp);
            $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
            // on affiche en gras le jour d'aujourd'hui
            if ($j_timestamp == $timestamp_today) {
                $content .= "<td class=\"cal-day {$td_second_class}\" title=\"{$j_date_fr} / " . _('divers_semaine') . " {$j_num_semaine}\"><b>{$j_name} {$j}/{$mois_select}</b></td>";
            } else {
                $content .= "<td class=\"cal-day {$td_second_class}\" title=\"{$j_date_fr} / " . _('divers_semaine') . " {$j_num_semaine}\">{$j_name} {$j}/{$mois_select}</td>";
            }
        }
    }
    if ($last < 7) {
        for ($i = $last; $i < 7; $i++) {
            $content .= '<td></td>';
        }
    }
    $content .= "</tr>\n";
    /**************************************************/
    /**************************************************/
    /* recup des info de chaque jour pour tous les users et stockage dans 1 tableau de tableaux */
    $tab_calendrier = recup_tableau_periodes($mois, $first_jour, $year, $tab_logins);
    /**************************************************/
    /* recup des rtt de chaque jour pour tous les users et stockage dans 2 tableaux de tableaux */
    /**************************************************/
    //$tab_rtt_echange  //tableau indexé dont la clé est la date sous forme yyyy-mm-dd
    //il contient pour chaque clé (chaque jour): un tableau indéxé ($tab_jour_rtt_echange) (clé= login)
    // qui contient lui même un tableau ($tab_echange) contenant les infos des echanges de rtt pour ce
    // jour et ce login (valeur du matin + valeur de l'apres midi ('Y' si rtt, 'N' sinon) )
    //$tab_rtt_planifiees=array();  //tableau indexé dont la clé est le login_user
    // il contient pour chaque clé login : un tableau ($tab_user_grille) indexé dont la
    // clé est la date_fin_grille.
    // qui contient lui meme pour chaque clé : un tableau ($tab_user_rtt) qui contient enfin
    // les infos pour le matin et l'après midi ('Y' si rtt, 'N' sinon) sur 2 semaines
    // ( du sem_imp_lu_am au sem_p_ve_pm ) + la date de début et de fin de la grille
    $tab_rtt_echange = recup_tableau_rtt_echange($mois, $first_jour, $year, $tab_logins);
    $tab_rtt_planifiees = recup_tableau_rtt_planifiees($mois, $first_jour, $year, $tab_logins);
    $tab_cong_users = recup_tableau_conges_for_users(false, $tab_logins);
    /**************************************************/
    /**************************************************/
    // affichage lignes suivantes (users)
    // pour chaque user :
    foreach ($tab_all_users as $sql_login => $tab_current_user) {
        $sql_nom = $tab_current_user["nom"];
        $sql_prenom = $tab_current_user["prenom"];
        $sql_quotite = $tab_current_user["quotite"];
        // nb de jour pris dans le mois en cours (pour un type d'absence donné)
        $nb_jours_current_month = array();
        // recup dans un tableau de tableaux les nb et soldes de conges d'un user (indicé par id de conges)
        $tab_cong_user = $tab_cong_users[$sql_login];
        if ($printable == 1) {
            $content .= "<tr align=\"center\" class=\"cal-ligne-user-edit\">\n";
        } elseif ($selected == $sql_login) {
            $content .= "<tr align=\"center\" class=\"cal-ligne-user-selected\">\n";
        } else {
            $content .= "<tr align=\"center\" class=\"cal-ligne-user\">\n";
        }
        if ($printable == 1) {
            $text_nom = "<b>{$sql_nom}</b>";
        } else {
            $text_nom = "<a href=\"{$PHP_SELF}?session={$session}&selected={$sql_login}&year={$year}&mois={$mois}&first_jour={$first_jour}&printable={$printable}&select_groupe={$select_groupe}\" method=\"GET\">{$sql_nom}</a>";
        }
        // affichage nom prenom quotité
        $content .= "<td class=\"cal-user\">{$text_nom}</td><td class=\"cal-user\">{$sql_prenom}</td><td class=\"cal-user\">{$sql_quotite}%</td>";
        // pour chaque jour : (du premier jour demandé à la fin du mois ...)
        for ($j = $first_jour; checkdate($mois, $j, $year); $j++) {
            $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
            $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
            $mois_select = $mois;
            $year_select = $year;
            // affichage de la cellule correspondant au jour et au user considéré
            $t_nb_j_type_abs = affiche_cellule_jour_user($sql_login, $j_timestamp, $year, $mois_select, $j, $td_second_class, $printable, $tab_calendrier, $tab_rtt_echange, $tab_rtt_planifiees, $tab_type_absence);
            foreach ($t_nb_j_type_abs as $id_type_abs => $nb_j_pris) {
                if (isset($nb_jours_current_month[$id_type_abs])) {
                    $nb_jours_current_month[$id_type_abs] += $nb_j_pris;
                } else {
                    $nb_jours_current_month[$id_type_abs] = $nb_j_pris;
                }
            }
        }
        // si le premier jour demandé n'est pas le 1ier du mois , on va jusqu'à la meme date le mois suivant :
        if ($first_jour != 1) {
            // pour chaque jour jusqu'a la date voulue : (meme num de jour le mois suivant)
            for ($j = 1; $j < $first_jour; $j++) {
                $j_timestamp = mktime(0, 0, 0, $mois + 1, $j, $year);
                $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
                if ($mois == 12) {
                    $mois_select = 1;
                    $year_select = $year + 1;
                } else {
                    $mois_select = $mois + 1;
                    $year_select = $year;
                }
                // affichage de la cellule correspondant au jour et au user considéré
                $t_nb_j_type_abs = affiche_cellule_jour_user($sql_login, $j_timestamp, $year, $mois_select, $j, $td_second_class, $printable, $tab_calendrier, $tab_rtt_echange, $tab_rtt_planifiees, $tab_type_absence);
                foreach ($t_nb_j_type_abs as $id_type_abs => $nb_j_pris) {
                    if (isset($nb_jours_current_month[$id_type_abs])) {
                        $nb_jours_current_month[$id_type_abs] += $nb_j_pris;
                    } else {
                        $nb_jours_current_month[$id_type_abs] = $nb_j_pris;
                    }
                }
            }
        }
        if ($last < 7) {
            for ($i = $last; $i < 7; $i++) {
                $content .= '<td></td>';
            }
        }
        //			if( $_SESSION['config']['affiche_soldes_calendrier'] || is_resp($_SESSION['userlogin']) || is_hr($_SESSION['userlogin']) || is_admin($_SESSION['userlogin']) )
        //			{
        //				// affichage des divers soldes
        //				foreach($tab_cong_user as $id => $tab_conges)
        //				{
        //					// si des jours ont été pris durant le mois affiché, on indique combien :
        //					if((isset($nb_jours_current_month[$id])) && ($_SESSION['config']['affiche_jours_current_month_calendrier']) )
        //						//$content .= "<td class=\"cal-user\">"./*$tab_conges['solde'].*/"&nbsp;("./*$nb_jours_current_month[$id].*/")</td>";
        //					else
        //						//$content .= "<td class=\"cal-user\">"./*$tab_conges['solde'].*/"</td>";
        //				}
        //			}
        $content .= "\n</tr>\n";
    }
    $content .= "</table>\n\n";
}
function affiche_calendrier_saisie_jours_chomes($year, $mois, $tab_year, $DEBUG = FALSE)
{
    $jour_today = date("j");
    $jour_today_name = date("D");
    $first_jour_mois_timestamp = mktime(0, 0, 0, $mois, 1, $year);
    $mois_name = date_fr("F", $first_jour_mois_timestamp);
    $first_jour_mois_rang = date("w", $first_jour_mois_timestamp);
    // jour de la semaine en chiffre (0=dim , 6=sam)
    if ($first_jour_mois_rang == 0) {
        $first_jour_mois_rang = 7;
    }
    // jour de la semaine en chiffre (1=lun , 7=dim)
    echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" width=\"250\" bgcolor=" . $_SESSION['config']['semaine_bgcolor'] . ">\n";
    /* affichage  2 premieres lignes */
    echo "\t<tr align=\"center\" bgcolor=\"" . $_SESSION['config']['light_grey_bgcolor'] . "\"><td colspan=7 class=\"titre\"> {$mois_name} {$year} </td></tr>\n";
    echo "\t<tr bgcolor=\"" . $_SESSION['config']['light_grey_bgcolor'] . "\">\n";
    echo "\t\t<td class=\"cal-saisie2\">" . _('lundi_1c') . "</td>\n";
    echo "\t\t<td class=\"cal-saisie2\">" . _('mardi_1c') . "</td>\n";
    echo "\t\t<td class=\"cal-saisie2\">" . _('mercredi_1c') . "</td>\n";
    echo "\t\t<td class=\"cal-saisie2\">" . _('jeudi_1c') . "</td>\n";
    echo "\t\t<td class=\"cal-saisie2\">" . _('vendredi_1c') . "</td>\n";
    echo "\t\t<td class=\"cal-saisie2\">" . _('samedi_1c') . "</td>\n";
    echo "\t\t<td class=\"cal-saisie2\">" . _('dimanche_1c') . "</td>\n";
    echo "\t</tr>\n";
    /* affichage ligne 1 du mois*/
    echo "<tr>\n";
    // affichage des cellules vides jusqu'au 1 du mois ...
    for ($i = 1; $i < $first_jour_mois_rang; $i++) {
        if ($i == 6 && $_SESSION['config']['samedi_travail'] == FALSE || $i == 7 && $_SESSION['config']['dimanche_travail'] == FALSE) {
            $bgcolor = $_SESSION['config']['week_end_bgcolor'];
        } else {
            $bgcolor = $_SESSION['config']['semaine_bgcolor'];
        }
        echo "<td bgcolor={$bgcolor} class=\"cal-saisie2\">-</td>";
    }
    // affichage des cellules cochables du 1 du mois à la fin de la ligne ...
    for ($i = $first_jour_mois_rang; $i < 8; $i++) {
        $j = $i - $first_jour_mois_rang + 1;
        $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\" checked></td>";
        } else {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\"></td>";
        }
    }
    echo "</tr>\n";
    /* affichage ligne 2 du mois*/
    echo "<tr>\n";
    for ($i = 8 - $first_jour_mois_rang + 1; $i < 15 - $first_jour_mois_rang + 1; $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\" checked></td>";
        } else {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\"></td>";
        }
    }
    echo "</tr>\n";
    /* affichage ligne 3 du mois*/
    echo "<tr>\n";
    for ($i = 15 - $first_jour_mois_rang + 1; $i < 22 - $first_jour_mois_rang + 1; $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\" checked></td>";
        } else {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\"></td>";
        }
    }
    echo "</tr>\n";
    /* affichage ligne 4 du mois*/
    echo "<tr>\n";
    for ($i = 22 - $first_jour_mois_rang + 1; $i < 29 - $first_jour_mois_rang + 1; $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\" checked></td>";
        } else {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\"></td>";
        }
    }
    echo "</tr>\n";
    /* affichage ligne 5 du mois (peut etre la derniere ligne) */
    echo "<tr>\n";
    for ($i = 29 - $first_jour_mois_rang + 1; $i < 36 - $first_jour_mois_rang + 1 && checkdate($mois, $i, $year); $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\" checked></td>";
        } else {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\"></td>";
        }
    }
    for ($i; $i < 36 - $first_jour_mois_rang + 1; $i++) {
        if ($i == 35 - $first_jour_mois_rang && $_SESSION['config']['samedi_travail'] == FALSE || $i == 36 - $first_jour_mois_rang && $_SESSION['config']['dimanche_travail'] == FALSE) {
            $bgcolor = $_SESSION['config']['week_end_bgcolor'];
        } else {
            $bgcolor = $_SESSION['config']['semaine_bgcolor'];
        }
        echo "<td bgcolor={$bgcolor} class=\"cal-saisie2\">-</td>";
    }
    echo "</tr>\n";
    /* affichage ligne 6 du mois (derniere ligne)*/
    echo "<tr>\n";
    for ($i = 36 - $first_jour_mois_rang + 1; checkdate($mois, $i, $year); $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\" checked></td>";
        } else {
            echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}<input type=\"checkbox\" name=\"tab_checkbox_j_chome[{$j_date}]\" value=\"Y\"></td>";
        }
    }
    for ($i; $i < 43 - $first_jour_mois_rang + 1; $i++) {
        if ($i == 42 - $first_jour_mois_rang && $_SESSION['config']['samedi_travail'] == FALSE || $i == 43 - $first_jour_mois_rang && $_SESSION['config']['dimanche_travail'] == FALSE) {
            $bgcolor = $_SESSION['config']['week_end_bgcolor'];
        } else {
            $bgcolor = $_SESSION['config']['semaine_bgcolor'];
        }
        echo "<td bgcolor={$bgcolor} class=\"cal-saisie2\">-</td>";
    }
    echo "</tr>\n";
    echo "</table>\n";
}
Example #5
0
 public static function affiche_calendrier_saisie_jour_absence($user_login, $year, $mois)
 {
     $return = '';
     $jour_today = date('j');
     $jour_today_name = date('D');
     $first_jour_mois_timestamp = mktime(0, 0, 0, $mois, 1, $year);
     $last_jour_mois_timestamp = mktime(0, 0, 0, $mois + 1, 0, $year);
     $mois_name = date_fr('F', $first_jour_mois_timestamp);
     $first_jour_mois_rang = date('w', $first_jour_mois_timestamp);
     // jour de la semaine en chiffre (0=dim , 6=sam)
     $last_jour_mois_rang = date('w', $last_jour_mois_timestamp);
     // jour de la semaine en chiffre (0=dim , 6=sam)
     $nb_jours_mois = ($last_jour_mois_timestamp - $first_jour_mois_timestamp + 60 * 60 * 12) / (24 * 60 * 60);
     // + 60*60 *12 for f*****g DST
     if ($first_jour_mois_rang == 0) {
         $first_jour_mois_rang = 7;
     }
     // jour de la semaine en chiffre (1=lun , 7=dim)
     if ($last_jour_mois_rang == 0) {
         $last_jour_mois_rang = 7;
     }
     // jour de la semaine en chiffre (1=lun , 7=dim)
     $return .= '<table class="table calendrier_saisie_date">';
     $return .= '<thead><tr><th colspan="7" class="titre"> ' . $mois_name . ' ' . $year . ' </th></tr><tr><th class="cal-saisie2">' . _('lundi_1c') . '</th><th class="cal-saisie2">' . _('mardi_1c') . '</th><th class="cal-saisie2">' . _('mercredi_1c') . '</th><th class="cal-saisie2">' . _('jeudi_1c') . '</th><th class="cal-saisie2">' . _('vendredi_1c') . '</th><th class="cal-saisie2">' . _('samedi_1c') . '</th><th class="cal-saisie2">' . _('dimanche_1c') . '</th></tr></thead>';
     $return .= '<tbody>';
     $start_nb_day_before = $first_jour_mois_rang - 1;
     $stop_nb_day_before = 7 - $last_jour_mois_rang;
     for ($i = -$start_nb_day_before; $i <= $nb_jours_mois + $stop_nb_day_before; $i++) {
         if (($i + $start_nb_day_before) % 7 == 0) {
             $return .= '<tr>';
         }
         $j_timestamp = mktime(0, 0, 0, $mois, $i + 1, $year);
         $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
         if ($i < 0 || $i > $nb_jours_mois || $td_second_class == 'weekend') {
             $return .= '<td class="' . $td_second_class . '">-</td>';
         } else {
             $val_matin = '';
             $val_aprem = '';
             recup_infos_artt_du_jour($user_login, $j_timestamp, $val_matin, $val_aprem);
             $return .= \utilisateur\Fonctions::affiche_cellule_calendrier_echange_absence_saisie_semaine($val_matin, $val_aprem, $year, $mois, $i + 1);
         }
         if (($i + $start_nb_day_before) % 7 == 6) {
             $return .= '<tr>';
         }
     }
     $return .= '</tbody>';
     $return .= '</table>';
     return $return;
 }
function affiche_calendrier_fermeture_mois($year, $mois, $tab_year, $DEBUG = FALSE)
{
    $jour_today = date("j");
    $jour_today_name = date("D");
    $first_jour_mois_timestamp = mktime(0, 0, 0, $mois, 1, $year);
    $mois_name = date_fr("F", $first_jour_mois_timestamp);
    $first_jour_mois_rang = date("w", $first_jour_mois_timestamp);
    // jour de la semaine en chiffre (0=dim , 6=sam)
    if ($first_jour_mois_rang == 0) {
        $first_jour_mois_rang = 7;
    }
    // jour de la semaine en chiffre (1=lun , 7=dim)
    echo "<table>\n";
    /* affichage  2 premieres lignes */
    echo "\t<thead>\n";
    echo "\t<tr><th colspan=7 class=\"titre\"> {$mois_name} {$year} </th></tr>\n";
    echo "\t<tr>\n";
    echo "\t\t<th class=\"cal-saisie2\">" . _('lundi_1c') . "</th>\n";
    echo "\t\t<th class=\"cal-saisie2\">" . _('mardi_1c') . "</th>\n";
    echo "\t\t<th class=\"cal-saisie2\">" . _('mercredi_1c') . "</th>\n";
    echo "\t\t<th class=\"cal-saisie2\">" . _('jeudi_1c') . "</th>\n";
    echo "\t\t<th class=\"cal-saisie2\">" . _('vendredi_1c') . "</th>\n";
    echo "\t\t<th class=\"cal-saisie2\">" . _('samedi_1c') . "</th>\n";
    echo "\t\t<th class=\"cal-saisie2\">" . _('dimanche_1c') . "</th>\n";
    echo "\t</tr>\n";
    echo "\t</thead>\n";
    /* affichage ligne 1 du mois*/
    echo "<tr>\n";
    // affichage des cellules vides jusqu'au 1 du mois ...
    for ($i = 1; $i < $first_jour_mois_rang; $i++) {
        if ($i == 6 && $_SESSION['config']['samedi_travail'] == FALSE || $i == 7 && $_SESSION['config']['dimanche_travail'] == FALSE) {
            $bgcolor = $_SESSION['config']['week_end_bgcolor'];
        } else {
            $bgcolor = $_SESSION['config']['semaine_bgcolor'];
        }
        echo "<td class=\"month-out cal-saisie2\">&nbsp;</td>";
    }
    // affichage des cellules du 1 du mois à la fin de la ligne ...
    for ($i = $first_jour_mois_rang; $i < 8; $i++) {
        $j = $i - $first_jour_mois_rang + 1;
        $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            $td_second_class = "fermeture";
        }
        echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}</td>";
    }
    echo "</tr>\n";
    /* affichage ligne 2 du mois*/
    echo "<tr>\n";
    for ($i = 8 - $first_jour_mois_rang + 1; $i < 15 - $first_jour_mois_rang + 1; $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            $td_second_class = "fermeture";
        }
        echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}</td>";
    }
    echo "</tr>\n";
    /* affichage ligne 3 du mois*/
    echo "<tr>\n";
    for ($i = 15 - $first_jour_mois_rang + 1; $i < 22 - $first_jour_mois_rang + 1; $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            $td_second_class = "fermeture";
        }
        echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}</td>";
    }
    echo "</tr>\n";
    /* affichage ligne 4 du mois*/
    echo "<tr>\n";
    for ($i = 22 - $first_jour_mois_rang + 1; $i < 29 - $first_jour_mois_rang + 1; $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            $td_second_class = "fermeture";
        }
        echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}</td>";
    }
    echo "</tr>\n";
    /* affichage ligne 5 du mois (peut etre la derniere ligne) */
    echo "<tr>\n";
    for ($i = 29 - $first_jour_mois_rang + 1; $i < 36 - $first_jour_mois_rang + 1 && checkdate($mois, $i, $year); $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            $td_second_class = "fermeture";
        }
        echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}</td>";
    }
    for ($i; $i < 36 - $first_jour_mois_rang + 1; $i++) {
        if ($i == 35 - $first_jour_mois_rang && $_SESSION['config']['samedi_travail'] == FALSE || $i == 36 - $first_jour_mois_rang && $_SESSION['config']['dimanche_travail'] == FALSE) {
            $bgcolor = $_SESSION['config']['week_end_bgcolor'];
        } else {
            $bgcolor = $_SESSION['config']['semaine_bgcolor'];
        }
        echo "<td class=\"cal-saisie2 month-out\">&nbsp;</td>";
    }
    echo "</tr>\n";
    /* affichage ligne 6 du mois (derniere ligne)*/
    echo "<tr>\n";
    for ($i = 36 - $first_jour_mois_rang + 1; checkdate($mois, $i, $year); $i++) {
        $j_timestamp = mktime(0, 0, 0, $mois, $i, $year);
        $j_date = date("Y-m-d", $j_timestamp);
        $j_day = date("d", $j_timestamp);
        $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
        if (in_array("{$j_date}", $tab_year)) {
            $td_second_class = "fermeture";
        }
        echo "<td  class=\"cal-saisie {$td_second_class}\">{$j_day}</td>";
    }
    for ($i; $i < 43 - $first_jour_mois_rang + 1; $i++) {
        if ($i == 42 - $first_jour_mois_rang && $_SESSION['config']['samedi_travail'] == FALSE || $i == 43 - $first_jour_mois_rang && $_SESSION['config']['dimanche_travail'] == FALSE) {
            $bgcolor = $_SESSION['config']['week_end_bgcolor'];
        } else {
            $bgcolor = $_SESSION['config']['semaine_bgcolor'];
        }
        echo "<td class=\"month-out cal-saisie2\">&nbsp;</td>";
    }
    echo "</tr>\n";
    echo "</table>\n";
}
Example #7
0
 public static function affichage_calendrier($year, $mois, $first_jour, $timestamp_today, $printable, $selected, $tab_type_absence, $select_groupe)
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $session = session_id();
     $nb_day = date('t', mktime(1, 1, 1, $mois, 1, $year));
     $return = '';
     // recup du tableau des types de conges (seulement les conges)
     $tab_type_cong = recup_tableau_types_conges();
     if ($_SESSION['config']['gestion_conges_exceptionnels']) {
         $tab_type_cong_excep = recup_tableau_types_conges_exceptionnels();
     }
     /*****************************************/
     /** Récupération des users à afficher:  **/
     $tab_all_users = \calendrier\Fonctions::recup_tableau_des_users_a_afficher($select_groupe);
     if ($_SESSION['config']['gestion_groupes'] && $select_groupe != 0) {
         $tab_logins = array_keys($tab_all_users);
         $tab_logins = array_map("\\includes\\SQL::quote", $tab_logins);
     } else {
         $tab_logins = false;
     }
     /** FIN de Récupération des users à afficher:  **/
     /************************************************/
     /*************************/
     /**  AFFICHAGE TABLEAU  **/
     if ($printable != 1) {
         // si version ecran :
         $return .= '<table class="calendar table table-responsive table-bordered table-stripped">';
     } else {
         // si version imprimable :
         $return .= '<table>';
     }
     $return .= '<tr><th colspan="2"></th><th colspan="' . $nb_day . '">' . _('divers_semaine') . '</th><th colspan="8">Solde</th></tr>';
     /*************************************/
     // affichage premiere ligne (semaines)
     $return .= '<tr align="center">';
     // affichage nom prenom quotité
     $nb_colonnes = 3;
     $return .= '<th rowspan="2">Utilisateur</th>';
     $return .= '<th rowspan="2">Quotité</th>';
     // affichage des semaines
     // ... du premier jour voulu à la fin du mois
     for ($j = $first_jour; checkdate($mois, $j, $year); $j++) {
         $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
         $j_num_semaine = date_fr("W", $j_timestamp);
         // attention date_fr("w", $j_timestamp) renvoit 0 pour dimanche !
         if (date_fr("w", $j_timestamp) == 0) {
             $j_num_jour_semaine = 7;
         } else {
             $j_num_jour_semaine = date_fr("w", $j_timestamp);
         }
         if ($j == $first_jour) {
             $colspan = 8 - $j_num_jour_semaine;
             $return .= '<th class="cal-day-first" colspan="' . $colspan . '" >' . $j_num_semaine . '</th>';
         } else {
             $month_rest = $nb_day - $j;
             $colspan = 7;
             if ($month_rest < 6) {
                 $colspan = $month_rest + 1;
             }
             // on affiche que les lundi
             if ($j_num_jour_semaine == 1) {
                 $return .= '<th class="cal-day" colspan="' . $colspan . '" >' . $j_num_semaine . '</th>';
             }
         }
     }
     // ... si le premier jour voulu n'etait pas le premier du mois, on va jusqu'à la meme date du mois suivant.
     if ($first_jour != 1) {
         for ($j = 1; $j < $first_jour; $j++) {
             if ($mois == 12) {
                 $mois_select = 1;
                 $year_select = $year + 1;
             } else {
                 $mois_select = $mois + 1;
                 $year_select = $year;
             }
             $j_timestamp = mktime(0, 0, 0, $mois_select, $j, $year_select);
             $j_num_jour_semaine = date_fr("w", $j_timestamp);
             $j_num_semaine = date_fr("W", $j_timestamp);
             // attention date_fr("w", $j_timestamp) renvoit 0 pour dimanche !
             if (date_fr("w", $j_timestamp) == 0) {
                 $j_num_jour_semaine = 7;
             } else {
                 $j_num_jour_semaine = date_fr("w", $j_timestamp);
             }
             if ($j == $first_jour) {
                 $colspan = 8 - $j_num_jour_semaine;
                 $return .= '<td class="cal-day-first" colspan="' . $colspan . '">' . $j_num_semaine . '</td>';
             } else {
                 // on affiche que les lundi
                 if ($j_num_jour_semaine == 1) {
                     $return .= '<td class="cal-day" colspan="7" >' . $j_num_semaine . '</td>';
                 }
             }
         }
     }
     if ($_SESSION['config']['affiche_soldes_calendrier'] || is_resp($_SESSION['userlogin']) || is_hr($_SESSION['userlogin']) || is_admin($_SESSION['userlogin'])) {
         // affichage des libellé des conges
         $abs_libelle = recup_tableau_tout_types_abs();
         foreach ($tab_type_cong as $id => $libelle) {
             $return .= '<th rowspan="2">' . $abs_libelle[$id]['short_libelle'] . '</th>';
             $nb_colonnes = $nb_colonnes + 1;
         }
         if ($_SESSION['config']['gestion_conges_exceptionnels']) {
             foreach ($tab_type_cong_excep as $id => $libelle) {
                 $return .= '<th rowspan="2">' . $abs_libelle[$id]['short_libelle'] . '</th>';
                 $nb_colonnes = $nb_colonnes + 1;
             }
         }
     }
     $return .= '</tr>';
     /*************************************/
     // affichage 2ieme ligne (dates)
     $return .= '<tr>';
     // on affiche pas car on a fait de "rowspan" à la ligne supérieure
     // affichage d'une cellule vide sous les titres
     //echo "    <td class=\"cal-user\" colspan=\"$nb_colonnes\">&nbsp;</td>\n";
     //dernier jour = dimanche ?
     $last = 7;
     // affichage des dates
     // ... du premier jour voulu à la fin du mois
     for ($j = $first_jour; checkdate($mois, $j, $year); $j++) {
         $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
         // $j_name=date_fr("D", $j_timestamp);
         $j_name = substr(date_fr("D", $j_timestamp), 0, 1);
         $last = date("N", $j_timestamp);
         $j_date_fr = date_fr("d-m-Y", $j_timestamp);
         $j_num_semaine = date_fr("W", $j_timestamp);
         $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
         // on affiche en gras le jour d'aujourd'hui
         if ($j_timestamp == $timestamp_today) {
             $text_titre_date = "<b>{$j_name} <br/>{$j}</b>";
         } else {
             $text_titre_date = "{$j_name} <br/>{$j}";
         }
         // on regarde si c'est la premiere cellule ou non
         if ($j == $first_jour) {
             $cal_day = "cal-day-first";
         } else {
             $cal_day = "cal-day";
         }
         // on affiche le titre -date (la date du jour)
         $return .= '<td class="' . $cal_day . ' ' . $td_second_class . '" title="' . $j_date_fr . ' / ' . _('divers_semaine') . ' ' . $j_num_semaine . '">' . $text_titre_date . '</td>';
     }
     // ... si le premier jour voulu n'etait pas le premier du mois, on va jusqu'à la meme date du mois suivant.
     if ($first_jour != 1) {
         for ($j = 1; $j < $first_jour; $j++) {
             if ($mois == 12) {
                 $mois_select = 1;
                 $year_select = $year + 1;
             } else {
                 $mois_select = $mois + 1;
                 $year_select = $year;
             }
             $j_timestamp = mktime(0, 0, 0, $mois_select, $j, $year_select);
             $last = date("N", $j_timestamp);
             // $j_name=date_fr("D", $j_timestamp);
             $j_name = substr(date_fr("D", $j_timestamp), 0, 1);
             $j_date_fr = date_fr("d-m-Y", $j_timestamp);
             $j_num_semaine = date_fr("W", $j_timestamp);
             $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
             // on affiche en gras le jour d'aujourd'hui
             if ($j_timestamp == $timestamp_today) {
                 $return .= '<td class="cal-day ' . $td_second_class . '" title="' . $j_date_fr . ' / ' . _('divers_semaine') . ' ' . $j_num_semaine . '"><strong>' . $j_name . ' ' . $j . '</strong></td>';
                 // echo "<td class=\"cal-day $td_second_class\" title=\"$j_date_fr / ". _('divers_semaine') ." $j_num_semaine\"><b>$j_name $j/$mois_select</b></td>";
             } else {
                 $return .= '<td class="cal-day ' . $td_second_class . '" title="' . $j_date_fr . ' / ' . _('divers_semaine') . ' ' . $j_num_semaine . '">' . $j_name . ' ' . $j . '</td>';
                 // echo "<td class=\"cal-day $td_second_class\" title=\"$j_date_fr / ". _('divers_semaine') ." $j_num_semaine\">$j_name $j/$mois_select</td>";
             }
         }
     }
     // if ($last < 7)
     // for ($i = $last; $i <7; $i ++)
     //     echo '<td></td>';
     // echo "</tr>\n";
     /**************************************************/
     /**************************************************/
     /* recup des info de chaque jour pour tous les users et stockage dans 1 tableau de tableaux */
     $tab_calendrier = \calendrier\Fonctions::recup_tableau_periodes($mois, $first_jour, $year, $tab_logins);
     /**************************************************/
     /* recup des rtt de chaque jour pour tous les users et stockage dans 2 tableaux de tableaux */
     /**************************************************/
     //$tab_rtt_echange  //tableau indexé dont la clé est la date sous forme yyyy-mm-dd
     //il contient pour chaque clé (chaque jour): un tableau indéxé ($tab_jour_rtt_echange) (clé= login)
     // qui contient lui même un tableau ($tab_echange) contenant les infos des echanges de rtt pour ce
     // jour et ce login (valeur du matin + valeur de l'apres midi ('Y' si rtt, 'N' sinon) )
     //$tab_rtt_planifiees=array();  //tableau indexé dont la clé est le login_user
     // il contient pour chaque clé login : un tableau ($tab_user_grille) indexé dont la
     // clé est la date_fin_grille.
     // qui contient lui meme pour chaque clé : un tableau ($tab_user_rtt) qui contient enfin
     // les infos pour le matin et l'après midi ('Y' si rtt, 'N' sinon) sur 2 semaines
     // ( du sem_imp_lu_am au sem_p_ve_pm ) + la date de début et de fin de la grille
     $tab_rtt_echange = recup_tableau_rtt_echange($mois, $first_jour, $year, $tab_logins);
     $tab_rtt_planifiees = recup_tableau_rtt_planifiees($mois, $first_jour, $year, $tab_logins);
     $tab_cong_users = recup_tableau_conges_for_users(false, $tab_logins);
     /**************************************************/
     /**************************************************/
     // affichage lignes suivantes (users)
     // pour chaque user :
     foreach ($tab_all_users as $sql_login => $tab_current_user) {
         $sql_nom = $tab_current_user["nom"];
         $sql_prenom = $tab_current_user["prenom"];
         $sql_quotite = $tab_current_user["quotite"];
         // nb de jour pris dans le mois en cours (pour un type d'absence donné)
         $nb_jours_current_month = array();
         // recup dans un tableau de tableaux les nb et soldes de conges d'un user (indicé par id de conges)
         $tab_cong_user = isset($tab_cong_users[$sql_login]) ? $tab_cong_users[$sql_login] : [];
         if ($printable == 1) {
             $return .= '<tr align="center" class="cal-ligne-user-edit">';
         } elseif ($selected == $sql_login) {
             $return .= '<tr align="center" class="cal-ligne-user-selected">';
         } else {
             $return .= '<tr align="center" class="cal-ligne-user">';
         }
         if ($printable == 1) {
             $text_nom = "<strong>{$sql_nom}</strong>";
         } else {
             $text_nom = "<a href=\"{$PHP_SELF}?session={$session}&selected={$sql_login}&year={$year}&mois={$mois}&first_jour={$first_jour}&printable={$printable}&select_groupe={$select_groupe}\" method=\"GET\">{$sql_nom} {$sql_prenom}</a>";
         }
         // affichage nom prenom quotité
         $return .= '<td class="cal-user">' . $text_nom . '</td><td class="cal-percent">' . $sql_quotite . '%</td>';
         // pour chaque jour : (du premier jour demandé à la fin du mois ...)
         for ($j = $first_jour; checkdate($mois, $j, $year); $j++) {
             $j_timestamp = mktime(0, 0, 0, $mois, $j, $year);
             $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
             $mois_select = $mois;
             $year_select = $year;
             // affichage de la cellule correspondant au jour et au user considéré
             $t_nb_j_type_abs = \calendrier\Fonctions::affiche_cellule_jour_user($sql_login, $j_timestamp, $year, $mois_select, $j, $td_second_class, $printable, $tab_calendrier, $tab_rtt_echange, $tab_rtt_planifiees, $tab_type_absence, $return);
             foreach ($t_nb_j_type_abs as $id_type_abs => $nb_j_pris) {
                 if (isset($nb_jours_current_month[$id_type_abs])) {
                     $nb_jours_current_month[$id_type_abs] += $nb_j_pris;
                 } else {
                     $nb_jours_current_month[$id_type_abs] = $nb_j_pris;
                 }
             }
         }
         // si le premier jour demandé n'est pas le 1ier du mois , on va jusqu'à la meme date le mois suivant :
         if ($first_jour != 1) {
             // pour chaque jour jusqu'a la date voulue : (meme num de jour le mois suivant)
             for ($j = 1; $j < $first_jour; $j++) {
                 $j_timestamp = mktime(0, 0, 0, $mois + 1, $j, $year);
                 $td_second_class = get_td_class_of_the_day_in_the_week($j_timestamp);
                 if ($mois == 12) {
                     $mois_select = 1;
                     $year_select = $year + 1;
                 } else {
                     $mois_select = $mois + 1;
                     $year_select = $year;
                 }
                 // affichage de la cellule correspondant au jour et au user considéré
                 $t_nb_j_type_abs = \calendrier\Fonctions::affiche_cellule_jour_user($sql_login, $j_timestamp, $year, $mois_select, $j, $td_second_class, $printable, $tab_calendrier, $tab_rtt_echange, $tab_rtt_planifiees, $tab_type_absence, $return);
                 foreach ($t_nb_j_type_abs as $id_type_abs => $nb_j_pris) {
                     if (isset($nb_jours_current_month[$id_type_abs])) {
                         $nb_jours_current_month[$id_type_abs] += $nb_j_pris;
                     } else {
                         $nb_jours_current_month[$id_type_abs] = $nb_j_pris;
                     }
                 }
             }
         }
         //if ($last < 7)
         //for ($i = $last; $i <7; $i ++)
         //    echo '<td></td>';
         if ($_SESSION['config']['affiche_soldes_calendrier'] || is_resp($_SESSION['userlogin']) || is_hr($_SESSION['userlogin']) || is_admin($_SESSION['userlogin'])) {
             // affichage des divers soldes
             foreach ($tab_cong_user as $id => $tab_conges) {
                 // si des jours ont été pris durant le mois affiché, on indique combien :
                 if (isset($nb_jours_current_month[$id]) && $_SESSION['config']['affiche_jours_current_month_calendrier']) {
                     $return .= '<td class="cal-user">' . $tab_conges['solde'] . '&nbsp;(' . $nb_jours_current_month[$id] . ')</td>';
                 } else {
                     $return .= '<td class="cal-user">' . $tab_conges['solde'] . '</td>';
                 }
             }
         }
         $return .= '</tr>';
     }
     $return .= '</table>';
     return $return;
 }