From 47c90d8737ba694a99104d562ff0832a8e562e15 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 17 May 2018 15:16:30 +0200 Subject: [PATCH] add dedicated page 'fiche' for teachers only (not 'cas_admin') + router management + add logout btn --- build/router/controller/page.php | 32 +++++++++++++++++++++++++---- public_html/page/fiche.php | 35 ++++++++++++++++++++++++++++++++ public_html/page/home.php | 21 +------------------ 3 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 public_html/page/fiche.php diff --git a/build/router/controller/page.php b/build/router/controller/page.php index e1294af..3abe07e 100644 --- a/build/router/controller/page.php +++ b/build/router/controller/page.php @@ -33,19 +33,43 @@ } + /* (2) Only teacher */ + if( !in_array('cas_admin', $_SESSION['AUTH']) ){ + + // redirection + if( $this->pagename != "fiche" ){ + header('Location: /fiche/'); + die(); + } + + // deconnection + if( $this->uri == 'logout' || $this->uri == 'logout/' ){ + + \session_destroy(); + header('Location: /'); + die(); + + } + + // load page + include __PUBLIC__."/page/fiche.php"; + die(); + + } - /* (1) Build page file name */ + + /* (3) Build page file name */ $page_fname = __PUBLIC__."/page/".$this->pagename.".php"; - /* (2) If page does not exist -> 404 */ + /* (4) If page does not exist -> 404 */ if( !file_exists($page_fname) ) include __PUBLIC__.'/page/404.php'; - /* (3) Set URI arguments */ + /* (5) Set URI arguments */ $_GET['uri'] = explode('/', $this->uri); - /* (4) Load page */ + /* (6) Load page */ include __PUBLIC__."/page/".$this->pagename.".php"; } diff --git a/public_html/page/fiche.php b/public_html/page/fiche.php new file mode 100644 index 0000000..23a32a6 --- /dev/null +++ b/public_html/page/fiche.php @@ -0,0 +1,35 @@ + + + + + + + + + + Espace enseignant + + + + + + + + + + +
+ + +
+
+
Plateforme Assistée de Traitement Administratif des Taches d'Enseignement
+ "> + +
+ + +
+ + + \ No newline at end of file diff --git a/public_html/page/home.php b/public_html/page/home.php index 78f2a89..fbc8c56 100644 --- a/public_html/page/home.php +++ b/public_html/page/home.php @@ -7,9 +7,8 @@ - PTUT web title + Connexion - @@ -47,23 +46,5 @@ - - - - - -
- - -
-
-
Plateforme Assistée de Traitement Administratif des Taches d'Enseignement
- " class="downloadButton">Télécharger ma fiche -
- - -
- - \ No newline at end of file