| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) or exit; |
| 4 |
$datetime_format = sprintf('%s %s', get_option( 'date_format' ), get_option( 'time_format' ) ); |
| 5 |
|
| 6 |
add_action( 'hf_admin_form_submissions_output_column_header', function( $column ) { |
| 7 |
echo esc_html( ucfirst( strtolower( $column ) ) ); |
| 8 |
}); |
| 9 |
|
| 10 |
?> |
| 11 |
|
| 12 |
<h2><?php _e( 'Form Submissions', 'html-forms' ); ?></h2> |
| 13 |
|
| 14 |
</form><?php // close main form. This means this always has to be the last tab or it will break stuff. ?> |
| 15 |
<form method="post"> |
| 16 |
<div class="tablenav top"> |
| 17 |
<div class="alignleft actions bulkactions"> |
| 18 |
<label for="bulk-action-selector-top" class="screen-reader-text"><?php _e( 'Select bulk action' ); ?></label> |
| 19 |
<select name="_hf_admin_action" id="bulk-action-selector-top"> |
| 20 |
<option value=""><?php _e( 'Bulk Actions' ); ?></option> |
| 21 |
<option value="bulk_delete_submissions"><?php _e( 'Move to Trash' ); ?></option> |
| 22 |
</select> |
| 23 |
<input type="submit" class="button action" value="<?php _e( 'Apply' ); ?>"> |
| 24 |
</div> |
| 25 |
|
| 26 |
<div class="tablenav-pages one-page"> |
| 27 |
<span class="displaying-num"><?php echo sprintf( __( '%d items' ), count( $submissions ) ); ?></span> |
| 28 |
</div> |
| 29 |
|
| 30 |
<br class="clear"> |
| 31 |
</div> |
| 32 |
|
| 33 |
<table class="wp-list-table widefat fixed striped"> |
| 34 |
<thead> |
| 35 |
<tr> |
| 36 |
<td id="cb" class="manage-column column-cb check-column"><input type="checkbox" /></td> |
| 37 |
<th scope="col" class="hf-column manage-column" style="width: 160px;"><?php _e( 'Timestamp', 'html-forms' ); ?></th> |
| 38 |
<?php foreach( $columns as $column ) { |
| 39 |
echo sprintf( '<th scope="col" class="hf-column manage-column hf-column-%s">', esc_attr( $column ) ); |
| 40 |
do_action( 'hf_admin_form_submissions_output_column_header', $column ); |
| 41 |
echo '</th>'; |
| 42 |
} ?> |
| 43 |
</tr> |
| 44 |
</thead> |
| 45 |
<tbody> |
| 46 |
|
| 47 |
<?php foreach( $submissions as $s ) { ?> |
| 48 |
<tr> |
| 49 |
<th scope="row" class="check-column"> |
| 50 |
<input type="checkbox" name="id[]" value="<?php echo esc_attr( $s->id ); ?>"/> |
| 51 |
</th> |
| 52 |
<td> |
| 53 |
<abbr title="<?php echo date( $datetime_format, strtotime( $s->submitted_at ) ); ?>"> |
| 54 |
<?php echo sprintf( '<a href="%s">%s</a>', esc_attr( add_query_arg( array( 'submission_id' => $s->id ) ) ), esc_html( $s->submitted_at ) ); ?> |
| 55 |
</abbr> |
| 56 |
</td> |
| 57 |
|
| 58 |
<?php foreach( $columns as $column ) { |
| 59 |
$value = isset( $s->data[ $column ] ) ? $s->data[ $column ] : ''; |
| 60 |
if( is_array( $value ) ) { |
| 61 |
$value = join( ', ', $value ); |
| 62 |
} |
| 63 |
$value = esc_html( $value ); |
| 64 |
|
| 65 |
echo sprintf( '<td>%s%s</td>', substr( $value, 0, 100 ), strlen( $value ) > 100 ? '...' : '' ); |
| 66 |
} ?> |
| 67 |
</tr> |
| 68 |
<?php } ?> |
| 69 |
<?php if ( empty( $submissions ) ) { |
| 70 |
printf( '<tr><td colspan="2">%s</td></tr>', __( 'Nothing to see here, yet!', 'html-forms' ) ); |
| 71 |
} ?> |
| 72 |
</tbody> |
| 73 |
</table> |
| 74 |
</form> |
| 75 |
|
| 76 |
|
| 77 |
<form><?php // open new main form. This means this always has to be the last tab or it will break stuff. ?> |
| 78 |
|