Getting ready to do checkout processing.
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 22 Aug 2017 19:04:32 +0000 (15:04 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 22 Aug 2017 19:04:32 +0000 (15:04 -0400)
classes/regCartSupport.php [new file with mode: 0644]
classes/registrationsSupport.php [deleted file]
models/admin/registrations/requests.php
models/front/registrations/checkout.php
models/front/registrations/checkoutProcess.php [new file with mode: 0644]

diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php
new file mode 100644 (file)
index 0000000..1af9f95
--- /dev/null
@@ -0,0 +1,702 @@
+<?php
+
+/**
+ * Gaslight Media Associate
+ * Registrations Plugin support class
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  registratiosnSupport.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load required data classes for registration events
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegTime.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegClass.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRate.php';
+
+// Load required data classes for registration requests
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataAccount.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestEvent.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestClass.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRate.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php';
+
+class GlmRegCartSupport
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Registration Request Cart
+     *
+     * $var $cart
+     * @access public
+     */
+    public $cart = false;
+
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     * @param array $config Configuration array
+     * @param bool $limitedEdit Flag to say indicate limited edit requested
+     *
+     * @return void
+     * @access public
+     */
+    public function __construct($wpdb, $config)
+    {
+
+        // 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;
+
+        }
+
+    }
+
+    /*
+     * Retrieve a complete cart
+     *
+     * Structure of returned data
+     *
+     * array (
+     *      status
+     *      errorMsg
+     *      notes
+     *      accounts        Array of accounts associated with this cart, both for the person submitting and those being registered - Index is account ID
+     *      request         Array of base request data - If no submission account yet, that value is false
+     *      events          Array of events requested
+     *          classes         Array of registration classes being requested
+     *              rates           Array of rates selected for this event class
+     *                 registrants      Array of registrants selected for this rate - Also points to account for registrants in "accounts" array above
+     *
+     * )
+     *
+     * @param integer $requestId
+     *
+     * @return array Array of request and all associated information or false
+     * @access public
+     */
+    public function getRegistrationCart($requestId = false)
+    {
+
+        $RegEvent = new GlmDataRegistrationsRegEvent($this->wpdb, $this->config);
+        $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config);
+        $RegRequest = new GlmDataRegistrationsRequest($this->wpdb, $this->config);
+        $RequestEvent = new GlmDataRegistrationsRequestEvent($this->wpdb, $this->config);
+        $RequestClass = new GlmDataRegistrationsRequestClass($this->wpdb, $this->config);
+        $RequestRate = new GlmDataRegistrationsRegRequestRate($this->wpdb, $this->config);
+        $RequestRegistrant = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config);
+
+        // Clear cart data
+        $this->cart = array(
+            'status'        => false,           // Return status, default to false, true if valid request returned
+            'errorMsg'      => '',              // Any applicable error message
+            'notes'         => array(),         // System generated notes regarding status of request
+            'accounts'      => array(),         // Accounts associated with this request - both requesting and attending (might be the same)
+                                                // Index in this array is the account ID as used in data below
+            'times'         => array(),         // reg_time records associated with this request - Index is the reg_time ID
+            'request'       => false,           // Base request record
+            'events'        => array()          // List of events requested
+        );
+
+        // Validate request ID
+        if (!$requestId || ($requestId-0) <= 0) {
+            return false;
+        }
+
+        // Try to get the base registration request data
+        $this->cart['request'] = $RegRequest->getEntry($requestId);
+        if (!$this->cart['request']) {
+            $this->cart['errorMsg'] = 'Unable to retrieve the requested registration request.';
+            return $this->cart;
+        }
+
+        // Add submitting account if not guest submission (at this point)
+        $this->addAccountToCart($this->cart['request']['account']);
+
+        // 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) {
+
+                // Get reg_event record for this event
+                $this->cart['events'][$eventKey]['reg_event'] = $RegEvent->getEntry($event['reg_event']);
+
+                // Get list of event classes requested for this event
+                $this->cart['events'][$eventKey]['classes'] = $RequestClass->getList("T.reg_request =  $requestId");
+
+                // For each class selected for this event
+                if ($this->cart['events'][$eventKey]['classes']) {
+                    foreach ($this->cart['events'][$eventKey]['classes'] as $classKey => $class) {
+
+                        // Get list of rates requested for this class
+                        $this->cart['events'][$eventKey]['classes'][$classKey]['rates'] = $RequestRate->getList("T.reg_request =  $requestId");
+
+                        // For each rate selected for this class
+                        if ($this->cart['events'][$eventKey]['classes'][$classKey]['rates']) {
+                            foreach ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'] as $rateKey => $rate) {
+
+                                // Get list of registrants requested for this rate
+                                $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'] = $RequestRegistrant->getList("T.reg_request =  $requestId");
+
+                                // For each rate selected for this class
+                                if ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants']) {
+                                    foreach ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'] as $registrantKey => $registrant) {
+
+                                        // Add registrant account to accounts table
+                                        $this->addAccountToCart($registrant['account']);
+
+                                        // Add time data to reg_times table
+                                        $this->addTimeToCart($registrant['reg_time']);
+
+                                    } // Each Registrant
+                                }
+
+                            } // Each Rate
+                        }
+
+
+                    } // Each Class
+                }
+
+            } // Each Event
+        }
+
+        $this->cart['status'] = true;
+
+        return $this->cart;
+
+    }
+
+    /*
+     * Checks validity of a request (cart) and sets new update time (for holds)
+     *
+     * This function loads the entire cart using the supplied request ID then checks it for any issues.
+     *
+     *  Checks links to referenced events and event times records in the Event Add-on tables and notes if either are missing.
+     *  Checks all referenced Accounts for non-guest carts and notes if any are missing.
+     *  Checks all internal references between records in the cart and notes any issues.
+     *  Checks all registrants and notes any problems.
+     *      If this is a cart that has not been successfully completed
+     *          Checks if registrant has a currently valid hold on an attendee slot
+     *              If no currently valid hold, attempts to hold an attendee slot and flags if not available
+     *  Updates all totals
+     *  Updates request last accessed time
+     *
+     * @param integer $requestId    If false then check the currently loaded cart
+     *
+     * @return array Array of request and all associated information or false
+     * @access public
+     */
+    public function checkRegistrationRequest($requestId = false)
+    {
+
+        $messages[] = '';
+
+        // If request ID is not false, get the cart first
+        if ($requestId !== false) {
+
+            // If we didn't get a cart using this ID or there was some failure getting it, then return false
+            if (!$this->getRegistrationCart($requestId) || !$this->cart['status']) {
+               return false;
+            }
+        }
+
+        // If a submission account is specified (otherwise it should be a guest user prior to checkout)
+        if ($this->cart['request']['account'] && !isset($this->cart['accounts'][$this->cart['request']['account']])) {
+            $messages[] .= 'Account for person submitting the request is missing.';
+        }
+
+        // Check if there's no events listed
+        if (is_array($this->cart['events']) && count($this->cart['events']) > 0) {
+            $messages[] .= 'Cart is empty.';
+        } else {
+
+            // Loop through all events in the cart
+            foreach ($this->cart['events'] as $event) {
+
+                // Check if Event exists in Events add-on
+
+            }
+
+        } // have events
+
+        // Check if Event Time exists in Events add-on
+
+    }
+
+    /*
+     * Recalculates and updates all totals for a reg_)time entry
+     *
+     * @param integer $requestId
+     *
+     * @return array Array of request and all associated information or false
+     * @access public
+     */
+    public function updateRegistrationTime($regTimeId = false)
+    {
+
+        // Validate request ID
+        if (!$regTimeId || ($regTimeId-0) <= 0) {
+            return false;
+        }
+
+        // **** NEED TO COMPLETE THIS FUNCTION ****
+
+    }
+
+    /*
+     * Add an account to the accounts list in the temoporary cart array if not already there
+     *
+     *
+     * @param integer $accountId
+     *
+     * @return boolean Success or fail
+     * @access public
+     */
+    public function addAccountToCart($accountId)
+    {
+
+        // Check the supplied account ID
+        $accountId = ($accountId-0);
+        if ($accountId == 0) {
+            return false;
+        }
+
+        // Try to get the account record for the person who submitted (is submitting) the request
+        $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
+        $account = $Account->getEntry($accountId);
+
+        // If account was not found
+        if (!$account) {
+            return false;
+        }
+
+        // If the account doesn't exist in the accounts array, add it
+        if (!isset($this->cart['accounts'][$accountId])) {
+            $this->cart['accounts'][$account['id']] = $account;
+        }
+
+        return true;
+
+    }
+
+    /*
+     * Add a reg_time record to the times list in the temoporary cart array if not already there
+     *
+     *
+     * @param integer $timeId
+     *
+     * @return boolean Success or fail
+     * @access public
+     */
+    public function addTimeToCart($timeId)
+    {
+
+        // Check the supplied reg_time ID
+        $timeId = ($timeId-0);
+        if ($timeId == 0) {
+            return false;
+        }
+
+        // Try to get the account record for the person who submitted (is submitting) the request
+        $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config);
+        $time = $RegTime->getEntry($timeId);
+
+        // If time was not found
+        if (!$time) {
+            return false;
+        }
+
+        // If the time doesn't exist in the times array, add it
+        if (!isset($this->cart['times'][$timeId])) {
+            $this->cart['times'][$time['id']] = $time;
+        }
+
+        return true;
+
+    }
+
+    /*
+     *  Add temporary test data
+     *
+     *  This builds a completed registration request and adds it to the appropriate
+     *  database tables.
+     *
+     *  This function builds the following data
+     *
+     *  1 reg_event
+     *      1 reg_class
+     *          1 reg_rates
+     *
+     *  1 account - Account also used as registrant
+     *
+     *  1 reg_request
+     *      1 reg_request_event
+     *          1 reg_request_class
+     *              1 reg_request_rate
+     *                  1 reg_request_registrant
+     *
+     */
+    public function addTestData()
+    {
+
+        // Grab the first event from the events database
+        $sql = "SELECT id, name FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX."events LIMIT 1";
+        $event = $this->wpdb->get_results($sql, ARRAY_A);
+        $eventId = $event[0]['id'];
+        $eventName = $event[0]['name'];
+
+        // Grab the first time from this event
+        $sql = "SELECT id, start_time FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX."times WHERE event = $eventId LIMIT 1";
+        $time = $this->wpdb->get_results($sql, ARRAY_A);
+        $timeId = $event[0]['id'];
+        $eventTime = $time[0]['start_time'];
+
+        // Event
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event
+                (
+                event,
+                event_name,
+                event_code,
+                active
+                )
+                VALUES
+                (
+                $eventId,
+                '$eventName',
+                'TEST-EVENT',
+                true
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $regEventID = $this->wpdb->insert_id;
+
+        // Event Registration Class
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_class
+                (
+                reg_event,
+                name,
+                descr
+                )
+                VALUES
+                (
+                $regEventID,
+                'Admiral Class',
+                'This is our Admiral Class registration level.'
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $regClassID = $this->wpdb->insert_id;
+
+        // Event Registration Rate
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_rate
+                (
+                reg_event,
+                reg_class,
+                name,
+                start_days,
+                end_days,
+                base_rate,
+                per_registrant,
+                registrant_credits
+                )
+                VALUES
+                (
+                $regEventID,
+                $regClassID,
+                'Rate Name',
+                100,
+                50,
+                20,
+                10,
+                1
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $regRateID = $this->wpdb->insert_id;
+
+
+        // Account
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."account
+                (
+                active,
+                fname
+                )
+                VALUES
+                (
+                true,
+                'Chuck'
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $accountID = $this->wpdb->insert_id;
+
+
+        // Registration Request
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request
+                (
+                account,
+                bill_fname,
+                bill_lname,
+                bill_org,
+                bill_title,
+                bill_addr1,
+                bill_addr2,
+                bill_city,
+                bill_state,
+                bill_zip,
+                bill_country,
+                date_submitted,
+                pay_method,
+                payment_code,
+                status,
+                total,
+                cc_type,
+                cc_name,
+                cc_numb,
+                cc_exp,
+                cc_cvv,
+                cc_conf,
+                summary,
+                mf_data,
+                notes
+                )
+                VALUES
+                (
+                ".$accountID.",
+                'Chuck',
+                'Scott',
+                'Gaslight Media',
+                'Vice President',
+                '120 E. Lake St.',
+                '3rd Floor',
+                'Petoskey',
+                'MI',
+                '49770',
+                'US',
+                '".date('Y-m-d')."',
+                ".$this->config['payment_method_numb']['Not Yet Defined'].",
+                'NULL',
+                ".$this->config['submission_status_numb']['CART'].",
+                100,
+                'NULL',
+                'NULL',
+                'NULL',
+                'NULL',
+                'NULL',
+                'NULL',
+                '<P>HTML SUMMARY</P>',
+                'NULL',
+                'Notes go here'
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $requestID = $this->wpdb->insert_id;
+
+        // Registration Request Event
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_event
+                (
+                account,
+                reg_request,
+                event,
+                event_name,
+                event_time,
+                event_datetime,
+                total_charge,
+                mf_data,
+                notes
+                )
+                VALUES
+                (
+                $accountID,
+                $requestID,
+                $regEventID,
+                '$eventName',
+                $timeId,
+                '$eventTime',
+                100,
+                '',
+                ''
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $requestEventID = $this->wpdb->insert_id;
+
+        // Registration Request class
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_class
+                (
+                account,
+                event,
+                event_name,
+                event_time,
+                event_datetime,
+                reg_request,
+                reg_request_event,
+                class,
+                class_name,
+                total_class_charge,
+                mf_data,
+                notes
+                )
+                VALUES
+                (
+                $accountID,
+                $regEventID,
+                '$eventName',
+                $timeId,
+                '$eventTime',
+                $requestID,
+                $requestEventID,
+                0,
+                'Class Name',
+                100,
+                '',
+                ''
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $requestClassID = $this->wpdb->insert_id;
+
+
+        // Registration Request Rate
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_rate
+                (
+                account,
+                event,
+                event_name,
+                event_time,
+                event_datetime,
+                reg_request,
+                reg_request_event,
+                reg_request_class,
+                rate,
+                rate_name,
+                base_rate,
+                per_registrant,
+                registrant_credits,
+                numb_registrants,
+                total_registrant_charges,
+                mf_data,
+                notes
+                )
+                VALUES
+                (
+                $accountID,
+                $regEventID,
+                '$eventName',
+                $timeId,
+                '$eventTime',
+                $requestID,
+                $requestEventID,
+                $requestClassID,
+                0,
+                'Rate Name',
+                100,
+                10,
+                1,
+                1,
+                100,
+                '',
+                ''
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $requestRateID = $this->wpdb->insert_id;
+
+
+        // Registration Request Registrant
+        $sql = "
+            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant
+                (
+                account,
+                event,
+                event_name,
+                event_time,
+                event_datetime,
+                reg_request,
+                reg_request_event,
+                reg_request_class,
+                reg_request_rate,
+                reg_request_registrant,
+                fname,
+                lname,
+                mf_data,
+                notes
+                )
+                VALUES
+                (
+                $accountID,
+                $regEventID,
+                '$eventName',
+                $timeId,
+                '$eventTime',
+                $requestID,
+                $requestEventID,
+                $requestClassID,
+                $requestRateID,
+                $accountID,
+                'First',
+                'Last',
+                '',
+                ''
+                )
+        ;";
+        $this->wpdb->query($sql);
+        $requestRegistrantID = $this->wpdb->insert_id;
+
+        return;
+
+    }
+
+    public function removeRegistrationRequestData()
+    {
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_class;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_rate;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."account;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_event;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_class;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_rate;");
+        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant;");
+
+    }
+
+}
diff --git a/classes/registrationsSupport.php b/classes/registrationsSupport.php
deleted file mode 100644 (file)
index c78aff4..0000000
+++ /dev/null
@@ -1,702 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Associate
- * Registrations Plugin support class
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  registratiosnSupport.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load required data classes for registration events
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegTime.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegClass.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRate.php';
-
-// Load required data classes for registration requests
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataAccount.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestEvent.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestClass.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRate.php';
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php';
-
-class GlmRegistrationsSupport
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Registration Request Cart
-     *
-     * $var $cart
-     * @access public
-     */
-    public $cart = false;
-
-    /**
-     * Constructor
-     *
-     * @param object $d database connection
-     * @param array $config Configuration array
-     * @param bool $limitedEdit Flag to say indicate limited edit requested
-     *
-     * @return void
-     * @access public
-     */
-    public function __construct($wpdb, $config)
-    {
-
-        // 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;
-
-        }
-
-    }
-
-    /*
-     * Retrieve a complete cart
-     *
-     * Structure of returned data
-     *
-     * array (
-     *      status
-     *      errorMsg
-     *      notes
-     *      accounts        Array of accounts associated with this cart, both for the person submitting and those being registered - Index is account ID
-     *      request         Array of base request data - If no submission account yet, that value is false
-     *      events          Array of events requested
-     *          classes         Array of registration classes being requested
-     *              rates           Array of rates selected for this event class
-     *                 registrants      Array of registrants selected for this rate - Also points to account for registrants in "accounts" array above
-     *
-     * )
-     *
-     * @param integer $requestId
-     *
-     * @return array Array of request and all associated information or false
-     * @access public
-     */
-    public function getRegistrationCart($requestId = false)
-    {
-
-        $RegEvent = new GlmDataRegistrationsRegEvent($this->wpdb, $this->config);
-        $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config);
-        $RegRequest = new GlmDataRegistrationsRequest($this->wpdb, $this->config);
-        $RequestEvent = new GlmDataRegistrationsRequestEvent($this->wpdb, $this->config);
-        $RequestClass = new GlmDataRegistrationsRequestClass($this->wpdb, $this->config);
-        $RequestRate = new GlmDataRegistrationsRegRequestRate($this->wpdb, $this->config);
-        $RequestRegistrant = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config);
-
-        // Clear cart data
-        $this->cart = array(
-            'status'        => false,           // Return status, default to false, true if valid request returned
-            'errorMsg'      => '',              // Any applicable error message
-            'notes'         => array(),         // System generated notes regarding status of request
-            'accounts'      => array(),         // Accounts associated with this request - both requesting and attending (might be the same)
-                                                // Index in this array is the account ID as used in data below
-            'times'         => array(),         // reg_time records associated with this request - Index is the reg_time ID
-            'request'       => false,           // Base request record
-            'events'        => array()          // List of events requested
-        );
-
-        // Validate request ID
-        if (!$requestId || ($requestId-0) <= 0) {
-            return false;
-        }
-
-        // Try to get the base registration request data
-        $this->cart['request'] = $RegRequest->getEntry($requestId);
-        if (!$this->cart['request']) {
-            $this->cart['errorMsg'] = 'Unable to retrieve the requested registration request.';
-            return $this->cart;
-        }
-
-        // Add submitting account if not guest submission (at this point)
-        $this->addAccountToCart($this->cart['request']['account']);
-
-        // 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) {
-
-                // Get reg_event record for this event
-                $this->cart['events'][$eventKey]['reg_event'] = $RegEvent->getEntry($event['reg_event']);
-
-                // Get list of event classes requested for this event
-                $this->cart['events'][$eventKey]['classes'] = $RequestClass->getList("T.reg_request =  $requestId");
-
-                // For each class selected for this event
-                if ($this->cart['events'][$eventKey]['classes']) {
-                    foreach ($this->cart['events'][$eventKey]['classes'] as $classKey => $class) {
-
-                        // Get list of rates requested for this class
-                        $this->cart['events'][$eventKey]['classes'][$classKey]['rates'] = $RequestRate->getList("T.reg_request =  $requestId");
-
-                        // For each rate selected for this class
-                        if ($this->cart['events'][$eventKey]['classes'][$classKey]['rates']) {
-                            foreach ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'] as $rateKey => $rate) {
-
-                                // Get list of registrants requested for this rate
-                                $this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'] = $RequestRegistrant->getList("T.reg_request =  $requestId");
-
-                                // For each rate selected for this class
-                                if ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants']) {
-                                    foreach ($this->cart['events'][$eventKey]['classes'][$classKey]['rates'][$rateKey]['registrants'] as $registrantKey => $registrant) {
-
-                                        // Add registrant account to accounts table
-                                        $this->addAccountToCart($registrant['account']);
-
-                                        // Add time data to reg_times table
-                                        $this->addTimeToCart($registrant['reg_time']);
-
-                                    } // Each Registrant
-                                }
-
-                            } // Each Rate
-                        }
-
-
-                    } // Each Class
-                }
-
-            } // Each Event
-        }
-
-        $this->cart['status'] = true;
-
-        return $this->cart;
-
-    }
-
-    /*
-     * Checks validity of a request (cart) and sets new update time (for holds)
-     *
-     * This function loads the entire cart using the supplied request ID then checks it for any issues.
-     *
-     *  Checks links to referenced events and event times records in the Event Add-on tables and notes if either are missing.
-     *  Checks all referenced Accounts for non-guest carts and notes if any are missing.
-     *  Checks all internal references between records in the cart and notes any issues.
-     *  Checks all registrants and notes any problems.
-     *      If this is a cart that has not been successfully completed
-     *          Checks if registrant has a currently valid hold on an attendee slot
-     *              If no currently valid hold, attempts to hold an attendee slot and flags if not available
-     *  Updates all totals
-     *  Updates request last accessed time
-     *
-     * @param integer $requestId    If false then check the currently loaded cart
-     *
-     * @return array Array of request and all associated information or false
-     * @access public
-     */
-    public function checkRegistrationRequest($requestId = false)
-    {
-
-        $messages[] = '';
-
-        // If request ID is not false, get the cart first
-        if ($requestId !== false) {
-
-            // If we didn't get a cart using this ID or there was some failure getting it, then return false
-            if (!$this->getRegistrationCart($requestId) || !$this->cart['status']) {
-               return false;
-            }
-        }
-
-        // If a submission account is specified (otherwise it should be a guest user prior to checkout)
-        if ($this->cart['request']['account'] && !isset($this->cart['accounts'][$this->cart['request']['account']])) {
-            $messages[] .= 'Account for person submitting the request is missing.';
-        }
-
-        // Check if there's no events listed
-        if (is_array($this->cart['events']) && count($this->cart['events']) > 0) {
-            $messages[] .= 'Cart is empty.';
-        } else {
-
-            // Loop through all events in the cart
-            foreach ($this->cart['events'] as $event) {
-
-                // Check if Event exists in Events add-on
-
-            }
-
-        } // have events
-
-        // Check if Event Time exists in Events add-on
-
-    }
-
-    /*
-     * Recalculates and updates all totals for a reg_)time entry
-     *
-     * @param integer $requestId
-     *
-     * @return array Array of request and all associated information or false
-     * @access public
-     */
-    public function updateRegistrationTime($regTimeId = false)
-    {
-
-        // Validate request ID
-        if (!$regTimeId || ($regTimeId-0) <= 0) {
-            return false;
-        }
-
-        // **** NEED TO COMPLETE THIS FUNCTION ****
-
-    }
-
-    /*
-     * Add an account to the accounts list in the temoporary cart array if not already there
-     *
-     *
-     * @param integer $accountId
-     *
-     * @return boolean Success or fail
-     * @access public
-     */
-    public function addAccountToCart($accountId)
-    {
-
-        // Check the supplied account ID
-        $accountId = ($accountId-0);
-        if ($accountId == 0) {
-            return false;
-        }
-
-        // Try to get the account record for the person who submitted (is submitting) the request
-        $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
-        $account = $Account->getEntry($accountId);
-
-        // If account was not found
-        if (!$account) {
-            return false;
-        }
-
-        // If the account doesn't exist in the accounts array, add it
-        if (!isset($this->cart['accounts'][$accountId])) {
-            $this->cart['accounts'][$account['id']] = $account;
-        }
-
-        return true;
-
-    }
-
-    /*
-     * Add a reg_time record to the times list in the temoporary cart array if not already there
-     *
-     *
-     * @param integer $timeId
-     *
-     * @return boolean Success or fail
-     * @access public
-     */
-    public function addTimeToCart($timeId)
-    {
-
-        // Check the supplied reg_time ID
-        $timeId = ($timeId-0);
-        if ($timeId == 0) {
-            return false;
-        }
-
-        // Try to get the account record for the person who submitted (is submitting) the request
-        $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config);
-        $time = $RegTime->getEntry($timeId);
-
-        // If time was not found
-        if (!$time) {
-            return false;
-        }
-
-        // If the time doesn't exist in the times array, add it
-        if (!isset($this->cart['times'][$timeId])) {
-            $this->cart['times'][$time['id']] = $time;
-        }
-
-        return true;
-
-    }
-
-    /*
-     *  Add temporary test data
-     *
-     *  This builds a completed registration request and adds it to the appropriate
-     *  database tables.
-     *
-     *  This function builds the following data
-     *
-     *  1 reg_event
-     *      1 reg_class
-     *          1 reg_rates
-     *
-     *  1 account - Account also used as registrant
-     *
-     *  1 reg_request
-     *      1 reg_request_event
-     *          1 reg_request_class
-     *              1 reg_request_rate
-     *                  1 reg_request_registrant
-     *
-     */
-    public function addTestData()
-    {
-
-        // Grab the first event from the events database
-        $sql = "SELECT id, name FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX."events LIMIT 1";
-        $event = $this->wpdb->get_results($sql, ARRAY_A);
-        $eventId = $event[0]['id'];
-        $eventName = $event[0]['name'];
-
-        // Grab the first time from this event
-        $sql = "SELECT id, start_time FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX."times WHERE event = $eventId LIMIT 1";
-        $time = $this->wpdb->get_results($sql, ARRAY_A);
-        $timeId = $event[0]['id'];
-        $eventTime = $time[0]['start_time'];
-
-        // Event
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event
-                (
-                event,
-                event_name,
-                event_code,
-                active
-                )
-                VALUES
-                (
-                $eventId,
-                '$eventName',
-                'TEST-EVENT',
-                true
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $regEventID = $this->wpdb->insert_id;
-
-        // Event Registration Class
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_class
-                (
-                reg_event,
-                name,
-                descr
-                )
-                VALUES
-                (
-                $regEventID,
-                'Admiral Class',
-                'This is our Admiral Class registration level.'
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $regClassID = $this->wpdb->insert_id;
-
-        // Event Registration Rate
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_rate
-                (
-                reg_event,
-                reg_class,
-                name,
-                start_days,
-                end_days,
-                base_rate,
-                per_registrant,
-                registrant_credits
-                )
-                VALUES
-                (
-                $regEventID,
-                $regClassID,
-                'Rate Name',
-                100,
-                50,
-                20,
-                10,
-                1
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $regRateID = $this->wpdb->insert_id;
-
-
-        // Account
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."account
-                (
-                active,
-                fname
-                )
-                VALUES
-                (
-                true,
-                'Chuck'
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $accountID = $this->wpdb->insert_id;
-
-
-        // Registration Request
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request
-                (
-                account,
-                bill_fname,
-                bill_lname,
-                bill_org,
-                bill_title,
-                bill_addr1,
-                bill_addr2,
-                bill_city,
-                bill_state,
-                bill_zip,
-                bill_country,
-                date_submitted,
-                pay_method,
-                payment_code,
-                status,
-                total,
-                cc_type,
-                cc_name,
-                cc_numb,
-                cc_exp,
-                cc_cvv,
-                cc_conf,
-                summary,
-                mf_data,
-                notes
-                )
-                VALUES
-                (
-                ".$accountID.",
-                'Chuck',
-                'Scott',
-                'Gaslight Media',
-                'Vice President',
-                '120 E. Lake St.',
-                '3rd Floor',
-                'Petoskey',
-                'MI',
-                '49770',
-                'US',
-                '".date('Y-m-d')."',
-                ".$this->config['payment_method_numb']['Not Yet Defined'].",
-                'NULL',
-                ".$this->config['submission_status_numb']['CART'].",
-                100,
-                'NULL',
-                'NULL',
-                'NULL',
-                'NULL',
-                'NULL',
-                'NULL',
-                '<P>HTML SUMMARY</P>',
-                'NULL',
-                'Notes go here'
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $requestID = $this->wpdb->insert_id;
-
-        // Registration Request Event
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_event
-                (
-                account,
-                reg_request,
-                event,
-                event_name,
-                event_time,
-                event_datetime,
-                total_charge,
-                mf_data,
-                notes
-                )
-                VALUES
-                (
-                $accountID,
-                $requestID,
-                $regEventID,
-                '$eventName',
-                $timeId,
-                '$eventTime',
-                100,
-                '',
-                ''
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $requestEventID = $this->wpdb->insert_id;
-
-        // Registration Request class
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_class
-                (
-                account,
-                event,
-                event_name,
-                event_time,
-                event_datetime,
-                reg_request,
-                reg_request_event,
-                class,
-                class_name,
-                total_class_charge,
-                mf_data,
-                notes
-                )
-                VALUES
-                (
-                $accountID,
-                $regEventID,
-                '$eventName',
-                $timeId,
-                '$eventTime',
-                $requestID,
-                $requestEventID,
-                0,
-                'Class Name',
-                100,
-                '',
-                ''
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $requestClassID = $this->wpdb->insert_id;
-
-
-        // Registration Request Rate
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_rate
-                (
-                account,
-                event,
-                event_name,
-                event_time,
-                event_datetime,
-                reg_request,
-                reg_request_event,
-                reg_request_class,
-                rate,
-                rate_name,
-                base_rate,
-                per_registrant,
-                registrant_credits,
-                numb_registrants,
-                total_registrant_charges,
-                mf_data,
-                notes
-                )
-                VALUES
-                (
-                $accountID,
-                $regEventID,
-                '$eventName',
-                $timeId,
-                '$eventTime',
-                $requestID,
-                $requestEventID,
-                $requestClassID,
-                0,
-                'Rate Name',
-                100,
-                10,
-                1,
-                1,
-                100,
-                '',
-                ''
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $requestRateID = $this->wpdb->insert_id;
-
-
-        // Registration Request Registrant
-        $sql = "
-            INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant
-                (
-                account,
-                event,
-                event_name,
-                event_time,
-                event_datetime,
-                reg_request,
-                reg_request_event,
-                reg_request_class,
-                reg_request_rate,
-                reg_request_registrant,
-                fname,
-                lname,
-                mf_data,
-                notes
-                )
-                VALUES
-                (
-                $accountID,
-                $regEventID,
-                '$eventName',
-                $timeId,
-                '$eventTime',
-                $requestID,
-                $requestEventID,
-                $requestClassID,
-                $requestRateID,
-                $accountID,
-                'First',
-                'Last',
-                '',
-                ''
-                )
-        ;";
-        $this->wpdb->query($sql);
-        $requestRegistrantID = $this->wpdb->insert_id;
-
-        return;
-
-    }
-
-    public function removeRegistrationRequestData()
-    {
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_class;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_rate;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."account;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_event;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_class;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_rate;");
-        $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant;");
-
-    }
-
-}
index c72671a..305cec7 100644 (file)
@@ -90,17 +90,17 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest
         $errorMsg       = false;
 
         // Load registrations support class
-        require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/registrationsSupport.php';
-        $regSupport = new GlmRegistrationsSupport($this->wpdb, $this->config);
+        require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/regCartSupport.php';
+        $regCartSupport = new GlmRegistrationsSupport($this->wpdb, $this->config);
 
 
         /* Test data */
 
         /* Uncomment to create one complete sample registration request each time this action is called */
-        //  $regSupport->addTestData();
+        //  $regCartSupport->addTestData();
 
         /* Uncomment to remove all registration data - *** WARNING - REMOVES ALL REQUEST DATA - NOT JUST TEST DATA *** */
-        //  $regSupport->removeRegistrationRequestData();
+        //  $regCartSupport->removeRegistrationRequestData();
 
         // Check for option submitted
         if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') {
@@ -118,7 +118,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest
             // Check request and update holds
             case 'check':
 
-                $requestCart = $regSupport->checkRegistrationRequest($requestId);
+                $requestCart = $regCartSupport->checkRegistrationRequest($requestId);
 
             // Display/Edit a registration request
             case 'edit':
@@ -127,7 +127,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest
                 if ($requestId) {
 
                     // Try to get the complete cart for this request
-                    $requestCart = $regSupport->getRegistrationCart($requestId);
+                    $requestCart = $regCartSupport->getRegistrationCart($requestId);
 
                     // If a valid cart was returned
                     if ($requestCart && $requestCart['status']) {
index 2a91f0a..cb03584 100644 (file)
@@ -1,5 +1,5 @@
 <?php
- require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
 
  class GlmMembersFront_registrations_checkout extends GlmDataRegistrationsRegEvent {
     /**
@@ -80,4 +80,7 @@
         );
 
     }
+    
+        
+        
  }
diff --git a/models/front/registrations/checkoutProcess.php b/models/front/registrations/checkoutProcess.php
new file mode 100644 (file)
index 0000000..830d902
--- /dev/null
@@ -0,0 +1,147 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Process Checkout
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  checkoutProcess.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Registrations Front-End Support class
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/regCartSupport.php';
+
+class GlmMembersAdmin_registrations_event extends GlmRegCartSupport
+{
+    
+    /**
+    * WordPress Database Object
+    *
+    * @var $wpdb
+    * @access public
+    */
+    public $wpdb;
+    /**
+    * Plugin Configuration Data
+    *
+    * @var $config
+    * @access public
+    */
+    public $config;
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     * @param array $config Configuration array
+     * @param bool $limitedEdit Flag to say indicate limited edit requested
+     *
+     * @return void
+     * @access public
+     */
+    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'
+     *
+     * 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 modelAction($actionData = false)
+    {
+
+        /*
+         * 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(
+
+        );
+             // Return status, any suggested view, and any data to controller
+        return array(
+            'status'        => true,
+            'modelRedirect' => false,
+            'view'          => 'front/registrations/' . $view . '.html',
+            'data'          => $templateData
+        );
+
+    }
+    
+        
+        
+ }