Add league table and players settings

This commit is contained in:
Brian Miyaji
2014-03-07 10:38:59 +11:00
parent a09f97d7af
commit 0d2b1749b2
5 changed files with 105 additions and 14 deletions

View File

@@ -11,12 +11,13 @@ class SportsPress_Widget_League_Table extends WP_Widget {
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
$columns = empty($instance['columns']) ? null : $instance['columns'];
$show_team_logo = empty($instance['show_team_logo']) ? false : $instance['show_team_logo'];
$show_full_table_link = empty($instance['show_full_table_link']) ? false : $instance['show_full_table_link'];
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo '<div id="sp_league_table_wrap">';
echo sportspress_league_table( $id, array( 'columns' => $columns, 'show_full_table_link' => $show_full_table_link ) );
echo sportspress_league_table( $id, array( 'columns' => $columns, 'show_full_table_link' => $show_full_table_link, 'show_team_logo' => $show_team_logo ) );
echo '</div>';
echo $after_widget;
}
@@ -26,16 +27,18 @@ class SportsPress_Widget_League_Table extends WP_Widget {
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['columns'] = (array)$new_instance['columns'];
$instance['show_team_logo'] = $new_instance['show_team_logo'];
$instance['show_full_table_link'] = $new_instance['show_full_table_link'];
return $instance;
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'columns' => null, 'show_full_table_link' => true ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'columns' => null, 'show_team_logo' => false, 'show_full_table_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$columns = $instance['columns'];
$show_team_logo = $instance['show_team_logo'];
$show_full_table_link = $instance['show_full_table_link'];
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
@@ -77,7 +80,10 @@ class SportsPress_Widget_League_Table extends WP_Widget {
<?php endforeach; ?>
</p>
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_full_table_link'); ?>" name="<?php echo $this->get_field_name('show_full_table_link'); ?>" value="1" <?php checked( $show_full_table_link, 1 ); ?>>
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_team_logo'); ?>" name="<?php echo $this->get_field_name('show_team_logo'); ?>" value="1" <?php checked( $show_team_logo, 1 ); ?>>
<label for="<?php echo $this->get_field_id('show_team_logo'); ?>"><?php _e( 'Display logos', 'sportspress' ); ?></label><br>
<input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_full_table_link'); ?>" name="<?php echo $this->get_field_name('show_full_table_link'); ?>" value="1" <?php checked( $show_full_table_link, 1 ); ?>>
<label for="<?php echo $this->get_field_id('show_full_table_link'); ?>"><?php _e( 'Display link to view full table', 'sportspress' ); ?></label></p>
<?php