html-admin-page-reports.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Admin View: Page - Reports
  4. */
  5. if ( ! defined( 'ABSPATH' ) ) {
  6. exit;
  7. }
  8. ?>
  9. <div class="wrap woocommerce">
  10. <nav class="nav-tab-wrapper woo-nav-tab-wrapper">
  11. <?php
  12. foreach ( $reports as $key => $report_group ) {
  13. echo '<a href="' . admin_url( 'admin.php?page=wc-reports&tab=' . urlencode( $key ) ) . '" class="nav-tab ';
  14. if ( $current_tab == $key ) {
  15. echo 'nav-tab-active';
  16. }
  17. echo '">' . esc_html( $report_group['title'] ) . '</a>';
  18. }
  19. do_action( 'wc_reports_tabs' );
  20. ?>
  21. </nav>
  22. <?php
  23. if ( sizeof( $reports[ $current_tab ]['reports'] ) > 1 ) {
  24. ?>
  25. <ul class="subsubsub">
  26. <li>
  27. <?php
  28. $links = array();
  29. foreach ( $reports[ $current_tab ]['reports'] as $key => $report ) {
  30. $link = '<a href="admin.php?page=wc-reports&tab=' . urlencode( $current_tab ) . '&amp;report=' . urlencode( $key ) . '" class="';
  31. if ( $key == $current_report ) {
  32. $link .= 'current';
  33. }
  34. $link .= '">' . $report['title'] . '</a>';
  35. $links[] = $link;
  36. }
  37. echo implode( ' | </li><li>', $links );
  38. ?>
  39. </li>
  40. </ul>
  41. <br class="clear" />
  42. <?php
  43. }
  44. if ( isset( $reports[ $current_tab ]['reports'][ $current_report ] ) ) {
  45. $report = $reports[ $current_tab ]['reports'][ $current_report ];
  46. if ( ! isset( $report['hide_title'] ) || true != $report['hide_title'] ) {
  47. echo '<h1>' . esc_html( $report['title'] ) . '</h1>';
  48. } else {
  49. echo '<h1 class="screen-reader-text">' . esc_html( $report['title'] ) . '</h1>';
  50. }
  51. if ( $report['description'] ) {
  52. echo '<p>' . $report['description'] . '</p>';
  53. }
  54. if ( $report['callback'] && ( is_callable( $report['callback'] ) ) ) {
  55. call_user_func( $report['callback'], $current_report );
  56. }
  57. }
  58. ?>
  59. </div>