Compare commits
6
Commits
v0.05
..
f5b5af5372
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5b5af5372 | ||
|
|
1d5fed6e1f | ||
|
|
d75997fbb5 | ||
|
|
ffaa624f65 | ||
|
|
6e1bc4ac1b | ||
|
|
ad1a535795 |
+25
@@ -0,0 +1,25 @@
|
|||||||
|
WordPress plugin for managing Go (Baduk/Weiqi) tournament registrations. Collects player data via frontend forms and exports entries to tournament management systems (Pairgoth, OpenGotha, McMahon, CSV).
|
||||||
|
|
||||||
|
**Relevant files:**
|
||||||
|
- `main.php` - Plugin entry point with WordPress hooks
|
||||||
|
- `go-form-plugin/go-form-plugin.php` - Core plugin logic (forms, entries, EGD integration, exports)
|
||||||
|
- `go-form-plugin/database-schema.sql` - MySQL schema for 4 tables (forms, entries, custom_fields, entry_custom_values)
|
||||||
|
- `go-form-plugin/export/csv.php` - CSV export handler
|
||||||
|
- `go-form-plugin/export/pairgoth.php` - Pairgoth JSON export handler
|
||||||
|
- `go-form-plugin/export/opengotha.php` - OpenGotha XML export handler
|
||||||
|
- `go-form-plugin/export/mcmahon.php` - McMahon XML export handler
|
||||||
|
- `go-form-plugin/export/mcmahon-help.php` - McMahon documentation/reference
|
||||||
|
- `go-form-plugin/templates/form-shortcode.php` - Frontend form template
|
||||||
|
- `go-form-plugin/templates/settings-page.php` - Admin dashboard template
|
||||||
|
- `go-form-plugin/templates/table.php` - Entries table display
|
||||||
|
- `README.md` - Full documentation
|
||||||
|
|
||||||
|
**Nuances:**
|
||||||
|
- Ranks stored as integers (0-47): 0-29=30k-1k, 30-38=1d-9d, 39-47=1p-9p
|
||||||
|
- Rating auto-calculated: `rating = (rank * 100) - 900`
|
||||||
|
- EGD integration: searches `https://europeangodatabase.eu/EGD/GetPlayerDataByData.php` and `GetPlayerDataByPIN.php`
|
||||||
|
- Uses WordPress nonces, `manage_options` capability, `$wpdb->prepare()` for security
|
||||||
|
- Foreign keys with CASCADE delete
|
||||||
|
|
||||||
|
## To LLM
|
||||||
|
Update this file if the changes you have done are worth updating here. The intent of this file is to give you a rough idea of the project, from where you can explore further, if needed.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
in macMahon export -> under country copy clubs.
|
||||||
|
Edit in delete button in line
|
||||||
|
make update person per person
|
||||||
|
Remove update egd data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -16,20 +16,20 @@ header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($f
|
|||||||
|
|
||||||
$output = fopen('php://output', 'w');
|
$output = fopen('php://output', 'w');
|
||||||
|
|
||||||
fwrite($output,'{"id":1,"type":"INDIVIDUAL","name":"Template","shortName":"20251111-Template","startDate":"2025-11-11","endDate":"2025-11-11","director":"","country":"si","location":"Template","online":false,"komi":6.5,"rules":"JAPANESE","gobanSize":19,"timeSystem":{"type":"CANADIAN","mainTime":2400,"byoyomi":300,"stones":15},"rounds":5,"pairing":{"type":"MAC_MAHON","base":{"nx1":0.5,"dupWeight":5.0E14,"random":0.0,"deterministic":true,"colorBalanceWeight":1000000.0},"main":{"catWeight":2.0E13,"scoreWeight":1.0E11,"upDownWeight":1.0E8,"upDownCompensate":true,"upDownLowerMode":"MIDDLE","upDownUpperMode":"MIDDLE","maximizeSeeding":5000000.0,"firstSeedLastRound":2,"firstSeed":"SPLIT_AND_RANDOM","secondSeed":"SPLIT_AND_FOLD","firstSeedAddCrit":"RATING","secondSeedAddCrit":"NONE","mmsValueAbsent":0.5,"roundDownScore":true,"sosValueAbsentUseBase":true},"secondary":{"barThreshold":true,"rankThreshold":0,"winsThreshold":true,"secWeight":1.0E11},"geo":{"weight":1.0E11,"mmsDiffCountry":1,"mmsDiffClubGroup":3,"mmsDiffClub":3},"handicap":{"weight":0.0,"useMMS":false,"threshold":8,"correction":2,"ceiling":9},"placement":["MMS","SOSM","SOSOSM"],"mmFloor":-20,"mmBar":0},"players":[');
|
fwrite($output, '{"id":1,"type":"INDIVIDUAL","name":"Template","shortName":"20251111-Template","startDate":"2025-11-11","endDate":"2025-11-11","director":"","country":"si","location":"Template","online":false,"komi":6.5,"rules":"JAPANESE","gobanSize":19,"timeSystem":{"type":"CANADIAN","mainTime":2400,"byoyomi":300,"stones":15},"rounds":5,"pairing":{"type":"MAC_MAHON","base":{"nx1":0.5,"dupWeight":5.0E14,"random":0.0,"deterministic":true,"colorBalanceWeight":1000000.0},"main":{"catWeight":2.0E13,"scoreWeight":1.0E11,"upDownWeight":1.0E8,"upDownCompensate":true,"upDownLowerMode":"MIDDLE","upDownUpperMode":"MIDDLE","maximizeSeeding":5000000.0,"firstSeedLastRound":2,"firstSeed":"SPLIT_AND_RANDOM","secondSeed":"SPLIT_AND_FOLD","firstSeedAddCrit":"RATING","secondSeedAddCrit":"NONE","mmsValueAbsent":0.5,"roundDownScore":true,"sosValueAbsentUseBase":true},"secondary":{"barThreshold":true,"rankThreshold":0,"winsThreshold":true,"secWeight":1.0E11},"geo":{"weight":1.0E11,"mmsDiffCountry":1,"mmsDiffClubGroup":3,"mmsDiffClub":3},"handicap":{"weight":0.0,"useMMS":false,"threshold":8,"correction":2,"ceiling":9},"placement":["MMS","SOSM","SOSOSM"],"mmFloor":-20,"mmBar":0},"players":[');
|
||||||
|
|
||||||
$count = count($entries);
|
$count = count($entries);
|
||||||
foreach ($entries as $i => $e) {
|
foreach ($entries as $i => $e) {
|
||||||
$rank = $e->rank - 30;
|
$rank = $e->rank - 30;
|
||||||
$id = ($i + 1) * 2;
|
$id = ($i + 1) * 2;
|
||||||
$out = "{\"id\":$id,\"name\":\"$e->first_name\",\"firstname\":\"$e->last_name\",\"rating\":$e->rating,\"rank\":$rank,\"country\":\"$e->country\",\"club\":\"$e->club\",\"final\":false,\"egf\":\"$e->egd_number\"}";
|
$out = "{\"id\":$id,\"name\":\"$e->last_name\",\"firstname\":\"$e->first_name\",\"rating\":$e->rating,\"rank\":$rank,\"country\":\"$e->country\",\"club\":\"$e->club\",\"final\":false,\"egf\":\"$e->egd_number\"}";
|
||||||
if ($i + 1 < $count) {
|
if ($i + 1 < $count) {
|
||||||
$out .= ",";
|
$out .= ",";
|
||||||
}
|
}
|
||||||
fwrite($output, $out);
|
fwrite($output, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($output,'],"games":[[]]}');
|
fwrite($output, '],"games":[[]]}');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -229,10 +229,22 @@ function go_form_handle_submission()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send notification email
|
||||||
|
// $to = 'nikola@petrovv.com';
|
||||||
|
// $subject = 'New Go Tournament Registration';
|
||||||
|
|
||||||
|
// $message = "A new player has signed up:\n\n";
|
||||||
|
// $message .= "Form ID: {$form_id}\n";
|
||||||
|
// $message .= "Name: {$data['first_name']} {$data['last_name']}\n";
|
||||||
|
|
||||||
|
|
||||||
|
// wp_mail($to, $subject, $message);
|
||||||
|
|
||||||
wp_redirect($_SERVER['HTTP_REFERER']);
|
wp_redirect($_SERVER['HTTP_REFERER']);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
add_action('admin_post_go_form_handle_submission', 'go_form_handle_submission');
|
add_action('admin_post_go_form_handle_submission', 'go_form_handle_submission');
|
||||||
|
add_action('admin_post_nopriv_go_form_handle_submission', 'go_form_handle_submission');
|
||||||
|
|
||||||
// ========== Shortcode ==========
|
// ========== Shortcode ==========
|
||||||
function go_form_shortcode($atts)
|
function go_form_shortcode($atts)
|
||||||
|
|||||||
@@ -54,6 +54,15 @@
|
|||||||
grid-template-columns: auto auto;
|
grid-template-columns: auto auto;
|
||||||
column-gap: 16px;
|
column-gap: 16px;
|
||||||
}
|
}
|
||||||
|
.go-form-user-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto auto min-content;
|
||||||
|
column-gap: 16px;
|
||||||
|
}
|
||||||
|
.egd-search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="form">
|
<div id="form">
|
||||||
@@ -62,7 +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">
|
||||||
<div class="go-form-grid">
|
|
||||||
|
<div class="go-form-user-grid">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="first_name">First Name*:</label><input type="text" name="first_name" id="first_name" required>
|
<label for="first_name">First Name*:</label><input type="text" name="first_name" id="first_name" required>
|
||||||
@@ -72,10 +82,13 @@
|
|||||||
<label for="last_name">Last Name*:</label><input type="text" name="last_name" id="last_name" required>
|
<label for="last_name">Last Name*:</label><input type="text" name="last_name" id="last_name" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="egd-search">
|
||||||
<button type="button" id="egd-search" class="button">Search EGD</button>
|
<button type="button" id="egd-search" class="button">Search EGD</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="go-form-grid">
|
||||||
<div>
|
<div>
|
||||||
<label for="rank">Rank*:</label>
|
<label for="rank">Rank*:</label>
|
||||||
<select name="rank" id="rank">
|
<select name="rank" id="rank">
|
||||||
@@ -87,16 +100,16 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="egd_number">EGD Number:</label><input type="text" name="egd_number" id="egd_number">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="country">Country*:</label><input type="text" name="country" id="country" required>
|
<label for="country">Country*:</label><input type="text" name="country" id="country" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="club">Club*:</label><input type="text" name="club" id="club" required>
|
<label for="club">Club:</label><input type="text" name="club" id="club">
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="egd_number">EGD Number:</label><input type="text" name="egd_number" id="egd_number">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -184,7 +197,6 @@
|
|||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<p>* Required fields</p>
|
|
||||||
<input type="submit" name="go_form_submit" value="Submit">
|
<input type="submit" name="go_form_submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -197,10 +209,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$entries = go_form_get_entries($form_id);
|
$entries = go_form_get_entries($form_id);
|
||||||
$entries_count = count($entries);
|
|
||||||
$custom_fields = go_form_get_custom_fields($form_id);
|
$custom_fields = go_form_get_custom_fields($form_id);
|
||||||
?>
|
?>
|
||||||
<h2>Sign-up players: <?= esc_html($entries_count); ?></h2>
|
|
||||||
<?php go_form_render_entries_table($entries, false, $custom_fields, $form_id); ?>
|
<?php go_form_render_entries_table($entries, false, $custom_fields, $form_id); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -214,11 +224,11 @@
|
|||||||
const lastName = document.getElementById('last_name').value.trim();
|
const lastName = document.getElementById('last_name').value.trim();
|
||||||
|
|
||||||
if (firstName.length < 2) {
|
if (firstName.length < 2) {
|
||||||
alert('Please enter at least 2 characters in first or last name');
|
alert('Please enter at least 2 characters in first and last name');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (lastName.length < 2) {
|
if (lastName.length < 2) {
|
||||||
alert('Please enter at least 2 characters in first or last name');
|
alert('Please enter at least 2 characters in first and last name');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<table class="wp-list-table widefat striped">
|
<div class="go-form-table-container" style="overflow-x: auto; -webkit-overflow-scrolling: touch;">
|
||||||
|
<table class="wp-list-table widefat striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>N</th>
|
<th>N</th>
|
||||||
<th>First Name</th>
|
<th>First Name</th>
|
||||||
<th>Last Name</th>
|
<th>Last Name</th>
|
||||||
|
<th>Rank</th>
|
||||||
<th>Country</th>
|
<th>Country</th>
|
||||||
<th>Club</th>
|
<th>Club</th>
|
||||||
<th>Rank</th>
|
|
||||||
<th>EGD Number</th>
|
<th>EGD Number</th>
|
||||||
<th>Date Added</th>
|
<th>Date Added</th>
|
||||||
<?php
|
<?php
|
||||||
@@ -31,10 +32,12 @@
|
|||||||
<td> <?= $i + 1 ?> </td>
|
<td> <?= $i + 1 ?> </td>
|
||||||
<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($e->country) ?> </td>
|
<td> <?= esc_html($e->country) ?> </td>
|
||||||
<td> <?= esc_html($e->club) ?> </td>
|
<td> <?= esc_html($e->club) ?> </td>
|
||||||
<td> <?= esc_html($ranks[$e->rank]) ?> </td>
|
<td><a
|
||||||
<td><a href="https://europeangodatabase.eu/EGD/Player_Card.php?&key=<?= esc_html($e->egd_number) ?>"><?= esc_html($e->egd_number) ?> </a> </td>
|
href="<?= esc_url('https://europeangodatabase.eu/EGD/Player_Card.php?&key=' . $e->egd_number) ?>"><?= esc_html($e->egd_number) ?>
|
||||||
|
</a> </td>
|
||||||
<td> <?= esc_html($e->created_at) ?> </td>
|
<td> <?= esc_html($e->created_at) ?> </td>
|
||||||
<?php
|
<?php
|
||||||
// Display custom field values
|
// Display custom field values
|
||||||
@@ -56,7 +59,8 @@
|
|||||||
|
|
||||||
<td> <?= esc_html($e->rating) ?> </td>
|
<td> <?= esc_html($e->rating) ?> </td>
|
||||||
<td>
|
<td>
|
||||||
<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 button-small">Edit</a>
|
<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 button-small">Edit</a>
|
||||||
<?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?>
|
<?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
@@ -66,4 +70,5 @@
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user