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

View File

@ -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 '<tr>';
echo '<td>'.(($MED['Civilite']=='M')?'Monsieur':'Madame').'</td>';
echo '<td>'.$MED['Prenom'].'</td>';
echo '<td>'.strtoupper($MED['Nom']).'</td>';
// début modification
echo "<td><form class='updMedecin' action='managers/' method='POST'>";
echo "<input type='hidden' name='command' value='Medecin:update'>";
echo "<input type='hidden' name='id_medecin' value='".$MED['Id']."'>";
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='submit' value=''>";
echo '</form></td>';
// fin modification
// début suppression
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='id_medecin' value='".$MED['Id']."'>";
echo "<input type='submit' value=''>";
echo '</form></td>';
// fin suppression
echo '</tr>';
}}

View File

@ -808,3 +808,15 @@ input[type=radio]:checked + label:before{
background-image: url(../src/svg/edit.svg);
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){
var container = document.getElementById('searchResultMedecin');
var content = '<table>';
var content = '';
for( var i = 0 ; i < foundMedecins.length ; i++ ){
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
content += "<td><form class='updMedecin' action='managers/' method='POST'>";
content += "<input type='hidden' name='command' value='Medecin:update'>";
content += "<input type='hidden' name='id_medecin' value='"+foundMedecins[i].Id+"'>";
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='submit' value=''>";
content += '</form></td>';
// fin modification
// début suppression
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='command' value='Medecin:delete'>";
content += "<input type='submit' value=''>";
content += '</form></td>';
// fin suppression
content += '</tr>';
}
content += '</table>';
// on vide le container
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='hidden' name='command' value='Patient:update'>";
content += "<input type='hidden' name='id_patient' value='"+foundPatients[i].Id+"'>";
content += "<input type='submit' value=''>";
content += '</form></td>';
// fin modification

View File

@ -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 <SVG>
$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\"?>
<!-- Created with PHP Maggle -->
$svgCalendar = "<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created with PHP Maggle !!LAUUUULEU!! -->
<svg
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=\"7700\"
height=\"6000\"
id=\"svg2\">
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'>
<metadata
id=\"metadata7\">
id='metadata7'>
<rdf:RDF>
<cc:Work
rdf:about=\"\">
rdf:about='>
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />
rdf:resource='http://purl.org/dc/dcmitype/StillImage' />
<dc:title>Calendar</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
";
$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 .= '</g>';
return $svgCalendar;
echo $svgCalendar;
}
}

View File

@ -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}
}

View File

@ -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]);
}

View File

@ -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() );
}
}

View File

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