From: Chuck Scott Date: Tue, 5 Sep 2017 20:12:29 +0000 (-0400) Subject: Minor typo in text on CartSupport class. X-Git-Tag: v1.0.0^2~427 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=1f4c22c3ea60d0f11dc369b8b1cbf973709f73c3;p=WP-Plugins%2Fglm-member-db-registrations.git Minor typo in text on CartSupport class. More work on registrations accounts admin pages including added selected account dashboard page and better organization of account admin actions. --- diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index 1af9f95..c460cf3 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -254,7 +254,7 @@ class GlmRegCartSupport } /* - * Recalculates and updates all totals for a reg_)time entry + * Recalculates and updates all totals for a reg_time entry * * @param integer $requestId * diff --git a/models/admin/registrations/accounts.php b/models/admin/registrations/accounts.php index b382052..612779a 100644 --- a/models/admin/registrations/accounts.php +++ b/models/admin/registrations/accounts.php @@ -87,7 +87,9 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount public function modelAction($actionData = false) { - $option = 'list'; + $option = 'dashboard'; + $view = 'accountsDashboard'; + $reason = false; $numbAccounts = 0; $hasAccounts = false; $paging = true; @@ -100,7 +102,7 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $filterArchived = false; $filterPending = false; $accounts = false; - $view = 'account'; + $accountID = false; $account = false; $haveAccount = false; $accountUpdated = false; @@ -110,7 +112,11 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $namesList = false; $numbDisplayed = false; $lastDisplayed = false; - + $registrations = false; + $haveRegistrations = false; + $registered = false; + $haveRegistered = false; + // Get any provided option if (isset($_REQUEST['option'])) { $option = $_REQUEST['option']; @@ -120,47 +126,49 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount if (isset($_REQUEST['account'])) { // Make sure it's numeric - $this->accountID = ($_REQUEST['account'] - 0); - - if ($this->accountID <= 0) { - $this->accountID = false; - } + $accountID = ($_REQUEST['account'] - 0); + } else { + + // Try to get saved + $accountID = get_option('glmMembersDatabaseRegistrationsAccountID'); + } - - $view = 'accountEdit'; - + + if (!$accountID || $accountID <= 0) { + $accountID = false; + } + switch ( $option ) { case 'add': + $account = $this->newEntry(); + $view = 'accountEdit'; + break; case 'insert': + $account = $this->insertEntry(); if ( $account['status'] ) { $accountAdded = true; } else { $accountAddError = true; } - break; - case 'edit': - $account = $this->editEntry( $this->accountID ); - //echo '
$account: ' . print_r( $account, true ) . '
'; - if ( $account['status'] ) { - $haveAccount = true; - } - //echo '
$account: ' . print_r( $account, true ) . '
'; + $view = 'accountEdit'; + break; case 'update': - $account = $this->updateEntry( $this->accountID ); + + $account = $this->updateEntry( $accountID ); if ( $account['status'] ) { //echo '
$account: ' . print_r( $account, true ) . '
'; $accountUpdated = true; // Retrieve the Edit Entry again - $account = $this->editEntry( $this->accountID ); + $account = $this->editEntry( $accountID ); if ( $account['status'] ) { $haveAccount = true; } @@ -168,14 +176,69 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $accountUpdateError = true; } + $view = 'accountEdit'; break; case 'delete': - $oldAccount = $this->deleteEntry( $this->accountID, true ); - $view = 'account'; - + + echo "*** NEED TO CHECK IF IT'S SAVE TO DELETE THIS ACCOUNT ***"; + + // $oldAccount = $this->deleteEntry( $accountID, true ); + + $view = 'accountsDashboard'; + + break; + + case 'accountDashboard': + + // Load registration request and registration registrant data classes + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; + $RegRequest = new GlmDataRegistrationsRequest($this->wpdb, $this->config); + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php'; + $RegRequestRegistrant = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config); + + // Get account base data + $account = $this->getEntry($accountID); + if ($account) { + + $haveAccount = true; + + // Get any registrations submitted + $registrations = $RegRequest->getList("T.account = $accountID"); + if (is_array($registrations) && count($registrations) > 0) { + $haveRegistrations = true; + } + + // Get any events registered + $registered = $RegRequestRegistrant->getList("T.account = $accountID"); + if (is_array($registered) && count($registered) > 0) { + $haveRegistered = true; + } + + } + + $view = 'accountDashboard'; + + break; + + case 'edit': + + $account = $this->editEntry( $accountID ); + if ( $account['status'] ) { + + $haveAccount = true; + $view = 'accountEdit'; + + } + + break; + default: - $where = 'true'; + case 'dashboard'; + + $option = 'dashboard'; + $where = 'true'; + // Check if we're doing paging if (isset($_REQUEST['pageSelect'])) { @@ -224,14 +287,22 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $accounts = $accountsResult['list']; $hasAccounts = ( $accounts !== false && count( $accounts > 0 ) ) ? true: false; - $view = 'account'; // Get full list of names matching this where clause for search box $namesList = $this->getIdName( $where ); unset( $accountsResult ); + + $view = 'accountsDashboard'; + break; + } - + + // If we have a valid account ID, save that for future use + if ($accountID > 0) { + update_option('glmMembersDatabaseRegistrationsAccountID', $accountID); + } + // Compile template data $templateData = array( 'hasAccounts' => $hasAccounts, @@ -246,7 +317,7 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount 'toDate' => $toDate, 'filterArchived' => $filterArchived, 'filterPending' => $filterPending, - 'accountID' => $this->accountID, + 'accountID' => $accountID, 'haveAccount' => $haveAccount, 'accountUpdated' => $accountUpdated, 'accountUpdateError' => $accountUpdateError, @@ -256,6 +327,11 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount 'namesList' => $namesList, 'numbDisplayed' => $numbDisplayed, 'lastDisplayed' => $lastDisplayed, + 'registrations' => $registrations, + 'haveRegistrations' => $haveRegistrations, + 'registered' => $registered, + 'haveRegistered' => $haveRegistered, + 'reason' => $reason ); // Return status, any suggested view, and any data to controller return array( diff --git a/views/admin/registrations/account.html b/views/admin/registrations/account.html deleted file mode 100644 index 7d1f84e..0000000 --- a/views/admin/registrations/account.html +++ /dev/null @@ -1,104 +0,0 @@ -{include file='admin/registrations/header.html'} - -

Account List Page

- - Add A New Account - -
- - - - - -
-

- - Name Search: - - -

-

- -
-

Total found: {$numAccounts}  

- - {if $paging && $numAccounts} - - - {/if} - -{if $hasAccounts} - {assign var="i" value="0"} - - - - - - - - - - - - {foreach $accounts as $account} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - - - - {/foreach} -
IDActiveNameCreatedMember ID
{$account.id}{$account.active.name} - {$account.fname} {$account.lname} - {$account.date_created.timestamp|date_format:"%D"}{$account.member_id}
-{/if} - - {if $paging && $numAccounts} - - - {/if} - -
- - - -{include file='admin/footer.html'} - diff --git a/views/admin/registrations/accountDashboard.html b/views/admin/registrations/accountDashboard.html new file mode 100644 index 0000000..15cfca6 --- /dev/null +++ b/views/admin/registrations/accountDashboard.html @@ -0,0 +1,124 @@ +{include file='admin/registrations/accountHeader.html'} + +

Account Dashboard + Edit Account +

+ + +{if $paging && $numAccounts} + + +{/if} + +
+
+
+
+
+
+

Account:

+
+
+ {$account.fname} {$account.lname}{if $account.title}, {$account.title}{/if} +
+
+ {$account.org} +
+
+ {$account.addr1} +
+ {if $account.addr2} +
+ {$account.addr2} +
+ {/if} +
+ {$account.city}, {$account.state} {$account.zip} +
+
+ {$account.country} +
+
+
+
+
+
+
+
+

Active:

+
+
+ {if $account.active}Yes{/if} +
+
+
+
+
+
+

Login Validated:

+
+
+ {if $account.validated}Yes{/if} +
+
+
+
+
+
+ +
+

Registration Requests

+ {assign var="i" value="0"} + + + + + + + + + + + {foreach $registrations as $reg} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + + {/foreach} +
SubmittedPayment ByTotal PaymentStatus
{$reg.date_submitted.datetime}{$reg.pay_method.name}{$reg.total}{$reg.status.name}
+
+ +
+

Registered for Events

+ {assign var="i" value="0"} + + + + + + + + + {foreach $registered as $reg} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + {/foreach} +
Event NameDate/Time
{$reg.event_name}{$reg.event_datetime.datetime}
+
+ + + +{include file='admin/footer.html'} + diff --git a/views/admin/registrations/accountEdit.html b/views/admin/registrations/accountEdit.html index 58f9a2d..e817197 100644 --- a/views/admin/registrations/accountEdit.html +++ b/views/admin/registrations/accountEdit.html @@ -1,27 +1,8 @@ -{include file='admin/registrations/header.html'} +{include file='admin/registrations/accountHeader.html'} - Return to Account List + Return to Account {if $option == 'edit' || $option == 'update'} - Delete this Account -
-
-

Cancel

-

-
-
-

WARNING:

-

- Clicking the "Delete this Account" button above will - delete all of the data and images associated with this contact. - -

-

- Once deleted, this information will no longer be available and cannot be retrieved! -

-
-

Edit Account {else}

Add new Account @@ -33,6 +14,7 @@ {if $accountAddError}Account Add Error{/if}

+

diff --git a/views/admin/registrations/accountHeader.html b/views/admin/registrations/accountHeader.html new file mode 100644 index 0000000..2cc4960 --- /dev/null +++ b/views/admin/registrations/accountHeader.html @@ -0,0 +1,7 @@ +
+

Registration Accounts

+ +
diff --git a/views/admin/registrations/accountsDashboard.html b/views/admin/registrations/accountsDashboard.html new file mode 100644 index 0000000..bfcd4c4 --- /dev/null +++ b/views/admin/registrations/accountsDashboard.html @@ -0,0 +1,104 @@ +{include file='admin/registrations/accountHeader.html'} + +

Accounts Dashboard + Add A New Account +

+ + + + + + + +
+

+ + Name Search: + + +

+

+ +
+

Total found: {$numAccounts}  

+ + {if $paging && $numAccounts} + + + {/if} + +{if $hasAccounts} + {assign var="i" value="0"} + + + + + + + + + + + + {foreach $accounts as $account} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + + + {/foreach} +
IDActiveNameCreatedMember ID
{$account.id}{$account.active.name} + {$account.fname} {$account.lname} + {$account.date_created.timestamp|date_format:"%D"}{$account.member_id}
+{/if} + + {if $paging && $numAccounts} + + + {/if} + + + + + +{include file='admin/footer.html'} +