diff --git a/admin/hooks/admin-enqueue-scripts.php b/admin/hooks/admin-enqueue-scripts.php
index 6926dbe3..413f5dac 100644
--- a/admin/hooks/admin-enqueue-scripts.php
+++ b/admin/hooks/admin-enqueue-scripts.php
@@ -22,6 +22,6 @@ function sportspress_admin_enqueue_scripts( $hook ) {
wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'assets/js/admin.js', array( 'jquery' ), time(), true );
// Localize scripts.
- wp_localize_script( 'sportspress-admin', 'localized_strings', array( 'remove_text' => __( '— Remove —', 'sportspress' ), 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ) ) );
+ wp_localize_script( 'sportspress-admin', 'localized_strings', array( 'none' => __( 'None', 'sportspress' ), 'remove_text' => __( '— Remove —', 'sportspress' ), 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ) ) );
}
add_action( 'admin_enqueue_scripts', 'sportspress_admin_enqueue_scripts' );
diff --git a/admin/hooks/manage-posts-columns.php b/admin/hooks/manage-posts-columns.php
index 2a90c1cb..d7389184 100644
--- a/admin/hooks/manage-posts-columns.php
+++ b/admin/hooks/manage-posts-columns.php
@@ -54,23 +54,7 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
endif;
if ( $team_result != null ):
- echo ' — ' . $team_result;
- endif;
-
- $outcome_slug = sportspress_array_value( $team_results, 'outcome', null );
- if ( $outcome_slug && $outcome_slug != '-1' ):
- $args=array(
- 'name' => $outcome_slug,
- 'post_type' => 'sp_outcome',
- 'post_status' => 'publish',
- 'posts_per_page' => 1
- );
- $outcomes = get_posts( $args );
-
- if ( sizeof( $outcomes ) ):
- $outcome = reset( $outcomes );
- echo ' (' . $outcome->post_title . ')';
- endif;
+ echo ' ' . $team_result . '';
endif;
echo '
';
diff --git a/assets/css/admin.css b/assets/css/admin.css
index 07446bcc..5e321ba7 100644
--- a/assets/css/admin.css
+++ b/assets/css/admin.css
@@ -181,10 +181,6 @@
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
}
-.postbox .inside .sp-data-table-container {
- overflow: auto;
-}
-
.wp-media-buttons .button.sp-insert {
padding-left: 5px;
}
diff --git a/assets/js/admin.js b/assets/js/admin.js
index 755c7e20..9b389644 100644
--- a/assets/js/admin.js
+++ b/assets/js/admin.js
@@ -12,7 +12,8 @@ jQuery(document).ready(function($){
// Chosen select
$(".chosen-select").chosen({
allow_single_deselect: true,
- single_backstroke_delete: false
+ single_backstroke_delete: false,
+ placeholder_text_multiple: localized_strings.none
});
// Auto key placeholder
diff --git a/functions.php b/functions.php
index e285ec58..2c7985c2 100644
--- a/functions.php
+++ b/functions.php
@@ -1046,15 +1046,20 @@ if ( !function_exists( 'sportspress_edit_event_results_table' ) ) {
'sp_outcome',
- 'name' => 'sp_results[' . $team_id . '][outcome]',
- 'show_option_none' => __( '-- Not set --', 'sportspress' ),
+ 'name' => 'sp_results[' . $team_id . '][outcome][]',
'option_none_value' => '',
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
- 'selected' => $value
+ 'selected' => $values,
+ 'class' => 'sp-outcome',
+ 'property' => 'multiple',
+ 'chosen' => true,
);
sportspress_dropdown_pages( $args );
?>
@@ -1534,33 +1539,42 @@ if ( !function_exists( 'sportspress_get_team_columns_data' ) ) {
if ( $team_id == $post_id ):
if ( $key == 'outcome' ):
- // Increment events played and outcome count
- if ( array_key_exists( $value, $totals ) ):
- $totals['eventsplayed']++;
- $totals[ $value ]++;
+ // Convert to array
+ if ( ! is_array( $value ) ):
+ $value = array( $value );
endif;
- if ( $value && $value != '-1' ):
+ foreach( $value as $outcome ):
- // Add to streak counter
- if ( $streak['fire'] && ( $streak['name'] == '' || $streak['name'] == $value ) ):
- $streak['name'] = $value;
- $streak['count'] ++;
- else:
- $streak['fire'] = 0;
+ // Increment events played and outcome count
+ if ( array_key_exists( $outcome, $totals ) ):
+ $totals['eventsplayed']++;
+ $totals[ $outcome ]++;
endif;
- // Add to last 5 counter if sum is less than 5
- if ( array_key_exists( $value, $last5 ) && array_sum( $last5 ) < 5 ):
- $last5[ $value ] ++;
+ if ( $outcome && $outcome != '-1' ):
+
+ // Add to streak counter
+ if ( $streak['fire'] && ( $streak['name'] == '' || $streak['name'] == $outcome ) ):
+ $streak['name'] = $outcome;
+ $streak['count'] ++;
+ else:
+ $streak['fire'] = 0;
+ endif;
+
+ // Add to last 5 counter if sum is less than 5
+ if ( array_key_exists( $outcome, $last5 ) && array_sum( $last5 ) < 5 ):
+ $last5[ $outcome ] ++;
+ endif;
+
+ // Add to last 10 counter if sum is less than 10
+ if ( array_key_exists( $outcome, $last10 ) && array_sum( $last10 ) < 10 ):
+ $last10[ $outcome ] ++;
+ endif;
+
endif;
- // Add to last 10 counter if sum is less than 10
- if ( array_key_exists( $value, $last10 ) && array_sum( $last10 ) < 10 ):
- $last10[ $value ] ++;
- endif;
-
- endif;
+ endforeach;
else:
if ( array_key_exists( $key . 'for', $totals ) ):
@@ -1747,33 +1761,41 @@ if ( !function_exists( 'sportspress_get_league_table_data' ) ) {
if ( $key == 'outcome' ):
- // Increment events played and outcome count
- if ( array_key_exists( $team_id, $totals ) && is_array( $totals[ $team_id ] ) && array_key_exists( $value, $totals[ $team_id ] ) ):
- $totals[ $team_id ]['eventsplayed']++;
- $totals[ $team_id ][ $value ]++;
+ if ( ! is_array( $value ) ):
+ $value = array( $value );
endif;
- if ( $value && $value != '-1' ):
+ foreach ( $value as $outcome ):
- // Add to streak counter
- if ( $streaks[ $team_id ]['fire'] && ( $streaks[ $team_id ]['name'] == '' || $streaks[ $team_id ]['name'] == $value ) ):
- $streaks[ $team_id ]['name'] = $value;
- $streaks[ $team_id ]['count'] ++;
- else:
- $streaks[ $team_id ]['fire'] = 0;
+ // Increment events played and outcome count
+ if ( array_key_exists( $team_id, $totals ) && is_array( $totals[ $team_id ] ) && array_key_exists( $outcome, $totals[ $team_id ] ) ):
+ $totals[ $team_id ]['eventsplayed']++;
+ $totals[ $team_id ][ $outcome ]++;
endif;
- // Add to last 5 counter if sum is less than 5
- if ( array_key_exists( $team_id, $last5s ) && array_key_exists( $value, $last5s[ $team_id ] ) && array_sum( $last5s[ $team_id ] ) < 5 ):
- $last5s[ $team_id ][ $value ] ++;
+ if ( $outcome && $outcome != '-1' ):
+
+ // Add to streak counter
+ if ( $streaks[ $team_id ]['fire'] && ( $streaks[ $team_id ]['name'] == '' || $streaks[ $team_id ]['name'] == $outcome ) ):
+ $streaks[ $team_id ]['name'] = $outcome;
+ $streaks[ $team_id ]['count'] ++;
+ else:
+ $streaks[ $team_id ]['fire'] = 0;
+ endif;
+
+ // Add to last 5 counter if sum is less than 5
+ if ( array_key_exists( $team_id, $last5s ) && array_key_exists( $outcome, $last5s[ $team_id ] ) && array_sum( $last5s[ $team_id ] ) < 5 ):
+ $last5s[ $team_id ][ $outcome ] ++;
+ endif;
+
+ // Add to last 10 counter if sum is less than 10
+ if ( array_key_exists( $team_id, $last10s ) && array_key_exists( $outcome, $last10s[ $team_id ] ) && array_sum( $last10s[ $team_id ] ) < 10 ):
+ $last10s[ $team_id ][ $outcome ] ++;
+ endif;
+
endif;
- // Add to last 10 counter if sum is less than 10
- if ( array_key_exists( $team_id, $last10s ) && array_key_exists( $value, $last10s[ $team_id ] ) && array_sum( $last10s[ $team_id ] ) < 10 ):
- $last10s[ $team_id ][ $value ] ++;
- endif;
-
- endif;
+ endforeach;
else:
if ( array_key_exists( $team_id, $totals ) && is_array( $totals[ $team_id ] ) && array_key_exists( $key . 'for', $totals[ $team_id ] ) ):
|