Enable player performance icons instead of values
This commit is contained in:
@@ -249,7 +249,9 @@ table.widefat.sp-sortable-table tr:nth-child(2n-1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sp-admin-config-table th.radio,
|
.sp-admin-config-table th.radio,
|
||||||
.sp-admin-config-table td.radio {
|
.sp-admin-config-table td.radio,
|
||||||
|
.sp-admin-config-table th.icon,
|
||||||
|
.sp-admin-config-table td.icon {
|
||||||
width: 1%;
|
width: 1%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,10 @@
|
|||||||
content: "\f140";
|
content: "\f140";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
.sp-data-table .data-number,
|
||||||
|
.sp-data-table .data-rank {
|
||||||
|
width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Pagination */
|
/* Pagination */
|
||||||
.sp-paginated-table {
|
.sp-paginated-table {
|
||||||
@@ -126,6 +130,9 @@
|
|||||||
.sp-event-performance .sub-out:before {
|
.sp-event-performance .sub-out:before {
|
||||||
content: "\f142";
|
content: "\f142";
|
||||||
}
|
}
|
||||||
|
.sp-event-performance .sp-performance-icons {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
/* Event Calendar */
|
/* Event Calendar */
|
||||||
.sp-event-calendar tbody td, .sp-event-calendar thead th {
|
.sp-event-calendar tbody td, .sp-event-calendar thead th {
|
||||||
|
|||||||
@@ -79,14 +79,6 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
'id' => 'sportspress_event_show_logos',
|
'id' => 'sportspress_event_show_logos',
|
||||||
'default' => 'yes',
|
'default' => 'yes',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
),
|
|
||||||
|
|
||||||
array(
|
|
||||||
'title' => __( 'Venue', 'sportspress' ),
|
|
||||||
'desc' => __( 'Display maps', 'sportspress' ),
|
|
||||||
'id' => 'sportspress_event_show_maps',
|
|
||||||
'default' => 'yes',
|
|
||||||
'type' => 'checkbox',
|
|
||||||
'checkboxgroup' => 'start',
|
'checkboxgroup' => 'start',
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -96,7 +88,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
'id' => 'sportspress_event_show_players',
|
'id' => 'sportspress_event_show_players',
|
||||||
'default' => 'yes',
|
'default' => 'yes',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'checkboxgroup' => 'start',
|
'checkboxgroup' => '',
|
||||||
),
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -107,6 +99,26 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|||||||
'checkboxgroup' => 'end',
|
'checkboxgroup' => 'end',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Player Performance', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_event_performance_mode',
|
||||||
|
'default' => 'values',
|
||||||
|
'type' => 'radio',
|
||||||
|
'options' => array(
|
||||||
|
'values' => __( 'Values', 'sportspress' ),
|
||||||
|
'icons' => __( 'Icons', 'sportspress' ),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Venue', 'sportspress' ),
|
||||||
|
'desc' => __( 'Display maps', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_event_show_maps',
|
||||||
|
'default' => 'yes',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'checkboxgroup' => 'start',
|
||||||
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Staff', 'sportspress' ),
|
'title' => __( 'Staff', 'sportspress' ),
|
||||||
'desc' => __( 'Display staff', 'sportspress' ),
|
'desc' => __( 'Display staff', 'sportspress' ),
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
<table class="widefat sp-admin-config-table">
|
<table class="widefat sp-admin-config-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
|
<th class="radio" scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Variables', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Variables', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
||||||
@@ -143,6 +143,7 @@
|
|||||||
<table class="widefat sp-admin-config-table">
|
<table class="widefat sp-admin-config-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th class="icon" scope="col"><?php _e( 'Icon', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
||||||
@@ -151,6 +152,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
|
<td class="icon"><?php if ( has_post_thumbnail( $row->ID ) ) echo get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' ); ?></td>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><?php echo $row->post_name; ?></td>
|
<td><?php echo $row->post_name; ?></td>
|
||||||
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ class SP_Post_types {
|
|||||||
'publicly_queryable' => false,
|
'publicly_queryable' => false,
|
||||||
'exclude_from_search' => true,
|
'exclude_from_search' => true,
|
||||||
'hierarchical' => false,
|
'hierarchical' => false,
|
||||||
'supports' => array( 'title', 'page-attributes', 'excerpt' ),
|
'supports' => array( 'title', 'thumbnail', 'page-attributes', 'excerpt' ),
|
||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
'show_in_nav_menus' => false,
|
'show_in_nav_menus' => false,
|
||||||
'can_export' => false,
|
'can_export' => false,
|
||||||
|
|||||||
@@ -153,6 +153,18 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain = nu
|
|||||||
case 'Slug':
|
case 'Slug':
|
||||||
$translated_text = ( in_array( $typenow, array( 'sp_column', 'sp_statistic' ) ) ) ? __( 'Key', 'sportspress' ) : __( 'Variable', 'sportspress' );
|
$translated_text = ( in_array( $typenow, array( 'sp_column', 'sp_statistic' ) ) ) ? __( 'Key', 'sportspress' ) : __( 'Variable', 'sportspress' );
|
||||||
break;
|
break;
|
||||||
|
case 'Featured Image':
|
||||||
|
$translated_text = __( 'Icon', 'sportspress' );
|
||||||
|
break;
|
||||||
|
case 'Set Featured Image':
|
||||||
|
$translated_text = __( 'Select Icon', 'sportspress' );
|
||||||
|
break;
|
||||||
|
case 'Set featured image':
|
||||||
|
$translated_text = __( 'Add icon', 'sportspress' );
|
||||||
|
break;
|
||||||
|
case 'Remove featured image':
|
||||||
|
$translated_text = __( 'Remove icon', 'sportspress' );
|
||||||
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,16 @@ $link_posts = get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true :
|
|||||||
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
|
$mode = get_option( 'sportspress_event_performance_mode', 'values' );
|
||||||
|
|
||||||
|
// Get performance ids for icons
|
||||||
|
if ( $mode == 'icons' ):
|
||||||
|
$performance_ids = array();
|
||||||
|
$performance_posts = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'sp_performance' ) );
|
||||||
|
foreach ( $performance_posts as $post ):
|
||||||
|
$performance_ids[ $post->post_name ] = $post->ID;
|
||||||
|
endforeach;
|
||||||
|
endif;
|
||||||
|
|
||||||
if ( is_array( $teams ) ):
|
if ( is_array( $teams ) ):
|
||||||
foreach( $teams as $index => $team_id ):
|
foreach( $teams as $index => $team_id ):
|
||||||
@@ -63,9 +73,12 @@ if ( is_array( $teams ) ):
|
|||||||
<?php if ( $has_players ): ?>
|
<?php if ( $has_players ): ?>
|
||||||
<th class="data-number">#</th>
|
<th class="data-number">#</th>
|
||||||
<th class="data-name"><?php _e( 'Player', 'sportspress' ); ?></th>
|
<th class="data-name"><?php _e( 'Player', 'sportspress' ); ?></th>
|
||||||
<?php endif; foreach( $labels as $key => $label ): ?>
|
<?php endif; ?>
|
||||||
|
<?php if ( $mode == 'values' ): foreach( $labels as $key => $label ): ?>
|
||||||
<th class="data-<?php echo $key; ?>"><?php echo $label; ?></th>
|
<th class="data-<?php echo $key; ?>"><?php echo $label; ?></th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; else: ?>
|
||||||
|
<th class="sp-performance-icons"> </th>
|
||||||
|
<?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<?php if ( $show_players && $has_players ): ?>
|
<?php if ( $show_players && $has_players ): ?>
|
||||||
@@ -115,17 +128,17 @@ if ( is_array( $teams ) ):
|
|||||||
endif;
|
endif;
|
||||||
|
|
||||||
echo '<td class="data-name">' . $name . '</td>';
|
echo '<td class="data-name">' . $name . '</td>';
|
||||||
|
|
||||||
|
if ( $mode == 'icons' ); echo '<td class="sp-performance-icons">';
|
||||||
|
|
||||||
foreach( $labels as $key => $label ):
|
foreach( $labels as $key => $label ):
|
||||||
if ( $key == 'name' )
|
if ( $key == 'name' )
|
||||||
continue;
|
continue;
|
||||||
|
$value = '—';
|
||||||
if ( $key == 'position' ):
|
if ( $key == 'position' ):
|
||||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||||
$position = get_term_by( 'id', $row[ $key ], 'sp_position' );
|
$position = get_term_by( 'id', $row[ $key ], 'sp_position' );
|
||||||
$value = $position->name;
|
if ( $position ) $value = $position->name;
|
||||||
else:
|
|
||||||
$value = '—';
|
|
||||||
endif;
|
endif;
|
||||||
else:
|
else:
|
||||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||||
@@ -138,8 +151,18 @@ if ( is_array( $teams ) ):
|
|||||||
$totals[ $key ] = 0;
|
$totals[ $key ] = 0;
|
||||||
endif;
|
endif;
|
||||||
$totals[ $key ] += $value;
|
$totals[ $key ] += $value;
|
||||||
echo '<td class="data-' . $key . '">' . $value . '</td>';
|
|
||||||
|
if ( $mode == 'values' ):
|
||||||
|
echo '<td class="data-' . $key . '">' . $value . '</td>';
|
||||||
|
elseif ( intval( $value ) && $mode == 'icons' ):
|
||||||
|
$performance_id = sp_array_value( $performance_ids, $key, null );
|
||||||
|
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
|
||||||
|
echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
|
||||||
|
endif;
|
||||||
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
|
if ( $mode == 'icons' ); echo '</td>';
|
||||||
|
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
@@ -160,6 +183,8 @@ if ( is_array( $teams ) ):
|
|||||||
|
|
||||||
$row = $data[0];
|
$row = $data[0];
|
||||||
|
|
||||||
|
if ( $mode == 'icons' ) echo '<td class="sp-performance-icons">';
|
||||||
|
|
||||||
foreach( $labels as $key => $label ):
|
foreach( $labels as $key => $label ):
|
||||||
if ( $key == 'name' )
|
if ( $key == 'name' )
|
||||||
continue;
|
continue;
|
||||||
@@ -170,8 +195,18 @@ if ( is_array( $teams ) ):
|
|||||||
else:
|
else:
|
||||||
$value = sp_array_value( $totals, $key, 0 );
|
$value = sp_array_value( $totals, $key, 0 );
|
||||||
endif;
|
endif;
|
||||||
echo '<td class="data-' . $key . '">' . $value . '</td>';
|
|
||||||
|
if ( $mode == 'values' ):
|
||||||
|
echo '<td class="data-' . $key . '">' . $value . '</td>';
|
||||||
|
elseif ( intval( $value ) && $mode == 'icons' ):
|
||||||
|
$performance_id = sp_array_value( $performance_ids, $key, null );
|
||||||
|
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
|
||||||
|
echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
|
||||||
|
endif;
|
||||||
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
|
if ( $mode == 'icons' ) echo '</td>';
|
||||||
?>
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
</<?php echo ( $has_players ? 'tfoot' : 'tbody' ); ?>>
|
</<?php echo ( $has_players ? 'tfoot' : 'tbody' ); ?>>
|
||||||
|
|||||||
Reference in New Issue
Block a user