2
0

event.class.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <?php
  2. class event
  3. {
  4. public static function getFiche(int $_id)
  5. {
  6. db::query("SELECT * FROM " . DB_T_EVENTS . " WHERE id = :id");
  7. db::bind(':id', $_id);
  8. return db::single();
  9. }
  10. public static function getFicheByMd5(string $_md5)
  11. {
  12. db::query("SELECT * FROM " . DB_T_EVENTS . " WHERE md5 = :md5");
  13. db::bind(':md5', $_md5);
  14. return db::single();
  15. }
  16. public static function getQRCode(int $_id, $_width = 50, string $_link = NULL)
  17. {
  18. db::query("SELECT md5 FROM " . DB_T_EVENTS . " WHERE id = :id");
  19. db::bind(':id', $_id);
  20. $md5 = db::single()["md5"];
  21. $link = core::base64_url_encode("https://" . DOMAIN_EVENTS . "/?e=" . $md5);
  22. if ($_link == NULL) {
  23. return '<img src="/qrcode.php?q= ' . $link . '" width="' . $_width . '" >';
  24. } else {
  25. return '<a href="https://' . DOMAIN_EVENTS . '/qrcode.php?q=' . $link . '" target="_blank"><img src="/qrcode.php?q= ' . $link . '" width="' . $_width . '" ></a>';
  26. }
  27. }
  28. public static function add()
  29. {
  30. db::query("INSERT INTO " . DB_T_EVENTS . " (md5, titre, description, startDate, endDate, type_emargement, type_inscription, actif, id_user) VALUES (:md5, :titre, :description, :startDate, :endDate, :type_emargement, :type_inscription, :actif, :id_user)");
  31. db::bind(':md5', md5(time().rand(1000000000, 9999999999)));
  32. db::bind(':titre', core::getPost("titre"));
  33. db::bind(':description', core::getPost("description"));
  34. db::bind(':startDate', core::getPost("startDate"));
  35. db::bind(':endDate', core::getPost("endDate"));
  36. db::bind(':type_emargement', core::getPost("type_emargement"));
  37. db::bind(':type_inscription', core::getPost("type_inscription"));
  38. db::bind(':actif', core::getPost("actif"));
  39. db::bind(':id_user', session::getId());
  40. try {
  41. db::execute();
  42. return TRUE;
  43. } catch (Exception $ex) {
  44. return FALSE;
  45. }
  46. }
  47. public static function update()
  48. {
  49. db::query("UPDATE " . DB_T_EVENTS . " SET "
  50. . "titre = :titre, "
  51. . "description = :description, "
  52. . "startDate = :startDate, "
  53. . "endDate = :endDate, "
  54. . "type_emargement = :type_emargement, "
  55. . "type_inscription = :type_inscription, "
  56. . "actif = :actif, "
  57. . "id_user = :id_user "
  58. . "WHERE id = :id");
  59. db::bind(':titre', core::getPost("titre"));
  60. db::bind(':description', core::getPost("description"));
  61. db::bind(':startDate', core::getPost("startDate"));
  62. db::bind(':endDate', core::getPost("endDate"));
  63. db::bind(':type_emargement', core::getPost("type_emargement"));
  64. db::bind(':type_inscription', core::getPost("type_inscription"));
  65. db::bind(':actif', core::getPost("actif"));
  66. db::bind(':id_user', session::getId());
  67. db::bind(':id', core::getPost("id"));
  68. try {
  69. db::execute();
  70. return TRUE;
  71. } catch (Exception $ex) {
  72. return FALSE;
  73. }
  74. }
  75. public static function subscribe(int $_salarie = NULL)
  76. {
  77. if($_salarie == NULL){
  78. $salarie = core::getPost("salarie");
  79. } else {
  80. $salarie = $_salarie;
  81. }
  82. db::query("INSERT INTO " . DB_T_EVENTS_INSCRITS . " (id_evenement, id_salarie, sel, id_user) VALUES (:id_evenement, :id_salarie, :sel, :id_user)");
  83. db::bind(':sel', md5(core::getPost("event")."-".time().rand(100000000000000, 999999999999999)));
  84. db::bind(':id_evenement', core::getPost("event"));
  85. db::bind(':id_salarie', $salarie);
  86. db::bind(':id_user', session::getId());
  87. try {
  88. db::execute();
  89. return TRUE;
  90. } catch (Exception $ex) {
  91. return FALSE;
  92. }
  93. }
  94. public static function unsubscribe()
  95. {
  96. db::query("DELETE FROM " . DB_T_EVENTS_INSCRITS . " WHERE id_evenement = :id_evenement AND id_salarie = :id_salarie");
  97. db::bind(':id_evenement', core::getPost("event"));
  98. db::bind(':id_salarie', core::getPost("salarie"));
  99. try {
  100. db::execute();
  101. return TRUE;
  102. } catch (Exception $ex) {
  103. return FALSE;
  104. }
  105. }
  106. public static function getEvents()
  107. {
  108. db::query("SELECT "
  109. . "" . DB_T_EVENTS . ".id, "
  110. . "" . DB_T_EVENTS . ".md5, "
  111. . "" . DB_T_EVENTS . ".titre, "
  112. . "" . DB_T_EVENTS . ".description, "
  113. . "" . DB_T_EVENTS . ".startDate, "
  114. . "COUNT(" . DB_T_EVENTS_INSCRITS . ".id_salarie) AS m_global, "
  115. . "COUNT(" . DB_T_EVENTS_INSCRITS . ".present) AS m_inscrit, "
  116. . "" . DB_T_EVENTS . ".endDate, "
  117. . "TIMESTAMPDIFF(HOUR, " . DB_T_EVENTS . ".startDate, " . DB_T_EVENTS . ".endDate) AS pastHours, "
  118. . "IF(" . DB_T_EVENTS . ".type_emargement = 1, 'Contôle', IF(" . DB_T_EVENTS . ".type_emargement = 2, 'Autonome', 'Contrôle & Autonome')) AS type_emargement, "
  119. . "IF(" . DB_T_EVENTS . ".type_inscription = 1, 'Incription', 'Libre') AS type_inscription, "
  120. . "" . DB_T_EVENTS . ".actif, "
  121. . "" . DB_T_EVENTS . ".cree, "
  122. . "" . DB_T_EVENTS . ".maj, "
  123. . "CONCAT (" . DB_T_USER . ".prenom, ' ', " . DB_T_USER . ".nom) AS 'user' "
  124. . "FROM " . DB_T_EVENTS . " "
  125. . "LEFT JOIN " . DB_T_EVENTS_INSCRITS . " ON " . DB_T_EVENTS_INSCRITS . ".id_evenement = " . DB_T_EVENTS . ".id "
  126. . "INNER JOIN " . DB_T_USER . " ON " . DB_T_EVENTS . ".id_user = " . DB_T_USER . ".id "
  127. . "GROUP BY 1");
  128. return db::resultset();
  129. }
  130. public static function getInscriptions()
  131. {
  132. db::query("SELECT "
  133. . "" . DB_T_SALARIES . ".id, "
  134. . "" . DB_T_SALARIES . ".idLocal, "
  135. . "" . DB_T_SALARIES . ".loginId, "
  136. . "" . DB_T_SALARIES . ".nom, "
  137. . "" . DB_T_SALARIES . ".prenom, "
  138. . "" . DB_T_SALARIES . ".sexe, "
  139. . "" . DB_T_SALARIES . ".contrat, "
  140. . "" . DB_T_SALARIES_PROWEB . ".dateNaissance, "
  141. . "" . DB_T_SALARIES . ".lieu, "
  142. . "" . DB_T_SALARIES . ".actif, "
  143. . "IF(" . DB_T_EVENTS_INSCRITS . ".id_salarie IS NOT NULL, 1, 0) AS inscrit, "
  144. . "" . DB_T_EVENTS_INSCRITS . ".present "
  145. . "FROM " . DB_T_SALARIES . " "
  146. . "LEFT JOIN " . DB_T_SALARIES_PROWEB . " ON " . DB_T_SALARIES . ".loginId = " . DB_T_SALARIES_PROWEB . ".loginId "
  147. . "LEFT JOIN " . DB_T_EVENTS_INSCRITS . " ON " . DB_T_SALARIES . ".id = " . DB_T_EVENTS_INSCRITS . ".id_salarie "
  148. . "AND " . DB_T_EVENTS_INSCRITS . ".id_evenement = " . core::getGet("id"));
  149. return db::resultset();
  150. }
  151. public static function connectSalarie(array $_post)
  152. {
  153. if (empty($_post["ident"])) {
  154. return FALSE;
  155. } elseif (empty($_post["date"])) {
  156. return FALSE;
  157. }
  158. if (is_int($_post["ident"])) {
  159. $login = intval($_post["ident"]);
  160. } else {
  161. $login = $_post["ident"];
  162. }
  163. $date = new DateTime($_post["date"]);
  164. $date = $date->format('Y-m-d H:i:s');
  165. db::query("SELECT "
  166. . "" . DB_T_SALARIES . ".id, "
  167. . "" . DB_T_SALARIES . ".sel, "
  168. . "" . DB_T_SALARIES . ".nom, "
  169. . "" . DB_T_SALARIES_PROWEB . ".dateNaissance, "
  170. . "" . DB_T_SALARIES . ".prenom, "
  171. . "" . DB_T_SALARIES . ".actif, "
  172. . "" . DB_T_SALARIES . ".contrat, "
  173. . "" . DB_T_SALARIES . ".jourEntree "
  174. . "FROM " . DB_T_SALARIES . " "
  175. . "INNER JOIN " . DB_T_SALARIES_PROWEB . " ON " . DB_T_SALARIES . ".loginId = " . DB_T_SALARIES_PROWEB . ".loginId "
  176. . "WHERE " . DB_T_SALARIES . ".loginId = :login OR " . DB_T_SALARIES . ".idLocal = :login");
  177. db::bind(':login', $login);
  178. $salarie = db::single();
  179. if (isset($salarie["id"])) {
  180. if ($salarie["actif"] == 0) {
  181. return FALSE;
  182. } elseif (core::dateWhithoutHours($salarie["dateNaissance"]) != core::dateWhithoutHours($date)) {
  183. return FALSE;
  184. } else {
  185. $_SESSION["salarie"] = array(
  186. "id" => $salarie["id"],
  187. "sel" => $salarie["sel"],
  188. "nom" => $salarie["nom"],
  189. "prenom" => $salarie["prenom"]
  190. );
  191. return TRUE;
  192. }
  193. } else {
  194. return FALSE;
  195. }
  196. return FALSE;
  197. }
  198. public static function lastEvenement()
  199. {
  200. db::query("SELECT MAX(id) AS id FROM " . DB_T_EVENTS);
  201. return db::single()["id"];
  202. }
  203. public static function getIdEvenementByMd5(string $_md5)
  204. {
  205. db::query("SELECT id FROM " . DB_T_EVENTS . " WHERE md5 = :md5");
  206. db::bind(':md5', $_md5);
  207. return db::single()["id"];
  208. }
  209. public static function presentEvenement(int $_idSalarie)
  210. {
  211. db::query("SELECT "
  212. . "" . DB_T_EVENTS . ".id, "
  213. . "" . DB_T_EVENTS . ".md5, "
  214. . "" . DB_T_EVENTS . ".titre, "
  215. . "" . DB_T_EVENTS . ".startDate, "
  216. . "" . DB_T_EVENTS . ".endDate, "
  217. . "" . DB_T_EVENTS . ".type_emargement, "
  218. . "" . DB_T_EVENTS_INSCRITS . ".sel, "
  219. . "" . DB_T_EVENTS_INSCRITS . ".present "
  220. . "FROM " . DB_T_EVENTS . " "
  221. . "LEFT JOIN " . DB_T_EVENTS_INSCRITS . " ON " . DB_T_EVENTS_INSCRITS . ".id_evenement = " . DB_T_EVENTS . ".id AND " . DB_T_EVENTS_INSCRITS . ".id_salarie = :id_salarie "
  222. . "WHERE " . DB_T_EVENTS . ".startDate <= CURRENT_TIMESTAMP() "
  223. . "AND " . DB_T_EVENTS . ".endDate >= CURRENT_TIMESTAMP() "
  224. . "AND ((" . DB_T_EVENTS . ".type_inscription = 1 AND " . DB_T_EVENTS_INSCRITS . ".id_salarie = :id_salarie) OR (" . DB_T_EVENTS . ".type_inscription = 0))"
  225. . "AND " . DB_T_EVENTS . ".actif = 1");
  226. db::bind(':id_salarie', $_idSalarie);
  227. $row = db::resultset();
  228. return $row;
  229. }
  230. public static function deleteEvenement(int $_id)
  231. {
  232. db::query("DELETE FROM " . DB_T_EVENTS . " WHERE id = :id");
  233. db::bind(':id', $_id);
  234. return db::execute();
  235. }
  236. public static function deleteInscriptionEvenement(int $_idEvenement)
  237. {
  238. db::query("DELETE FROM " . DB_T_EVENTS_INSCRITS . " WHERE id_evenement = :id_evenement");
  239. db::bind(':id_evenement', $_idEvenement);
  240. return db::execute();
  241. }
  242. public static function checkUrl(string $_url)
  243. {
  244. return parse_url($_url)["host"];
  245. }
  246. public static function getEvenementbyQRCode(string $_QRCode)
  247. {
  248. $query = parse_url($_QRCode)["query"];
  249. parse_str($query, $params);
  250. return $params;
  251. }
  252. public static function checkEmargement(int $_id_evenement)
  253. {
  254. db::query("SELECT "
  255. . "COUNT(present) AS nb "
  256. . "FROM " . DB_T_EVENTS_INSCRITS . " "
  257. . "WHERE " . DB_T_EVENTS_INSCRITS . ".id_evenement = :id_evenement");
  258. db::bind(':id_evenement', $_id_evenement);
  259. $nb = db::single()["nb"];
  260. return $nb;
  261. }
  262. public static function getInscriptionEvenementById(int $_id_evenement, int $_id_salarie)
  263. {
  264. db::query("SELECT "
  265. . "" . DB_T_EVENTS_INSCRITS . ".id_salarie, "
  266. . "" . DB_T_EVENTS_INSCRITS . ".present, "
  267. . "" . DB_T_EVENTS . ".titre "
  268. . "FROM " . DB_T_EVENTS_INSCRITS . " "
  269. . "INNER JOIN " . DB_T_EVENTS . " ON " . DB_T_EVENTS_INSCRITS . ".id_evenement = " . DB_T_EVENTS . ".id "
  270. . "WHERE " . DB_T_EVENTS_INSCRITS . ".id_salarie = :id_salarie AND " . DB_T_EVENTS_INSCRITS . ".id_evenement = :id_evenement");
  271. db::bind(':id_salarie', $_id_salarie);
  272. db::bind(':id_evenement', $_id_evenement);
  273. $inscription = db::single();
  274. return $inscription;
  275. }
  276. public static function getInscription(int $_id_event){
  277. db::query("SELECT "
  278. . "" . DB_T_SALARIES . ".id, "
  279. . "" . DB_T_SALARIES . ".loginId, "
  280. . "" . DB_T_SALARIES . ".idLocal, "
  281. . "" . DB_T_SALARIES_PROWEB . ".dateNaissance, "
  282. . "" . DB_T_SALARIES . ".jourEntree, "
  283. . "" . DB_T_SALARIES . ".nom, "
  284. . "" . DB_T_SALARIES . ".prenom, "
  285. . "" . DB_T_SALARIES . ".sexe, "
  286. . "" . DB_T_SALARIES . ".contrat, "
  287. . "" . DB_T_SALARIES . ".lieu, "
  288. . "" . DB_T_SALARIES . ".actif, "
  289. . "" . DB_T_EVENTS_INSCRITS . ".id_evenement, "
  290. . "CONCAT (" . DB_T_USER . ".prenom, ' ', " . DB_T_USER . ".nom) AS 'nameAdminPresent', "
  291. . "" . DB_T_EVENTS_INSCRITS . ".present "
  292. . "FROM " . DB_T_SALARIES . " "
  293. . "INNER JOIN " . DB_T_EVENTS_INSCRITS . " ON " . DB_T_EVENTS_INSCRITS . ".id_salarie = " . DB_T_SALARIES . ".id "
  294. . "LEFT JOIN " . DB_T_SALARIES_PROWEB . " ON " . DB_T_SALARIES . ".loginId = " . DB_T_SALARIES_PROWEB . ".loginId "
  295. . "LEFT JOIN " . DB_T_USER . " ON " . DB_T_EVENTS_INSCRITS . ".id_admin_present = " . DB_T_USER . ".id "
  296. . "WHERE " . DB_T_EVENTS_INSCRITS . ".id_evenement = " . $_id_event);
  297. return db::resultset();
  298. }
  299. public static function checkEvenementBySalarie(string $_md5)
  300. {
  301. $return = array();
  302. $now = time();
  303. db::query("SELECT "
  304. . "" . DB_T_SALARIES . ".id, "
  305. . "" . DB_T_SALARIES . ".actif, "
  306. . "" . DB_T_SALARIES . ".contrat "
  307. . "FROM " . DB_T_SALARIES . " "
  308. . "WHERE " . DB_T_SALARIES . ".id = :id");
  309. db::bind(':id', session::getId("salarie"));
  310. $salarie = db::single();
  311. db::query("SELECT "
  312. . "" . DB_T_EVENTS_INSCRITS . ".id_salarie, "
  313. . "" . DB_T_EVENTS_INSCRITS . ".present "
  314. . "FROM " . DB_T_EVENTS . " "
  315. . "LEFT JOIN " . DB_T_EVENTS_INSCRITS . " ON " . DB_T_EVENTS_INSCRITS . ".id_evenement = " . DB_T_EVENTS . ".id "
  316. . "WHERE " . DB_T_EVENTS_INSCRITS . ".id_salarie = :id_salarie AND " . DB_T_EVENTS . ".md5 = :md5");
  317. db::bind(':id_salarie', session::getId("salarie"));
  318. db::bind(':md5', $_md5);
  319. $inscription = db::single();
  320. db::query("SELECT "
  321. . "" . DB_T_EVENTS . ".id, "
  322. . "" . DB_T_EVENTS . ".md5, "
  323. . "" . DB_T_EVENTS . ".titre, "
  324. . "" . DB_T_EVENTS . ".startDate, "
  325. . "" . DB_T_EVENTS . ".endDate, "
  326. . "" . DB_T_EVENTS . ".type_emargement, "
  327. . "" . DB_T_EVENTS . ".type_inscription, "
  328. . "" . DB_T_EVENTS . ".actif "
  329. . "FROM " . DB_T_EVENTS . " "
  330. . "WHERE " . DB_T_EVENTS . ".md5 = :md5");
  331. db::bind(':md5', $_md5);
  332. $evenement = db::single();
  333. if ($salarie["id"] == NULL) {
  334. $return["result"] = FALSE;
  335. $return["description"] = "Vous n'êtes pas un salarié rattaché à notre CSE";
  336. } elseif ($salarie["actif"] == 0) {
  337. $return["result"] = FALSE;
  338. $return["description"] = "Vous n'êtes plus un salarié rattaché à notre CSE";
  339. } elseif ($evenement["actif"] == 0) {
  340. $return["result"] = FALSE;
  341. $return["description"] = "Cet évènement n'est pas activée";
  342. } elseif ($evenement["type_inscription"] == 1 and $inscription["id_salarie"] == NULL) {
  343. $return["result"] = FALSE;
  344. $return["description"] = "Vous n'êtes pas inscrit à cet évènement";
  345. } elseif ($now < strtotime($evenement["startDate"])) {
  346. $return["result"] = FALSE;
  347. $return["description"] = "Cet évènement n'a pas encore commencé";
  348. } elseif ($now > (strtotime($evenement["endDate"]) + EMEMARGEMENT_END)) {
  349. $return["result"] = FALSE;
  350. $return["description"] = "Cet évènement est terminé";
  351. } elseif (isset($inscription["present"])) {
  352. $return["result"] = FALSE;
  353. $return["description"] = "Votre émargement a déjà été pris en compte<br />le " . core::convertDate($inscription["present"]);
  354. } else {
  355. $return["result"] = TRUE;
  356. $return["description"] = "Votre émargement a été pris en compte";
  357. }
  358. $return["evenement"] = $evenement["titre"];
  359. return $return;
  360. }
  361. public static function emargementEvenement(int $_idEvenement, int $_idSalarie, int $_idAdmin = NULL)
  362. {
  363. $inscription = self::getInscriptionEvenementById($_idEvenement, $_idSalarie);
  364. $evenement = self::getFiche($_idEvenement);
  365. if (!isset($inscription["present"]) or empty($inscription["present"])) {
  366. if (isset($inscription["id_salarie"])) {
  367. db::query("UPDATE " . DB_T_EVENTS_INSCRITS . " SET present = CURRENT_TIMESTAMP(), id_admin_present = :id_admin_present WHERE id_evenement = :id_evenement AND id_salarie = :id_salarie");
  368. db::bind(':id_evenement', $_idEvenement);
  369. db::bind(':id_salarie', $_idSalarie);
  370. db::bind(':id_admin_present', $_idAdmin);
  371. db::execute();
  372. $return["result"] = TRUE;
  373. $return["evenement"] = $evenement["titre"];
  374. $return["description"] = "L'émargement a été pris en compte";
  375. } else {
  376. db::query("INSERT INTO " . DB_T_EVENTS_INSCRITS . " (id_evenement, id_salarie, present, id_admin_present) "
  377. . "VALUES (:id_evenement, :id_salarie, CURRENT_TIMESTAMP(), :id_admin_present)");
  378. db::bind(':id_evenement', $_idEvenement);
  379. db::bind(':id_salarie', $_idSalarie);
  380. db::bind(':id_admin_present', $_idAdmin);
  381. db::execute();
  382. $return["result"] = TRUE;
  383. $return["evenement"] = $evenement["titre"];
  384. $return["description"] = "L'émargement a été pris en compte";
  385. }
  386. } else {
  387. $return["result"] = FALSE;
  388. $return["description"] = "Emargement déjà pris en compte le " . core::convertDate($inscription["present"]);
  389. }
  390. return $return;
  391. }
  392. public static function emargementEvenementByQRCode()
  393. {
  394. $idSalarie = core::getGet("s");
  395. $md5Evenement = core::getGet("e");
  396. $key = core::getGet("k");
  397. $salarie = salaries::getSalarieById($idSalarie);
  398. $constructKey = md5($md5Evenement . $salarie["sel"]);
  399. if ($constructKey == $key) {
  400. $checkEmarge = self::emargementEvenement(self::getIdEvenementByMd5($md5Evenement), $salarie["id"]);
  401. return $checkEmarge;
  402. } else {
  403. $return["result"] = FALSE;
  404. $return["description"] = "Le QR-Code n'est pas valide";
  405. return $return;
  406. }
  407. }
  408. public static function printEventBouton(array $_array)
  409. {
  410. switch ($_array["nb"]) {
  411. case 0:
  412. $class_fadeIn = "first";
  413. break;
  414. case 1:
  415. $class_fadeIn = "second";
  416. break;
  417. case 2:
  418. $class_fadeIn = "third";
  419. break;
  420. case 3:
  421. $class_fadeIn = "fourth";
  422. break;
  423. default:
  424. $class_fadeIn = "fifth";
  425. break;
  426. }
  427. if ($_array["type_emargement"] == 1) {
  428. $explication = '<p class="card-text">
  429. <div>[ QRCode à présenter à votre arrivée ]</div>
  430. <br />
  431. <div><i class="bi bi-fullscreen" style="font-size:2rem"></i></div>
  432. </p>';
  433. $meta = 'data-toggle="modal" data-target="#QRCodeModal" data-qrr-qrcode-regexp="^https?:\/\/" data-sel="' . $_array["url_qrcode"] . '" data-titre="' . $_array["titre"] . '"';
  434. $class_card = 'showQRCode';
  435. $txt["footer"] = "Cliquez ici pour afficher votre QRCode";
  436. } else {
  437. $explication = '<p class="card-text">
  438. <div>[ QRCode à flasher vous même ]</div>
  439. <br />
  440. <div><i class="bi bi-camera-video" style="font-size:2rem"></i></div>
  441. </p>';
  442. $meta = 'data-event="' . $_array["md5"] . '" data-qrr-target="#QRCodeRead" ';
  443. $class_card = 'qrcodeReader';
  444. $txt["footer"] = "Cliquez ici pour scanner le QRCode";
  445. }
  446. if (isset($_array["present"])) {
  447. $meta = "";
  448. $explication = '<p class="card-text">Votre émargement a bien été pris en compte</p>';
  449. $class["card-text"] = "text-success";
  450. $class["card"] = "";
  451. $txt["footer"] = "Emargement réalisé le " . core::convertDate($_array["present"]);
  452. } else {
  453. $class["card-text"] = "text-dark";
  454. $class["card"] = $class_card;
  455. }
  456. echo ' <div ' . $meta . ' class="card mb-3 text-center ' . $class["card"] . ' ' . $class["card-text"] . ' fadeIn ' . $class_fadeIn . '">
  457. <div class="card-header"><small>Du ' . core::convertDate($_array["startDate"]) . ' au ' . core::convertDate($_array["endDate"]) . '</small></div>
  458. <div class="card-body">
  459. <h5 class="card-title">' . $_array["titre"] . '</h5>
  460. ' . $explication . '
  461. </div>
  462. <div class="card-footer"><small>' . $txt["footer"] . '</small></div>
  463. </div>';
  464. }
  465. public static function printIconeResultFlash(string $_result)
  466. {
  467. if ($_result == 1) {
  468. echo ' <div class="swal2-icon swal2-success swal2-animate-success-icon" style="display: flex;">
  469. <div class="swal2-success-circular-line-left" style="background-color: rgb(255, 255, 255);"></div>
  470. <span class="swal2-success-line-tip"></span>
  471. <span class="swal2-success-line-long"></span>
  472. <div class="swal2-success-ring"></div>
  473. <div class="swal2-success-fix" style="background-color: rgb(255, 255, 255);"></div>
  474. <div class="swal2-success-circular-line-right" style="background-color: rgb(255, 255, 255);"></div>
  475. </div>';
  476. } else {
  477. echo ' <div class="swal2-icon swal2-error swal2-animate-error-icon" style="display: flex;">
  478. <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>
  479. </div>';
  480. }
  481. }
  482. }