From 2ef8ff584aa2ce5ad57d9c2bebfa9ca049590cfb Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 28 Mar 2015 11:27:35 +1100 Subject: [PATCH] Display career totals if available --- templates/player-statistics.php | 75 ++++++++++++++++----------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/templates/player-statistics.php b/templates/player-statistics.php index 6be98d9b..60469089 100644 --- a/templates/player-statistics.php +++ b/templates/player-statistics.php @@ -16,7 +16,6 @@ if ( ! isset( $id ) ) $player = new SP_Player( $id ); $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false; -$show_total = get_option( 'sportspress_player_show_total', 'no' ) == 'yes' ? true : false; $leagues = get_the_terms( $id, 'sp_league' ); // Loop through statistics for each league @@ -69,53 +68,51 @@ if ( is_array( $leagues ) ): endforeach; endif; -if ( $show_total ): - $data = $player->data( 0 ); +// Career total +$data = $player->data( 0 ); - // The first row should be column labels - $labels = $data[0]; +// The first row should be column labels +$labels = $data[0]; - // Remove the first row to leave us with the actual data - unset( $data[0] ); +// Remove the first row to leave us with the actual data +unset( $data[0] ); - // Skip if there are no rows in the table - if ( empty( $data ) ) - return false; +// Skip if there are no rows in the table +if ( empty( $data ) ) + return false; - $output = '

' . __( 'Career Total', 'sportspress' ) . '

' . - '
' . - '' . '' . ''; +$output = '

' . __( 'Career Total', 'sportspress' ) . '

' . + '
' . + '
' . '' . ''; - foreach( $labels as $key => $label ): +foreach( $labels as $key => $label ): + if ( 'team' == $key ) + continue; + $output .= ''; +endforeach; + +$output .= '' . '' . ''; + +$i = 0; + +foreach( $data as $season_id => $row ): + + $output .= ''; + + foreach( $labels as $key => $value ): if ( 'team' == $key ) continue; - $output .= ''; + $output .= ''; endforeach; - $output .= '' . '' . ''; + $output .= ''; - $i = 0; + $i++; - foreach( $data as $season_id => $row ): +endforeach; - $output .= ''; - - foreach( $labels as $key => $value ): - if ( 'team' == $key ) - continue; - $output .= ''; - endforeach; - - $output .= ''; - - $i++; - - endforeach; - - $output .= '' . '
' . $label . '
' . $label . '' . sp_array_value( $row, $key, '—' ) . '
' . sp_array_value( $row, $key, '—' ) . '
' . '
'; - ?> -
- -
- ' . '' . ''; +?> +
+ +
\ No newline at end of file