ottlinger / hornherzogen

Project to manage Aikidō seminar registrations
GNU General Public License v3.0
0 stars 2 forks source link

Admin: Allow export of gradings list for seminars #117

Open ottlinger opened 7 years ago

ottlinger commented 7 years ago

In order to allow Sensei to do gradings more easily provide an export view to see the list of applicants in final states (BOOKED?) or selectable via UI (all/BOOKED).

First step is: HTML with with

If it's easy you may provide a CSV-file download as well: https://stackoverflow.com/questions/16251625/how-to-create-and-download-a-csv-file-from-php-script

ottlinger commented 7 years ago

https://stackoverflow.com/questions/217424/create-a-csv-file-for-a-user-in-php

header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=file.csv");

function outputCSV($data) {
  $output = fopen("php://output", "w");
  foreach ($data as $row)
    fputcsv($output, $row); // here you can change delimiter/enclosure
  fclose($output);
}

outputCSV(array(
  array("name 1", "age 1", "city 1"),
  array("name 2", "age 2", "city 2"),
  array("name 3", "age 3", "city 3")
));