echo '<td class="data-number">' . $number . '</td>'; } if ($link_posts) { $permalink = get_post_permalink($player_id); $name = '<a href="' . $permalink . '">' . $name . '</a>'; } echo '<td class="data-name">' . $name . '</td>'; if ($mode == 'icons') { echo '<td class="sp-performance-icons">'; } foreach ($labels as $key => $label) { if (in_array($key, array('number', 'name'))) { continue; } $format = sp_array_value($formats, $key, 'number'); $placeholder = sp_get_format_placeholder($format); $value = '—'; if ($key == 'position') { if (array_key_exists($key, $row) && $row[$key] != '') { $positions = array(); $position_ids = (array) $row[$key]; foreach ($position_ids as $position_id) { $player_position = get_term_by('id', $position_id, 'sp_position'); if ($player_position) { $positions[] = $player_position->name; } } $value = implode(', ', $positions); } } else { if (array_key_exists($key, $row) && $row[$key] != '') {
/** * Admin edit table row */ public static function row($labels = array(), $player_id = 0, $player_performance = array(), $team_id = 0, $data = array(), $positions = true, $status = true, $sortable = true, $numbers = true, $section = -1, $formats = array(), $player_timeline = array()) { if ($player_id <= 0) { return; } $value = sp_array_value($player_performance, 'number', ''); ?> <tr class="sp-row sp-post" data-player="<?php echo $player_id; ?> "> <?php if ($sortable) { ?> <td class="icon"><span class="dashicons dashicons-menu post-state-format"></span></td> <?php } ?> <?php if (apply_filters('sportspress_event_performance_show_numbers', $numbers, $section)) { ?> <td> <input class="small-text sp-player-number-input sp-sync-input" type="text" name="sp_players[<?php echo $team_id; ?> ][<?php echo $player_id; ?> ][number]" value="<?php echo esc_attr($value); ?> " /> </td> <?php } ?> <td> <?php echo get_the_title($player_id); ?> <?php if (1 == $section) { ?> <input type="hidden" name="sp_order[<?php echo $team_id; ?> ][]" value="<?php echo $player_id; ?> "> <?php } ?> </td> <?php if ($positions) { ?> <td> <?php $selected = (array) sp_array_value($player_performance, 'position', null); if ($selected == null) { $selected = (array) sp_get_the_term_id($player_id, 'sp_position', 0); } $args = array('taxonomy' => 'sp_position', 'name' => 'sp_players[' . $team_id . '][' . $player_id . '][position][]', 'values' => 'term_id', 'orderby' => 'slug', 'selected' => $selected, 'class' => 'sp-position', 'property' => 'multiple', 'chosen' => true, 'include_children' => 'no' == get_option('sportspress_event_hide_child_positions', 'no')); sp_dropdown_taxonomies($args); ?> </td> <?php } ?> <?php foreach ($labels as $column => $label) { $value = sp_array_value($player_performance, $column, ''); $intval = intval($value); $placeholder = sp_get_format_placeholder(sp_array_value($formats, $column, 'number')); ?> <td> <input class="sp-player-<?php echo $column; ?> -input sp-sync-input" type="text" name="sp_players[<?php echo $team_id; ?> ][<?php echo $player_id; ?> ][<?php echo $column; ?> ]" value="<?php echo esc_attr($value); ?> " placeholder="<?php echo $placeholder; ?> " /> <?php if ($intval) { ?> <?php // Get performance times if (is_array($player_timeline)) { $times = sp_array_value($player_timeline, $column, array()); } else { $times = false; } if (is_array($times)) { ?> <hr> <?php for ($i = 0; $i < $intval; $i++) { ?> <input class="sp-sync-input small-text" type="text" name="sp_timeline[<?php echo $team_id; ?> ][<?php echo $player_id; ?> ][<?php echo $column; ?> ][<?php echo $i; ?> ]" value="<?php echo esc_attr(sp_array_value($times, $i, '')); ?> " placeholder="-" /><?php } ?> <span class="description"><?php _e('mins', 'sportspress'); ?> </span> <?php } } ?> </td> <?php } ?> <?php if (apply_filters('sportspress_event_performance_show_status', $status, $section)) { ?> <td class="sp-status-selector"> <?php // Get substitute times if (is_array($player_timeline)) { $times = sp_array_value($player_timeline, 'sub', array()); } else { $times = false; } ?> <?php echo self::status_select($team_id, $player_id, sp_array_value($player_performance, 'status', null)); ?> <?php echo self::sub_select($team_id, $player_id, sp_array_value($player_performance, 'sub', null), $data); ?> <input class="sp-sync-input small-text" type="text" name="sp_timeline[<?php echo $team_id; ?> ][<?php echo $player_id; ?> ][sub][]" value="<?php echo esc_attr(sp_array_value($times, 0, '')); ?> " placeholder="-" /> <span class="description"><?php _e('mins', 'sportspress'); ?> </span> </td> <?php } ?> </tr> <?php }