add dedicated page 'fiche' for teachers only (not 'cas_admin') + router management + add logout btn

This commit is contained in:
Adrien Marquès 2018-05-17 15:16:30 +02:00
parent 1bfd97009e
commit 47c90d8737
3 changed files with 64 additions and 24 deletions

View File

@ -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"; $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) ) if( !file_exists($page_fname) )
include __PUBLIC__.'/page/404.php'; include __PUBLIC__.'/page/404.php';
/* (3) Set URI arguments */ /* (5) Set URI arguments */
$_GET['uri'] = explode('/', $this->uri); $_GET['uri'] = explode('/', $this->uri);
/* (4) Load page */ /* (6) Load page */
include __PUBLIC__."/page/".$this->pagename.".php"; include __PUBLIC__."/page/".$this->pagename.".php";
} }

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=.6">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Espace enseignant</title>
<!-- Icon -->
<link rel='shortcut icon' href='/favicon.ico'>
<!-- CSS dependencies -->
<link href="https://fonts.googleapis.com/css?family=Fira+Sans" rel="stylesheet">
<link rel='stylesheet' type='text/css' href='/css/layout.css'>
<body>
<div id="WRAPPER" class='login'>
<div id='LOGIN_REDIRECT'>
<div class='icon'></div>
<div class='title'><b>P</b><i>lateforme</i> <b>A</b><i>ssistée de</i> <b>T</b><i>raitement</i> <b>A</b><i>dministratif des</i> <b>T</b><i>aches d'</i><b>E</b><i>nseignement</i></div>
<a href="/api/v/1.0/professor/pdf/<?php echo $_SESSION['CAS']["id"]; ?>"><button style='font-weight: normal; margin-bottom: 1em;'>Télécharger ma fiche</button></a>
<a href="/fiche/logout"><button style='font-weight: normal'>Me déconnecter</button></a>
</div>
</div>
</body>
</html>

View File

@ -7,9 +7,8 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PTUT web title</title> <title>Connexion</title>
<?php if(in_array('cas_admin', $_SESSION['AUTH'])) { ?>
<!-- Icon --> <!-- Icon -->
<link rel='shortcut icon' href='/favicon.ico'> <link rel='shortcut icon' href='/favicon.ico'>
@ -47,23 +46,5 @@
<!-- Main loop --> <!-- Main loop -->
<script type='text/javascript' src='/js/bundle@home.js' onload="document.body.className=''"></script> <script type='text/javascript' src='/js/bundle@home.js' onload="document.body.className=''"></script>
</body> </body>
<?php }else{?>
<link rel='stylesheet' type='text/css' href='/css/layout.css'>
</head>
<body>
<div id="WRAPPER" class='login'>
<div id='LOGIN_REDIRECT'>
<div class='icon'></div>
<div class='title'><b>P</b><i>lateforme</i> <b>A</b><i>ssistée de</i> <b>T</b><i>raitement</i> <b>A</b><i>dministratif des</i> <b>T</b><i>aches d'</i><b>E</b><i>nseignement</i></div>
<a href="/api/v/1.0/professor/pdf/<?php echo $_SESSION['CAS']["id"]; ?>" class="downloadButton">Télécharger ma fiche</a>
</div>
</div>
</body>
<?php } ?>
</html> </html>