2017-09-12 16:32:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace router\controller;
|
|
|
|
|
|
|
|
|
|
|
|
class ics{
|
|
|
|
|
|
|
|
|
|
|
|
private $diplome_id;
|
|
|
|
|
|
|
|
/* PRE-CALL
|
|
|
|
*
|
|
|
|
* @url<String> 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');
|
2017-09-12 17:11:39 +00:00
|
|
|
header('Content-Disposition: attachment; filename='.$this->diplome_id.'.ics');
|
2017-09-12 16:32:01 +00:00
|
|
|
|
|
|
|
/* (2) Body */
|
|
|
|
readfile($file_name);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* POST-CALL
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function __destruct(){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|