337 lines
14 KiB
PHP
337 lines
14 KiB
PHP
<?php
|
||
|
||
include('include/entete.php');
|
||
include('include/entete_cfa.php');
|
||
include('config/config.inc.php');
|
||
include('config/lib.inc.php');
|
||
|
||
if(empty($_GET['id'])){
|
||
header('location:index-cfa.php');
|
||
exit();
|
||
}else $myIdCap = $_GET['id'];
|
||
|
||
$maCleDeCryptage = getCleDeCryptage();
|
||
|
||
$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']);
|
||
|
||
|
||
?>
|
||
<!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']="";
|
||
}
|
||
?>
|
||
});
|
||
|
||
</script>
|
||
</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>
|
||
|
||
<a name="sollicitation"></a>
|
||
<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">Capitaine <?php echo $nom_cap; ?></div>
|
||
<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>
|
||
<div class="clearfix"></div>
|
||
|
||
<div class="textIntro"><br/>Organisez l’agenda de votre capitaine :
|
||
<div class="clearfix"></div>
|
||
<ul>
|
||
<li>Sélectionnez jusqu’à 4 créneaux de disponibilité par jour</li>
|
||
<li>Suivez les sollicitations des collèges et lycées</li>
|
||
</ul>
|
||
<br />
|
||
<?php
|
||
|
||
//if($_SESSION['cfa_num']!=399 && $_SESSION['cfa_num']!=402){
|
||
|
||
// echo 'La page sera disponible prochainement.';
|
||
|
||
//}else{
|
||
|
||
//SOLLICITATIONS REFERENT
|
||
echo '<a name="sollicitation"></a>';
|
||
echo '<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>';
|
||
echo '<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12 titreContenuPage">Les sollicitations refusées</div>';
|
||
echo '<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>';
|
||
echo '<div class="clearfix"></div>';
|
||
|
||
$query="SELECT * FROM sollicitations WHERE idCapitaine=0 AND chxNumEta=:chxNumEta AND traitement=0 ORDER BY chxJour, chxCreneau, dateCreate";
|
||
$db = connect_base();
|
||
$queryRequest = $db->prepare( $query );
|
||
$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 refusée.</div>';
|
||
}else{
|
||
|
||
echo '<table>';
|
||
echo '<tr><th>Etablissement</th><th>Contact</th><th>Localisation</th><th>Jour</th><th>Creneau</th><th>Actions</th></tr>';
|
||
foreach($dataSol as $k => $v){
|
||
$myjourSol = MysqlToDateFr($v['chxJour']);
|
||
$mycreneauSol = getCreneauSol($v['chxCreneau']);
|
||
echo '<tr>';
|
||
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 '<td align="center"><a href="javascript:voirSol('.$v['idCoLy'].')">Voir</a></td>';
|
||
//echo '<td align="center"><a href="javascript:refusSol(\''.$v['chxJour'].'\',\''.$v['chxCreneau'].'\','.$v['idCoLy'].')">Refuser</a></td>';
|
||
echo '</tr>';
|
||
}
|
||
echo '<table>';
|
||
|
||
}
|
||
|
||
echo '<br /><br />';
|
||
|
||
//SOLLICITATIONS CAPITAINE
|
||
echo '<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>';
|
||
echo '<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12 titreContenuPage">Les sollicitations en attente</div>';
|
||
echo '<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>';
|
||
echo '<div class="clearfix"></div>';
|
||
|
||
$query="SELECT * FROM sollicitations WHERE idCapitaine=:id_cap AND traitement=0 ORDER BY chxJour, chxCreneau, dateCreate";
|
||
$db = connect_base();
|
||
$queryRequest = $db->prepare( $query );
|
||
$queryRequest->bindParam( ':id_cap', $myIdCap, PDO::PARAM_INT );
|
||
$queryRequest->execute();
|
||
$countSol = $queryRequest->rowCount();
|
||
$dataSol = $queryRequest->fetchAll();
|
||
|
||
if($countSol==0){
|
||
echo '<div align="center">Aucune sollicitation en attente.</div>';
|
||
}else{
|
||
|
||
echo '<table>';
|
||
echo '<tr><th>Etablissement</th><th>Contact</th><th>Localisation</th><th>Jour</th><th>Creneau</th><th>Actions</th></tr>';
|
||
foreach($dataSol as $k => $v){
|
||
$myjourSol = MysqlToDateFr($v['chxJour']);
|
||
$mycreneauSol = getCreneauSol($v['chxCreneau']);
|
||
echo '<tr>';
|
||
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 '<td align="center"><a href="javascript:voirSol('.$v['idCoLy'].')">Voir</a></td>';
|
||
//echo '<td align="center"><a href="javascript:refusSol(\''.$v['chxJour'].'\',\''.$v['chxCreneau'].'\','.$v['idCoLy'].')">Refuser</a></td>';
|
||
echo '</tr>';
|
||
}
|
||
echo '<table>';
|
||
|
||
}
|
||
|
||
echo '<br /><br />';
|
||
|
||
//AGENDA CAPITAINE
|
||
|
||
/*
|
||
$arrWeek = array();
|
||
$arrWeek[3] = array('','','','2019-01-17','2019-01-18');
|
||
$arrWeek[4] = array('2019-01-21','2019-01-22','2019-01-23','2019-01-24','2019-01-25');
|
||
$arrWeek[5] = array('2019-01-28','2019-01-29','2019-01-30','2019-01-31','2019-02-01');
|
||
$arrWeek[6] = array('2019-02-04','2019-02-05','2019-02-06','2019-02-07','2019-02-08');
|
||
|
||
$arrDaysWeek = array('lundi','mardi','mercredi','jeudi','vendredi');
|
||
|
||
$arrCreneaux = array('am1','am2','pm1','pm2');
|
||
$arrCreneauxTitle = array('Matin 1','Matin 2','Après-midi 1','Après-midi 2');
|
||
|
||
$theGreatDay = '2019-01-17';
|
||
*/
|
||
|
||
echo '<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>';
|
||
echo '<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12 titreContenuPage">Agenda de votre capitaine</div>';
|
||
echo '<div class="col-lg-2 col-md-2 col-sm-1 hidden-xs"></div>';
|
||
echo '<div class="clearfix"></div>';
|
||
|
||
include('include/agenda.inc.php');
|
||
|
||
foreach($arrWeek as $kw=>$vw){
|
||
echo '<table class="arrWeek">'."\r\n";
|
||
|
||
echo '<caption>Semaine '.$kw.'</caption>';
|
||
|
||
$idDay = 0;
|
||
echo '<tr>'."\r\n";
|
||
echo '<th class="empty"> </th>';
|
||
foreach($vw as $vDay){
|
||
if(!empty($vDay)) $th = '<th><span>'.$arrDaysWeek[$idDay].'</span><br />'.MysqlToDateFr($vDay).'</th>'; else $th = '<th> </th>';
|
||
echo $th."\r\n";
|
||
$idDay++;
|
||
}
|
||
echo '</tr>'."\r\n";
|
||
|
||
foreach($arrCreneaux as $kCr => $vCr){
|
||
if($arrCreneaux[$kCr]=="pm1") $isMidDay = ' class="isMidDay"'; else $isMidDay = '';
|
||
echo '<tr'.$isMidDay.'>'."\r\n";
|
||
echo '<th>'.$arrCreneauxTitle[$kCr].'</th>';
|
||
foreach($vw as $vDay){
|
||
if(!empty($vDay)){
|
||
|
||
//Un enregistrement existe t'il pour le créneau ?
|
||
$query="SELECT * FROM agenda LEFT JOIN collegelycee ON idCoLy=numCoLy WHERE numCap=:numCap AND jour=:jour AND creneau=:creneau
|
||
";
|
||
$queryRequest = $db->prepare( $query );
|
||
$queryRequest->bindParam( ':numCap', $myIdCap, PDO::PARAM_INT );
|
||
$queryRequest->bindParam( ':jour', $vDay, PDO::PARAM_STR );
|
||
$queryRequest->bindParam( ':creneau', $arrCreneaux[$kCr], PDO::PARAM_STR );
|
||
$queryRequest->execute();
|
||
$countD = $queryRequest->rowCount();
|
||
$dataD=$queryRequest->fetchAll();
|
||
if($countD>1){ //Erreur Pas possible
|
||
$td = '<td class="empty">Erreur recontrée sur ce créneau</td>';
|
||
}elseif($countD==1){
|
||
if($dataD[0]['statut']=="bloque"){
|
||
$td = '<td class="isGrey"><b>Indisponible</b><br /><a href="javascript:updateAg(\'D3B\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\',0)">Rendre disponible</a></td>';
|
||
}
|
||
if($dataD[0]['statut']=="libre"){
|
||
$td = '<td class="isWhite"><b>Disponible</b><br /><a href="javascript:reservAg(\'R3S\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\',\'\')">Identifier un rendez-vous</a><br><a href="javascript:updateAg(\'BL0\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\',0)">Rendre indisponible</a><br><a href="javascript:affecterSol(\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\')">Affecter une sollicitation</a></td>';
|
||
}
|
||
if($dataD[0]['statut']=="reserve"){
|
||
$reserve = decrypter($maCleDeCryptage,$dataD[0]['etaCoLy'])."<br /><span>(".decrypter($maCleDeCryptage,$dataD[0]['cpCoLy'])." ".decrypter($maCleDeCryptage,$dataD[0]['villeCoLy']).")</span> ";
|
||
$td = '<td class="isPurple"><b>'.$reserve.'</b><br /><a href="javascript:reservAg(\'R3S\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\','.$dataD[0]['idCoLy'].')">Modifier</a><br /><a href="javascript:updateAg(\'BL0\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\',1)">Rendre indisponible</a></td>';
|
||
}
|
||
}/*else{ //Créneau vide
|
||
|
||
if($vDay==$theGreatDay) $td = '<td class="isWhite">Libre<br /><a href="javascript:reservAg(\'R3S\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\',\'\')">Réserver</a><br><a href="javascript:updateAg(\'BL0\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\')">Bloquer</a></td>'; else $td = '<td class="isGrey">Bloqué<br /><a href="javascript:updateAg(\'D3B\',\''.$vDay.'\',\''.$arrCreneaux[$kCr].'\')">Débloquer</a></td>';
|
||
|
||
}*/
|
||
|
||
}else $td = '<td class="empty"> </td>';
|
||
echo $td."\r\n";
|
||
}
|
||
echo '</tr>'."\r\n";
|
||
}
|
||
|
||
echo '</table>'."\r\n";
|
||
}
|
||
|
||
//}
|
||
|
||
?>
|
||
</div>
|
||
<div class="clearfix"></div>
|
||
|
||
<script type="text/javascript">
|
||
function updateAg(myAction,myDay,myCreneau,confirm){
|
||
document.frmAgenda.myAction.value = myAction;
|
||
document.frmAgenda.myDay.value = myDay;
|
||
document.frmAgenda.myCreneau.value = myCreneau;
|
||
if(confirm==1){
|
||
if(window.confirm('Attention : Vous allez bloquer un créneau déjà réservé, ce qui annulera la réservation.\nAucune notification ne sera envoyée.\nVeuillez contacter l\'établissement pour l\'en informer.')){
|
||
document.frmAgenda.submit();
|
||
}
|
||
}else document.frmAgenda.submit();
|
||
}
|
||
function reservAg(myAction,myDay,myCreneau,idCoLy){
|
||
document.frmReserv.myAction.value = myAction;
|
||
document.frmReserv.myDay.value = myDay;
|
||
document.frmReserv.myCreneau.value = myCreneau;
|
||
document.frmReserv.idCoLy.value = idCoLy;
|
||
document.frmReserv.submit();
|
||
}
|
||
function affecterSol(myDay,myCreneau){
|
||
document.frmSolAffecter.myDay.value = myDay;
|
||
document.frmSolAffecter.myCreneau.value = myCreneau;
|
||
document.frmSolAffecter.submit();
|
||
}
|
||
function voirSol(idSol){
|
||
document.frmSolVoir.idSol.value = idSol;
|
||
document.frmSolVoir.submit();
|
||
}
|
||
</script>
|
||
|
||
<form name="frmAgenda" method="post" action="agenda-cfa-actions.php">
|
||
<input type="hidden" name="myAction">
|
||
<input type="hidden" name="myDay">
|
||
<input type="hidden" name="myCreneau">
|
||
<input type="hidden" name="myIdCap" value="<?php echo $myIdCap; ?>">
|
||
</form>
|
||
<form name="frmReserv" method="post" action="agenda-cfa-form.php">
|
||
<input type="hidden" name="myAction">
|
||
<input type="hidden" name="myDay">
|
||
<input type="hidden" name="myCreneau">
|
||
<input type="hidden" name="idCoLy">
|
||
<input type="hidden" name="myIdCap" value="<?php echo $myIdCap; ?>">
|
||
</form>
|
||
<form name="frmSolAffecter" method="post" action="sollicitations-cfa-choix.php">
|
||
<input type="hidden" name="myAction" value="affecterSol">
|
||
<input type="hidden" name="myDay">
|
||
<input type="hidden" name="myCreneau">
|
||
<input type="hidden" name="myIdCap" value="<?php echo $myIdCap; ?>">
|
||
</form>
|
||
<form name="frmSolVoir" method="post" action="sollicitation-cfa-voir.php">
|
||
<input type="hidden" name="myAction" value="voirSol">
|
||
<input type="hidden" name="idSol">
|
||
<input type="hidden" name="myIdCap" value="<?php echo $myIdCap; ?>">
|
||
</form>
|
||
|
||
</div>
|
||
|
||
<?php include('include/footer.php');?>
|
||
|
||
</body>
|
||
</html>
|