univ-pau-ics/build/router/controller/page.php

75 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace router\controller;
use \service\Config;
class page{
private $pagename;
/* PRE-CALL
*
* @url<String> Calling URI
*
*/
public function __construct($url){
$this->pagename = $url['page'];
}
/* CALL
*
*/
public function home(){
/* [1] Fetch configuration
=========================================================*/
/* (1) Get config */
try{
$config = Config::loadCached();
/* (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
=========================================================*/
echo "<table><thead><tr><td>Diplome</td><td>Link</td></tr></thead><tbody>";
foreach($diplomes as $id=>$name){
echo "<tr><td>$name</td>";
2017-09-12 17:19:03 +00:00
2017-09-12 17:20:34 +00:00
$link = $_SERVER['HTTP_HOST']."/ics/$id.ics";
2017-09-12 17:19:36 +00:00
if( file_exists(__ROOT__."/tmp/$id.ics") )
echo "<td><a href='/ics/$id.ics'>https://$link</a></td>";
echo "</tr>";
}
echo "</tbody></table>";
}
/* POST-CALL
*
*/
public function __destruct(){
}
}