Add option to choose individual/team mode per event

This commit is contained in:
Brian Miyaji
2017-03-16 13:49:51 +11:00
parent 6078dcd534
commit b6f79cec13
25 changed files with 253 additions and 326 deletions

View File

@@ -27,7 +27,6 @@ class SP_Settings_Events extends SP_Settings_Page {
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_current_mode', array( $this, 'current_mode_setting' ) );
add_action( 'sportspress_admin_field_delimiter', array( $this, 'delimiter_setting' ) );
add_action( 'sportspress_admin_field_event_layout', array( $this, 'layout_setting' ) );
add_action( 'sportspress_admin_field_event_tabs', array( $this, 'tabs_setting' ) );
@@ -98,18 +97,16 @@ class SP_Settings_Events extends SP_Settings_Page {
array(
array(
'title' => __( 'Mode', 'sportspress' ),
'id' => 'sportspress_load_individual_mode_module',
'default' => 'no',
'title' => __( 'Default mode', 'sportspress' ),
'id' => 'sportspress_mode',
'default' => 'team',
'type' => 'radio',
'options' => array(
'no' => __( 'Team vs team', 'sportspress' ),
'yes' => __( 'Player vs player', 'sportspress' ),
'team' => __( 'Team vs team', 'sportspress' ),
'player' => __( 'Player vs player', 'sportspress' ),
),
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
),
array( 'type' => 'current_mode' ),
array(
'title' => __( 'Limit', 'sportspress' ),
@@ -476,21 +473,6 @@ class SP_Settings_Events extends SP_Settings_Page {
</tr>
<?php
}
/**
* Output script to refresh page when mode is changed.
*/
function current_mode_setting() {
?>
<input type="hidden" name="sportspress_individual_mode_module_loaded" value="<?php echo get_option( 'sportspress_load_individual_mode_module', 'no' ); ?>">
<?php if ( sp_array_value( $_POST, 'sportspress_load_individual_mode_module', 'no' ) !== sp_array_value( $_POST, 'sportspress_individual_mode_module_loaded', 'no' ) ) { ?>
<script type="text/javascript">
window.onload = function() {
window.location = window.location.href;
}
</script>
<?php }
}
}
endif;