list.html.php 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <h2>Traitement des <?php echo strtolower($title); ?></h2>
  2. <div id="alert"></div>
  3. <?php if($title == "Documents" || $title == "Promotions")
  4. {
  5. echo '<div style="text-align:right">
  6. <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#addForm" aria-expanded="false" aria-controls="addForm">
  7. Ajouter
  8. </button>
  9. </div>';
  10. }
  11. else if($title == "Données")
  12. {
  13. echo '<div style="text-align:right">
  14. <a href="data/extract" class="btn btn-primary">
  15. Tout télécharger (format CSV)
  16. </a>
  17. </div>';
  18. }
  19. ?>
  20. <form class="collapse" id="addForm">
  21. <?php
  22. switch($title)
  23. {
  24. case "Documents":
  25. echo '<div class="well">
  26. <div class="form-group">
  27. <label for="promo">Promotion :</label>
  28. <select id="promo">';
  29. foreach($promos as $promo)
  30. {
  31. echo '<option value="'.$promo["Identifiant"].'">'.$promo["Libellé"].'</option>';
  32. }
  33. echo '<option value=""></option>
  34. </select>
  35. </div>
  36. <div class="form-group">
  37. <label class="control-label" for="rang">Rang :</label>
  38. <input type="number" class="form-control" id="rang" />
  39. </div>
  40. <div class="form-group">
  41. <label class="control-label" for="libelle">Libellé : </label>
  42. <input type="text" class="form-control" id="libelle" placeholder="Libellé" />
  43. </div>
  44. <div class="form-group">
  45. <label class="control-label" for="file">Fichier :</label>
  46. <input type="file" id="file" />
  47. </div>
  48. <div class="form-group">
  49. <input type="submit" class="form-control" value="Ajouter le document" id="formsubmit" />
  50. </div>
  51. </div>';
  52. break;
  53. case "Promotions":
  54. echo '<div class="well">
  55. <div class="form-group">
  56. <label class="control-label" for="id">Identifiant :</label>
  57. <input type="text" class="form-control" id="id" placeholder="Identifiant" />
  58. </div>
  59. <div class="form-group">
  60. <label class="control-label" for="libelle">Libellé : </label>
  61. <input type="text" class="form-control" id="libelle" placeholder="Libellé" />
  62. </div>
  63. <div class="form-group">
  64. <input type="submit" class="form-control" value="Ajouter la promotion" id="formsubmit" />
  65. </div>
  66. </div>';
  67. break;
  68. }
  69. ?>
  70. </form>
  71. <table class="table tablesorter table-striped" id="mainTable">
  72. <thead>
  73. <?php foreach ($data[0] as $key => $value) {
  74. if ($key != "id") {
  75. ?>
  76. <th class="th-inner sortable both" style="cursor:pointer"><?php echo $key; ?></th>
  77. <?php
  78. }
  79. }
  80. if ($title != "Données") {
  81. ?>
  82. <th>Opérations</th>
  83. <?php
  84. }
  85. ?>
  86. </thead>
  87. <tbody>
  88. <?php foreach ($data as $element) {
  89. ?>
  90. <tr id="<?php echo $element["id"]; ?>">
  91. <?php
  92. foreach ($element as $field => $value) {
  93. if ($field != "id") {
  94. if (is_array($value)) {
  95. ?>
  96. <td class="<?php echo $value["id"]; ?>"><?php echo $value["libelle"]; ?></td>
  97. <?php
  98. } else {
  99. ?>
  100. <td><?php echo $value; ?></td>
  101. <?php
  102. }
  103. }
  104. }
  105. if ($title != "Données") {
  106. ?>
  107. <td><i class="fa fa-pencil" style="cursor:pointer"></i>&nbsp;&nbsp;&nbsp;<i class="fa fa-trash-o"
  108. style="cursor:pointer"></i>
  109. </td>
  110. <?php
  111. }
  112. ?>
  113. </tr>
  114. <?php
  115. }
  116. ?>
  117. </tbody>
  118. </table>