Add checkbox type to event performance
This commit is contained in:
@@ -133,6 +133,10 @@
|
||||
.sp-data-table .data-rank {
|
||||
width: 1px;
|
||||
}
|
||||
.sp-data-table .sp-checkbox {
|
||||
font-family: sportspress;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
/* Post Content */
|
||||
.sp-post-content {
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 66 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -449,7 +449,8 @@ class SP_Meta_Box_Event_Performance {
|
||||
$placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) );
|
||||
?>
|
||||
<td>
|
||||
<?php if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) { ?>
|
||||
<?php $format = sp_array_value( $formats, $column, 'number' ); ?>
|
||||
<?php if ( 'time' === $format ) { ?>
|
||||
<?php
|
||||
$intval = intval( $value );
|
||||
$timeval = gmdate( 'i:s', $intval );
|
||||
@@ -463,6 +464,9 @@ class SP_Meta_Box_Event_Performance {
|
||||
|
||||
<input class="sp-player-<?php echo $column; ?>-input sp-convert-time-input sp-sync-input" type="text" name="sp_times[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $timeval ); ?>" placeholder="<?php echo $placeholder; ?>" />
|
||||
<input class="sp-convert-time-output" type="hidden" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" />
|
||||
<?php } elseif ( 'checkbox' === $format ) { ?>
|
||||
<input type="hidden" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="0" />
|
||||
<input class="sp-player-<?php echo $column; ?>-input sp-sync-input" type="checkbox" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="1" data-value="<?php echo $value; ?>" <?php checked( $value ); ?> />
|
||||
<?php } else { ?>
|
||||
<input class="sp-player-<?php echo $column; ?>-input sp-sync-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo $placeholder; ?>" />
|
||||
<?php } ?>
|
||||
|
||||
@@ -77,7 +77,7 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
|
||||
<p class="sp-format-selector">
|
||||
<select name="sp_format">
|
||||
<?php
|
||||
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ) ) );
|
||||
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ), 'checkbox' => __( 'Checkbox', 'sportspress' ) ) );
|
||||
foreach ( $options as $key => $value ):
|
||||
printf( '<option value="%s" %s>%s</option>', $key, selected( $key == $format, true, false ), $value );
|
||||
endforeach;
|
||||
|
||||
@@ -533,7 +533,7 @@ if ( !function_exists( 'sp_get_post_format' ) ) {
|
||||
function sp_get_post_format( $post_id ) {
|
||||
$format = get_post_meta ( $post_id, 'sp_format', true );
|
||||
if ( isset( $format ) ):
|
||||
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ) ) );
|
||||
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ), 'checkbox' => __( 'Checkbox', 'sportspress' ) ) );
|
||||
return sp_array_value( $options, $format, __( 'Number', 'sportspress' ) );
|
||||
else:
|
||||
return __( 'Number', 'sportspress' );
|
||||
@@ -547,6 +547,7 @@ if ( !function_exists( 'sp_get_format_placeholder' ) ) {
|
||||
'number' => 0,
|
||||
'time' => '0:00',
|
||||
'text' => ' ',
|
||||
'checkbox' => ' ',
|
||||
) );
|
||||
return sp_array_value( $placeholders, $key, 0 );
|
||||
}
|
||||
|
||||
@@ -163,7 +163,11 @@ $i = 0;
|
||||
endif;
|
||||
else:
|
||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||
$value = $row[ $key ];
|
||||
if ( 'checkbox' === $format ):
|
||||
$value = '<span class="sp-checkbox">' . $row[ $key ] . '</span>';
|
||||
else:
|
||||
$value = $row[ $key ];
|
||||
endif;
|
||||
else:
|
||||
$value = $placeholder;
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user