Updates to registrations admin. Working on completing various page output.
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 16 Nov 2017 20:51:18 +0000 (15:51 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 16 Nov 2017 20:51:18 +0000 (15:51 -0500)
Added better formatted date to getRegistrationCart() data.
Staging regRequestEvent.php for deletion.
Added admin hook to display a link to an event from registrations.
Added links between Events and Registrations on vaious tables and dashboards.
Added cart data to admin requests dashboard.
Various other minor appearance issues.

14 files changed:
classes/regCartSupport.php
css/admin.css
models/admin/ajax/account.php
models/admin/ajax/regFront/DELETE_regRequestEvent.php [new file with mode: 0644]
models/admin/ajax/regFront/regRequestEvent.php [deleted file]
models/admin/ajax/regFront/registrant.php
models/admin/ajax/updateAvailability.php
models/admin/registrations/requests.php
views/admin/registrations/eventDashboard.html
views/admin/registrations/eventsDashboard.html
views/admin/registrations/requestDashboard.html
views/admin/registrations/requestsDashboard.html
views/front/registrations/cart.html
views/front/registrations/registration.html

index 84cd3a5..f9ab1f5 100644 (file)
@@ -229,10 +229,12 @@ class GlmRegCartSupport
                                 // Get list of registrants requested for this rate
                                 $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'] = $RequestRegistrant->getList("T.reg_request_rate =  ".$rate['id']);
 
-                                // For each rate selected for this class
+                                // For each registrant under this rate
                                 if ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants']) {
                                     foreach ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'] as $registrantKey => $registrant) {
 
+                                        $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'][$registrantKey]['timeReformatted'] = date('l m/d/Y g:i A', strtotime($registrant['event_time']));
+
                                         // Add registrant account to accounts table
                                         $this->addAccountToCart($registrant['account']);
 
index 01faa2a..71969c1 100644 (file)
@@ -54,3 +54,4 @@
     margin-top: 1em;
     margin-left: 2em;
 }
+
index 962cff2..faf80a1 100644 (file)
@@ -78,7 +78,7 @@ class GlmMembersAdmin_ajax_account extends GlmDataRegistrationsAccount
         $return = false;
 
         $option = filter_var( $_REQUEST['option'], FILTER_SANITIZE_STRING );
-        trigger_error(print_r($_REQUEST,E_USER_NOTICE));
+        // trigger_error(print_r($_REQUEST,E_USER_NOTICE));
 
         switch ( $option ) {
         case 'register':
diff --git a/models/admin/ajax/regFront/DELETE_regRequestEvent.php b/models/admin/ajax/regFront/DELETE_regRequestEvent.php
new file mode 100644 (file)
index 0000000..ee3579d
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations AJAX processing for Registration Request Events
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  regRequestEvent.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Registrations data abstract
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
+
+class GlmMembersAdmin_registrations_ajax_regClasses extends GlmDataRegistrationsRequestEvent
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /**
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        /*
+         * 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);
+
+    }
+
+    public function modelAction($modelData)
+    {
+
+trigger_error(print_r($modelData,1));
+
+        // Perform specified action
+        switch ($modelData['option']) {
+
+            case 'add':
+                break;
+
+            case 'get':
+                break;
+
+            case 'update':
+                break;
+
+            case 'delete':
+                break;
+
+            default:
+                die();  // should never get here
+                break;
+
+        }
+
+        wp_die();
+
+
+
+    }
+
+
+}
diff --git a/models/admin/ajax/regFront/regRequestEvent.php b/models/admin/ajax/regFront/regRequestEvent.php
deleted file mode 100644 (file)
index ee3579d..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Registrations AJAX processing for Registration Request Events
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  regRequestEvent.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Registrations data abstract
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
-
-class GlmMembersAdmin_registrations_ajax_regClasses extends GlmDataRegistrationsRequestEvent
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-
-    /**
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * 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);
-
-    }
-
-    public function modelAction($modelData)
-    {
-
-trigger_error(print_r($modelData,1));
-
-        // Perform specified action
-        switch ($modelData['option']) {
-
-            case 'add':
-                break;
-
-            case 'get':
-                break;
-
-            case 'update':
-                break;
-
-            case 'delete':
-                break;
-
-            default:
-                die();  // should never get here
-                break;
-
-        }
-
-        wp_die();
-
-
-
-    }
-
-
-}
index fae4e50..8ce06e3 100644 (file)
@@ -82,7 +82,7 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations
     {
 
         $validated = false;
-        trigger_error(print_r($modelData,1));
+        // trigger_error(print_r($modelData,1));
 
         if ( !isset( $modelData['option'] ) ) {
             $option = null;
index e37d121..1447373 100644 (file)
@@ -71,7 +71,6 @@
             wp_die();
         }
 
-trigger_error("1111",E_USER_NOTICE);
         // Get the reg_time entry id
         if (!isset($_REQUEST['reg_time'])) {
             wp_die();
@@ -81,17 +80,14 @@ trigger_error("1111",E_USER_NOTICE);
             wp_die();
         }
 
-trigger_error("regTimeId = $regTimeId",E_USER_NOTICE);
         // Try to get the reg_time entry
         $regTime = $this->getEntry($regTimeId);
         if (!$regTime) {
             wp_die();
         }
 
-trigger_error("3333",E_USER_NOTICE);
         // re-calculate the total
         $avail = $max - $regTime['attendee_count'] - $regTime['attendees_pending'];
-trigger_error("max = $max, avail = $avail", E_USER_NOTICE);
         // Try to update the reg_time entry
         $this->wpdb->update(
             $this->table,
index 079d96f..f374468 100644 (file)
@@ -196,6 +196,8 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
             update_option('glmMembersDatabaseRegistrationsRequestID', $requestID);
         }
 
+        // echo "<pre>".print_r($cart,1)."</pre>";
+
         // Compile template data
         $templateData = array(
             'haveRequests'  => $haveRequests,
@@ -205,7 +207,8 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
             'cart'          => $cart,
             'haveCart'      => $haveCart,
             'errorMsg'      => $errorMsg,
-            'option'        => $option
+            'option'        => $option,
+            'regUrl'        => GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/'
         );
              // Return status, any suggested view, and any data to controller
         return array(
index ff208d2..ae688e8 100644 (file)
             </div>
             {if apply_filters('glm_members_menu_members', true)}
             <div class="glm-small-4 glm-right">
+                {$r_link = apply_filters('glm_members_add_link_to_registrations_event_list_entry', $regEvent.event)}
+                {if is_array($r_link)}
+                    <a class="button button-secondary glm-button glm-right" href="{$r_link.url|escape:'string'}">Edit {$r_link.title}</a>
+                {/if}
                 <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=edit&regEventID={$regEvent.id}" class="button button-secondary glm-button glm-right">Edit Registration Event</a>
             </div>
             {/if}
index 654b62f..e0304f6 100644 (file)
@@ -41,6 +41,7 @@
             <tr>
                 <th>ID</th>
                 <th>Event Name</th>
+                <th>&nbsp;</th>
             </tr>
         </thead>
         <tbody>
                     <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard&regEventID={$r.id}">{$r.id}</a>
                 </td>
                 <td>
-                    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard&regEventID={$r.id}">{$r.event_name}</a>
+                   <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard&regEventID={$r.id}">{$r.event_name}</a>
+                </td>
+                <td>
+                {$r_link = apply_filters('glm_members_add_link_to_registrations_event_list_entry', $r.event)}
+                {if is_array($r_link)}
+                    <a class="button button-secondary glm-button-small" href="{$r_link.url|escape:'string'}">{$r_link.title}</a>
+                {/if}
                 </td>
             </tr>
     {/foreach}
index 6fd6326..baaa708 100644 (file)
@@ -7,13 +7,22 @@
 <div class="glm-admin-table-inner glm-admin-table">
     
     <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&glm_action=requests&option=edit&account={$acct}" class="button button-secondary glm-button glm-right">Edit Request</a>
-    <h3>Request</h3>
+    <h1>Request</h1>
     
     <div id="glm-admin-member-registrations-request-overview" class="glm-admin-table">
         <div class="glm-row">
             <div class="glm-small-4 glm-left">
                 <div class="glm-admin-table">
 
+                    <div class="glm-row">
+                        <div class="glm-small-12 glm-column">
+                            <h3>Request ID:</h3>
+                        </div>
+                        <div class="glm-small-12 glm-column">
+                            {$cart.request.id}
+                        </div>
+                    </div>
+
                     <div class="glm-row">
                         <div class="glm-small-12 glm-column">
                             <h3>Account Submitting Request:</h3>
                             <h3>Checkout Summary:</h3>
                         </div>
                         <div class="glm-small-12 glm-column" style="margin-top: .5em;">
+                    {if $cart.request.summary}
                             <a id="viewSummaryButton" class="button button-secondary glm-button">View</a>
                             <div id="viewSummaryDialog" class="glm-dialog-box" title="Registration Request Checkout Summary">
                                 {$cart.request.summary}
                             </div>
+                    {/if}
                         </div>
                     </div>
                 </div>
 
 <div class="glm-admin-table-inner glm-admin-table">
     
-    <h3>Request Cart</h3>
+    <h1>Current Cart Contents</h1>
+    
+    <div>
+
+{if $haveCart && !$cart.request.summary}
+
+        
+        <div>
+            <a href="{$regUrl}?page=cart&cartId={$cart.request.id}" class="button button-secondary glm-button">Show Front-End Cart Page</a>
+        </div>
+        
+        <table class="glm-admin-table" width="100%" style="background-color: #fff; border: 1px black solid; margin-top: 2rem;">
+      
+            <thead>
+
+                <tr>
+                    <th>Registering</th>
+                    <th>Registrant</th>
+                    <th>Date/Time</th>
+                    <th>Discount</th>
+                    <th>Rate</th>
+                </tr>
+
+
+            </thead>
+            <tbody>
+  {foreach $cart.events as $event}
+                <tr>
+                    <th colspan="5">Event: {$event.event_name}</th>
+                </tr>
+    {foreach $event.classes as $class}
+                <tr>
+                    <td colspan="5">&nbsp;&nbsp;&nbsp;&nbsp;{$class.class_name}</td>
+                </tr>
+      {foreach $class.rates as $rate}
+        {if $rate.base_rate || $rate.registrant_credits}
+                <tr>
+                    <td colspan="4">
+                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$rate.rate_name}
+                        - Base Rate ({$rate.registrant_credits} registrants included)
+                    </td>
+                    <td style="text-align: right;">
+                        {if $rate.base_rate}{$rate.base_rate_money}{/if}
+                    </td>
+                </tr>
+        {/if}
+        {foreach $rate.registrants as $registrant}
+                <tr>
+                    <td>&nbsp;</td>
+                    <td>{$registrant.fname} {$registrant.lname}</td>
+                    <td>{$registrant.timeReformatted}</td>
+                    <td style="text-align: right;">
+                        {if $registrant.registrantDiscounts > 0}
+                            {$registrant.registrantDiscounts|number_format:2}
+                        {else}
+                            &nbsp;
+                        {/if}
+                    </td>
+                    <td style="text-align: right;">
+                        {if $registrant.registrantRate > 0}
+                            {$registrant.registrantRate|number_format:2}
+                        {else}
+                            (included)
+                        {/if}
+                    </td>
+                </tr>
+          {assign var="acct" value=$cart.accounts.{$registrant.account}}
+          {if $acct.validated.value}
+                <tr>
+                    <td colspan="2">&nbsp;</td>
+                    <td colspan="3">
+                      {if $acct.email != ''}E-Mail: {$acct.email}<br>{/if}
+                      (Account information is restricted)
+                    </td>
+                </tr>
+          {else}
+            {if $acct.addr1 != '' || $acct.phone != '' || $acct.email != ''}
+                <tr>
+                    <td colspan="2">&nbsp;</td>
+                    <td colspan="3">
+                      {if $acct.org != ''}          {$acct.title}, {$acct.org}<br>                      {/if}
+                      {if $acct.addr1 != ''}        {$acct.addr1}<br>                                   {/if}
+                      {if $acct.addr2 != ''}        {$acct.addr2}<br>                                   {/if}
+                      {if $acct.city != ''}         {$acct.city}, {$acct.state.value} {$acct.zip}<br>   {/if}
+                      {if $acct.country.name != ''} {$acct.country.name}<br>                            {/if}
+                      {if $acct.phone != ''}        Phone: {$acct.phone}<br>                            {/if}
+                      {if $acct.fax != ''}          Fax: {$acct.fax}<br>                                {/if}
+                      {if $acct.email != ''}        E-Mail: {$acct.email}                               {/if}
+                    </td>
+                </tr>
+            {/if}
+          {/if}
+        {/foreach}
+      {/foreach}
+    {/foreach}
+  {/foreach}
+            </tbody>
+            <tfoot>
+                <td colspan="2">&nbsp;</td>
+                <td>Total registrants: {$cart.totalRegistrants}</td>
+                <td style="text-align: right;">
+                    {if $cart.totalDiscounts > 0}
+                        ${$cart.totalDiscounts|number_format:2}
+                    {else}
+                        &nbsp;
+                    {/if}
+                </td>
+                <td style="text-align: right;">${$cart.totalCharges|number_format:2}</td>
+            </tfoot>
+        </table>
+{/if} {* / if have cart *}
+    </div>
+</div>    
+    
     
-    (awaiting page development)
+
 
 </div>
 
index 98603c6..065e7c2 100644 (file)
                     <th>Org</th>
                     <th>City</th>
                     <th>State</th>
+                    <th>Country</th>
+                    <th>Phone</th>
+                    <th>E-mail</th>
+                    <th>Status</th>
                 </tr>
             </thead>
             <tbody>
     {if $haveRequests}
         {foreach $requests as $r}
                 <tr>
-                    <td>{$r.id}<a href="">show</a></td>
-                    <td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$r.id}">{$r.bill_fname}</td>
-                    <td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$r.id}">{$r.bill_lname}</td>
-                    <td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$r.id}">{$r.bill_org}</td>
+                    <td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$r.id}">{$r.id}</a></td>
+                    <td>{$r.bill_fname}</td>
+                    <td>{$r.bill_lname}</td>
+                    <td>{$r.bill_org}</td>
                     <td>{$r.bill_city}</td>
                     <td>{$r.bill_state}</td>
+                    <td>{$r.bill_country}</td>
+                    <td>{$r.bill_phone}</td>
+                    <td>{$r.bill_email}</td>
+                    <td>{$r.status.name}</td>
                 </tr>
         {/foreach}
     {else}
index f23f136..36b29dd 100644 (file)
@@ -87,7 +87,7 @@
                     </td>
                 </tr>
           {else}
-            {if $acct.addr != '' || $acct.phone != '' || $acct.email != ''}
+            {if $acct.addr1 != '' || $acct.phone != '' || $acct.email != ''}
                 <tr>
                     <td colspan="2">&nbsp;</td>
                     <td colspan="3">
index b844b9c..a5a83d5 100644 (file)
@@ -13,7 +13,7 @@
             <h2><%= event_name %></h2>
             <div>
                 <% if ( this.getClassCount() == 0 ) { %>
-                    <p> Registrations for this event not currently available at this time. </p>
+                    <p> Registrations not available at this time. </p>
                 <% } else { %>
                     <% if ( !time_specific ) { %>
                         <p>Attend any time during event</p>