From 46cd25d73d31e2d46986ba733c5a25919431afea Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 10 Dec 2014 04:11:08 +1100 Subject: [PATCH] Enable individual players to compete in events --- .../post-types/class-sp-admin-meta-boxes.php | 2 ++ .../class-sp-meta-box-event-performance.php | 26 +++++++++++++------ .../class-sp-meta-box-event-teams.php | 6 +++-- .../class-sp-meta-box-player-statistics.php | 1 + includes/class-sp-event.php | 7 +++++ includes/class-sp-player.php | 18 ++++++++----- templates/event-performance.php | 16 ++++++++---- 7 files changed, 54 insertions(+), 22 deletions(-) diff --git a/includes/admin/post-types/class-sp-admin-meta-boxes.php b/includes/admin/post-types/class-sp-admin-meta-boxes.php index 8189b3d5..ead64146 100644 --- a/includes/admin/post-types/class-sp-admin-meta-boxes.php +++ b/includes/admin/post-types/class-sp-admin-meta-boxes.php @@ -125,6 +125,8 @@ class SP_Admin_Meta_Boxes { add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' ); if ( sizeof( array_filter( sp_array_value( $post_meta, 'sp_team', array() ) ) ) ): add_meta_box( 'sp_resultsdiv', __( 'Team Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' ); + endif; + if ( sizeof( array_filter( sp_array_value( $post_meta, 'sp_player', array() ) ) ) ): add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' ); endif; add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'low' ); diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php index 8c92c4c4..6d871d49 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php @@ -25,7 +25,7 @@ class SP_Meta_Box_Event_Performance { $i = 0; foreach ( $teams as $key => $team_id ): - if ( ! $team_id ) continue; + if ( -1 == $team_id ) continue; // Get results for players in the team $players = sp_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key ); @@ -33,7 +33,11 @@ class SP_Meta_Box_Event_Performance { ?>
-

+ +

+ +
+
- + + + @@ -99,7 +105,9 @@ class SP_Meta_Box_Event_Performance { ?> -   + +   + @@ -137,10 +145,12 @@ class SP_Meta_Box_Event_Performance { - - - - + + + + + + 'sp_team', 'name' => 'sp_team[]', 'class' => 'sportspress-pages', - 'show_option_none' => sprintf( __( '— None —', 'sportspress' ), 'Team' ), + 'show_option_none' => __( '— None —', 'sportspress' ), + 'show_option_all' => __( '— Individual —', 'sportspress' ), + 'values' => 'ID', 'selected' => $team, ); - wp_dropdown_pages( $args ); + sp_dropdown_pages( $args ); ?>