|
|
@@ -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();
|
|
|
+}
|
|
|
+
|