diff --git a/assets/css/admin.css b/assets/css/admin.css index 69270372..a861fb39 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -249,7 +249,9 @@ table.widefat.sp-sortable-table tr:nth-child(2n-1) { } .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%; text-align: center; } diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index e985f367..81b5f83c 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -51,6 +51,10 @@ content: "\f140"; position: absolute; } +.sp-data-table .data-number, +.sp-data-table .data-rank { + width: 1px; +} /* Pagination */ .sp-paginated-table { @@ -126,6 +130,9 @@ .sp-event-performance .sub-out:before { content: "\f142"; } +.sp-event-performance .sp-performance-icons { + width: 25%; +} /* Event Calendar */ .sp-event-calendar tbody td, .sp-event-calendar thead th { diff --git a/includes/admin/settings/class-sp-settings-events.php b/includes/admin/settings/class-sp-settings-events.php index 5567ddb9..fff87342 100644 --- a/includes/admin/settings/class-sp-settings-events.php +++ b/includes/admin/settings/class-sp-settings-events.php @@ -79,14 +79,6 @@ class SP_Settings_Events extends SP_Settings_Page { 'id' => 'sportspress_event_show_logos', 'default' => 'yes', 'type' => 'checkbox', - ), - - array( - 'title' => __( 'Venue', 'sportspress' ), - 'desc' => __( 'Display maps', 'sportspress' ), - 'id' => 'sportspress_event_show_maps', - 'default' => 'yes', - 'type' => 'checkbox', 'checkboxgroup' => 'start', ), @@ -96,7 +88,7 @@ class SP_Settings_Events extends SP_Settings_Page { 'id' => 'sportspress_event_show_players', 'default' => 'yes', 'type' => 'checkbox', - 'checkboxgroup' => 'start', + 'checkboxgroup' => '', ), array( @@ -107,6 +99,26 @@ class SP_Settings_Events extends SP_Settings_Page { '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( 'title' => __( 'Staff', 'sportspress' ), 'desc' => __( 'Display staff', 'sportspress' ), diff --git a/includes/admin/views/html-admin-config.php b/includes/admin/views/html-admin-config.php index 1a3e58bb..9dd15eb4 100644 --- a/includes/admin/views/html-admin-config.php +++ b/includes/admin/views/html-admin-config.php @@ -77,7 +77,7 @@ - + @@ -143,6 +143,7 @@
+ @@ -151,6 +152,7 @@ > + diff --git a/includes/class-sp-post-types.php b/includes/class-sp-post-types.php index 72986419..8395f50e 100644 --- a/includes/class-sp-post-types.php +++ b/includes/class-sp-post-types.php @@ -295,7 +295,7 @@ class SP_Post_types { 'publicly_queryable' => false, 'exclude_from_search' => true, 'hierarchical' => false, - 'supports' => array( 'title', 'page-attributes', 'excerpt' ), + 'supports' => array( 'title', 'thumbnail', 'page-attributes', 'excerpt' ), 'has_archive' => false, 'show_in_nav_menus' => false, 'can_export' => false, diff --git a/includes/sp-template-hooks.php b/includes/sp-template-hooks.php index 585627bd..4d1c7c28 100644 --- a/includes/sp-template-hooks.php +++ b/includes/sp-template-hooks.php @@ -153,6 +153,18 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain = nu case 'Slug': $translated_text = ( in_array( $typenow, array( 'sp_column', 'sp_statistic' ) ) ) ? __( 'Key', 'sportspress' ) : __( 'Variable', 'sportspress' ); 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; endif; diff --git a/templates/event-performance.php b/templates/event-performance.php index 3417ab0b..c07bb462 100644 --- a/templates/event-performance.php +++ b/templates/event-performance.php @@ -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; $scrollable = get_option( 'sportspress_enable_scrollable_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 ) ): foreach( $teams as $index => $team_id ): @@ -63,9 +73,12 @@ if ( is_array( $teams ) ): - $label ): ?> + + $label ): ?> - + + + @@ -115,17 +128,17 @@ if ( is_array( $teams ) ): endif; echo ''; - + + if ( $mode == 'icons' ); echo ''; + + if ( $mode == 'values' ): + echo ''; + 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; + + if ( $mode == 'icons' ); echo ''; echo ''; @@ -160,6 +183,8 @@ if ( is_array( $teams ) ): $row = $data[0]; + if ( $mode == 'icons' ) echo ''; + + if ( $mode == 'values' ): + echo ''; + 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; + + if ( $mode == 'icons' ) echo ''; ?> >
ID ) ) echo get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' ); ?> post_title; ?> post_name; ?>

post_excerpt; ?>

#  
' . $name . ''; foreach( $labels as $key => $label ): if ( $key == 'name' ) continue; + $value = '—'; if ( $key == 'position' ): if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): $position = get_term_by( 'id', $row[ $key ], 'sp_position' ); - $value = $position->name; - else: - $value = '—'; + if ( $position ) $value = $position->name; endif; else: if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): @@ -138,8 +151,18 @@ if ( is_array( $teams ) ): $totals[ $key ] = 0; endif; $totals[ $key ] += $value; - echo '' . $value . '' . $value . '
'; + foreach( $labels as $key => $label ): if ( $key == 'name' ) continue; @@ -170,8 +195,18 @@ if ( is_array( $teams ) ): else: $value = sp_array_value( $totals, $key, 0 ); endif; - echo '' . $value . '' . $value . '