Files
wp-go-form/go-form-plugin/templates/table.php
2026-05-13 10:58:56 +02:00

69 lines
2.1 KiB
PHP

<table class="wp-list-table widefat striped">
<thead>
<tr>
<th>N</th>
<th>First Name</th>
<th>Last Name</th>
<th>Country</th>
<th>Club</th>
<th>Rank</th>
<th>EGD Number</th>
<th>Date Added</th>
<?php
// Add custom field columns
foreach ($custom_fields as $field):
if ($field->is_public || $show_admin):
echo '<th>' . esc_html($field->field_name) . '</th>';
endif;
endforeach;
?>
<?php if ($show_admin): ?>
<th>Rating</th>
<th>Action</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php foreach ($entries as $i => $e): ?>
<tr>
<td> <?= $i + 1 ?> </td>
<td> <?= esc_html($e->first_name) ?> </td>
<td> <?= esc_html($e->last_name) ?> </td>
<td> <?= esc_html($e->country) ?> </td>
<td> <?= esc_html($e->club) ?> </td>
<td> <?= esc_html($ranks[$e->rank]) ?> </td>
<td><a href="https://europeangodatabase.eu/EGD/Player_Card.php?&key=<?= esc_html($e->egd_number) ?>"><?= esc_html($e->egd_number) ?> </a> </td>
<td> <?= esc_html($e->created_at) ?> </td>
<?php
// Display custom field values
foreach ($custom_fields as $field):
if ($field->is_public || $show_admin):
echo '<td>';
$value = go_form_get_custom_value($e->id, $field->id);
if ($field->field_type === 'checkbox') {
echo $value ? 'Yes' : 'No';
} else {
echo esc_html($value);
}
echo '</td>';
endif;
endforeach;
?>
<?php if ($show_admin): ?>
<td> <?= esc_html($e->rating) ?> </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>
<?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>