Add description to config post types

This commit is contained in:
Brian Miyaji
2014-04-24 12:18:04 +10:00
parent 63e1ace191
commit feb870c491
8 changed files with 153 additions and 89 deletions

View File

@@ -31,6 +31,7 @@ class SP_Settings_Config extends SP_Settings_Page {
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_admin_field_statistics', array( $this, 'statistics_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
@@ -54,16 +55,16 @@ class SP_Settings_Config extends SP_Settings_Page {
'options' => $sports,
),
array( 'type' => 'results' ),
array( 'type' => 'outcomes' ),
array( 'type' => 'results' ),
array( 'type' => 'performance' ),
array( 'type' => 'columns' ),
array( 'type' => 'metrics' ),
array( 'type' => 'performance' ),
array( 'type' => 'statistics' ),
array( 'type' => 'sectionend', 'id' => 'config_options' ),
@@ -87,6 +88,56 @@ class SP_Settings_Config extends SP_Settings_Page {
SP_Admin_Settings::save_fields( $settings );
}
/**
* Output outcomes settings
*
* @access public
* @return void
*/
public function outcomes_setting() {
$args = array(
'post_type' => 'sp_outcome',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc">
<?php _e( 'Event Outcomes', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for events.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
<tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th>
</tr>
</thead>
<?php $i = 0; foreach ( $data as $row ): ?>
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
<td class="row-title"><?php echo $row->post_title; ?></td>
<td><?php echo $row->post_name; ?></td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
</tr>
<?php $i++; endforeach; ?>
</table>
<div class="tablenav bottom">
<div class="alignleft actions">
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_outcome' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_outcome' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
</div>
<br class="clear">
</div>
</td>
</tr>
<?php
}
/**
* Results settings
*
@@ -106,10 +157,13 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Results', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Team Results', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for events.' ); ?></p>
</th>
<td class="forminp">
<fieldset>
<legend class="screen-reader-text"><span><?php _e( 'Results', 'sportspress' ) ?></span></legend>
<legend class="screen-reader-text"><span><?php _e( 'Team Results', 'sportspress' ) ?></span></legend>
<table class="widefat sp-admin-config-table">
<thead>
<tr>
@@ -158,23 +212,26 @@ class SP_Settings_Config extends SP_Settings_Page {
}
/**
* Output outcomes settings
* Output performance settings
*
* @access public
* @return void
*/
public function outcomes_setting() {
public function performance_setting() {
$args = array(
'post_type' => 'sp_outcome',
'post_type' => 'sp_performance',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Outcomes', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Player Performance', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for events.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
@@ -194,8 +251,8 @@ class SP_Settings_Config extends SP_Settings_Page {
</table>
<div class="tablenav bottom">
<div class="alignleft actions">
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_outcome' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_outcome' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_performance' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_performance' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
</div>
<br class="clear">
</div>
@@ -221,7 +278,10 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Columns', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Table Columns', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for league tables.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
@@ -238,7 +298,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
<td class="row-title"><?php echo $row->post_title; ?></td>
<td><?php echo $row->post_name; ?></td>
<td><?php echo sp_get_post_equation( $row->ID, $row->post_name ); ?></td>
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
<td><?php echo sp_get_post_order( $row->ID ); ?></td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
@@ -275,14 +335,16 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Metrics', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Player Metrics', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for player lists.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
<tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
<th scope="col">&nbsp;</th>
<th scope="col" class="edit"></th>
</tr>
@@ -291,7 +353,6 @@ class SP_Settings_Config extends SP_Settings_Page {
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
<td class="row-title"><?php echo $row->post_title; ?></td>
<td><?php echo $row->post_name; ?></td>
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '&mdash;'; ?></td>
<td>&nbsp;</td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
</tr>
@@ -310,14 +371,14 @@ class SP_Settings_Config extends SP_Settings_Page {
}
/**
* Output performance settings
* Output statistics settings
*
* @access public
* @return void
*/
public function performance_setting() {
public function statistics_setting() {
$args = array(
'post_type' => 'sp_performance',
'post_type' => 'sp_statistic',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
@@ -326,15 +387,18 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Performance', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Player Statistics', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for player lists.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
<tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th>
</tr>
</thead>
@@ -342,16 +406,16 @@ class SP_Settings_Config extends SP_Settings_Page {
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
<td class="row-title"><?php echo $row->post_title; ?></td>
<td><?php echo $row->post_name; ?></td>
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '&mdash;'; ?></td>
<td><?php echo sp_get_post_calculate( $row->ID ); ?></td>
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
</tr>
<?php $i++; endforeach; ?>
</table>
<div class="tablenav bottom">
<div class="alignleft actions">
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_performance' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_performance' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_statistic' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_statistic' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
</div>
<br class="clear">
</div>