From a193ba1ca34c4ee76ac96769786d79a99acf95b8 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 11 Aug 2014 01:43:06 +1000 Subject: [PATCH] Add overview page with sitemap --- assets/css/slickmap.css | 225 ++++++++ assets/images/slickmap/L1-center.png | Bin 0 -> 300 bytes assets/images/slickmap/L1-left.png | Bin 0 -> 305 bytes assets/images/slickmap/L1-right.png | Bin 0 -> 295 bytes assets/images/slickmap/L3-bottom.png | Bin 0 -> 353 bytes assets/images/slickmap/L3-center.png | Bin 0 -> 326 bytes assets/images/slickmap/L3-li-top.png | Bin 0 -> 3019 bytes assets/images/slickmap/L3-ul-top.png | Bin 0 -> 1020 bytes assets/images/slickmap/vertical-line.png | Bin 0 -> 152 bytes includes/admin/class-sp-admin-assets.php | 4 + includes/admin/class-sp-admin-menus.php | 22 +- includes/admin/class-sp-admin-overview.php | 578 +++++++++++++++++++ includes/admin/sp-admin-functions.php | 1 + includes/admin/views/html-admin-overview.php | 307 ++++++++++ includes/sp-conditional-functions.php | 44 ++ 15 files changed, 1178 insertions(+), 3 deletions(-) create mode 100644 assets/css/slickmap.css create mode 100644 assets/images/slickmap/L1-center.png create mode 100644 assets/images/slickmap/L1-left.png create mode 100644 assets/images/slickmap/L1-right.png create mode 100644 assets/images/slickmap/L3-bottom.png create mode 100644 assets/images/slickmap/L3-center.png create mode 100644 assets/images/slickmap/L3-li-top.png create mode 100644 assets/images/slickmap/L3-ul-top.png create mode 100644 assets/images/slickmap/vertical-line.png mode change 100644 => 100755 includes/admin/class-sp-admin-assets.php mode change 100644 => 100755 includes/admin/class-sp-admin-menus.php create mode 100644 includes/admin/class-sp-admin-overview.php mode change 100644 => 100755 includes/admin/sp-admin-functions.php create mode 100644 includes/admin/views/html-admin-overview.php mode change 100644 => 100755 includes/sp-conditional-functions.php diff --git a/assets/css/slickmap.css b/assets/css/slickmap.css new file mode 100644 index 00000000..fc6bf87b --- /dev/null +++ b/assets/css/slickmap.css @@ -0,0 +1,225 @@ +.sp-sitemap { + margin: 40px 0; + float: left; + width: 100%; + position: relative; +} + +/* ------------------------------------------------------------ + Reset Styles (adapted from meyerweb.com) +------------------------------------------------------------ */ + +.sp-sitemap div, .sp-sitemap span, .sp-sitemap applet, .sp-sitemap object, .sp-sitemap iframe, .sp-sitemap +h1, .sp-sitemap h2, .sp-sitemap h3, .sp-sitemap h4, .sp-sitemap h5, .sp-sitemap h6, .sp-sitemap p, .sp-sitemap blockquote, .sp-sitemap pre, .sp-sitemap +a, .sp-sitemap abbr, .sp-sitemap acronym, .sp-sitemap address, .sp-sitemap big, .sp-sitemap cite, .sp-sitemap code, .sp-sitemap +del, .sp-sitemap dfn, .sp-sitemap em, .sp-sitemap font, .sp-sitemap img, .sp-sitemap ins, .sp-sitemap kbd, .sp-sitemap q, .sp-sitemap s, .sp-sitemap samp, .sp-sitemap +small, .sp-sitemap strike, .sp-sitemap strong, .sp-sitemap sub, .sp-sitemap sup, .sp-sitemap tt, .sp-sitemap var, .sp-sitemap +dl, .sp-sitemap dt, .sp-sitemap dd, .sp-sitemap ol, .sp-sitemap ul, .sp-sitemap li, .sp-sitemap +fieldset, .sp-sitemap form, .sp-sitemap label, .sp-sitemap legend, .sp-sitemap +table, .sp-sitemap caption, .sp-sitemap tbody, .sp-sitemap tfoot, .sp-sitemap thead, .sp-sitemap tr, .sp-sitemap th, .sp-sitemap td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + vertical-align: baseline; +} + +/* ------------------------------------------------------------ + NUMBER OF COLUMNS: Adjust .sp-sitemap li to set the number + of columns required in your site map. The default is + 4 columns (25%). 5 columns would be 20%, 6 columns would + be 16.6%, etc. +------------------------------------------------------------ */ + +.sp-sitemap li { + width: 10%; +} + +.sp-sitemap li ul li { + width:100% !important; +} + +.sp-sitemap .col0 { max-width: 300px; } +.sp-sitemap .col1 { max-width: 300px; } +.sp-sitemap .col2 { max-width: 600px; } +.sp-sitemap .col3 { max-width: 900px; } +.sp-sitemap .col4 { max-width: 1200px; } +.sp-sitemap .col5 { max-width: 1500px; } +.sp-sitemap .col6 { max-width: 1800px; } +.sp-sitemap .col7 { max-width: 2100px; } +.sp-sitemap .col8 { max-width: 2400px; } +.sp-sitemap .col9 { max-width: 2700px; } +.sp-sitemap .col10 { max-width: 3000px; } +.sp-sitemap .col11 { max-width: 3300px; } +.sp-sitemap .col12 { max-width: 3600px; } + +.sp-sitemap .col1 li { width:99.9%; } +.sp-sitemap .col2 li { width:50%; } +.sp-sitemap .col3 li { width:33.3%; } +.sp-sitemap .col4 li { width:25%; } +.sp-sitemap .col5 li { width:20%; } +.sp-sitemap .col6 li { width:16.6%; } +.sp-sitemap .col7 li { width:14.2%; } +.sp-sitemap .col8 li { width:12.5%; } +.sp-sitemap .col9 li { width:11.1%; } +.sp-sitemap .col10 li { width:10%; } +.sp-sitemap .col11 li { width:9%; } +.sp-sitemap .col12 li { width:8.3%; } + +/* ------------------------------------------------------------ + General Styles +------------------------------------------------------------ */ + +.sp-sitemap h1 { + font-weight: bold; + text-transform: uppercase; + font-size: 20px; + margin: 0 0 5px 0; +} +.sp-sitemap h2 { + font-size: 10px; + color: #777777; + margin: 0 0 20px 0; +} +.sp-sitemap a { + text-decoration: none; +} +.sp-sitemap ol, .sp-sitemap ul { + list-style: none; +} +.sp-sitemap li { + margin: 0; +} +.sp-sitemap li a.button { + white-space: normal; +} + + +/* ------------------------------------------------------------ + Site Map Styles +------------------------------------------------------------ */ + +/* -------- Top Level --------- */ + +.sp-sitemap #sp-primary .sp-home { + display: block; + float: none; + background: #f1f1f1 url('../images/slickmap/L1-left.png') center bottom no-repeat; + position: relative; + z-index: 2; + padding: 0 0 30px 0; +} +.sp-sitemap #sp-primary .sp-breadcrumb { + display: block; + float: none; + background: #f1f1f1 url('../images/slickmap/vertical-line.png') center bottom repeat-y; + position: relative; + z-index: 2; + padding: 0 0 30px 0; + margin-bottom: 30px; +} +.sp-sitemap #sp-primary li { + min-width: 150px; + float: left; + background: url('../images/slickmap/L1-center.png') center top no-repeat; + padding: 30px 0; + margin-top: -30px; +} +.sp-sitemap #sp-primary li a.button { + margin: 0 20px 0 0; + padding: 10px 0; + display: block; + font-size: 13px; + font-weight: bold; + text-align: center; + height: auto; + line-height: normal; +} +.sp-sitemap #sp-primary li:last-child { + background: url('../images/slickmap/L1-right.png') center top no-repeat; +} + +/* -------- Second Level --------- */ + +.sp-sitemap #sp-primary li li { + width: 100%; + clear: left; + margin-top: 0; + padding: 10px 0 0 0; + background: url('../images/slickmap/vertical-line.png') center bottom repeat-y; +} +.sp-sitemap #sp-primary li li:first-child { + padding-top: 30px; +} +.sp-sitemap #sp-primary li li:last-child { + background: url('../images/slickmap/vertical-line.png') center bottom repeat-y; +} + +/* -------- Third Level --------- */ + +.sp-sitemap #sp-primary li li ul { + margin: 10px 0 0 0; + width: 100%; + float: right; + padding: 9px 0 10px 0; + background: #f1f1f1 url('../images/slickmap/L3-ul-top.png') center top no-repeat; +} +.sp-sitemap #sp-primary li li li { + background: url('../images/slickmap/L3-center.png') left center no-repeat; + padding: 5px 0; +} +.sp-sitemap #sp-primary li li li a { + padding: 5px 0; + width: 80%; + float: right; +} +.sp-sitemap #sp-primary li li li:first-child { + padding: 15px 0 5px 0; + background: url('../images/slickmap/L3-li-top.png') left center no-repeat; +} +.sp-sitemap #sp-primary li li li:last-child { + background: url('../images/slickmap/L3-bottom.png') left center no-repeat; +} + + +/* ------------------------------------------------------------ + Utility Navigation +------------------------------------------------------------ */ + +.sp-sitemap #sp-utility { + float: right; + max-width: 80%; + margin-top: -30px; + margin-right: 10px; +} +.sp-sitemap #sp-utility li { + float: left; + margin-bottom: 10px; + width: auto; +} +.sp-sitemap #sp-utility li a.button { + margin: 0 10px 0 0; + padding: 10px 16px; + display: block; + font-size: 13px; + font-weight: bold; + text-align: center; + height: auto; + line-height: normal; + position: relative; + z-index: 10; +} +.sp-sitemap #sp-utility li a:link:before, +.sp-sitemap #sp-utility li a:visited:before { + margin-bottom: 3px; +} + +@media screen and ( max-width: 782px ) { + .sp-sitemap #sp-primary { + clear: both; + padding-top: 50px; + } + .sp-sitemap #sp-utility { + max-width: none; + } +} \ No newline at end of file diff --git a/assets/images/slickmap/L1-center.png b/assets/images/slickmap/L1-center.png new file mode 100644 index 0000000000000000000000000000000000000000..8023abc5a01fdeb748e277ebf6a96a1fbe171dc3 GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0y~yU^W4=6*$;{#AsN+$iN@~bO4;e&;)b{NCeDqxBz6>Y`T{S z6iiSOmjaS&wrpi$xNkq<$-WQk>z{04W2i4&2s8v_EZh({17QfrSg>gvKttdRu(Lkw bVv%6Dw16v!?b!NcpnVLUu6{1-oD!M4K(yzv&-ebH*uusT>n9A<*95f4;R2AsA%(ML>*( z1&j;~0zj9785zYh85(3g+e8^&JaPhR{4Fv-^jmW~-g*$I3Dn5o>FVdQ&MBb@07wu?UH||9 literal 0 HcmV?d00001 diff --git a/assets/images/slickmap/L1-right.png b/assets/images/slickmap/L1-right.png new file mode 100644 index 0000000000000000000000000000000000000000..154441a3623f93419447d2e16cd534d55924b25c GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0y~yU^W4=6*$;{nHmO5Mj%EK8PQcw{PgTaxRf#HKx=+_yH z4Y8ifL>Yc`^8*bkSo?4j+W|iLItIT7&OjA#r3x8PJzxghPB;V8@&}t)Bp9Zw<#t@M SwY(RonZeW5&t;ucLK6TL$wpED literal 0 HcmV?d00001 diff --git a/assets/images/slickmap/L3-bottom.png b/assets/images/slickmap/L3-bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..572b282e6d970ab482300990d015b337391791b9 GIT binary patch literal 353 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 literal 0 HcmV?d00001 diff --git a/assets/images/slickmap/L3-ul-top.png b/assets/images/slickmap/L3-ul-top.png new file mode 100644 index 0000000000000000000000000000000000000000..80c3fb363085db89af7da4faf9f7a10e26ab98ba GIT binary patch literal 1020 zcmaJ=O;6N77#<)Yx`HQTBBx0q5fipwY+2iEmn@xK*~AiD*06~&v9tqQpq(-u*uuqx zlO9ZrN8-mXzy#xsgI@JyJZNHKqGw6?3r?5ag@bDkZ{KCf*`ytKDaclS12 z-4kYuu#gyBAi&IlNw68lMq&zWU4#2+SQ20x!Zu9dtf+>)2rWV})I=@o%BlkMx~OPc zKCezeRaSD6tVqgqR?&@I&X8r;c?6z~daFhaRXVx&$rPH5MTR7`S}n0PEfTsWDY~vp zvMQ-+mLsz9ZpfS@8^+^Z1%zXl`VsR<2vbF8g={lZ;FX@W5JWxMFz$?r4@^p&NK!;O zZK(^i?f*lApoflG4WHNhPvN+}8)2!2W3o+MesQbgX{yMuD0Ud3bwW0~Q(SBkM&c%k zpk=kE1}AOD^}{rHtIe`)qZ-D{30+)8roeSX-}j7CUPbw`ij>=G zu2d?h%SFW94sgi2T<@G)?#oRVB8YfqgsH!Sy$U4(Y&UNB{cD-)tJmRr{cExMawT4j zlwR+J>+Xj54yA5ydHJEY{y5}2Px*3>UH!eoe~k4iD%F!8CqIuyKf;l6srdQY$?St~ z(Tn|ouM_Xs_bA^5~d{E)cCu7{)8v+2XUv!FFCpYy001Uds jzrDZyh71Dm>fzuBn7NXfiVv4xax|!x7tq_eNBe&P=bkm( literal 0 HcmV?d00001 diff --git a/assets/images/slickmap/vertical-line.png b/assets/images/slickmap/vertical-line.png new file mode 100644 index 0000000000000000000000000000000000000000..af2d03723859cdc1deda63ca398663b9f8e23c36 GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^VnA%f!3HEFI<=*Nlw^r(L`iUdT1k0gQ7VIDN`6wR zf@f}GdTLN=VoGJ<$y6JlA}dc9$B>F!Z_YUKGAIbJY-E-EalNhgv5Ui@#gor$S3dbF uIMiBvcBO~}4_ouW1Oo{5A^(G50>jcamc&plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); } + if ( in_array( $screen->id, array( 'sportspress_page_sp-overview' ) ) ) { + wp_enqueue_style( 'sportspress-admin-slickmap', SP()->plugin_url() . '/assets/css/slickmap.css', array(), '1.1.0' ); + } + if ( in_array( $screen->id, array( 'dashboard' ) ) ) { wp_enqueue_style( 'sportspress-admin-dashboard-styles', SP()->plugin_url() . '/assets/css/dashboard.css', array(), SP_VERSION ); } diff --git a/includes/admin/class-sp-admin-menus.php b/includes/admin/class-sp-admin-menus.php old mode 100644 new mode 100755 index bc397170..077215fd --- a/includes/admin/class-sp-admin-menus.php +++ b/includes/admin/class-sp-admin-menus.php @@ -23,8 +23,9 @@ class SP_Admin_Menus { public function __construct() { add_filter( 'admin_menu', array( $this, 'menu_clean' ), 5 ); add_action( 'admin_menu', array( $this, 'admin_menu' ), 6 ); - add_action( 'admin_menu', array( $this, 'leagues_menu' ), 7 ); - add_action( 'admin_menu', array( $this, 'seasons_menu' ), 8 ); + add_action( 'admin_menu', array( $this, 'overview_menu' ), 7 ); + add_action( 'admin_menu', array( $this, 'leagues_menu' ), 8 ); + add_action( 'admin_menu', array( $this, 'seasons_menu' ), 9 ); if ( current_user_can( 'manage_options' ) ) add_action( 'admin_menu', array( $this, 'status_menu' ), 20 ); @@ -47,7 +48,14 @@ class SP_Admin_Menus { if ( current_user_can( 'manage_sportspress' ) ) $menu[] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' ); - $main_page = add_menu_page( __( 'SportsPress Settings', 'sportspress' ), __( 'SportsPress', 'sportspress' ), 'manage_sportspress', 'sportspress', array( $this, 'settings_page' ), apply_filters( 'sportspress_menu_icon', null ), '51.5' ); + $main_page = add_menu_page( __( 'SportsPress', 'sportspress' ), __( 'SportsPress', 'sportspress' ), 'manage_sportspress', 'sportspress', array( $this, 'settings_page' ), apply_filters( 'sportspress_menu_icon', null ), '51.5' ); + } + + /** + * Add menu item + */ + public function overview_menu() { + add_submenu_page( 'sportspress', __( 'Overview', 'sportspress' ), __( 'Overview', 'sportspress' ), 'manage_sportspress', 'sp-overview', array( $this, 'overview_page' ) ); } /** @@ -230,6 +238,14 @@ class SP_Admin_Menus { endif; } + /** + * Init the overview page + */ + public function overview_page() { + include_once( 'class-sp-admin-overview.php' ); + SP_Admin_Overview::output(); + } + /** * Init the settings page */ diff --git a/includes/admin/class-sp-admin-overview.php b/includes/admin/class-sp-admin-overview.php new file mode 100644 index 00000000..4d05b8ad --- /dev/null +++ b/includes/admin/class-sp-admin-overview.php @@ -0,0 +1,578 @@ +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 ); + + $settings[] = include( 'settings/class-sp-settings-text.php' ); + $settings[] = include( 'settings/class-sp-settings-config.php' ); + + self::$settings = apply_filters( 'sportspress_get_settings_config_pages', $settings ); + } + return self::$settings; + } + + /** + * Save the settings + */ + public static function save() { + global $current_section, $current_tab; + + if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'sportspress-settings' ) ) + die( __( 'Action failed. Please refresh the page and retry.', 'sportspress' ) ); + + // Trigger actions + do_action( 'sportspress_settings_save_' . $current_tab ); + do_action( 'sportspress_update_options_' . $current_tab ); + do_action( 'sportspress_update_options' ); + + self::add_message( __( 'Your settings have been saved.', 'sportspress' ) ); + + do_action( 'sportspress_settings_saved' ); + } + + /** + * Add a message + * @param string $text + */ + public static function add_message( $text ) { + self::$messages[] = $text; + } + + /** + * Add an error + * @param string $text + */ + public static function add_error( $text ) { + self::$errors[] = $text; + } + + /** + * Output messages + errors + */ + public static function show_messages() { + if ( sizeof( self::$errors ) > 0 ) { + foreach ( self::$errors as $error ) + echo '

' . esc_html( $error ) . '

'; + } elseif ( sizeof( self::$messages ) > 0 ) { + foreach ( self::$messages as $message ) + echo '

' . esc_html( $message ) . '

'; + } + } + + /** + * Overview page. + * + * Handles the display of the main sportspress overview page in admin. + * + * @access public + * @return void + */ + public static function output() { + include 'views/html-admin-overview.php'; + } + + /** + * Get a setting from the settings API. + * + * @param mixed $option + * @return string + */ + public static function get_option( $option_name, $default = '' ) { + // Array value + if ( strstr( $option_name, '[' ) ) { + + parse_str( $option_name, $option_array ); + + // Option name is first key + $option_name = current( array_keys( $option_array ) ); + + // Get value + $option_values = get_option( $option_name, '' ); + + $key = key( $option_array[ $option_name ] ); + + if ( isset( $option_values[ $key ] ) ) + $option_value = $option_values[ $key ]; + else + $option_value = null; + + // Single value + } else { + $option_value = get_option( $option_name, null ); + } + + if ( is_array( $option_value ) ) + $option_value = array_map( 'stripslashes', $option_value ); + elseif ( ! is_null( $option_value ) ) + $option_value = stripslashes( $option_value ); + + return $option_value === null ? $default : $option_value; + } + + /** + * Output admin fields. + * + * Loops though the sportspress options array and outputs each field. + * + * @access public + * @param array $options Opens array to output + */ + public static function output_fields( $options ) { + foreach ( $options as $value ) { + if ( ! isset( $value['type'] ) ) continue; + if ( ! isset( $value['id'] ) ) $value['id'] = ''; + if ( ! isset( $value['title'] ) ) $value['title'] = isset( $value['name'] ) ? $value['name'] : ''; + if ( ! isset( $value['class'] ) ) $value['class'] = ''; + if ( ! isset( $value['css'] ) ) $value['css'] = ''; + if ( ! isset( $value['default'] ) ) $value['default'] = ''; + if ( ! isset( $value['desc'] ) ) $value['desc'] = ''; + if ( ! isset( $value['desc_tip'] ) ) $value['desc_tip'] = false; + if ( ! isset( $value['placeholder'] ) ) $value['placeholder'] = ''; + + // Custom attribute handling + $custom_attributes = array(); + + if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) + foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) + $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; + + // Description handling + if ( $value['desc_tip'] === true ) { + $description = ''; + $tip = $value['desc']; + } elseif ( ! empty( $value['desc_tip'] ) ) { + $description = $value['desc']; + $tip = $value['desc_tip']; + } elseif ( ! empty( $value['desc'] ) ) { + $description = $value['desc']; + $tip = ''; + } else { + $description = $tip = ''; + } + + if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ) ) ) { + $description = '

' . wp_kses_post( $description ) . '

'; + } elseif ( $description && in_array( $value['type'], array( 'checkbox' ) ) ) { + $description = wp_kses_post( $description ); + } elseif ( $description ) { + $description = '' . wp_kses_post( $description ) . ''; + } + + if ( $tip && in_array( $value['type'], array( 'checkbox' ) ) ) { + + $tip = '

' . $tip . '

'; + + } elseif ( $tip ) { + + $tip = ''; + + } + + // Switch based on type + switch( $value['type'] ) { + + // Section Titles + case 'title': + if ( ! empty( $value['title'] ) ) { + echo '

' . esc_html( $value['title'] ) . '

'; + } + if ( ! empty( $value['desc'] ) ) { + echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); + } + echo ''. "\n\n"; + if ( ! empty( $value['id'] ) ) { + do_action( 'sportspress_settings_' . sanitize_title( $value['id'] ) ); + } + break; + + // Section Ends + case 'sectionend': + if ( ! empty( $value['id'] ) ) { + do_action( 'sportspress_settings_' . sanitize_title( $value['id'] ) . '_end' ); + } + echo '
'; + if ( ! empty( $value['id'] ) ) { + do_action( 'sportspress_settings_' . sanitize_title( $value['id'] ) . '_after' ); + } + break; + + // Standard text inputs and subtypes like 'number' + case 'text': + case 'email': + case 'number': + case 'color' : + case 'password' : + + $type = $value['type']; + $class = ''; + $option_value = self::get_option( $value['id'], $value['default'] ); + + if ( $value['type'] == 'color' ) { + $type = 'text'; + $value['class'] .= 'colorpick'; + $description .= ''; + } + + ?> + + + + + + + /> + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
    + $val ) { + ?> +
  • + +
  • + +
+
+ + + + + +
+ +
+ + + + + +
+ + + +
+ $value ) + update_option( $name, $value ); + + return true; + } +} + +endif; diff --git a/includes/admin/sp-admin-functions.php b/includes/admin/sp-admin-functions.php old mode 100644 new mode 100755 index 16e5481c..7089b93a --- a/includes/admin/sp-admin-functions.php +++ b/includes/admin/sp-admin-functions.php @@ -20,6 +20,7 @@ function sp_get_screen_ids() { 'dashboard', 'dashboard_page_sp-about', 'toplevel_page_sportspress', + 'sportspress_page_sp-overview', 'sportspress_page_sp-status', 'edit-sp_result', 'sp_result', diff --git a/includes/admin/views/html-admin-overview.php b/includes/admin/views/html-admin-overview.php new file mode 100644 index 00000000..7636e2e0 --- /dev/null +++ b/includes/admin/views/html-admin-overview.php @@ -0,0 +1,307 @@ +
+

+ +

+
+ + + + + +
    + $children ): $object = get_post_type_object( $post_type ); ?> +
  • labels->name; ?>
  • + +
+ + +
    +
  • + +
  • labels->name; ?> + false, 'parent' => 0, 'orderby' => 'slug' ) ); ?> +
      + 0 ): ?> + + false, 'parent' => $term->term_id, 'orderby' => 'slug' ) ); ?> +
    • + object_type ) <= 1 ): ?> + object_type ) ): foreach ( $object->object_type as $post_type ): ?> + name; ?> + + + name; ?> + + + +
        + +
      • + object_type ) <= 1 ): ?> + object_type ) ): foreach ( $object->object_type as $post_type ): ?> + name; ?> + + + name; ?> + +
      • + +
      + +
    • + + +
    • labels->add_new_item; ?>
    • + +
    +
  • + +
+ + + + + + + + false, 'parent' => $term->term_id, 'orderby' => 'slug' ) ); ?> + + + +
    +
  • +
  • labels->name; ?>
  • +
  • name; ?>
  • +
  • +
      + object_type ) ): ?> + object_type as $post_type ): if ( array_key_exists( $post_type, $hierarchy ) ): $post_object = get_post_type_object( $post_type ); ?> +
    • labels->name; ?>
    • + + +
    +
  • + +
  • name; ?> + object_type ) ): ?> +
      + object_type as $post_type ): if ( array_key_exists( $post_type, $hierarchy ) ): $post_object = get_post_type_object( $post_type ); ?> +
    • labels->name; ?>
    • + +
    + +
  • + +
+ + + + object_type as $post_type ): + if ( array_key_exists( $post_type, $hierarchy ) ): + $post_types[] = $post_type; + endif; + endforeach; + ?> + + + + + + + + false, 'parent' => 0, 'orderby' => 'slug' ) ); ?> +
    + +
  • +
  • labels->name; ?>
  • + + +
  • name; ?> + false, 'parent' => $term->term_id, 'orderby' => 'slug' ) ); ?> +
      + + + + object_type ) <= 1 ): ?> + + + object_type ) ): ?> + object_type as $post_type ): if ( array_key_exists( $post_type, $hierarchy ) ): $post_object = get_post_type_object( $post_type ); ?> +
    • name; ?>
    • + + + + + + +
    • +
        + object_type ) ): ?> + object_type as $post_type ): if ( array_key_exists( $post_type, $hierarchy ) ): $post_object = get_post_type_object( $post_type ); ?> +
      • labels->name; ?>
      • + + +
      +
    • + + +
    • name; ?> + object_type ) ): ?> +
        + object_type as $post_type ): if ( array_key_exists( $post_type, $hierarchy ) ): $post_object = get_post_type_object( $post_type ); ?> +
      • labels->name; ?>
      • + +
      + +
    • + + + + + + + object_type ) ): ?> + object_type as $post_type ): if ( array_key_exists( $post_type, $hierarchy ) ): $post_object = get_post_type_object( $post_type ); ?> +
    • labels->name; ?>
    • + + + + + +
    +
  • + + +
  • labels->add_new_item; ?>
  • +
+ + + + + + + + + + + + + + + -1, 'post_type' => $post_type ) ); ?> + + + + + + + + + false, 'parent' => 0, 'orderby' => 'slug' ) ); ?> + + + + +
+

+ + + +

+
\ No newline at end of file diff --git a/includes/sp-conditional-functions.php b/includes/sp-conditional-functions.php old mode 100644 new mode 100755 index 14522003..3dd795ae --- a/includes/sp-conditional-functions.php +++ b/includes/sp-conditional-functions.php @@ -34,6 +34,38 @@ if ( ! function_exists( 'sp_post_types' ) ) { } } +/** + * sp_post_type_hierarchy - Returns array of SP primary post types + * + * @access public + * @return array + */ +if ( ! function_exists( 'sp_post_type_hierarchy' ) ) { + function sp_post_type_hierarchy() { + return apply_filters( + 'sportspress_post_type_hierarchy', + array( + 'sp_event' => array( 'sp_calendar' ), + 'sp_team' => array( 'sp_table' ), + 'sp_player' => array( 'sp_list' ), + 'sp_staff' => array() + ) + ); + } +} + +/** + * sp_secondary_post_types - Returns array of SP secondary post types + * + * @access public + * @return array + */ +if ( ! function_exists( 'sp_secondary_post_types' ) ) { + function sp_secondary_post_types() { + return apply_filters( 'sportspress_secondary_post_types', array( 'sp_calendar', 'sp_table', 'sp_list' ) ); + } +} + /** * sp_config_types - Returns array of SP config types * @@ -46,6 +78,18 @@ if ( ! function_exists( 'sp_config_types' ) ) { } } +/** + * sp_taxonomies - Returns array of SP taxonomies + * + * @access public + * @return array + */ +if ( ! function_exists( 'sp_taxonomies' ) ) { + function sp_taxonomies() { + return apply_filters( 'sportspress_terms', array( 'sp_league', 'sp_season', 'sp_venue', 'sp_position' ) ); + } +} + /** * is_sp_post_type - Returns true if post is SportsPress post type *