cms.lottery.php 4.7 KB

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