Corrections svg + modifications mineures

This commit is contained in:
xdrm-brackets 2015-12-26 18:21:44 +01:00
parent 37f96ceb63
commit 55d001bc07
10 changed files with 97 additions and 147 deletions

View File

@ -4,8 +4,10 @@ if(!Authentification::checkUser(0)){
header("Location: http://".$_SERVER['HTTP_HOST']."/index.php"); header("Location: http://".$_SERVER['HTTP_HOST']."/index.php");
die(); die();
}; };
// formattage $_GET['type'] /* REPONSE DU MANAGER */
$answerType = (isset($_GET['type'])) ? $_GET['type'] : null; $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;
<body> <body>
<!-- BARRE DE NOTIFICATIONS --> <!-- BARRE DE NOTIFICATIONS -->
<div id='NOTIFBAR'> <div id='NOTIFBAR' class='<?php echo ($managerStatus!=null) ? 'active '.$managerStatus : $managerStatus; ?>'>
<div></div> <div></div>
<div> <div>
<h3>Oups!</h3> <h3><?php echo $managerTitle; ?></h3>
<p>Certains champs sont incorrects. Veuillez réessayer.</p> <p><?php echo $managerMessage; ?></p>
<a href='#'><input type='button' value='Fermer'></a> <a href='?'><input type='button' value='Fermer'></a>
</div> </div>
</div> </div>
@ -61,24 +63,16 @@ $answerType = (isset($_GET['type'])) ? $_GET['type'] : null;
<!-- FIL D'ARIANE --> <!-- FIL D'ARIANE -->
<div id='BREADCRUMB'><a href='Dashboard.php'>Accueil</a> <a href='Consultations.php'>Consultations</a></a> </div> <div id='BREADCRUMB'><a href='Dashboard.php'>Accueil</a> <a href='Consultations.php'>Consultations</a></a> </div>
<?php if( $answerType != null ){
echo '<span>'; <?php/********************************/
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 '</span>';
}/************************************/
/* CONSULTER LES RENDEZ-VOUS */ /* CONSULTER LES RENDEZ-VOUS */
/*************************************/ ?> /*************************************/?>
<article data-title="Calendrier des consultations"> <article data-title="Calendrier des consultations">
<div> <div><form action='managers/' method='POST'>
<input type='text' id='csMonth' placeholder='12/2015'>Mois à afficher.<br>
<!-- [1] Choix du mois et l'année d'affichage -->
<input type='text' id='csMonth' name='mois' placeholder='12/2015'>Mois à afficher.<br>
<select id='csPatient' name='id_patient'> <select id='csPatient' name='id_patient'>
<option value='*'>Tous les patients:</option> <option value='*'>Tous les patients:</option>
<?php <?php
@ -96,10 +90,17 @@ $answerType = (isset($_GET['type'])) ? $_GET['type'] : null;
?> ?>
</select> </select>
<input type='hidden' name='command' value='RDV:getSVG'>
<input type='submit' value='Affiner'> <input type='submit' value='Affiner'>
</div><br>
</form></div><br>
<!-- HERE COMES THE SVG --> <!-- HERE COMES THE SVG -->
<div id='calendar'><?php
$rdv = new RDV();
$rdv->getSVG(['mois'=>'10/2015']);
?></div>
</article> </article>
@ -141,6 +142,8 @@ $answerType = (isset($_GET['type'])) ? $_GET['type'] : null;
</article> </article>
</section> </section>
</div> </div>

View File

@ -94,27 +94,24 @@ $medecinsSearch = ( isset($_GET['medecins']) ) ? json_decode( customCompression(
// pour chaque médecin // pour chaque médecin
foreach($medecinsSearch as $MED){ if( isset($MED['Id']) && isset($MED['Civilite']) && isset($MED['Prenom']) && isset($MED['Nom']) ){ foreach($medecinsSearch as $MED){ if( isset($MED['Id']) && isset($MED['Civilite']) && isset($MED['Prenom']) && isset($MED['Nom']) ){
echo '<tr>'; echo '<tr>';
echo '<td>'.(($MED['Civilite']=='M')?'Monsieur':'Madame').'</td>';
echo '<td>'.$MED['Prenom'].'</td>';
echo '<td>'.strtoupper($MED['Nom']).'</td>';
// début modification // début modification
echo "<td><form class='updMedecin' action='managers/' method='POST'>"; echo "<td colspan=4><form class='updPatient' action='managers/' method='POST'>";
echo "<input type='hidden' name='Id' value='". $PAT['Id'] ."'>";
echo "<input type='text' name='Civilite' value='". (($PAT['Civilite']=='M')?'Monsieur':'Madame') ."'>";
echo "<input type='text' name='Prenom' value='". $PAT['Prenom'] ."'>";
echo "<input type='text' name='Nom' value='". strtoupper($PAT['Nom']) ."'>";
echo "<input type='hidden' name='command' value='Medecin:update'>"; 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 "<input type='submit' value=''>";
echo '</form></td>'; echo '</form></td>';
// fin modification // fin modification
// début suppression // début suppression
echo "<td><form class='delMedecin' action='managers/' method='POST'>"; echo "<td><form class='delMedecin' action='managers/' method='POST'>";
echo "<input type='hidden' name='id_medecin' value='". $PAT['Id'] ."'>";
echo "<input type='hidden' name='command' value='Medecin:delete'>"; 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 "<input type='submit' value=''>";
echo '</form></td>'; echo '</form></td>';
// fin suppression // fin suppression
echo '</tr>'; echo '</tr>';
}} }}

View File

@ -808,3 +808,15 @@ input[type=radio]:checked + label:before{
background-image: url(../src/svg/edit.svg); background-image: url(../src/svg/edit.svg);
background-position: center center; background-position: center center;
} }
/* CALENDRIER */
#calendar{
width: 100%;
padding: 10%;
height: auto;
}
#Textday_3:hover{
background: red;
}

View File

@ -150,33 +150,32 @@ sbCherche.addEventListener('click', function(e){
//////////////////////////////////////////// ////////////////////////////////////////////
function displayFoundMedecins(foundMedecins){ function displayFoundMedecins(foundMedecins){
var container = document.getElementById('searchResultMedecin'); var container = document.getElementById('searchResultMedecin');
var content = '<table>'; var content = '';
for( var i = 0 ; i < foundMedecins.length ; i++ ){ for( var i = 0 ; i < foundMedecins.length ; i++ ){
content += '<tr>'; content += '<tr>';
content += '<td>'+ ((foundMedecins[i].Civilite=='M')?'Monsieur':'Madame') + '</td>';
content += '<td>'+ foundMedecins[i].Prenom + '</td>';
content += '<td>'+ foundMedecins[i].Nom.toUpperCase() + '</td>';
// début modification // début modification
content += "<td><form class='updMedecin' action='managers/' method='POST'>"; content += "<td colspan=4><form class='updPatient' action='managers/' method='POST'>";
content += "<input type='hidden' name='Id' value='"+ foundMedecins[i].Id +"'>";
content += "<input type='text' name='Civilite' value='"+ ((foundMedecins[i].Civilite=='M')?'Monsieur':'Madame') + "'>";
content += "<input type='text' name='Prenom' value='"+ foundMedecins[i].Prenom + "'>";
content += "<input type='text' name='Nom' value='"+ foundMedecins[i].Nom.toUpperCase() + "'>";
content += "<input type='hidden' name='command' value='Medecin:update'>"; content += "<input type='hidden' name='command' value='Medecin:update'>";
content += "<input type='hidden' name='id_medecin' value='"+foundMedecins[i].Id+"'>";
content += "<input type='submit' value=''>"; content += "<input type='submit' value=''>";
content += '</form></td>'; content += '</form></td>';
// fin modification // fin modification
// début suppression // début suppression
content += "<td><form class='delMedecin' action='managers/' method='POST'>"; content += "<td><form class='delMedecin' action='managers/' method='POST'>";
content += "<input type='hidden' name='command' value='Medecin:delete'>";
content += "<input type='hidden' name='id_medecin' value='"+foundMedecins[i].Id+"'>"; content += "<input type='hidden' name='id_medecin' value='"+foundMedecins[i].Id+"'>";
content += "<input type='hidden' name='command' value='Medecin:delete'>";
content += "<input type='submit' value=''>"; content += "<input type='submit' value=''>";
content += '</form></td>'; content += '</form></td>';
// fin suppression // fin suppression
content += '</tr>'; content += '</tr>';
} }
content += '</table>';
// on vide le container // on vide le container
container.innerHTML = content; container.innerHTML = content;

View File

@ -243,7 +243,6 @@ function displayFoundPatients(foundPatients){
content += "<input type='text' name='NumSecuriteSociale' value='"+ foundPatients[i].NumSecuriteSociale + "'>"; content += "<input type='text' name='NumSecuriteSociale' value='"+ foundPatients[i].NumSecuriteSociale + "'>";
content += "<input type='hidden' name='command' value='Patient:update'>"; content += "<input type='hidden' name='command' value='Patient:update'>";
content += "<input type='hidden' name='id_patient' value='"+foundPatients[i].Id+"'>";
content += "<input type='submit' value=''>"; content += "<input type='submit' value=''>";
content += '</form></td>'; content += '</form></td>';
// fin modification // fin modification

View File

@ -120,37 +120,45 @@ class RDV
} }
public function getSVG($params){ 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 <SVG>
$days = ['Mon'=>0,'Tue'=>1,'Wed'=>2,'Thu'=>3,'Fri'=>4,'Sat'=>5,'Sun'=>6]; $days = ['Mon'=>0,'Tue'=>1,'Wed'=>2,'Thu'=>3,'Fri'=>4,'Sat'=>5,'Sun'=>6];
$svgCalendar = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> $svgCalendar = "<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created with PHP Maggle --> <!-- Created with PHP Maggle !!LAUUUULEU!! -->
<svg <svg
xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:svg='http://www.w3.org/2000/svg'
xmlns=\"http://www.w3.org/2000/svg\" xmlns='http://www.w3.org/2000/svg'
xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xlink='http://www.w3.org/1999/xlink'
version=\"1.1\" version='1.1'
width=\"7700\" width='80%'
height=\"6000\" height='auto'
id=\"svg2\"> viewbox='0 0 7700 6000'
id='svg2'>
<metadata <metadata
id=\"metadata7\"> id='metadata7'>
<rdf:RDF> <rdf:RDF>
<cc:Work <cc:Work
rdf:about=\"\"> rdf:about='>
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" /> rdf:resource='http://purl.org/dc/dcmitype/StillImage' />
<dc:title>Calendar</dc:title> <dc:title>Calendar</dc:title>
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
"; ";
$current = strtotime($params['mois']); $current = strtotime($mois);
//on range les rendez-vous dans un tableau avec leur jour comme clé //on range les rendez-vous dans un tableau avec leur jour comme clé
$RDVTemp = RDVRepo::getByMonth($params['mois'].'-01'); $RDVTemp = RDVRepo::getByMonth($current);
$RDVs = []; $RDVs = [];
foreach($RDVTemp as $rdv){ foreach($RDVTemp as $rdv){
if(!isset($RDVs[date('j',strtotime($rdv['DateRDV']))])){ if(!isset($RDVs[date('j',strtotime($rdv['DateRDV']))])){
@ -219,11 +227,7 @@ class RDV
$medecin = MedecinRepo::getById(intval($rdv['Medecin_id'])); $medecin = MedecinRepo::getById(intval($rdv['Medecin_id']));
//couleur suivant le nombre de consultation //couleur suivant le nombre de consultation
if ($key % 2 == 0) { $color = ($key%2==0) ? 'f9f9f9' : 'ececec';
$color = 'f9f9f9';
} else {
$color = 'ececec';
}
//du svg blablabla //du svg blablabla
$yConsult = 1500 + 700 * $key; $yConsult = 1500 + 700 * $key;
@ -373,7 +377,7 @@ class RDV
} }
} }
$svgCalendar .= '</g>'; $svgCalendar .= '</g>';
return $svgCalendar; echo $svgCalendar;
} }
} }

View File

@ -22,6 +22,9 @@
"role": 0, "role": 0,
"strict": false}, "strict": false},
"updateDateTime":{"method": "update", "updateDateTime":{"method": "update",
"role": 0,
"strict": false},
"getSVG":{"method": "getSVG",
"role": 0, "role": 0,
"strict": false} "strict": false}
}, },
@ -33,6 +36,9 @@
"role":0, "role":0,
"strict":false}, "strict":false},
"delete":{"method": "delete", "delete":{"method": "delete",
"role": 0,
"strict": false},
"update":{"method": "update",
"role": 0, "role": 0,
"strict": false} "strict": false}
} }

View File

@ -42,6 +42,8 @@ class MedecinRepo
if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false; if(!StaticRepo::checkParam($idMedecin,'Numeric')) return false;
var_dump($idMedecin);
$req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id'); $req = StaticRepo::getConnexion()->prepare('DELETE FROM Medecin WHERE Id = :id');
return $req->execute(['id' => $idMedecin]); return $req->execute(['id' => $idMedecin]);
} }

View File

@ -101,13 +101,18 @@ class RDVRepo
public static function getByMonth($date){ 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 = 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)), $req->execute([
'year' => date('Y',strtotime($date))]); 'month' => date( 'm', $date ),
return StaticRepo::delNumeric($req->fetchAll()); 'year' => date( 'Y', $date )
]);
return StaticRepo::delNumeric( $req->fetchAll() );
} }
} }

View File

@ -6,6 +6,7 @@
* Time: 11:40 * Time: 11:40
*/ */
require_once('autoloader.php'); require_once('autoloader.php');
$rdv = new RDV();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -13,85 +14,7 @@ require_once('autoloader.php');
</head> </head>
<body> <body>
<?php <?php
echo $rdv->getSVG(['mois' => '2015-11']); echo $rdv->getSVG(['mois' => '10/2015']);
?> ?>
</body> </body>
</html> </html>
// 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.'<br><br>';
echo $uncompressed.'<br><br>';
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){
}