Dynamic colors in tables and fix #67

This commit is contained in:
Brian Miyaji
2014-10-23 13:27:20 +11:00
parent 12064bd8c3
commit 6344be35a3
4 changed files with 41 additions and 25 deletions

View File

@@ -103,22 +103,19 @@ foreach ( $data as $team_id => $row ):
if ( ! $name ) continue;
// Generate tags for highlighted team
$before = $after = $class = '';
$tr_class = $td_class = '';
if ( $highlight == $team_id ):
$before = '<strong>';
$after = '</strong>';
$class = ' highlighted';
$tr_class = ' highlighted';
$td_class = ' sp-highlight';
endif;
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . $class . '">';
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . $tr_class . '">';
// Rank
$output .= '<td class="data-rank">' . $before . sp_array_value( $row, 'pos' ) . $after . '</td>';
$output .= '<td class="data-rank' . $td_class . '">' . sp_array_value( $row, 'pos' ) . '</td>';
$name_class = '';
$name = $before . $name . $after;
if ( $show_team_logo ):
if ( has_post_thumbnail( $team_id ) ):
$logo = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' );
@@ -132,13 +129,13 @@ foreach ( $data as $team_id => $row ):
$name = '<a href="' . $permalink . '">' . $name . '</a>';
endif;
$output .= '<td class="data-name' . $name_class . '">' . $name . '</td>';
$output .= '<td class="data-name' . $name_class . $td_class . '">' . $name . '</td>';
foreach( $labels as $key => $value ):
if ( in_array( $key, array( 'pos', 'name' ) ) )
continue;
if ( ! is_array( $columns ) || in_array( $key, $columns ) )
$output .= '<td class="data-' . $key . '">' . $before . sp_array_value( $row, $key, '&mdash;' ) . $after . '</td>';
$output .= '<td class="data-' . $key . $td_class . '">' . sp_array_value( $row, $key, '&mdash;' ) . '</td>';
endforeach;
$output .= '</tr>';