Modifications majeures éparses

This commit is contained in:
xdrm-brackets 2016-01-03 16:01:38 +01:00
parent 55d001bc07
commit e270a35062
8 changed files with 428 additions and 199 deletions

View File

@ -9,6 +9,11 @@ $managerStatus = (isset($_GET['status'])) ? $_GET['status'] : null;
$managerTitle = (isset($_GET['title'])) ? $_GET['title'] : 'Oups!'; $managerTitle = (isset($_GET['title'])) ? $_GET['title'] : 'Oups!';
$managerMessage = (isset($_GET['message'])) ? $_GET['message'] : 'Erreur interne!'; $managerMessage = (isset($_GET['message'])) ? $_GET['message'] : 'Erreur interne!';
/* AFFINAGE CALENDRIER */
$patientOpt = (isset($_POST['id_patient'])) ? $_POST['id_patient'] : null;
$medecinOpt = (isset($_POST['id_medecin'])) ? $_POST['id_medecin'] : null;
$moisOpt = (isset($_POST['mois'])) ? $_POST['mois'] : null;
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -66,18 +71,27 @@ $managerMessage = (isset($_GET['message'])) ? $_GET['message'] : 'Erreur interne
<?php/********************************/ <?php/********************************/
/* CONSULTER LES RENDEZ-VOUS */ /* CONSULTER LES RENDEZ-VOUS */
/*************************************/?> /*************************************/
?>
<article data-title="Calendrier des consultations"> <article data-title="Calendrier des consultations">
<div><form action='managers/' method='POST'> <div><form action='' method='POST'>
<!-- [1] Choix du mois et l'année d'affichage --> <!-- [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 <?php
foreach(PatientRepo::getAll() as $PATIENT) if( $moisOpt != null )
echo "<input type='text' id='csMonth' name='mois' placeholder='12/2015' value='".$moisOpt."'>Mois à afficher.<br>";
else
echo "<input type='text' id='csMonth' name='mois' placeholder='12/2015'>Mois à afficher.<br>";
?>
<select id='csPatient' name='id_patient'>
<?php
echo "<option value='*'>Tous les patients:</option>";
foreach(PatientRepo::getAll() as $PATIENT){
if( $PATIENT['Id'] == $patientOpt ) // selection par défaut
echo "<option value='".$PATIENT['Id']."' data-medecin='".$PATIENT['MedecinTraitant']."' selected>".$PATIENT['Nom']." ".$PATIENT['Prenom']."</option>";
else // sinon
echo "<option value='".$PATIENT['Id']."' data-medecin='".$PATIENT['MedecinTraitant']."'>".$PATIENT['Nom']." ".$PATIENT['Prenom']."</option>"; echo "<option value='".$PATIENT['Id']."' data-medecin='".$PATIENT['MedecinTraitant']."'>".$PATIENT['Nom']." ".$PATIENT['Prenom']."</option>";
}
?> ?>
</select> </select>
@ -85,21 +99,56 @@ $managerMessage = (isset($_GET['message'])) ? $_GET['message'] : 'Erreur interne
<select id='csMedecin' name='id_medecin'> <select id='csMedecin' name='id_medecin'>
<option value='*'>Tous les médecins:</option> <option value='*'>Tous les médecins:</option>
<?php <?php
foreach(MedecinRepo::getAll() as $MEDECIN) foreach(MedecinRepo::getAll() as $MEDECIN){
if( $MEDECIN['Id'] == $medecinOpt ) // selection par défaut
echo "<option value='".$MEDECIN['Id']."' selected>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>";
else
echo "<option value='".$MEDECIN['Id']."'>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>"; echo "<option value='".$MEDECIN['Id']."'>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>";
}
?> ?>
</select> </select>
<input type='hidden' name='command' value='RDV:getSVG'> <!-- <input type='hidden' name='command' value='RDV:getSVG'> -->
<input type='submit' value='Affiner'> <input type='submit' value='Affiner'>
</form></div><br> </form></div>
<!-- HERE COMES THE SVG --> <!-- HERE COMES THE SVG -->
<div id='calendar'><?php <div id='calendar'><?php
$rdv = new RDV(); $rdv = new RDV();
$rdv->getSVG(['mois'=>'10/2015']); if( $moisOpt != null && preg_match('/^(\d{2})\/(\d{4})$/', $moisOpt, $m) ){
$mois = $m[1];
$annee = $m[2];
// $rdv->getSVG(['mois'=>$moisOpt]);
// on affiche les consutations en fonction de l'affinage
// var_dump( RDVRepo::getForMonth($mois, $annee) );
foreach(RDVRepo::getForMonth($mois, $annee) as $RDV){
echo "<div class='RDV'>";
/* MODIFICATION */
echo "<form action='managers/' method='POST'>";
echo "<input type='text' class='jour' name='jour' value='".date('d/m/Y', strtotime($RDV['DateRDV']))."'>";
echo "<input type='text' class='heure' name='heure' value='".date('H:i', strtotime($RDV['DateRDV']))."'>";
echo "<input type='text' class='duree' name='Duree' value='".date('i:s', strtotime($RDV['Duree']))."'>";
echo "<input type='text' readonly class='Medecin' value='Medecin: ".$RDV['M_Prenom']." ".$RDV['M_Nom']."'>";
echo "<input type='text' readonly class='Patient' value='Patient: ".$RDV['P_Prenom']." ".$RDV['P_Nom']."'>";
echo "<input type='hidden' name='id_consultation' value='".$RDV['Id']."'>";
echo "<input type='hidden' name='command' value='RDV:update'>";
echo "<input type='submit' value=''>";
echo "</form>";
/* SUPPRESSION */
echo "<form action='managers/' method='POST'>";
echo "<input type='hidden' name='id_consultation' value='".$RDV['Id']."'>";
echo "<input type='hidden' name='command' value='RDV:delete'>";
echo "<input type='submit' value=''>";
echo "</form>";
echo "</div>";
}
}
?></div> ?></div>
</article> </article>

View File

@ -817,6 +817,144 @@ input[type=radio]:checked + label:before{
height: auto; height: auto;
} }
#Textday_3:hover{ /* cases */
background: red; #calendar rect[class^="day_"]{
transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-webkit-transition: all .2s ease-in-out;
-ms-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
cursor: pointer;
}
#calendar rect[class^="day_"]:hover{
fill: #f09108 !important;
}
#calendar rect[class^="day_"]:hover + [class^="Textday_"]{
fill: #fff !important;
cursor: pointer;
pointer-events: none;
}
/* Liste des rendez-vous */
.RDV{
/* position */
display: inline-block;
position: relative;
width: calc( 100% - 2*1em - 10em );
margin-bottom: .5em;
padding: 2em 1em;
/* border */
border-radius: 3px;
border: 1px solid #c7c7c7;
/* background */
background: transparent;
/* animation */
transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-webkit-transition: all .2s ease-in-out;
-ms-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
/* extra */
cursor: pointer;
}
.RDV:hover{
border-color: #898989;
}
/* les champs */
.RDV > form:nth-child(1) > input{
/* position */
display: inline-block !important;
position: absolute !important;
margin: 0 !important;
padding: 0 !important;
padding-right: 2em !important;
/* border */
border: 0 !important;
/* foreground */
color: #6a6a6a;
/* event */
/*pointer-events: none;*/
}
.RDV:hover > span{
/* foreground */
color: #000;
}
/* JOUR */
.RDV > form:nth-child(1) > input.jour{
top: 1em;
}
/* HEURE */
.RDV > form:nth-child(1) > input.heure{
top: 3em;
}
/* DUREE */
.RDV > form:nth-child(1) > input.duree{
position: relative !important;
margin-left: 10em !important;
}
/* PATIENT */
.RDV > form:nth-child(1) > input.Patient{
margin-left: -10em !important;
top: 1em;
}
/* MEDECIN */
.RDV > form:nth-child(1) > input.Medecin{
margin-left: -10em !important;
top: 3em;
}
/* SUPPRESSION */
.RDV > form:nth-child(2){
display: inline-block;
position: absolute;
top: calc( 100% - .5em - 1.5em );
left: calc( 100% - 2em );
width: 2em;
height: 2em;
}
/* BOUTON SUPPRESSION */
.RDV > form > input[type=submit]{
/* position */
display: inline-block;
position: absolute;
left: calc( 100% - 4em );
top: -2em;
padding: .5em 1em !important;
/* border */
border: 0 !important;
/* background */
background-color: transparent !important;
background-image: url(../src/svg/invalid.svg) !important;
background-position: center center !important;
}
/* BOUTON MODIFICATION */
.RDV > form:nth-child(1) > input[type=submit]{
left: calc( 100% - 3em );
top: .5em;
background-image: url(../src/svg/edit.svg) !important;
} }

View File

@ -177,3 +177,12 @@ csMonth.addEventListener('keyup', function(e){
/* [3] Affinage du calendrier /* [3] Affinage du calendrier
======================================================*/ ======================================================*/
var dayCells = document.querySelectorAll('#calendar rect[class^="day_"]');
// pour chaque jour, on créé l'évènement
for( var i = 0 ; i < dayCells.length ; i++ ){
dayCells[i].addEventListener('click', function(e){
console.log( e.target );
}, false);
}

View File

@ -51,74 +51,95 @@ class RDV
} }
public function delete($params){ public function delete($params){
if(RDVRepo::delete($params['id_consultation']) !==FALSE){ if(RDVRepo::delete($params['id_consultation']) !== FALSE){
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){ $_status = 'success';
Response::quickResponse(200, json_encode([ $_title = 'Suppression effectuée!';
'status' => 'success', $_message = 'La consultation a bien été supprimée.';
'title' => 'Supression effectuée!',
'message' => 'La consultation a bien été supprimée.' 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{ else{
$response = new Response(); $response = new Response();
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=supression"); $response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
$response->send(); $response->send();
} }
}else{ }else{
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){ $_status = 'error';
Response::quickResponse(200, json_encode([ $_title = 'Erreur lors de la suppression!';
'status' => 'error', $_message = 'La suppression de la consultation a échoué!';
'title' => 'Erreur lors de la supression!'
])); if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
}else{ Response::quickResponse(200, json_encode([ 'status' => $_status, 'title' => $_title, 'message' => $_message ]));
else{
$response = new Response(); $response = new Response();
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error"); $response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
$response->send();
} }
} }
} }
public function update($params){ public function update($params){
if(StaticRepo::checkParam($params['date_naissance'],'Date')) { // si params ok
$params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']); var_dump($params['duree']);
if (RDVRepo::updateDateTime($params['id_consultation'], $params['date']->format('Y-m-d') . ' ' . $params['heure'] . ':00') !== FALSE) { if( StaticRepo::checkParam($params['id_consultation'], 'Numeric') && StaticRepo::checkParam($params['jour'], 'Date') && StaticRepo::checkParam($params['heure'], 'Heure') && StaticRepo::checkParam($params['Duree'], 'Heure') ){
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){ $params['date'] = DateTime::createFromFormat('d/m/Y H:i', $params['jour'].' '.$params['heure']);
$params['dureeTime'] = $params['duree'].':00';
var_dump($params['dureeTime']);
if (RDVRepo::updateDateTime($params['id_consultation'], $params['date']->format('Y-m-d H:i:00'), $params['dureeTime'] ) !== FALSE) {
$_status = 'success';
$_title = 'Modification effectuée!';
$_message = 'La consultation du '.$params['date']->format('d/m/Y').' à '.$params['heure'].'a bien été mise à jour.';
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 = new Response();
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=maj"); $response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
$response->send();
}else{
Response::quickResponse(200, json_encode([
'status' => 'success',
'title' => 'Modification effectuée!',
'message' => 'La consultation du '.$params['date']->format('d/m/Y').' à '.$params['heure'].'a bien été mis àjour.'
]));
} }
}else{ }else{
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){ $_status = 'error';
$_title = 'Erreur lors de la modifiction!';
$_message = 'La consultation n\'a pas pu être modifiée!';
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 = new Response();
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error"); $response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
$response->send();
}else{
Response::quickResponse(200, json_encode([
'status' => 'error',
'title' => 'Erreur de mise a jour!'
]));
} }
} }
}else{ }else{
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){ $_status = 'error';
$_title = 'Erreur de paramètre!';
$_message = 'Date Incorrecte!';
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 = new Response();
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error"); $response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
$response->send();
}else{
Response::quickResponse(200, json_encode([
'status' => 'error',
'title' => 'Erreur de paramètre',
'message' => 'Date incorrecte'
]));
} }
} }
} }
public function getConsultationsForMonth($month){
// conversion du mois
if( preg_match('/^(\d{2})\/(\d{4})$/', $month, $m) ){
$mois = $m[1]; $annee = $m[2];
}else{
$mois = '12'; $annee = '2015';
}
/* RECHERCHE REUSSIE */
if( ($rdvList=RDVRepo::getForMonth($mois, $annee)) !== FALSE ){
foreach($rdvList as $RDV){
var_dump($RDV);
}
}else{
echo "error";
}
}
public function getSVG($params){ public function getSVG($params){
// conversion du mois // conversion du mois
if( preg_match('/^(\d{2})\/(\d{4})$/', $params['mois'], $m) ) if( preg_match('/^(\d{2})\/(\d{4})$/', $params['mois'], $m) )
@ -138,7 +159,7 @@ class RDV
version='1.1' version='1.1'
width='80%' width='80%'
height='auto' height='auto'
viewbox='0 0 7700 6000' viewbox='0 0 7700 7000'
id='svg2'> id='svg2'>
<metadata <metadata
id='metadata7'> id='metadata7'>
@ -161,9 +182,8 @@ class RDV
$RDVTemp = RDVRepo::getByMonth($current); $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']))]))
$RDVs[date('j',strtotime($rdv['DateRDV']))] = []; $RDVs[date('j',strtotime($rdv['DateRDV']))] = [];
}
array_push($RDVs[date('j',strtotime($rdv['DateRDV']))],$rdv); array_push($RDVs[date('j',strtotime($rdv['DateRDV']))],$rdv);
} }
@ -180,38 +200,40 @@ class RDV
} }
//fond général + affichage de la date //fond général + affichage de la date
$svgCalendar .= '<g id="Day_' . $day . '"> $svgCalendar .= '<g class="Day_' . $day . '">
<!-- Case du jour -->
<rect <rect
width="7700" width="7700"
height="6000" height="7000"
x="0" x="0"
y="0" y="0"
id="backgroundDay_' . $day . '" class="backgroundDay_' . $day . '"
style="fill:#fff;fill-opacity:1;stroke:none" /> style="fill:#fff;fill-opacity:1;stroke:none" />
<!-- Numéro du jour -->
<text <text
x="300" x="300"
y="1000" y="1000"
id="TextDay_' . $day . '" class="TextDay_' . $day . '"
xml:space="preserve" xml:space="preserve"
style="font-size:750px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"> style="font-size:750px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee">
<tspan <tspan
x="300" x="300"
y="1000" y="1000"
id="TextSpanDay_' . $day . '">' . $day . ' class="TextSpanDay_' . $day . '">' . $day . '
</tspan> </tspan>
</text> </text>
<!-- Texte du jour -->
<text <text
x="' . $xDate . '" x="' . $xDate . '"
y="1000" y="1000"
id="TextMonthDay_' . $day . '" class="TextMonthDay_' . $day . '"
xml:space="preserve" xml:space="preserve"
style="font-size:400px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan style="font-size:400px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="' . $xDate . '" x="' . $xDate . '"
y="1000" y="1000"
id="TextSpanMonthDay_' . $day . '">' . $date . ' class="TextSpanMonthDay_' . $day . '">' . $date . '
</tspan> </tspan>
</text> </text>
'; ';
@ -232,7 +254,7 @@ class RDV
//du svg blablabla //du svg blablabla
$yConsult = 1500 + 700 * $key; $yConsult = 1500 + 700 * $key;
$svgCalendar .= '<g $svgCalendar .= '<g
id="ConsultationGroupDay' . $day . 'Consult' . $key . '" class="ConsultationGroupDay' . $day . 'Consult' . $key . '"
data-patient="' . $rdv['Patient_Id'] . '" data-patient="' . $rdv['Patient_Id'] . '"
data-medecin="' . $rdv['Medecin_id'] . '"> data-medecin="' . $rdv['Medecin_id'] . '">
<rect <rect
@ -240,17 +262,14 @@ class RDV
height="700" height="700"
x="300" x="300"
y="' . $yConsult . '" y="' . $yConsult . '"
id="ConsultationBackgroundDay' . $day . 'Consult' . $key . '" class="ConsultationBackgroundDay' . $day . 'Consult' . $key . '"
style="fill:#' . $color . ';fill-opacity:1;stroke:none" /> style="fill:#' . $color . ';fill-opacity:1;stroke:none" />
<text <text x="400" y="' . $yConsult . '"
x="400" class="ConsultationTextHourDay' . $day . 'Consult' . $key . '"
y="' . $yConsult . '"
id="ConsultationTextHourDay' . $day . 'Consult' . $key . '"
xml:space="preserve" xml:space="preserve"
style="font-size:400px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan style="font-size:400px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="400" x="400" y="' . ($yConsult + 500) . '"
y="' . ($yConsult + 500) . '" class="ConsultationTextSpanHourDay' . $day . 'Consult' . $key . '">' . date('G:i', strtotime($rdv['DateRDV'])) . '</tspan></text>
id="ConsultationTextSpanHourDay' . $day . 'Consult' . $key . '">' . date('G:i', strtotime($rdv['DateRDV'])) . '</tspan></text>
<g <g
id="g5136"> id="g5136">
<text <text
@ -312,13 +331,13 @@ class RDV
} }
//on met u fond (sinon on voit les consultation en arrière plan) //on met u fond (sinon on voit les consultation en arrière plan)
$svgCalendar .= '</g></g><g id="Calendar">'; $svgCalendar .= '</g></g><g class="Calendar">';
$svgCalendar.='<rect $svgCalendar.='<rect
width="7700" width="7700"
height="6000" height="6000"
x="0" x="0"
y="0" y="0"
id="BackgroundCalendar" class="BackgroundCalendar"
style="fill:#fff";fill-opacity:1;stroke:none" />'; style="fill:#fff";fill-opacity:1;stroke:none" />';
//position x;y de base des jours du calendrier //position x;y de base des jours du calendrier
@ -345,7 +364,7 @@ class RDV
ry="90" ry="90"
x="'.$x.'" x="'.$x.'"
y="'.$y.'" y="'.$y.'"
id="day_'.$days[$day].'" class="day_'.$days[$day].'"
style="fill:#'.$color.';fill-opacity:1;stroke:none" />'; style="fill:#'.$color.';fill-opacity:1;stroke:none" />';
}else{ }else{
if($days[$day] % 2 != 0){$color='f0f0f0';}else{$color='fff';} if($days[$day] % 2 != 0){$color='f0f0f0';}else{$color='fff';}
@ -355,18 +374,18 @@ class RDV
ry="90" ry="90"
x="'.$x.'" x="'.$x.'"
y="'.$y.'" y="'.$y.'"
id="day_'.$days[$day].'" class="day_'.$days[$day].'"
style="fill:#'.$color.';fill-opacity:1;stroke:none" />'; style="fill:#'.$color.';fill-opacity:1;stroke:none" />';
} }
$svgCalendar.='<text $svgCalendar.='<text
x="'.($x-700).'" x="'.($x-700).'"
y="'.(($y+1100)-700).'" y="'.(($y+1100)-700).'"
id="Textday_'.$days[$day].'" class="Textday_'.$days[$day].'"
xml:space="preserve" xml:space="preserve"
style="font-size:400px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan style="font-size:400px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="'.($x+260).'" x="'.($x+260).'"
y="'.($y+1100-470).'" y="'.($y+1100-470).'"
id="TextDay_'.$days[$day].'">'.$day_nbr.'</tspan></text>'; class="TextDay_'.$days[$day].'">'.$day_nbr.'</tspan></text>';
$x+=1100; $x+=1100;
if($days[$day] == 6){ if($days[$day] == 6){
$i=0; $i=0;

View File

@ -21,7 +21,7 @@
"delete":{"method": "delete", "delete":{"method": "delete",
"role": 0, "role": 0,
"strict": false}, "strict": false},
"updateDateTime":{"method": "update", "update":{"method": "update",
"role": 0, "role": 0,
"strict": false}, "strict": false},
"getSVG":{"method": "getSVG", "getSVG":{"method": "getSVG",

View File

@ -149,11 +149,11 @@ class StaticRepo{
break; break;
case 'Date': case 'Date':
$checker = $checker && !is_null($variable) && is_string($variable) && ( preg_match('/\d{2}\/\d{2}\/\d{4}/', $variable) || preg_match('/\d{4}-\d{2}-\d{2}/', $variable) ); $checker = $checker && !is_null($variable) && is_string($variable) && ( preg_match('/^\d{2}\/\d{2}\/\d{4}$/', $variable) || preg_match('/^\d{4}-\d{2}-\d{2}$/', $variable) );
break; break;
case 'Heure': case 'Heure':
$checker = $checker && !is_null($variable) && is_string($variable) && preg_match('/(\d+):(\d+)/is',$variable); $checker = $checker && !is_null($variable) && is_string($variable) && preg_match('/^\d{1,2}:\d{1,2}$/', $variable);
break; break;
// [N] Type inconnu // [N] Type inconnu

View File

@ -19,6 +19,18 @@ class RDVRepo
} }
public static function getForMonth($month, $year){
$req = StaticRepo::getConnexion()->prepare("SELECT RDV.Id, RDV.DateRDV, RDV.Duree, Medecin.Prenom as M_Prenom, Medecin.Nom as M_Nom, Patient.Prenom as P_Prenom, Patient.Nom as P_Nom
FROM RDV, Patient, Medecin
WHERE Patient.Id = RDV.Patient_Id
AND Medecin.Id = RDV.Medecin_Id
AND MONTH(DateRDV) = :month
AND YEAR(DateRDV) = :year
ORDER BY DateRDV ASC");
$req->execute(array( ':month' => $month, ':year' => $year ));
return $req->fetchAll();
}
public static function getByDate($date){ public static function getByDate($date){
if(!StaticRepo::checkParam($date,'Date')){return false;} if(!StaticRepo::checkParam($date,'Date')){return false;}
@ -31,7 +43,7 @@ class RDVRepo
public static function delete($idRDV){ public static function delete($idRDV){
if(!StaticRepo::checkParam($idRDV,'Integer')){return false;} if(!StaticRepo::checkParam($idRDV,'Numeric')){return false;}
$req = StaticRepo::getConnexion()->prepare('DELETE FROM RDV WHERE RDV.id = :id'); $req = StaticRepo::getConnexion()->prepare('DELETE FROM RDV WHERE RDV.id = :id');
return $req->execute(['id' => $idRDV]); return $req->execute(['id' => $idRDV]);
@ -56,14 +68,16 @@ class RDVRepo
else{return false;} else{return false;}
} }
public static function updateDateTime($idRDV,$dateTime){ public static function updateDateTime($idRDV, $dateRdv, $duree){
if(!StaticRepo::checkParam($idRDV,'Integer')){return false;} if(!StaticRepo::checkParam($idRDV, 'Numeric')){return false;}
$date = date('Y-m-d H:i:s',strtotime($dateTime)); $req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date_rdv, Duree = :duree WHERE id = :id');
$req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date WHERE id = :id'); return $req->execute([
return $req->execute(['date' => $date, ':date_rdv' => $dateRdv,
'id' => $idRDV]); ':duree' => $duree,
':id' => $idRDV
]);
} }
public static function getByPatientAndDate($idPatient,$date){ public static function getByPatientAndDate($idPatient,$date){