function wpcm_stats_value($stats, $type, $index) { echo get_wpcm_stats_value($stats, $type, $index); }
/** * Player profile stats table. * * @access public * @param array * @param string $team * @param string $season * @return void */ function wpcm_profile_stats_table($stats = array(), $team = 0, $season = 0) { $id = get_the_ID(); if (array_key_exists($team, $stats)) { if (array_key_exists($season, $stats[$team])) { $stats = $stats[$team][$season]; } } $wpcm_player_stats_labels = wpcm_get_sports_stats_labels(); $stats_labels = array('appearances' => '<a title="' . __('Games Played', 'wp-club-manager') . '">' . __('GP', 'wp-club-manager') . '</a>'); $stats_labels = array_merge($stats_labels, $wpcm_player_stats_labels); ?> <table> <thead> <tr> <?php foreach ($stats_labels as $key => $val) { if (get_option('wpcm_show_stats_' . $key) == 'yes') { ?> <th><?php echo $val; ?> </th> <?php } } ?> </tr> </thead> <tbody> <tr> <?php foreach ($stats_labels as $key => $val) { if ($key == 'appearances') { if (get_option('wpcm_show_stats_appearances') == 'yes') { if (get_option('wpcm_show_stats_subs') == 'yes') { $subs = get_player_subs_total($id, $season, $team); if ($subs > 0) { $sub = ' <span class="sub-appearances">(' . $subs . ')</span>'; } else { $sub = ''; } } ?> <td><span data-index="appearances"><?php wpcm_stats_value($stats, 'total', 'appearances'); echo get_option('wpcm_show_stats_subs') == 'yes' ? $sub : ''; ?> </span></td> <?php } } elseif ($key == 'rating') { $rating = get_wpcm_stats_value($stats, 'total', 'rating'); $apps = get_wpcm_stats_value($stats, 'total', 'appearances'); $avrating = wpcm_divide($rating, $apps); if (get_option('wpcm_show_stats_rating') == 'yes') { ?> <td><span data-index="rating"><?php echo sprintf("%01.2f", round($avrating, 2)); ?> </span></td> <?php } } else { if (get_option('wpcm_show_stats_' . $key) == 'yes') { ?> <td><span data-index="<?php echo $key; ?> "><?php wpcm_stats_value($stats, 'total', $key); ?> </span></td> <?php } } } ?> </tr> </tbody> </table> <?php }
/** * Match player minutes input. * * @access public * @param array * @param string $id * @param bool $disabled = false * @return void */ function wpcm_player_subs_minutes($players = array(), $id = null, $disabled = false) { global $player; $players = array('lineup' => array(), 'subs' => array()); ?> <td> <input type="text" data-player="<?php echo $id; ?> " name="wpcm_players[subs][<?php echo $id; ?> ][subtime]" value="<?php echo get_wpcm_stats_value($players['subs'], $id, 'subtime'); ?> " size="2" <?php disabled(true, $disabled); ?> /> </td> <?php }