From 44dba72251325356d0e081e458cd49e178049b5c Mon Sep 17 00:00:00 2001
From: Takumi
Date: Mon, 29 Jul 2013 01:13:02 +1000
Subject: [PATCH] Add player statistics placeholder in event
---
event.php | 20 +++++++++++--
helpers.php | 69 +++++++++++++++++++++++++++++++++++++++++++
sportspress-admin.css | 11 +++++++
3 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/event.php b/event.php
index b1a01835..a2449cb9 100644
--- a/event.php
+++ b/event.php
@@ -30,12 +30,12 @@ function sp_event_meta_init() {
add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' );
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_event_team_meta', 'sp_event', 'side', 'high' );
add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sp_event_article_meta', 'sp_event', 'normal', 'high' );
+ add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_event_stats_meta', 'sp_event', 'normal', 'high' );
}
function sp_event_team_meta( $post ) {
$limit = get_option( 'sp_event_team_count' );
$teams = array_pad( array_slice( (array)get_post_meta( $post->ID, 'sp_team', false ), 0, $limit ), $limit, 0);
- $scores = array_pad( array_slice( (array)get_post_meta( $post->ID, 'sp_score', false ), 0, $limit ), $limit, 0);
$players = (array)get_post_meta( $post->ID, 'sp_player', false );
for ( $i = 0; $i < $limit; $i++ ):
?>
@@ -52,7 +52,6 @@ function sp_event_team_meta( $post ) {
);
wp_dropdown_pages( $args );
?>
-
@@ -73,6 +72,23 @@ function sp_event_article_meta( $post ) {
wp_editor( $post->post_content, 'content' );
}
+function sp_event_stats_meta( $post ) {
+ $limit = get_option( 'sp_event_team_count' );
+ $teams = array_pad( array_slice( (array)get_post_meta( $post->ID, 'sp_team', false ), 0, $limit ), $limit, 0);
+ $players = (array)get_post_meta( $post->ID, 'sp_player', false );
+ for ( $i = 0; $i < $limit; $i++ ):
+ ?>
+
+
+
+
+ ID, 'sp_player', 'block', 'sp_team', $i ); ?>
+
+ '',
diff --git a/helpers.php b/helpers.php
index 62cb2008..ea6e04ae 100644
--- a/helpers.php
+++ b/helpers.php
@@ -157,6 +157,75 @@ if ( ! function_exists( 'sp_post_checklist' ) ) {
}
}
+if ( ! function_exists( 'sp_post_table' ) ) {
+ function sp_post_table( $post_id = null, $meta = 'post', $display = 'block', $data = null, $index = null ) {
+ if ( ! isset( $post_id ) )
+ global $post_id;
+ $obj = get_post_type_object( $meta );
+ ?>
+
+