Apply players (individual sport) mode throughout

This commit is contained in:
Brian Miyaji
2015-01-25 16:45:21 +11:00
parent 352c6632da
commit 5d5368d1bf
19 changed files with 656 additions and 559 deletions

View File

@@ -28,6 +28,7 @@ class SP_Settings_General extends SP_Settings_Page {
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'sportspress_admin_field_timezone', array( $this, 'timezone_setting' ) );
add_action( 'sportspress_admin_field_frontend_styles', array( $this, 'frontend_styles_setting' ) );
add_action( 'sportspress_admin_field_current_mode', array( $this, 'current_mode_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
@@ -64,10 +65,12 @@ class SP_Settings_General extends SP_Settings_Page {
'type' => 'radio',
'options' => array(
'team' => __( 'Teams', 'sportspress' ),
'player' => __( 'Players', 'sportspress' ),
'player' => __( 'Players', 'sportspress' ) . ' ' . __( '(Beta)', 'sportspress' ),
),
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
),
array( 'type' => 'current_mode' ),
)),
array(
@@ -335,6 +338,21 @@ class SP_Settings_General extends SP_Settings_Page {
<input name="' . esc_attr( $id ). '" id="' . esc_attr( $id ) . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
</div>';
}
/**
* Output script to refresh page when mode is changed.
*/
function current_mode_setting() {
?>
<input type="hidden" name="sportspress_current_mode" value="<?php echo get_option( 'sportspress_mode', 'team' ); ?>">
<?php if ( sp_array_value( $_POST, 'sportspress_mode', 'team' ) !== sp_array_value( $_POST, 'sportspress_current_mode', 'team' ) ) { ?>
<script type="text/javascript">
window.onload = function() {
window.location = window.location.href;
}
</script>
<?php }
}
}
endif;

View File

@@ -167,7 +167,8 @@ class SP_Settings_Modules extends SP_Settings_Page {
<img src="<?php echo $theme->get_screenshot(); ?>" class="sp-theme-screenshot">
<p><?php _e( '<strong>Your theme does not declare SportsPress support</strong> &#8211; if you encounter layout issues please read our integration guide or choose a SportsPress theme :)', 'sportspress' ); ?></p>
<p class="sp-module-actions">
<a class="button" href="http://themeboy.com/sportspress/themes/" target="_blank"><?php _e( 'Need a Better Theme?', 'sportspress' ); ?></a>
<span><?php _e( 'Free', 'sportspress' ); ?></span>
<a class="button" href="<?php echo add_query_arg( array( 'theme' => 'rookie' ), admin_url( 'theme-install.php' ) ); ?>" target="_blank"><?php _e( 'Install Rookie Theme', 'sportspress' ); ?></a>
</p>
</td></tr>
</tbody>
@@ -194,6 +195,7 @@ class SP_Settings_Modules extends SP_Settings_Page {
<div class="sp-modules-main">
<?php foreach ( SP()->modules->data as $section => $modules ) { ?>
<?php if ( 'team' == $section && 'team' != get_option( 'sportspress_mode', 'team' ) ) continue; ?>
<table class="sp-modules-table widefat" cellspacing="0">
<thead>
<tr><th>