Change Statistic to Performance
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if ( !function_exists( 'sportspress_event_statistics' ) ) {
|
||||
function sportspress_event_statistics( $id = null ) {
|
||||
if ( !function_exists( 'sportspress_event_performance' ) ) {
|
||||
function sportspress_event_performance( $id = null ) {
|
||||
global $sportspress_options;
|
||||
|
||||
if ( ! $id )
|
||||
@@ -9,10 +9,10 @@ if ( !function_exists( 'sportspress_event_statistics' ) ) {
|
||||
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
||||
$staff = (array)get_post_meta( $id, 'sp_staff', false );
|
||||
$stats = (array)get_post_meta( $id, 'sp_players', true );
|
||||
$statistic_labels = sportspress_get_var_labels( 'sp_statistic' );
|
||||
$link_posts = sportspress_array_value( $sportspress_options, 'event_statistics_link_posts', true );
|
||||
$sortable = sportspress_array_value( $sportspress_options, 'event_statistics_sortable', true );
|
||||
$responsive = sportspress_array_value( $sportspress_options, 'event_statistics_responsive', true );
|
||||
$performance_labels = sportspress_get_var_labels( 'sp_performance' );
|
||||
$link_posts = sportspress_array_value( $sportspress_options, 'event_performance_link_posts', true );
|
||||
$sortable = sportspress_array_value( $sportspress_options, 'event_performance_sortable', true );
|
||||
$responsive = sportspress_array_value( $sportspress_options, 'event_performance_responsive', true );
|
||||
|
||||
$output = '';
|
||||
|
||||
@@ -28,12 +28,12 @@ if ( !function_exists( 'sportspress_event_statistics' ) ) {
|
||||
$output .= '<h3>' . get_the_title( $team_id ) . '</h3>';
|
||||
|
||||
$output .= '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-event-statistics sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
||||
'<table class="sp-event-performance sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
||||
|
||||
$output .= '<th class="data-number">#</th>';
|
||||
$output .= '<th class="data-number">' . __( 'Player', 'sportspress' ) . '</th>';
|
||||
|
||||
foreach( $statistic_labels as $key => $label ):
|
||||
foreach( $performance_labels as $key => $label ):
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
endforeach;
|
||||
|
||||
@@ -65,7 +65,7 @@ if ( !function_exists( 'sportspress_event_statistics' ) ) {
|
||||
|
||||
$output .= '<td class="data-name">' . $name . '</td>';
|
||||
|
||||
foreach( $statistic_labels as $key => $label ):
|
||||
foreach( $performance_labels as $key => $label ):
|
||||
if ( $key == 'name' )
|
||||
continue;
|
||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||
@@ -100,7 +100,7 @@ if ( !function_exists( 'sportspress_event_statistics' ) ) {
|
||||
|
||||
$row = $data[0];
|
||||
|
||||
foreach( $statistic_labels as $key => $label ):
|
||||
foreach( $performance_labels as $key => $label ):
|
||||
if ( $key == 'name' ):
|
||||
continue;
|
||||
endif;
|
||||
@@ -120,7 +120,7 @@ if ( !function_exists( 'sportspress_event_statistics' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
return apply_filters( 'sportspress_event_statistics', $output );
|
||||
return apply_filters( 'sportspress_event_performance', $output );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -48,16 +48,16 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
$statistics = sportspress_array_value( $r, 'statistics', null );
|
||||
$performance = sportspress_array_value( $r, 'performance', null );
|
||||
|
||||
if ( $r['orderby'] == 'default' ):
|
||||
$r['orderby'] = get_post_meta( $id, 'sp_orderby', true );
|
||||
$r['order'] = get_post_meta( $id, 'sp_order', true );
|
||||
else:
|
||||
global $sportspress_statistic_priorities;
|
||||
$sportspress_statistic_priorities = array(
|
||||
global $sportspress_performance_priorities;
|
||||
$sportspress_performance_priorities = array(
|
||||
array(
|
||||
'statistic' => $r['orderby'],
|
||||
'key' => $r['orderby'],
|
||||
'order' => $r['order'],
|
||||
),
|
||||
);
|
||||
@@ -94,7 +94,7 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
|
||||
if ( is_int( $r['number'] ) && $r['number'] > 0 )
|
||||
$limit = $r['number'];
|
||||
|
||||
foreach( $data as $player_id => $statistics ):
|
||||
foreach( $data as $player_id => $performance ):
|
||||
|
||||
if ( $r['show_names_on_hover'] ):
|
||||
$caption = get_the_title( $player_id );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
function sportspress_player_league_statistics( $league, $id = null ) {
|
||||
if ( !function_exists( 'sportspress_player_league_performance' ) ) {
|
||||
function sportspress_player_league_performance( $league, $id = null ) {
|
||||
|
||||
if ( ! $league )
|
||||
return false;
|
||||
@@ -8,7 +8,7 @@ if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
if ( ! $id )
|
||||
$id = get_the_ID();
|
||||
|
||||
$data = sportspress_get_player_statistics_data( $id, $league->term_id );
|
||||
$data = sportspress_get_player_performance_data( $id, $league->term_id );
|
||||
|
||||
// The first row should be column labels
|
||||
$labels = $data[0];
|
||||
@@ -22,7 +22,7 @@ if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
|
||||
$output = '<h4 class="sp-table-caption">' . $league->name . '</h4>' .
|
||||
'<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-player-statistics sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
'<table class="sp-player-performance sp-data-table sp-responsive-table">' . '<thead>' . '<tr>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
@@ -48,7 +48,7 @@ if ( !function_exists( 'sportspress_player_league_statistics' ) ) {
|
||||
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
return apply_filters( 'sportspress_player_league_statistics', $output );
|
||||
return apply_filters( 'sportspress_player_league_performance', $output );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
|
||||
$defaults = array(
|
||||
'number' => -1,
|
||||
'statistics' => null,
|
||||
'performance' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
'show_all_players_link' => false,
|
||||
@@ -31,16 +31,16 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
$statistics = sportspress_array_value( $r, 'statistics', null );
|
||||
$performance = sportspress_array_value( $r, 'performance', null );
|
||||
|
||||
if ( $r['orderby'] == 'default' ):
|
||||
$r['orderby'] = get_post_meta( $id, 'sp_orderby', true );
|
||||
$r['order'] = get_post_meta( $id, 'sp_order', true );
|
||||
else:
|
||||
global $sportspress_statistic_priorities;
|
||||
$sportspress_statistic_priorities = array(
|
||||
global $sportspress_performance_priorities;
|
||||
$sportspress_performance_priorities = array(
|
||||
array(
|
||||
'statistic' => $r['orderby'],
|
||||
'key' => $r['orderby'],
|
||||
'order' => $r['order'],
|
||||
),
|
||||
);
|
||||
@@ -54,7 +54,7 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
endif;
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( ! is_array( $statistics ) || $key == 'name' || in_array( $key, $statistics ) )
|
||||
if ( ! is_array( $performance ) || $key == 'name' || in_array( $key, $performance ) )
|
||||
$output .= '<th class="data-' . $key . '">'. $label . '</th>';
|
||||
endforeach;
|
||||
|
||||
@@ -91,7 +91,7 @@ if ( !function_exists( 'sportspress_player_list' ) ) {
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( $key == 'name' )
|
||||
continue;
|
||||
if ( ! is_array( $statistics ) || in_array( $key, $statistics ) )
|
||||
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
|
||||
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
||||
endforeach;
|
||||
|
||||
|
||||
22
admin/templates/player-performance.php
Normal file
22
admin/templates/player-performance.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if ( !function_exists( 'sportspress_player_performance' ) ) {
|
||||
function sportspress_player_performance( $id = null ) {
|
||||
|
||||
if ( ! $id )
|
||||
$id = get_the_ID();
|
||||
|
||||
$leagues = get_the_terms( $id, 'sp_league' );
|
||||
|
||||
$output = '';
|
||||
|
||||
// Loop through performance for each league
|
||||
if ( is_array( $leagues ) ):
|
||||
foreach ( $leagues as $league ):
|
||||
$output .= sportspress_player_league_performance( $league, $id );
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
return apply_filters( 'sportspress_player_performance', $output );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ if ( !function_exists( 'sportspress_player_roster' ) ) {
|
||||
$id = get_the_ID();
|
||||
|
||||
$defaults = array(
|
||||
'statistics' => null,
|
||||
'performance' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
);
|
||||
@@ -23,16 +23,16 @@ if ( !function_exists( 'sportspress_player_roster' ) ) {
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
$statistics = sportspress_array_value( $r, 'statistics', null );
|
||||
$performance = sportspress_array_value( $r, 'performance', null );
|
||||
|
||||
if ( $r['orderby'] == 'default' ):
|
||||
$r['orderby'] = get_post_meta( $id, 'sp_orderby', true );
|
||||
$r['order'] = get_post_meta( $id, 'sp_order', true );
|
||||
else:
|
||||
global $sportspress_statistic_priorities;
|
||||
$sportspress_statistic_priorities = array(
|
||||
global $sportspress_performance_priorities;
|
||||
$sportspress_performance_priorities = array(
|
||||
array(
|
||||
'statistic' => $r['orderby'],
|
||||
'key' => $r['orderby'],
|
||||
'order' => $r['order'],
|
||||
),
|
||||
);
|
||||
@@ -68,7 +68,7 @@ if ( !function_exists( 'sportspress_player_roster' ) ) {
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( $key == 'name' )
|
||||
continue;
|
||||
if ( ! is_array( $statistics ) || in_array( $key, $statistics ) )
|
||||
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
|
||||
$rows .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
||||
endforeach;
|
||||
|
||||
@@ -89,7 +89,7 @@ if ( !function_exists( 'sportspress_player_roster' ) ) {
|
||||
endif;
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( ! is_array( $statistics ) || $key == 'name' || in_array( $key, $statistics ) )
|
||||
if ( ! is_array( $performance ) || $key == 'name' || in_array( $key, $performance ) )
|
||||
$output .= '<th class="data-' . $key . '">'. $label . '</th>';
|
||||
endforeach;
|
||||
$output .= '</tr>' . '</thead>' . '<tbody>' . $rows . '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
if ( !function_exists( 'sportspress_player_statistics' ) ) {
|
||||
function sportspress_player_statistics( $id = null ) {
|
||||
|
||||
if ( ! $id )
|
||||
$id = get_the_ID();
|
||||
|
||||
$leagues = get_the_terms( $id, 'sp_league' );
|
||||
|
||||
$output = '';
|
||||
|
||||
// Loop through statistics for each league
|
||||
if ( is_array( $leagues ) ):
|
||||
foreach ( $leagues as $league ):
|
||||
$output .= sportspress_player_league_statistics( $league, $id );
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
return apply_filters( 'sportspress_player_statistics', $output );
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user