Add separate career totals option and group statistic settings
This commit is contained in:
@@ -23,6 +23,7 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
||||||
$league_num = sizeof( $leagues );
|
$league_num = sizeof( $leagues );
|
||||||
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
||||||
|
$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
|
||||||
|
|
||||||
if ( $leagues ) {
|
if ( $leagues ) {
|
||||||
if ( -1 == $sections ) {
|
if ( -1 == $sections ) {
|
||||||
@@ -36,11 +37,13 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true, $formats );
|
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true, $formats );
|
||||||
$i ++;
|
$i ++;
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
if ( $show_career_totals ) {
|
||||||
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?></strong></p>
|
?>
|
||||||
<?php
|
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?></strong></p>
|
||||||
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true );
|
<?php
|
||||||
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams );
|
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true );
|
||||||
|
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Determine order of sections
|
// Determine order of sections
|
||||||
if ( 1 == $sections ) {
|
if ( 1 == $sections ) {
|
||||||
@@ -61,11 +64,13 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
||||||
$i ++;
|
$i ++;
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
if ( $show_career_totals ) {
|
||||||
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?> — <?php echo $section_label; ?></strong></p>
|
?>
|
||||||
<?php
|
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?> — <?php echo $section_label; ?></strong></p>
|
||||||
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true, $section_id );
|
<?php
|
||||||
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true, $section_id );
|
||||||
|
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
||||||
|
}
|
||||||
$s ++;
|
$s ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,22 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|||||||
'checkboxgroup' => 'end',
|
'checkboxgroup' => 'end',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Nationality', 'sportspress' ),
|
||||||
|
'desc' => __( 'Display national flags', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_player_show_flags',
|
||||||
|
'default' => 'yes',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
),
|
||||||
|
) ),
|
||||||
|
|
||||||
|
array(
|
||||||
|
array( 'type' => 'sectionend', 'id' => 'player_options' ),
|
||||||
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
array( 'title' => __( 'Statistics', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_statistic_options' ),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Columns', 'sportspress' ),
|
'title' => __( 'Columns', 'sportspress' ),
|
||||||
'id' => 'sportspress_player_columns',
|
'id' => 'sportspress_player_columns',
|
||||||
@@ -134,7 +150,7 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Statistics', 'sportspress' ),
|
'title' => __( 'Categories', 'sportspress' ),
|
||||||
'id' => 'sportspress_player_performance_sections',
|
'id' => 'sportspress_player_performance_sections',
|
||||||
'default' => -1,
|
'default' => -1,
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
@@ -146,24 +162,28 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Total', 'sportspress' ),
|
'title' => __( 'Display', 'sportspress' ),
|
||||||
'desc' => __( 'Display total', 'sportspress' ),
|
'desc' => __( 'Total', 'sportspress' ),
|
||||||
'id' => 'sportspress_player_show_total',
|
'id' => 'sportspress_player_show_total',
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
|
'checkboxgroup' => 'start',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Nationality', 'sportspress' ),
|
'desc' => __( 'Career Total', 'sportspress' ),
|
||||||
'desc' => __( 'Display national flags', 'sportspress' ),
|
'id' => 'sportspress_player_show_career_total',
|
||||||
'id' => 'sportspress_player_show_flags',
|
'default' => 'no',
|
||||||
'default' => 'yes',
|
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
|
'checkboxgroup' => 'end',
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
apply_filters( 'sportspress_player_statistic_options', array(
|
||||||
) ),
|
) ),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
array( 'type' => 'sectionend', 'id' => 'player_options' ),
|
array( 'type' => 'sectionend', 'id' => 'player_statistic_options' ),
|
||||||
)
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -429,6 +429,11 @@ class SP_Install {
|
|||||||
update_option( 'sportspress_event_show_timeline', 'no' );
|
update_option( 'sportspress_event_show_timeline', 'no' );
|
||||||
update_option( 'sportspress_event_logos_show_team_names', 'no' );
|
update_option( 'sportspress_event_logos_show_team_names', 'no' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( version_compare( $version, '2.2.3', '<' ) ) {
|
||||||
|
$option = get_option( 'sportspress_player_show_total', 'no' );
|
||||||
|
update_option( 'sportspress_player_show_career_total', $option );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ if ( ! isset( $id ) )
|
|||||||
$player = new SP_Player( $id );
|
$player = new SP_Player( $id );
|
||||||
|
|
||||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
|
$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
|
||||||
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
||||||
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
|
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
|
||||||
$leagues = get_the_terms( $id, 'sp_league' );
|
$leagues = get_the_terms( $id, 'sp_league' );
|
||||||
@@ -65,11 +66,13 @@ if ( is_array( $leagues ) ):
|
|||||||
sp_get_template( 'player-statistics-league.php', $args );
|
sp_get_template( 'player-statistics-league.php', $args );
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
sp_get_template( 'player-statistics-league.php', array(
|
if ( $show_career_totals ) {
|
||||||
'data' => $player->data( 0, false, $section_id ),
|
sp_get_template( 'player-statistics-league.php', array(
|
||||||
'caption' => __( 'Career Total', 'sportspress' ),
|
'data' => $player->data( 0, false, $section_id ),
|
||||||
'scrollable' => $scrollable,
|
'caption' => __( 'Career Total', 'sportspress' ),
|
||||||
'hide_teams' => true,
|
'scrollable' => $scrollable,
|
||||||
) );
|
'hide_teams' => true,
|
||||||
|
) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
Reference in New Issue
Block a user