apiTableauFromClassement.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. require_once "libs/fnMain.php";
  3. /**************************
  4. * Contrôle du token JWT
  5. **************************/
  6. if (!isset($_GET["jwt"], $_SETTINGS["jwt_secret"])) {
  7. echo "Manque d'arguments";
  8. die();
  9. }
  10. verifyJWTtoken($_GET["jwt"], $_SETTINGS["jwt_secret"]);
  11. /**************************
  12. * Contrôle du statut premium de l'utilisateur
  13. **************************/
  14. verifyUserPremium($_GET["jwt"]);
  15. /**************************
  16. * GENERATION DES CLASSEMENTS
  17. **************************/
  18. $isClassementValid = isset($_GET["classement"]) && (int) $_GET["classement"] !== 0;
  19. if ($isClassementValid) {
  20. $rangMoyen = (int) $_GET["classement"];
  21. // HTML renvoyé au site
  22. $html = <<<EOF
  23. <!doctype html>
  24. <html lang="fr">
  25. <head>
  26. <meta charset="UTF-8">
  27. <meta name="viewport"
  28. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  29. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  30. <title>RangLimier</title>
  31. <link rel="stylesheet" href="assets/bootstrap.min.css">
  32. <link rel="stylesheet" href="assets/divers.css">
  33. </head>
  34. <body>
  35. <h1>RangLimier</h1>
  36. <p>Cet outil permet, en entrant un classement (réel ou supposé), de voir les choix disponibles à ce classement. <br>
  37. <i>Attention : Cet outil est à but purement indicatif !</i>
  38. </p>
  39. <style>
  40. /* Tableau */
  41. table {
  42. font-size: 13px;
  43. text-align: center;
  44. border-collapse: collapse;
  45. white-space: nowrap;
  46. overflow: auto;
  47. }
  48. th, td {
  49. padding: 2px;
  50. border: 1px solid black;
  51. --text-color: lightgrey;
  52. }
  53. .all-choices {
  54. background-color: #28a745;
  55. /* color: #8fd19e; */
  56. color: white;
  57. }
  58. .half-choices {
  59. background-color: #8fd19e;
  60. color: black;
  61. }
  62. .last-choice {
  63. background-color: #ffdf7e;
  64. color: grey;
  65. }
  66. .no-choice {
  67. background-color: #ed969e;
  68. }
  69. .never-available {
  70. background-color: lightgrey;
  71. }
  72. </style>
  73. <h2>Tableau de classement pour le rang {$rangMoyen}</h2>
  74. <!--
  75. <h3>Légende</h3>
  76. <table>
  77. <thead>
  78. <th colspan="5">Légende (sur toutes les années)</th>
  79. </thead>
  80. <tbody>
  81. <tr>
  82. <td>Jamais proposé</td>
  83. <td class="no-choice">Aucun choix</td>
  84. <td class="last-choice">Une seule année</td>
  85. <td class="half-choices">Plusieurs choix</td>
  86. <td class="all-choices">Tous les choix</td>
  87. </tr>
  88. </tbody>
  89. </table> -->
  90. <p>
  91. Chaque nombre dans chaque case correspond au nombre d'années où ce choix était dispo au classement rentré <br>
  92. </p>
  93. EOF;
  94. require "apiDisplay.php";
  95. } else {
  96. echo "Classement entré incorrect.";
  97. }