Remove seasons in favor of child leagues

This commit is contained in:
Takumi
2013-07-27 00:48:20 +10:00
parent d0490c6a03
commit 0772cb7b53
13 changed files with 112 additions and 128 deletions

View File

@@ -27,9 +27,6 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
case 'sp_league': case 'sp_league':
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—';
break; break;
case 'sp_season':
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
break;
case 'sp_sponsor': case 'sp_sponsor':
echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—'; echo get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : '—';
break; break;
@@ -76,16 +73,6 @@ function sp_restrict_manage_posts() {
); );
sp_dropdown_taxonomies( $args ); sp_dropdown_taxonomies( $args );
endif; endif;
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_calendar' ) ) ):
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
$args = array(
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
'taxonomy' => 'sp_season',
'name' => 'sp_season',
'selected' => $selected
);
sp_dropdown_taxonomies( $args );
endif;
if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_tournament', 'sp_venue' ) ) ): if ( in_array( $typenow, array( 'sp_team', 'sp_event', 'sp_player', 'sp_tournament', 'sp_venue' ) ) ):
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null; $selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
$args = array( $args = array(

View File

@@ -20,8 +20,7 @@ function sp_calendar_edit_columns() {
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'title' => __( 'Title' ), 'title' => __( 'Title' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_league' => __( 'Leagues', 'sportspress' )
'sp_season' => __( 'Seasons', 'sportspress' )
); );
return $columns; return $columns;
} }

View File

@@ -43,6 +43,7 @@ function sp_event_team_meta( $post ) {
); );
wp_dropdown_pages( $args ); wp_dropdown_pages( $args );
endfor; endfor;
sp_post_checklist( $post->ID, 'sp_player', true );
sp_nonce(); sp_nonce();
} }
@@ -56,7 +57,6 @@ function sp_event_edit_columns() {
'title' => __( 'Event', 'sportspress' ), 'title' => __( 'Event', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_league' => __( 'Leagues', 'sportspress' ),
'sp_season' => __( 'Seasons', 'sportspress' ),
'sp_sponsor' => __( 'Sponsors', 'sportspress' ), 'sp_sponsor' => __( 'Sponsors', 'sportspress' ),
'sp_kickoff' => __( 'Kick-off', 'sportspress' ) 'sp_kickoff' => __( 'Kick-off', 'sportspress' )
); );

View File

@@ -123,15 +123,17 @@ if ( ! function_exists( 'sp_post_checklist' ) ) {
<ul class="categorychecklist form-no-clear"> <ul class="categorychecklist form-no-clear">
<?php <?php
$selected = (array)get_post_meta( $post_id, $meta, false ); $selected = (array)get_post_meta( $post_id, $meta, false );
$teams = get_pages( array( 'post_type' => $meta) ); $posts = get_pages( array( 'post_type' => $meta, 'number' => 0 ) );
foreach ( $teams as $team ): if ( empty( $posts ) )
$parents = get_post_ancestors( $team ); $posts = get_posts( array( 'post_type' => $meta, 'numberposts' => 0 ) );
foreach ( $posts as $post ):
$parents = get_post_ancestors( $post );
?> ?>
<li> <li>
<?php echo str_repeat( '<ul><li>', sizeof( $parents ) ); ?> <?php echo str_repeat( '<ul><li>', sizeof( $parents ) ); ?>
<label class="selectit"> <label class="selectit">
<input type="checkbox" value="<?php echo $team->ID; ?>" name="sportspress[<?php echo $meta; ?>][]"<?php if ( in_array( $team->ID, $selected ) ) echo ' checked="checked"'; ?>> <input type="checkbox" value="<?php echo $post->ID; ?>" name="sportspress[<?php echo $meta; ?>][]"<?php if ( in_array( $post->ID, $selected ) ) echo ' checked="checked"'; ?>>
<?php echo $team->post_title; ?> <?php echo $post->post_title; ?>
</label> </label>
<?php echo str_repeat( '</li></ul>', sizeof( $parents ) ); ?> <?php echo str_repeat( '</li></ul>', sizeof( $parents ) ); ?>
</li> </li>

Binary file not shown.

View File

@@ -2,8 +2,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: SportsPress 0.1\n" "Project-Id-Version: SportsPress 0.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-07-24 00:16+1000\n" "POT-Creation-Date: 2013-07-27 00:38+1000\n"
"PO-Revision-Date: 2013-07-24 02:54+1000\n" "PO-Revision-Date: 2013-07-27 00:43+1000\n"
"Last-Translator: ThemeBoy <translate@themeboy.com>\n" "Last-Translator: ThemeBoy <translate@themeboy.com>\n"
"Language-Team: ThemeBoy <translate@themeboy.com>\n" "Language-Team: ThemeBoy <translate@themeboy.com>\n"
"Language: ja\n" "Language: ja\n"
@@ -16,6 +16,32 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: ..\n" "X-Poedit-SearchPath-0: ..\n"
#: ../actions.php:49 ../actions.php:59 ../actions.php:69 ../actions.php:79
#: ../helpers.php:7 ../helpers.php:26
#, php-format
msgid "All %s"
msgstr "すべての%s"
#: ../actions.php:49 ../calendar.php:22 ../event.php:31 ../event.php:58
#: ../player.php:24 ../player.php:42 ../staff.php:24 ../staff.php:41
#: ../table.php:22 ../team.php:3 ../tournament.php:22
msgid "Teams"
msgstr "チーム"
#: ../actions.php:59 ../player.php:41 ../position.php:3 ../staff.php:40
msgid "Positions"
msgstr "ポジション"
#: ../actions.php:69 ../calendar.php:23 ../event.php:59 ../league.php:3
#: ../player.php:43 ../staff.php:42 ../table.php:23 ../team.php:31
msgid "Leagues"
msgstr "リーグ"
#: ../actions.php:79 ../event.php:60 ../player.php:44 ../sponsor.php:3
#: ../team.php:32 ../venue.php:23
msgid "Sponsors"
msgstr "スポンサー"
#: ../calendar.php:3 #: ../calendar.php:3
msgid "Calendars" msgid "Calendars"
msgstr "カレンダー" msgstr "カレンダー"
@@ -24,82 +50,69 @@ msgstr "カレンダー"
msgid "Calendar" msgid "Calendar"
msgstr "カレンダー" msgstr "カレンダー"
#: ../calendar.php:21 ../table.php:21 #: ../calendar.php:21 ../table.php:21 ../tournament.php:21
msgid "Title" msgid "Title"
msgstr "タイトル" msgstr "タイトル"
#: ../calendar.php:22 ../event.php:83 ../table.php:22 ../team.php:3 #: ../event.php:3 ../tournament.php:23
msgid "Teams"
msgstr "チーム"
#: ../calendar.php:23 ../event.php:84 ../league.php:4 ../player.php:24
#: ../staff.php:24 ../table.php:23 ../team.php:42
msgid "League"
msgstr "リーグ"
#: ../calendar.php:24 ../event.php:85 ../player.php:25 ../season.php:4
#: ../staff.php:25 ../table.php:24 ../team.php:43
msgid "Season"
msgstr "シーズン"
#: ../calendar.php:56 ../calendar.php:67 ../event.php:129 ../event.php:140
#: ../event.php:151 ../helpers.php:7 ../helpers.php:26 ../player.php:61
#: ../player.php:72 ../player.php:83 ../player.php:94 ../staff.php:57
#: ../staff.php:68 ../staff.php:79 ../table.php:56 ../table.php:67
#: ../team.php:76 ../team.php:87 ../team.php:98
#, php-format
msgid "All %s"
msgstr "すべての%s"
#: ../calendar.php:56 ../event.php:129 ../league.php:3 ../player.php:72
#: ../staff.php:68 ../table.php:56 ../team.php:76
msgid "Leagues"
msgstr "リーグ"
#: ../calendar.php:67 ../event.php:140 ../player.php:83 ../season.php:3
#: ../staff.php:79 ../table.php:67 ../team.php:87
msgid "Seasons"
msgstr "シーズン"
#: ../event.php:3
msgid "Events" msgid "Events"
msgstr "試合" msgstr "試合"
#: ../event.php:4 ../event.php:82 #: ../event.php:4 ../event.php:30 ../event.php:57
msgid "Event" msgid "Event"
msgstr "試合" msgstr "試合"
#: ../event.php:33 ../event.php:36 ../event.php:39 #: ../event.php:32
#, php-format
msgid "Kick-off: <b>%1$s</b>"
msgstr "キックオフ: <b>%1$s</b>"
#: ../event.php:52 ../player.php:23 ../staff.php:22 ../team.php:4
#: ../team.php:41
msgid "Team"
msgstr "チーム"
#: ../event.php:62
msgid "Article" msgid "Article"
msgstr "記事" msgstr "記事"
#: ../event.php:86 ../player.php:26 ../sponsor.php:4 ../team.php:44 #: ../event.php:61 ../globals.php:17 ../globals.php:18 ../globals.php:19
msgid "Sponsor"
msgstr "スポンサー"
#: ../event.php:87
msgid "Kick-off" msgid "Kick-off"
msgstr "キックオフ" msgstr "キックオフ"
#: ../event.php:88 #: ../globals.php:10 ../globals.php:13 ../team.php:4 ../team.php:30
msgid "Date" msgid "Team"
msgstr "日付" msgstr "チーム"
#: ../event.php:151 ../player.php:94 ../sponsor.php:3 ../team.php:98 #: ../globals.php:11 ../globals.php:12 ../globals.php:23 ../globals.php:24
msgid "Sponsors" #: ../globals.php:32 ../globals.php:33 ../globals.php:43 ../globals.php:47
msgstr "スポンサー" #: ../globals.php:51
#, php-format
msgid "Add %s"
msgstr "新規%sを追加"
#: ../helpers.php:8 ../helpers.php:30 ../team.php:26 ../team.php:29 #: ../globals.php:11 ../globals.php:12 ../globals.php:14 ../globals.php:43
#: ../globals.php:44 ../team.php:23
msgid "Logo"
msgstr "ロゴ"
#: ../globals.php:13 ../helpers.php:15 ../helpers.php:32 ../helpers.php:33
#, php-format
msgid "Parent %s"
msgstr "親%s"
#: ../globals.php:14 ../globals.php:25 ../globals.php:34 ../globals.php:44
#: ../globals.php:48 ../globals.php:52
#, php-format
msgid "Remove %s"
msgstr "%sを削除"
#: ../globals.php:22 ../globals.php:31 ../player.php:40 ../staff.php:39
msgid "Name"
msgstr "名前"
#: ../globals.php:23 ../globals.php:24 ../globals.php:25 ../globals.php:32
#: ../globals.php:33 ../globals.php:34 ../globals.php:47 ../globals.php:48
#: ../globals.php:51 ../globals.php:52 ../player.php:23 ../staff.php:23
msgid "Photo"
msgstr "写真"
#: ../globals.php:26 ../globals.php:27 ../globals.php:28 ../globals.php:35
#: ../globals.php:36 ../globals.php:37
msgid "Joined"
msgstr "入団日"
#: ../helpers.php:8 ../helpers.php:30 ../helpers.php:149
#, php-format #, php-format
msgid "Add New %s" msgid "Add New %s"
msgstr "新規%sを追加" msgstr "新規%sを追加"
@@ -134,20 +147,19 @@ msgstr "%sは見つかりませんでした"
msgid "No %s found in trash" msgid "No %s found in trash"
msgstr "ゴミ箱内に%sは見つかりませんでした。" msgstr "ゴミ箱内に%sは見つかりませんでした。"
#: ../helpers.php:15 ../helpers.php:33
#, php-format
msgid "Parent %s:"
msgstr "親%s:"
#: ../helpers.php:29 #: ../helpers.php:29
#, php-format #, php-format
msgid "Update %s" msgid "Update %s"
msgstr "%sを更新" msgstr "%sを更新"
#: ../helpers.php:32 #: ../helpers.php:31
#, php-format #, php-format
msgid "Parent %s" msgid "New %s Name"
msgstr "%s" msgstr "新規%s"
#: ../league.php:4
msgid "League"
msgstr "リーグ"
#: ../player.php:3 #: ../player.php:3
msgid "Players" msgid "Players"
@@ -157,17 +169,25 @@ msgstr "選手"
msgid "Player" msgid "Player"
msgstr "選手" msgstr "選手"
#: ../player.php:21 ../staff.php:21 #: ../player.php:21 ../staff.php:21 ../team.php:21
msgid "Name" msgid "Publish"
msgstr "名前" msgstr "公開"
#: ../player.php:22 ../position.php:4 ../staff.php:23 #: ../player.php:25 ../staff.php:25
msgid "Profile"
msgstr "プロフィール"
#: ../position.php:4
msgid "Position" msgid "Position"
msgstr "ポジション" msgstr "ポジション"
#: ../player.php:61 ../position.php:3 ../staff.php:57 #: ../settings.php:5 ../settings.php:6
msgid "Positions" msgid "SportsPress"
msgstr "ポジション" msgstr "SportsPress"
#: ../sponsor.php:4 ../tournament.php:24
msgid "Sponsor"
msgstr "スポンサー"
#: ../staff.php:3 ../staff.php:4 #: ../staff.php:3 ../staff.php:4
msgid "Staff" msgid "Staff"
@@ -181,10 +201,6 @@ msgstr "順位表"
msgid "Table" msgid "Table"
msgstr "順位表" msgstr "順位表"
#: ../team.php:23 ../team.php:26 ../team.php:29
msgid "Logo"
msgstr "ロゴ"
#: ../tournament.php:3 #: ../tournament.php:3
msgid "Tournaments" msgid "Tournaments"
msgstr "大会" msgstr "大会"
@@ -197,9 +213,10 @@ msgstr "大会"
msgid "Venues" msgid "Venues"
msgstr "会場" msgstr "会場"
#: ../venue.php:4 #: ../venue.php:4 ../venue.php:21
msgid "Venue" msgid "Venue"
msgstr "会場" msgstr "会場"
#~ msgid "League Table" #: ../venue.php:22
#~ msgstr "順位表" msgid "Address"
msgstr "住所"

View File

@@ -24,6 +24,7 @@ function sp_player_meta_init() {
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_player_team_meta', 'sp_player', 'side', 'high' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_player_team_meta', 'sp_player', 'side', 'high' );
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sp_player_profile_meta', 'sp_player', 'normal', 'high' ); add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sp_player_profile_meta', 'sp_player', 'normal', 'high' );
} }
function sp_player_team_meta( $post ) { function sp_player_team_meta( $post ) {
sp_post_checklist( $post->ID, 'sp_team', true ); sp_post_checklist( $post->ID, 'sp_team', true );
sp_nonce(); sp_nonce();
@@ -40,7 +41,6 @@ function sp_player_edit_columns() {
'sp_position' => __( 'Positions', 'sportspress' ), 'sp_position' => __( 'Positions', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_league' => __( 'Leagues', 'sportspress' ),
'sp_season' => __( 'Seasons', 'sportspress' ),
'sp_sponsor' => __( 'Sponsors', 'sportspress' ) 'sp_sponsor' => __( 'Sponsors', 'sportspress' )
); );
return $columns; return $columns;

View File

@@ -1,17 +0,0 @@
<?php
function sp_season_tax_init() {
$name = __( 'Seasons', 'sportspress' );
$singular_name = __( 'Season', 'sportspress' );
$object_type = array( 'sp_team', 'sp_event', 'sp_player', 'sp_staff', 'sp_table', 'sp_calendar' );
$labels = sp_get_tax_labels( $name, $singular_name );
$args = array(
'label' => $name,
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'rewrite' => array( 'slug' => 'season' ),
);
register_taxonomy( 'sp_season', $object_type, $args );
}
add_action( 'init', 'sp_season_tax_init' );
?>

View File

@@ -2,8 +2,8 @@
function sp_settings_menu() { function sp_settings_menu() {
add_submenu_page( add_submenu_page(
'options-general.php', 'options-general.php',
__( 'SportsPress', 'sportspress' ), 'SportsPress',
__( 'SportsPress', 'sportspress' ), 'SportsPress',
'manage_options', 'manage_options',
'sp_settings', 'sp_settings',
'sp_settings_page' 'sp_settings_page'

View File

@@ -41,7 +41,6 @@ require_once dirname( __FILE__ ) . '/tournament.php';
// Taxonomies // Taxonomies
require_once dirname( __FILE__ ) . '/league.php'; require_once dirname( __FILE__ ) . '/league.php';
require_once dirname( __FILE__ ) . '/season.php';
require_once dirname( __FILE__ ) . '/venue.php'; require_once dirname( __FILE__ ) . '/venue.php';
require_once dirname( __FILE__ ) . '/position.php'; require_once dirname( __FILE__ ) . '/position.php';
require_once dirname( __FILE__ ) . '/sponsor.php'; require_once dirname( __FILE__ ) . '/sponsor.php';

View File

@@ -40,7 +40,6 @@ function sp_staff_edit_columns() {
'sp_position' => __( 'Positions', 'sportspress' ), 'sp_position' => __( 'Positions', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_league' => __( 'Leagues', 'sportspress' ),
'sp_season' => __( 'Seasons', 'sportspress' )
); );
return $columns; return $columns;
} }

View File

@@ -21,7 +21,6 @@ function sp_table_edit_columns() {
'title' => __( 'Title' ), 'title' => __( 'Title' ),
'sp_team' => __( 'Teams', 'sportspress' ), 'sp_team' => __( 'Teams', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_league' => __( 'Leagues', 'sportspress' ),
'sp_season' => __( 'Seasons', 'sportspress' )
); );
return $columns; return $columns;
} }

View File

@@ -29,7 +29,6 @@ function sp_team_edit_columns() {
'sp_icon' => '&nbsp;', 'sp_icon' => '&nbsp;',
'title' => __( 'Team', 'sportspress' ), 'title' => __( 'Team', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_league' => __( 'Leagues', 'sportspress' ),
'sp_season' => __( 'Seasons', 'sportspress' ),
'sp_sponsor' => __( 'Sponsors', 'sportspress' ) 'sp_sponsor' => __( 'Sponsors', 'sportspress' )
); );
return $columns; return $columns;