Bring back career totals table

This commit is contained in:
Brian Miyaji
2016-04-27 21:02:26 +10:00
parent 3befe925fc
commit 07a16ba0be
3 changed files with 21 additions and 1 deletions

View File

@@ -36,6 +36,11 @@ class SP_Meta_Box_Player_Statistics {
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true ); self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true );
$i ++; $i ++;
endforeach; endforeach;
?>
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?></strong></p>
<?php
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true );
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams );
} else { } else {
// Determine order of sections // Determine order of sections
if ( 1 == $sections ) { if ( 1 == $sections ) {
@@ -56,6 +61,11 @@ class SP_Meta_Box_Player_Statistics {
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 ); self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
$i ++; $i ++;
endforeach; endforeach;
?>
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?> &mdash; <?php echo $section_label; ?></strong></p>
<?php
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true, $section_id );
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
$s ++; $s ++;
} }
} }

View File

@@ -14,6 +14,8 @@ $output = '<h4 class="sp-table-caption">' . $caption . '</h4>' .
'<table class="sp-player-statistics sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '">' . '<thead>' . '<tr>'; '<table class="sp-player-statistics sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '">' . '<thead>' . '<tr>';
foreach( $labels as $key => $label ): foreach( $labels as $key => $label ):
if ( isset( $hide_teams ) && 'team' == $key )
continue;
$output .= '<th class="data-' . $key . '">' . $label . '</th>'; $output .= '<th class="data-' . $key . '">' . $label . '</th>';
endforeach; endforeach;
@@ -26,6 +28,8 @@ foreach( $data as $season_id => $row ):
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">'; $output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
foreach( $labels as $key => $value ): foreach( $labels as $key => $value ):
if ( isset( $hide_teams ) && 'team' == $key )
continue;
$output .= '<td class="data-' . $key . ( -1 === $season_id ? ' sp-highlight' : '' ) . '">' . sp_array_value( $row, $key, '' ) . '</td>'; $output .= '<td class="data-' . $key . ( -1 === $season_id ? ' sp-highlight' : '' ) . '">' . sp_array_value( $row, $key, '' ) . '</td>';
endforeach; endforeach;

View File

@@ -55,10 +55,16 @@ if ( is_array( $leagues ) ):
sp_get_template( 'player-statistics-league.php', array( sp_get_template( 'player-statistics-league.php', array(
'data' => $player->data( $league->term_id, false, $section_id ), 'data' => $player->data( $league->term_id, false, $section_id ),
'league' => $league,
'caption' => $caption, 'caption' => $caption,
'scrollable' => $scrollable, 'scrollable' => $scrollable,
) ); ) );
endforeach; endforeach;
sp_get_template( 'player-statistics-league.php', array(
'data' => $player->data( 0, false, $section_id ),
'caption' => __( 'Career Total', 'sportspress' ),
'scrollable' => $scrollable,
'hide_teams' => true,
) );
} }
endif; endif;