Calling URI
*
*/
public function __construct($url){
$this->diplome_id = $url['diplome_id'];
}
/* CALL
*
*/
public function download(){
/* [1] Check .ics file
=========================================================*/
/* (1) Set file name */
$file_name = __ROOT__."/tmp/".$this->diplome_id.".ics";
/* (2) Check if exists */
if( !file_exists($file_name) )
die("An error occured. Please contact the developers.\n");
/* [2] Display file
=========================================================*/
/* (1) Headers */
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename='.$this->diplome_id.'.ics');
/* (2) Body */
readfile($file_name);
}
public function info(){
/* [1] Get database colors
=========================================================*/
/* (1) Open instance */
try{
$ldb = new lightdb('config');
}catch(\Exception $e){
die("An error occured. Please contact the developers.\n");
}
/* (2) Fetch diplome data */
$d_cols = $ldb->fetch($this->diplome_id);
/* (3) Error */
if( $d_cols == false )
die("No color found for this diplome");
foreach($d_cols as $col=>$name){
echo "PLANNING COLOR => ";
if( $col == $name )
echo "no name
";
else
echo "$name
";
}
}
/* POST-CALL
*
*/
public function __destruct(){
}
}