Fix MacMahon output and rename
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
$macmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<Tournament typeversion="9">
|
||||
<NumberOfRounds>5</NumberOfRounds>
|
||||
<CurrentRoundNumber>1</CurrentRoundNumber>
|
||||
@@ -114,7 +114,7 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
</SortCriterionDescriptor>
|
||||
</Walllist>';
|
||||
|
||||
$mcmahonlast = '<TournamentRound typeversion="2">
|
||||
$macmahonlast = '<TournamentRound typeversion="2">
|
||||
<RoundNumber>1</RoundNumber>
|
||||
<LastUpdated>2026-05-13 21:30:31</LastUpdated>
|
||||
</TournamentRound>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
go_form_admin_action('export_mcmahon');
|
||||
go_form_admin_action('export_macmahon');
|
||||
if (!isset($_POST['value_one'])) {
|
||||
wp_redirect(admin_url('admin.php?page=go-form-settings'));
|
||||
exit;
|
||||
@@ -15,9 +15,43 @@ 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';
|
||||
include_once 'macmahon-help.php';
|
||||
|
||||
fwrite($output, $mcmahonfirst);
|
||||
fwrite($output, $macmahonfirst);
|
||||
|
||||
// Gather the distinct clubs used per country among the actual participants
|
||||
$clubs_by_country = [];
|
||||
foreach ($entries as $e) {
|
||||
$country_code = strtoupper(trim($e->country));
|
||||
$club = trim($e->club);
|
||||
if ($country_code === '' || $club === '') {
|
||||
continue;
|
||||
}
|
||||
if (!isset($clubs_by_country[$country_code])) {
|
||||
$clubs_by_country[$country_code] = [];
|
||||
}
|
||||
if (!in_array($club, $clubs_by_country[$country_code], true)) {
|
||||
$clubs_by_country[$country_code][] = $club;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($countries as $code => $name) {
|
||||
$out = ' <Country typeversion="1">
|
||||
<InternetCode>' . esc_html(strtolower($code)) . '</InternetCode>
|
||||
<Name>' . esc_html($name) . '</Name>';
|
||||
if (!empty($clubs_by_country[$code])) {
|
||||
foreach ($clubs_by_country[$code] as $club) {
|
||||
$out .= '
|
||||
<Club typeversion="1">
|
||||
<Name>' . esc_html($club) . '</Name>
|
||||
<EGDName>' . esc_html($club) . '</EGDName>
|
||||
</Club>';
|
||||
}
|
||||
}
|
||||
$out .= '
|
||||
</Country>';
|
||||
fwrite($output, $out);
|
||||
}
|
||||
|
||||
foreach ($entries as $i => $e) {
|
||||
$rank = $ranks[$e->rank];
|
||||
@@ -44,6 +78,6 @@ foreach ($entries as $i => $e) {
|
||||
fwrite($output, $out);
|
||||
}
|
||||
|
||||
fwrite($output, $mcmahonlast);
|
||||
fwrite($output, $macmahonlast);
|
||||
|
||||
fclose($output);
|
||||
Reference in New Issue
Block a user