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-10 10:12:44 +00:00
|
|
|
$params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']);
|
2015-12-10 09:47:30 +00:00
|
|
|
if(RDVRepo::add($params['date']->format('Y-m-d').' '.$params['heure'].':00',$params['duree'],$params['id_patient'],$params['id_medecin']) !==FALSE){
|
|
|
|
$response = new Response();
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=creation");
|
|
|
|
$response->send();
|
|
|
|
}else{
|
|
|
|
$response = new Response(500);
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=error");
|
|
|
|
$response->send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete($params){
|
|
|
|
if(RDVRepo::delete($params['id_consultation']) !==FALSE){
|
|
|
|
$response = new Response();
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=supression");
|
|
|
|
$response->send();
|
|
|
|
}else{
|
|
|
|
$response = new Response(500);
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=error");
|
|
|
|
$response->send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function update($params){
|
2015-12-10 10:12:44 +00:00
|
|
|
$params['date'] = DateTime::createFromFormat('d/m/Y', $params['date']);
|
2015-12-10 09:47:30 +00:00
|
|
|
if(RDVRepo::updateDateTime($params['id_consultation'],$params['date']->format('Y-m-d').' '.$params['heure'].':00') !==FALSE){
|
|
|
|
$response = new Response();
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=maj");
|
|
|
|
$response->send();
|
|
|
|
}else{
|
|
|
|
$response = new Response(500);
|
|
|
|
$response->setHeader('Location',"http://".$_SERVER['HTTP_HOST']."/Consultation.php?type=error");
|
|
|
|
$response->send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|