Enable individual players to compete in events
This commit is contained in:
@@ -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' );
|
||||
|
||||
@@ -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 {
|
||||
|
||||
?>
|
||||
<div>
|
||||
<p><strong><?php echo get_the_title( $team_id ); ?></strong></p>
|
||||
<?php if ( $team_id ): ?>
|
||||
<p><strong><?php echo get_the_title( $team_id ); ?></strong></p>
|
||||
<?php elseif ( $i ): ?>
|
||||
<br>
|
||||
<?php endif; ?>
|
||||
<?php self::table( $labels, $columns, $data, $team_id, $i == 0 ); ?>
|
||||
</div>
|
||||
<?php
|
||||
@@ -83,7 +87,9 @@ class SP_Meta_Box_Event_Performance {
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
<th><?php _e( 'Status', 'sportspress' ); ?></th>
|
||||
<?php if ( $team_id ): ?>
|
||||
<th><?php _e( 'Status', 'sportspress' ); ?></th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
@@ -99,7 +105,9 @@ class SP_Meta_Box_Event_Performance {
|
||||
?>
|
||||
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="0" /></td>
|
||||
<?php endforeach; ?>
|
||||
<td> </td>
|
||||
<?php if ( $team_id ): ?>
|
||||
<td> </td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
@@ -137,10 +145,12 @@ class SP_Meta_Box_Event_Performance {
|
||||
<input class="sp-player-<?php echo $column; ?>-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="0" />
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
<td class="sp-status-selector">
|
||||
<?php echo self::status_select( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?>
|
||||
<?php echo self::sub_select( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?>
|
||||
</td>
|
||||
<?php if ( $team_id ): ?>
|
||||
<td class="sp-status-selector">
|
||||
<?php echo self::status_select( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?>
|
||||
<?php echo self::sub_select( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
@@ -59,10 +59,12 @@ class SP_Meta_Box_Event_Teams {
|
||||
'post_type' => '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 );
|
||||
?>
|
||||
</p>
|
||||
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
|
||||
|
||||
@@ -103,6 +103,7 @@ class SP_Meta_Box_Player_Statistics {
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']',
|
||||
'show_option_none' => __( '— None —', 'sportspress' ),
|
||||
'show_option_all' => __( '— Individual —', 'sportspress' ),
|
||||
'sort_order' => 'ASC',
|
||||
'sort_column' => 'menu_order',
|
||||
'selected' => $value,
|
||||
|
||||
Reference in New Issue
Block a user