Now trimming trailing whitespace on PHP files. Most of these files have only whitespa...
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 2 Oct 2017 15:54:17 +0000 (11:54 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 2 Oct 2017 15:54:17 +0000 (11:54 -0400)
Updated getRegistrationCart() and checkRegistrationRequest() to now both optionally return a JSON or an array for the cart contents or return only a status flag.

19 files changed:
classes/regCartSupport.php
gulpfile.js
models/admin/ajax/regAdmin.php
models/admin/ajax/regAdmin/regClasses.php
models/admin/ajax/regAdmin/regRates.php
models/admin/ajax/regFront/regRequestEvent.php
models/admin/management/registrations.php
models/admin/management/regterms.php
models/admin/registrations/events.php
models/admin/registrations/reports.php
models/admin/registrations/requests.php
models/front/registrations/account.php
models/front/registrations/cart.php
models/front/registrations/checkout.php
models/front/registrations/checkoutProcess.php
models/front/registrations/list.php
models/front/registrations/summary.php
setup/shortcodes.php
views/front/registrations/cart.html

index 1a98e3c..4f0fc21 100644 (file)
@@ -138,12 +138,16 @@ class GlmRegCartSupport
      *
      * )
      *
-     * @param integer $requestId
+     * @param integer $requestId Cart (request) ID
+     * @param boolean $json      Tell function to return cart data as JSON
+     * @param boolean $noReturn  Tell function to not return any data - overridden by $json
+     *
+     * @return array Array of cart (request) and all associated information (optionally as a JSON) or false if failure.
+     *               Returns true or false for cart 'status' if $noReturn is set to true.
      *
-     * @return array Array of request and all associated information or false
      * @access public
      */
-    public function getRegistrationCart($requestId = false, $json = false)
+    public function getRegistrationCart($requestId = false, $json = false, $noReturn = false)
     {
 
         $RegEvent = new GlmDataRegistrationsRegEvent($this->wpdb, $this->config);
@@ -172,7 +176,7 @@ class GlmRegCartSupport
         }
 
         // Try to get the base registration request data
-        $this->cart['request'] = $RegRequest->getEntry($requestId);        
+        $this->cart['request'] = $RegRequest->getEntry($requestId);
         if (!$this->cart['request']) {
             $this->cart['errorMsg'] = 'Unable to retrieve the requested registration request.';
             return $this->cart;
@@ -183,7 +187,7 @@ class GlmRegCartSupport
 
         // Get list of events being requested
         $this->cart['events'] = $RequestEvent->getList("T.reg_request = $requestId");
-        
+
         // For each event
         if ($this->cart['events']) {
             foreach ($this->cart['events'] as $eventKey => $event) {
@@ -230,15 +234,19 @@ class GlmRegCartSupport
 
         $this->cart['status'] = true;
         $this->cart['validated'] = false;
-        
+
 //        echo "<br>getRegistrationCart() Results:<pre>".print_r($this->cart,1)."</pre>";        exit;
-        
+
 
         if ($json) {
             return json_encode($this->cart);
         }
 
-        return;
+        if ($noReturn) {
+            return $this->cart['status'];
+        }
+
+        return $this->cart;
 
     }
 
@@ -258,20 +266,24 @@ class GlmRegCartSupport
      *  Updates request last accessed time
      *
      * @param integer $requestId
-     * 
-     * @return array Array of request and all associated information or false
+     * @param boolean $json      Tell function to return cart data as JSON
+     * @param boolean $noReturn  Tell function to not return any data - overridden by $json
+     *
+     * @return array Array of cart (request) and all associated information (optionally as a JSON) or false if failure.
+     *               Returns true or false for cart 'status' if $noReturn is set to true.
+     *
      * @access public
      */
-    public function checkRegistrationRequest($requestId = false
+    public function checkRegistrationRequest($requestId = false, $json = false, $noReturn = false)
     {
 
         // Try to get the cart data
-        $this->getRegistrationCart($requestId);
-        
+        $this->getRegistrationCart($requestId, false, true);
+
         if (!$this->cart) {
             return false;
         }
-        
+
         $RegEvent = new GlmDataRegistrationsRegEvent($this->wpdb, $this->config);
         $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config);
         $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
@@ -279,14 +291,14 @@ class GlmRegCartSupport
         $RequestClass = new GlmDataRegistrationsRequestClass($this->wpdb, $this->config);
         $RequestRate = new GlmDataRegistrationsRegRequestRate($this->wpdb, $this->config);
         $RequestRegistrant = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config);
-        
+
         $this->cart['messages'] = array();
-        
+
         $totalRegistrants       = 0;
         $totalCharges           = 0;
         $totalDiscounts         = 0;
         $grandTotal             = 0;
-        
+
         // If we have a cart (request)
         if ($this->cart) {
 
@@ -294,119 +306,119 @@ class GlmRegCartSupport
             if ($this->cart['request']['account'] && !isset($this->cart['accounts'][$this->cart['request']['account']])) {
                 $this->cart['messages'][] .= 'Account for person submitting the request is missing.';
             }
-            
+
             /*
              * Events Processing
              */
-       
+
             // If we don't have events for this cart
             if (!is_array($this->cart['events']) || count($this->cart['events']) == 0) {
                 $this->cart['messages'][] = 'Cart is empty.';
             } else {
-                
+
                 // Loop through all events in the cart
                 foreach ($this->cart['events'] as $eventKey => $event) {
-  
+
                     $eventRegistrants   = 0;
                     $eventCharges       = 0;
                     $eventDiscounts     = 0;
                     $eventTotal         = 0;
-                    
+
                     // Do event Checks
-                    
-                    
-                    
+
+
+
                     // Check if Event exists in Events add-on and is active in registrations or if doing admin (admin_active)
                     $regEvent = $RegEvent->getEntry($event['reg_event']);
                     if (!$regEvent) {
                         $this->cart['messages'][] = 'Event in cart is not currently available for registration.';
                     }
-                    
+
                     // Check if the event is time-specific and if there's a list of times for this event - If not, should be a default
-                    
+
                     /*
                      * Classes (levels) Processing
                      */
-                    
+
                     // If we don't have classes for this event
                     if (!is_array($event['classes']) || count($event['classes']) == 0 ) {
                         $this->cart['messages'][] = 'Event '.$event['event_name'].' has no levels.';
                     } else {
-   
+
                         // Loop through all classes (levels) for this event
-                        foreach ($event['classes'] as $classKey => $class) { 
-                        
+                        foreach ($event['classes'] as $classKey => $class) {
+
                             $classRegistrants   = 0;
                             $classCharges       = 0;
                             $classDiscounts     = 0;
                             $classTotal         = 0;
-                            
+
                             // Do class (level) checks
-                            
-                            
+
+
                             /*
                              * Rates Processing
                              */
-                            
+
                             // If we don't have rates for this class
                             if (!is_array($class['rates']) || count($class['rates']) == 0 ) {
                                 $this->cart['messages'][] = 'Class '.$class['class_name'].' has no rates.';
                             } else {
-                                
+
                                 // loop through all rates
                                 foreach ($class['rates'] as $rateKey => $rate) {
-                                    
+
                                     $rateRegistrants   = 0;
                                     $rateCharges       = 0;
                                     $rateDiscounts     = 0;
                                     $rateTotal         = 0;
-                                    
+
                                     // Do rate Checks
 
-                                    
+
                                     // Check if listed rate is currently available - If not, add as a problem
-                                    
+
                                     /*
                                      * Registrants Processing
                                      */
-                                    
+
                                     // If we don't have registrants for this class
                                     if (!is_array($rate['registrants']) || count($rate['registrants']) == 0 ) {
                                         $this->cart['messages'][] = 'Rate '.$rate['rate_name'].' has no registrants.';
                                     } else {
-                                        
+
                                         // loop through all Registrants
                                         foreach ($rate['registrants'] as $registrantKey => $registrant) {
-                                            
+
                                             $registrantCharges       = 0;
                                             $registrantDiscounts     = 0;
                                             $registrantTotal         = 0;
-                                            
+
                                             // Do registrant checks
-                                            
 
-                                            
+
+
                                             // Save totals for this registrant
                                             $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'][$registrantKey]['totalCharges']        = $registrantCharges;
                                             $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'][$registrantKey]['totalDiscounts']      = $registrantDiscounts;
                                             $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'][$registrantKey]['rateTotal']           = $registrantTotal;
-                                            
+
                                             // Add totals to rate
                                             $rateRegistrants++;
                                             $rateCharges       += $registrantCharges;
                                             $rateDiscounts     += $registrantDiscounts;
                                             $rateTotal         += $registrantTotal;
-                                            
+
                                         } // Each registrant
-                                    
+
                                     } // Have registrants
-                                    
+
                                     // Save totals for this rate
                                     $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['totalRegistrants']    = $rateRegistrants;
                                     $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['totalCharges']        = $rateCharges;
                                     $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['totalDiscounts']      = $rateDiscounts;
                                     $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['rateTotal']           = $rateTotal;
-                                    
+
                                     // Add totals to class
                                     $classRegistrants   += $rateRegistrants;
                                     $classCharges       += $rateCharges;
@@ -414,48 +426,48 @@ class GlmRegCartSupport
                                     $classTotal         += $rateTotal;
 
                                 } // Each Rate
-                            
+
                             } // Have rates
-                            
+
                             // Save totals for this class (level)
                             $this->cart['events'][$eventKey]['classes'][$classKey]['totalRegistrants']    = $classRegistrants;
                             $this->cart['events'][$eventKey]['classes'][$classKey]['totalCharges']        = $classCharges;
                             $this->cart['events'][$eventKey]['classes'][$classKey]['totalDiscounts']      = $classDiscounts;
                             $this->cart['events'][$eventKey]['classes'][$classKey]['classTotal']          = $classTotal;
-                            
+
                             // Add totals to event
                             $eventRegistrants   += $classRegistrants;
                             $eventCharges       += $classCharges;
                             $eventDiscounts     += $classDiscounts;
                             $eventTotal         += $classTotal;
-                            
-                        
+
+
                         } // Each class
-                        
+
                     } // Have Classes
-                    
+
                     // Save totals for this event
                     $this->cart['events'][$eventKey]['totalRegistrants']    = $eventRegistrants;
                     $this->cart['events'][$eventKey]['totalCharges']        = $eventCharges;
                     $this->cart['events'][$eventKey]['totalDiscounts']      = $eventDiscounts;
                     $this->cart['events'][$eventKey]['eventTotal']          = $eventTotal;
-                    
+
                     // Add totals to request
                     $totalCharges       += $eventCharges;
                     $totalRegistrants   += $eventRegistrants;
                     $totalDiscounts     += $eventDiscounts;
                     $totalTotal         += $eventTotal;
-                    
+
                 } // Each event
-                
+
             } // Have events
-            
+
             // Update request last_update timestamp
-            
+
         } // have request
-        
+
         // Check if Event Time exists in Events add-on
-        
+
 //        echo "<pre>".print_r($this->cart,1)."</pre>";
 
         // Check if no messages then cart validated
@@ -463,7 +475,15 @@ class GlmRegCartSupport
             $this->cart['validated'] = true;
         }
 
-        return;
+        if ($json) {
+            return json_encode($this->cart);
+        }
+
+        if ($noReturn) {
+            return $this->cart['status'];
+        }
+
+        return $this->cart;
 
     }
 
index 165297b..47326ec 100644 (file)
@@ -43,3 +43,4 @@ gulp.task('watch', function(){
 });
 
 gulp.task('default', ['frontscripts', 'adminscripts', 'watch']);
\ No newline at end of file
index bc9b813..7fbc9e7 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Gaslight Media Members Database
- * Registration add-on admin AJAX processor 
+ * Registration add-on admin AJAX processor
  *
  * PHP version 5.5
  *
@@ -14,7 +14,7 @@
  */
 
 /**
- * This class processes AJAX requests from admin Backbone.js registrations interface 
+ * This class processes AJAX requests from admin Backbone.js registrations interface
  */
 class GlmMembersAdmin_ajax_regAdmin
 {
@@ -73,7 +73,7 @@ class GlmMembersAdmin_ajax_regAdmin
 
         // Get Backbone collection we're talking with
         $collection = filter_var( $_REQUEST['collection'], FILTER_SANITIZE_STRING );
-   
+
         // If not a valid collection, die quietly
         if (!in_array($collection, array('regClasses', 'regRates'))) {
             $this->failureResponse('Not a valid desitination (collection?).');
@@ -86,33 +86,33 @@ class GlmMembersAdmin_ajax_regAdmin
         } else {
             $modelData = $_REQUEST;
         }
-        
+
         // Build model and path and class names
         $modelName = GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/ajax/regAdmin/'.$collection.'.php';
         $className = 'GlmMembersAdmin_registrations_ajax_'.$collection;
-        
+
         // Check if model for this request exists
         if (!file_exists($modelName)) {
             trigger_error ( "ERROR: The specified model file doesn't exist. ($modelName)", E_USER_ERROR);
             wp_die();
         }
-       
+
         // Load the model file
         require_once $modelName;
-        
+
         // check for an invalid model class name
         if (!class_exists($className)) {
             trigger_error ( "ERROR: The specified class name doesn't exist. ($className)", E_USER_ERROR);
             wp_die();
         }
-        
+
         // Instantiate the model and ask it to perform the work
         $model = new $className($this->wpdb, $this->config);
 
         $results = $model->modelAction($modelData);
-        
-        
+
+
     }
-    
+
 
 }
index 9cae7e0..4c19702 100644 (file)
@@ -85,12 +85,12 @@ class GlmMembersAdmin_registrations_ajax_regClasses extends GlmDataRegistrations
 
         // Perform specified action
         switch ($modelData['option']) {
-            
+
             case 'add':
-                                
+
                 // Make sure we got a parent ID with the data
                 if (isset($modelData['parent']) || ($modelData['parent']-0) > 0) {
-                    
+
                     // Try to insert the class (level) data
                     $res = $this->wpdb->insert(
                         $this->table,
@@ -105,12 +105,12 @@ class GlmMembersAdmin_registrations_ajax_regClasses extends GlmDataRegistrations
                             '%s'
                         )
                     );
-                    
+
                     if ($res != 1) {
                         trigger_error('Registration Class Insert failed');
                         return false;
                     }
-                    
+
                     // If there's a new classID, declare success
                     $classID = $this->wpdb->insert_id;
                     if ($classID) {
@@ -120,16 +120,16 @@ class GlmMembersAdmin_registrations_ajax_regClasses extends GlmDataRegistrations
                         echo json_encode(0);
                         wp_die();
                     }
-                    
+
                 }
-                
+
                 break;
-                
+
             case 'get':
                 break;
-                
+
             case 'update':
-                
+
                 // We must have a numeric class (level) ID
                 $classID = ($modelData['id'] - 0);
                 if ($classID > 0) {
@@ -148,33 +148,33 @@ class GlmMembersAdmin_registrations_ajax_regClasses extends GlmDataRegistrations
                         ),
                         array( '%d' )
                     );
-                    
+
                 }
-                
+
                 break;
-                
+
             case 'delete':
-                
+
                 $classID = ($modelData['id'] - 0);
                 if ($classID > 0) {
                     $this->wpdb->delete( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_rate', array( 'reg_class' => $classID ), array( '%d' ) );
                     $this->wpdb->delete( $this->table, array( 'id' => $classID ), array( '%d' ) );
                 }
-                
+
                 return;
-                
+
                 break;
-                
+
             default:
                 die();  // should never get here
                 break;
-                
+
         }
-        
+
         wp_die();
-        
-        
-        
+
+
+
     }
 
 
index f1932ff..7bde1bc 100644 (file)
@@ -107,22 +107,22 @@ class GlmMembersAdmin_registrations_ajax_regRates extends GlmDataRegistrationsRe
         switch ($modelData['option']) {
 
             case 'add':
-                                
+
                 // Make sure we got a parent ID with the data
                 if (isset($modelData['parent']) || (modelData['parent']-0) > 0) {
-                    
+
                     // Try to insert the rate (level) data
                     $res = $this->wpdb->insert(
                         $this->table,
                         $ratesFields,
                         $ratesFieldTypes
                     );
-                    
+
                     if ($res != 1) {
                         trigger_error('Registration Rate Insert failed');
                         return false;
                     }
-                    
+
                     // If there's a new rateID, declare success
                     $rateID = $this->wpdb->insert_id;
                     if ($rateID) {
@@ -132,16 +132,16 @@ class GlmMembersAdmin_registrations_ajax_regRates extends GlmDataRegistrationsRe
                         echo json_encode(0);
                         wp_die();
                     }
-                    
+
                 }
-                
+
                 break;
-                
+
             case 'get':
                 break;
-                
+
             case 'update':
-                
+
                 // We must have a numeric class (level) ID
                 $rateID = ($modelData['id'] - 0);
                 if ($rateID > 0) {
@@ -154,32 +154,32 @@ class GlmMembersAdmin_registrations_ajax_regRates extends GlmDataRegistrationsRe
                         $ratesFieldTypes,
                         array( '%d' )
                     );
-                    
+
                 }
-                
+
                 break;
-                
+
             case 'delete':
-                
+
                 $rateID = ($modelData['id'] - 0);
                 if ($rateID > 0) {
                     $this->wpdb->delete( $this->table, array( 'id' => $rateID ), array( '%d' ) );
                 }
-                
+
                 return;
-                
+
                 break;
-                
+
             default:
                 die();  // should never get here
                 break;
-                
+
         }
-        
+
         wp_die();
-        
-        
-        
+
+
+
     }
 
 
index fa6b802..ee3579d 100644 (file)
@@ -81,33 +81,33 @@ class GlmMembersAdmin_registrations_ajax_regClasses extends GlmDataRegistrations
     public function modelAction($modelData)
     {
 
-trigger_error(print_r($modelData,1));        
-        
+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 69a39d5..742c718 100644 (file)
@@ -170,7 +170,7 @@ class GlmMembersAdmin_management_registrations extends GlmDataRegistrationsManag
                     $errorMsg = "Unable to load the Registrations management settings";
 
                     trigger_error($errorMsg, E_USER_NOTICE);
-                    
+
                     return array(
                         'status' => false,
                         'menuItemRedirect' => 'error',
index 446a76e..ea58c69 100644 (file)
@@ -156,7 +156,7 @@ class GlmMembersAdmin_management_regterms extends GlmDataRegistrationsSettingsTe
                 if ($termsSettings === false) {
 
                     trigger_error("Unable to load Terms Settings: /models/admin/settings/terms.php", E_USER_NOTICE);
-                    
+
                     return array(
                         'status' => false,
                         'menuItemRedirect' => 'error',
index a64774a..67b1e56 100644 (file)
@@ -114,7 +114,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
         $regEventJSON              = false;
         $regClassesJSON            = false;
         $regTimesJSON              = false;
-        
+
         // Get any provided option
         if (isset($_REQUEST['option'])) {
             $option = $_REQUEST['option'];
@@ -175,16 +175,16 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
                 if (is_array($regEvent['reg_time'])) {
                     $regEvent['reg_time'] = array_values($regEvent['reg_time']);
                 }
-                
+
                 // Separate Event, Classes, and Times and send those as separate JSONs
                 $regClassesJSON = json_encode($regEvent['reg_class']);
                 $regTimesJSON = json_encode($regEvent['reg_time']);
-                
+
                 // Get rid of class and time arrays so we just have the event data
                 unset($regEvent['reg_class']);
                 unset($regEvent['reg_time']);
                 $regEventJSON = json_encode($regEvent);
-                
+
                 $view = 'eventEditLevels';
 
                 break;
@@ -197,7 +197,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
 
                     $eventData = false;
                     $eventID = ($_REQUEST['event']-0);
-                    
+
                     // Verify that event is not already listed
                     $regEvent = $this->getEntry($eventID, 'event');
                     if (!$regEvent) {
@@ -273,9 +273,9 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
                         }
                     }
                 }
-                
+
 // echo "<pre>".print_r($regEvent,1)."</pre>";
-                
+
                 $view = 'eventEdit';
 
                 break;
@@ -436,7 +436,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
                 if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search'] != '')) {
                     $textSearch = trim($_REQUEST['text_search']);
                     $where = "event_name LIKE '%".$textSearch."%'";
-                    
+
                     // Clean up for use in redisplaying search value
                     $textSearch = stripslashes($textSearch);
                 }
@@ -529,7 +529,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
             'thisJsUrl'               => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
             'regEventJSON'            => $regEventJSON,
             'regClassesJSON'          => $regClassesJSON,
-            'regTimesJSON'            => $regTimesJSON            
+            'regTimesJSON'            => $regTimesJSON
         );
 
         // Return status, any suggested view, and any data to controller
index b912ae9..2ca14b0 100644 (file)
@@ -86,12 +86,12 @@ class GlmMembersAdmin_registrations_reports
     {
         $view               = 'reports';
         $reason             = array();
-        
+
         // Compile template data
         $templateData = array(
             'reason'             => $reason
         );
-        
+
         // Return status, any suggested view, and any data to controller
         return array(
             'status'        => true,
index 3eb7b1c..079d96f 100644 (file)
@@ -107,25 +107,25 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
         if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') {
             $option = $_REQUEST['option'];
         }
-        
-        
+
+
         // Get request ID if supplied
         if (isset($_REQUEST['requestID'])) {
-            
+
             // Make sure it's numeric
             $requestID = ($_REQUEST['requestID'] - 0);
-            
+
         } else {
-            
+
             // Try to get saved
             $requestID = get_option('glmMembersDatabaseRegistrationsRequestID');
-            
+
         }
-        
+
         if (!$requestID || $requestID <= 0) {
             $requestID = false;
         }
-        
+
         // Perform selected option
         switch ($option) {
 
@@ -133,20 +133,20 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
             case 'check':
 
                 $cart = $regCartSupport->checkRegistrationRequest($requestID);
-                
+
                 break;
-                
+
             // Display selected registration request dashboard
             case 'requestDashboard':
-                
+
                 $cart = $regCartSupport->getRegistrationCart($requestID);
 
                 if ($cart) {
                     $haveCart = true;
                 }
-                
+
                 $view = 'requestDashboard.html';
-                
+
                 break;
 
             // Display/Edit a registration request
@@ -195,7 +195,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
         if ($requestID > 0) {
             update_option('glmMembersDatabaseRegistrationsRequestID', $requestID);
         }
-        
+
         // Compile template data
         $templateData = array(
             'haveRequests'  => $haveRequests,
index ee63b2c..8e0b304 100644 (file)
         parent::__construct(false, false);
 
     }
-    
+
     public function modelAction($actionData = false)
     {
-   
+
 
         // Get any provided option
         if (isset($_REQUEST['option'])) {
index 6bb5fe7..6c061a6 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Gaslight Media Members Database
- * Admin Registrations Cart 
+ * Admin Registrations Cart
  *
  * PHP version 5.5
  *
@@ -59,13 +59,13 @@ class GlmMembersFront_registrations_cart extends GlmRegCartSupport
      */
     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
          *
@@ -73,17 +73,16 @@ class GlmMembersFront_registrations_cart extends GlmRegCartSupport
          * data class that it should flag a group of fields as 'view_only'.
          */
         parent::__construct(false, false, true);
-        
+
     }
-    
 
     public function modelAction($actionData = false)
     {
-        
+
         $cartId = false;
         $haveCart = false;
         $option = false;
-        
+
         // Get any provided option
         if (isset($_REQUEST['option'])) {
             $option = $_REQUEST['option'];
@@ -101,20 +100,24 @@ class GlmMembersFront_registrations_cart extends GlmRegCartSupport
         }
 
         // Get cart ID if supplied
-        if (isset($_SESSION['glm_reg_cart_id'])) {
-           
-            // Get ID from sessiosn
-            $cartId = $_SESSION['glm_reg_cart_id'];
-            
-        } elseif (isset($_REQUEST['cart'])) {
-            
+        if (isset($_REQUEST['cartId'])) {
+
             // Get ID from REQUEST Make sure it's numeric
-            $cartId = ($_REQUEST['cart'] - 0);
-            
+            $cartId = ($_REQUEST['cartId'] - 0);
+
+            // If bad cart ID, set to false
             if ($cartId <= 0) {
                 $cartId = false;
+            } else {
+                // If good dart ID save that in the session
+                $_SESSION['glm_reg_cart_id'] = $cartId;
             }
-            
+
+        } elseif (isset($_SESSION['glm_reg_cart_id'])) {
+
+            // Get ID from session
+            $cartId = $_SESSION['glm_reg_cart_id'];
+
         }
 
         if ($cartId) {
@@ -123,22 +126,22 @@ class GlmMembersFront_registrations_cart extends GlmRegCartSupport
                 $haveCart = true;
             }
         }
-        
+
         $view = 'cart';
 
         switch ( $option ) {
-            
-            
+
+
             case 'showCart':
             default:
-                
+
                     if ($cartId) {
 
                         // Try to get a Validate cart with updated totals
                         $this->checkRegistrationRequest($cartId);
-                        
+
                     }
-                
+
                 break;
 
         }
@@ -150,7 +153,7 @@ class GlmMembersFront_registrations_cart extends GlmRegCartSupport
             'cart'          => $this->cart
 
         );
-        
+
 //echo "<pre>".print_r($templateData,1)."</pre>";
 
              // Return status, any suggested view, and any data to controller
index cb03584..56cdf74 100644 (file)
@@ -80,7 +80,7 @@ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php
         );
 
     }
-    
-        
-        
+
+
+
  }
index 830d902..2870d58 100644 (file)
@@ -18,7 +18,7 @@ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/regCartSupport.php';
 
 class GlmMembersAdmin_registrations_event extends GlmRegCartSupport
 {
-    
+
     /**
     * WordPress Database Object
     *
@@ -45,22 +45,22 @@ class GlmMembersAdmin_registrations_event extends GlmRegCartSupport
      */
     public function __construct($wpdb, $config, $limitedEdit = false)
     {
-        
+
         // If this class is not being extended along with existing $wpdb and $config
         if (!$this->wpdb) {
-            
+
             // Save WordPress Database object
             $this->wpdb = $wpdb;
-            
+
             // Save plugin configuration object
             $this->config = $config;
-            
+
         }
     }
-    
+
     /**
      * Model Action
-     * 
+     *
      * This model returns an array containing the following...
      *
      * 'status'
@@ -89,45 +89,45 @@ class GlmMembersAdmin_registrations_event extends GlmRegCartSupport
         /*
          * Initial Checks
          */
-        
+
         // Do we have a current login account
-        
+
             // If not, then is guest checkout permitted?
-            
+
                 // Otheriwse back to checkout with a message
-       
+
         // Do we need accounts for all registrants?
-        
+
             // If so, do we have accounts for all registrants
-            
+
                 // If needed, create accounts
-                
+
         // Is the submission valid, do we have all required information
-        
+
             // All submitter data
-            
+
             // All billing data
-            
+
             // All policies accepted
-            
+
         /*
          * Store Submission
          */
-        
+
         /*
          * Process Payment
          */
-        
+
         /*
          * Send out Notifications
          */
-        
+
         /*
          * If all is done correctly, use model redirect to go to Step 4 - Dispaly summary
          */
-        
-        
-        
+
+
+
         // Compile template data
         $templateData = array(
 
@@ -141,7 +141,7 @@ class GlmMembersAdmin_registrations_event extends GlmRegCartSupport
         );
 
     }
-    
-        
-        
+
+
+
  }
index e5f5500..da1f705 100644 (file)
         switch ( $option ) {
 
         default:
-            
+
             // Get a current list of reg events
             $listResult = $this->getSimpleRegEventsList($where.$alphaWhere, 'event_name', true, 'id', $start, $limit, true);
-            
+
             //echo '<pre>$listResult: ' . print_r( $listResult, true ) . '</pre>';
 
             // Get paging results
index f1167a9..006e168 100644 (file)
@@ -1,6 +1,6 @@
 <?php
  require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
+
  class GlmMembersFront_registrations_summary extends GlmDataRegistrationsRegEvent {
     /**
     * WordPress Database Object
      *
      * @return array Array containing status, suggested view, and any data
      */
-    
+
     public function modelAction($actionData = false)
     {
-   
+
         // Get any provided option
         if (isset($_REQUEST['option'])) {
             $option = $_REQUEST['option'];
index 297d7f8..4e33675 100644 (file)
@@ -87,7 +87,7 @@
  */
 
 $glmMembersRegistrationsShortcodes = array(
-    
+
     // Short code for all registrations related pages. "page" parameter sets page to be produced.
     'glm-members-registrations' => array(
         'plugin'     => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
@@ -102,10 +102,10 @@ $glmMembersRegistrationsShortcodes = array(
             'datetime'      => false,
             'time'          => false,
             'account'       => false,
-            
+
         )
     )
-    
+
 );
 
 $glmMembersRegistrationsShortcodesDescription = '
@@ -114,9 +114,9 @@ $glmMembersRegistrationsShortcodesDescription = '
         <th>[glm-members-registrations]</th>
         <td>&nbsp;</td>
         <td width="50%">
-            By default shows a list of current and upcoming events that are set to accept 
+            By default shows a list of current and upcoming events that are set to accept
             registrations. The added "page" parameter can be used to specify the desired
-            registrations page. 
+            registrations page.
         </td>
     </tr>
     <tr>
@@ -145,16 +145,16 @@ $glmMembersRegistrationsShortcodesDescription = '
         <td>&nbsp;</td>
         <th>cart="{ID of a specific cart}"</th>
         <td>
-            The "cart" attribute is used to specify the ID of a particular user cart. 
-            Note that if a user is logged in to a registrations "account", that they may have one 
-            or more completed carts and one or more carts in progress. 
+            The "cart" attribute is used to specify the ID of a particular user cart.
+            Note that if a user is logged in to a registrations "account", that they may have one
+            or more completed carts and one or more carts in progress.
         </td>
     </tr>
     <tr>
         <td>&nbsp;</td>
         <th>event="{event ID or event code}"</th>
         <td>
-            The "event" attribute is used to specify the ID of an event for registration. 
+            The "event" attribute is used to specify the ID of an event for registration.
             This may also be the "event code" for an event that offers registrations.
         </td>
     </tr>
@@ -172,9 +172,9 @@ $glmMembersRegistrationsShortcodesDescription = '
         <th>date="{a text date}"</th>
         <td>
             A date string used to search for matching event instances, primarily for the "Registrations List" page.
-            This can be used to list the times for all events that can take reservations on that date or 
+            This can be used to list the times for all events that can take reservations on that date or
             can be used along with the "event" ID attribute to list all times on that date for the specified
-            event. Additionally both "date" and "time" can be used to together to list all occurances on a 
+            event. Additionally both "date" and "time" can be used to together to list all occurances on a
             specific date and at a specific time.
         </td>
     </tr>
@@ -183,9 +183,9 @@ $glmMembersRegistrationsShortcodesDescription = '
         <th>time="{a text time}"</th>
         <td>
             A time string used to search for matching event instances, primarily for the "Registrations List" page.
-            This can be used to list the dates for all events that can take reservations at that particular time of day or 
+            This can be used to list the dates for all events that can take reservations at that particular time of day or
             can be used along with the "event" ID attribute to list all dates for that time for the specified
-            event. Additionally both "date" and "time" can be used to together to list all occurances on a 
+            event. Additionally both "date" and "time" can be used to together to list all occurances on a
             specific date and at a specific time.
         </td>
     </tr>
@@ -193,13 +193,13 @@ $glmMembersRegistrationsShortcodesDescription = '
         <td>&nbsp;</td>
         <th>account="{ID of a specific user account}"</th>
         <td>
-            This is the ID of a specific registration user account. Registration "accounts" hold information on 
+            This is the ID of a specific registration user account. Registration "accounts" hold information on
             a particular person. That person/account may have been registered for one or more event or may have
             submitted one or more registreation carts.<br>
-            This is primarily used to specify the 
+            This is primarily used to specify the
             currently logged-in account, but it is more likely to be obtained from currently logged-in
             information that is stored along with some type of browser storage or session. Use of an account
-            that is not currently logged in may be permitted in some restricted cases.  
+            that is not currently logged in may be permitted in some restricted cases.
         </td>
     </tr>
 ';
index f9c7be3..0560945 100644 (file)
@@ -14,7 +14,7 @@
         <div style="margin-left: 2em;">
         
         {foreach $event.classes as $class}
-            
+           
              <p>    
              Level: {$class.class_name}<br>
              </p>
@@ -22,7 +22,7 @@
                 <div style="margin-left: 2em;">
         
                 {foreach $class.rates as $rate}
-
+  
                     <p>                
                     Rate: {$rate.rate_name}<br>
                     Base Rate: {$rate.base_rate}<br>
@@ -40,7 +40,7 @@
                         {$aid = $registrant.account}
                         
                         Registrant Name: {$account.$aid.fname} {$account.$aid.lname}<br>
-                        Date & Time: {$registrant.event_datetime.datetime}<br>
+                        Date &amp; Time: {$registrant.event_datetime.datetime}<br>
                         Charges: {$registrant.totalCharges}<br>
                         Discounts: {$registrant.totalDiscounts}<br>
                         Net Charges: {$registrant.rateTotal}<br>