id = 'config';
$this->label = __( 'Configure', 'sportspress' );
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'sportspress_admin_field_results', array( $this, 'results_setting' ) );
add_action( 'sportspress_admin_field_outcomes', array( $this, 'outcomes_setting' ) );
add_action( 'sportspress_admin_field_columns', array( $this, 'columns_setting' ) );
add_action( 'sportspress_admin_field_metrics', array( $this, 'metrics_setting' ) );
add_action( 'sportspress_admin_field_performance', array( $this, 'performance_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
/**
* Get settings array
*
* @return array
*/
public function get_settings() {
$sports = sp_get_sport_options();
return apply_filters('sportspress_event_settings', array(
array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
array(
'title' => __( 'Sport', 'sportspress' ),
'id' => 'sportspress_sport',
'default' => 'soccer',
'type' => 'select',
'options' => $sports,
),
array( 'type' => 'results' ),
array( 'type' => 'outcomes' ),
array( 'type' => 'columns' ),
array( 'type' => 'metrics' ),
array( 'type' => 'performance' ),
array( 'type' => 'statistics' ),
array( 'type' => 'sectionend', 'id' => 'config_options' ),
)); // End event settings
}
/**
* Save settings
*/
public function save() {
if ( isset( $_POST['sportspress_sport'] ) && ! empty( $_POST['sportspress_sport'] ) && get_option( 'sportspress_sport', null ) != $_POST['sportspress_sport'] ):
$sport = SP()->sports->$_POST['sportspress_sport'];
SP_Admin_Settings::configure_sport( $sport );
update_option( '_sp_needs_welcome', 0 );
elseif ( isset( $_POST['sportspress_primary_result'] ) ):
update_option( 'sportspress_primary_result', $_POST['sportspress_primary_result'] );
endif;
$settings = $this->get_settings();
SP_Admin_Settings::save_fields( $settings );
}
/**
* Results settings
*
* @access public
* @return void
*/
public function results_setting() {
$selection = get_option( 'sportspress_primary_result', 0 );
$args = array(
'post_type' => 'sp_result',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
'sp_outcome',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
>
| post_title; ?> |
post_name; ?> |
|
|
'sp_column',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
|
|
|
>
| post_title; ?> |
post_name; ?> |
ID, $row->post_name ); ?> |
ID ); ?> |
ID ); ?> |
|
|
'sp_metric',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
|
|
>
| post_title; ?> |
post_name; ?> |
ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?> |
|
|
|
'sp_performance',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
|
|
|
|
|
|
>
| post_title; ?> |
post_name; ?> |
ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?> |
ID ); ?> |
|
|