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!';
$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>
@ -66,18 +71,27 @@ $managerMessage = (isset($_GET['message'])) ? $_GET['message'] : 'Erreur interne
<?php/********************************/
/* CONSULTER LES RENDEZ-VOUS */
/*************************************/?>
/*************************************/
?>
<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 -->
<input type='text' id='csMonth' name='mois' placeholder='12/2015'>Mois à afficher.<br>
<?php
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'>
<option value='*'>Tous les patients:</option>
<?php
foreach(PatientRepo::getAll() as $PATIENT)
echo "<option value='".$PATIENT['Id']."' data-medecin='".$PATIENT['MedecinTraitant']."'>".$PATIENT['Nom']." ".$PATIENT['Prenom']."</option>";
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>";
}
?>
</select>
@ -85,21 +99,56 @@ $managerMessage = (isset($_GET['message'])) ? $_GET['message'] : 'Erreur interne
<select id='csMedecin' name='id_medecin'>
<option value='*'>Tous les médecins:</option>
<?php
foreach(MedecinRepo::getAll() as $MEDECIN)
echo "<option value='".$MEDECIN['Id']."'>".$MEDECIN['Nom']." ".$MEDECIN['Prenom']."</option>";
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>";
}
?>
</select>
<input type='hidden' name='command' value='RDV:getSVG'>
<!-- <input type='hidden' name='command' value='RDV:getSVG'> -->
<input type='submit' value='Affiner'>
</form></div><br>
</form></div>
<!-- HERE COMES THE SVG -->
<div id='calendar'><?php
$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>
</article>

View File

@ -817,6 +817,144 @@ input[type=radio]:checked + label:before{
height: auto;
}
#Textday_3:hover{
background: red;
/* cases */
#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
======================================================*/
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,71 +51,92 @@ class RDV
}
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::quickResponse(200, json_encode([
'status' => 'success',
'title' => 'Supression effectuée!',
'message' => 'La consultation a bien été supprimée.'
]));
}else{
if(RDVRepo::delete($params['id_consultation']) !== FALSE){
$_status = 'success';
$_title = 'Suppression 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{
$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();
}
}
}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();
$_status = 'error';
$_title = 'Erreur lors de la suppression!';
$_message = 'La suppression de la consultation a échoué!';
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->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
}
}
}
public function update($params){
if(StaticRepo::checkParam($params['date_naissance'],'Date')) {
$params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']);
if (RDVRepo::updateDateTime($params['id_consultation'], $params['date']->format('Y-m-d') . ' ' . $params['heure'] . ':00') !== 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=maj");
$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{
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{
Response::quickResponse(200, json_encode([
'status' => 'error',
'title' => 'Erreur de mise a jour!'
]));
}
}
}else{
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
// si params ok
var_dump($params['duree']);
if( StaticRepo::checkParam($params['id_consultation'], 'Numeric') && StaticRepo::checkParam($params['jour'], 'Date') && StaticRepo::checkParam($params['heure'], 'Heure') && StaticRepo::checkParam($params['Duree'], 'Heure') ){
$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->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
$response->send();
}else{
Response::quickResponse(200, json_encode([
'status' => 'error',
'title' => 'Erreur de paramètre',
'message' => 'Date incorrecte'
]));
}
$response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
}
}else{
$_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->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
}
}
}else{
$_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->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
}
}
}
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";
}
}
@ -138,7 +159,7 @@ class RDV
version='1.1'
width='80%'
height='auto'
viewbox='0 0 7700 6000'
viewbox='0 0 7700 7000'
id='svg2'>
<metadata
id='metadata7'>
@ -161,9 +182,8 @@ class RDV
$RDVTemp = RDVRepo::getByMonth($current);
$RDVs = [];
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']))] = [];
}
array_push($RDVs[date('j',strtotime($rdv['DateRDV']))],$rdv);
}
@ -180,41 +200,43 @@ class RDV
}
//fond général + affichage de la date
$svgCalendar .= '<g id="Day_' . $day . '">
<rect
width="7700"
height="6000"
x="0"
y="0"
id="backgroundDay_' . $day . '"
style="fill:#fff;fill-opacity:1;stroke:none" />
<text
x="300"
y="1000"
id="TextDay_' . $day . '"
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">
<tspan
x="300"
y="1000"
id="TextSpanDay_' . $day . '">' . $day . '
</tspan>
</text>
<text
x="' . $xDate . '"
y="1000"
id="TextMonthDay_' . $day . '"
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
x="' . $xDate . '"
y="1000"
id="TextSpanMonthDay_' . $day . '">' . $date . '
</tspan>
</text>
';
$svgCalendar .= '<g class="Day_' . $day . '">
<!-- Case du jour -->
<rect
width="7700"
height="7000"
x="0"
y="0"
class="backgroundDay_' . $day . '"
style="fill:#fff;fill-opacity:1;stroke:none" />
<!-- Numéro du jour -->
<text
x="300"
y="1000"
class="TextDay_' . $day . '"
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">
<tspan
x="300"
y="1000"
class="TextSpanDay_' . $day . '">' . $day . '
</tspan>
</text>
<!-- Texte du jour -->
<text
x="' . $xDate . '"
y="1000"
class="TextMonthDay_' . $day . '"
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
x="' . $xDate . '"
y="1000"
class="TextSpanMonthDay_' . $day . '">' . $date . '
</tspan>
</text>
';
//on défini le tableau si jamais
if (!isset($RDVs[$day])) {
@ -232,93 +254,90 @@ class RDV
//du svg blablabla
$yConsult = 1500 + 700 * $key;
$svgCalendar .= '<g
id="ConsultationGroupDay' . $day . 'Consult' . $key . '"
data-patient="' . $rdv['Patient_Id'] . '"
data-medecin="' . $rdv['Medecin_id'] . '">
<rect
width="7000"
height="700"
x="300"
y="' . $yConsult . '"
id="ConsultationBackgroundDay' . $day . 'Consult' . $key . '"
style="fill:#' . $color . ';fill-opacity:1;stroke:none" />
<text
x="400"
y="' . $yConsult . '"
id="ConsultationTextHourDay' . $day . 'Consult' . $key . '"
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
x="400"
y="' . ($yConsult + 500) . '"
id="ConsultationTextSpanHourDay' . $day . 'Consult' . $key . '">' . date('G:i', strtotime($rdv['DateRDV'])) . '</tspan></text>
<g
id="g5136">
<text
x="6100"
y="' . ($yConsult + 500) . '"
id="text5084"
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:#999999;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="6100"
y="' . ($yConsult + 500) . '"
id="tspan5086">' . $rdv['Minute'] . 'mn</tspan></text>
<g
id="g5224">
<text
x="2500"
y="' . ($yConsult + 270) . '"
id="text5072"
xml:space="preserve"
style="font-size:250px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="2500"
y="' . ($yConsult + 270) . '"
id="tspan5074">' . $medecin['Prenom'] . '</tspan></text>
<text
x="3800"
y="' . ($yConsult + 270) . '"
id="text5186"
xml:space="preserve"
style="font-size:250px;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="3800"
y="' . ($yConsult + 270) . '"
id="tspan5188"
style="font-size:250;fill:#4d4d4d;fill-opacity:1">' . $medecin['Nom'] . '</tspan></text>
</g>
<g
id="g5230">
<text
x="2500"
y="' . ($yConsult + 600) . '"
id="text5080"
xml:space="preserve"
style="font-size:250px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="2500"
y="' . ($yConsult + 600) . '"
id="tspan5082">' . $patient['Prenom'] . '</tspan></text>
<text
x="3800"
y="' . ($yConsult + 600) . '"
id="text5194"
xml:space="preserve"
style="font-size:250px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="3800"
y="' . ($yConsult + 600) . '"
id="tspan5196">' . $patient['Nom'] . '</tspan></text>
</g>
</g>';
class="ConsultationGroupDay' . $day . 'Consult' . $key . '"
data-patient="' . $rdv['Patient_Id'] . '"
data-medecin="' . $rdv['Medecin_id'] . '">
<rect
width="7000"
height="700"
x="300"
y="' . $yConsult . '"
class="ConsultationBackgroundDay' . $day . 'Consult' . $key . '"
style="fill:#' . $color . ';fill-opacity:1;stroke:none" />
<text x="400" y="' . $yConsult . '"
class="ConsultationTextHourDay' . $day . 'Consult' . $key . '"
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
x="400" y="' . ($yConsult + 500) . '"
class="ConsultationTextSpanHourDay' . $day . 'Consult' . $key . '">' . date('G:i', strtotime($rdv['DateRDV'])) . '</tspan></text>
<g
id="g5136">
<text
x="6100"
y="' . ($yConsult + 500) . '"
id="text5084"
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:#999999;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="6100"
y="' . ($yConsult + 500) . '"
id="tspan5086">' . $rdv['Minute'] . 'mn</tspan></text>
<g
id="g5224">
<text
x="2500"
y="' . ($yConsult + 270) . '"
id="text5072"
xml:space="preserve"
style="font-size:250px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="2500"
y="' . ($yConsult + 270) . '"
id="tspan5074">' . $medecin['Prenom'] . '</tspan></text>
<text
x="3800"
y="' . ($yConsult + 270) . '"
id="text5186"
xml:space="preserve"
style="font-size:250px;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="3800"
y="' . ($yConsult + 270) . '"
id="tspan5188"
style="font-size:250;fill:#4d4d4d;fill-opacity:1">' . $medecin['Nom'] . '</tspan></text>
</g>
<g
id="g5230">
<text
x="2500"
y="' . ($yConsult + 600) . '"
id="text5080"
xml:space="preserve"
style="font-size:250px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="2500"
y="' . ($yConsult + 600) . '"
id="tspan5082">' . $patient['Prenom'] . '</tspan></text>
<text
x="3800"
y="' . ($yConsult + 600) . '"
id="text5194"
xml:space="preserve"
style="font-size:250px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;font-family:Sawasdee;-inkscape-font-specification:Sawasdee"><tspan
x="3800"
y="' . ($yConsult + 600) . '"
id="tspan5196">' . $patient['Nom'] . '</tspan></text>
</g>
</g>';
}
$svgCalendar .= '</g></g>';
}
//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
width="7700"
height="6000"
x="0"
y="0"
id="BackgroundCalendar"
class="BackgroundCalendar"
style="fill:#fff";fill-opacity:1;stroke:none" />';
//position x;y de base des jours du calendrier
@ -345,7 +364,7 @@ class RDV
ry="90"
x="'.$x.'"
y="'.$y.'"
id="day_'.$days[$day].'"
class="day_'.$days[$day].'"
style="fill:#'.$color.';fill-opacity:1;stroke:none" />';
}else{
if($days[$day] % 2 != 0){$color='f0f0f0';}else{$color='fff';}
@ -355,18 +374,18 @@ class RDV
ry="90"
x="'.$x.'"
y="'.$y.'"
id="day_'.$days[$day].'"
class="day_'.$days[$day].'"
style="fill:#'.$color.';fill-opacity:1;stroke:none" />';
}
$svgCalendar.='<text
x="'.($x-700).'"
y="'.(($y+1100)-700).'"
id="Textday_'.$days[$day].'"
class="Textday_'.$days[$day].'"
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
x="'.($x+260).'"
y="'.($y+1100-470).'"
id="TextDay_'.$days[$day].'">'.$day_nbr.'</tspan></text>';
class="TextDay_'.$days[$day].'">'.$day_nbr.'</tspan></text>';
$x+=1100;
if($days[$day] == 6){
$i=0;

View File

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

View File

@ -149,11 +149,11 @@ class StaticRepo{
break;
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;
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;
// [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){
if(!StaticRepo::checkParam($date,'Date')){return false;}
@ -31,7 +43,7 @@ class RDVRepo
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');
return $req->execute(['id' => $idRDV]);
@ -56,14 +68,16 @@ class RDVRepo
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 WHERE id = :id');
return $req->execute(['date' => $date,
'id' => $idRDV]);
$req = StaticRepo::getConnexion()->prepare('UPDATE RDV SET DateRDV = :date_rdv, Duree = :duree WHERE id = :id');
return $req->execute([
':date_rdv' => $dateRdv,
':duree' => $duree,
':id' => $idRDV
]);
}
public static function getByPatientAndDate($idPatient,$date){

View File

@ -17,4 +17,4 @@ $rdv = new RDV();
echo $rdv->getSVG(['mois' => '10/2015']);
?>
</body>
</html>
</html>