Add per-league statistics editor to team

This commit is contained in:
Takumi
2013-07-31 00:39:12 +10:00
parent 156afd5e79
commit b355a7bb4c
5 changed files with 73 additions and 19 deletions

View File

@@ -36,16 +36,24 @@ function sp_player_stats_meta( $post ) {
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
$stats = (array)get_post_meta( $post->ID, 'sp_stats', true );
// Overall
$data = sp_array_combine( $teams, sp_array_value( $stats, 0, array() ) );
?>
<p><strong><?php _e( 'Overall', 'sportspress' ); ?></strong></p>
<?php sp_data_table( $data, 0, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
<?php
// Leagues
foreach ( $leagues as $league ):
if ( !$league ) continue;
$data = sp_array_combine( $teams, sp_array_value( $stats, $league->term_id, array() ) );
?>
<div>
<p><strong><?php echo $league->name; ?></strong></p>
<?php sp_data_table( $data, $league->term_id, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
</div>
<p><strong><?php echo $league->name; ?></strong></p>
<?php sp_data_table( $data, $league->term_id, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
<?php
endforeach;
}
function sp_player_profile_meta( $post ) {