diff --git a/includes/sp-template-functions.php b/includes/sp-template-functions.php index 7439d15f..c73ffa9d 100644 --- a/includes/sp-template-functions.php +++ b/includes/sp-template-functions.php @@ -507,3 +507,76 @@ function sportspress_output_br_tag() {
get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false, 'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false, 'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false, + 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false, 'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false, 'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false, 'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false, @@ -91,13 +92,16 @@ if ( $show_title && false === $title && $id ): else $title = get_the_title( $id ); endif; +$labels = array(); +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid( 'eventlist_' ); ?>

- +
' . __( 'Time/Results', 'sportspress' ) . ''; + $labels[] = __( 'Time/Results', 'sportspress' ); } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) { echo ''; } @@ -125,10 +130,11 @@ endif; break; default: if ( sp_column_active( $usecolumns, 'event' ) ) { - if ( $title_format == 'teams' ) + if ( $title_format == 'teams' ){ echo ''; - else + } else { echo ''; + } } switch ( $time_format ) { @@ -241,17 +247,17 @@ endif; if ( $link_events ) $date_html = ''; - echo ''; + echo ''; switch ( $title_format ) { case 'homeaway': if ( sp_column_active( $usecolumns, 'event' ) ) { $team = array_shift( $teams_array ); - echo ''; + echo ''; } if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) { - echo ''; } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) { - echo ''; + echo ''; } if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) { - echo ''; + echo ''; } else { $title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title; if ( $link_events ) $title_html = ''; - echo ''; + echo ''; } } switch ( $time_format ) { case 'separate': if ( sp_column_active( $usecolumns, 'time' ) ) { - echo ''; } if ( sp_column_active( $usecolumns, 'results' ) ) { - echo '
' . __( 'Results', 'sportspress' ) . '' . __( 'Teams', 'sportspress' ) . '' . __( 'Event', 'sportspress' ) . '' . $date_html . '' . $date_html . '' . $team . '' . $team . ''; + echo ''; if ( $link_events ) echo ''; echo ''; + echo ''; if ( $link_events ) echo '' . $team . '' . $team . ''; + echo ''; if ( $link_events ) echo ''; @@ -288,25 +294,25 @@ endif; default: if ( sp_column_active( $usecolumns, 'event' ) ) { if ( $title_format == 'teams' ) { - echo '' . $teams_output . '' . $teams_output . '' . $title_html . '' . $title_html . ''; + echo ''; if ( $link_events ) echo ''; echo ''; + echo ''; if ( $link_events ) echo ''; + echo ''; if ( $link_events ) echo ''; @@ -328,7 +334,7 @@ endif; break; case 'results': if ( sp_column_active( $usecolumns, 'results' ) ) { - echo ''; + echo ''; if ( $link_events ) echo ''; + echo ''; if ( $link_events ) echo ''; + echo ''; $leagues = get_the_terms( $event->ID, 'sp_league' ); if ( $leagues ): foreach ( $leagues as $league ): echo $league->name; @@ -364,7 +370,7 @@ endif; endif; if ( sp_column_active( $usecolumns, 'season' ) ): - echo ''; + echo ''; $seasons = get_the_terms( $event->ID, 'sp_season' ); if ( $seasons ): foreach ( $seasons as $season ): echo $season->name; @@ -373,7 +379,7 @@ endif; endif; if ( sp_column_active( $usecolumns, 'venue' ) ): - echo ''; + echo ''; if ( $link_venues ): the_terms( $event->ID, 'sp_venue' ); else: @@ -386,7 +392,7 @@ endif; endif; if ( sp_column_active( $usecolumns, 'article' ) ): - echo ''; + echo ''; if ( $link_events ) echo ''; + echo ''; $day = get_post_meta( $event->ID, 'sp_day', true ); if ( '' == $day ) { echo '-'; @@ -428,7 +434,12 @@ endif;
' . __( 'View all events', 'sportspress' ) . '
'; + } ?> diff --git a/templates/event-performance-table.php b/templates/event-performance-table.php index 51d5797e..d6deafbe 100644 --- a/templates/event-performance-table.php +++ b/templates/event-performance-table.php @@ -20,13 +20,21 @@ if ( ! isset( $class ) ) $class = null; // Initialize arrays if ( ! isset( $lineups ) ) $lineups = array(); if ( ! isset( $subs ) ) $subs = array(); + +$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false; +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid( 'performance_' ); +// If responsive tables are enabled then load the inline css code +if ( true == $responsive && $mode == 'values' ){ + sportspress_responsive_tables_css( $identifier ); +} ?>

- +
@@ -37,8 +45,10 @@ if ( ! isset( $subs ) ) $subs = array(); @@ -84,7 +94,7 @@ if ( ! isset( $subs ) ) $subs = array(); $number = sp_array_value( $row, 'number', ' ' ); // Player number - echo ''; + echo ''; } if ( $link_posts ): @@ -167,7 +177,7 @@ if ( ! isset( $subs ) ) $subs = array(); endif; if ( $mode == 'values' ): - $content .= ''; + $content .= ''; elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); $icons = ''; @@ -182,7 +192,7 @@ if ( ! isset( $subs ) ) $subs = array(); $name .= ' ' . $position . ''; endif; - echo ''; + echo ''; if ( $mode == 'icons' ): echo ''; @@ -208,10 +218,10 @@ if ( ! isset( $subs ) ) $subs = array();  '; + echo ''; } if ( $mode == 'values' ): - echo ''; + echo ''; endif; endif; @@ -235,7 +245,11 @@ if ( ! isset( $subs ) ) $subs = array(); endif; if ( $mode == 'values' ): - echo ''; + if ($key == 'position'){ + echo ''; + }else{ + echo ''; + } elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); $icons = ''; @@ -256,4 +270,4 @@ if ( ! isset( $subs ) ) $subs = array(); - + \ No newline at end of file diff --git a/templates/league-table.php b/templates/league-table.php index aa8112c6..499a97fc 100644 --- a/templates/league-table.php +++ b/templates/league-table.php @@ -19,6 +19,7 @@ $defaults = array( 'show_title' => get_option( 'sportspress_table_show_title', 'yes' ) == 'yes' ? true : false, 'show_team_logo' => get_option( 'sportspress_table_show_logos', 'yes' ) == 'yes' ? true : false, 'link_posts' => null, + 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false, 'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false, 'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false, 'paginated' => get_option( 'sportspress_table_paginated', 'yes' ) == 'yes' ? true : false, @@ -47,6 +48,9 @@ if ( $show_title && false === $title && $id ): $title = get_the_title( $id ); endif; +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid( 'table_' ); + $output = ''; if ( $title ) @@ -54,13 +58,16 @@ if ( $title ) $output .= '
'; -$output .= '
+ + ' . $number . '' . $number . '' . $value . '' . $value . '' . $name . '' . $name . '' . $content . ' ' . __( 'Total', 'sportspress' ) . '' . __( 'Total', 'sportspress' ) . '' . $value . '' . $value . '' . $value . '
' . '' . ''; +$output .= '
' . '' . ''; $data = $table->data(); // The first row should be column labels $labels = $data[0]; - +// If responsive tables are enabled then load the inline css code +if ( true == $responsive ){ + sportspress_responsive_tables_css( $identifier ); +} // Remove the first row to leave us with the actual data unset( $data[0] ); @@ -132,7 +139,7 @@ foreach ( $data as $team_id => $row ): $output .= ''; // Rank - $output .= ''; + $output .= ''; $name_class = ''; @@ -149,13 +156,13 @@ foreach ( $data as $team_id => $row ): $name = '' . $name . ''; endif; - $output .= ''; + $output .= ''; foreach( $labels as $key => $value ): if ( in_array( $key, array( 'pos', 'name' ) ) ) continue; if ( ! is_array( $columns ) || in_array( $key, $columns ) ) - $output .= ''; + $output .= ''; endforeach; $output .= ''; @@ -171,7 +178,6 @@ $output .= ''; if ( $show_full_table_link ) $output .= ''; - ?>
diff --git a/templates/player-list.php b/templates/player-list.php index 2d709711..fc72d42e 100644 --- a/templates/player-list.php +++ b/templates/player-list.php @@ -25,6 +25,7 @@ $defaults = array( 'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false, 'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false, 'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false, + 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false, 'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false, 'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false, 'paginated' => get_option( 'sportspress_list_paginated', 'yes' ) == 'yes' ? true : false, @@ -56,6 +57,12 @@ $data = $list->data(); // The first row should be column labels $labels = $data[0]; +//Create a unique identifier based on the current time in microseconds +$identifier = uniqid( 'playerlist_' ); +// If responsive tables are enabled then load the inline css code +if ( true == $responsive ){ + sportspress_responsive_tables_css( $identifier ); +} // Remove the first row to leave us with the actual data unset( $data[0] ); @@ -130,9 +137,9 @@ foreach ( $groups as $group ): // Rank or number if ( ! is_array( $labels ) || array_key_exists( 'number', $labels ) ): if ( isset( $orderby ) && $orderby != 'number' ): - $tbody .= '
'; + $tbody .= ''; else: - $tbody .= ''; + $tbody .= ''; endif; endif; @@ -162,7 +169,7 @@ foreach ( $groups as $group ): $name = '' . $name . ''; endif; - $tbody .= ''; + $tbody .= ''; if ( array_key_exists( 'team', $labels ) ): $team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) ); @@ -170,7 +177,7 @@ foreach ( $groups as $group ): if ( $link_teams && false !== get_post_status( $team ) ): $team_name = '' . $team_name . ''; endif; - $tbody .= ''; + $tbody .= ''; endif; if ( array_key_exists( 'position', $labels ) ): @@ -181,14 +188,14 @@ foreach ( $groups as $group ): $position_term = get_term_by( 'id', $position, 'sp_position', ARRAY_A ); $positions = sp_array_value( $position_term, 'name', '—' ); endif; - $tbody .= ''; + $tbody .= ''; endif; foreach( $labels as $key => $value ): if ( in_array( $key, array( 'number', 'name', 'team', 'position' ) ) ) continue; if ( ! is_array( $columns ) || in_array( $key, $columns ) ) - $tbody .= ''; + $tbody .= ''; endforeach; $tbody .= ''; @@ -207,7 +214,7 @@ foreach ( $groups as $group ): endif; $output .= '
' . - '
' . sp_array_value( $row, 'pos' ) . '' . sp_array_value( $row, 'pos' ) . '' . $name . '' . $name . '' . sp_array_value( $row, $key, '—' ) . '' . sp_array_value( $row, $key, '—' ) . '
' . ( $i + 1 ) . '' . ( $i + 1 ) . '' . sp_array_value( $row, 'number', ' ' ) . '' . sp_array_value( $row, 'number', ' ' ) . '' . $name . '' . $name . '' . $team_name . '' . $team_name . '' . $positions . '' . $positions . '' . sp_array_value( $row, $key, '—' ) . '' . sp_array_value( $row, $key, '—' ) . '
' . '' . ''; + '
' . '' . ''; if ( ! is_array( $labels ) || array_key_exists( 'number', $labels ) ): if ( in_array( $orderby, array( 'number', 'name' ) ) ):