Compare commits
6
Commits
17998dc7b2
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6a210f281 | ||
|
|
ad1ed7e45a | ||
|
|
6aeee287f8 | ||
|
|
4925b345bc | ||
|
|
c36f409484 | ||
|
|
2139a31e7c |
@@ -1,7 +1,18 @@
|
|||||||
in macMahon export -> under country copy clubs.
|
|
||||||
Edit in delete button in line
|
|
||||||
make update person per person
|
|
||||||
Remove update egd data
|
Remove update egd data
|
||||||
|
|
||||||
|
https://stackoverflow.com/questions/18796221/creating-a-select-box-with-a-search-option
|
||||||
|
|
||||||
|
|
||||||
|
<input list="brow">
|
||||||
|
<datalist id="brow">
|
||||||
|
<option value="Internet Explorer">
|
||||||
|
<option value="Firefox">
|
||||||
|
<option value="Chrome">
|
||||||
|
<option value="Opera">
|
||||||
|
<option value="Safari">
|
||||||
|
</datalist>
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"retcode":"Ok","Pin_Player":"12098053","AGAID":"0","Last_Name":"Podavini","Name":"Aldo","Country_Code":"IT","Club":"Mila","Grade":"5k","Grade_n":"25","EGF_Placement":"0","Gor":"1576","DGor":"0","Proposed_Grade":"","Tot_Tournaments":"36","Last_Appearance":"T101212A","Elab_Date":"2009-04-03","Hidden_History":"0","Real_Last_Name":"Podavini","Real_Name":"Aldo"}
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ CREATE TABLE wp_go_form_entries (
|
|||||||
last_name varchar(100) NOT NULL,
|
last_name varchar(100) NOT NULL,
|
||||||
country varchar(100) DEFAULT NULL,
|
country varchar(100) DEFAULT NULL,
|
||||||
club varchar(100) DEFAULT NULL,
|
club varchar(100) DEFAULT NULL,
|
||||||
|
display_country varchar(150) DEFAULT NULL,
|
||||||
|
display_club varchar(100) DEFAULT NULL,
|
||||||
rank tinyint(2) DEFAULT 0,
|
rank tinyint(2) DEFAULT 0,
|
||||||
rating smallint(5) DEFAULT 0,
|
rating smallint(5) DEFAULT 0,
|
||||||
egd_number varchar(20) DEFAULT NULL,
|
egd_number varchar(20) DEFAULT NULL,
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
$macmahonfirst = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<Tournament typeversion="9">
|
||||||
|
<NumberOfRounds>5</NumberOfRounds>
|
||||||
|
<CurrentRoundNumber>1</CurrentRoundNumber>
|
||||||
|
<TakeCurrentRoundInAccount>true</TakeCurrentRoundInAccount>
|
||||||
|
<DefaultAsianName>false</DefaultAsianName>
|
||||||
|
<RatingAllowed>false</RatingAllowed>
|
||||||
|
<RatingLowestOneDanRating>2050</RatingLowestOneDanRating>
|
||||||
|
<RatingDeterminesRank>false</RatingDeterminesRank>
|
||||||
|
<RatingDeterminesStartScore>false</RatingDeterminesStartScore>
|
||||||
|
<LowerMacMahonBar>true</LowerMacMahonBar>
|
||||||
|
<LowerMacMahonBarLevel>10k</LowerMacMahonBarLevel>
|
||||||
|
<UpperMacMahonBar>true</UpperMacMahonBar>
|
||||||
|
<UpperMacMahonBarLevel>2k</UpperMacMahonBarLevel>
|
||||||
|
<UpperMacMahonBarRating>0</UpperMacMahonBarRating>
|
||||||
|
<ByeShouldResultInZeroSOSetc>false</ByeShouldResultInZeroSOSetc>
|
||||||
|
<HalfScoreGroupsRoundDown>false</HalfScoreGroupsRoundDown>
|
||||||
|
<HalfScoreGroupsRoundDownNotJigo>true</HalfScoreGroupsRoundDownNotJigo>
|
||||||
|
<PreliminaryDefaultRegistration>false</PreliminaryDefaultRegistration>
|
||||||
|
<OnlineEgdSupport>true</OnlineEgdSupport>
|
||||||
|
<OnlineEgdSupportByPin>false</OnlineEgdSupportByPin>
|
||||||
|
<HandicapUsed>true</HandicapUsed>
|
||||||
|
<HandicapBelow>false</HandicapBelow>
|
||||||
|
<HandicapBelowLevel>1d</HandicapBelowLevel>
|
||||||
|
<HandicapByLevel>true</HandicapByLevel>
|
||||||
|
<HandicapAdjustment>true</HandicapAdjustment>
|
||||||
|
<HandicapAdjustmentValue>-2</HandicapAdjustmentValue>
|
||||||
|
<HandicapLimit>true</HandicapLimit>
|
||||||
|
<HandicapLimitValue>9</HandicapLimitValue>
|
||||||
|
<HandicapIncludeInTieBreakers>true</HandicapIncludeInTieBreakers>
|
||||||
|
<AllowJigo>false</AllowJigo>
|
||||||
|
<Boardsize>19</Boardsize>
|
||||||
|
<PairingsMarkFixedBoardnumbers>true</PairingsMarkFixedBoardnumbers>
|
||||||
|
<PairingsMarkMissingResults>true</PairingsMarkMissingResults>
|
||||||
|
<PairingsMarkWinner>true</PairingsMarkWinner>
|
||||||
|
<PairingsMarkUnwantedPairings>true</PairingsMarkUnwantedPairings>
|
||||||
|
<PairingsShowLevels>true</PairingsShowLevels>
|
||||||
|
<PairingsShortNotationForLevel>false</PairingsShortNotationForLevel>
|
||||||
|
<PairingsShowScores>false</PairingsShowScores>
|
||||||
|
<PairingsShowHandicaps>true</PairingsShowHandicaps>
|
||||||
|
<PairingsFontsize>18</PairingsFontsize>
|
||||||
|
<PairingsBlackColumnWidth>283</PairingsBlackColumnWidth>
|
||||||
|
<PairingsWhiteColumnWidth>301</PairingsWhiteColumnWidth>
|
||||||
|
<ImportEncoding>UTF-8</ImportEncoding>
|
||||||
|
<ExportColumnDelimiter><![CDATA[f]]></ExportColumnDelimiter>
|
||||||
|
<ExportWalllistShowTournamentTitle>true</ExportWalllistShowTournamentTitle>
|
||||||
|
<ExportEncoding>UTF-8</ExportEncoding>
|
||||||
|
<VersionCreated>MacMahon 3.10</VersionCreated>
|
||||||
|
<VersionSaved>MacMahon 3.10</VersionSaved>
|
||||||
|
<MakePairingTopGroup>true</MakePairingTopGroup>
|
||||||
|
<MakePairingTopGroupEverywhere>false</MakePairingTopGroupEverywhere>
|
||||||
|
<MakePairingTopGroupStrictlyByTopBar>false</MakePairingTopGroupStrictlyByTopBar>
|
||||||
|
<MakePairingTopGroupByNumberOfPlayersAuto>true</MakePairingTopGroupByNumberOfPlayersAuto>
|
||||||
|
<MakePairingTopGroupByNumberOfPlayers>0</MakePairingTopGroupByNumberOfPlayers>
|
||||||
|
<MakePairingTopGroupSeeding>true</MakePairingTopGroupSeeding>
|
||||||
|
<MakePairingSeedingPlacementCriterion typeversion="2">
|
||||||
|
<ShortName>SOS</ShortName>
|
||||||
|
</MakePairingSeedingPlacementCriterion>
|
||||||
|
<MakePairingTopGroupSeedingByRating>false</MakePairingTopGroupSeedingByRating>
|
||||||
|
<MakePairingTopGroupSeedingByRatingRound>2</MakePairingTopGroupSeedingByRatingRound>
|
||||||
|
<MakePairingOutsideTopGroupSameCountry>true</MakePairingOutsideTopGroupSameCountry>
|
||||||
|
<MakePairingOutsideTopGroupSameClub>true</MakePairingOutsideTopGroupSameClub>
|
||||||
|
<MakePairingOutsideTopGroupSameNationality>false</MakePairingOutsideTopGroupSameNationality>
|
||||||
|
<MakePairingOutsideTopGroupStrengthDifference>true</MakePairingOutsideTopGroupStrengthDifference>
|
||||||
|
<MakePairingOutsideTopGroupStrengthDifferenceValue>3</MakePairingOutsideTopGroupStrengthDifferenceValue>
|
||||||
|
<MakePairingOutsideTopGroupColorBalance>true</MakePairingOutsideTopGroupColorBalance>
|
||||||
|
<MakePairingOutsideTopGroupWeakOddMan>true</MakePairingOutsideTopGroupWeakOddMan>
|
||||||
|
<MakePairingOutsideTopGroupSeeding>false</MakePairingOutsideTopGroupSeeding>
|
||||||
|
<PrintWalllistFont>SansSerif</PrintWalllistFont>
|
||||||
|
<PrintWalllistFontsize>9</PrintWalllistFontsize>
|
||||||
|
<PrintWalllistIndentationTop>0</PrintWalllistIndentationTop>
|
||||||
|
<PrintWalllistIndentationLeft>0</PrintWalllistIndentationLeft>
|
||||||
|
<PrintWalllistColumnDistance>2</PrintWalllistColumnDistance>
|
||||||
|
<PrintWalllistAbbreviateName>true</PrintWalllistAbbreviateName>
|
||||||
|
<PrintWalllistAbbreviateNameLength>28</PrintWalllistAbbreviateNameLength>
|
||||||
|
<PrintPairingsFont>SansSerif</PrintPairingsFont>
|
||||||
|
<PrintPairingsFontsize>10</PrintPairingsFontsize>
|
||||||
|
<PrintPairingsIndentationTop>0</PrintPairingsIndentationTop>
|
||||||
|
<PrintPairingsIndentationLeft>0</PrintPairingsIndentationLeft>
|
||||||
|
<PrintPairingsColumnDistance>3</PrintPairingsColumnDistance>
|
||||||
|
<PrintPairingsAbbreviateName>true</PrintPairingsAbbreviateName>
|
||||||
|
<PrintPairingsAbbreviateNameLength>35</PrintPairingsAbbreviateNameLength>
|
||||||
|
<Walllist typeversion="3">
|
||||||
|
<ShowCountry>true</ShowCountry>
|
||||||
|
<ShowClub>true</ShowClub>
|
||||||
|
<ShowClubEgdName>false</ShowClubEgdName>
|
||||||
|
<ShowClubAbbreviateName>true</ShowClubAbbreviateName>
|
||||||
|
<ShowLevels>true</ShowLevels>
|
||||||
|
<ShortNotationForLevel>false</ShortNotationForLevel>
|
||||||
|
<ShowBarMembership>true</ShowBarMembership>
|
||||||
|
<ShowRatings>true</ShowRatings>
|
||||||
|
<MarkPreliminaryRegisteredParticipants>true</MarkPreliminaryRegisteredParticipants>
|
||||||
|
<MarkResultsByReferree>true</MarkResultsByReferree>
|
||||||
|
<ShowColors>false</ShowColors>
|
||||||
|
<ShowHandicap>true</ShowHandicap>
|
||||||
|
<ShowWarningMissingPairing>true</ShowWarningMissingPairing>
|
||||||
|
<Fontsize>18</Fontsize>
|
||||||
|
<NameColumnWidth>221</NameColumnWidth>
|
||||||
|
<ClubColumnWidth>0</ClubColumnWidth>
|
||||||
|
<ClubColumnAlignmentCenter>true</ClubColumnAlignmentCenter>
|
||||||
|
<WeakSortCriteria>1</WeakSortCriteria>
|
||||||
|
<SortCriterionDescriptor typeversion="2">
|
||||||
|
<ShortName>Score</ShortName>
|
||||||
|
</SortCriterionDescriptor>
|
||||||
|
<SortCriterionDescriptor typeversion="2">
|
||||||
|
<ShortName>SOS</ShortName>
|
||||||
|
</SortCriterionDescriptor>
|
||||||
|
<SortCriterionDescriptor typeversion="2">
|
||||||
|
<ShortName>SOSOS</ShortName>
|
||||||
|
</SortCriterionDescriptor>
|
||||||
|
<SortCriterionDescriptor typeversion="2">
|
||||||
|
<ShortName>ScoreX</ShortName>
|
||||||
|
</SortCriterionDescriptor>
|
||||||
|
</Walllist>';
|
||||||
|
|
||||||
|
$macmahonlast = '<TournamentRound typeversion="2">
|
||||||
|
<RoundNumber>1</RoundNumber>
|
||||||
|
<LastUpdated>2026-05-13 21:30:31</LastUpdated>
|
||||||
|
</TournamentRound>
|
||||||
|
<TournamentRound typeversion="2">
|
||||||
|
<RoundNumber>2</RoundNumber>
|
||||||
|
<LastUpdated>2026-05-13 21:30:21</LastUpdated>
|
||||||
|
</TournamentRound>
|
||||||
|
<TournamentRound typeversion="2">
|
||||||
|
<RoundNumber>3</RoundNumber>
|
||||||
|
<LastUpdated>2026-05-13 21:30:10</LastUpdated>
|
||||||
|
</TournamentRound>
|
||||||
|
<TournamentRound typeversion="2">
|
||||||
|
<RoundNumber>4</RoundNumber>
|
||||||
|
<LastUpdated>2026-05-13 21:29:20</LastUpdated>
|
||||||
|
</TournamentRound>
|
||||||
|
<TournamentRound typeversion="2">
|
||||||
|
<RoundNumber>5</RoundNumber>
|
||||||
|
<LastUpdated>2026-05-13 21:29:04</LastUpdated>
|
||||||
|
</TournamentRound>
|
||||||
|
</Tournament>';
|
||||||
@@ -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);
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ if (!defined('ABSPATH'))
|
|||||||
|
|
||||||
// Load helpers
|
// Load helpers
|
||||||
require_once plugin_dir_path(__FILE__) . 'helpers.php';
|
require_once plugin_dir_path(__FILE__) . 'helpers.php';
|
||||||
|
require_once plugin_dir_path(__FILE__) . 'countries.php';
|
||||||
|
|
||||||
// ========== Database ===========
|
// ========== Database ===========
|
||||||
function go_form_activate()
|
function go_form_activate()
|
||||||
@@ -32,6 +33,8 @@ function go_form_activate()
|
|||||||
last_name varchar(100) NOT NULL,
|
last_name varchar(100) NOT NULL,
|
||||||
country varchar(100) DEFAULT NULL,
|
country varchar(100) DEFAULT NULL,
|
||||||
club varchar(100) DEFAULT NULL,
|
club varchar(100) DEFAULT NULL,
|
||||||
|
display_country varchar(150) DEFAULT NULL,
|
||||||
|
display_club varchar(100) DEFAULT NULL,
|
||||||
rank tinyint(2) DEFAULT 0,
|
rank tinyint(2) DEFAULT 0,
|
||||||
rating smallint(5) DEFAULT 0,
|
rating smallint(5) DEFAULT 0,
|
||||||
egd_number varchar(20) DEFAULT NULL,
|
egd_number varchar(20) DEFAULT NULL,
|
||||||
@@ -183,6 +186,8 @@ function go_form_handle_submission()
|
|||||||
'last_name' => sanitize_text_field($_POST['last_name']),
|
'last_name' => sanitize_text_field($_POST['last_name']),
|
||||||
'country' => sanitize_text_field($_POST['country'] ?? ''),
|
'country' => sanitize_text_field($_POST['country'] ?? ''),
|
||||||
'club' => sanitize_text_field($_POST['club'] ?? ''),
|
'club' => sanitize_text_field($_POST['club'] ?? ''),
|
||||||
|
'display_country' => sanitize_text_field($_POST['display_country'] ?? ''),
|
||||||
|
'display_club' => sanitize_text_field($_POST['display_club'] ?? ''),
|
||||||
'rank' => $rank,
|
'rank' => $rank,
|
||||||
'rating' => $rating,
|
'rating' => $rating,
|
||||||
'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''),
|
'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''),
|
||||||
@@ -251,7 +256,7 @@ add_action('admin_post_nopriv_go_form_handle_submission', 'go_form_handle_submis
|
|||||||
// ========== Shortcode ==========
|
// ========== Shortcode ==========
|
||||||
function go_form_shortcode($atts)
|
function go_form_shortcode($atts)
|
||||||
{
|
{
|
||||||
global $ranks;
|
global $ranks, $countries;
|
||||||
$form_id = intval($atts['id']);
|
$form_id = intval($atts['id']);
|
||||||
|
|
||||||
$form = go_form_get_form_by_id($form_id);
|
$form = go_form_get_form_by_id($form_id);
|
||||||
@@ -373,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()
|
||||||
@@ -459,6 +464,30 @@ function go_form_delete_custom_field()
|
|||||||
add_action('admin_post_go_form_delete_custom_field', 'go_form_delete_custom_field');
|
add_action('admin_post_go_form_delete_custom_field', 'go_form_delete_custom_field');
|
||||||
|
|
||||||
// ========== Entry Edit Admin Action ==========
|
// ========== Entry Edit Admin Action ==========
|
||||||
|
function go_form_fetch_egd_data($pin)
|
||||||
|
{
|
||||||
|
$pin = trim($pin);
|
||||||
|
if (empty($pin)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = 'https://europeangodatabase.eu/EGD/GetPlayerDataByPIN.php?pin=' . urlencode($pin);
|
||||||
|
$response = wp_remote_get($url, ['timeout' => 10]);
|
||||||
|
|
||||||
|
if (is_wp_error($response)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = wp_remote_retrieve_body($response);
|
||||||
|
$data = json_decode($body, true);
|
||||||
|
|
||||||
|
if ($data && isset($data['retcode']) && $data['retcode'] === 'Ok') {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
function go_form_update_egd_data()
|
function go_form_update_egd_data()
|
||||||
{
|
{
|
||||||
go_form_admin_action('update_egd_data');
|
go_form_admin_action('update_egd_data');
|
||||||
@@ -468,7 +497,7 @@ function go_form_update_egd_data()
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $wpdb, $ranks;
|
global $wpdb;
|
||||||
$form_id = intval($_POST['value_one']);
|
$form_id = intval($_POST['value_one']);
|
||||||
$entries = go_form_get_entries($form_id);
|
$entries = go_form_get_entries($form_id);
|
||||||
$updated_count = 0;
|
$updated_count = 0;
|
||||||
@@ -478,19 +507,11 @@ function go_form_update_egd_data()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pin = trim($entry->egd_number);
|
$data = go_form_fetch_egd_data($entry->egd_number);
|
||||||
$url = 'https://europeangodatabase.eu/EGD/GetPlayerDataByPIN.php?pin=' . urlencode($pin);
|
if (!$data) {
|
||||||
|
|
||||||
$response = wp_remote_get($url, ['timeout' => 10]);
|
|
||||||
|
|
||||||
if (is_wp_error($response)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = wp_remote_retrieve_body($response);
|
|
||||||
$data = json_decode($body, true);
|
|
||||||
|
|
||||||
if ($data && isset($data['retcode']) && $data['retcode'] === 'Ok') {
|
|
||||||
// Map EGD Grade_n to our rank system
|
// Map EGD Grade_n to our rank system
|
||||||
// EGD Grade_n: 0=30k, 1=29k, ... 25=5k, 30=1d, ... 39=9d, 40=1p, ... 47=9p
|
// EGD Grade_n: 0=30k, 1=29k, ... 25=5k, 30=1d, ... 39=9d, 40=1p, ... 47=9p
|
||||||
// Our ranks array: 0=30k, 1=29k, ... 25=5k, 30=1d, ... 39=9d, 40=1p, ... 47=9p
|
// Our ranks array: 0=30k, 1=29k, ... 25=5k, 30=1d, ... 39=9d, 40=1p, ... 47=9p
|
||||||
@@ -508,7 +529,6 @@ function go_form_update_egd_data()
|
|||||||
$updated_count++;
|
$updated_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$redirect_url = add_query_arg(
|
$redirect_url = add_query_arg(
|
||||||
array('page' => 'go-form-settings', 'form_id' => $form_id, 'egd_updated' => $updated_count),
|
array('page' => 'go-form-settings', 'form_id' => $form_id, 'egd_updated' => $updated_count),
|
||||||
@@ -542,6 +562,8 @@ function go_form_update_entry()
|
|||||||
'last_name' => sanitize_text_field($_POST['last_name']),
|
'last_name' => sanitize_text_field($_POST['last_name']),
|
||||||
'country' => sanitize_text_field($_POST['country'] ?? ''),
|
'country' => sanitize_text_field($_POST['country'] ?? ''),
|
||||||
'club' => sanitize_text_field($_POST['club'] ?? ''),
|
'club' => sanitize_text_field($_POST['club'] ?? ''),
|
||||||
|
'display_country' => sanitize_text_field($_POST['display_country'] ?? ''),
|
||||||
|
'display_club' => sanitize_text_field($_POST['display_club'] ?? ''),
|
||||||
'rank' => $rank,
|
'rank' => $rank,
|
||||||
'rating' => $rating,
|
'rating' => $rating,
|
||||||
'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''),
|
'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''),
|
||||||
@@ -620,3 +642,11 @@ function go_form_settings_page()
|
|||||||
{
|
{
|
||||||
include_once 'templates/settings-page.php';
|
include_once 'templates/settings-page.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function go_form_egd_hint($value)
|
||||||
|
{
|
||||||
|
if ($value === null || $value === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return ' <span style="color:#2271b1; font-style:italic;">(EGD: ' . esc_html($value) . ')</span>';
|
||||||
|
}
|
||||||
|
|||||||
@@ -71,6 +71,8 @@
|
|||||||
<input type="hidden" name="action" value="go_form_handle_submission">
|
<input type="hidden" name="action" value="go_form_handle_submission">
|
||||||
<input type="hidden" name="form_id" value="<?php echo esc_attr($form_id); ?>">
|
<input type="hidden" name="form_id" value="<?php echo esc_attr($form_id); ?>">
|
||||||
<input type="hidden" name="rating" id="rating" value="-1000">
|
<input type="hidden" name="rating" id="rating" value="-1000">
|
||||||
|
<input type="hidden" name="country" id="country">
|
||||||
|
<input type="hidden" name="club" id="club">
|
||||||
|
|
||||||
<div class="go-form-user-grid">
|
<div class="go-form-user-grid">
|
||||||
|
|
||||||
@@ -105,11 +107,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="country">Country*:</label><input type="text" name="country" id="country" required>
|
<label for="display_country">Country*:</label><input type="text" name="display_country" id="display_country" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="club">Club:</label><input type="text" name="club" id="club">
|
<label for="display_club">Club:</label><input type="text" name="display_club" id="display_club">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -218,6 +220,7 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const contentDiv = document.getElementById('egd-results-content');
|
const contentDiv = document.getElementById('egd-results-content');
|
||||||
const egdOverlay = document.getElementById('egd-popup-overlay');
|
const egdOverlay = document.getElementById('egd-popup-overlay');
|
||||||
|
const countryMap = <?php echo wp_json_encode($countries); ?>;
|
||||||
|
|
||||||
function fetchPlayers() {
|
function fetchPlayers() {
|
||||||
const firstName = document.getElementById('first_name').value.trim();
|
const firstName = document.getElementById('first_name').value.trim();
|
||||||
@@ -269,6 +272,8 @@
|
|||||||
document.getElementById('last_name').value = player.Last_Name || player.Real_Last_Name || '';
|
document.getElementById('last_name').value = player.Last_Name || player.Real_Last_Name || '';
|
||||||
document.getElementById('country').value = player.Country_Code || '';
|
document.getElementById('country').value = player.Country_Code || '';
|
||||||
document.getElementById('club').value = player.Club || '';
|
document.getElementById('club').value = player.Club || '';
|
||||||
|
document.getElementById('display_country').value = countryMap[player.Country_Code] || player.Country_Code || '';
|
||||||
|
document.getElementById('display_club').value = player.Club || '';
|
||||||
document.getElementById('rank').value = player.Grade_n || 0;
|
document.getElementById('rank').value = player.Grade_n || 0;
|
||||||
document.getElementById('egd_number').value = player.Pin_Player || '';
|
document.getElementById('egd_number').value = player.Pin_Player || '';
|
||||||
document.getElementById('rating').value = player.Gor || 0;
|
document.getElementById('rating').value = player.Gor || 0;
|
||||||
|
|||||||
@@ -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>';
|
||||||
@@ -162,27 +162,35 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
|
|||||||
$entry = go_form_get_entry_by_id($edit_entry_id);
|
$entry = go_form_get_entry_by_id($edit_entry_id);
|
||||||
if ($entry && $entry->form_id == $selected_form_id) {
|
if ($entry && $entry->form_id == $selected_form_id) {
|
||||||
$custom_fields = go_form_get_custom_fields($selected_form_id);
|
$custom_fields = go_form_get_custom_fields($selected_form_id);
|
||||||
|
global $ranks;
|
||||||
|
$egd_data = !empty($entry->egd_number) ? go_form_fetch_egd_data($entry->egd_number) : null;
|
||||||
|
|
||||||
echo '<div style="margin-bottom:20px; padding:15px; background:#fff; border:1px solid #ddd; border-radius:4px;">';
|
echo '<div style="margin-bottom:20px; padding:15px; background:#fff; border:1px solid #ddd; border-radius:4px;">';
|
||||||
echo '<h3>Edit Entry</h3>';
|
echo '<h3>Edit Entry</h3>';
|
||||||
|
if (!empty($entry->egd_number) && !$egd_data) {
|
||||||
|
echo '<div class="notice notice-warning inline"><p>Could not fetch EGD data for PIN ' . esc_html($entry->egd_number) . '.</p></div>';
|
||||||
|
}
|
||||||
echo '<form method="post" action="' . admin_url('admin-post.php') . '">';
|
echo '<form method="post" action="' . admin_url('admin-post.php') . '">';
|
||||||
echo wp_nonce_field('go_form_update_entry_action', 'go_form_update_entry_nonce', true, false);
|
echo wp_nonce_field('go_form_update_entry_action', 'go_form_update_entry_nonce', true, false);
|
||||||
echo '<input type="hidden" name="action" value="go_form_update_entry">';
|
echo '<input type="hidden" name="action" value="go_form_update_entry">';
|
||||||
echo '<input type="hidden" name="entry_id" value="' . esc_attr($entry->id) . '">';
|
echo '<input type="hidden" name="entry_id" value="' . esc_attr($entry->id) . '">';
|
||||||
echo '<input type="hidden" name="form_id" value="' . esc_attr($selected_form_id) . '">';
|
echo '<input type="hidden" name="form_id" value="' . esc_attr($selected_form_id) . '">';
|
||||||
echo '<table class="form-table">';
|
echo '<table class="form-table">';
|
||||||
echo '<tr><th><label for="first_name">First Name*:</label></th><td><input type="text" name="first_name" id="first_name" value="' . esc_attr($entry->first_name) . '" required></td></tr>';
|
echo '<tr><th><label for="first_name">First Name*:</label></th><td><input type="text" name="first_name" id="first_name" value="' . esc_attr($entry->first_name) . '" required>' . go_form_egd_hint($egd_data['Name'] ?? $egd_data['Real_Name'] ?? null) . '</td></tr>';
|
||||||
echo '<tr><th><label for="last_name">Last Name*:</label></th><td><input type="text" name="last_name" id="last_name" value="' . esc_attr($entry->last_name) . '" required></td></tr>';
|
echo '<tr><th><label for="last_name">Last Name*:</label></th><td><input type="text" name="last_name" id="last_name" value="' . esc_attr($entry->last_name) . '" required>' . go_form_egd_hint($egd_data['Last_Name'] ?? $egd_data['Real_Last_Name'] ?? null) . '</td></tr>';
|
||||||
echo '<tr><th><label for="country">Country:</label></th><td><input type="text" name="country" id="country" value="' . esc_attr($entry->country) . '"></td></tr>';
|
echo '<tr><th><label for="country">Country:</label></th><td><input type="text" name="country" id="country" value="' . esc_attr($entry->country) . '">' . go_form_egd_hint($egd_data['Country_Code'] ?? null) . '</td></tr>';
|
||||||
echo '<tr><th><label for="club">Club:</label></th><td><input type="text" name="club" id="club" value="' . esc_attr($entry->club) . '"></td></tr>';
|
echo '<tr><th><label for="club">Club:</label></th><td><input type="text" name="club" id="club" value="' . esc_attr($entry->club) . '">' . go_form_egd_hint($egd_data['Club'] ?? null) . '</td></tr>';
|
||||||
|
echo '<tr><th><label for="display_country">Display Country:</label></th><td><input type="text" name="display_country" id="display_country" value="' . esc_attr($entry->display_country) . '"></td></tr>';
|
||||||
|
echo '<tr><th><label for="display_club">Display Club:</label></th><td><input type="text" name="display_club" id="display_club" value="' . esc_attr($entry->display_club) . '"></td></tr>';
|
||||||
echo '<tr><th><label for="rank">Rank:</label></th><td>';
|
echo '<tr><th><label for="rank">Rank:</label></th><td>';
|
||||||
echo '<select name="rank" id="rank">';
|
echo '<select name="rank" id="rank">';
|
||||||
global $ranks;
|
|
||||||
foreach ($ranks as $value => $label) {
|
foreach ($ranks as $value => $label) {
|
||||||
echo '<option value="' . esc_attr($value) . '" ' . selected($entry->rank, $value, false) . '>' . esc_html($label) . '</option>';
|
echo '<option value="' . esc_attr($value) . '" ' . selected($entry->rank, $value, false) . '>' . esc_html($label) . '</option>';
|
||||||
}
|
}
|
||||||
echo '</select>';
|
echo '</select>';
|
||||||
|
echo go_form_egd_hint(isset($egd_data['Grade_n']) ? ($ranks[intval($egd_data['Grade_n'])] ?? null) : null);
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '<tr><th><label for="rating">Rating:</label></th><td><input type="number" name="rating" id="rating" value="' . esc_attr($entry->rating) . '"></td></tr>';
|
echo '<tr><th><label for="rating">Rating:</label></th><td><input type="number" name="rating" id="rating" value="' . esc_attr($entry->rating) . '">' . go_form_egd_hint($egd_data['Gor'] ?? null) . '</td></tr>';
|
||||||
echo '<tr><th><label for="egd_number">EGD Number:</label></th><td><input type="text" name="egd_number" id="egd_number" value="' . esc_attr($entry->egd_number) . '"></td></tr>';
|
echo '<tr><th><label for="egd_number">EGD Number:</label></th><td><input type="text" name="egd_number" id="egd_number" value="' . esc_attr($entry->egd_number) . '"></td></tr>';
|
||||||
|
|
||||||
// Custom fields
|
// Custom fields
|
||||||
|
|||||||
@@ -6,8 +6,15 @@
|
|||||||
<th>First Name</th>
|
<th>First Name</th>
|
||||||
<th>Last Name</th>
|
<th>Last Name</th>
|
||||||
<th>Rank</th>
|
<th>Rank</th>
|
||||||
|
<?php if ($show_admin): ?>
|
||||||
|
<th>Rating</th>
|
||||||
|
<?php endif; ?>
|
||||||
<th>Country</th>
|
<th>Country</th>
|
||||||
<th>Club</th>
|
<th>Club</th>
|
||||||
|
<?php if ($show_admin): ?>
|
||||||
|
<th>Country (raw)</th>
|
||||||
|
<th>Club (raw)</th>
|
||||||
|
<?php endif; ?>
|
||||||
<th>EGD Number</th>
|
<th>EGD Number</th>
|
||||||
<th>Date Added</th>
|
<th>Date Added</th>
|
||||||
<?php
|
<?php
|
||||||
@@ -17,11 +24,10 @@
|
|||||||
echo '<th>' . esc_html($field->field_name) . '</th>';
|
echo '<th>' . esc_html($field->field_name) . '</th>';
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
|
||||||
<?php if ($show_admin): ?>
|
if ($show_admin):
|
||||||
<th>Rating</th>
|
echo '<th>Action</th>';
|
||||||
<th>Action</th>
|
endif; ?>
|
||||||
<?php endif; ?>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -33,8 +39,15 @@
|
|||||||
<td> <?= esc_html($e->first_name) ?> </td>
|
<td> <?= esc_html($e->first_name) ?> </td>
|
||||||
<td> <?= esc_html($e->last_name) ?> </td>
|
<td> <?= esc_html($e->last_name) ?> </td>
|
||||||
<td> <?= esc_html($ranks[$e->rank]) ?> </td>
|
<td> <?= esc_html($ranks[$e->rank]) ?> </td>
|
||||||
|
<?php if ($show_admin): ?>
|
||||||
|
<td> <?= esc_html($e->rating) ?> </td>
|
||||||
|
<?php endif; ?>
|
||||||
|
<td> <?= esc_html($e->display_country) ?> </td>
|
||||||
|
<td> <?= esc_html($e->display_club) ?> </td>
|
||||||
|
<?php if ($show_admin): ?>
|
||||||
<td> <?= esc_html($e->country) ?> </td>
|
<td> <?= esc_html($e->country) ?> </td>
|
||||||
<td> <?= esc_html($e->club) ?> </td>
|
<td> <?= esc_html($e->club) ?> </td>
|
||||||
|
<?php endif; ?>
|
||||||
<td><a
|
<td><a
|
||||||
href="<?= esc_url('https://europeangodatabase.eu/EGD/Player_Card.php?&key=' . $e->egd_number) ?>"><?= esc_html($e->egd_number) ?>
|
href="<?= esc_url('https://europeangodatabase.eu/EGD/Player_Card.php?&key=' . $e->egd_number) ?>"><?= esc_html($e->egd_number) ?>
|
||||||
</a> </td>
|
</a> </td>
|
||||||
@@ -57,7 +70,6 @@
|
|||||||
|
|
||||||
<?php if ($show_admin): ?>
|
<?php if ($show_admin): ?>
|
||||||
|
|
||||||
<td> <?= esc_html($e->rating) ?> </td>
|
|
||||||
<td style="white-space: nowrap;">
|
<td style="white-space: nowrap;">
|
||||||
<a href="<?= add_query_arg(array('page' => 'go-form-settings', 'form_id' => $form_id ?? 0, 'edit_entry' => $e->id), admin_url('admin.php')) ?>"
|
<a href="<?= add_query_arg(array('page' => 'go-form-settings', 'form_id' => $form_id ?? 0, 'edit_entry' => $e->id), admin_url('admin.php')) ?>"
|
||||||
class="button" style="margin-right: 4px;">Edit</a>
|
class="button" style="margin-right: 4px;">Edit</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user