Commit 10d1bbf3 authored by Stephane Crozat's avatar Stephane Crozat

Ajout trombinoscope

parent 86ea0c64
<?php
if (!isset($_GET['api'])) {
header('Location:index.php');
}
else {
session_start();
include 'lib/cas_connect.php';
include 'lib/db.php';
include 'lib/views.php';
include 'lib/admin.php';
$db = new DB();
$admin = new Admin($db);
$view = new Views($admin, $_SESSION['utclogin'], $_SESSION['surname'], $_SESSION['firstname']);
$view->printHtmlBegin($admin);
$view->printUser($db->isResp($_SESSION['utclogin']), $db->isAdmin($_SESSION['utclogin']));
$view->apiStudents($db->apiStudents($_SESSION['utclogin'],$_GET['api']));
}
?>
......@@ -203,5 +203,26 @@ class DB {
}
}
public function apiStudents($utclogin, $api) {
if ($this->isAdmin($utclogin)) {
$sql = 'SELECT *
FROM vsubscription
WHERE id=:api AND resplogin=:utclogin
ORDER BY surname, firstname' ; //TODO
}
else {
$sql = 'SELECT *
FROM vsubscription
WHERE id=:api AND resplogin=:utclogin
ORDER BY surname, firstname';
}
$st = $this->conn->prepare($sql);
$st->bindValue(':api',$api,PDO::PARAM_STR);
$st->bindValue(':utclogin',$utclogin,PDO::PARAM_STR);
$st->execute();
$res = $st->fetchAll(PDO::FETCH_ASSOC);
return $res;
}
}
......@@ -150,7 +150,7 @@ class Views {
if ($api != $sub['id']) {
$api = $sub['id'];
echo '<hr/>';
echo '<h2>'.$this->printApi($sub).'</h2>';
echo '<h2>'.$this->printApi($sub)." <a href='api.php?api=$api'>*</a></h2>";
}
if ($sub['utclogin']) {
if ($sub['validation']) {
......@@ -176,6 +176,26 @@ class Views {
}
}
public function apiStudents($students) {
echo "<hr/>";
foreach ($students as $s) {
echo "<div class='student'>
<img src='https://demeter.utc.fr/portal/pls/portal30/portal30.get_photo_utilisateur?username=$s[utclogin]'
height='100px'
width='100px'/>
<span class='name'>$s[surname] $s[firstname] | $s[level] <a href='mailto:$s[email]'>[mail]</a> ($s[utclogin])</span>
</div>";
}
}
public function apiStudentsCsv($students) {
//TODO
foreach ($students as $s) {
echo "$s[surname];$s[firstname];$s[level];$s[email];$s[utclogin]\n";
}
}
public function adminFunction ($utclogin) {
echo "<p>Je dois vérifier que $utclogin a vraiment des super-pouvoirs...</p>";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment