/**
     * Output the metabox
     */
    public static function output($post)
    {
        $event = new SP_Event($post);
        list($labels, $columns, $stats, $teams) = $event->performance(true);
        $i = 0;
        foreach ($teams as $key => $team_id) {
            if (-1 == $team_id) {
                continue;
            }
            // Get results for players in the team
            $players = sp_array_between((array) get_post_meta($post->ID, 'sp_player', false), 0, $key);
            $players[] = -1;
            $data = sp_array_combine($players, sp_array_value($stats, $team_id, array()));
            // Determine if we need checkboxes
            if ('manual' == get_option('sportspress_event_performance_columns', 'auto') && $i == 0) {
                $has_checkboxes = true;
            } else {
                $has_checkboxes = false;
            }
            // Determine if we need extras
            if ('yes' == get_option('sportspress_event_show_extras', 'no')) {
                $show_extras = true;
            } else {
                $show_extras = false;
            }
            // Determine if we are splitting positions
            if ('yes' == get_option('sportspress_event_split_players_by_position', 'no')) {
                $split_positions = true;
            } else {
                $split_positions = false;
            }
            ?>
			<div>
				<?php 
            if ($team_id) {
                ?>
					<p><strong><?php 
                echo get_the_title($team_id);
                ?>
</strong></p>
				<?php 
            } elseif ($i) {
                ?>
					<br>
				<?php 
            }
            ?>
				<?php 
            self::table($labels, $columns, $data, $team_id, $has_checkboxes, $show_extras, $split_positions);
            ?>
			</div>
			<?php 
            $i++;
        }
    }
 /**
  * Output the metabox
  */
 public static function output($post)
 {
     // Determine if we need checkboxes
     if ('manual' == get_option('sportspress_event_result_columns', 'auto')) {
         $has_checkboxes = true;
     } else {
         $has_checkboxes = false;
     }
     $event = new SP_Event($post);
     list($columns, $usecolumns, $data) = $event->results(true);
     self::table($columns, $usecolumns, $data, $has_checkboxes);
 }
 /**
  * Output the metabox
  */
 public static function output($post)
 {
     $event = new SP_Event($post);
     list($labels, $columns, $stats, $teams) = $event->performance(true);
     // Determine if we are splitting positions
     if ('yes' == get_option('sportspress_event_split_players_by_position', 'no')) {
         $split_positions = true;
     } else {
         $split_positions = false;
     }
     // Determine if we are splitting teams
     if ('yes' == get_option('sportspress_event_split_players_by_team', 'yes')) {
         $split_teams = true;
     } else {
         $split_teams = false;
     }
     // Determine if columns are auto or manual
     if ('manual' == get_option('sportspress_event_performance_columns', 'auto')) {
         $manual = true;
     } else {
         $manual = false;
     }
     // Determine if we need checkboxes
     if ($manual && $i == 0) {
         $has_checkboxes = true;
     } else {
         $has_checkboxes = false;
     }
     // Get positions
     $positions = array();
     if (taxonomy_exists('sp_position')) {
         $args = array('hide_empty' => false, 'parent' => 0, 'include_children' => true);
         $positions = get_terms('sp_position', $args);
     }
     // Get status option
     if ('yes' == get_option('sportspress_event_show_status', 'yes')) {
         $status = true;
     } else {
         $status = false;
     }
     // Apply filters to labels
     $labels = apply_filters('sportspress_event_performance_labels_admin', $labels);
     self::tables($post->ID, $stats, $labels, $columns, $teams, $has_checkboxes, $split_positions, $split_teams, $positions, $status);
 }
 /**
  * Output the metabox
  */
 public static function output($post)
 {
     $event = new SP_Event($post);
     list($labels, $columns, $stats, $teams, $formats, $order) = $event->performance(true);
     if ('yes' == get_option('sportspress_event_performance_show_minutes', 'yes')) {
         $timeline = $event->timeline(true);
     } else {
         $timeline = false;
     }
     // Determine if columns are auto or manual
     if ('manual' == get_option('sportspress_event_performance_columns', 'auto')) {
         $manual = true;
     } else {
         $manual = false;
     }
     // Determine if we need checkboxes
     if ($manual) {
         $has_checkboxes = true;
     } else {
         $has_checkboxes = false;
     }
     // Get player number option
     $numbers = 'yes' == get_option('sportspress_event_show_player_numbers', 'yes') ? true : false;
     // Get positions
     $positions = array();
     if ('yes' == get_option('sportspress_event_show_position', 'yes') && taxonomy_exists('sp_position')) {
         $args = array('hide_empty' => false, 'parent' => 0, 'include_children' => true);
         $positions = get_terms('sp_position', $args);
     }
     // Get status option
     if ('yes' == get_option('sportspress_event_show_status', 'yes')) {
         $status = true;
     } else {
         $status = false;
     }
     // Apply filters to labels
     $labels = apply_filters('sportspress_event_performance_labels_admin', $labels);
     // Check if individual mode
     $is_individual = get_option('sportspress_load_individual_mode_module', 'no') === 'yes' ? true : false;
     self::tables($post->ID, $stats, $labels, $columns, $teams, $has_checkboxes, $positions, $status, $formats, $order, $numbers, $is_individual, $timeline);
 }
    /**
     * Output the metabox
     */
    public static function output($post)
    {
        $event = new SP_Event($post);
        list($labels, $columns, $stats, $teams) = $event->performance(true);
        $i = 0;
        foreach ($teams as $key => $team_id) {
            if (-1 == $team_id) {
                continue;
            }
            // Get results for players in the team
            $players = sp_array_between((array) get_post_meta($post->ID, 'sp_player', false), 0, $key);
            $data = sp_array_combine($players, sp_array_value($stats, $team_id, array()));
            ?>
			<div>
				<?php 
            if ($team_id) {
                ?>
					<p><strong><?php 
                echo get_the_title($team_id);
                ?>
</strong></p>
				<?php 
            } elseif ($i) {
                ?>
					<br>
				<?php 
            }
            ?>
				<?php 
            self::table($labels, $columns, $data, $team_id, $i == 0);
            ?>
			</div>
			<?php 
            $i++;
        }
    }
function sp_get_performance($post = 0)
{
    $event = new SP_Event($post);
    return $event->performance();
}
 *
 * @author 		ThemeBoy
 * @package 	SportsPress_Match_Stats
 * @version     1.9
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (get_option('sportspress_event_show_statistics', 'yes') === 'no') {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$event = new SP_Event($id);
// Return if no teams
$teams = get_post_meta($id, 'sp_team', false);
if (empty($teams)) {
    return;
}
// Return if no results
$status = $event->status();
if ('results' !== $status) {
    return;
}
// Get performance
$performance = $event->performance();
// The first row should be column labels
$labels = apply_filters('sportspress_match_stats_labels', $performance[0]);
// Remove position column label
 /**
  * Add class to body
  */
 public function body_class($classes = array())
 {
     if ('sp_event' == get_post_type() && 'yes' == get_option('sportspress_event_show_statistics', 'yes') && 'icons' == get_option('sportspress_event_performance_mode', 'values')) {
         $event = new SP_Event(get_the_ID());
         $status = $event->status();
         if ('results' !== $status) {
             return $classes;
         }
         $classes[] = 'sp-inline-statistics';
     }
     return $classes;
 }
$total = get_option('sportspress_event_total_performance', 'all');
if (!$show_players && !$show_staff && !$show_total) {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$teams = get_post_meta($id, 'sp_team', false);
if (is_array($teams)) {
    ?>
	<div class="sp-event-performance-tables sp-event-performance-<?php 
    echo $split_positions ? 'positions' : 'teams';
    ?>
">
	<?php 
    $event = new SP_Event($id);
    $performance = $event->performance();
    $link_posts = get_option('sportspress_link_players', 'yes') == 'yes' ? true : false;
    $scrollable = get_option('sportspress_enable_scrollable_tables', 'yes') == 'yes' ? true : false;
    $sortable = get_option('sportspress_enable_sortable_tables', 'yes') == 'yes' ? true : false;
    $mode = get_option('sportspress_event_performance_mode', 'values');
    // The first row should be column labels
    $labels = apply_filters('sportspress_event_box_score_labels', $performance[0], $event, $mode);
    // Remove the first row to leave us with the actual data
    unset($performance[0]);
    $performance = array_filter($performance);
    $status = $event->status();
    // Get performance ids for icons
    if ($mode == 'icons') {
        $performance_ids = array();
        $performance_posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'sp_performance'));
Exemple #10
0
 *
 * @author 		ProSports
 * @package 	ProSports/Templates
 * @version     1.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (get_option('prosports_event_show_results', 'yes') === 'no') {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$event = new SP_Event($id);
$status = $event->status();
if ('results' != $status) {
    return;
}
// Get event result data
$data = $event->results();
// The first row should be column labels
$labels = $data[0];
// Remove the first row to leave us with the actual data
unset($data[0]);
$data = array_filter($data);
if (empty($data)) {
    return false;
}
$scrollable = get_option('prosports_enable_scrollable_tables', 'yes') == 'yes' ? true : false;
 /**
  * Output the metabox
  */
 public static function output($post)
 {
     $event = new SP_Event($post);
     list($columns, $usecolumns, $data) = $event->results(true);
     self::table($columns, $usecolumns, $data);
 }