stany.ferer преди 2 години
родител
ревизия
4da2878d9d
променени са 3 файла, в които са добавени 51 реда и са изтрити 4 реда
  1. 46 0
      core/submit/cms.event-export-inscription.php
  2. 0 1
      core/submit/cms.parametres-reset-datas.php
  3. 5 3
      core/views/pages/cms.evenement-inscrits.php

+ 46 - 0
core/submit/cms.event-export-inscription.php

@@ -0,0 +1,46 @@
+<?php
+
+error_reporting(E_ALL);
+ini_set("display_errors", 1);
+
+if (core::ifGet("from") AND core::getGet("from") == "event-export-inscription") {
+
+    db::query("SELECT "
+                . "" . DB_T_SALARIES . ".id, "
+                . "" . DB_T_SALARIES . ".loginId, "
+                . "" . DB_T_SALARIES . ".nom, "
+                . "" . DB_T_SALARIES . ".prenom, "
+                . "" . DB_T_SALARIES . ".sexe, "
+                . "" . DB_T_SALARIES . ".contrat, "
+                . "" . DB_T_SALARIES . ".lieu, "
+                . "" . DB_T_SALARIES . ".actif, "
+                . "" . DB_T_EVENTS_INSCRITS . ".id_evenement, "
+                . "" . DB_T_EVENTS_INSCRITS . ".present "
+                . "FROM " . DB_T_SALARIES . " "
+                . "INNER JOIN " . DB_T_EVENTS_INSCRITS . " ON " . DB_T_EVENTS_INSCRITS . ".id_salarie = " . DB_T_SALARIES . ".id "
+                . "WHERE " . DB_T_EVENTS_INSCRITS . ".id_evenement = " . core::getGet("id"));
+                $row = db::resultset();
+
+    $tmpList = 'inscripts-evenement-' . core::getGet("id") . '.csv';
+
+    $csv = fopen(DIR_TEMP . $tmpList , 'w'); 
+    fputcsv($csv, array("id", "loginId", "nom", "prenom", "sexe", "contrat", "lieu", "actif", "id_evenement", "present"), ";");
+
+    foreach ($row as $fields) {
+        fputcsv($csv, $fields, ";");
+    }
+
+    fclose($csv);
+
+    header('Content-type: application/octet-stream;');
+    header('Content-Transfer-Encoding: base64');
+    header('Content-Disposition: attachment; filename="'.$tmpList.'"');
+    readfile(DIR_TEMP . $tmpList);
+
+    unlink(DIR_TEMP.$tmpList);
+
+} else {
+    header('HTTP/1.0 401 Unauthorized');
+    exit();
+}
+

+ 0 - 1
core/submit/cms.parametres-reset-datas.php

@@ -6,4 +6,3 @@ if((ENVIRONNEMENT == "DEV" OR ENVIRONNEMENT == "PREPROD")) {
     header("Location: /parametres.html");
     exit();
 }
-

+ 5 - 3
core/views/pages/cms.evenement-inscrits.php

@@ -1,11 +1,13 @@
+
+<div style="float:right; margin-top: -60px;">
 <?php 
     $evenement = event::getFiche(core::getGet("id"));
     if($evenement["type_inscription"] == 1){
 ?>
-<div style="float:right; margin-top: -60px;">
-    <a href="/evenement-inscription-upload-<?php echo core::getGet("id") ?>.html"><button type="submit" class="btn btn-outline-success btn-sm"><span data-feather="file-plus"></span> Importer un fichier Excel</button></a>
-</div>
+    <a href="/?p=evenement-inscription-upload&id=<?php echo core::getGet("id") ?>"><button type="submit" class="btn btn-outline-success btn-sm"><span data-feather="file-plus"></span> Importer un fichier Excel</button></a>
 <?php } ?>
+    <a href="/submit.php?from=event-export-inscription&id=<?php echo core::getGet("id") ?>"><button type="submit" class="btn btn-outline-primary btn-sm"><span data-feather="download"></span> Extraire en CSV</button></a>
+</div>
 <table
     id="table"
     class="table-striped table-hover table-sm"