2
0

cms.lottery.php 4.8 KB

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