| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Display the main reports page wrapper. |
| 10 |
* |
| 11 |
* @author David Bisset |
| 12 |
* @package Charitable/Admin View/Settings |
| 13 |
* @copyright Copyright (c) 2023, WP Charitable LLC |
| 14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 15 |
* @since 1.8,1 |
| 16 |
* @version 1.8.1 |
| 17 |
* @version 1.8.8.6 |
| 18 |
*/ |
| 19 |
|
| 20 |
$active_tab = isset( $_GET['tab'] ) ? esc_html( $_GET['tab'] ) : 'overview'; // phpcs:ignore |
| 21 |
$group = isset( $_GET['group'] ) ? esc_html( $_GET['group'] ) : $active_tab; // phpcs:ignore |
| 22 |
$charitable_sections = charitable_get_admin_reports()->get_sections(); |
| 23 |
$charitable_show_return = $group !== $active_tab; |
| 24 |
|
| 25 |
ob_start(); |
| 26 |
?> |
| 27 |
<div id="charitable-reports" class="wrap"> |
| 28 |
<h1 class="screen-reader-text"><?php echo esc_html( get_admin_page_title() ); ?></h1> |
| 29 |
|
| 30 |
<?php do_action( 'charitable_maybe_show_notification' ); ?> |
| 31 |
|
| 32 |
<h1><?php echo esc_html__( 'Reports', 'charitable' ); ?></h1> |
| 33 |
|
| 34 |
<h2 class="nav-tab-wrapper"> |
| 35 |
<?php foreach ( $charitable_sections as $charitable_the_tab => $charitable_name ) : ?> |
| 36 |
<a href="<?php echo esc_url( add_query_arg( array( 'tab' => $charitable_the_tab ), admin_url( 'admin.php?page=charitable-reports' ) ) ); ?>" class="nav-tab <?php echo esc_attr( sanitize_title( $charitable_name ) ); ?> <?php echo $active_tab === $charitable_the_tab ? 'nav-tab-active' : ''; ?>"><?php echo esc_html( $charitable_name ); ?></a> |
| 37 |
<?php endforeach ?> |
| 38 |
</h2> |
| 39 |
|
| 40 |
<?php |
| 41 |
/** |
| 42 |
* Do or render something right before the reports form. |
| 43 |
* |
| 44 |
* @since 1.8.1 |
| 45 |
* |
| 46 |
* @param string $group The reports group we are viewing. |
| 47 |
*/ |
| 48 |
do_action( 'charitable_before_admin_reports', $group ); |
| 49 |
|
| 50 |
switch ( $active_tab ) { |
| 51 |
case 'overview': |
| 52 |
charitable_admin_view( 'reports/overview' ); |
| 53 |
break; |
| 54 |
|
| 55 |
case 'advanced': |
| 56 |
charitable_admin_view( 'reports/advanced' ); |
| 57 |
break; |
| 58 |
|
| 59 |
case 'activity': |
| 60 |
charitable_admin_view( 'reports/activity' ); |
| 61 |
break; |
| 62 |
|
| 63 |
case 'donors': |
| 64 |
charitable_admin_view( 'reports/donors' ); |
| 65 |
break; |
| 66 |
|
| 67 |
case 'analytics': |
| 68 |
charitable_admin_view( 'reports/analytics' ); |
| 69 |
break; |
| 70 |
|
| 71 |
default: |
| 72 |
// Allow add-on tabs (registered via the charitable_reports_tabs filter) to render their content. |
| 73 |
if ( has_action( 'charitable_reports_tab_' . $active_tab ) ) { |
| 74 |
do_action( 'charitable_reports_tab_' . $active_tab ); |
| 75 |
} else { |
| 76 |
charitable_admin_view( 'reports/overview' ); |
| 77 |
} |
| 78 |
break; |
| 79 |
} |
| 80 |
|
| 81 |
/** |
| 82 |
* Do or render something right after the reports form. |
| 83 |
* |
| 84 |
* @since 1.8.1 |
| 85 |
* |
| 86 |
* @param string $group The reports group we are viewing. |
| 87 |
*/ |
| 88 |
do_action( 'charitable_after_admin_reports', $group ); |
| 89 |
?> |
| 90 |
</div> |
| 91 |
<?php |
| 92 |
echo ob_get_clean(); // phpcs:ignore |
| 93 |
|