49 lines
1.9 KiB
PHP
Executable File
49 lines
1.9 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: seekdasky
|
|
* Date: 10/12/15
|
|
* Time: 09:52
|
|
*/
|
|
class RDV
|
|
{
|
|
public function add($params){
|
|
$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){
|
|
$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){
|
|
$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){
|
|
$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();
|
|
}
|
|
}
|
|
|
|
} |