diff --git a/Consultations.php b/Consultations.php
index 5772436..be250db 100755
--- a/Consultations.php
+++ b/Consultations.php
@@ -14,6 +14,9 @@ $patientOpt = (isset($_POST['id_patient'])) ? $_POST['id_patient'] : null;
$medecinOpt = (isset($_POST['id_medecin'])) ? $_POST['id_medecin'] : null;
$moisOpt = (isset($_POST['mois'])) ? $_POST['mois'] : null;
+$patientOpt = (!is_numeric($patientOpt)) ? null : $patientOpt;
+$medecinOpt = (!is_numeric($medecinOpt)) ? null : $medecinOpt;
+
?>
@@ -122,31 +125,34 @@ $moisOpt = (isset($_POST['mois'])) ? $_POST['mois'] : null;
$annee = $m[2];
// $rdv->getSVG(['mois'=>$moisOpt]);
// on affiche les consutations en fonction de l'affinage
- // var_dump( RDVRepo::getForMonth($mois, $annee) );
foreach(RDVRepo::getForMonth($mois, $annee) as $RDV){
- echo "
";
+ // affinage par médecin
+ if( $medecinOpt == null || $medecinOpt == $RDV['Medecin_Id'] ){
+ if( $patientOpt == null || $patientOpt == $RDV['Patient_Id'] ){
+ echo "
";
- /* MODIFICATION */
- echo "";
+ echo "";
+ echo "";
+ echo "";
+ echo "";
- /* SUPPRESSION */
- echo "";
+ /* SUPPRESSION */
+ echo "";
- echo "
";
+ echo "
";
+ }}
}
}
?>
diff --git a/managers/RDV.class.php b/managers/RDV.class.php
index 79a6fb2..ba88651 100755
--- a/managers/RDV.class.php
+++ b/managers/RDV.class.php
@@ -79,20 +79,20 @@ class RDV
public function update($params){
// si params ok
- var_dump($params['duree']);
if( StaticRepo::checkParam($params['id_consultation'], 'Numeric') && StaticRepo::checkParam($params['jour'], 'Date') && StaticRepo::checkParam($params['heure'], 'Heure') && StaticRepo::checkParam($params['Duree'], 'Heure') ){
$params['date'] = DateTime::createFromFormat('d/m/Y H:i', $params['jour'].' '.$params['heure']);
- $params['dureeTime'] = $params['duree'].':00';
- var_dump($params['dureeTime']);
+ $params['dureeTime'] = $params['Duree'].':00';
+ // var_dump($params['dureeTime']);
if (RDVRepo::updateDateTime($params['id_consultation'], $params['date']->format('Y-m-d H:i:00'), $params['dureeTime'] ) !== FALSE) {
$_status = 'success';
$_title = 'Modification effectuée!';
- $_message = 'La consultation du '.$params['date']->format('d/m/Y').' à '.$params['heure'].'a bien été mise à jour.';
+ $_message = 'La consultation du '.$params['date']->format('d/m/Y').' à '.$params['heure'].' a bien été mise à jour.';
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
Response::quickResponse(200, json_encode([ 'status' => $_status, 'title' => $_title, 'message' => $_message ]));
else{
$response = new Response();
$response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
+ $response->send();
}
}else{
$_status = 'error';
@@ -104,6 +104,7 @@ class RDV
else{
$response = new Response();
$response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
+ $response->send();
}
}
}else{
@@ -116,6 +117,7 @@ class RDV
else{
$response = new Response();
$response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
+ $response->send();
}
}
}
diff --git a/repositories/repos/RDVRepo.php b/repositories/repos/RDVRepo.php
index 09f55a4..617e81d 100755
--- a/repositories/repos/RDVRepo.php
+++ b/repositories/repos/RDVRepo.php
@@ -20,7 +20,7 @@ class RDVRepo
}
public static function getForMonth($month, $year){
- $req = StaticRepo::getConnexion()->prepare("SELECT RDV.Id, RDV.DateRDV, RDV.Duree, Medecin.Prenom as M_Prenom, Medecin.Nom as M_Nom, Patient.Prenom as P_Prenom, Patient.Nom as P_Nom
+ $req = StaticRepo::getConnexion()->prepare("SELECT RDV.Id, RDV.DateRDV, RDV.Medecin_Id, RDV.Patient_Id, RDV.Duree, Medecin.Prenom as M_Prenom, Medecin.Nom as M_Nom, Patient.Prenom as P_Prenom, Patient.Nom as P_Nom
FROM RDV, Patient, Medecin
WHERE Patient.Id = RDV.Patient_Id
AND Medecin.Id = RDV.Medecin_Id
@@ -70,8 +70,11 @@ class RDVRepo
public static function updateDateTime($idRDV, $dateRdv, $duree){
- if(!StaticRepo::checkParam($idRDV, 'Numeric')){return false;}
+ if(!StaticRepo::checkParam($idRDV, 'Numeric')) return false;
+ var_dump($idRDV);
+ var_dump($dateRdv);
+ var_dump($duree);
$req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date_rdv, Duree = :duree WHERE id = :id');
return $req->execute([
':date_rdv' => $dateRdv,