Initial commit
62
admin.php
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
if ($_SESSION['status'] != "a"){
|
||||||
|
http_response_code(403);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = $_SESSION['config'];
|
||||||
|
include 'functions.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><?php echo $config->title?></title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||||
|
<style>
|
||||||
|
table td, table th {
|
||||||
|
width: 700px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
<?php nav($config);?>
|
||||||
|
</nav>
|
||||||
|
<h1>Admin</h1>
|
||||||
|
<table>
|
||||||
|
<tr><th>Active Sessions</th></tr>
|
||||||
|
<?php
|
||||||
|
foreach (array_slice(scandir(ini_get("session.save_path")), 2) as $session_name) {
|
||||||
|
echo "<tr><td>" . $session_name . "</td></tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<table style="width: 60%">
|
||||||
|
<tr><th>Logs</th></tr>
|
||||||
|
<?php
|
||||||
|
$logs = file($config->log_dir . "/notehub.log", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
|
$logs_lines = array_slice($logs, -10);
|
||||||
|
for (end($logs_lines); key($logs_lines)!==null; prev($logs_lines)) {
|
||||||
|
echo "<tr><td>" . current($logs_lines) . "</td></tr>";
|
||||||
|
};
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<footer><?php footer()?></footer>
|
||||||
|
</body>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<script>colormode(<?php echo $_SESSION['colormode']?>)</script>
|
||||||
|
</html>
|
18
colormode.php
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if (!isset($_SESSION['colormode']) || !isset($_GET['source'])) {
|
||||||
|
http_response_code(403);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
if (!isset($_GET['mode'])) {
|
||||||
|
header("Location: " . $_GET['source']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
if (in_array($_GET['mode'], [0,1,2])){
|
||||||
|
$_SESSION['colormode'] = $_GET['mode'];
|
||||||
|
header("Location: " . $_GET['source']);
|
||||||
|
} else {
|
||||||
|
http_response_code(403);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
?>
|
48
data_usage.php
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if (isset($_SESSION['status'])) {
|
||||||
|
$loggedin = 1;
|
||||||
|
}
|
||||||
|
include 'functions.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>NoteHub - Politique des données</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
if ($loggedin) {
|
||||||
|
echo "<nav>";
|
||||||
|
nav($_SESSION['config']);
|
||||||
|
echo "</nav>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<h1>Données Utilisateur</h1>
|
||||||
|
<p style="text-align: left;">
|
||||||
|
Lorsque vous vous connectez sur NoteHub,
|
||||||
|
vos identifiants UVSQ sont utilisés pour récupérer les données relatives aux notes sur <a href="https://bulletins.iut-velizy.uvsq.fr">bulletins.iut-velizy.uvsq.fr</a><br>
|
||||||
|
<br>Vos identifiants UVSQ ainsi que les données renvoyées par <a href="https://bulletins.iut-velizy.uvsq.fr">bulletins.iut-velizy.uvsq.fr</a> sont stockées dans une session qui se détruit lorsque vous vous déconnectez.<br>
|
||||||
|
<br>Pour toute question, vous pouvez nous écrire à l'adresse <a href="mailto:club@e59.fr">club@e59.fr</a>.
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
if ($loggedin) {
|
||||||
|
echo "<footer>";
|
||||||
|
footer();
|
||||||
|
echo "</footer>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
<?php
|
||||||
|
if ($loggedin) {
|
||||||
|
echo "<script src='main.js'></script>";
|
||||||
|
echo "<script>colormode(" . $_SESSION['colormode'] . ")</script>";
|
||||||
|
};
|
||||||
|
?>
|
||||||
|
</html>
|
36
devoirs.php
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
|
||||||
|
header("Location: index.php?page=" . $_SERVER['REQUEST_URI']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
include 'functions.php';
|
||||||
|
|
||||||
|
$config = $_SESSION['config'];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><?php echo $config->title?></title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
<?php nav($config)?>
|
||||||
|
</nav>
|
||||||
|
<h1>Devoirs</h1>
|
||||||
|
<p>En construction</p>
|
||||||
|
<footer><?php footer()?></footer>
|
||||||
|
</body>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<script>colormode(<?php echo $_SESSION['colormode']?>)</script>
|
||||||
|
</html>
|
BIN
favicon.ico
Executable file
After Width: | Height: | Size: 820 B |
95
functions.php
Executable file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
function authentification($username, $password) {
|
||||||
|
|
||||||
|
$s = curl_init();
|
||||||
|
|
||||||
|
$url1 = "https://cas2.uvsq.fr/cas/login?service=https://bulletins.iut-velizy.uvsq.fr/services/doAuth.php";
|
||||||
|
$url2 = "https://bulletins.iut-velizy.uvsq.fr/services/data.php?q=semestresEtudiant";
|
||||||
|
$url3 = "https://bulletins.iut-velizy.uvsq.fr/logout.php";
|
||||||
|
curl_setopt($s, CURLOPT_URL, $url1);
|
||||||
|
curl_setopt($s, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($s, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($s, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($s, CURLOPT_COOKIEJAR, "/tmp/" . $username . "-cookies.txt");
|
||||||
|
$req1 = curl_exec($s);
|
||||||
|
|
||||||
|
$req1_html = new DOMDocument();
|
||||||
|
@$req1_html->loadHTML($req1);
|
||||||
|
$inputs = $req1_html->getElementsByTagName("input");
|
||||||
|
foreach ($inputs as $input) {
|
||||||
|
if ($input->getAttribute("name") == "execution") {
|
||||||
|
$execution = $input->getAttribute("value");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($s, CURLOPT_URL, $url1);
|
||||||
|
curl_setopt($s, CURLOPT_POST, true);
|
||||||
|
curl_setopt($s, CURLOPT_COOKIEFILE, "/tmp/" . $username . "-cookies.txt");
|
||||||
|
curl_setopt($s, CURLOPT_POSTFIELDS, array (
|
||||||
|
"username" => $username,
|
||||||
|
"password" => $password,
|
||||||
|
"execution" => $execution,
|
||||||
|
"_eventId" => "submit",
|
||||||
|
"geolocalisation" => ""
|
||||||
|
));
|
||||||
|
|
||||||
|
$auth = curl_exec($s);
|
||||||
|
|
||||||
|
if (curl_getinfo($s, CURLINFO_HTTP_CODE) != 200) {
|
||||||
|
if (curl_getinfo($s, CURLINFO_HTTP_CODE) == 302) {
|
||||||
|
return 3;
|
||||||
|
} else if (curl_getinfo($s, CURLINFO_HTTP_CODE) == 403 || curl_getinfo($s, CURLINFO_HTTP_CODE) == 401){
|
||||||
|
return 2;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($s, CURLOPT_URL, $url2);
|
||||||
|
$semestres = curl_exec($s);
|
||||||
|
if (curl_getinfo($s, CURLINFO_HTTP_CODE) != 200) {
|
||||||
|
if (curl_getinfo($s, CURLINFO_HTTP_CODE) == 500) {
|
||||||
|
return 4;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$semestres_data = json_decode($semestres, true);
|
||||||
|
|
||||||
|
$semestres_json = array();
|
||||||
|
|
||||||
|
foreach ($semestres_data as $sem) {
|
||||||
|
$id_semestre = $sem['formsemestre_id'];
|
||||||
|
$url = "https://bulletins.iut-velizy.uvsq.fr/services/data.php?q=relev%C3%A9Etudiant&semestre=" . $id_semestre;
|
||||||
|
curl_setopt($s, CURLOPT_URL, $url);
|
||||||
|
$notes_request = curl_exec($s);
|
||||||
|
array_push($semestres_json, json_decode($notes_request));
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($s, CURLOPT_URL, $url3);
|
||||||
|
curl_exec($s);
|
||||||
|
|
||||||
|
curl_close($s);
|
||||||
|
|
||||||
|
return $semestres_json;
|
||||||
|
}
|
||||||
|
function footer() {
|
||||||
|
echo '<h2>A propos</h2>';
|
||||||
|
$modes = array("clair", "sombre", "sombre");
|
||||||
|
$modes_codes = array("1", "0", "0");
|
||||||
|
echo '<a href="colormode.php?mode=' . $modes_codes[$_SESSION['colormode']] . '&source=' . $_SERVER['REQUEST_URI'] . '">Mode ' . $modes[$_SESSION['colormode']] . '</a><br><br>';
|
||||||
|
echo '<a href="data_usage.php">Utilisation des données</a><br><br>';
|
||||||
|
if (isset($_SESSION['status']) && $_SESSION['status'] == "a") {
|
||||||
|
echo '<a href="admin.php">Admin</a>';
|
||||||
|
};
|
||||||
|
echo "<hr>© 2024 Jan BELLON - E59";
|
||||||
|
}
|
||||||
|
function nav($config) {
|
||||||
|
echo '<a href="home.php"><img src="./img/notehub' . $_SESSION['colormode'] . '.png" id="notehub-icon"/></a>';
|
||||||
|
foreach($config->pages as $key => $value) {
|
||||||
|
echo '<a href="' . $value . '" class="navlink">' . $key . '</a>';
|
||||||
|
};
|
||||||
|
echo '<a href="logout.php" class="navlink" style="color: #FE2424">Deconnexion</a>';
|
||||||
|
}
|
||||||
|
?>
|
37
home.php
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = $_SESSION['config'];
|
||||||
|
include 'functions.php';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><?php echo $config->title ?> - IUT de Vélizy</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
<?php nav($config)?>
|
||||||
|
</nav>
|
||||||
|
<h1>Bienvenue sur Notehub</h1>
|
||||||
|
<div>Vous pouvez consulter vos notes et moyennes dans <a href="notes.php">notes</a></div>
|
||||||
|
<footer><?php footer()?></footer>
|
||||||
|
</body>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<script>colormode(<?php echo $_SESSION['colormode']?>)</script>
|
||||||
|
</html>
|
BIN
img/notehub.png
Executable file
After Width: | Height: | Size: 175 KiB |
BIN
img/notehub0.png
Executable file
After Width: | Height: | Size: 175 KiB |
BIN
img/notehub1.png
Executable file
After Width: | Height: | Size: 169 KiB |
BIN
img/notehub2.png
Executable file
After Width: | Height: | Size: 175 KiB |
BIN
img/uvsq.png
Executable file
After Width: | Height: | Size: 9.3 KiB |
BIN
img/webphone.bmp
Executable file
After Width: | Height: | Size: 830 B |
23
index.nginx-debian.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Welcome to nginx!</title>
|
||||||
|
<style>
|
||||||
|
html { color-scheme: light dark; }
|
||||||
|
body { width: 35em; margin: 0 auto;
|
||||||
|
font-family: Tahoma, Verdana, Arial, sans-serif; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Welcome to nginx!</h1>
|
||||||
|
<p>If you see this page, the nginx web server is successfully installed and
|
||||||
|
working. Further configuration is required.</p>
|
||||||
|
|
||||||
|
<p>For online documentation and support please refer to
|
||||||
|
<a href="http://nginx.org/">nginx.org</a>.<br/>
|
||||||
|
Commercial support is available at
|
||||||
|
<a href="http://nginx.com/">nginx.com</a>.</p>
|
||||||
|
|
||||||
|
<p><em>Thank you for using nginx.</em></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
166
index.php
Executable file
@ -0,0 +1,166 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
|
||||||
|
header("Location: home.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = "";
|
||||||
|
|
||||||
|
include 'functions.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['colormode'])) {
|
||||||
|
$_SESSION['colormode'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_SESSION['config'])) {
|
||||||
|
$config_location = "/etc/notehub.json";
|
||||||
|
$config_file = fopen($config_location, "r") or die("Config Error");
|
||||||
|
$config = json_decode(fread($config_file,filesize($config_location)));
|
||||||
|
fclose($config_file);
|
||||||
|
$_SESSION['config'] = $config;
|
||||||
|
} else {
|
||||||
|
$config = $_SESSION['config'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['submit'])) {
|
||||||
|
$username = $_POST['username'];
|
||||||
|
$password = $_POST['password'];
|
||||||
|
if (is_null($username) || is_null($password) || $_POST['submit'] != "valider") {
|
||||||
|
$status = "Les champs ne doivent pas être vides";
|
||||||
|
} else if (!preg_match('/^\d{8}$/', $username)) {
|
||||||
|
$status = "Le nom d'utilisateur doit être un numéro de 8 chiffres";
|
||||||
|
} else {
|
||||||
|
$auth = authentification($username, $password);
|
||||||
|
if ($auth == 2) {
|
||||||
|
$status = "Mauvais identifiant ou mot de passe";
|
||||||
|
} else if ($auth == 3) {
|
||||||
|
$status = "Problème de redirection sur scodoc";
|
||||||
|
} else if ($auth == 4) {
|
||||||
|
$status = "Erreur 500 Scodoc";
|
||||||
|
} else if ($auth == 1) {
|
||||||
|
$status = "Réponse de Scodoc vide";
|
||||||
|
} else {
|
||||||
|
$_SESSION['username'] = $username;
|
||||||
|
$_SESSION['password'] = $password;
|
||||||
|
$_SESSION['data'] = $auth;
|
||||||
|
|
||||||
|
if (in_array($username, $config->admins)) {
|
||||||
|
$_SESSION['status'] = "a";
|
||||||
|
} else {
|
||||||
|
$_SESSION['status'] = "e";
|
||||||
|
}
|
||||||
|
if ($username != "22200239") {
|
||||||
|
$log_file = fopen("$config->log_dir/notehub.log", "a") or die("Log Error");
|
||||||
|
$now = getdate();
|
||||||
|
$log = "C => " . sprintf("%02d", $now['mday']) . "/" . sprintf("%02d", $now['mon']) . "/" . $now['year'] . " " . sprintf("%02d", $now['hours']) . ":" . sprintf("%02d", $now['minutes']) . ":" . sprintf("%02d", $now['seconds']) . " -> " . $username . " logged in from " . $_SERVER['REMOTE_ADDR'] . " with session : " . session_id() . "\n";
|
||||||
|
fwrite($log_file, $log);
|
||||||
|
fclose($log_file);
|
||||||
|
}
|
||||||
|
if (isset($_GET["page"])) {
|
||||||
|
header("Location: " . $_GET["page"]);
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
header("Location: home.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Connexion - <?php echo $config->title ?></title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||||
|
<meta name="description" content=<?php echo "'$config->description'";?>/>
|
||||||
|
<meta property="og:image" content="https://notehub.fr/favicon.ico"/>
|
||||||
|
<meta property="og:description" content=<?php echo "'$config->description'";?>/>
|
||||||
|
<meta property="og:url" content="https://notehub.fr/"/>
|
||||||
|
<meta property="og:title" content=<?php echo "'$config->title'";?>/>
|
||||||
|
<meta name="theme-color" data-react-helmet="true" content="#000000"/>
|
||||||
|
<style>
|
||||||
|
input[type="text"],
|
||||||
|
input[type="password"] {
|
||||||
|
background-color: var(--table-bg);
|
||||||
|
color: var(--text-color);
|
||||||
|
border: 0;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 30px;
|
||||||
|
outline: none;
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
input[type="submit"] {
|
||||||
|
background-color: var(--table-bg);
|
||||||
|
color: var(--text-colo2);
|
||||||
|
border: 0;
|
||||||
|
padding: 10px 20px;
|
||||||
|
margin: 0;
|
||||||
|
margin-left: 270px;
|
||||||
|
margin-top: 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 30px;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
input[type="submit"]:hover {
|
||||||
|
border-bottom: 1px solid var(--link-hover-bg);
|
||||||
|
}
|
||||||
|
form {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 500px;
|
||||||
|
display: block;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
#logo-uvsq {
|
||||||
|
width: 400px;
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
}
|
||||||
|
@media only screen and (max-device-width: 600px){
|
||||||
|
form {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
input[type="text"],
|
||||||
|
input[type="password"] {
|
||||||
|
font-size: 2em;
|
||||||
|
width: 80%;
|
||||||
|
margin: 40px;
|
||||||
|
}
|
||||||
|
input[type="submit"] {
|
||||||
|
font-size: 2em;
|
||||||
|
width: 250px;
|
||||||
|
margin-left: 542px;
|
||||||
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img id="logo-uvsq" src="/img/uvsq.png"/>
|
||||||
|
<h1>Connexion - Notehub</h1>
|
||||||
|
<form action="" method="post">
|
||||||
|
<div><?=$status?></div>
|
||||||
|
<input type="text" placeholder="Identifiant CAS" name="username" required>
|
||||||
|
<input type="password" placeholder="Mot de passe" name="password" required>
|
||||||
|
<input type="submit" value="valider" name="submit">
|
||||||
|
</form>
|
||||||
|
<footer><?php footer()?></footer>
|
||||||
|
</body>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<script>colormode(<?php echo $_SESSION['colormode']?>)</script>
|
||||||
|
</html>
|
13
logout.php
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if (isset($_SESSION['config']) && $_SESSION['username'] != "22200239") {
|
||||||
|
$log_file = fopen($_SESSION['config']->log_dir . "/notehub.log", "a") or die("Log Error");
|
||||||
|
$now = getdate();
|
||||||
|
$log = "D => " . sprintf("%02d", $now['mday']) . "/" . sprintf("%02d", $now['mon']) . "/" . $now['year'] . " " .sprintf("%02d", $now['hours']) . ":" . sprintf("%02d", $now['minutes']) . ":" . sprintf("%02d", $now['seconds']) . " -> " . $_SESSION['username'] . " disconnected from " . $_SERVER['REMOTE_ADDR'] . "\n";
|
||||||
|
fwrite($log_file, $log);
|
||||||
|
fclose($log_file);
|
||||||
|
}
|
||||||
|
session_destroy();
|
||||||
|
header('Location: index.php');
|
||||||
|
exit();
|
||||||
|
?>
|
308
main.js
Executable file
@ -0,0 +1,308 @@
|
|||||||
|
function colormode(mode) {
|
||||||
|
const profiles = {
|
||||||
|
0:["#0D1117", "#0D1117", "#161B22", "#171D24", "#ECF6FF", "#E1EAF3", "#BEC6CD", "#BEC6CD", "dark"],
|
||||||
|
1:["#EFF3F4", "#F7F9F9", "#FFFFFF", "#EFF1F1", "#0F1419", "#454A4F", "#0F1419", "#ACB3B3", "light"],
|
||||||
|
2:["#FF0000", "#FF8800", "#FFFF00", "#88FF00", "#00FF00", "#00FFFF", "#0000FF", "#8800FF", "dark"]
|
||||||
|
}
|
||||||
|
var r = document.querySelector('body');
|
||||||
|
r.style.setProperty('--nav-bg', profiles[mode][0]);
|
||||||
|
r.style.setProperty('--table-bg', profiles[mode][1]);
|
||||||
|
r.style.setProperty('--background', profiles[mode][2]);
|
||||||
|
r.style.setProperty('--link-hover-bg', profiles[mode][3]);
|
||||||
|
r.style.setProperty('--text-color', profiles[mode][4]);
|
||||||
|
r.style.setProperty('--link-color', profiles[mode][5]);
|
||||||
|
r.style.setProperty('--title-color', profiles[mode][6]);
|
||||||
|
r.style.setProperty('--table-corder', profiles[mode][7]);
|
||||||
|
r.style.setProperty('--graphtheme', profiles[mode][8]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ressourceChart(ue, name) {
|
||||||
|
|
||||||
|
const moyennes = [];
|
||||||
|
const labels = [];
|
||||||
|
const colors = [];
|
||||||
|
const palette = ["#ca1414", "#ca1414", "#ca1414", "#ca1414", "#ea1818", "#ea1818", "#ea1818", "#ea1818", "#eb6b17", "#ebb117", "#ebe117", "#e5eb17", "#d8eb17", "#cbeb17","#bfeb17", "#9feb17", "#6ceb17", "#2dde15", "#28c513", "#13be7f", "#7013bf"];
|
||||||
|
|
||||||
|
// Récupération des moyennes et des labels pour chaque ressource
|
||||||
|
ue = data.relevé.ues[ue]
|
||||||
|
for (const ressource in ue.ressources) {
|
||||||
|
var moyenne = ue.ressources[ressource].moyenne
|
||||||
|
if (moyenne == "~") {
|
||||||
|
moyenne = "0";
|
||||||
|
}
|
||||||
|
moyennes.push(moyenne);
|
||||||
|
labels.push([`${data.relevé.ressources[ressource].titre} (${ue.ressources[ressource].coef})`]);
|
||||||
|
colors.push(palette[Math.round(parseInt(moyenne))]);
|
||||||
|
}
|
||||||
|
for (const sae in ue.saes) {
|
||||||
|
var moyenne = ue.saes[sae].moyenne
|
||||||
|
if (moyenne == "~") {
|
||||||
|
moyenne = "0";
|
||||||
|
}
|
||||||
|
moyennes.push(moyenne);
|
||||||
|
labels.push([`${data.relevé.saes[sae].titre} (${ue.saes[sae].coef})`]);
|
||||||
|
colors.push(palette[Math.round(parseInt(moyenne))]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Options pour le graphe
|
||||||
|
const options = {
|
||||||
|
series: [{
|
||||||
|
name: "Moyenne",
|
||||||
|
data: moyennes
|
||||||
|
},],
|
||||||
|
chart: {
|
||||||
|
type: 'bar',
|
||||||
|
height: 400,
|
||||||
|
width: 800,
|
||||||
|
background: getComputedStyle(document.body).getPropertyValue('--background'),
|
||||||
|
foreColor: getComputedStyle(document.body).getPropertyValue('--text-color')
|
||||||
|
},
|
||||||
|
plotOptions: {
|
||||||
|
bar: {
|
||||||
|
horizontal: false,
|
||||||
|
distributed: true,
|
||||||
|
borderRadius: 2,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
colors: colors,
|
||||||
|
annotations: {
|
||||||
|
yaxis: [{
|
||||||
|
y: 0,
|
||||||
|
y2: 8,
|
||||||
|
borderColor: '#b62828',
|
||||||
|
fillColor: '#b62828',
|
||||||
|
opacity: 0.2,
|
||||||
|
},{
|
||||||
|
y: 8,
|
||||||
|
y2: 10,
|
||||||
|
borderColor: '#deb62f',
|
||||||
|
fillColor: '#deb62f',
|
||||||
|
opacity: 0.2,
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
xaxis: {
|
||||||
|
categories: labels
|
||||||
|
},
|
||||||
|
yaxis: {
|
||||||
|
max: 20
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: name,
|
||||||
|
align: 'center',
|
||||||
|
margin: 10,
|
||||||
|
offsetX: 0,
|
||||||
|
offsetY: 0,
|
||||||
|
floating: false,
|
||||||
|
style: {
|
||||||
|
fontSize: '20px',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
fontFamily: undefined,
|
||||||
|
color: getComputedStyle(document.body).getPropertyValue('--title-color')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
mode: 'dark'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
options.theme.mode = getComputedStyle(document.body).getPropertyValue('--graphtheme');
|
||||||
|
console.log(getComputedStyle(document.body).getPropertyValue('--graphtheme'));
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
function uesChart(data, name) {
|
||||||
|
|
||||||
|
const moyennes = [];
|
||||||
|
const labels = [];
|
||||||
|
const colors = [];
|
||||||
|
const palette = ["#ca1414", "#ca1414", "#ca1414", "#ca1414", "#ea1818", "#ea1818", "#ea1818", "#ea1818", "#eb6b17", "#ebb117", "#ebe117", "#e5eb17", "#d8eb17", "#cbeb17","#bfeb17", "#9feb17", "#6ceb17", "#2dde15", "#28c513", "#13be7f", "#7013bf"];
|
||||||
|
|
||||||
|
|
||||||
|
// Récupération des moyennes et des labels pour chaque ressource
|
||||||
|
for (const ue in data.relevé.ues) {
|
||||||
|
moyenne = data.relevé.ues[ue].moyenne.value
|
||||||
|
if (moyenne == "~") {
|
||||||
|
moyenne = "0"
|
||||||
|
}
|
||||||
|
moyennes.push(data.relevé.ues[ue].moyenne.value);
|
||||||
|
labels.push([`${ue}`]);
|
||||||
|
colors.push(palette[parseInt(moyenne, 10)])
|
||||||
|
}
|
||||||
|
|
||||||
|
// Options pour le graphe
|
||||||
|
const options = {
|
||||||
|
series: [{
|
||||||
|
name: "Moyenne",
|
||||||
|
data: moyennes
|
||||||
|
}],
|
||||||
|
chart: {
|
||||||
|
type: "bar",
|
||||||
|
height: 400,
|
||||||
|
width: 800,
|
||||||
|
background: getComputedStyle(document.body).getPropertyValue('--background'),
|
||||||
|
foreColor: getComputedStyle(document.body).getPropertyValue('--text-color')
|
||||||
|
},
|
||||||
|
plotOptions: {
|
||||||
|
bar: {
|
||||||
|
horizontal: false,
|
||||||
|
distributed: true,
|
||||||
|
endingShape: 'rounded',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
colors: colors,
|
||||||
|
annotations: {
|
||||||
|
yaxis: [{
|
||||||
|
y: 0,
|
||||||
|
y2: 8,
|
||||||
|
borderColor: '#b62828',
|
||||||
|
fillColor: '#b62828',
|
||||||
|
opacity: 0.2,
|
||||||
|
},{
|
||||||
|
y: 8,
|
||||||
|
y2: 10,
|
||||||
|
borderColor: '#deb62f',
|
||||||
|
fillColor: '#deb62f',
|
||||||
|
opacity: 0.2,
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
xaxis: {
|
||||||
|
categories: labels
|
||||||
|
},
|
||||||
|
yaxis: {
|
||||||
|
max: 20
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: name,
|
||||||
|
align: 'center',
|
||||||
|
margin: 10,
|
||||||
|
offsetX: 0,
|
||||||
|
offsetY: 0,
|
||||||
|
floating: false,
|
||||||
|
style: {
|
||||||
|
fontSize: '20px',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
fontFamily: undefined,
|
||||||
|
color: getComputedStyle(document.body).getPropertyValue('--title-color')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
mode: 'dark',
|
||||||
|
palette: 'palette1',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
options.theme.mode = getComputedStyle(document.body).getPropertyValue('--graphtheme');
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
function absencesChart(data) {
|
||||||
|
|
||||||
|
const absences = data.relevé.semestre.absences.total;
|
||||||
|
const absences_injustifie = data.relevé.semestre.absences.injustifie;
|
||||||
|
const abs_percent = (absences_injustifie/5)*100;
|
||||||
|
var color;
|
||||||
|
if (absences <= 1) {
|
||||||
|
color = "#23A100"
|
||||||
|
} else if (absences == 2) {
|
||||||
|
color = "#00FF00"
|
||||||
|
} else if (absences == 3) {
|
||||||
|
color = "#FFFF00"
|
||||||
|
} else if (absences == 4) {
|
||||||
|
color = "#FF7500"
|
||||||
|
} else if (absences >= 5) {
|
||||||
|
color = "#FF0000"
|
||||||
|
};
|
||||||
|
const options = {
|
||||||
|
chart: {
|
||||||
|
height: 400,
|
||||||
|
type: "radialBar",
|
||||||
|
},
|
||||||
|
series: [abs_percent],
|
||||||
|
colors: [color],
|
||||||
|
plotOptions: {
|
||||||
|
radialBar: {
|
||||||
|
startAngle: -135,
|
||||||
|
endAngle: 135,
|
||||||
|
track: {
|
||||||
|
background: getComputedStyle(document.body).getPropertyValue('--table-bg'),
|
||||||
|
startAngle: -135,
|
||||||
|
endAngle: 135,
|
||||||
|
},
|
||||||
|
dataLabels: {
|
||||||
|
name: {
|
||||||
|
offsetY: 10,
|
||||||
|
fontSize: "30px",
|
||||||
|
show: true,
|
||||||
|
label: "Absences"
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
fontSize: "10px",
|
||||||
|
show: false,
|
||||||
|
color: getComputedStyle(document.body).getPropertyValue('--title-color'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
labels: [[`${absences_injustifie}/${absences}`]],
|
||||||
|
stroke: {
|
||||||
|
lineCap: "round"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Options pour le graphe
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
function rangChart(data) {
|
||||||
|
|
||||||
|
const rang = parseInt(data.relevé.semestre.rang.value, 10);
|
||||||
|
const total = data.relevé.semestre.rang.total;
|
||||||
|
const rang_percent = 100-((rang/total)*100);
|
||||||
|
const colors = ["#ca1414", "#ca1414", "#ca1414", "#ca1414", "#ea1818", "#ea1818", "#ea1818", "#ea1818", "#eb6b17", "#ebb117", "#ebe117", "#e5eb17", "#d8eb17", "#cbeb17","#bfeb17", "#9feb17", "#6ceb17", "#2dde15", "#28c513", "#13be7f", "#7013bf"];
|
||||||
|
var color_pos = Math.round(rang_percent/5);
|
||||||
|
var color = colors[color_pos];
|
||||||
|
const options = {
|
||||||
|
chart: {
|
||||||
|
height: 400,
|
||||||
|
type: "radialBar",
|
||||||
|
},
|
||||||
|
series: [rang_percent],
|
||||||
|
colors: [color],
|
||||||
|
plotOptions: {
|
||||||
|
radialBar: {
|
||||||
|
startAngle: -135,
|
||||||
|
endAngle: 135,
|
||||||
|
track: {
|
||||||
|
background: getComputedStyle(document.body).getPropertyValue('--table-bg'),
|
||||||
|
startAngle: -135,
|
||||||
|
endAngle: 135,
|
||||||
|
},
|
||||||
|
dataLabels: {
|
||||||
|
name: {
|
||||||
|
offsetY: 10,
|
||||||
|
fontSize: "30px",
|
||||||
|
show: true,
|
||||||
|
label: "Rang"
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
fontSize: "10px",
|
||||||
|
show: false,
|
||||||
|
color: getComputedStyle(document.body).getPropertyValue('--title-color'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
labels: [`${rang}/${total}`],
|
||||||
|
stroke: {
|
||||||
|
lineCap: "round"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Options pour le graphe
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
BIN
notehub-code.tar
Normal file
283
notes.php
Executable file
@ -0,0 +1,283 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
|
||||||
|
header("Location: index.php?page=" . $_SERVER['REQUEST_URI']);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
include 'functions.php';
|
||||||
|
|
||||||
|
$username = $_SESSION['username'];
|
||||||
|
$password = $_SESSION['password'];
|
||||||
|
$config = $_SESSION['config'];
|
||||||
|
$data = $_SESSION['data'];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><?php echo $config->title;?></title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
#sem_links {
|
||||||
|
position: fixed;
|
||||||
|
top: 30px;
|
||||||
|
right: 20px;
|
||||||
|
display: block;
|
||||||
|
z-index: 1200;
|
||||||
|
}
|
||||||
|
#sem_links a {
|
||||||
|
position: relative;
|
||||||
|
margin: 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: var(--table-bg);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
#sem_links a:hover {
|
||||||
|
background-color: var(--link-hover-bg);
|
||||||
|
}
|
||||||
|
.rname {
|
||||||
|
border-bottom: 0;
|
||||||
|
color: var(--title-color);
|
||||||
|
}
|
||||||
|
.apexcharts-xaxis-label {
|
||||||
|
fill: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.apexcharts-canvas {
|
||||||
|
margin: 0 auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart {
|
||||||
|
margin: 0 auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#circhart {
|
||||||
|
display: flex;
|
||||||
|
margin: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chart1 {
|
||||||
|
//margin-top: 500px;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
#abschart {
|
||||||
|
position: absolute;
|
||||||
|
right: 100px;
|
||||||
|
top: 150px;
|
||||||
|
z-index: 500;
|
||||||
|
}
|
||||||
|
#retchart {
|
||||||
|
position: absolute;
|
||||||
|
left: 100px;
|
||||||
|
top: 150px;
|
||||||
|
z-index: 500;
|
||||||
|
}*/
|
||||||
|
@media screen and (min-width: 1800px) {
|
||||||
|
#circhart {
|
||||||
|
width: 800px;
|
||||||
|
margin-left: 800px;
|
||||||
|
}
|
||||||
|
#charts {
|
||||||
|
display:grid;
|
||||||
|
grid-gap: 0;
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chart1 {
|
||||||
|
grid-column: 1;
|
||||||
|
grid-row: 1;
|
||||||
|
//margin-top: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chart2 {
|
||||||
|
grid-column: 2;
|
||||||
|
grid-row: 1;
|
||||||
|
//margin-top: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chart3 {
|
||||||
|
grid-column: 1;
|
||||||
|
grid-row: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chart4 {
|
||||||
|
grid-column: 2;
|
||||||
|
grid-row: 2;
|
||||||
|
}
|
||||||
|
/*#abschart {
|
||||||
|
right: 80px;
|
||||||
|
top: 100px;
|
||||||
|
}
|
||||||
|
#retchart {
|
||||||
|
right: -40px;
|
||||||
|
top: 100px;
|
||||||
|
}*/
|
||||||
|
#lastgrades {
|
||||||
|
position: absolute;
|
||||||
|
top: 25px;
|
||||||
|
left: 20px;
|
||||||
|
font-size: 0.8em;
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
#lastgrades td, #lastgrades th{
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
.notecol {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
<?php nav($config)?>
|
||||||
|
</nav>
|
||||||
|
<div id="sem_links">
|
||||||
|
<?php
|
||||||
|
for ($i = 0; $i < sizeof($data); $i++) {
|
||||||
|
if (property_exists($data[$i]->relevé, 'semestre')) {
|
||||||
|
echo '<a href="notes.php?sem_id=' . $i .'">' . $data[$i]->relevé->semestre->annee_universitaire . ' Semestre ' . $data[$i]->relevé->semestre->numero . '</a><br><br>';
|
||||||
|
} else {
|
||||||
|
echo '<a href="notes.php?sem_id=' . $i .'">Semestre bloqué</a><br><br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="circhart">
|
||||||
|
<div id="abschart" class="chart"></div>
|
||||||
|
<div id="retchart" class="chart"></div>
|
||||||
|
</div>
|
||||||
|
<div id="charts"></div>
|
||||||
|
<hr</>
|
||||||
|
<?php
|
||||||
|
if (!isset($_GET['sem_id'])) {
|
||||||
|
$sem = 0;
|
||||||
|
} else {
|
||||||
|
$sem = intval($_GET['sem_id']);
|
||||||
|
}
|
||||||
|
if ($sem >= sizeof($data)) {
|
||||||
|
die("Numéro de semestre invalide");
|
||||||
|
}
|
||||||
|
$sem_data = $data[$sem];
|
||||||
|
if (!property_exists($sem_data->relevé, 'semestre')) {
|
||||||
|
die('<div>Télécharger le relevé : <a href="https://cas2.uvsq.fr/cas/login?service=https%3A%2F%2Fbulletins.iut-velizy.uvsq.fr%2Fservices%2FdoAuth.php%3Fhref%3Dhttps://bulletins.iut-velizy.uvsq.fr/services/bulletin_PDF.php?sem_id=' . $sem_data->relevé->formsemestre_id . '&etudiant=' . $_SESSION['username'] . '">bulletin.pdf</a></div>');
|
||||||
|
}
|
||||||
|
$notes = array();
|
||||||
|
$michel = array("ressources", "saes");
|
||||||
|
$allcolors = array(
|
||||||
|
0 => array("#FF4949", "#FFB14A", "#D8FF4A", "#4AFF4A", "#4AFFBA"),
|
||||||
|
1 => array("#C90000", "#D06F00", "#CAB000", "#06B800", "#00BF8F")
|
||||||
|
);
|
||||||
|
$colors = $allcolors[$_SESSION['colormode']];
|
||||||
|
echo "<table>";
|
||||||
|
if ($sem_data->relevé->semestre->notes->value == "~") {
|
||||||
|
$noteval = '<td style="color: #888888">' . $sem_data->relevé->semestre->notes->value . '</td>';
|
||||||
|
} else if (floatval($sem_data->relevé->semestre->notes->value) == floatval($sem_data->relevé->semestre->notes->max)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[4] . '">' . $sem_data->relevé->semestre->notes->value . '</td>';
|
||||||
|
} else if (floatval($sem_data->relevé->semestre->notes->value) > floatval($sem_data->relevé->semestre->notes->moy)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[3] . '">' . $sem_data->relevé->semestre->notes->value . '</td>';
|
||||||
|
} else if (floatval($sem_data->relevé->semestre->notes->value) == floatval($sem_data->relevé->semestre->notes->moy)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[2] . '">' . $sem_data->relevé->semestre->notes->value . '</td>';
|
||||||
|
} else if (floatval($sem_data->relevé->semestre->notes->value) == floatval($sem_data->relevé->semestre->notes->min)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[0] . '">' . $sem_data->relevé->semestre->notes->value . '</td>';
|
||||||
|
} else if (floatval($sem_data->relevé->semestre->notes->value) < floatval($sem_data->relevé->semestre->notes->moy)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[1] . '">' . $sem_data->relevé->semestre->notes->value . '</td>';
|
||||||
|
} else {
|
||||||
|
$noteval = '<td>' . $sem_data->relevé->semestre->notes->value . '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<td>Moyenne Générale</td>" . $noteval . "<td><span style='color: " . $colors[0] . "'>" . $sem_data->relevé->semestre->notes->min . "</span> | <span style='color: " . $colors[2] . "'>" . $sem_data->relevé->semestre->notes->moy . "</span> | <span style='color: " . $colors[4] . "'>" . $sem_data->relevé->semestre->notes->max . "</span></td></tr>";
|
||||||
|
|
||||||
|
echo "</table>";
|
||||||
|
|
||||||
|
foreach ($michel as $m) {
|
||||||
|
foreach ($sem_data->relevé->$m as $ressource_key => $ressource) {
|
||||||
|
echo "<table>";
|
||||||
|
echo "<tr><th class='rname' colspan='3'>" . $ressource_key . " - " . $ressource->titre . "</th></tr>";
|
||||||
|
echo "<tr><th>Description</th><th>Coef</th><th>Note</th><th>Min Moy Max</th></tr>";
|
||||||
|
foreach($ressource->evaluations as $eval) {
|
||||||
|
if (!is_null($eval->date)){
|
||||||
|
$eval->ressource = $ressource_key;
|
||||||
|
$notes[] = $eval;
|
||||||
|
}
|
||||||
|
if ($eval->note->value == "~") {
|
||||||
|
$noteval = '<td style="color: #888888">' . $eval->note->value . '</td>';
|
||||||
|
} else if (floatval($eval->note->value) == floatval($eval->note->max)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[4] . '">' . $eval->note->value . '</td>';
|
||||||
|
} else if (floatval($eval->note->value) > floatval($eval->note->moy)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[3] . '">' . $eval->note->value . '</td>';
|
||||||
|
} else if (floatval($eval->note->value) == floatval($eval->note->moy)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[2] . '">' . $eval->note->value . '</td>';
|
||||||
|
} else if (floatval($eval->note->value) == floatval($eval->note->min)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[0] . '">' . $eval->note->value . '</td>';
|
||||||
|
} else if (floatval($eval->note->value) < floatval($eval->note->moy)){
|
||||||
|
$noteval = '<td style="color: ' . $colors[1] . '">' . $eval->note->value . '</td>';
|
||||||
|
} else {
|
||||||
|
$noteval = '<td>' . $eval->note->value . '</td>';
|
||||||
|
}
|
||||||
|
echo "<tr><td>" . $eval->description . "</td><td>" . $eval->coef . "</td>" . $noteval . "<td><span style='color: " . $colors[0] . "'>" . $eval->note->min . "</span> | <span style='color: " . $colors[2] . "'>" . $eval->note->moy . "</span> | <span style='color: " . $colors[4] . "'>" . $eval->note->max . "</span></td></tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "<table id='lastgrades'>";
|
||||||
|
echo "<tr><th class='rname' colspan='3'>Dernières notes</th></tr>";
|
||||||
|
echo "<tr><th>Eval</th><th>Date</th><th class='notecol'>Note</th></tr>";
|
||||||
|
function compareByDate($a, $b) {
|
||||||
|
return strtotime($a->date) - strtotime($b->date);
|
||||||
|
}
|
||||||
|
usort($notes, 'compareByDate');
|
||||||
|
$notes = array_reverse($notes);
|
||||||
|
for ($i = 0; $i < sizeof($notes) && $i < 3; $i++) {
|
||||||
|
$notedate = strtotime($notes[$i]->date);
|
||||||
|
echo "<tr><td>" . $notes[$i]->ressource . " - " . $notes[$i]->description . "</td><td>" . date("d/m/Y", $notedate). "</td><td class='notecol'>" . $notes[$i]->note->value . "</td></tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
?>
|
||||||
|
<footer><?php footer()?></footer>
|
||||||
|
</body>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<script>
|
||||||
|
colormode(<?php echo $_SESSION['colormode'];?>);
|
||||||
|
const data = <?php if (isset($_SESSION['data'])) {echo json_encode($_SESSION['data'][$sem]);}?>;
|
||||||
|
console.log(data);
|
||||||
|
// Récupération des données pour chaque UE
|
||||||
|
|
||||||
|
// Création des graphes
|
||||||
|
var i = 1;
|
||||||
|
const container = document.getElementById("charts");
|
||||||
|
const template = document.createElement("div");
|
||||||
|
const charts = []
|
||||||
|
for (const ue in data.relevé.ues) {
|
||||||
|
const graph = template.cloneNode(true);
|
||||||
|
graph.setAttribute("id", `chart${i}`);
|
||||||
|
container.appendChild(graph);
|
||||||
|
|
||||||
|
const chart = new ApexCharts(document.querySelector(`#chart${i}`), ressourceChart(ue, `UE${i}`));
|
||||||
|
chart.render();
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
const graph = template.cloneNode(true);
|
||||||
|
graph.setAttribute("id", `chart${i}`);
|
||||||
|
container.appendChild(graph);
|
||||||
|
|
||||||
|
const ueschart = new ApexCharts(document.querySelector(`#chart${i}`), uesChart(data, "Moyennes UES"));
|
||||||
|
ueschart.render();
|
||||||
|
const abschart = new ApexCharts(document.querySelector("#abschart"), absencesChart(data));
|
||||||
|
const rangchart = new ApexCharts(document.querySelector("#retchart"), rangChart(data));
|
||||||
|
abschart.render();
|
||||||
|
rangchart.render();
|
||||||
|
</script>
|
||||||
|
</html>
|
59
profil.php
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
|
||||||
|
header("Location: index.php?page=" . $_SERVER['REQUEST_URI']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
include 'functions.php';
|
||||||
|
|
||||||
|
$username = $_SESSION['username'];
|
||||||
|
$password = $_SESSION['password'];
|
||||||
|
$config = $_SESSION['config'];
|
||||||
|
|
||||||
|
$data = $_SESSION['data'];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><?php echo $config->title ?></title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
<?php nav($config);?>
|
||||||
|
</nav>
|
||||||
|
<h1>Etudiant</h1>
|
||||||
|
<table>
|
||||||
|
<tr><th colspan="2">Infos profil</th></tr>
|
||||||
|
<?php
|
||||||
|
$info_profil = $data[0];
|
||||||
|
echo "<tr><td>Date MAJ</td><td>" . $info_profil->relevé->date . "</td></tr>";
|
||||||
|
foreach($info_profil->relevé->etudiant as $key => $value) {
|
||||||
|
echo "<tr><td>" . $key . "</td><td>" . $value . "</td></tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr><th colspan="2">Formation</th></tr>
|
||||||
|
<?php
|
||||||
|
foreach($info_profil->relevé->formation as $key => $value) {
|
||||||
|
echo "<tr><td>" . $key . "</td><td>" . $value . "</td></tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<footer><?php footer() ?></footer>
|
||||||
|
</body>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<script>colormode(<?php echo $_SESSION['colormode']?>)</script>
|
||||||
|
</html>
|
4
robots.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow: /home.php
|
||||||
|
Allow: /index.php
|
||||||
|
Allow: /data_usage.php
|
10
sitemap.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
<url>
|
||||||
|
<loc>https://notehub.fr/</loc>
|
||||||
|
<lastmod>2024-09-15</lastmod>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>https://notehub.fr/data_usage.php</loc>
|
||||||
|
<lastmod>2024-08-31</lastmod>
|
||||||
|
</url>
|
||||||
|
</urlset>
|
110
style.css
Executable file
@ -0,0 +1,110 @@
|
|||||||
|
:root{
|
||||||
|
--nav-bg: #0D1117;
|
||||||
|
--table-bg: #0D1117;
|
||||||
|
--background: #161B22;
|
||||||
|
--link-hover-bg: #171D24;
|
||||||
|
--text-color: #ECF6FF;
|
||||||
|
--link-color: #E1EAF3;
|
||||||
|
--title-color: #BEC6CD;
|
||||||
|
--table-border: #BEC6CD;
|
||||||
|
--graphtheme: 'dark';
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: var(--background);
|
||||||
|
color: var(--text-color);
|
||||||
|
font-family: "Open Sans", sans-serif;
|
||||||
|
font-size: 1.2em;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin-top: 160px;
|
||||||
|
margin-bottom: 100px;
|
||||||
|
font-size: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border: 0;
|
||||||
|
margin: 50px auto 50px auto;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: var(--table-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
table th, table td {
|
||||||
|
padding: 10px;
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 1px solid var(--table-border);
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 14px;
|
||||||
|
z-index: 1000;
|
||||||
|
background-color: var(--nav-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#notehub-icon {
|
||||||
|
height: 30px;
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--link-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 30px;
|
||||||
|
background-color: var(--table-bg);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin: 0;
|
||||||
|
margin-top: 500px;
|
||||||
|
background-color: var(--nav-bg);
|
||||||
|
text-align: left;
|
||||||
|
padding: 30px;
|
||||||
|
}
|
||||||
|
footer hr {
|
||||||
|
margin: 70px 10px 30px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navlink {
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1.2em;
|
||||||
|
color: var(--fg3);
|
||||||
|
padding: 10px 14px 10px 14px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navlink:hover {
|
||||||
|
border-bottom: 1px solid var(--table-border);
|
||||||
|
background-color: var(--link-hover-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-device-width : 600px) {
|
||||||
|
body {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
nav {
|
||||||
|
padding: 20px 0 20px 0;
|
||||||
|
}
|
||||||
|
.navlink {
|
||||||
|
font-size: 0.8em;
|
||||||
|
padding: 20px 15px 20px 15px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
margin-top: 800px;
|
||||||
|
}
|
||||||
|
}
|