From 55d001bc07f86b728009a66e7ba467f29e4d9a32 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 26 Dec 2015 18:21:44 +0100 Subject: [PATCH] Corrections svg + modifications mineures --- Consultations.php | 47 +++++++++-------- Medecins.php | 17 +++---- css/global.css | 12 +++++ js/medecins.js | 19 ++++--- js/patients.js | 1 - managers/RDV.class.php | 44 ++++++++-------- managers/config/managers.json | 6 +++ repositories/repos/MedecinRepo.php | 2 + repositories/repos/RDVRepo.php | 15 ++++-- test.php | 81 +----------------------------- 10 files changed, 97 insertions(+), 147 deletions(-) diff --git a/Consultations.php b/Consultations.php index d283a2b..8d61ce3 100755 --- a/Consultations.php +++ b/Consultations.php @@ -4,8 +4,10 @@ if(!Authentification::checkUser(0)){ header("Location: http://".$_SERVER['HTTP_HOST']."/index.php"); die(); }; -// formattage $_GET['type'] -$answerType = (isset($_GET['type'])) ? $_GET['type'] : null; +/* 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!'; ?> @@ -30,12 +32,12 @@ $answerType = (isset($_GET['type'])) ? $_GET['type'] : null; -
+
'>
-

Oups!

-

Certains champs sont incorrects. Veuillez réessayer.

- +

+

+
@@ -61,24 +63,16 @@ $answerType = (isset($_GET['type'])) ? $_GET['type'] : null; - '; - switch($answerType){ - case 'creation': echo 'Patient créé.'; break; - case 'modification': echo 'Patient modifié.'; break; - case 'suppression': echo 'Patient supprimé.'; break; - case 'error': echo 'Une erreur est survenue.'; break; - default: echo 'rien à déclarer ? Non!'; break; - } - echo ''; - }/************************************/ + + /*************************************/?>
-
- Mois à afficher.
+
+ + + Mois à afficher.
+ + + -

+ +

+
getSVG(['mois'=>'10/2015']); + ?>
@@ -141,6 +142,8 @@ $answerType = (isset($_GET['type'])) ? $_GET['type'] : null; + +
diff --git a/Medecins.php b/Medecins.php index 57c5fc7..1cc556c 100755 --- a/Medecins.php +++ b/Medecins.php @@ -94,27 +94,24 @@ $medecinsSearch = ( isset($_GET['medecins']) ) ? json_decode( customCompression( // pour chaque médecin foreach($medecinsSearch as $MED){ if( isset($MED['Id']) && isset($MED['Civilite']) && isset($MED['Prenom']) && isset($MED['Nom']) ){ echo ''; - - echo ''.(($MED['Civilite']=='M')?'Monsieur':'Madame').''; - echo ''.$MED['Prenom'].''; - echo ''.strtoupper($MED['Nom']).''; - // début modification - echo "
"; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo '
'; // fin modification // début suppression echo "
"; + echo ""; echo ""; - echo ""; echo ""; echo '
'; // fin suppression - echo ''; }} diff --git a/css/global.css b/css/global.css index aa9be64..29f780c 100755 --- a/css/global.css +++ b/css/global.css @@ -807,4 +807,16 @@ input[type=radio]:checked + label:before{ /* background */ background-image: url(../src/svg/edit.svg); background-position: center center; +} + + +/* CALENDRIER */ +#calendar{ + width: 100%; + padding: 10%; + height: auto; +} + +#Textday_3:hover{ + background: red; } \ No newline at end of file diff --git a/js/medecins.js b/js/medecins.js index 8aa0ee1..0a15056 100755 --- a/js/medecins.js +++ b/js/medecins.js @@ -150,33 +150,32 @@ sbCherche.addEventListener('click', function(e){ //////////////////////////////////////////// function displayFoundMedecins(foundMedecins){ var container = document.getElementById('searchResultMedecin'); - var content = ''; + var content = ''; for( var i = 0 ; i < foundMedecins.length ; i++ ){ content += ''; - content += ''; - content += ''; - content += ''; // début modification - content += "'; // fin modification // début suppression content += "'; // fin suppression content += ''; } - content += '
'+ ((foundMedecins[i].Civilite=='M')?'Monsieur':'Madame') + ''+ foundMedecins[i].Prenom + ''+ foundMedecins[i].Nom.toUpperCase() + '
"; - content += ""; - content += ""; + content += "
"; + content += ""; + content += ""; + content += ""; + content += ""; + + content += ""; content += ""; content += '
"; - content += ""; content += ""; + content += ""; content += ""; content += '
'; - // on vide le container container.innerHTML = content; diff --git a/js/patients.js b/js/patients.js index f3daeec..18f4609 100755 --- a/js/patients.js +++ b/js/patients.js @@ -243,7 +243,6 @@ function displayFoundPatients(foundPatients){ content += ""; content += ""; - content += ""; content += ""; content += ''; // fin modification diff --git a/managers/RDV.class.php b/managers/RDV.class.php index f34d5d9..5165f51 100755 --- a/managers/RDV.class.php +++ b/managers/RDV.class.php @@ -120,37 +120,45 @@ class RDV } public function getSVG($params){ + // conversion du mois + if( preg_match('/^(\d{2})\/(\d{4})$/', $params['mois'], $m) ) + $mois = $m[2].'-'.$m[1]; + else + $mois = '2015-12'; + + // constantes et début $days = ['Mon'=>0,'Tue'=>1,'Wed'=>2,'Thu'=>3,'Fri'=>4,'Sat'=>5,'Sun'=>6]; - $svgCalendar = " - + $svgCalendar = " + + xmlns:svg='http://www.w3.org/2000/svg' + xmlns='http://www.w3.org/2000/svg' + xmlns:xlink='http://www.w3.org/1999/xlink' + version='1.1' + width='80%' + height='auto' + viewbox='0 0 7700 6000' + id='svg2'> + id='metadata7'> + rdf:about='> image/svg+xml + rdf:resource='http://purl.org/dc/dcmitype/StillImage' /> Calendar "; - $current = strtotime($params['mois']); + $current = strtotime($mois); //on range les rendez-vous dans un tableau avec leur jour comme clé - $RDVTemp = RDVRepo::getByMonth($params['mois'].'-01'); + $RDVTemp = RDVRepo::getByMonth($current); $RDVs = []; foreach($RDVTemp as $rdv){ if(!isset($RDVs[date('j',strtotime($rdv['DateRDV']))])){ @@ -219,11 +227,7 @@ class RDV $medecin = MedecinRepo::getById(intval($rdv['Medecin_id'])); //couleur suivant le nombre de consultation - if ($key % 2 == 0) { - $color = 'f9f9f9'; - } else { - $color = 'ececec'; - } + $color = ($key%2==0) ? 'f9f9f9' : 'ececec'; //du svg blablabla $yConsult = 1500 + 700 * $key; @@ -373,7 +377,7 @@ class RDV } } $svgCalendar .= ''; - return $svgCalendar; + echo $svgCalendar; } } \ No newline at end of file diff --git a/managers/config/managers.json b/managers/config/managers.json index eff48c2..7050409 100755 --- a/managers/config/managers.json +++ b/managers/config/managers.json @@ -22,6 +22,9 @@ "role": 0, "strict": false}, "updateDateTime":{"method": "update", + "role": 0, + "strict": false}, + "getSVG":{"method": "getSVG", "role": 0, "strict": false} }, @@ -33,6 +36,9 @@ "role":0, "strict":false}, "delete":{"method": "delete", + "role": 0, + "strict": false}, + "update":{"method": "update", "role": 0, "strict": false} } diff --git a/repositories/repos/MedecinRepo.php b/repositories/repos/MedecinRepo.php index f80b33d..a8586f2 100755 --- a/repositories/repos/MedecinRepo.php +++ b/repositories/repos/MedecinRepo.php @@ -42,6 +42,8 @@ class MedecinRepo if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; + var_dump($idMedecin); + $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); return $req->execute(['id' => $idMedecin]); } diff --git a/repositories/repos/RDVRepo.php b/repositories/repos/RDVRepo.php index 80eb277..cd37b93 100755 --- a/repositories/repos/RDVRepo.php +++ b/repositories/repos/RDVRepo.php @@ -101,13 +101,18 @@ class RDVRepo public static function getByMonth($date){ - if(!StaticRepo::checkParam($date,'Date')){return false;} + $strDate = date( 'Y-m-d', $date ); + + // si erreur on retourne un tableau vide + if( !StaticRepo::checkParam($strDate, 'Date') ) return []; - $date = date('Y-m-d',strtotime($date)); $req = StaticRepo::getConnexion()->prepare('SELECT *, ((HOUR(Duree)*60)+MINUTE(Duree)) AS Minute FROM RDV WHERE MONTH(DateRDV) = :month AND YEAR(DateRDV) = :year ORDER BY DateRDV ASC'); - $req->execute(['month' => date('m',strtotime($date)), - 'year' => date('Y',strtotime($date))]); - return StaticRepo::delNumeric($req->fetchAll()); + $req->execute([ + 'month' => date( 'm', $date ), + 'year' => date( 'Y', $date ) + ]); + + return StaticRepo::delNumeric( $req->fetchAll() ); } } diff --git a/test.php b/test.php index d45232b..f690e81 100755 --- a/test.php +++ b/test.php @@ -6,6 +6,7 @@ * Time: 11:40 */ require_once('autoloader.php'); +$rdv = new RDV(); ?> @@ -13,85 +14,7 @@ require_once('autoloader.php'); getSVG(['mois' => '2015-11']); + echo $rdv->getSVG(['mois' => '10/2015']); ?> -// Response::quickResponse(200,'lol'); -$json = [ - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ], - - [ - "nom" => "Alex", - "prenom" => "Alex", - ] -]; - -$compressed = compress( json_encode($json) ); -$uncompressed = uncompress( $compressed ); - -echo $compressed.'

'; -echo $uncompressed.'

'; - - - - - - - - - - - - -function customCompression($input, compression){ - if( $compression ) return strtr(base64_encode(addslashes(gzcompress(serialize($input),9))), '+/=', '-_,'); - else return unserialize(gzuncompress(stripslashes(base64_decode(strtr($input, '-_,', '+/='))))); -} - -function uncompress($input){ - -}