49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
|
|
go_form_admin_action('export_mcmahon');
|
|
if (!isset($_POST['value_one'])) {
|
|
wp_redirect(admin_url('admin.php?page=go-form-settings'));
|
|
exit;
|
|
}
|
|
|
|
$form_id = intval($_POST['value_one']);
|
|
$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/xml; charset=utf-8');
|
|
header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export-macmahon.xml"');
|
|
|
|
$output = fopen('php://output', 'w');
|
|
include_once 'mcmahon-help.php';
|
|
|
|
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); |