diff --git a/assets/css/admin.css b/assets/css/admin.css index cbc1ab1e..512051ba 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -91,8 +91,10 @@ #sp_profilediv .wp-editor-container { background-color:#fff; } +.sp-data-table-container { + overflow: auto; +} .sp-data-table td { - padding: 4px 7px; line-height: 2; } .sp-data-table td:first-child { diff --git a/sportspress-functions.php b/sportspress-functions.php index 42f6451a..7a4dcad0 100644 --- a/sportspress-functions.php +++ b/sportspress-functions.php @@ -496,39 +496,41 @@ if ( !function_exists( 'sp_get_var_equations' ) ) { if ( !function_exists( 'sp_league_table' ) ) { function sp_league_table( $columns = array(), $data = array(), $placeholders = array() ) { ?> - - - - - - - - - - - $team_stats ): - if ( !$team_id ) continue; - $div = get_term( $team_id, 'sp_season' ); - ?> - - - $label ): - $value = sp_array_value( $team_stats, $column, '' ); - $placeholder = sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $column, 0 ); - ?> - +
+
- -
+ + + + + + + - -
+ $i = 0; + foreach ( $data as $team_id => $team_stats ): + if ( !$team_id ) continue; + $div = get_term( $team_id, 'sp_season' ); + ?> + + + + + $label ): + $value = sp_array_value( $team_stats, $column, '' ); + $placeholder = sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $column, 0 ); + ?> + + + + + + + - - - - - - - - - - - $player_stats ): - if ( !$player_id ) continue; - $div = get_term( $player_id, 'sp_season' ); - ?> - - - $label ): - $value = sp_array_value( $player_stats, $column, '' ); - $placeholder = sp_array_value( sp_array_value( $placeholders, $player_id, array() ), $column, 0 ); - ?> - +
+
- -
+ + + + + + + - -
+ $i = 0; + foreach ( $data as $player_id => $player_stats ): + if ( !$player_id ) continue; + $div = get_term( $player_id, 'sp_season' ); + ?> + + + + + $label ): + $value = sp_array_value( $player_stats, $column, '' ); + $placeholder = sp_array_value( sp_array_value( $placeholders, $player_id, array() ), $column, 0 ); + ?> + + + + + + + - - - - - - - - - - - - - - +
+
+ + + + + + + + + $div_stats ): - if ( !$div_id ) continue; - $div = get_term( $div_id, 'sp_season' ); + $i = 0; + if ( empty( $data ) ): ?> - - - $label ): - $value = sp_array_value( $div_stats, $column, '' ); - $placeholder = sp_array_value( sp_array_value( $placeholders, $div_id, array() ), $column, 0 ); - ?> - - - + + + - -
- name; ?> -
+ else: + foreach ( $data as $div_id => $div_stats ): + if ( !$div_id ) continue; + $div = get_term( $div_id, 'sp_season' ); + ?> + + + name; ?> + + $label ): + $value = sp_array_value( $div_stats, $column, '' ); + $placeholder = sp_array_value( sp_array_value( $placeholders, $div_id, array() ), $column, 0 ); + ?> + + + + + + + - - - - - - - - - - - $team_stats ): - if ( empty( $team_stats ) ): - ?> - - $div_stats ): - if ( !$div_id ) continue; - $div = get_term( $div_id, 'sp_season' ); - ?> - - - $label ): - $value = sp_array_value( $div_stats, $column, '' ); - $placeholder = sp_array_value( sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $div_id, array() ), $column, 0 ); - ?> - - - - +
- name; ?> -
+ + + + + + + + + + $team_stats ): + if ( empty( $team_stats ) ): + ?> + + $div_stats ): + if ( !$div_id ) continue; + $div = get_term( $div_id, 'sp_season' ); + ?> + + + $label ): + $value = sp_array_value( $div_stats, $column, '' ); + $placeholder = sp_array_value( sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $div_id, array() ), $column, 0 ); + ?> + + + + - -
+ name; ?> +
+ ?> + + + - - - - - - - - - - - - $team_results ): - if ( !$team_id ) continue; - ?> - - - $label ): - $value = sp_array_value( $team_results, $column, '' ); - ?> - +
+
- -
+ + + + + - + + + - -
- 'sp_outcome', - 'name' => 'sp_results[' . $team_id . '][outcome]', - 'show_option_none' => __( '-- Not set --', 'sportspress' ), - 'option_none_value' => 0, - 'sort_order' => 'ASC', - 'sort_column' => 'menu_order', - 'selected' => $value - ); - sp_dropdown_pages( $args ); - ?> -
+ $i = 0; + foreach ( $data as $team_id => $team_results ): + if ( !$team_id ) continue; + ?> + + + + + $label ): + $value = sp_array_value( $team_results, $column, '' ); + ?> + + + + 'sp_outcome', + 'name' => 'sp_results[' . $team_id . '][outcome]', + 'show_option_none' => __( '-- Not set --', 'sportspress' ), + 'option_none_value' => 0, + 'sort_order' => 'ASC', + 'sort_column' => 'menu_order', + 'selected' => $value + ); + sp_dropdown_pages( $args ); + ?> + + + + + + - - - - - - - - - - - - $player_statistics ): - if ( !$player_id ) continue; +
+
+ + + + + + + + + + + $player_statistics ): + if ( !$player_id ) continue; + ?> + + + $label ): + $value = sp_array_value( $player_statistics, $column, '' ); + ?> + + + + + - - + + $label ): + $player_id = 0; + $player_statistics = sp_array_value( $data, 0, array() ); $value = sp_array_value( $player_statistics, $column, '' ); ?> - + - + - - - - $label ): - $player_id = 0; - $player_statistics = sp_array_value( $data, 0, array() ); - $value = sp_array_value( $player_statistics, $column, '' ); - ?> - - - - - -
+ + + + + + +
- -
- - - - -  
 
+ + +