From 139d3e94adf82a439ff81528dc4caf8c73281f43 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 14 Dec 2017 21:09:09 -0500 Subject: [PATCH] Added registrant list output to registrants tab in admin registration event pages. Added post-processing and function to dataRegRequestRegistrant.php to include more data on a registrant. Added "registrants" option code to events.php to collect registrant data. Added template code to eventRegistrants.html --- classes/data/dataRegRequestRegistrant.php | 133 ++++++++++++++++++ models/admin/registrations/events.php | 21 ++- .../admin/registrations/eventRegistrants.html | 49 ++++++- 3 files changed, 198 insertions(+), 5 deletions(-) diff --git a/classes/data/dataRegRequestRegistrant.php b/classes/data/dataRegRequestRegistrant.php index 0bd087d..e5d7d46 100644 --- a/classes/data/dataRegRequestRegistrant.php +++ b/classes/data/dataRegRequestRegistrant.php @@ -151,6 +151,14 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract 'use' => 'lg' ), + // Pointer to reg_request table entry + 'reg_request' => array ( + 'field' => 'reg_request', + 'type' => 'integer', + 'required' => true, + 'use' => 'lgneud' + ), + // Pointer to reg_request_event table entry 'reg_request_event' => array ( 'field' => 'reg_request_event', @@ -211,10 +219,135 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract 'use' => 'a' ), + // Additional quick data + + // Class Name + 'class_name' => array ( + 'field' => 'reg_request_class', + 'as' => 'class_name', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_class', + 'p_field' => 'class_name', + 'p_static' => true, + 'required' => true, + 'use' => 'lg' + ), + + // Rate Name + 'rate_name' => array ( + 'field' => 'reg_request_rate', + 'as' => 'rate_name', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_rate', + 'p_field' => 'rate_name', + 'p_static' => true, + 'required' => true, + 'use' => 'lg' + ), + + // Request Status + 'request_status' => array ( + 'field' => 'reg_request', + 'as' => 'request_status', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request', + 'p_field' => 'status', + 'p_static' => true, + 'required' => true, + 'use' => 'lg' + ) + ); } + /** + * Entry Post Processing Call-Back Method + * + * Perform post-processing for all result entries. + * + * @param array $r Array of field result data for a single entry + * @param string $a Action being performed (l, i, g, ...) + * + * @return object Class object + * + */ + public function entryPostProcessing( $r, $action ) + { + + // If doing the following actions + if (in_array($action, array('l','g'))) { + + // Get the registration request status name + $r['request_status_name'] = $this->config['submission_status'][$r['request_status']]; + + // Add a reformatted date/time + $r['event_time_reformatted'] = ''; + $t = strtotime($r['event_time']); + if ($t > 0) { + $r['event_time_reformatted'] = date('m/d/Y h:i A', strtotime($r['event_time'])); + } + + } + + return $r; + } + + + /* + * Get full information on registrants for an event + * + * @param integer $eventId ID of the reg_event record + * + * @return array List of registrants with optional additional data or false if none + * + */ + public function getFullRegistrantsData($eventId = false) + { + + // Check Event ID + $eventId = ($eventId - 0); + if ($eventId <= 0) { + return false; + } + + // Get registrants for this event + $registrants = $this->getList("T.reg_event = $eventId"); + + // Make sure we received registrants + if (!is_array($registrants) || count($registrants) == 0) { + return false; + } + + // For each registrant + foreach ($registrants as $registrantKey=>$registrantVal) { + + // Try to get account + $registrants[$registrantKey]['account'] = false; + if ($registrantVal['account']) { + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataAccount.php'; + $Accounts = new GlmDataRegistrationsAccount($this->wpdb, $this->config); + $registrants[$registrantKey]['account'] = $Accounts->getEntry($registrantVal['account']); + } + + // Try to get any per Event custom field data + + // Try to get any per + } + + return $registrants; + + + + + + + + + + + + } } ?> \ No newline at end of file diff --git a/models/admin/registrations/events.php b/models/admin/registrations/events.php index eec5a41..ba2ef28 100644 --- a/models/admin/registrations/events.php +++ b/models/admin/registrations/events.php @@ -70,9 +70,6 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent /* * Run constructor for the REgistrations data class - * - * Note, the third parameter is a flag that indicates to the Contacts - * data class that it should flag a group of fields as 'view_only'. */ parent::__construct(false, false, true); @@ -116,6 +113,8 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent $regTimesJSON = false; $regEventDeleted = false; $classes = false; + $haveRegistrants = false; + $registrants = false; // Register the masked input script that we need for input controls wp_dequeue_script('glm-members-admin-maskedinput'); @@ -159,6 +158,18 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent case 'registrants': + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php'; + $Registrants = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config); + + // Get list of all registrants for this event + $registrants = $Registrants->getFullRegistrantsData($regEventID); + + if ($registrants) { + $haveRegistrants = true; + } + + // echo "
".print_r($registrants,1)."
"; + $view = 'eventRegistrants'; break; @@ -562,7 +573,9 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent 'regEventJSON' => $regEventJSON, 'regClassesJSON' => $regClassesJSON, 'regTimesJSON' => $regTimesJSON, - 'classes' => $classes + 'classes' => $classes, + 'haveRegistrants' => $haveRegistrants, + 'registrants' => $registrants ); // echo "
".print_r($templateData,1)."
"; diff --git a/views/admin/registrations/eventRegistrants.html b/views/admin/registrations/eventRegistrants.html index 5680b15..be1c037 100644 --- a/views/admin/registrations/eventRegistrants.html +++ b/views/admin/registrations/eventRegistrants.html @@ -1,4 +1,51 @@ {include file='admin/registrations/eventHeader.html'} {include file='admin/registrations/eventSubTabs.html'} -this is the registrants page. \ No newline at end of file +{if $errorMsg} +

{$errorMsg}

+{/if} + +

Registrant List

+ +
+ + + + + + + + + + + + + + + + + + {if $haveRegistrants} + {foreach $registrants as $r} + + + + + + + + + + + + + {/foreach} + {else} + + {/if} + +
First NameLast NameCityStatePhoneLevelDate/TimeRateStatus 
{$r.fname}{$r.lname}{$r.account.city}{$r.account.state.value}{$r.account.phone}{$r.class_name}{$r.event_time_reformatted}{$r.rate_name}{$r.request_status_name}Request
(no registrants listed)
+ +
+ +{include file='admin/footer.html'} -- 2.17.1