projet-php/Medecins.php

151 lines
5.4 KiB
PHP
Raw Normal View History

2015-12-09 20:43:02 +00:00
<?php session_start();
require('autoloader.php');
if(!Authentification::checkUser(0)){
header("Location: http://".$_SERVER['HTTP_HOST']."/index.php");
die();
};
function customCompression($input, $compression){
if( $compression ) return strtr(base64_encode(addslashes(gzcompress(serialize($input),9))), '+/=', '-_,');
else return unserialize(gzuncompress(stripslashes(base64_decode(strtr($input, '-_,', '+/=')))));
}
2015-12-22 18:35:35 +00:00
/* REPONSE DU MANAGER */
$managerStatus = (isset($_GET['status'])) ? $_GET['status'] : null;
$managerTitle = (isset($_GET['title'])) ? $_GET['title'] : 'Oups!';
$managerMessage = (isset($_GET['message'])) ? $_GET['message'] : 'Erreur interne!';
// on récupère la liste des médecins si donnée
$medecinsSearch = ( isset($_GET['medecins']) ) ? json_decode( customCompression($_GET['medecins'], false) , true) : [];
?>
2015-12-09 20:43:02 +00:00
<!DOCTYPE html>
<html>
<head>
<title>Gestion des médecins</title>
<meta charset='utf-8'/>
<meta name='description' value='Site de test'/>
<meta name='author' value='{xdrm} & SeekDaSky'/>
2015-12-19 17:15:04 +00:00
<link rel='stylesheet' href='css/font.css'/>
2015-12-09 20:43:02 +00:00
<link rel='stylesheet' href='css/animations.css'/>
<link rel='stylesheet' href='css/global.css'/>
<link rel='stylesheet' href='css/blue-green.theme.css'/>
2015-12-09 20:43:02 +00:00
<link rel='stylesheet' href='css/responsive.css'/>
<script type='text/javascript' src='js/lib/API.js'></script>
2015-12-14 10:01:35 +00:00
<script type='text/javascript' src='js/lib/adjust.js'></script>
2015-12-22 23:04:57 +00:00
<script type='text/javascript' src='js/lib/input-checker.js'></script>
2015-12-09 20:43:02 +00:00
</head>
2015-12-13 22:19:22 +00:00
<body>
<!-- BARRE DE NOTIFICATIONS -->
2015-12-22 18:35:35 +00:00
<div id='NOTIFBAR' class='<?php echo ($managerStatus!=null) ? 'active '.$managerStatus : $managerStatus; ?>'>
2015-12-13 22:19:22 +00:00
<div></div>
<div>
2015-12-22 18:35:35 +00:00
<h3><?php echo $managerTitle; ?></h3>
<p><?php echo $managerMessage; ?></p>
<a href='?medecins=<?php echo customCompression(json_encode($medecinsSearch), true); ?>'><input type='button' value='Fermer'></a>
2015-12-13 22:19:22 +00:00
</div>
</div>
2015-12-09 20:43:02 +00:00
<!-- 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'>Tableau de bord</a>
<a href='Consultations.php' id='consultations'>Consultations</a>
<a href='Medecins.php' id='medecin' class='active'>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> <a href='Medecins.php'>Gestion des médecins</a></a> </div>
2015-12-22 18:35:35 +00:00
<?php/********************************/
2015-12-17 09:58:06 +00:00
/* CONSULTER LES MÉDECIN */
/*************************************/ ?>
<article data-title="Rechercher un médecin">
<form method='POST' action='managers/'>
<br><h4>Recherche par nom et/ou prénom:</h4>
2015-12-22 18:35:35 +00:00
<input type='text' id='srPrenom' name='prenom' placeholder='Prénom' value=''><br>
<input type='text' id='srNom' name='nom' placeholder='NOM' value=''><br>
2015-12-17 09:58:06 +00:00
<br>
<input type='hidden' name='command' value='Medecin:search'>
<input type='submit' id='sbCherche' value='Lancer la recherche'>
2015-12-22 18:35:35 +00:00
</form><br>
<h3>Résultats:</h3><br>
2015-12-22 23:04:57 +00:00
<table id='searchResultMedecin'>
2015-12-22 18:35:35 +00:00
<?php
// pour chaque médecin
foreach($medecinsSearch as $MED){ if( isset($MED['Id']) && isset($MED['Civilite']) && isset($MED['Prenom']) && isset($MED['Nom']) ){
2015-12-22 18:35:35 +00:00
echo '<tr>';
echo '<td>'.(($MED['Civilite']=='M')?'Monsieur':'Madame').'</td>';
echo '<td>'.$MED['Prenom'].'</td>';
echo '<td>'.strtoupper($MED['Nom']).'</td>';
// début modification
echo "<td><form class='updMedecin' action='managers/' method='POST'>";
echo "<input type='hidden' name='command' value='Medecin:update'>";
echo "<input type='hidden' name='id_medecin' value='".$MED['Id']."'>";
echo "<input type='submit' value=''>";
echo '</form></td>';
// fin modification
// début suppression
echo "<td><form class='delMedecin' action='managers/' method='POST'>";
echo "<input type='hidden' name='command' value='Medecin:delete'>";
echo "<input type='hidden' name='id_medecin' value='".$MED['Id']."'>";
echo "<input type='submit' value=''>";
echo '</form></td>';
// fin suppression
2015-12-22 18:35:35 +00:00
echo '</tr>';
}}
?>
</table>
2015-12-17 09:58:06 +00:00
</article>
<?php/**********************************/
2015-12-10 09:56:35 +00:00
/* AJOUTER UN MÉDECIN */
2015-12-09 20:43:02 +00:00
/*************************************/ ?>
2015-12-10 09:56:35 +00:00
<article data-title="Ajouter un médecin">
<form method='POST' action='managers/'>
<br><h4>Ajout d'un nouveau médecin</h4>
<input type='text' id='crPrenom' name='prenom' placeholder='Prénom' value='' required><br>
<input type='text' id='crNom' name='nom' placeholder='NOM' value='' required><br>
2015-12-10 09:56:35 +00:00
2015-12-14 10:01:35 +00:00
<input type='radio' name='civilite' class='crCiv' value='M' id='civ1' checked><label for='civ1'>Homme</label><br>
<input type='radio' name='civilite' class='crCiv' value='F' id='civ2'><label for='civ2'>Femme</label><br>
2015-12-09 20:43:02 +00:00
<br>
2015-12-10 09:56:35 +00:00
<input type='hidden' name='command' value='Medecin:add'>
<input type='submit' id='sbCreer' value='Créer le médecin'>
2015-12-09 20:43:02 +00:00
</form>
</article>
</section>
</div>
2015-12-10 09:56:35 +00:00
<script type='text/javascript' src='js/medecins.js'></script>
2015-12-09 20:43:02 +00:00
</body>
</html>