cms.lottery.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. if (core::getGet("id") == NULL AND access::ifAccesss("add-lottery") == FALSE) {
  3. get::page("unknow");
  4. exit();
  5. }
  6. if (core::getGet("id") == NULL) {
  7. $titre = "Ajouter un tirage au sort";
  8. } else {
  9. $lottery = lottery::getFiche(core::getGet("id"));
  10. if(empty($lottery["id"])){
  11. get::page("unknow");
  12. exit();
  13. }
  14. $badgeCSS = " font-size:0.4em; margin-top:-5px;";
  15. $titre = "[#" . $lottery["id"] . "] " . $lottery["titre"];
  16. $dataLottery = lottery::getInscriptionData(core::getGet("id"));
  17. }
  18. $tab_fiche = $tab_inscrits = $tab_winners = "false";
  19. if(alert::ifTab()){
  20. switch (alert::getTab()) {
  21. case "inscrits-tab":
  22. $tab_inscrits = "true";
  23. break;
  24. case "winners-tab":
  25. $tab_winners = "true";
  26. break;
  27. default:
  28. $tab_fiche = "true";
  29. break;
  30. }
  31. } else {
  32. $tab_fiche = "true";
  33. }
  34. ?>
  35. <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
  36. <div class="row" style="width:100%;">
  37. <div class="col-11">
  38. <h2 class="bd-title" id="content">
  39. <?php echo $titre ?>
  40. </h2>
  41. </div>
  42. <?php if(isset($user["id"]) AND session::getId() != $user["id"]){ ?>
  43. <div style="float:right; margin: -30px;">
  44. </div>
  45. <div class="fix-container-button-nav">
  46. <a href="/submit.php?from=lottery-delete&id=<?php echo $lottery["id"] ?>" onclick="return confirm('Voulez-vous supprimer ce tirage au sort ?')"><button type="submit" class="btn btn-outline-danger btn-sm"><?php icon::getFont(["icon" => "bi-trash-fill"]) ?></i> Supprimer</button></a>
  47. </div>
  48. <?php } ?>
  49. </div>
  50. </header>
  51. <?php
  52. if(core::ifGet("add")) {
  53. $labelFil = "Ajouter un tirage au sort";
  54. $lienFil = "/?p=lottery&add=1";
  55. } else {
  56. $labelFil = "[#" . $lottery["id"] . "] " . $lottery["titre"];
  57. $lienFil = "/lottery-".core::getGet("id").".html";
  58. }
  59. echo core::filAriane(array(
  60. "current" => $labelFil,
  61. "arbo" => array(
  62. "Tirage au sort" => NULL,
  63. "Listes des tirages au sort" => "/lotterys.html",
  64. $labelFil => $lienFil)
  65. ));
  66. ?>
  67. <br />
  68. <ul class="nav nav-tabs" id="event-fiche" role="tablist">
  69. <li class="nav-item">
  70. <a class="nav-link<?php if($tab_fiche == "true"){ echo ' active'; } if(empty($lottery["id"])){ echo " disabled"; } ?>" data-toggle="tab" id="fiche-tab" role="tab" aria-selected="<?php echo $tab_fiche ?>">Fiche du tirage au sort</a>
  71. </li>
  72. <?php if(isset($lottery["id"])){ ?>
  73. <li class="nav-item">
  74. <a class="nav-link<?php if($tab_inscrits == "true"){ echo ' active'; } if(empty($lottery["id"])){ echo " disabled"; } ?>" data-toggle="tab" id="inscrits-tab" role="tab" aria-selected="<?php echo $tab_inscrits ?>">Inscriptions</a>
  75. </li>
  76. <?php
  77. if($dataLottery["inscrits"] > 0) {
  78. ?>
  79. <li class="nav-item">
  80. <a class="nav-link<?php if($tab_winners == "true"){ echo ' active'; } if(empty($lottery["id"])){ echo " disabled"; } ?>" data-toggle="tab" id="winners-tab" role="tab" aria-selected="<?php echo $tab_winners ?>">Tirage au sort</a>
  81. </li>
  82. <?php } } ?>
  83. </ul>
  84. <br />
  85. <div class="tab-content">
  86. <div id="tab-fiche"<?php if($tab_fiche == "false"){ echo ' style="display: none;"'; } ?>>
  87. <?php get::page("lottery-fiche") ?>
  88. </div>
  89. <?php if(isset($lottery["id"])){ ?>
  90. <div id="tab-inscrits"<?php if($tab_inscrits == "false"){ echo ' style="display: none;"'; } ?>>
  91. <?php get::page("lottery-inscrits") ?>
  92. </div>
  93. <?php
  94. if($dataLottery["inscrits"] > 0) {
  95. ?>
  96. <div id="tab-winners"<?php if($tab_winners == "false"){ echo ' style="display: none;"'; } ?>>
  97. <?php get::page("lottery-winners") ?>
  98. </div>
  99. <?php } } ?>
  100. </div>
  101. <script>
  102. $(document).ready(function(){
  103. $("#fiche-tab").click(function() {
  104. $("#tab-fiche").show();
  105. $("#tab-inscrits").hide();
  106. $("#tab-winners").hide();
  107. });
  108. <?php if(isset($lottery["id"])){ ?>
  109. $("#inscrits-tab").click(function() {
  110. $("#tab-fiche").hide();
  111. $("#tab-inscrits").show();
  112. $("#tab-winners").hide();
  113. });
  114. $("#winners-tab").click(function() {
  115. $("#tab-fiche").hide();
  116. $("#tab-inscrits").hide();
  117. $("#tab-winners").show();
  118. });
  119. <?php } ?>
  120. })
  121. </script>
  122. <?php if(isset($lottery["id"]) AND isset($lottery["type_emargement"]) AND $lottery["type_emargement"] != 1){ ?>
  123. <div class="modal fade" id="QRCodeModal" tabindex="-1" role="dialog" aria-hidden="true">
  124. <div class="modal-dialog modal-dialog-centered" role="document">
  125. <div class="modal-content">
  126. <div class="modal-body">
  127. <?php echo event::getQRCode($lottery["id"], "100%") ?>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <?php } ?>