Enable individual sport mode

This commit is contained in:
Brian Miyaji
2014-06-19 15:37:16 +10:00
parent cdf74285d5
commit 33069f395d
12 changed files with 217 additions and 124 deletions

View File

@@ -60,6 +60,11 @@ class SP_Admin_Assets {
wp_enqueue_style( 'sportspress-admin-equation-styles', SP()->plugin_url() . '/assets/css/equation.css', array(), SP_VERSION );
}
if ( SP()->mode == 'player' ):
$custom_css = '#adminmenu #menu-posts-sp_team .menu-icon-sp_team div.wp-menu-image:before,.sp-icon-shield:before{content: "\f307"}';
wp_add_inline_style( 'sportspress-admin-menu-styles', $custom_css );
endif;
do_action( 'sportspress_admin_css' );
}

View File

@@ -34,8 +34,11 @@ class SP_Admin_Settings {
$settings[] = include( 'settings/class-sp-settings-general.php' );
$settings[] = include( 'settings/class-sp-settings-events.php' );
$settings[] = include( 'settings/class-sp-settings-teams.php' );
$settings[] = include( 'settings/class-sp-settings-players.php' );
$settings[] = include( 'settings/class-sp-settings-staff.php' );
if ( SP()->mode == 'team' ):
$settings[] = include( 'settings/class-sp-settings-players.php' );
$settings[] = include( 'settings/class-sp-settings-staff.php' );
endif;
$settings = apply_filters( 'sportspress_get_settings_pages', $settings );

View File

@@ -52,7 +52,7 @@ class SP_Admin_Meta_Boxes {
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Teams::save', 30, 2 );
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Video::save', 40, 2 );
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Results::save', 50, 2 );
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Performance::save', 60, 2 );
if ( SP()->mode == 'team' ) add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Performance::save', 60, 2 );
// Save Calendar Meta Boxes
add_action( 'sportspress_process_sp_calendar_meta', 'SP_Meta_Box_Calendar_Format::save', 10, 2 );
@@ -114,7 +114,7 @@ class SP_Admin_Meta_Boxes {
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' );
add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' );
add_meta_box( 'sp_resultsdiv', __( 'Team Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' );
if ( SP()->mode == 'team' ) add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'high' );
// Calendars

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 0.8.6
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -37,13 +37,17 @@ class SP_Meta_Box_Event_Teams {
wp_dropdown_pages( $args );
?>
</p>
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
<li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li>
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
</ul>
<?php
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $i );
sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $i );
<?php
if ( SP()->mode == 'team' ):
?>
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
<li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li>
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
</ul>
<?php
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $i );
sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $i );
endif;
?>
</div>
<?php

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 0.8
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -42,25 +42,29 @@ class SP_Settings_Config extends SP_Settings_Page {
*/
public function get_settings() {
return apply_filters('sportspress_config_settings', array(
$settings = array(
array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
array( 'type' => 'outcomes' ),
array( 'type' => 'results' ),
);
array( 'type' => 'performance' ),
if ( SP()->mode == 'team' ) $settings[] = array( 'type' => 'performance' );
array( 'type' => 'columns' ),
$settings[] = array( 'type' => 'columns' );
array( 'type' => 'metrics' ),
if ( SP()->mode == 'team' ):
$settings = array_merge( $settings, array(
array( 'type' => 'metrics' ),
array( 'type' => 'statistics' ),
array( 'type' => 'statistics' ),
));
endif;
array( 'type' => 'sectionend', 'id' => 'config_options' ),
$settings[] = array( 'type' => 'sectionend', 'id' => 'config_options' ); // End event settings
)); // End event settings
return apply_filters( 'sportspress_config_settings', $settings );
}
/**

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 1.0
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

View File

@@ -53,6 +53,16 @@ class SP_Settings_General extends SP_Settings_Page {
'type' => 'select',
'options' => $presets,
),
array(
'title' => __( 'Mode', 'sportspress' ),
'id' => 'sportspress_mode',
'default' => 'team',
'type' => 'select',
'options' => array(
'team' => __( 'Team', 'sportspress' ),
'player' => __( 'Individual', 'sportspress' ),
),
),
array(
'title' => __( 'Google Maps', 'sportspress' ),

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 1.0
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -35,9 +35,7 @@ class SP_Settings_Players extends SP_Settings_Page {
* @return array
*/
public function get_settings() {
return apply_filters( 'sportspress_player_settings', array(
$settings = array(
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
array(
@@ -59,15 +57,19 @@ class SP_Settings_Players extends SP_Settings_Page {
'default' => 'yes',
'type' => 'checkbox',
),
);
array(
if ( SP()->mode == 'team' ):
$settings[] = array(
'title' => __( 'Teams', 'sportspress' ),
'desc' => __( 'Link teams', 'sportspress' ),
'id' => 'sportspress_list_link_teams',
'default' => 'no',
'type' => 'checkbox',
),
);
endif;
$settings = array_merge( $settings, array(
array(
'title' => __( 'Pagination', 'sportspress' ),
'desc' => __( 'Paginate', 'sportspress' ),
@@ -90,8 +92,9 @@ class SP_Settings_Players extends SP_Settings_Page {
),
array( 'type' => 'sectionend', 'id' => 'list_options' ),
)); // End player settings
return apply_filters( 'sportspress_player_settings', $settings );
}
}