mcmahon WIP
This commit is contained in:
@@ -11,26 +11,39 @@ $form = go_form_get_form_by_id($form_id);
|
||||
$form_name = $form ? $form->name : 'Unknown Form';
|
||||
$entries = go_form_get_entries($form_id);
|
||||
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export.csv"');
|
||||
header('Content-Type: text/xml; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export-macmahon.xml"');
|
||||
|
||||
$output = fopen('php://output', 'w');
|
||||
fputcsv($output, ['ID', 'First Name', 'Last Name', 'Country', 'Club', 'Rank', 'Email', 'EGD Number', 'Comment', 'Date Added']);
|
||||
include_once 'mcmahon-help.php';
|
||||
|
||||
foreach ($entries as $e) {
|
||||
global $ranks;
|
||||
fputcsv($output, [
|
||||
$e->id,
|
||||
$e->first_name,
|
||||
$e->last_name,
|
||||
$e->country,
|
||||
$e->club,
|
||||
$ranks[$e->rank] ?? '',
|
||||
$e->email,
|
||||
$e->egd_number,
|
||||
$e->comment,
|
||||
$e->created_at
|
||||
]);
|
||||
fwrite($output, $mcmahonfirst);
|
||||
|
||||
foreach ($entries as $i => $e) {
|
||||
$rank = $ranks[$e->rank];
|
||||
$id = $e->i + 1;
|
||||
$egd = $e->egd_number ? $e->egd_number : '0';
|
||||
$out = " <IndividualParticipant typeversion=\"1\">
|
||||
<Id>$id</Id>
|
||||
<Joker>false</Joker>
|
||||
<PreliminaryRegistration>false</PreliminaryRegistration>
|
||||
<ScoreAdjustment>false</ScoreAdjustment>
|
||||
<ScoreAdjustmentValue>0</ScoreAdjustmentValue>
|
||||
<SuperBarMember>false</SuperBarMember>
|
||||
<GoPlayer typeversion=\"1\">
|
||||
<AsianName>false</AsianName>
|
||||
<FirstName><![CDATA[$e->first_name]]></FirstName>
|
||||
<Surname><![CDATA[$e->last_name]]></Surname>
|
||||
<GoLevel>$rank</GoLevel>
|
||||
<Rating>$e->rating</Rating>
|
||||
<EgdPin>$e->egd_number</EgdPin>
|
||||
<Country>$e->country</Country>
|
||||
<Club>$e->club</Club>
|
||||
</GoPlayer>
|
||||
</IndividualParticipant>";
|
||||
fwrite($output, $out);
|
||||
}
|
||||
|
||||
fwrite($output, $mcmahonlast);
|
||||
|
||||
fclose($output);
|
||||
Reference in New Issue
Block a user