Enable output of time and results without team names when in home and

away mode in event lists
This commit is contained in:
Brian Miyaji
2016-12-19 21:12:22 +11:00
parent 97dccd95ac
commit 61578d2331

View File

@@ -36,6 +36,8 @@ $defaults = array(
'columns' => null, 'columns' => null,
'show_all_events_link' => false, 'show_all_events_link' => false,
'show_title' => get_option( 'sportspress_event_list_show_title', 'yes' ) == 'yes' ? true : false, 'show_title' => get_option( 'sportspress_event_list_show_title', 'yes' ) == 'yes' ? true : false,
'title_format' => get_option( 'sportspress_event_list_title_format', 'title' ),
'time_format' => get_option( 'sportspress_event_list_time_format', 'combined' ),
); );
extract( $defaults, EXTR_SKIP ); extract( $defaults, EXTR_SKIP );
@@ -65,8 +67,6 @@ if ( $day != 'default' )
$calendar->day = $day; $calendar->day = $day;
$data = $calendar->data(); $data = $calendar->data();
$usecolumns = $calendar->columns; $usecolumns = $calendar->columns;
$title_format = get_option( 'sportspress_event_list_title_format', 'title' );
$time_format = get_option( 'sportspress_event_list_time_format', 'combined' );
if ( isset( $columns ) ): if ( isset( $columns ) ):
if ( is_array( $columns ) ) if ( is_array( $columns ) )
@@ -98,6 +98,7 @@ endif;
case 'homeaway': case 'homeaway':
if ( sp_column_active( $usecolumns, 'event' ) ) { if ( sp_column_active( $usecolumns, 'event' ) ) {
echo '<th class="data-home">' . __( 'Home', 'sportspress' ) . '</th>'; echo '<th class="data-home">' . __( 'Home', 'sportspress' ) . '</th>';
}
if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) { if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>'; echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
@@ -105,12 +106,13 @@ endif;
echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>'; echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
} }
if ( sp_column_active( $usecolumns, 'event' ) ) {
echo '<th class="data-away">' . __( 'Away', 'sportspress' ) . '</th>'; echo '<th class="data-away">' . __( 'Away', 'sportspress' ) . '</th>';
}
if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) { if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>'; echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
} }
}
break; break;
default: default:
if ( sp_column_active( $usecolumns, 'event' ) ) { if ( sp_column_active( $usecolumns, 'event' ) ) {
@@ -230,6 +232,7 @@ endif;
if ( sp_column_active( $usecolumns, 'event' ) ) { if ( sp_column_active( $usecolumns, 'event' ) ) {
$team = array_shift( $teams_array ); $team = array_shift( $teams_array );
echo '<td class="data-home' . $team_class . '">' . $team . '</td>'; echo '<td class="data-home' . $team_class . '">' . $team . '</td>';
}
if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) { if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
echo '<td class="data-time">'; echo '<td class="data-time">';
@@ -253,8 +256,10 @@ endif;
echo '</td>'; echo '</td>';
} }
if ( sp_column_active( $usecolumns, 'event' ) ) {
$team = array_shift( $teams_array ); $team = array_shift( $teams_array );
echo '<td class="data-away' . $team_class . '">' . $team . '</td>'; echo '<td class="data-away' . $team_class . '">' . $team . '</td>';
}
if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) { if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
echo '<td class="data-time">'; echo '<td class="data-time">';
@@ -263,7 +268,6 @@ endif;
if ( $link_events ) echo '</a>'; if ( $link_events ) echo '</a>';
echo '</td>'; echo '</td>';
} }
}
break; break;
default: default:
if ( sp_column_active( $usecolumns, 'event' ) ) { if ( sp_column_active( $usecolumns, 'event' ) ) {