diff --git a/bdd/notehub.sql b/bdd/notehub.sql new file mode 100644 index 0000000..f65fda2 --- /dev/null +++ b/bdd/notehub.sql @@ -0,0 +1,326 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost +-- Generation Time: May 21, 2023 at 09:05 PM +-- Server version: 10.5.19-MariaDB-0+deb11u2 +-- PHP Version: 7.4.33 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `notehub` +-- + +CREATE Database IF NOT EXISTS notehub; +USE notehub; +-- -------------------------------------------------------- + +-- +-- Table structure for table `annees` +-- + +CREATE TABLE `annees` ( + `ID` int(11) NOT NULL, + `annees` varchar(255) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `annees` +-- + +INSERT INTO `annees` (`ID`, `annees`) VALUES +(1, '2022-2023'),(2, '2023-2024'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `annonces` +-- + +CREATE TABLE `annonces` ( + `ID` int(11) NOT NULL, + `emetteur` int(11) NOT NULL, + `couleur` varchar(255) DEFAULT NULL, + `titre` varchar(255) DEFAULT NULL, + `message` text DEFAULT NULL, + `date` datetime NOT NULL DEFAULT current_timestamp(), + `visible` tinyint(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `annonces` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `devoirs` +-- + +CREATE TABLE `devoirs` ( + `ID` int(11) NOT NULL, + `prof` int(11) NOT NULL, + `contenu` varchar(255) DEFAULT NULL, + `ressource` int(11) DEFAULT NULL, + `date` datetime NOT NULL DEFAULT current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `devoirs` +-- +-- -------------------------------------------------------- + +-- +-- Table structure for table `groupes` +-- + +CREATE TABLE `groupes` ( + `ID` int(11) NOT NULL, + `nom` varchar(255) NOT NULL, + `annee` int(11) NOT NULL, + `alternance` tinyint(1) NOT NULL COMMENT 'FI ou FA' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Table des groupes de TP'; + +-- +-- Dumping data for table `groupes` +-- + +INSERT INTO `groupes` (`ID`, `nom`, `annee`, `alternance`) VALUES +(1, 'RT1-FI-A1', 1, 0), +(2, 'RT1-FI-A2', 1, 0), +(3, 'RT1-FI-B1', 1, 0), +(4, 'RT1-FA', 1, 1); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `profs` +-- + +CREATE TABLE `profs` ( + `ID` int(11) NOT NULL, + `nom` varchar(255) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `profs` +-- + +INSERT INTO `profs` (`ID`, `nom`) VALUES +(1, 'Sébastien Le Moel'), +(2, 'Samuel Marty'), +(3, 'Amar Ramdane-Cherif'), +(4, 'Willy Guillemin'), +(5, 'Marie-Bernard Bat'), +(6, 'Jenny Fancett'), +(7, 'Dana Marinca'), +(8, 'Etienne Huot'), +(9, 'Abdelaziz Benallegue'), +(10, 'Luc Bondant'), +(11, 'Stephan Soulayrol') +; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `publications` +-- + +CREATE TABLE `publications` ( + `ID` int(11) NOT NULL, + `type` int(11) NOT NULL, + `id_pub` int(11) NOT NULL COMMENT 'ID publication dans sa table', + `groupe` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `publications` + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ressources` +-- + +CREATE TABLE `ressources` ( + `ID` int(11) NOT NULL, + `semestre` int(11) NOT NULL, + `nom` varchar(255) DEFAULT NULL, + `code` int(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `semestres` +-- + +CREATE TABLE `semestres` ( + `ID` int(11) NOT NULL, + `numero` int(11) NOT NULL, + `annee` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `semestres` +-- + +INSERT INTO `semestres` (`ID`, `numero`, `annee`) VALUES +(1, 1, 1), +(2, 2, 1); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `utilisateurs` +-- + +CREATE TABLE `utilisateurs` ( + `ID` int(11) NOT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `usercas` varchar(255) DEFAULT NULL, + `passcas` varchar(255) DEFAULT NULL, + `iv` varchar(255) DEFAULT NULL, + `pp_url` varchar(255) DEFAULT NULL, + `verified` tinyint(1) NOT NULL, + `admin` tinyint(1) NOT NULL, + `groupe` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Table utilisateurs'; + +-- +-- Dumping data for table `utilisateurs` +-- + +INSERT INTO `utilisateurs` (`ID`, `username`, `password`, `usercas`, `passcas`, `iv`, `pp_url`, `verified`, `admin`, `groupe`) VALUES (1, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', NULL, NULL, NULL, NULL, 0, 1, 1); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `annees` +-- +ALTER TABLE `annees` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `annonces` +-- +ALTER TABLE `annonces` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `devoirs` +-- +ALTER TABLE `devoirs` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `groupes` +-- +ALTER TABLE `groupes` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `profs` +-- +ALTER TABLE `profs` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `publications` +-- +ALTER TABLE `publications` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `ressources` +-- +ALTER TABLE `ressources` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `semestres` +-- +ALTER TABLE `semestres` + ADD PRIMARY KEY (`ID`); + +-- +-- Indexes for table `utilisateurs` +-- +ALTER TABLE `utilisateurs` + ADD PRIMARY KEY (`ID`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `annees` +-- +ALTER TABLE `annees` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT for table `annonces` +-- +ALTER TABLE `annonces` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT for table `devoirs` +-- +ALTER TABLE `devoirs` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT for table `groupes` +-- +ALTER TABLE `groupes` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; + +-- +-- AUTO_INCREMENT for table `profs` +-- +ALTER TABLE `profs` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; + +-- +-- AUTO_INCREMENT for table `publications` +-- +ALTER TABLE `publications` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; + +-- +-- AUTO_INCREMENT for table `ressources` +-- +ALTER TABLE `ressources` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; + +-- +-- AUTO_INCREMENT for table `semestres` +-- +ALTER TABLE `semestres` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; + +-- +-- AUTO_INCREMENT for table `utilisateurs` +-- +ALTER TABLE `utilisateurs` + MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/doc/cahierdescharges.pdf b/doc/cahierdescharges.pdf new file mode 100644 index 0000000..31e9d7a Binary files /dev/null and b/doc/cahierdescharges.pdf differ diff --git a/html/addcas.php b/html/addcas.php new file mode 100644 index 0000000..e9da3c7 --- /dev/null +++ b/html/addcas.php @@ -0,0 +1,45 @@ +prepare("UPDATE utilisateurs SET usercas = :usercas, passcas = :passcas, iv = :iv, verified = 1 WHERE ID = :id"); + + $stmt->bindParam(':usercas', $usercas); + $stmt->bindParam(':passcas', $passcas); + $stmt->bindParam(':iv', $biniv); + $stmt->bindParam(':id', $_SESSION['userdata']['ID']); + $stmt->execute(); + + $_SESSION['usercas'] = $_POST['usercas']; + $_SESSION['passcas'] = $_POST['passcas']; + $_SESSION['userdata']['verified'] = 1; + } else { + $stmt = $pdo->prepare("UPDATE utilisateurs SET usercas = '', passcas = '', verified = 0 WHERE ID = :id"); + $stmt->bindParam(':id', $_SESSION['userdata']['ID']); + $stmt->execute(); + + $_SESSION['usercas'] = ""; + $_SESSION['passcas'] = ""; + $_SESSION['userdata']['verified'] = 0; + } +} + +header("Location: profil.php"); +?> \ No newline at end of file diff --git a/html/admin.php b/html/admin.php new file mode 100644 index 0000000..063919a --- /dev/null +++ b/html/admin.php @@ -0,0 +1,240 @@ +prepare("INSERT INTO devoirs (`prof`, `contenu`, `ressource`, `date`) VALUES (:prof, :contenu, :ressource, :date)"); + $stmt->bindParam(':prof', $_POST['prof']); + $stmt->bindParam(':contenu', $_POST['contenu']); + $stmt->bindParam(':ressource', $_POST['ressource']); + $stmt->bindParam(':date', $_POST['date']); + if ($stmt->execute()) { + + // Récupération de l'ID du devoir ajouté précédemment + $idDevoir = $pdo->lastInsertId(); + + // Ajout de la publication associée au devoir + + foreach($_POST['groupe'] as $groupe) { + $stmt = $pdo->prepare("INSERT INTO publications (`type`, `id_pub`, `groupe`) VALUES (1, :idpub, :groupe)"); + $stmt->bindParam(':idpub', $idDevoir); + $stmt->bindParam(':groupe', $groupe); + if(!$stmt->execute()) { + die("Erreur SQL" . $stmt->errorInfo()[2]); + } + } + + $erreur = "Devoir ajouté"; + $now = getdate(); + $log = "A => " . sprintf("%02d", $now['mday']) . "/" . sprintf("%02d", $now['mon']) . "/" . $now['year'] . " " . sprintf("%02d", $now['hours']) . ":" . sprintf("%02d", $now['minutes']) . ":" . sprintf("%02d", $now['seconds']) . " -> " . $_SESSION['username'] . " a ajouté un devoir (ID ressource : " . $_POST['ressource'] . ")\n"; + addlog($log, $log_dir); + } else { + $erreur = "Erreur : " . $stmt->errorInfo()[2]; + } + } + } else if ($_POST['submit'] == "annonce"){ + //##################### + // ANNONCES + //##################### + if (isset($_POST['message']) && isset($_POST['couleur'])) { + $stmt = $pdo->prepare("INSERT INTO annonces (`emetteur`, `couleur`, `titre`, `message`, `visible`) VALUES (:emetteur, :couleur, :titre, :message, 1)"); + $stmt->bindParam(':emetteur', $_SESSION['userdata']['ID']); + $stmt->bindParam(':couleur', $_POST['couleur']); + $stmt->bindParam(':titre', $_POST['titre']); + $stmt->bindParam(':message', $_POST['message']); + if ($stmt->execute()) { + + // Récupération de l'ID de l'annonce ajoutée précédemment + $idAnnonce = $pdo->lastInsertId(); + + // Ajout de la publication associée à l'annonce + + foreach($_POST['groupe'] as $groupe) { + $stmt = $pdo->prepare("INSERT INTO publications (`type`, `id_pub`, `groupe`) VALUES (2, :idpub, :groupe)"); + $stmt->bindParam(':idpub', $idAnnonce); + $stmt->bindParam(':groupe', $groupe); + if(!$stmt->execute()) { + die("Erreur SQL" . $stmt->errorInfo()[2]); + } + } + + $erreur = "Annonce publiée"; + $now = getdate(); + $log = "A => " . sprintf("%02d", $now['mday']) . "/" . sprintf("%02d", $now['mon']) . "/" . $now['year'] . " " . sprintf("%02d", $now['hours']) . ":" . sprintf("%02d", $now['minutes']) . ":" . sprintf("%02d", $now['seconds']) . " -> " . $_SESSION['username'] . " a ajouté une annonce (" . $_POST['titre'] . ")\n"; + addlog($log, $log_dir); + } else { + $erreur = "Erreur : " . $stmt->errorInfo()[2]; + } + } + } else if ($_POST['submit'] == "popadmin") { + if (isset($_POST['id']) && !empty($_POST['id'])) { + $stmt = $pdo->prepare("UPDATE utilisateurs SET admin = 0 WHERE ID = :adminid"); + $stmt->bindParam(':adminid', $_POST['id']); + $stmt->execute(); + $erreur = "Utilisateur retiré des admins"; + } + } else if ($_POST['submit'] == "addadmin") { + if (isset($_POST['username']) && !empty($_POST['username'])) { + $stmt = $pdo->prepare("UPDATE utilisateurs SET admin = 1 WHERE username = :username"); + $stmt->bindParam(':username', $_POST['username']); + $stmt->execute(); + + if ($stmt->rowCount() > 0) { + $erreur = $_POST['username'] . " a rejoint le groupe des admins"; + } else { + $erreur = "Aucun admin ajouté"; + } + } + } else if ($_POST['submit'] == "deluser") { + if (isset($_POST['id']) && !empty($_POST['id'])) { + $stmt = $pdo->prepare("DELETE FROM utilisateurs WHERE ID = :userid"); + $stmt->bindParam(':userid', $_POST['id']); + $stmt->execute(); + $erreur = "Utilisateur supprimé"; + } + } +} + + +?> + + + +
+ +Sessions | " . $session_name . " | "; + } + ?> +
---|
Logs | " . current($logs_lines) . " | "; + }; + ?> +
---|
Gestion des utilisateurs |
---|
Utilisateurs |
Gestion des admins |
---|
Admins |
Ajouter un admin |
Toutes les données sensibles (MDP utilisateur, identifiants CAS) sont chiffrées dans la Base de données. Si vous voulez récupérer vos données : club@e59.fr
+ "; + footer(); + echo ""; + } + ?> + + "; + echo ""; + }; + ?> + diff --git a/html/devoirs.php b/html/devoirs.php new file mode 100644 index 0000000..2e87ad2 --- /dev/null +++ b/html/devoirs.php @@ -0,0 +1,72 @@ + + + + + + +Vous n'avez pas encore de compte ? Créer un compte
+ + + + + \ No newline at end of file diff --git a/html/logout.php b/html/logout.php new file mode 100644 index 0000000..2d55c51 --- /dev/null +++ b/html/logout.php @@ -0,0 +1,11 @@ + " . sprintf("%02d", $now['mday']) . "/" . sprintf("%02d", $now['mon']) . "/" . $now['year'] . " " .sprintf("%02d", $now['hours']) . ":" . sprintf("%02d", $now['minutes']) . ":" . sprintf("%02d", $now['seconds']) . " -> " . $_SESSION['username'] . " s'est déconnecté depuis " . $_SERVER['REMOTE_ADDR'] . "\n"; +addlog($log, $log_dir); +session_destroy(); +header('Location: login.php'); +exit(); +?> diff --git a/html/main.js b/html/main.js new file mode 100644 index 0000000..05df383 --- /dev/null +++ b/html/main.js @@ -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; +} diff --git a/html/notes.php b/html/notes.php new file mode 100644 index 0000000..68a4b88 --- /dev/null +++ b/html/notes.php @@ -0,0 +1,292 @@ + + + + + + +Erreur d'authentification CAS, vérifiez vos identifiants dans la page profil