diff --git a/Medecins.php b/Medecins.php
index fa744ff..57c5fc7 100755
--- a/Medecins.php
+++ b/Medecins.php
@@ -92,13 +92,29 @@ $medecinsSearch = ( isset($_GET['medecins']) ) ? json_decode( customCompression(
';
echo '
'.(($MED['Civilite']=='M')?'Monsieur':'Madame').' | ';
echo ''.$MED['Prenom'].' | ';
echo ''.strtoupper($MED['Nom']).' | ';
+ // début modification
+ echo " | ';
+ // fin modification
+
+ // début suppression
+ echo " | ';
+ // fin suppression
+
echo '';
}}
diff --git a/Patients.php b/Patients.php
index 879fe84..440978f 100755
--- a/Patients.php
+++ b/Patients.php
@@ -91,7 +91,7 @@ $patientsSearch = ( isset($_GET['patients']) ) ? json_decode( customCompression(
';
echo ''.(($PAT['Civilite']=='M')?'Monsieur':'Madame').' | ';
@@ -100,6 +100,22 @@ $patientsSearch = ( isset($_GET['patients']) ) ? json_decode( customCompression(
echo ''.$PAT['DateNaissance'].' | ';
echo ''.$PAT['NumSecuriteSociale'].' | ';
+ // début modification
+ echo " | ';
+ // fin modification
+
+ // début suppression
+ echo " | ';
+ // fin suppression
+
echo '';
}}
diff --git a/css/global.css b/css/global.css
index 9f7338d..b96b7a6 100755
--- a/css/global.css
+++ b/css/global.css
@@ -754,8 +754,7 @@ input[type=radio]:checked + label:before{
#CONTAINER > article table td{
/* position */
- max-width: calc( 100% / 5% );
- padding: .5em 0;
+ max-width: calc( 100% / 6% );
/* border */
border-bottom: 1px solid #cacaca;
@@ -763,9 +762,37 @@ input[type=radio]:checked + label:before{
#CONTAINER > article table#searchResultMedecin td{
/* position */
- max-width: calc( 100% / 3% );
- padding: .5em 0;
+ max-width: calc( 100% / 5% );
/* border */
border-bottom: 1px solid #cacaca;
+}
+
+
+/* Suppression champ de recherche (patient/médecin/consultation) */
+#CONTAINER > article .delPatient input[type=submit],
+#CONTAINER > article .delMedecin input[type=submit]{
+ /* position */
+ padding: .5em 1em;
+
+ /* border */
+ border: 0;
+
+ /* background */
+ background-image: url(../src/svg/invalid.svg);
+ background-position: center center;
+}
+
+/* Modification champ de recherche (patient/médecin/consultation) */
+#CONTAINER > article .updPatient input[type=submit],
+#CONTAINER > article .updMedecin input[type=submit]{
+ /* position */
+ padding: .5em 1em;
+
+ /* border */
+ border: 0;
+
+ /* background */
+ background-image: url(../src/svg/edit.svg);
+ background-position: center center;
}
\ No newline at end of file
diff --git a/js/medecins.js b/js/medecins.js
index 7c9eb72..8aa0ee1 100755
--- a/js/medecins.js
+++ b/js/medecins.js
@@ -157,6 +157,21 @@ function displayFoundMedecins(foundMedecins){
content += ''+ ((foundMedecins[i].Civilite=='M')?'Monsieur':'Madame') + ' | ';
content += ''+ foundMedecins[i].Prenom + ' | ';
content += ''+ foundMedecins[i].Nom.toUpperCase() + ' | ';
+ // début modification
+ content += " | ';
+ // fin modification
+
+ // début suppression
+ content += " | ';
+ // fin suppression
content += '';
}
diff --git a/js/patients.js b/js/patients.js
index 8f5df52..8217b85 100755
--- a/js/patients.js
+++ b/js/patients.js
@@ -238,6 +238,21 @@ function displayFoundPatients(foundPatients){
content += ''+ foundPatients[i].Nom.toUpperCase() + ' | ';
content += ''+ foundPatients[i].DateNaissance + ' | ';
content += ''+ foundPatients[i].NumSecuriteSociale + ' | ';
+ // début modification
+ content += " | ';
+ // fin modification
+
+ // début suppression
+ content += " | ';
+ // fin suppression
content += '';
}
diff --git a/managers/Medecin.class.php b/managers/Medecin.class.php
index 4411d88..df77a08 100755
--- a/managers/Medecin.class.php
+++ b/managers/Medecin.class.php
@@ -76,29 +76,34 @@ class Medecin
}
public function delete($params){
- if(MedecinRepo::delete($params['id_medecin']) !==FALSE){
- if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
- Response::quickResponse(200, json_encode([
- 'status' => 'success',
- 'title' => 'Médecin supprimé!',
- 'message' => ''
- ]));
- }else{
+ if( MedecinRepo::delete($params['id_medecin']) !== FALSE ){
+
+ $_status = 'success';
+ $_title = 'Médecin supprimé!';
+ $_message = 'Le médecin a bien été supprimé de la base de données! ';
+
+ 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'].'/Medecins.php?status='.$_status.'&title='.$_title.'&message='.$_message);
$response->send();
}
+
}else{
- if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
- Response::quickResponse(200, json_encode([
- 'status' => 'error',
- 'title' => 'Erreur lors de la supression!'
- ]));
- }else{
+
+ $_status = 'error';
+ $_title = 'Erreur de suppression!';
+ $_message = 'Erreur lors de la suppression. Réessayez!';
+
+ 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'].'/Medecins.php?status='.$_status.'&title='.$_title.'&message='.$_message);
$response->send();
}
+
}
}
diff --git a/managers/Patient.class.php b/managers/Patient.class.php
index e658152..1c36b7e 100755
--- a/managers/Patient.class.php
+++ b/managers/Patient.class.php
@@ -13,10 +13,10 @@ function customCompression($input, $compression){
class Patient
{
public function add($params){
- if(StaticRepo::checkParam($params['date_naissance'],'Date')){
- $params['num_secu'] = str_replace(' ','',$params['num_secu']);
+ if( StaticRepo::checkParam($params['date_naissance'], 'Date') ){
+ $params['num_secu'] = str_replace(' ', '', $params['num_secu']);
$params['date_naissance'] = DateTime::createFromFormat('d/m/Y', $params['date_naissance']);
- if(PatientRepo::add($params['civilite'],strtolower($params['prenom']),strtolower($params['nom']),$params['adresse'],$params['adresse2'],$params['ville'],$params['code_postal'],
+ if( PatientRepo::add($params['civilite'],strtolower($params['prenom']),strtolower($params['nom']),$params['adresse'],$params['adresse2'],$params['ville'],$params['code_postal'],
$params['date_naissance']->format('Y-m-d'),$params['lieu_naissance'],$params['num_secu'],$params['medecin_traitant']) !== FALSE){
$_status = 'success';
$_title = 'Création effectuée!';
@@ -139,10 +139,10 @@ class Patient
}
public function delete($params){
- if(PatientRepo::delete($params['id_patient']) !==FALSE){
+ if( PatientRepo::delete($params['id_patient']) !== FALSE ){
- $_status = 'success';
- $_title = 'Patient supprimé!';
+ $_status = 'success';
+ $_title = 'Patient supprimé!';
$_message = 'Le patient a bien été supprimé de la base de données!';
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
@@ -154,8 +154,8 @@ class Patient
}
}else{
- $_status = 'error';
- $_title = 'Erreur de suppression!';
+ $_status = 'error';
+ $_title = 'Erreur de suppression!';
$_message = 'Erreur lors de la suppression. Réessayez!';
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
diff --git a/repositories/StaticRepo.php b/repositories/StaticRepo.php
index 60e8c9c..6cd1239 100755
--- a/repositories/StaticRepo.php
+++ b/repositories/StaticRepo.php
@@ -132,6 +132,10 @@ class StaticRepo{
$checker = $checker && !is_null($variable) && is_int($variable) && $variableprepare('SELECT * FROM Medecin WHERE Id = :id');
$req->execute(['id' => $id]);
@@ -21,22 +21,26 @@ class MedecinRepo
public static function add($civilite,$prenom,$nom){
- if(!StaticRepo::checkParam($civilite,'Civilite') && !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')){return false;}
+ if(!StaticRepo::checkParam($civilite,'Civilite') && !StaticRepo::checkParam($prenom,'String45') && !StaticRepo::checkParam($nom,'String45')) return false;
$req = StaticRepo::getConnexion()->prepare('INSERT INTO Medecin VALUES (DEFAULT,:civilite,:prenom,:nom)');
$result = $req->execute(['civilite' => $civilite,
'nom' => $nom,
- 'prenom' => $prenom]);
+ 'prenom' => $prenom
+ ]);
+
//PDO renvoie un ID sous forme de char, on transtype
$id = StaticRepo::getConnexion()->lastInsertId();
- settype($id,'integer');
- if($result){return $id;}
- else{return false;}
+ settype($id, 'integer');
+
+
+ if($result) return $id;
+ else return false;
}
public static function delete($idMedecin){
- if(!StaticRepo::checkParam($idMedecin,'Integer')){return false;}
+ if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false;
$req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id');
return $req->execute(['id' => $idMedecin]);
@@ -50,7 +54,7 @@ class MedecinRepo
$optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%';
$optNom = ( $nom != 'null' && StaticRepo::checkParam($nom, 'String45') ) ? '%'.$nom.'%' : '%';
- $req = StaticRepo::getConnexion()->query("SELECT *
+ $req = StaticRepo::getConnexion()->query("SELECT Id, Civilite, Prenom, Nom
FROM Medecin
WHERE Nom LIKE '".$optNom."'
AND Prenom LIKE '".$optPrenom."'
@@ -62,7 +66,7 @@ class MedecinRepo
public static function getPatients($idMedecin){
- if(!StaticRepo::checkParam($idMedecin,'Integer')){return false;}
+ if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false;
$req = StaticRepo::getConnexion()->prepare('SELECT Patient.* FROM Patient,Medecin
WHERE Medecin.Id = :id
diff --git a/repositories/repos/PatientRepo.php b/repositories/repos/PatientRepo.php
index 74ba310..86d1523 100755
--- a/repositories/repos/PatientRepo.php
+++ b/repositories/repos/PatientRepo.php
@@ -28,11 +28,11 @@ class PatientRepo
$correctTypes = $correctTypes && StaticRepo::checkParam($codePostal,'String');
$correctTypes = $correctTypes && StaticRepo::checkParam($dateNaissance,'Date');
$correctTypes = $correctTypes && StaticRepo::checkParam($lieuNaissance,'String50');
- $correctTypes = $correctTypes && ( $medecinTraitant == 'null' || StaticRepo::checkParam($medecinTraitant, 'Integer') );
+ $correctTypes = $correctTypes && ( $medecinTraitant == 'null' || StaticRepo::checkParam($medecinTraitant, 'Numeric') );
if( !$correctTypes ) return false;
$dateNaissance = strtotime($dateNaissance);
- $dateNaissance = Date('o-m-d',$dateNaissance);
+ $dateNaissance = Date('o-m-d', $dateNaissance);
$req = StaticRepo::getConnexion()->prepare("INSERT INTO Patient
VALUES(DEFAULT,
@@ -107,10 +107,12 @@ class PatientRepo
public static function delete($idPatient){
- if(!StaticRepo::checkParam($idPatient,'Integer')){ return false;}
+ // si format erroné, retourne FALSE
+ if( !StaticRepo::checkParam($idPatient, 'Numeric') ) return false;
$req = StaticRepo::getConnexion()->prepare('DELETE FROM Patient WHERE Patient.Id = :id');
- return $req->execute(['id' => $idPatient]);
+
+ return $req->execute([':id' => $idPatient]);
}
@@ -132,7 +134,7 @@ class PatientRepo
$optPrenom = ( $prenom != 'null' && StaticRepo::checkParam($prenom,'String45') ) ? '%'.$prenom.'%' : '%';
$optNom = ( $nom != 'null' && StaticRepo::checkParam($nom, 'String45') ) ? '%'.$nom.'%' : '%';
- $req = StaticRepo::getConnexion()->query("SELECT Civilite, Nom, Prenom, DateNaissance, NumSecuriteSociale
+ $req = StaticRepo::getConnexion()->query("SELECT Id, Civilite, Nom, Prenom, DateNaissance, NumSecuriteSociale
FROM Patient
WHERE Nom LIKE '".$optNom."'
AND Prenom LIKE '".$optPrenom."'
diff --git a/src/svg/edit.svg b/src/svg/edit.svg
new file mode 100755
index 0000000..41ae019
--- /dev/null
+++ b/src/svg/edit.svg
@@ -0,0 +1 @@
+
\ No newline at end of file