From c36e901dd34a76e6e2d5a239910dabf020ba201f Mon Sep 17 00:00:00 2001 From: Rene Vergara A Date: Mon, 26 Dec 2022 17:12:23 -0500 Subject: [PATCH] Add global totals to page --- admin/class-submenu.php | 52 ------------ {admin => assets}/class-submenu-page.php | 103 +++++++++++++++++------ assets/class-submenu.php | 44 ++++++++++ zgopmtlist.php | 35 +++----- 4 files changed, 135 insertions(+), 99 deletions(-) delete mode 100644 admin/class-submenu.php rename {admin => assets}/class-submenu-page.php (88%) create mode 100644 assets/class-submenu.php diff --git a/admin/class-submenu.php b/admin/class-submenu.php deleted file mode 100644 index 3bfb16e..0000000 --- a/admin/class-submenu.php +++ /dev/null @@ -1,52 +0,0 @@ -submenu_page = $submenu_page; - } - - /** - * Adds a submenu for this plugin to the 'Tools' menu. - */ - public function init() { - add_action( 'admin_menu', array( $this, 'add_options_page' ) ); - } - - /** - * Creates the submenu item and calls on the Submenu Page object to render - * the actual contents of the page. - */ - public function add_options_page() { - - add_options_page( - 'ZGo Payment Gateway Support', - 'ZGo Payments', - 'manage_options', - 'zgopmtlist', - array( $this->submenu_page, 'render' ) - ); - } - -} diff --git a/admin/class-submenu-page.php b/assets/class-submenu-page.php similarity index 88% rename from admin/class-submenu-page.php rename to assets/class-submenu-page.php index 26ade54..ba550e5 100644 --- a/admin/class-submenu-page.php +++ b/assets/class-submenu-page.php @@ -1,20 +1,18 @@ render_stats(); + $this->render_totals(); } } @@ -334,8 +333,8 @@ class Submenu_Page { $result = $wpdb->get_row($sql,OBJECT); ?>
- - +
+ - -
Payments received Description Value
- + + + @@ -538,4 +537,56 @@ class Submenu_Page { get_row($sql,OBJECT); + if ( $result ) { + if ($result->gTotalPmts > 0) { + ?> +
+ Global Totals +
+ + + + + +
+ + + + + + + + + +
Payments:gTotalPmts ?>Total Amount:gTotalAmount,2) ?>Total ZEC:gTotalZec,8) ?>
+
+ submenu_page = $submenu_page; + } + + /** + * Adds a submenu for this plugin to the 'Tools' menu. + **/ + public function init() { + add_action( 'admin_menu', array( $this, 'add_options_page' ) ); + } + + /** + * Creates the submenu item and calls on the Submenu Page object to render + * the actual contents of the page. + **/ + public function add_options_page() { + + add_options_page( + 'ZGo Payment Gateway Support', + 'ZGo Payments', + 'manage_options', + 'zgopmtlist', + array( $this->submenu_page, 'render' ) + ); + } + +} diff --git a/zgopmtlist.php b/zgopmtlist.php index 8bf5d9d..de4adf4 100644 --- a/zgopmtlist.php +++ b/zgopmtlist.php @@ -1,21 +1,16 @@