This commit is contained in:
xdrm-brackets 2016-01-03 18:55:13 +01:00
parent 2851188fdf
commit 6d5a72da38
1 changed files with 16 additions and 6 deletions

View File

@ -3,7 +3,13 @@ require('autoloader.php');
if(!Authentification::checkUser(0)){ if(!Authentification::checkUser(0)){
header("Location: http://".$_SERVER['HTTP_HOST']."/index.php"); header("Location: http://".$_SERVER['HTTP_HOST']."/index.php");
die(); die();
};?> };
/* AFFINAGE PAR MÉDECIN */
$medecinOpt = (isset($_POST['submit'])) ? $_POST['id_medecin'] : null;
$medecinOpt = (!is_numeric($medecinOpt)) ? null : $medecinOpt;
?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -125,8 +131,12 @@ if(!Authentification::checkUser(0)){
<select id='StatMedecin' name='id_medecin'> <select id='StatMedecin' name='id_medecin'>
<option value='*'>Medecins:</option> <option value='*'>Medecins:</option>
<?php <?php
foreach(MedecinRepo::getAll() as $MEDECIN) foreach(MedecinRepo::getAll() as $MEDECIN){
echo "<option value='".$MEDECIN['Id']."'>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>"; 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> </select>
@ -134,15 +144,15 @@ if(!Authentification::checkUser(0)){
</form> </form>
<?php <?php
if(isset($_POST['submit'])) { if( $medecinOpt != null ){
$medecin = MedecinRepo::getById($_POST['id_medecin']); $medecin = MedecinRepo::getById($_POST['id_medecin']);
$stats = StatsRepo::getRDVStat($_POST['id_medecin']); $stats = StatsRepo::getRDVStat($_POST['id_medecin']);
$heures = ($stats['DureeTotale'] - ($stats['DureeTotale']%60))/60; $heures = ($stats['DureeTotale'] - ($stats['DureeTotale']%60))/60;
$minutes = $stats['DureeTotale']%60; $minutes = $stats['DureeTotale']%60;
echo '<div><p>'.$medecin['Nom'].' '. $medecin['Prenom'].'</p> echo '<div><strong>'.$medecin['Nom'].' '. $medecin['Prenom'].'</strong>
<p>Nombre total de consultation: '.$stats['NombreRDV'].'</p> <p>Nombre total de consultations: '.$stats['NombreRDV'].'</p>
<p>Durée totale des consultations: '.$heures.' Heures et '.$minutes.' Minutes</p></div>'; <p>Durée totale des consultations: '.$heures.' Heures et '.$minutes.' Minutes</p></div>';
} }
?> ?>