Fix MacMahon output and rename
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
$mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
$macmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<Tournament typeversion="9">
|
<Tournament typeversion="9">
|
||||||
<NumberOfRounds>5</NumberOfRounds>
|
<NumberOfRounds>5</NumberOfRounds>
|
||||||
<CurrentRoundNumber>1</CurrentRoundNumber>
|
<CurrentRoundNumber>1</CurrentRoundNumber>
|
||||||
@@ -114,7 +114,7 @@ $mcmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|||||||
</SortCriterionDescriptor>
|
</SortCriterionDescriptor>
|
||||||
</Walllist>';
|
</Walllist>';
|
||||||
|
|
||||||
$mcmahonlast = '<TournamentRound typeversion="2">
|
$macmahonlast = '<TournamentRound typeversion="2">
|
||||||
<RoundNumber>1</RoundNumber>
|
<RoundNumber>1</RoundNumber>
|
||||||
<LastUpdated>2026-05-13 21:30:31</LastUpdated>
|
<LastUpdated>2026-05-13 21:30:31</LastUpdated>
|
||||||
</TournamentRound>
|
</TournamentRound>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
go_form_admin_action('export_mcmahon');
|
go_form_admin_action('export_macmahon');
|
||||||
if (!isset($_POST['value_one'])) {
|
if (!isset($_POST['value_one'])) {
|
||||||
wp_redirect(admin_url('admin.php?page=go-form-settings'));
|
wp_redirect(admin_url('admin.php?page=go-form-settings'));
|
||||||
exit;
|
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"');
|
header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export-macmahon.xml"');
|
||||||
|
|
||||||
$output = fopen('php://output', 'w');
|
$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) {
|
foreach ($entries as $i => $e) {
|
||||||
$rank = $ranks[$e->rank];
|
$rank = $ranks[$e->rank];
|
||||||
@@ -44,6 +78,6 @@ foreach ($entries as $i => $e) {
|
|||||||
fwrite($output, $out);
|
fwrite($output, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($output, $mcmahonlast);
|
fwrite($output, $macmahonlast);
|
||||||
|
|
||||||
fclose($output);
|
fclose($output);
|
||||||
@@ -378,13 +378,13 @@ function go_form_export_opengotha()
|
|||||||
}
|
}
|
||||||
add_action('admin_post_go_form_export_opengotha', 'go_form_export_opengotha');
|
add_action('admin_post_go_form_export_opengotha', 'go_form_export_opengotha');
|
||||||
|
|
||||||
function go_form_export_mcmahon()
|
function go_form_export_macmahon()
|
||||||
{
|
{
|
||||||
global $ranks;
|
global $ranks, $countries;
|
||||||
include_once 'export/mcmahon.php';
|
include_once 'export/macmahon.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
add_action('admin_post_go_form_export_mcmahon', 'go_form_export_mcmahon');
|
add_action('admin_post_go_form_export_macmahon', 'go_form_export_macmahon');
|
||||||
|
|
||||||
// ========== Custom Field Admin Actions ==========
|
// ========== Custom Field Admin Actions ==========
|
||||||
function go_form_create_custom_field()
|
function go_form_create_custom_field()
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
|
|||||||
action_button('go_form_export_csv', 'Export to CSV', 'Confirm Export', $selected_form_id);
|
action_button('go_form_export_csv', 'Export to CSV', 'Confirm Export', $selected_form_id);
|
||||||
action_button('go_form_export_pairgoth', 'Export to Pairgoth', 'Confirm Export', $selected_form_id);
|
action_button('go_form_export_pairgoth', 'Export to Pairgoth', 'Confirm Export', $selected_form_id);
|
||||||
action_button('go_form_export_opengotha', 'Export to Opengoth', 'Confirm Export', $selected_form_id);
|
action_button('go_form_export_opengotha', 'Export to Opengoth', 'Confirm Export', $selected_form_id);
|
||||||
action_button('go_form_export_mcmahon', 'Export to McMahon', 'Confirm Export', $selected_form_id);
|
action_button('go_form_export_macmahon', 'Export to MacMahon', 'Confirm Export', $selected_form_id);
|
||||||
action_button('go_form_update_egd_data', 'Update EGD Data', 'Update rank and rating from EGD for all entries with EGD numbers?', $selected_form_id);
|
action_button('go_form_update_egd_data', 'Update EGD Data', 'Update rank and rating from EGD for all entries with EGD numbers?', $selected_form_id);
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|||||||
Reference in New Issue
Block a user