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

187 lines
6.3 KiB
PHP

<?php
include('include/entete.php');
include('include/entete_cfa.php');
include('config/config.inc.php');
include('config/lib.inc.php');
$maCleDeCryptage = getCleDeCryptage();
$myIdCap = $_POST['myIdCap'];
$query="select * from eta
INNER JOIN capitaines ON id_eta=num_eta
WHERE id_eta=:num_eta AND id_cap=:myIdCap";
$db = connect_base();
$queryRequest = $db->prepare( $query );
$queryRequest->bindParam( ':num_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
$queryRequest->bindParam( ':myIdCap', $myIdCap, PDO::PARAM_INT );
$queryRequest->execute();
$data=$queryRequest->fetchAll();
$count = $queryRequest->rowCount();
if($count!=1){
header('location:index-cfa.php');
exit();
}
$nom_cap = decrypter($maCleDeCryptage,$data[0]['nom_cap']).' '.decrypter($maCleDeCryptage,$data[0]['prenom_cap']);
if(!isset($_POST['myCreneau']) || $_POST['myCreneau']=='undefined' || !isset($_POST['myDay'])){
$_SESSION['msg']='Une erreur a été rencontrée pour affecter une sollicitation.';
header('location:index-cfa.php');
exit();
}
//Ajout ou Modification
if($_POST['myAction']=='affecterSol'){
$myCreneau = $_POST['myCreneau'];
$myDay = $_POST['myDay'];
}else{
$_SESSION['msg']='Une erreur a été rencontrée pour affecter une sollicitation.';
header('location:index-cfa.php');
exit();
}
?>
<!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']="";
}
?>
});
function validAffectSol(){
if(!testerRadio('document.frmSolAffecter.chxSol','Veuillez sélectionner une sollicitation pour continuer.')) return false;
return true;
}
function affectSol(){
if(validAffectSol()) document.frmSolAffecter.submit();
}
</script>
<style type="text/css">
.frmVoir th{ font-weight: normal; }
.frmVoir th, .frmVoir td{ padding: 5px 10px; vertical-align: middle; }
.contentPage form input {
margin-bottom: 0;
}
</style>
</head>
<body>
<?php include('include/header.php');?>
<div class="container contentPage">
<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">Votre espace Référent</div>
<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs bgTitrePage"></div>
<div class="clearfix"></div>
<div class="headerCap" style="text-align: center; margin:18px 0 12px;">
<span class="ssTitreViolet"><?php echo decrypter($maCleDeCryptage,$data[0]['nom_eta']);?></span><br />
<b>Référent : </b><?php echo decrypter($maCleDeCryptage,$data[0]['nom_ref']);?> <a href="modifier-referent.php">modifier</a><br />
<a href="deco.php">Déconnexion</a>
</div>
<div class="menuPage">
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<a href="index-cfa.php">Vos trinômes</a>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<a href="bao-cfa.php">Boite à outils</a>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<a href="po-cfa.php">Portes ouvertes</a>
</div>
<div class="clearfix"></div>
</div>
<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12 titreContenuPage">Choisir une sollicitation pour un créneau</div>
<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>
<div class="clearfix"></div>
<div class="textIntro"><br/>
<div class="clearfix"></div>
<ul>
<li>Journée : <b><?php echo MysqlToDateFr($myDay); ?></b></li>
<li>Période : <b><?php echo getCreneauPlus($myCreneau); ?></b></li>
</ul>
<br />
<?php
$query="SELECT * FROM sollicitations WHERE (idCapitaine=:id_cap || idCapitaine=0) AND chxNumEta=:chxNumEta AND traitement=0 ORDER BY idCapitaine, chxJour, chxCreneau, dateCreate";
$db = connect_base();
$queryRequest = $db->prepare( $query );
$queryRequest->bindParam( ':id_cap', $myIdCap, PDO::PARAM_INT );
$queryRequest->bindParam( ':chxNumEta', $_SESSION['cfa_num'], PDO::PARAM_INT );
$queryRequest->execute();
$countSol = $queryRequest->rowCount();
$dataSol = $queryRequest->fetchAll();
if($countSol==0) echo '<div align="center">Vous n\'avez aucune sollicitation en attente.</div>';
echo '<form name="frmSolAffecter" method="post" action="sollicitations-cfa-actions.php">';
echo '<input type="hidden" name="myAction" value="affecterSol">';
echo '<input type="hidden" name="myIdCap" value="'.$myIdCap.'">';
echo '<input type="hidden" name="myDay" value="'.$myDay.'">';
echo '<input type="hidden" name="myCreneau" value="'.$myCreneau.'">';
echo '<table cellspacing="0" cellpadding="0">';
echo '<tr><th>&nbsp;</th><th>Etablissement</th><th>Contact</th><th>Localisation</th><th>Jour</th><th>Creneau</th></tr>';
foreach($dataSol as $k => $v){
$myjourSol = MysqlToDateFr($v['chxJour']);
$mycreneauSol = getCreneauSol($v['chxCreneau']);
echo '<tr>';
echo '<td valign="middle"><input type="radio" name="chxSol" value="'.$v['idCoLy'].'"></td>';
echo '<td>'.decrypter($maCleDeCryptage,$v['etaCoLy']).'</td>';
echo '<td>'.decrypter($maCleDeCryptage,$v['nomCoLy']).' '.decrypter($maCleDeCryptage,$v['prenomCoLy']).'</td>';
echo '<td>'.decrypter($maCleDeCryptage,$v['cpCoLy']).' '.decrypter($maCleDeCryptage,$v['villeCoLy']).'</td>';
echo '<td>'.$myjourSol.'</td>';
echo '<td>'.$mycreneauSol.'</td>';
echo '</tr>';
}
echo '<table>';
echo '</form>';
?>
<div style="height: 20px;"></div>
<div class="btnDeci"><a href="javascript:void(0);" onClick="affectSol()">Choisir cette sollicitation</a></div>
<div style="height: 20px;"></div>
<div class="btnDeci"><a href="agenda-cfa.php#sollicitation">Annuler</a></div>
</form>
</div>
<div class="clearfix"></div>
</div>
<?php include('include/footer.php');?>
</body>
</html>