Adding help files
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 8 Feb 2019 20:28:13 +0000 (15:28 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 8 Feb 2019 20:28:13 +0000 (15:28 -0500)
Help files for Billing Plugin.
Hopefull a good layout for help files.

22 files changed:
index.php
setup/help.php [new file with mode: 0644]
setup/help/accounts.html [new file with mode: 0644]
setup/help/dashboard.html [new file with mode: 0644]
setup/help/invoices-add.html [new file with mode: 0644]
setup/help/invoices.html [new file with mode: 0644]
setup/help/invoicing-createInvoices.html [new file with mode: 0644]
setup/help/invoicing-createLabels.html [new file with mode: 0644]
setup/help/invoicing-printInvoices.html [new file with mode: 0644]
setup/help/invoicing-sendEmails.html [new file with mode: 0644]
setup/help/invoicing.html [new file with mode: 0644]
setup/help/logs.html [new file with mode: 0644]
setup/help/payments-add.html [new file with mode: 0644]
setup/help/payments.html [new file with mode: 0644]
setup/help/reports-accountsByAge.html [new file with mode: 0644]
setup/help/reports-allAccounts.html [new file with mode: 0644]
setup/help/reports-closedAccounts.html [new file with mode: 0644]
setup/help/reports-noAccounts.html [new file with mode: 0644]
setup/help/reports-openAccounts.html [new file with mode: 0644]
setup/help/reports-reportGenerator.html [new file with mode: 0644]
setup/help/reports.html [new file with mode: 0644]
views/admin/billing/subHeader.html

index b5f3471..dc8875c 100644 (file)
--- a/index.php
+++ b/index.php
@@ -232,7 +232,12 @@ register_deactivation_hook(__FILE__, 'glmMembersBillingPluginDeactivate');
 /*
  * Hooks for testing capabilities provided by this add-on
  */
-require_once GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH.'/permissions.php';
+require_once GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/permissions.php';
+
+/**
+ * Hooks for creating help documentation
+ */
+require_once GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help.php';
 
 /**
  * Action for the cron tasks.
@@ -242,7 +247,5 @@ add_action(
     GLM_MEMBERS_BILLING_PLUGIN_CRON_HOOK,
     function(){
         trigger_error( print_r( $_REQUEST, true ) );
-    },
-        10,
-        1
-    );
+    }, 10, 1
+);
diff --git a/setup/help.php b/setup/help.php
new file mode 100644 (file)
index 0000000..34d5e1a
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+/**
+ * Gaslight Media Members Billing Database
+ * GLM Billing Help
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersBillingDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @author   Steve Sutton <steve@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  help.php
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Help Hooks and Filters here. If this file exists, it will be included
+ * by the Billing plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ *  add_filter( 'filter_title', function( $parameter ) {
+ *     // Function code
+ *  });
+ *
+  */
+function loadHelpFile( $screen, $tab )
+{
+    $fileName = GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $tab['extra'] . '.html';
+    if ( is_file( $fileName ) ) {
+        echo file_get_contents( $fileName );
+    } else {
+        return false;
+    }
+}
+
+add_action( 'current_screen',
+    function () {
+        $screen = get_current_screen();
+        // var_dump($screen);
+        if ( !isset( $screen ) ) {
+            return false;
+        }
+        if ( $screen->base != 'glm-associate_page_glm-members-admin-menu-billing' ) {
+            return false;
+        }
+
+        $helpTabs = array(
+            array(
+                'name'  => 'dashboard',
+                'title' => 'Dashboard',
+            ),
+            array(
+                'name'  => 'invoices',
+                'title' => 'Invoices',
+                'subs'  => array(
+                    array(
+                        'name'  => 'add',
+                        'title' => 'Create Invoice',
+                    ),
+                ),
+            ),
+            array(
+                'name'  => 'payments',
+                'title' => 'Payments',
+                'subs'  => array(
+                    array(
+                        'name'  => 'add',
+                        'title' => 'Make a Payment',
+                    ),
+                ),
+            ),
+            array(
+                'name'  => 'accounts',
+                'title' => 'Accounts',
+            ),
+            array(
+                'name'  => 'invoicing',
+                'title' => 'Invoicing',
+                'subs'  => array(
+                    array(
+                        'name'  => 'createInvoices',
+                        'title' => 'Create Invoices',
+                    ),
+                    array(
+                        'name'  => 'printInvoices',
+                        'title' => 'Print Invoices',
+                    ),
+                    array(
+                        'name'  => 'createLabels',
+                        'title' => 'Create Labels',
+                    ),
+                    array(
+                        'name'  => 'sendEmails',
+                        'title' => 'Send Emails',
+                    ),
+                ),
+            ),
+            array(
+                'name'  => 'reports',
+                'title' => 'Reports',
+                'subs'  => array(
+                    array(
+                        'name'  => 'openAccounts',
+                        'title' => 'Open Accounts',
+                    ),
+                    array(
+                        'name'  => 'closedAccounts',
+                        'title' => 'Closed Accounts',
+                    ),
+                    array(
+                        'name'  => 'accountsByAge',
+                        'title' => 'Accounts By Age',
+                    ),
+                    array(
+                        'name'  => 'reportGenerator',
+                        'title' => 'Report Generator',
+                    ),
+                    array(
+                        'name'  => 'noAccounts',
+                        'title' => 'No Accounts',
+                    ),
+                    array(
+                        'name'  => 'allAccounts',
+                        'title' => 'All Accounts',
+                    ),
+                ),
+            ),
+            array(
+                'name'  => 'logs',
+                'title' => 'Logs',
+            ),
+        );
+
+        foreach ( $helpTabs as $tab ) {
+            $glmAction = isset( $_REQUEST['glm_action'] ) ? filter_var( $_REQUEST['glm_action'] ) : 'dashboard';
+            if ( $glmAction === $tab['name'] ) {
+                if ( is_file( GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $tab['name'] . '.html' ) ) {
+                    $screen->add_help_tab(
+                        array(
+                            'id'       => 'glm-member-db-billing-help-' . $tab['name'],
+                            'title'    => __( $tab['title'] ),
+                            'content'  => '',
+                            'callback' => 'loadHelpFile',
+                            'extra'    => $tab['name'],
+                        )
+                    );
+                }
+                // Check for subs
+                if ( isset( $tab['subs'] ) && is_array( $tab['subs'] ) ) {
+                    foreach ( $tab['subs'] as $sub ) {
+                        $fileName = GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $glmAction . '-' . $sub['name'] . '.html';
+                        if ( is_file( GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $glmAction . '-' . $sub['name'] . '.html' ) ) {
+                            $screen->add_help_tab(
+                                array(
+                                    'id'       => 'glm-member-db-billing-help-'. $glmAction . '-' . $sub['name'],
+                                    'title'    => __( $sub['title'] ),
+                                    'content'  => $fileContents,
+                                    'callback' => 'loadHelpFile',
+                                    'extra'    => $glmAction . '-' . $sub['name'],
+                                )
+                            );
+                        }
+                    }
+                }
+            }
+        }
+
+        // Help sidebars
+        $screen->set_help_sidebar(
+            '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+            '<p><a href="https://www.gaslightmedia.com/wp-admin-guide/#GLM" target="_blank">' .
+            __( 'Help Guide' ) . '</a></p>'
+        );
+    }
+);
diff --git a/setup/help/accounts.html b/setup/help/accounts.html
new file mode 100644 (file)
index 0000000..adced6c
--- /dev/null
@@ -0,0 +1,3 @@
+<h2>Accounts</h2>
+<p>This is your main Accounts page.</p>
+<p>Search for an account by Date range, Member account, or any of the status filters (Active, Pending, Overdue, Expired)</p>
diff --git a/setup/help/dashboard.html b/setup/help/dashboard.html
new file mode 100644 (file)
index 0000000..547bf0a
--- /dev/null
@@ -0,0 +1,10 @@
+<h2>Dashboard</h2>
+<p>This is your Billing dashboard</p>
+<p>From here you can view any Pending or Overdue Accounts</p>
+<p>You can also
+<ul>
+    <li>Search for accounts</li>
+    <li>Make a Payment</li>
+    <li>Create an Invoice</li>
+    <li>Export Account data</li>
+</ul></p>
diff --git a/setup/help/invoices-add.html b/setup/help/invoices-add.html
new file mode 100644 (file)
index 0000000..7df3b1c
--- /dev/null
@@ -0,0 +1,9 @@
+<h2>Create Invoice</h2>
+<p>From this screen you can create an invoice.</p>
+<p>Start by typing into the Billing Account field. It will auto complete with the Billing Account name.</p>
+<p>You can:
+<ul>
+    <li>Add Line Item</li>
+    <li>Create New Line Item</li>
+</ul>
+</p>
diff --git a/setup/help/invoices.html b/setup/help/invoices.html
new file mode 100644 (file)
index 0000000..f54a1ef
--- /dev/null
@@ -0,0 +1,3 @@
+<h2>Invoices</h2>
+<p>This is your Main Invoices page. You can search for a date range, Member Account, or by Unpaid Status</p>
+<p>Each row has links to Member Billing Dashboard, Edit, View, Make a Payment (if unpaid) or Delete</p>
diff --git a/setup/help/invoicing-createInvoices.html b/setup/help/invoicing-createInvoices.html
new file mode 100644 (file)
index 0000000..6ae2f97
--- /dev/null
@@ -0,0 +1,3 @@
+<h2>Create Invoices</h2>
+<p>From this screen you can create invoices for your billing accounts.</p>
+<p>First filter the results then click on Create Invoices.</p>
diff --git a/setup/help/invoicing-createLabels.html b/setup/help/invoicing-createLabels.html
new file mode 100644 (file)
index 0000000..95b52cf
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Create Labels</h2>
+<p>Filter the available invoices. Then create labels.</p>
diff --git a/setup/help/invoicing-printInvoices.html b/setup/help/invoicing-printInvoices.html
new file mode 100644 (file)
index 0000000..331c495
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Print Invoices</h2>
+<p>Filter the available invoices. Then print.</p>
diff --git a/setup/help/invoicing-sendEmails.html b/setup/help/invoicing-sendEmails.html
new file mode 100644 (file)
index 0000000..4ef095b
--- /dev/null
@@ -0,0 +1,3 @@
+<h2>Send Emails</h2>
+<p>Filter the available invoices. Then Send Emails.</p>
+
diff --git a/setup/help/invoicing.html b/setup/help/invoicing.html
new file mode 100644 (file)
index 0000000..1c25abc
--- /dev/null
@@ -0,0 +1,10 @@
+<h2>Invoicing</h2>
+<p>This is your main invoicing page.</p>
+<p>Click on one of the sub tabs to:
+<ul>
+    <li>Create Invoices</li>
+    <li>Print Invoices</li>
+    <li>Create Labels</li>
+    <li>Send Emails</li>
+</ul>
+</p>
diff --git a/setup/help/logs.html b/setup/help/logs.html
new file mode 100644 (file)
index 0000000..489b316
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Logs</h2>
+<p>This list out logs from cron jobs such as email notifications.</p>
diff --git a/setup/help/payments-add.html b/setup/help/payments-add.html
new file mode 100644 (file)
index 0000000..a143f4a
--- /dev/null
@@ -0,0 +1,3 @@
+<h2>Make a Payment</h2>
+<p>You can create a payment for a billing account from this one form.</p>
+<p>Start the lookup by entering text into the Lookup Member Invoices By Account field.</p>
diff --git a/setup/help/payments.html b/setup/help/payments.html
new file mode 100644 (file)
index 0000000..2131050
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Payments</h2>
+<p>This is your Main Payments page. You can search by date range or Member account.</p>
diff --git a/setup/help/reports-accountsByAge.html b/setup/help/reports-accountsByAge.html
new file mode 100644 (file)
index 0000000..d57ef98
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Accounts By Age</h2>
+<p>This list accounts that are over 60 days past due.</p>
diff --git a/setup/help/reports-allAccounts.html b/setup/help/reports-allAccounts.html
new file mode 100644 (file)
index 0000000..fdbd7a1
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>All Accounts</h2>
+<p>This list all accounts.</p>
diff --git a/setup/help/reports-closedAccounts.html b/setup/help/reports-closedAccounts.html
new file mode 100644 (file)
index 0000000..88abeec
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Closed Accounts</h2>
+<p>This list all accounts that are paid.</p>
diff --git a/setup/help/reports-noAccounts.html b/setup/help/reports-noAccounts.html
new file mode 100644 (file)
index 0000000..8adfe93
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>No Accounts</h2>
+<p>This list all members without accounts.</p>
diff --git a/setup/help/reports-openAccounts.html b/setup/help/reports-openAccounts.html
new file mode 100644 (file)
index 0000000..31b2045
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Open Accounts</h2>
+<p>This list any accounts with a balance due.</p>
diff --git a/setup/help/reports-reportGenerator.html b/setup/help/reports-reportGenerator.html
new file mode 100644 (file)
index 0000000..c2b7ab6
--- /dev/null
@@ -0,0 +1,3 @@
+<h2>Report Generatoro</h2>
+<p>You can generate reports for your billing accounts</p>
+<p>Totals are included at the bottom.</p>
diff --git a/setup/help/reports.html b/setup/help/reports.html
new file mode 100644 (file)
index 0000000..c128e6b
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Reports</h2>
+<p>This is your main reports page.</p>
index f7fcaf2..dc68cc7 100644 (file)
@@ -1,6 +1,6 @@
 <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
     <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices"
         class="nav-tab{if $option == 'list'} nav-tab-active{/if}">Search Invoices</a>
-    <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices&option=add"
+    <a href="{$thisUrl}?page=glm-members-admin-menu-billing&glm_action=invoices&option=add#tab-link-glm-member-db-billing-help-invoices-add"
         class="nav-tab{if $option == 'add' || $option == 'edit'} nav-tab-active{/if}">Create Invoice</a>
 </h2>