if (!checkAccess()) {
    header("Location: ../logout.php?auto=1");
    die;
}
require 'sanctions_func_lib.php';
$msg = "";
// recupération des parametres
$periode = isset($_POST['periode']) ? $_POST['periode'] : (isset($_GET['periode']) ? $_GET['periode'] : NULL);
$id_classe = isset($_POST['id_classe']) ? $_POST['id_classe'] : (isset($_GET['id_classe']) ? $_GET['id_classe'] : NULL);
$eleve = isset($_POST['eleve']) ? $_POST['eleve'] : (isset($_GET['eleve']) ? $_GET['eleve'] : NULL);
//debug_var();
if ($_SESSION['statut'] == 'professeur') {
    if (getSettingAOui('imprDiscProfAvtOOo')) {
        $tab_restriction_classes = get_classes_from_prof($_SESSION['login']);
    } elseif (getSettingAOui('imprDiscProfPAvtOOo')) {
        $tmp_tab = get_tab_ele_clas_pp($_SESSION['login']);
        $tab_restriction_classes = array();
        for ($loop2 = 0; $loop2 < count($tmp_tab['id_classe']); $loop2++) {
            $tab_restriction_classes[$tmp_tab['id_classe'][$loop2]] = $tmp_tab['classe'][$loop2];
        }
    } else {
        $mess = rawurlencode("Vous n'êtes pas autorisé à imprimer les " . $mod_disc_terme_avertissement_fin_periode . "s !");
        tentative_intrusion(1, "Tentative d'accès à l'impression de {$mod_disc_terme_avertissement_fin_periode}.");
        header("Location: ../accueil.php?msg={$mess}");
        die;
    }
    if (count($tab_restriction_classes) == 0) {
        $mess = rawurlencode("Il n'y a aucune classe pour laquelle vous seriez autorisé à imprimer les " . $mod_disc_terme_avertissement_fin_periode . "s !");
        //tentative_intrusion(1, "Tentative d'accès à l'impression de $mod_disc_terme_avertissement_fin_periode.");
        header("Location: ../accueil.php?msg={$mess}");
        die;
示例#2
0
function get_temoin_discipline_personnel($date_depuis = "")
{
    global $mysqli;
    $cpt = 0;
    if ($date_depuis == "") {
        $sql = "SELECT * FROM log WHERE LOGIN='******'login'] . "' AND (AUTOCLOSE='0' OR AUTOCLOSE='1' OR AUTOCLOSE='2' OR AUTOCLOSE='3' OR AUTOCLOSE='10') AND START<'" . strftime("%Y-%m-%d %H:%M:%S", time() - 3600 * 24) . "' ORDER BY START DESC LIMIT 1;";
        $res = mysqli_query($mysqli, $sql);
        if (mysqli_num_rows($res) > 0) {
            $lig = mysqli_fetch_object($res);
            $tmp_tab = explode(" ", $lig->START);
            $date_depuis = $tmp_tab[0];
        } else {
            $date_depuis = "1970-01-01";
        }
    }
    if ($_SESSION['statut'] == 'professeur') {
        if ((getSettingAOui('visuDiscProfClasses') || getSettingAOui('visuDiscProfGroupes')) && getPref($_SESSION['login'], 'DiscTemoinIncidentProf', "n") == "y") {
            if (getSettingAOui('visuDiscProfClasses')) {
                $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\t\ts_protagonistes sp, \n\t\t\t\t\t\t\t\t\tj_groupes_classes jgc, \n\t\t\t\t\t\t\t\t\tj_groupes_professeurs jgp, \n\t\t\t\t\t\t\t\t\tj_eleves_classes jec\n\t\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}' AND \n\t\t\t\t\t\t\t\t\tsp.login=jec.login AND \n\t\t\t\t\t\t\t\t\tjec.id_classe=jgc.id_classe AND \n\t\t\t\t\t\t\t\t\tjgc.id_groupe=jgp.id_groupe AND \n\t\t\t\t\t\t\t\t\tjgp.login='******'login'] . "';";
            } else {
                $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\t\ts_protagonistes sp, \n\t\t\t\t\t\t\t\t\tj_eleves_groupes jeg, \n\t\t\t\t\t\t\t\t\tj_groupes_professeurs jgp\n\t\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}' AND \n\t\t\t\t\t\t\t\t\tsp.login=jeg.login AND \n\t\t\t\t\t\t\t\t\tjeg.id_groupe=jgp.id_groupe AND \n\t\t\t\t\t\t\t\t\tjgp.login='******'login'] . "';";
            }
            //echo "$sql<br />";
            $res = mysqli_query($mysqli, $sql);
            $cpt = mysqli_num_rows($res);
        } elseif (getPref($_SESSION['login'], 'DiscTemoinIncidentPP', "n") == "y") {
            $tab_pp = get_tab_ele_clas_pp($_SESSION['login']);
            for ($loop = 0; $loop < count($tab_pp['id_classe']); $loop++) {
                $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\t\ts_protagonistes sp, \n\t\t\t\t\t\t\t\t\tj_eleves_classes jec\n\t\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}' AND \n\t\t\t\t\t\t\t\t\tsp.login=jec.login AND \n\t\t\t\t\t\t\t\t\tjec.id_classe='" . $tab_pp['id_classe'][$loop] . "';";
                //echo "$sql<br />";
                $res = mysqli_query($mysqli, $sql);
                $cpt += mysqli_num_rows($res);
            }
        }
    } elseif ($_SESSION['statut'] == 'cpe') {
        if (getPref($_SESSION['login'], 'DiscTemoinIncidentCpeTous', "n") == "y") {
            $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\ts_protagonistes sp\n\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}';";
            //echo "$sql<br />";
            $res = mysqli_query($mysqli, $sql);
            $cpt = mysqli_num_rows($res);
        } elseif (getPref($_SESSION['login'], 'DiscTemoinIncidentCpe', "n") == "y") {
            $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\ts_protagonistes sp, \n\t\t\t\t\t\t\t\tj_eleves_cpe jecpe\n\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}' AND \n\t\t\t\t\t\t\t\tsp.login=jecpe.e_login AND \n\t\t\t\t\t\t\t\tjecpe.cpe_login='******'login'] . "';";
            //echo "$sql<br />";
            $res = mysqli_query($mysqli, $sql);
            $cpt = mysqli_num_rows($res);
        }
    } elseif ($_SESSION['statut'] == 'scolarite') {
        if (getPref($_SESSION['login'], 'DiscTemoinIncidentScolTous', "n") == "y") {
            $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\ts_protagonistes sp\n\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}';";
            //echo "$sql<br />";
            $res = mysqli_query($mysqli, $sql);
            $cpt = mysqli_num_rows($res);
        } elseif (getPref($_SESSION['login'], 'DiscTemoinIncidentScol', "n") == "y") {
            $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\ts_protagonistes sp, \n\t\t\t\t\t\t\t\tj_eleves_classes jec,\n\t\t\t\t\t\t\t\tj_scol_classes jsc\n\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}' AND \n\t\t\t\t\t\t\t\tsp.login=jec.login AND \n\t\t\t\t\t\t\t\tjec.id_classe=jsc.id_classe AND \n\t\t\t\t\t\t\t\tjsc.login='******'login'] . "';";
            //echo "$sql<br />";
            $res = mysqli_query($mysqli, $sql);
            $cpt = mysqli_num_rows($res);
        }
    } elseif ($_SESSION['statut'] == 'administrateur') {
        if (getPref($_SESSION['login'], 'DiscTemoinIncidentAdmin', "n") == "y") {
            $sql = "SELECT DISTINCT si.id_incident FROM s_incidents si, \n\t\t\t\t\t\t\t\ts_protagonistes sp\n\t\t\t\t\t\t\tWHERE si.id_incident=sp.id_incident AND \n\t\t\t\t\t\t\t\tsi.date>'{$date_depuis}';";
            //echo "$sql<br />";
            $res = mysqli_query($mysqli, $sql);
            $cpt = mysqli_num_rows($res);
        }
    }
    return $cpt;
}
 }
 if ($affiche_li_bull_simp == "y") {
     $tmp_sous_menu[$cpt_sous_menu] = array("lien" => '/prepa_conseil/index3.php', "texte" => "Bulletins simplifiés");
     $tmp_sous_menu2 = array();
     $cpt_sous_menu2 = 0;
     foreach ($tmp_mes_classes as $key => $value) {
         $tmp_sous_menu2[$cpt_sous_menu2]['lien'] = '/prepa_conseil/index3.php?id_classe=' . $key;
         $tmp_sous_menu2[$cpt_sous_menu2]['texte'] = $value;
         $cpt_sous_menu2++;
     }
     $tmp_sous_menu[$cpt_sous_menu]['sous_menu'] = $tmp_sous_menu2;
     $tmp_sous_menu[$cpt_sous_menu]['niveau_sous_menu'] = 3;
     $cpt_sous_menu++;
 }
 if (getSettingAOui('GepiProfImprBul') && $is_pp_header_barre_prof_template) {
     $tab_pp = get_tab_ele_clas_pp($_SESSION['login']);
     if (count($tab_pp) > 0) {
         $tmp_sous_menu[$cpt_sous_menu] = array("lien" => '/bulletin/bull_index.php', "texte" => "Imprimer bulletins");
         $tmp_sous_menu2 = array();
         $cpt_sous_menu2 = 0;
         for ($loop = 0; $loop < count($tab_pp['id_classe']); $loop++) {
             $tmp_sous_menu2[$cpt_sous_menu2]['lien'] = '/bulletin/bull_index.php?tab_id_classe[0]=' . $tab_pp['id_classe'][$loop];
             $tmp_sous_menu2[$cpt_sous_menu2]['texte'] = $tab_pp['classe'][$loop];
             $sql = "SELECT * FROM periodes WHERE id_classe='" . $tab_pp['id_classe'][$loop] . "' ORDER BY num_periode;";
             $res_per = mysqli_query($mysqli, $sql);
             if ($res_per->num_rows > 0) {
                 $tmp_sous_menu3 = array();
                 $cpt_sous_menu3 = 0;
                 while ($lig_per = $res_per->fetch_object()) {
                     $tmp_sous_menu3[$cpt_sous_menu3]['lien'] = '/bulletin/bull_index.php?tab_id_classe[0]=' . $tab_pp['id_classe'][$loop] . "&amp;tab_periode_num[0]=" . $lig_per->num_periode . "&amp;choix_periode_num=fait";
                     $tmp_sous_menu3[$cpt_sous_menu3]['texte'] = $lig_per->nom_periode;
示例#4
0
function affiche_evenement($id_ev, $afficher_obsolete="n") {
	global $gepiPath;
	$retour="";

	$sql="SELECT * FROM d_dates_evenements WHERE id_ev='$id_ev';";
	$res=mysqli_query($GLOBALS["mysqli"], $sql);
	if(mysqli_num_rows($res)>0) {
		$lig=mysqli_fetch_object($res);

		$tab_u=array();
		$sql="SELECT * FROM d_dates_evenements_utilisateurs WHERE id_ev='$id_ev';";
		$res_u=mysqli_query($GLOBALS["mysqli"], $sql);
		if(mysqli_num_rows($res_u)>0) {
			while($lig_u=mysqli_fetch_object($res_u)) {
				$tab_u[]=$lig_u->statut;
			}
		}

		if($lig->type=='autre') {
			//$retour.=nl2br($lig->description)."<br />";
			$retour.=$lig->texte_avant;
			//$retour.="<br />";

			if(in_array("professeur", $tab_u)) {
				$retour.=" <img src='$gepiPath/images/icons/prof.png' class='icone16' alt='Prof' title=\"Professeurs de la classe.\" />";
			}
			if(in_array("cpe", $tab_u)) {
				$retour.=" <img src='$gepiPath/images/icons/cpe.png' class='icone16' alt='Cpe' title=\"CPE de la classe.\" />";
			}
			if(in_array("scolarite", $tab_u)) {
				$retour.=" <img src='$gepiPath/images/icons/scolarite.png' class='icone16' alt='Scol' title=\"Comptes scolarité associés à la classe.\" />";
			}
			if(in_array("responsable", $tab_u)) {
				$retour.=" <img src='$gepiPath/images/icons/responsable.png' class='icone16' alt='Resp' title=\"Comptes responsables associés à la classe.\" />";
			}
			if(in_array("eleve", $tab_u)) {
				$retour.=" <img src='$gepiPath/images/icons/eleve.png' class='icone16' alt='Resp' title=\"Élèves associés à la classe.\" />";
			}
			$retour.="<br />";

			if($afficher_obsolete=="y") {
				if($_SESSION['statut']=='professeur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jgc.id_classe FROM j_groupes_classes jgc, j_groupes_professeurs jgp WHERE jgc.id_groupe=jgp.id_groupe AND jgp.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='cpe') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jec.id_classe FROM j_eleves_classes jec, j_eleves_cpe jecpe WHERE jec.e_login=jecpe.cpe_login AND jecpe.cpe_login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='scolarite') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jsc.id_classe FROM j_scol_classes jsc WHERE jsc.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='administrateur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='responsable') {
					$sql="SELECT DISTINCT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jec.id_classe FROM resp_pers rp, 
																	responsables2 r, 
																	eleves e, 
																	j_eleves_classes jec 
																WHERE rp.login='******'login']."' AND 
																	rp.pers_id=r.pers_id AND 
																	r.ele_id=e.ele_id AND 
																	e.login=jec.login AND 
																	(r.resp_legal='1' OR r.resp_legal='2' OR r.acces_sp='y')
																) ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='eleve') {
					$sql="SELECT DISTINCT d.*, c.* FROM d_dates_evenements_classes d, classes c, j_eleves_classes jec WHERE id_ev='$id_ev' AND d.id_classe=c.id AND d.id_classe=jec.id_classe AND jec.login='******'login']."' ORDER BY date_evenement, classe;";
				}
			}
			else {
				// 12h après
				if($_SESSION['statut']=='professeur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jgc.id_classe FROM j_groupes_classes jgc, j_groupes_professeurs jgp WHERE jgc.id_groupe=jgp.id_groupe AND jgp.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='cpe') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jec.id_classe FROM j_eleves_classes jec, j_eleves_cpe jecpe WHERE jec.e_login=jecpe.cpe_login AND jecpe.cpe_login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='scolarite') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jsc.id_classe FROM j_scol_classes jsc WHERE jsc.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='administrateur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='responsable') {
					$sql="SELECT DISTINCT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jec.id_classe FROM resp_pers rp, 
																	responsables2 r, 
																	eleves e, 
																	j_eleves_classes jec 
																WHERE rp.login='******'login']."' AND 
																	rp.pers_id=r.pers_id AND 
																	r.ele_id=e.ele_id AND 
																	e.login=jec.login AND 
																	(r.resp_legal='1' OR r.resp_legal='2' OR r.acces_sp='y')
																) ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='eleve') {
					$sql="SELECT DISTINCT d.*, c.* FROM d_dates_evenements_classes d, classes c, j_eleves_classes jec WHERE id_ev='$id_ev' AND d.id_classe=c.id AND d.id_classe=jec.id_classe AND jec.login='******'login']."' AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' ORDER BY date_evenement, classe;";
				}
			}
			$res2=mysqli_query($GLOBALS["mysqli"], $sql);
			if(mysqli_num_rows($res2)>0) {
				while($lig2=mysqli_fetch_object($res2)) {
					if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
						$retour.="<span style='color:red'>".$lig2->classe."&nbsp;: ".formate_date($lig2->date_evenement, "y")."</span><br />";
					}
					else {
						$retour.=$lig2->classe."&nbsp;: ".formate_date($lig2->date_evenement, "y")."<br />";
					}
				}
			}
			$retour.=$lig->texte_apres;
		}
		elseif($lig->type=='conseil_de_classe') {

			$tab_classe_pp=array("id_classe");
			if($_SESSION['statut']=="professeur") {
				$tab_classe_pp=get_tab_ele_clas_pp($_SESSION['login']);
			}

			$retour.=$lig->texte_avant;
			//$retour.="<br />";

			if($afficher_obsolete=="y") {
				if($_SESSION['statut']=='professeur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jgc.id_classe FROM j_groupes_classes jgc, j_groupes_professeurs jgp WHERE jgc.id_groupe=jgp.id_groupe AND jgp.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='cpe') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jec.id_classe FROM j_eleves_classes jec, j_eleves_cpe jecpe WHERE jec.login=jecpe.e_login AND jecpe.cpe_login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='scolarite') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jsc.id_classe FROM j_scol_classes jsc WHERE jsc.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='administrateur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='responsable') {
					$sql="SELECT DISTINCT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND id_classe IN (SELECT DISTINCT jec.id_classe FROM resp_pers rp, 
																	responsables2 r, 
																	eleves e, 
																	j_eleves_classes jec 
																WHERE rp.login='******'login']."' AND 
																	rp.pers_id=r.pers_id AND 
																	r.ele_id=e.ele_id AND 
																	e.login=jec.login AND 
																	(r.resp_legal='1' OR r.resp_legal='2' OR r.acces_sp='y')
																) ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='eleve') {
					$sql="SELECT DISTINCT d.*, c.* FROM d_dates_evenements_classes d, classes c, j_eleves_classes jec WHERE id_ev='$id_ev' AND d.id_classe=c.id AND d.id_classe=jec.id_classe AND jec.login='******'login']."' ORDER BY date_evenement, classe;";
				}
			}
			else {
				// 12h après
				if($_SESSION['statut']=='professeur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jgc.id_classe FROM j_groupes_classes jgc, j_groupes_professeurs jgp WHERE jgc.id_groupe=jgp.id_groupe AND jgp.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='cpe') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jec.id_classe FROM j_eleves_classes jec, j_eleves_cpe jecpe WHERE jec.login=jecpe.e_login AND jecpe.cpe_login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='scolarite') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jsc.id_classe FROM j_scol_classes jsc WHERE jsc.login='******'login']."') ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='administrateur') {
					$sql="SELECT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='responsable') {
					$sql="SELECT DISTINCT * FROM d_dates_evenements_classes d, classes c WHERE id_ev='$id_ev' AND d.id_classe=c.id AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' AND id_classe IN (SELECT DISTINCT jec.id_classe FROM resp_pers rp, 
																	responsables2 r, 
																	eleves e, 
																	j_eleves_classes jec 
																WHERE rp.login='******'login']."' AND 
																	rp.pers_id=r.pers_id AND 
																	r.ele_id=e.ele_id AND 
																	e.login=jec.login AND 
																	(r.resp_legal='1' OR r.resp_legal='2' OR r.acces_sp='y')
																) ORDER BY date_evenement, classe;";
				}
				elseif($_SESSION['statut']=='eleve') {
					$sql="SELECT DISTINCT d.*, c.* FROM d_dates_evenements_classes d, classes c, j_eleves_classes jec WHERE id_ev='$id_ev' AND d.id_classe=c.id AND d.id_classe=jec.id_classe AND jec.login='******'login']."' AND date_evenement>='".strftime("%Y-%m-%d %H:%M:%S", time()-12*3600)."' ORDER BY date_evenement, classe;";
				}
			}
			// DEBUG:
			//$retour.="$sql<br />";
			$res2=mysqli_query($GLOBALS["mysqli"], $sql);
			if(mysqli_num_rows($res2)>0) {
				// On va remplir un tableau et repérer les jours et heures.
				$tab_jours=array();
				$tab_heures=array();
				$tab_cellules=array();
				while($lig2=mysqli_fetch_object($res2)) {
					$tmp_jour=get_date_slash_from_mysql_date($lig2->date_evenement, "court");
					if(!in_array($tmp_jour, $tab_jours)) {
						$tab_jours[]=$tmp_jour;
					}
					//sort($tab_jours);

					$tmp_tab_pp=get_tab_prof_suivi($lig2->id_classe);
					//$liste_pp=implode(", ", $tmp_tab_pp);
					$liste_pp="";
					for($loop=0;$loop<count($tmp_tab_pp);$loop++) {
						if($loop>0) {
							$liste_pp.="";
						}
						$liste_pp.=affiche_utilisateur($tmp_tab_pp[$loop], $lig2->id_classe);
					}

					$tmp_heure=get_heure_2pt_minute_from_mysql_date($lig2->date_evenement);
					if(!in_array($tmp_heure, $tab_heures)) {
						$tab_heures[]=$tmp_heure;
					}
					sort($tab_heures);

					/*
					if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
						if(!isset($tab_cellules[$tmp_jour][$tmp_heure])) {
							$tab_cellules[$tmp_jour][$tmp_heure]="";
						}
						else {
							$tab_cellules[$tmp_jour][$tmp_heure].=" - ";
						}
						$tab_cellules[$tmp_jour][$tmp_heure].="<span style='color:red' title=\"La date du conseil de classe de $lig2->classe est passée : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">".$lig2->classe."</span>";
					}
					else {
					*/
						if(!isset($tab_cellules[$tmp_jour][$tmp_heure])) {
							$tab_cellules[$tmp_jour][$tmp_heure]="";
						}
						else {
							$tab_cellules[$tmp_jour][$tmp_heure].=" - ";
						}

						if($_SESSION["statut"]=="professeur") {
							if(in_array($lig2->id_classe, $tab_classe_pp['id_classe'])) {
								if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
									$tab_cellules[$tmp_jour][$tmp_heure].="<span style='color:red' title=\"La date du conseil de classe de $lig2->classe est passée : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp

Cliquer pour saisir/consulter l'avis du conseil de classe.\">";
									$tab_cellules[$tmp_jour][$tmp_heure].="<a href='$gepiPath/saisie/saisie_avis1.php?id_classe=$lig2->id_classe' style='color:red'>";
								}
								else {
									$tab_cellules[$tmp_jour][$tmp_heure].="<span title=\"Date du conseil de classe de $lig2->classe : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp

Cliquer pour saisir l'avis du conseil de classe.\">";
									$tab_cellules[$tmp_jour][$tmp_heure].="<a href='$gepiPath/saisie/saisie_avis1.php?id_classe=$lig2->id_classe' style='color:black'>";
								}
								$tab_cellules[$tmp_jour][$tmp_heure].=$lig2->classe;
								$tab_cellules[$tmp_jour][$tmp_heure].="</a>";
								$tab_cellules[$tmp_jour][$tmp_heure].="</span>";
							}
							else {
								if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
									$tab_cellules[$tmp_jour][$tmp_heure].="<span style='color:red' title=\"La date du conseil de classe de $lig2->classe est passée : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
								}
								else {
									$tab_cellules[$tmp_jour][$tmp_heure].="<span title=\"Date du conseil de classe de $lig2->classe : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
								}
								// Problème: Un prof peut avoir plusieurs groupes dans une classe
								//$tab_cellules[$tmp_jour][$tmp_heure].="<a href='$gepiPath/saisie/saisie_appreciations.php?id_groupe=' style='color:black'>";
								$tab_cellules[$tmp_jour][$tmp_heure].=$lig2->classe;
								//$tab_cellules[$tmp_jour][$tmp_heure].="</a>";
								$tab_cellules[$tmp_jour][$tmp_heure].="</span>";
							}
						}
						elseif($_SESSION["statut"]=="scolarite") {
							if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span style='color:red' title=\"La date du conseil de classe de $lig2->classe est passée : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp

Cliquer pour saisir/consulter l'avis du conseil de classe.\">";
							$tab_cellules[$tmp_jour][$tmp_heure].="<a href='$gepiPath/saisie/saisie_avis1.php?id_classe=$lig2->id_classe' style='color:red'>";
							}
							else {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span title=\"Date du conseil de classe de $lig2->classe : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp

Cliquer pour saisir l'avis du conseil de classe.\">";
								$tab_cellules[$tmp_jour][$tmp_heure].="<a href='$gepiPath/saisie/saisie_avis1.php?id_classe=$lig2->id_classe' style='color:black'>";
							}
							$tab_cellules[$tmp_jour][$tmp_heure].=$lig2->classe;
							$tab_cellules[$tmp_jour][$tmp_heure].="</a>";
							$tab_cellules[$tmp_jour][$tmp_heure].="</span>";
						}
						elseif($_SESSION["statut"]=="cpe") {
							if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span style='color:red' title=\"La date du conseil de classe de $lig2->classe est passée : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
							}
							else {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span title=\"Date du conseil de classe de $lig2->classe : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
							}
							$tab_cellules[$tmp_jour][$tmp_heure].=$lig2->classe;
							$tab_cellules[$tmp_jour][$tmp_heure].="</span>";
						}
						elseif($_SESSION["statut"]=="administrateur") {
							if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span style='color:red' title=\"La date du conseil de classe de $lig2->classe est passée : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
							}
							else {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span title=\"Date du conseil de classe de $lig2->classe : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
							}
							$tab_cellules[$tmp_jour][$tmp_heure].=$lig2->classe;
							$tab_cellules[$tmp_jour][$tmp_heure].="</span>";
						}
						elseif(($_SESSION["statut"]=="responsable")||($_SESSION["statut"]=="eleve")) {
							if($lig2->date_evenement<strftime("%Y-%m-%d %H:%M:%S")) {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span style='color:red' title=\"La date du conseil de classe de $lig2->classe est passée : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
							}
							else {
								$tab_cellules[$tmp_jour][$tmp_heure].="<span title=\"Date du conseil de classe de $lig2->classe : ".formate_date($lig2->date_evenement, "y")."
".ucfirst(getSettingValue('gepi_prof_suivi'))." : $liste_pp\">";
							}
							$tab_cellules[$tmp_jour][$tmp_heure].=$lig2->classe;
							$tab_cellules[$tmp_jour][$tmp_heure].="</span>";
						}
					//}
				}

				$retour.="<table class='boireaus boireaus_alt' summary='Dates de conseils de classe'>
	<thead>
		<tr>
			<th>";


				if(in_array("professeur", $tab_u)) {
					$retour.=" <img src='$gepiPath/images/icons/prof.png' class='icone16' alt='Prof' title=\"Professeurs de la classe.\" />";
				}
				if(in_array("cpe", $tab_u)) {
					$retour.=" <img src='$gepiPath/images/icons/cpe.png' class='icone16' alt='Cpe' title=\"CPE de la classe.\" />";
				}
				if(in_array("scolarite", $tab_u)) {
					$retour.=" <img src='$gepiPath/images/icons/scolarite.png' class='icone16' alt='Scol' title=\"Comptes scolarité associés à la classe.\" />";
				}
				if(in_array("responsable", $tab_u)) {
					$retour.=" <img src='$gepiPath/images/icons/responsable.png' class='icone16' alt='Resp' title=\"Comptes responsables associés à la classe.\" />";
				}
				if(in_array("eleve", $tab_u)) {
					$retour.=" <img src='$gepiPath/images/icons/eleve.png' class='icone16' alt='Resp' title=\"Élèves de la classe.\" />";
				}
				//$retour.="<br />";

				$retour.="</th>";
				for($j=0;$j<count($tab_jours);$j++) {
					$retour.="
			<th>".$tab_jours[$j]."</th>";
				}
				$retour.="
	</thead>
	<tbody>";

				for($i=0;$i<count($tab_heures);$i++) {
					$retour.="
		<tr>
			<th>".$tab_heures[$i]."</th>";

					for($j=0;$j<count($tab_jours);$j++) {
						$retour.="
			<td>";
						if(isset($tab_cellules[$tab_jours[$j]][$tab_heures[$i]])) {
							$retour.=$tab_cellules[$tab_jours[$j]][$tab_heures[$i]];
						}
						$retour.="</td>";
					}
					$retour.="
		</tr>";

				}
				$retour.="
	</tbody>
</table>";

			}
			$retour.=$lig->texte_apres;

		}
	}

	return $retour;
}