pv_project/site/suivi-sollicitations-adm.php
2025-07-17 10:15:19 +02:00

176 lines
5.7 KiB
PHP

<?php
include('include/entete.php');
include('include/entete_adm.php');
include('config/config.inc.php');
include('config/lib.inc.php');
$maCleDeCryptage = getCleDeCryptage();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>FAFIH - DECIDAY</title>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/fonctions.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script>
jQuery(document).ready(function(){
<?php
if(isset($_SESSION['msg']) && !empty($_SESSION['msg'])){
?>
alert('<?php print addslashes($_SESSION['msg']);?>');
<?php
$_SESSION['msg']="";
}
?>
$('.comLien').each(function (index){
$(this).click(function() {
$('#mCommentaire'+index).modal('show');
});
index = index++;
});
$("#export").click(function(e){
e.preventDefault;
window.location.href='export-suivi-sollicitations-adm.php';
})
});
</script>
</head>
<body>
<?php include('include/header.php');?>
<div class="container contentPage">
<?php include('include/admin-header.php');?>
<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs bgTitrePage"></div>
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12 titreContenuPage">Suivi des sollicitations</div>
<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs bgTitrePage"></div>
<div class="clearfix"></div>
<br/><br/>
<button type="button" class="btn btn-default btn-lg tabEtat" id="export" title="Télécharger le fichier Excel">
<span class="glyphicon glyphicon-save-file" aria-hidden="true"></span> Export Excel
</button>
<?php
$query="SELECT *
FROM `sollicitations`
INNER JOIN `eta` ON id_eta = chxNumEta
ORDER BY dateCreate ASC";
$db = connect_base();
$queryRequest = $db->prepare( $query );
$queryRequest->execute();
$n=0;
if($queryRequest->rowCount()>0){
$data=$queryRequest->fetchAll();
$statut = null;
$coordonnees = null;
$commentaire = null;
echo '<table cellpadding="0" cellspacing="0" class="tabAdm tabEtat">';
echo "<tr><th>CFA/LP</th><th>CFA/LP Ville<br/>Code postal</th><th>CFA/LP<br/>E-mail référent</th><th>Etablissement</th><th>Nom Prénom</th><th>Fonction</th><th>Téléphone</th><th>E-mail</th><th>Coordonnées</th><th>Classes/Elèves</th><th>Créneaux</th><th>Commentaires</th><th>Statut</th><th>Date</th></tr>";
foreach($data as $val){
// Définition du statut de la sollicitation
if($val['traitement'] <> 1) {
if(intval($val['idCapitaine']) > 0 ){
$statut = "En&nbsp;attente";
} else {
$statut = "<span style='color:#A33;'>Refusée</span>";
}
} else {
$statut = "<span style='color:#3A3;'>Traitée</span>";
}
// Définition des coordonnées de l'établissement
$add1 = decrypter($maCleDeCryptage,$val['adresse1CoLy']);
$add2 = decrypter($maCleDeCryptage,$val['adresse2CoLy']);
$cp = decrypter($maCleDeCryptage,$val['cpCoLy']);
$ville = decrypter($maCleDeCryptage,$val['villeCoLy']);
$coordonnees = $add1;
if(!empty($add2)){
$coordonnees = $coordonnees . "<br/>" . $add2;
}
$coordonnees = $coordonnees . "<br/>" . $cp . " " . $ville;
$cpVilleEta = decrypter($maCleDeCryptage,$val['cp']). "<br/>" . decrypter($maCleDeCryptage,$val['ville']);
$commentaire = decrypter($maCleDeCryptage,$val['commentCoLy']);
//Si pas de commentaire, pas de lien détail
if (!empty($commentaire)) {
$commentaire = "<a href=\"#\" data-toggle=\"modal\" data-target=\"mCommentaire$n\" class=\"comLien\">Détail</a>";
$n++;
}
echo "<tr>";
echo "<td>".decrypter($maCleDeCryptage,$val['nom_eta'])."</td>";
echo "<td>".$cpVilleEta."</td>";
echo "<td>".decrypter($maCleDeCryptage,$val['email_ref'])."</td>";
echo "<td>".decrypter($maCleDeCryptage,$val['etaCoLy'])."</td>";
echo "<td>".decrypter($maCleDeCryptage,$val['nomCoLy'])."<br/>".decrypter($maCleDeCryptage,$val['prenomCoLy']). "</td>";
echo "<td>".decrypter($maCleDeCryptage,$val['fonctionCoLy'])."</td>";
echo "<td>".decrypter($maCleDeCryptage,$val['telCoLy'])."</td>";
echo "<td>".decrypter($maCleDeCryptage,$val['emlCoLy'])."</td>";
echo "<td>".$coordonnees."</td>";
echo "<td>".$val['nbClasses']."/".$val['nbEleves']."</td>";
echo "<td>".MysqlToDateFr($val['chxJour'])." ".$val['chxCreneau']."</td>";
echo "<td>". $commentaire ."</td>";
echo "<td>$statut</td>";
echo "<td>".MysqlToDateFr($val['dateCreate'])."</td>";
}
echo '</table>';
$n=0;
foreach($data as $val){
$coLy = decrypter($maCleDeCryptage,$val['etaCoLy']);
$commentaires = nl2br(htmlspecialchars(decrypter($maCleDeCryptage,$val['commentCoLy'])));
if(!empty($commentaires)){
?>
<!-- Modal -->
<div class="modal fade" id="mCommentaire<?=$n?>" tabindex="-1" role="dialog" aria-labelledby="mCommentaire<?=$n?>" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="mCommentaire<?=$n?>Title">Commentaires du <?=$coLy ?> </h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<?=$commentaires ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
</div>
</div>
</div>
</div>
<?php
$n++;
}
}
}
?>
<br /><div class="btnDeci"><a href="index-adm.php">Retour</a></div>
</div>
<?php include('include/footer.php');?>
</body>
</html>