projet-php/Dashboard.php

175 lines
5.0 KiB
PHP
Executable File

<?php session_start();
require('autoloader.php');
if(!Authentification::checkUser(0)){
header("Location: http://".$_SERVER['HTTP_HOST']."/index.php");
die();
};
/* AFFINAGE PAR MÉDECIN */
$medecinOpt = (isset($_POST['submit'])) ? $_POST['id_medecin'] : null;
$medecinOpt = (!is_numeric($medecinOpt)) ? null : $medecinOpt;
?>
<!DOCTYPE html>
<html>
<head>
<title>Tableau de bord</title>
<meta charset='utf-8'/>
<meta name='description' value='Site de test'/>
<meta name='author' value='{xdrm} & SeekDaSky'/>
<link rel='stylesheet' href='css/font.css'/>
<link rel='stylesheet' href='css/animations.css'/>
<link rel='stylesheet' href='css/global.css'/>
<link rel='stylesheet' href='css/responsive.css'/>
<script type='text/javascript' src='js/lib/API.js'></script>
<script type='text/javascript' src='js/lib/adjust.js'></script>
</head>
<body>
<!-- BARRE DE NOTIFICATIONS -->
<div id='NOTIFBAR'>
<div></div>
<div>
<h3>Oups!</h3>
<p>Certains champs sont incorrects. Veuillez réessayer.</p>
<input type='button' value='Fermer'>
</div>
</div>
<!-- WRAPPER DE LA PAGE -->
<div id='WRAPPER'>
<!-- MENU DE LA PAGE -->
<nav id='MENU'>
<a href='Dashboard.php' id='ICON'></a>
<div>
<a href='Dashboard.php' id='dashboard' class='active'>Tableau de bord</a>
<a href='Consultations.php' id='consultations'>Consultations</a>
<a href='Medecins.php' id='medecin'>Gestion des médecins</a>
<a href='Patients.php' id='patient'>Gestion des patients</a>
</div>
</nav>
<!-- CONTAINER DE LA PAGE -->
<section id='CONTAINER'>
<!-- FIL D'ARIANE -->
<div id='BREADCRUMB'><a href='Dashboard.php'>Accueil</a></div>
<article data-title="Statistiques sur l'âge des patients">
<?php
$stats = StatsRepo::getAgePatient();
?>
<div class="StatContainer">
<p class="title">Homme</p>
<div class="man bar" style="height: 150px"></div>
<?php
foreach($stats['H'] as $Homme){
echo '<div class="man bar" style="height:'.round($Homme/$stats['NbrH']*150).'px;margin-top:'.round(150-($Homme/$stats['NbrH']*150)).'px"></div>';
}
?>
<div class="clear labels">
<p class="label">Total</p>
<?php
foreach (array_keys($stats['H']) as $key){
echo '<p class="label">'.$key.'</p>';
}
?>
</div>
<div class="clear labels">
<p class="label value"><?php echo $stats['NbrH']; ?></p>
<?php
foreach ($stats['H'] as $value){
echo '<p class="label value">'.$value.'</p>';
}
?>
</div>
</div>
<div class="StatContainer">
<p class="title">Femme</p>
<div class="woman bar" style="height: 150px"></div>
<?php
foreach($stats['H'] as $Femme){
echo '<div class="woman bar" style="height:'.round($Femme/$stats['NbrH']*150).'px;margin-top:'.round(150-($Femme/$stats['NbrH']*150)).'px"></div>';
}
?>
<div class="clear labels">
<p class="label">Total</p>
<?php
foreach (array_keys($stats['F']) as $key){
echo '<p class="label">'.$key.'</p>';
}
?>
</div>
<div class="clear labels">
<p class="label value"><?php echo $stats['NbrF']; ?></p>
<?php
foreach ($stats['F'] as $value){
echo '<p class="label value">'.$value.'</p>';
}
?>
</div>
</div>
<div class="clear"></div>
</article>
<article id="search" data-title="Nombre total d'heure de consultation par medecin">
<form method="POST" action="Dashboard.php#search">
<select id='StatMedecin' name='id_medecin'>
<option value='*'>Medecins:</option>
<?php
foreach(MedecinRepo::getAll() as $MEDECIN){
if( $medecinOpt == $MEDECIN['Id'] )
echo "<option value='".$MEDECIN['Id']."' selected>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>";
else
echo "<option value='".$MEDECIN['Id']."'>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>";
}
?>
</select>
<input id="sbCherche" name="submit" type="submit" value="Lancer la recherche" />
</form>
<?php
if( $medecinOpt != null ){
$medecin = MedecinRepo::getById($_POST['id_medecin']);
$stats = StatsRepo::getRDVStat($_POST['id_medecin']);
$heures = ($stats['DureeTotale'] - ($stats['DureeTotale']%60))/60;
$minutes = $stats['DureeTotale']%60;
echo '<div><strong>'.$medecin['Nom'].' '. $medecin['Prenom'].'</strong>
<p>Nombre total de consultations: '.$stats['NombreRDV'].'</p>
<p>Durée totale des consultations: '.$heures.' Heures et '.$minutes.' Minutes</p></div>';
}
?>
</article>
</section>
</div>
<script type='text/javascript'>
var notifBar = document.getElementById('NOTIFBAR');
notifBar.children[1].children[2].addEventListener('click', function(e){
remClass(notifBar, 'active');
}, false);
</script>
</body>
</html>