2015-12-10 09:47:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: seekdasky
|
|
|
|
* Date: 10/12/15
|
|
|
|
* Time: 09:52
|
|
|
|
*/
|
|
|
|
class RDV
|
|
|
|
{
|
|
|
|
public function add($params){
|
2015-12-17 08:53:09 +00:00
|
|
|
if(StaticRepo::checkParam($params['date'],'Date')) {
|
2015-12-15 08:24:20 +00:00
|
|
|
$params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']);
|
|
|
|
if (RDVRepo::add($params['date']->format('Y-m-d') . ' ' . $params['heure'] . ':00', $params['duree'], $params['id_patient'], $params['id_medecin']) !== FALSE) {
|
2015-12-17 08:53:09 +00:00
|
|
|
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
2015-12-15 08:24:20 +00:00
|
|
|
Response::quickResponse(200, json_encode([
|
|
|
|
'status' => 'success',
|
|
|
|
'title' => 'Création effectuée!',
|
|
|
|
'message' => 'La consultation du '.$params['date']->format('d/m/Y').' à '.$params['heure'].' a bien été créée.'
|
|
|
|
]));
|
2015-12-17 08:53:09 +00:00
|
|
|
}else{
|
2015-12-15 08:24:20 +00:00
|
|
|
$response = new Response();
|
2015-12-17 08:53:09 +00:00
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=creation");
|
2015-12-15 08:24:20 +00:00
|
|
|
$response->send();
|
2015-12-17 08:53:09 +00:00
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
2015-12-15 08:24:20 +00:00
|
|
|
Response::quickResponse(200, json_encode([
|
|
|
|
'status' => 'error',
|
|
|
|
'title' => 'Erreur de création!'
|
|
|
|
]));
|
2015-12-17 08:53:09 +00:00
|
|
|
}else{
|
|
|
|
$response->send();
|
|
|
|
$response = new Response();
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
2015-12-15 08:24:20 +00:00
|
|
|
}
|
|
|
|
}
|
2015-12-10 09:47:30 +00:00
|
|
|
}else{
|
2015-12-17 08:53:09 +00:00
|
|
|
if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ){
|
2015-12-15 08:24:20 +00:00
|
|
|
Response::quickResponse(200, json_encode([
|
|
|
|
'status' => 'error',
|
|
|
|
'title' => 'Erreur de paramètre',
|
|
|
|
'message' => 'Date incorrecte'
|
|
|
|
]));
|
2015-12-17 08:53:09 +00:00
|
|
|
}else{
|
|
|
|
$response = new Response();
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultations.php?type=error");
|
|
|
|
$response->send();
|
2015-12-15 08:24:20 +00:00
|
|
|
}
|
2015-12-10 09:47:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete($params){
|
2016-01-03 15:01:38 +00:00
|
|
|
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{
|
2015-12-15 08:24:20 +00:00
|
|
|
$response = new Response();
|
2016-01-03 15:01:38 +00:00
|
|
|
$response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
|
2015-12-15 08:24:20 +00:00
|
|
|
$response->send();
|
2016-01-03 15:01:38 +00:00
|
|
|
}
|
2015-12-17 08:53:09 +00:00
|
|
|
}else{
|
2016-01-03 15:01:38 +00:00
|
|
|
$_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);
|
2015-12-15 08:24:20 +00:00
|
|
|
}
|
2015-12-10 09:47:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function update($params){
|
2016-01-03 15:01:38 +00:00
|
|
|
// si params ok
|
|
|
|
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']);
|
2016-01-03 15:10:48 +00:00
|
|
|
$params['dureeTime'] = $params['Duree'].':00';
|
|
|
|
// var_dump($params['dureeTime']);
|
2016-01-03 15:01:38 +00:00
|
|
|
if (RDVRepo::updateDateTime($params['id_consultation'], $params['date']->format('Y-m-d H:i:00'), $params['dureeTime'] ) !== FALSE) {
|
|
|
|
$_status = 'success';
|
|
|
|
$_title = 'Modification effectuée!';
|
2016-01-03 15:10:48 +00:00
|
|
|
$_message = 'La consultation du '.$params['date']->format('d/m/Y').' à '.$params['heure'].' a bien été mise à jour.';
|
2016-01-03 15:01:38 +00:00
|
|
|
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{
|
2015-12-15 08:24:20 +00:00
|
|
|
$response = new Response();
|
2016-01-03 15:01:38 +00:00
|
|
|
$response->setHeader('Location', 'http://'.$_SERVER['HTTP_HOST'].'/Consultations.php?status='.$_status.'&title='.$_title.'&message='.$_message);
|
2016-01-03 15:10:48 +00:00
|
|
|
$response->send();
|
2016-01-03 15:01:38 +00:00
|
|
|
}
|
|
|
|
}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);
|
2016-01-03 15:10:48 +00:00
|
|
|
$response->send();
|
2016-01-03 15:01:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}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);
|
2016-01-03 15:10:48 +00:00
|
|
|
$response->send();
|
2016-01-03 15:01:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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";
|
2015-12-10 09:47:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-17 07:56:42 +00:00
|
|
|
public function getSVG($params){
|
2015-12-26 17:21:44 +00:00
|
|
|
// 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>
|
2015-12-26 12:22:06 +00:00
|
|
|
$days = ['Mon'=>0,'Tue'=>1,'Wed'=>2,'Thu'=>3,'Fri'=>4,'Sat'=>5,'Sun'=>6];
|
2015-12-26 17:21:44 +00:00
|
|
|
$svgCalendar = "<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
|
|
|
<!-- Created with PHP Maggle !!LAUUUULEU!! -->
|
2015-12-17 07:56:42 +00:00
|
|
|
|
2015-12-26 12:22:06 +00:00
|
|
|
<svg
|
2015-12-26 17:21:44 +00:00
|
|
|
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'
|
2016-01-03 15:01:38 +00:00
|
|
|
viewbox='0 0 7700 7000'
|
2015-12-26 17:21:44 +00:00
|
|
|
id='svg2'>
|
2015-12-26 12:22:06 +00:00
|
|
|
<metadata
|
2015-12-26 17:21:44 +00:00
|
|
|
id='metadata7'>
|
2015-12-26 12:22:06 +00:00
|
|
|
<rdf:RDF>
|
|
|
|
<cc:Work
|
2015-12-26 17:21:44 +00:00
|
|
|
rdf:about='>
|
2015-12-26 12:22:06 +00:00
|
|
|
<dc:format>image/svg+xml</dc:format>
|
|
|
|
<dc:type
|
2015-12-26 17:21:44 +00:00
|
|
|
rdf:resource='http://purl.org/dc/dcmitype/StillImage' />
|
2015-12-26 12:22:06 +00:00
|
|
|
<dc:title>Calendar</dc:title>
|
|
|
|
</cc:Work>
|
|
|
|
</rdf:RDF>
|
|
|
|
</metadata>
|
|
|
|
";
|
|
|
|
|
2015-12-26 17:21:44 +00:00
|
|
|
$current = strtotime($mois);
|
2015-12-26 12:22:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
//on range les rendez-vous dans un tableau avec leur jour comme clé
|
2015-12-26 17:21:44 +00:00
|
|
|
$RDVTemp = RDVRepo::getByMonth($current);
|
2015-12-26 12:22:06 +00:00
|
|
|
$RDVs = [];
|
|
|
|
foreach($RDVTemp as $rdv){
|
2016-01-03 15:01:38 +00:00
|
|
|
if(!isset($RDVs[date('j',strtotime($rdv['DateRDV']))]))
|
2015-12-26 12:22:06 +00:00
|
|
|
$RDVs[date('j',strtotime($rdv['DateRDV']))] = [];
|
|
|
|
|
|
|
|
array_push($RDVs[date('j',strtotime($rdv['DateRDV']))],$rdv);
|
|
|
|
}
|
|
|
|
foreach(range(1,date('t',strtotime($params['mois']))) as $day) {
|
|
|
|
|
|
|
|
//génération du SVG de la journée
|
|
|
|
|
|
|
|
//selon si on a une date sur un ou deux chiffres, on adapte
|
|
|
|
$date = strftime("%B %Y", $current);
|
|
|
|
if ($day >= 10) {
|
|
|
|
$xDate = 1500;
|
|
|
|
} else {
|
|
|
|
$xDate = 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
//fond général + affichage de la date
|
2016-01-03 15:01:38 +00:00
|
|
|
$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>
|
|
|
|
';
|
2015-12-26 12:22:06 +00:00
|
|
|
|
|
|
|
//on défini le tableau si jamais
|
|
|
|
if (!isset($RDVs[$day])) {
|
|
|
|
$RDVs[$day] = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
//on parcours les consultations du jour pour les afficher
|
|
|
|
foreach ($RDVs[$day] as $key => $rdv) {
|
|
|
|
$patient = PatientRepo::getById(intval($rdv['Patient_Id']));
|
|
|
|
$medecin = MedecinRepo::getById(intval($rdv['Medecin_id']));
|
|
|
|
|
|
|
|
//couleur suivant le nombre de consultation
|
2015-12-26 17:21:44 +00:00
|
|
|
$color = ($key%2==0) ? 'f9f9f9' : 'ececec';
|
2015-12-26 12:22:06 +00:00
|
|
|
|
|
|
|
//du svg blablabla
|
|
|
|
$yConsult = 1500 + 700 * $key;
|
|
|
|
$svgCalendar .= '<g
|
2016-01-03 15:01:38 +00:00
|
|
|
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>';
|
2015-12-26 12:22:06 +00:00
|
|
|
}
|
|
|
|
$svgCalendar .= '</g></g>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//on met u fond (sinon on voit les consultation en arrière plan)
|
2016-01-03 15:01:38 +00:00
|
|
|
$svgCalendar .= '</g></g><g class="Calendar">';
|
2015-12-26 12:22:06 +00:00
|
|
|
$svgCalendar.='<rect
|
|
|
|
width="7700"
|
|
|
|
height="6000"
|
|
|
|
x="0"
|
|
|
|
y="0"
|
2016-01-03 15:01:38 +00:00
|
|
|
class="BackgroundCalendar"
|
2015-12-26 12:22:06 +00:00
|
|
|
style="fill:#fff";fill-opacity:1;stroke:none" />';
|
|
|
|
|
|
|
|
//position x;y de base des jours du calendrier
|
|
|
|
$x=1100*$days[date('D',$current)];
|
|
|
|
$y=0;
|
|
|
|
|
|
|
|
//initialisation de variables
|
|
|
|
$cal = [];
|
|
|
|
$week=[];
|
|
|
|
|
|
|
|
|
|
|
|
//obligé de séparer la génération des consultation et du calendrier pour organiser le svg
|
|
|
|
foreach(range(1,date('t',strtotime($params['mois']))) as $day){
|
|
|
|
//génération du svg du calendrier
|
|
|
|
$day = date('D',$current);
|
|
|
|
$day_nbr = date('d',$current);
|
|
|
|
$week[$days[$day]] = date('d',$current);
|
|
|
|
$current = strtotime("+1 day",$current);
|
|
|
|
if($y/1100 % 2 == 0){
|
|
|
|
if($days[$day] % 2 == 0){$color='f0f0f0';}else{$color='fff';}
|
|
|
|
$svgCalendar.='<rect
|
|
|
|
width="1000"
|
|
|
|
height="1000"
|
|
|
|
ry="90"
|
|
|
|
x="'.$x.'"
|
|
|
|
y="'.$y.'"
|
2016-01-03 15:01:38 +00:00
|
|
|
class="day_'.$days[$day].'"
|
2015-12-26 12:22:06 +00:00
|
|
|
style="fill:#'.$color.';fill-opacity:1;stroke:none" />';
|
|
|
|
}else{
|
|
|
|
if($days[$day] % 2 != 0){$color='f0f0f0';}else{$color='fff';}
|
|
|
|
$svgCalendar.='<rect
|
|
|
|
width="1000"
|
|
|
|
height="1000"
|
|
|
|
ry="90"
|
|
|
|
x="'.$x.'"
|
|
|
|
y="'.$y.'"
|
2016-01-03 15:01:38 +00:00
|
|
|
class="day_'.$days[$day].'"
|
2015-12-26 12:22:06 +00:00
|
|
|
style="fill:#'.$color.';fill-opacity:1;stroke:none" />';
|
|
|
|
}
|
|
|
|
$svgCalendar.='<text
|
|
|
|
x="'.($x-700).'"
|
|
|
|
y="'.(($y+1100)-700).'"
|
2016-01-03 15:01:38 +00:00
|
|
|
class="Textday_'.$days[$day].'"
|
2015-12-26 12:22:06 +00:00
|
|
|
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).'"
|
2016-01-03 15:01:38 +00:00
|
|
|
class="TextDay_'.$days[$day].'">'.$day_nbr.'</tspan></text>';
|
2015-12-26 12:22:06 +00:00
|
|
|
$x+=1100;
|
|
|
|
if($days[$day] == 6){
|
|
|
|
$i=0;
|
|
|
|
array_push($cal,$week);
|
|
|
|
$week = [];
|
|
|
|
$y+=1100;
|
|
|
|
$x=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$svgCalendar .= '</g>';
|
2015-12-26 17:21:44 +00:00
|
|
|
echo $svgCalendar;
|
2015-12-17 07:56:42 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 09:47:30 +00:00
|
|
|
}
|