Organize config table
This commit is contained in:
@@ -25,7 +25,6 @@ function sp_column_edit_columns() {
|
|||||||
'title' => __( 'Label', 'sportspress' ),
|
'title' => __( 'Label', 'sportspress' ),
|
||||||
'sp_key' => __( 'Key', 'sportspress' ),
|
'sp_key' => __( 'Key', 'sportspress' ),
|
||||||
'sp_format' => __( 'Format', 'sportspress' ),
|
'sp_format' => __( 'Format', 'sportspress' ),
|
||||||
'sp_precision' => __( 'Precision', 'sportspress' ),
|
|
||||||
'sp_equation' => __( 'Equation', 'sportspress' ),
|
'sp_equation' => __( 'Equation', 'sportspress' ),
|
||||||
'sp_order' => __( 'Sort Order', 'sportspress' ),
|
'sp_order' => __( 'Sort Order', 'sportspress' ),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ function sp_statistic_edit_columns() {
|
|||||||
'title' => __( 'Label', 'sportspress' ),
|
'title' => __( 'Label', 'sportspress' ),
|
||||||
'sp_key' => __( 'Key', 'sportspress' ),
|
'sp_key' => __( 'Key', 'sportspress' ),
|
||||||
'sp_format' => __( 'Format', 'sportspress' ),
|
'sp_format' => __( 'Format', 'sportspress' ),
|
||||||
'sp_precision' => __( 'Precision', 'sportspress' ),
|
|
||||||
'sp_equation' => __( 'Equation', 'sportspress' ),
|
'sp_equation' => __( 'Equation', 'sportspress' ),
|
||||||
'sp_order' => __( 'Sort Order', 'sportspress' ),
|
'sp_order' => __( 'Sort Order', 'sportspress' ),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ $sportspress_sports['baseball'] = array(
|
|||||||
'post_name' => 'w',
|
'post_name' => 'w',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'sp_equation' => '$w',
|
'sp_equation' => '$w',
|
||||||
|
'sp_format' => 'integer',
|
||||||
|
'sp_precision' => 1,
|
||||||
'sp_priority' => 1,
|
'sp_priority' => 1,
|
||||||
'sp_order' => 'DESC',
|
'sp_order' => 'DESC',
|
||||||
),
|
),
|
||||||
@@ -20,6 +22,8 @@ $sportspress_sports['baseball'] = array(
|
|||||||
'post_name' => 'l',
|
'post_name' => 'l',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'sp_equation' => '$l',
|
'sp_equation' => '$l',
|
||||||
|
'sp_format' => 'integer',
|
||||||
|
'sp_precision' => 1,
|
||||||
'sp_priority' => 2,
|
'sp_priority' => 2,
|
||||||
'sp_order' => 'ASC',
|
'sp_order' => 'ASC',
|
||||||
),
|
),
|
||||||
@@ -29,6 +33,8 @@ $sportspress_sports['baseball'] = array(
|
|||||||
'post_name' => 'pct',
|
'post_name' => 'pct',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'sp_equation' => '$w / $eventsplayed',
|
'sp_equation' => '$w / $eventsplayed',
|
||||||
|
'sp_format' => 'decimal',
|
||||||
|
'sp_precision' => 3,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@@ -36,6 +42,8 @@ $sportspress_sports['baseball'] = array(
|
|||||||
'post_name' => 'gb',
|
'post_name' => 'gb',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'sp_equation' => '( $wmax + $l - $w - $lmax ) / 2',
|
'sp_equation' => '( $wmax + $l - $w - $lmax ) / 2',
|
||||||
|
'sp_format' => 'decimal',
|
||||||
|
'sp_precision' => 2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@@ -43,6 +51,8 @@ $sportspress_sports['baseball'] = array(
|
|||||||
'post_name' => 'rs',
|
'post_name' => 'rs',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'sp_equation' => '$rfor',
|
'sp_equation' => '$rfor',
|
||||||
|
'sp_format' => 'integer',
|
||||||
|
'sp_precision' => 1,
|
||||||
'sp_priority' => 3,
|
'sp_priority' => 3,
|
||||||
'sp_order' => 'DESC',
|
'sp_order' => 'DESC',
|
||||||
),
|
),
|
||||||
@@ -52,6 +62,8 @@ $sportspress_sports['baseball'] = array(
|
|||||||
'post_name' => 'ra',
|
'post_name' => 'ra',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'sp_equation' => '$ragainst',
|
'sp_equation' => '$ragainst',
|
||||||
|
'sp_format' => 'integer',
|
||||||
|
'sp_precision' => 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@@ -59,6 +71,8 @@ $sportspress_sports['baseball'] = array(
|
|||||||
'post_name' => 'strk',
|
'post_name' => 'strk',
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'sp_equation' => '$streak',
|
'sp_equation' => '$streak',
|
||||||
|
'sp_format' => 'integer',
|
||||||
|
'sp_precision' => 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -9,13 +9,12 @@
|
|||||||
$data = get_posts( $args );
|
$data = get_posts( $args );
|
||||||
?>
|
?>
|
||||||
<h3 class="title"><?php _e( 'Table Columns', 'sportspress' ); ?></h3>
|
<h3 class="title"><?php _e( 'Table Columns', 'sportspress' ); ?></h3>
|
||||||
<table class="widefat">
|
<table class="widefat sp-config-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Format', 'sportspress' ); ?></th>
|
<th><?php _e( 'Format', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Precision', 'sportspress' ); ?></th>
|
|
||||||
<th><?php _e( 'Equation', 'sportspress' ); ?></th>
|
<th><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -25,14 +24,13 @@
|
|||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><?php echo $row->post_name; ?></td>
|
<td><?php echo $row->post_name; ?></td>
|
||||||
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
||||||
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
|
|
||||||
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
||||||
<td><?php echo sp_get_post_order( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_order( $row->ID ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $i++; endforeach; ?>
|
<?php $i++; endforeach; ?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7"><a href="<?php echo admin_url( 'edit.php?post_type=sp_column' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Table Columns', 'sportspress' ) ); ?></a></th>
|
<th colspan="5"><a href="<?php echo admin_url( 'edit.php?post_type=sp_column' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Table Columns', 'sportspress' ) ); ?></a></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -48,13 +46,12 @@
|
|||||||
$data = get_posts( $args );
|
$data = get_posts( $args );
|
||||||
?>
|
?>
|
||||||
<h3 class="title"><?php _e( 'Statistics', 'sportspress' ); ?></h3>
|
<h3 class="title"><?php _e( 'Statistics', 'sportspress' ); ?></h3>
|
||||||
<table class="widefat">
|
<table class="widefat sp-config-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Format', 'sportspress' ); ?></th>
|
<th><?php _e( 'Format', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Precision', 'sportspress' ); ?></th>
|
|
||||||
<th><?php _e( 'Equation', 'sportspress' ); ?></th>
|
<th><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -64,14 +61,13 @@
|
|||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><?php echo $row->post_name; ?></td>
|
<td><?php echo $row->post_name; ?></td>
|
||||||
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
||||||
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
|
|
||||||
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
||||||
<td><?php echo sp_get_post_order( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_order( $row->ID ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $i++; endforeach; ?>
|
<?php $i++; endforeach; ?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7"><a href="<?php echo admin_url( 'edit.php?post_type=sp_statistic' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Statistics', 'sportspress' ) ); ?></a></th>
|
<th colspan="5"><a href="<?php echo admin_url( 'edit.php?post_type=sp_statistic' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Statistics', 'sportspress' ) ); ?></a></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -87,12 +83,14 @@
|
|||||||
$data = get_posts( $args );
|
$data = get_posts( $args );
|
||||||
?>
|
?>
|
||||||
<h3 class="title"><?php _e( 'Results', 'sportspress' ); ?></h3>
|
<h3 class="title"><?php _e( 'Results', 'sportspress' ); ?></h3>
|
||||||
<table class="widefat">
|
<table class="widefat sp-config-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Format', 'sportspress' ); ?></th>
|
<th><?php _e( 'Format', 'sportspress' ); ?></th>
|
||||||
|
<th><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||||
|
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||||
@@ -100,11 +98,13 @@
|
|||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><?php echo $row->post_name; ?></td>
|
<td><?php echo $row->post_name; ?></td>
|
||||||
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>—</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $i++; endforeach; ?>
|
<?php $i++; endforeach; ?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4"><a href="<?php echo admin_url( 'edit.php?post_type=sp_result' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Results', 'sportspress' ) ); ?></a></th>
|
<th colspan="5"><a href="<?php echo admin_url( 'edit.php?post_type=sp_result' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Results', 'sportspress' ) ); ?></a></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -120,22 +120,28 @@
|
|||||||
$data = get_posts( $args );
|
$data = get_posts( $args );
|
||||||
?>
|
?>
|
||||||
<h3 class="title"><?php _e( 'Outcomes', 'sportspress' ); ?></h3>
|
<h3 class="title"><?php _e( 'Outcomes', 'sportspress' ); ?></h3>
|
||||||
<table class="widefat">
|
<table class="widefat sp-config-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
<th><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||||
|
<th><?php _e( 'Format', 'sportspress' ); ?></th>
|
||||||
|
<th><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||||
|
<th><?php _e( 'Sort Order', 'sportspress' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><?php echo $row->post_name; ?></td>
|
<td><?php echo $row->post_name; ?></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>—</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $i++; endforeach; ?>
|
<?php $i++; endforeach; ?>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="3"><a href="<?php echo admin_url( 'edit.php?post_type=sp_outcome' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Outcomes', 'sportspress' ) ); ?></a></th>
|
<th colspan="5"><a href="<?php echo admin_url( 'edit.php?post_type=sp_outcome' ); ?>"><?php printf( __( 'Edit %s', 'sportspress' ), __( 'Outcomes', 'sportspress' ) ); ?></a></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -103,6 +103,10 @@
|
|||||||
min-width: 14px;
|
min-width: 14px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.sp-config-table th,
|
||||||
|
.sp-config-table td {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
.widefat th.column-sp_logo,
|
.widefat th.column-sp_logo,
|
||||||
.widefat td.column-sp_logo {
|
.widefat td.column-sp_logo {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
|
|||||||
@@ -79,9 +79,6 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
|
|||||||
case 'sp_format':
|
case 'sp_format':
|
||||||
echo sp_get_post_format( $post_id );
|
echo sp_get_post_format( $post_id );
|
||||||
break;
|
break;
|
||||||
case 'sp_precision':
|
|
||||||
echo sp_get_post_precision( $post_id );
|
|
||||||
break;
|
|
||||||
case 'sp_player':
|
case 'sp_player':
|
||||||
echo sp_the_posts( $post_id, 'sp_player' );
|
echo sp_the_posts( $post_id, 'sp_player' );
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -106,7 +106,12 @@ if ( !function_exists( 'sp_get_post_format' ) ) {
|
|||||||
$format = get_post_meta ( $post_id, 'sp_format', true );
|
$format = get_post_meta ( $post_id, 'sp_format', true );
|
||||||
if ( $format ):
|
if ( $format ):
|
||||||
global $sportspress_config_formats;
|
global $sportspress_config_formats;
|
||||||
return sp_array_value( $sportspress_config_formats, $format, '—' );
|
$format_str = sp_array_value( $sportspress_config_formats, $format, '—' );
|
||||||
|
if ( in_array( $format, array( 'decimal', 'time' ) ) ):
|
||||||
|
return $format_str . ' (' . sp_get_post_precision( $post_id ) . ')';
|
||||||
|
else:
|
||||||
|
return $format_str;
|
||||||
|
endif;
|
||||||
else:
|
else:
|
||||||
return '—';
|
return '—';
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
Reference in New Issue
Block a user