2017-09-12 16:32:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace router\controller;
|
|
|
|
use \service\Config;
|
|
|
|
|
|
|
|
|
|
|
|
class page{
|
|
|
|
|
|
|
|
|
|
|
|
/* PRE-CALL
|
|
|
|
*
|
|
|
|
* @url<String> Calling URI
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function __construct($url){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* CALL
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function home(){
|
|
|
|
|
|
|
|
|
|
|
|
/* [1] Fetch configuration
|
|
|
|
=========================================================*/
|
|
|
|
/* (1) Get config */
|
|
|
|
try{
|
2017-09-12 19:35:45 +00:00
|
|
|
$config = Config::loadCached();
|
2017-09-12 16:32:01 +00:00
|
|
|
|
|
|
|
/* (2) Error management */
|
|
|
|
}catch(\Exception $e){
|
|
|
|
die("An error occured. Please contact the developers.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* (3) Get the diplome list */
|
|
|
|
$diplomes = $config->getDiplomes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [2] Display the links
|
|
|
|
=========================================================*/
|
2017-09-14 17:56:24 +00:00
|
|
|
echo "<table><thead><tr><td>Diplome</td><td>Config</td><td>Link</td><td>Last Update</td></tr></thead><tbody>";
|
2017-09-12 19:35:45 +00:00
|
|
|
|
2017-09-14 17:56:24 +00:00
|
|
|
foreach($diplomes as $id=>$data){
|
2017-09-12 16:38:46 +00:00
|
|
|
|
2017-09-14 17:56:24 +00:00
|
|
|
$name = $data[0];
|
|
|
|
$upda = $data[1];
|
2017-09-12 16:38:46 +00:00
|
|
|
|
2017-09-12 19:35:45 +00:00
|
|
|
echo "<tr><td>$name</td>";
|
2017-09-12 17:19:03 +00:00
|
|
|
|
2017-09-13 13:48:56 +00:00
|
|
|
$URI = $_SERVER['REQUEST_URI'];
|
2017-09-14 17:56:24 +00:00
|
|
|
$url = $_SERVER['HTTP_HOST'].$URI."ics/$id.ics";
|
|
|
|
$link = __ROOT__."/tmp/$id.ics";
|
|
|
|
echo "<td><a href='/info/$id'>Correct</a></td>";
|
2017-09-13 13:03:36 +00:00
|
|
|
echo "<td><a";
|
2017-09-14 17:56:24 +00:00
|
|
|
if( file_exists($link) )
|
|
|
|
echo " href='/ics/$id.ics'";
|
2017-09-12 16:32:01 +00:00
|
|
|
|
2017-09-14 17:56:24 +00:00
|
|
|
echo ">https://$url</a></td>";
|
|
|
|
echo "<td>$upda</td>";
|
2017-09-12 19:35:45 +00:00
|
|
|
echo "</tr>";
|
2017-09-12 16:32:01 +00:00
|
|
|
}
|
|
|
|
|
2017-09-12 19:35:45 +00:00
|
|
|
echo "</tbody></table>";
|
|
|
|
|
2017-09-12 16:32:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* POST-CALL
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function __destruct(){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|