Correction inversion des IF
This commit is contained in:
parent
fb596ef35a
commit
4c9ed8f692
|
@ -41,35 +41,28 @@ if( newRDVPatient != null && newRDVMedecin != null ){
|
|||
|
||||
|
||||
|
||||
/* VERIFICATION DES CHAMPS */
|
||||
|
||||
|
||||
/* [1] VERIFICATION DES CHAMPS DE LA CREATION
|
||||
======================================================*/
|
||||
var inCk = new inputChecker();
|
||||
var inDate = document.getElementById('inDate');
|
||||
var inHeure = document.getElementById('inHeure');
|
||||
var inSecu = document.getElementById('inSecu');
|
||||
var sbCreer = document.getElementById('sbCreer');
|
||||
|
||||
// format de date simplifié
|
||||
var dateFormat = new formatChecker(null,
|
||||
'Ji/Mi/2iii', { 'J': '[0-3]', 'M': '[0-1]' }
|
||||
'Ji/Mi/iiii', { 'J': '[0-3]', 'M': '[0-1]' }
|
||||
);
|
||||
|
||||
// format de temps simplifié
|
||||
var timeFormat = new formatChecker(null,
|
||||
'Hi:Mi', { 'H': '[0-2]', 'M': '[0-6]' }
|
||||
);
|
||||
// format numéro SECU simplifié
|
||||
var secuFormat = new formatChecker(null,
|
||||
'S ii Mi ii iii iii ii', { 'S': '[0-1]', 'M': '[0-1]' }
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
var now = new Date();
|
||||
inCk.append( inDate, dateFormat, '01/01/2015' );
|
||||
inCk.append( inHeure, timeFormat, '23:59' );
|
||||
inCk.append( inSecu, secuFormat, inSecu.placeholder );
|
||||
|
||||
|
||||
inDate.addEventListener('keyup', function(e){
|
||||
if( inCk.check(inDate) ) addClass(inDate, 'validated'); // on active la classe si correct
|
||||
|
@ -98,48 +91,6 @@ inDuree.addEventListener('keyup', function(e){
|
|||
remClass(inDuree, 'validated'); // on désactive la classe
|
||||
}, false);
|
||||
|
||||
function checkSecuControlKey(pNumSecu){
|
||||
var NIR = pNumSecu.slice(0,-2).replace(/ /g, '');
|
||||
var key = pNumSecu.slice(-2);
|
||||
|
||||
return 97-(NIR%97) == key;
|
||||
}
|
||||
|
||||
inSecu.addEventListener('keyup', function(e){
|
||||
if( inCk.check(inSecu) ){
|
||||
|
||||
if( checkSecuControlKey(inSecu.value) ){ // si la clé est correcte
|
||||
addClass(inSecu, 'validated'); // on dis que le champ est valide
|
||||
remClass(inSecu, 'invalid'); // on dis qu'il n'est pas invalide
|
||||
}else{
|
||||
remClass(inSecu, 'validated'); // on dis que le champ n'est pas valide
|
||||
addClass(inSecu, 'invalid'); // on dis qu'il est invalide
|
||||
}
|
||||
|
||||
}else{ // si incorrect
|
||||
|
||||
remClass(inSecu, 'validated'); // on désactive la classe
|
||||
remClass(inSecu, 'invalid'); // on dis qu'il n'est pas invalide
|
||||
|
||||
inCk.correct(inSecu, false); // on corrige partiellement
|
||||
if( inCk.check(inSecu) ){
|
||||
|
||||
if( checkSecuControlKey(inSecu.value) ){ // si la clé est correcte
|
||||
addClass(inSecu, 'validated'); // on dis que le champ est valide
|
||||
remClass(inSecu, 'invalid'); // on dis qu'il n'est pas invalide
|
||||
}else{
|
||||
remClass(inSecu, 'validated'); // on dis que le champ n'est pas valide
|
||||
addClass(inSecu, 'invalid'); // on dis qu'il est invalide
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
||||
// inDate.value = 'x3 F3/a8';
|
||||
// inHeure.value = 'x3 F3/a8';
|
||||
inSecu.value = '1 96 01 31 555 861';
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -166,11 +117,62 @@ sbCreer.addEventListener('click', function(e){
|
|||
var inputCheckerValid = inCk.check(inDate) && inCk.check(inHeure);
|
||||
var selectNoDefault = newRDVPatient.value != '*' && newRDVMedecin.value != '*';
|
||||
|
||||
console.log( inputCheckerValid );
|
||||
console.log( checker );
|
||||
console.log( selectNoDefault );
|
||||
|
||||
|
||||
if( inputCheckerValid && checker && selectNoDefault ) // si tout es ok uniquement, on submit()
|
||||
sbCreer.parentNode.submit();
|
||||
}, false);
|
||||
if( inputCheckerValid && checker && selectNoDefault ){ // si tout es ok uniquement, on submit()
|
||||
var request = {
|
||||
id_patient: newRDVPatient.value,
|
||||
id_medecin: newRDVMedecin.value,
|
||||
date: inDate.value,
|
||||
heure: inHeure.value,
|
||||
duree: inDuree.value
|
||||
};
|
||||
|
||||
API.send('RDV:add', request, function(e){
|
||||
notif(e.status, e.title, e.message);
|
||||
|
||||
if( e.status == 'success' ) // on vide le formulaire si on a 'success'
|
||||
sbCreer.parentNode.reset();
|
||||
}, false);
|
||||
|
||||
|
||||
}else{ // sinon on affiche l'erreur
|
||||
notif('error', 'Oups!', 'Certains champs sont requis ou incorrects.');
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] Verification des champs de la consultation
|
||||
======================================================*/
|
||||
var inCk2 = new inputChecker();
|
||||
var csMonth = document.getElementById('csMonth');
|
||||
var csPatient = document.getElementById('csPatient');
|
||||
var csMedecin = document.getElementById('csMedecin');
|
||||
|
||||
|
||||
// format de mois simplifié
|
||||
var monthFormat = new formatChecker(null, 'Mi/iiii', { 'M': '[0-1]' } );
|
||||
inCk2.append( csMonth, monthFormat, csMonth.placeholder );
|
||||
|
||||
csMonth.addEventListener('keyup', function(e){
|
||||
if( inCk2.check(csMonth) ) addClass(csMonth, 'validated'); // on active la classe si correct
|
||||
else{ // si incorrect
|
||||
remClass(csMonth, 'validated'); // on désactive la classe
|
||||
inCk2.correct(csMonth, false); // on corrige partiellement
|
||||
if( inCk2.check(csMonth) ) addClass(csMonth, 'validated'); // mise à jour de la classe après correction
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [3] Affinage du calendrier
|
||||
======================================================*/
|
||||
|
|
|
@ -10,54 +10,54 @@ class Medecin
|
|||
{
|
||||
public function add($params){
|
||||
if(MedecinRepo::add($params['civilite'],strtolower($params['prenom']),strtolower($params['nom'])) !==FALSE){
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=creation");
|
||||
$response->send();
|
||||
}else{
|
||||
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
Response::quickResponse(200, json_encode([
|
||||
'status' => 'success',
|
||||
'title' => 'Création effectuée!',
|
||||
'message' => 'Le médecin '.$params['prenom'].' '.$params['nom'].' a bien été créé.'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=creation");
|
||||
$response->send();
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=error");
|
||||
$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 de création!'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=supression");
|
||||
$response->send();
|
||||
}else{
|
||||
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{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=supression");
|
||||
$response->send();
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=error");
|
||||
$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{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Medecins.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,40 +14,40 @@ class Patient
|
|||
$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'],
|
||||
$params['date_naissance']->format('Y-m-d'),$params['lieu_naissance'],$params['num_secu'],$params['medecin_traitant']) !== FALSE){
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=creation");
|
||||
$response->send();
|
||||
}else{
|
||||
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
Response::quickResponse(200, json_encode([
|
||||
'status' => 'success',
|
||||
'title' => 'Création effectuée!',
|
||||
'message' => 'Le patient '.$params['prenom'].' '.$params['nom'].' a bien été créé.'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=creation");
|
||||
$response->send();
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$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 de création!'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$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 de paramètre',
|
||||
'message' => 'Date incorrecte'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,67 +58,67 @@ class Patient
|
|||
$params['date_naissance'] = DateTime::createFromFormat('d/m/Y', $params['date_naissance']);
|
||||
if(PatientRepo::update($params['id_patient'],$params['civilite'],strtolower($params['prenom']),strtolower($params['nom']),$params['adresse'],$params['adresse2'],$params['ville'],$params['cope_postal'],
|
||||
$params['date_naissance']->format('Y-m-d'),$params['lieu_naissance'],$params['num_secu'],$params['medecin_traitant']) !==FALSE){
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=maj");
|
||||
$response->send();
|
||||
}else{
|
||||
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
Response::quickResponse(200, json_encode([
|
||||
'status' => 'success',
|
||||
'title' => 'Modification effectuée!',
|
||||
'message' => 'Le patient '.$params['prenom'].' '.$params['nom'].' a bien été modifié.'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=maj");
|
||||
$response->send();
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$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 de création!'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$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 de paramètre',
|
||||
'message' => 'Date incorrecte'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($params){
|
||||
if(PatientRepo::delete($params['id_patient']) !==FALSE){
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=supression");
|
||||
$response->send();
|
||||
}else{
|
||||
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
Response::quickResponse(200, json_encode([
|
||||
'status' => 'success',
|
||||
'title' => 'Supression effectuée!',
|
||||
'message' => 'Le patient a bien été supprimé.'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=supression");
|
||||
$response->send();
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$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{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Patients.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,70 +9,70 @@
|
|||
class RDV
|
||||
{
|
||||
public function add($params){
|
||||
if(StaticRepo::checkParam($params['date_naissance'],'Date')) {
|
||||
if(StaticRepo::checkParam($params['date'],'Date')) {
|
||||
$params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']);
|
||||
if (RDVRepo::add($params['date']->format('Y-m-d') . ' ' . $params['heure'] . ':00', $params['duree'], $params['id_patient'], $params['id_medecin']) !== FALSE) {
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=creation");
|
||||
$response->send();
|
||||
}else{
|
||||
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
Response::quickResponse(200, json_encode([
|
||||
'status' => 'success',
|
||||
'title' => 'Création effectuée!',
|
||||
'message' => 'La consultation du '.$params['date']->format('d/m/Y').' à '.$params['heure'].' a bien été créée.'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=creation");
|
||||
$response->send();
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
||||
$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 de création!'
|
||||
]));
|
||||
}else{
|
||||
$response->send();
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
||||
$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 de paramètre',
|
||||
'message' => 'Date incorrecte'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($params){
|
||||
if(RDVRepo::delete($params['id_consultation']) !==FALSE){
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=supression");
|
||||
$response->send();
|
||||
}else{
|
||||
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
Response::quickResponse(200, json_encode([
|
||||
'status' => 'success',
|
||||
'title' => 'Supression effectuée!',
|
||||
'message' => 'La consultation a bien été supprimée.'
|
||||
]));
|
||||
}else{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=supression");
|
||||
$response->send();
|
||||
}
|
||||
}else{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
||||
$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{
|
||||
$response = new Response();
|
||||
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue