Removed copies of old admin registrations models that are no longer in use.
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 8 Sep 2017 14:30:35 +0000 (10:30 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 8 Sep 2017 14:30:35 +0000 (10:30 -0400)
Cleaned up a number of invalid parameter references in both models and views for registrations admin.

14 files changed:
css/admin.css
models/admin/registrations/dashboard-SAVE.php [deleted file]
models/admin/registrations/event-SAVE.php [deleted file]
models/admin/registrations/events-SAVE.php [deleted file]
models/admin/registrations/events.php
models/admin/registrations/index-SAVE.php [deleted file]
models/admin/registrations/requests.php
setup/adminHooks.php
views/admin/registrations/accountHeader.html
views/admin/registrations/eventEdit.html
views/admin/registrations/eventEditLevels.html
views/admin/registrations/eventHeader.html
views/admin/registrations/requestDashboard.html
views/admin/registrations/requestHeader.html

index 59ae731..0cb0eab 100644 (file)
@@ -3,4 +3,4 @@
     text-align: center;
     margin-right: 5px;
     display: inline-block;
-}
\ No newline at end of file
+}
diff --git a/models/admin/registrations/dashboard-SAVE.php b/models/admin/registrations/dashboard-SAVE.php
deleted file mode 100644 (file)
index 88678ed..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Registrations Dashboard
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-echo "NOT UPDATED";exit;
-// Load Registrations data abstract
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
-
-class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Registrations Event ID
-     *
-     * @var $eventID
-     * @access public
-     */
-    public $regEventID = false;
-
-    /**
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * Run constructor for the REgistrations data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-        parent::__construct(false, false, true);
-
-    }
-
-    public function modelAction($actionData = false)
-    {  
-       
-        $option                 = 'list';
-        $template               = 'list';
-        $haveEvent              = false;
-        $eventID                = false;
-        $haveRegEvent           = false;
-        $regEventID             = false;
-        $regEventUpdated        = false;
-        $regEventUpdateError    = false;
-        $regEventAdded          = false;
-        $reason                 = false;
-        
-        // Get any provided option
-        if (isset($_REQUEST['option'])) {
-            $option = $_REQUEST['option'];
-        }
-
-        // Check for a supplied regEvent record ID
-        if (isset($_REQUEST['regEventID']) && $_REQUEST['regEventID'] != '') {
-            $regEventID = ($_REQUEST['regEventID'] - 0);
-            if ($regEventID > 0) {
-                $regEvent = $this->getEntry($regEventID);
-                if ($regEvent) {
-                    $haveRegEvent = true;
-                }
-            }
-        }
-        
-        // If we don't have a reg event ID, then check for an event ID and make sure it's a positive integer
-        if (!$haveRegEvent && isset($_REQUEST['event']) && $_REQUEST['event'] != '') {
-            $eventID = ($_REQUEST['event']-0);
-        }
-        
-        // If we don't have a regEvent or likely event ID, force option to a list
-        if (!$haveRegEvent && !$eventID) {
-            $option = 'list';
-        }
-    
-        switch( $option ) {
-            
-            case 'update':
-                
-                // Try to update the reg event
-                $regEvent = $this->updateEntry($regEventID);
-                
-                // If there's some type of failure, flag that for the view file
-                if ($regEvent['status']) {
-                    $regEventUpdated = true;
-                } else {
-                    $regEventUpdateError = true;
-                }
-
-                $template = 'eventEdit';
-                
-                break;
-                
-            
-            case 'add':
-            case 'edit':
-
-                if ($option == 'add') {
-
-                    // Verify that event is not already listed
-                    $regEvent = $this->getEntry($eventID, 'event');
-                    if (!$regEvent) {
-                        
-                        // Get data on this event from events add-on
-                        $eventData = apply_filters('glm-member-db-events-get-event', $eventID);
-          
-                        // Did we get event data?
-                        if ($eventData) {
-                            
-                            // Add event to registrations
-                            $sql = "
-                                INSERT INTO ".$this->table." 
-                                    (
-                                    event,
-                                    event_name,
-                                    event_code,
-                                    notify_email,
-                                    admin_active,
-                                    active,
-                                    attendees,
-                                    attendee_max,
-                                    attendee_max_per_reg,
-                                    reg_hold_minutes,
-                                    cart_hold_days,
-                                    registration_account_options,
-                                    payment_methods,
-                                    restricted_payment_methods,
-                                    terms
-                                    )
-                                  VALUES
-                                    (
-                                    ".$eventData['id'].",
-                                    '".$eventData['name']."',
-                                    '".$eventData['name_slug']."',
-                                    '".$eventData['admin_email']."',
-                                    false,
-                                    false,
-                                    true,
-                                    0,
-                                    0,
-                                    60,
-                                    10,
-                                    0,
-                                    0,
-                                    0,
-                                    ''
-                                    )      
-                            ;";
-                            $this->wpdb->query($sql);
-                            $regEventID = $this->wpdb->insert_id;
-                            
-                            if ($regEventID) {
-                                $regEventUpdated = true;
-                            }
-                        
-                        }
-                        
-                    } else {
-                        $reason = "Trying to add an event that is already listed in Registrations.";
-                    }
-                    
-                }
-
-                // If there's no problem yet, try to get the regEvent data for edit
-                if ($reason == '') {
-                    if ($regEventID) {
-                        $regEvent = $this->editEntry($regEventID);
-                        if ($regEvent) {
-                            $haveRegEvent = true;
-                        }
-                    }
-                }
-                
-                $template = 'eventEdit';
-                break;
-                
-            case 'dashboard':
-
-                if ($regEventID) {
-                    $regEvent = $this->editEntry($regEventID);
-                    if ($regEvent) {
-                        $haveRegEvent = true;
-                    }
-                }
-                
-                if (!$haveRegEvent) {
-                    $reason = 'Unable to load registration event data.';
-                }
-                
-                $template = 'eventDashboard';
-                break;
-                
-            case 'list':
-            default:
-                
-                $regEventList = $this->getList();
-                
-                $template = 'eventList';
-                break;
-           
-        }
-        
-        
-        // Compile template data
-        $templateData = array(
-            'haveEvent'             => $haveEvent,
-            'eventID'               => $eventID,
-            'haveRegEvent'          => $haveRegEvent,
-            'regEventID'            => $regEventID,
-            'regEvent'              => $regEvent,
-            'regEventUpdated'       => $regEventUpdated,
-            'regEventUpdateError'   => $regEventUpdateError,
-            'regEventAdded'         => $regEventAdded ,
-            'reason'                => $reason
-        );
-        
-        // Return status, any suggested view, and any data to controller
-        return array(
-            'status'        => true,
-            'modelRedirect' => false,
-            'view'          => 'admin/registrations/'.$template.'.html',
-            'data'          => $templateData
-        );
-
-    }
-
-
-}
diff --git a/models/admin/registrations/event-SAVE.php b/models/admin/registrations/event-SAVE.php
deleted file mode 100644 (file)
index 32fc106..0000000
+++ /dev/null
@@ -1,385 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Registrations Event Dashboard
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Registrations data abstract
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
-
-class GlmMembersAdmin_registrations_event extends GlmDataRegistrationsRegEvent
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Registrations Event ID
-     *
-     * @var $eventID
-     * @access public
-     */
-    public $regEventID = false;
-
-    /**
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * Run constructor for the REgistrations data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-        parent::__construct(false, false, true);
-
-    }
-
-    public function modelAction($actionData = false)
-    {  
-    
-        $option                 = 'list';
-        $regEvent               = false;
-        $haveEvent              = false;
-        $haveRegEventRecurrences = false;
-        $haveRegEventTimes      = false;
-        $regEventFirstTime      = false;
-        $regEventLastTime       = false;
-        $eventID                = 0;
-        $haveRegEvent           = false;
-        $regEventID             = 0;
-        $regEventUpdated        = false;
-        $regEventUpdateError    = false;
-        $regEventAdded          = false;
-        $reason                 = false;
-        
-        // Get any provided option
-        if (isset($_REQUEST['option'])) {
-            $option = $_REQUEST['option'];
-        }
-                
-        // Check for a supplied regEvent record ID and make sure it's and integer
-        if (isset($_REQUEST['regEventID']) && $_REQUEST['regEventID'] != '') {
-            $regEventID = ($_REQUEST['regEventID'] - 0);
-        }        
-
-        // If no ID was supplied try to get last used reg event ID
-        if ($regEventID <= 0) {
-            $regEventID = get_option('glmMembersDatabaseLastUsedRegEventID');
-        }
-        
-        // If we have a positive Int reg event ID, try to get the reg event data
-        if ($regEventID > 0) {
-            $regEvent = $this->getEntry($regEventID);
-            if ($regEvent) {
-                $haveRegEvent = true;
-            }
-        }
-        
-        // If we don't have a reg event ID, then check for an event ID to create new reg event
-        if (!$haveRegEvent && isset($_REQUEST['event']) && $_REQUEST['event'] != '') {
-            $eventID = ($_REQUEST['event']-0);
-        }
-
-        switch( $option ) {
-            
-            case 'update':
-                
-                // Try to update the reg event
-                $regEvent = $this->updateEntry($regEventID);
-                
-                // If there's some type of failure, flag that for the view file
-                if ($regEvent['status']) {
-                    $regEventUpdated = true;
-                } else {
-                    $regEventUpdateError = true;
-                }
-
-                $template = 'eventEdit.html';
-                
-                break;
-                
-            
-            case 'add':
-            case 'edit':
-   
-                // If we're adding a new reg event
-                if ($option == 'add') {
-
-                    // Verify that event is not already listed
-                    $regEvent = $this->getEntry($eventID, 'event');
-                    if (!$regEvent) {
-                        
-                        // Get data on this event from events add-on
-                        $eventData = apply_filters('glm-member-db-events-get-event', $eventID);
-          
-                        // Did we get event data?
-                        if ($eventData) {
-                            
-                            // Add event to registrations
-                            $sql = "
-                                INSERT INTO ".$this->table." 
-                                    (
-                                    event,
-                                    event_name,
-                                    event_code,
-                                    notify_email,
-                                    admin_active,
-                                    active,
-                                    attendees,
-                                    attendee_max,
-                                    attendee_max_per_reg,
-                                    reg_hold_minutes,
-                                    cart_hold_days,
-                                    registration_account_options,
-                                    payment_methods,
-                                    restricted_payment_methods,
-                                    terms
-                                    )
-                                  VALUES
-                                    (
-                                    ".$eventData['id'].",
-                                    '".$eventData['name']."',
-                                    '".$eventData['name_slug']."',
-                                    '".$eventData['admin_email']."',
-                                    false,
-                                    false,
-                                    true,
-                                    0,
-                                    0,
-                                    60,
-                                    10,
-                                    0,
-                                    0,
-                                    0,
-                                    ''
-                                    )      
-                            ;";
-                            $this->wpdb->query($sql);
-                            $regEventID = $this->wpdb->insert_id;
-                            
-                            if ($regEventID) {
-                                $regEventUpdated = true;
-                            }
-                        
-                        }
-                        
-                    } else {
-                        $reason = "Trying to add an event that is already listed in Registrations.";
-                    }
-                    
-                }
-
-                // If there's no problem yet, try to get the regEvent data for edit
-                if ($reason == '') {
-                    if ($regEventID) {
-                        $regEvent = $this->editEntry($regEventID);
-                        if ($regEvent) {
-                            $haveRegEvent = true;
-                        }
-                    }
-                }
-                
-                $template = 'eventEdit.html';
-                break;
-                
-            case 'dashboard':
-            default:
-
-                // If we have an event ID               
-                if ($regEventID) {
-                    
-                    // Try to get the event configuration including recurrences and times
-                    $this->postProcAddedEventData = true;
-                    $regEvent = $this->getEventConfig($regEventID, true, true, true);
-
-                    // If we have the event data
-                    if ($regEvent) {
-                        
-                        $haveRegEvent = true;
-
-                        // If event is time_specific and we have recurrences for the event
-                        if ($regEvent['time_specific']['value'] && is_array($regEvent['recurrences']) && count($regEvent['recurrences']) > 0) {
-
-                            $haveRegEventRecurrences = true;
-              
-                            // For each recurrence
-                            foreach ($regEvent['recurrences'] as $k=>$v) {
-
-                                $regEvent['recurrences'][$k]['haveTimes'] = false;
-                                
-                                // If we have times for this recuirrence
-                                if ($v['times'] && count($v['times']) > 0) {
-                                    
-                                    $regEvent['recurrences'][$k]['haveTimes'] = false;
-                                    $haveRegEventTimes = true;
-                                    
-                                    // Get the first event date/time
-                                    $first = current($v['times']);                            
-                                    $last = end($v['times']);
-                                    $regEvent['recurrences'][$k]['first_time'] = $first;
-                                    $regEvent['recurrences'][$k]['lastTime'] = $last;
-                                    
-                                    // Set event first and last times
-                                    if (!$regEventFirstTime || $regEventFirstTime['timestamp'] < $first ) {
-                                        $regEventFirstTime = $first;
-                                    }
-                                    if (!$regEventLastTime || $regEventLastTime['timestamp'] > $last ) {
-                                        $regEventLastTime = $last;
-                                    }
-                                         
-                                    // Check all event times for matching reg event times
-                                    foreach ($v['times'] as $tk=>$tv) {
-                                        
-                                        // If time doesn't exist in reg_times
-                                        if (!isset($regEvent['reg_times'][$tk])) {                                           
-                                           
-                                            $sTime = date('Y-m-d H:i:s',strtotime($tv['start_time']['datetime']));
-                                            $eTime = date('Y-m-d H:i:s',strtotime($tv['end_time']['datetime']));
-                                            
-                                            // Add reg event time 
-                                            $this->wpdb->insert(
-                                                GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time",
-                                                array(
-                                                    'reg_event'             => $regEvent['event'],
-                                                    'event_time'            => $tk,
-                                                    'start_datetime'        => $sTime, 
-                                                    'end_datetime'          => $eTime,
-                                                    'all_day'               => $tv['all_day']['value'],
-                                                    'attendees'             => $regEvent['attendees']['value'],
-                                                    'attendee_max'          => $regEvent['attendee_max'],
-                                                    'attendee_count'        => 0,
-                                                    'attendees_pending'     => 0,
-                                                    'attendees_available'   => $regEvent['attendee_max'],
-                                                    'total_base_charge'     => 0,
-                                                    'total_per_attendee'    => 0,
-                                                    'total_other'           => 0,
-                                                    'total_taxes'           => 0,
-                                                    'total_charges'         => 0,
-                                                    'total_discounts'       => 0,
-                                                    'total_payments'        => 0
-                                                ),
-                                                array(
-                                                    '%d',   // reg_event
-                                                    '%d',   // event_time record ID
-                                                    '%s',   // start_datetime
-                                                    '%s',   // end_datetime
-                                                    '%d',   // all_day flag
-                                                    '%d',   // attendees flag
-                                                    '%d',   // attendee_max
-                                                    '%d',   // attendee_count
-                                                    '%d',   // attendees_pending
-                                                    '%d',   // attendees_available
-                                                    '%f',   // total_base__charge
-                                                    '%f',   // total_per_attendee
-                                                    '%f',   // total_other
-                                                    '%f',   // total_taxes
-                                                    '%f',   // total_charges
-                                                    '%f',   // total_discounts
-                                                    '%f'    // total_payments
-                                                )                                                 
-                                            );
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-                                
-                if (!$haveRegEvent) {
-                    $reason = 'Unable to load registration event data or registration event not selected.';
-                }
-
-                $template = 'event.html';
-                break;
-                           
-        } // switch
-
-        // If we have a reg event, then save it as last accessed
-        if ($haveRegEvent) {
-            update_option('glmMembersDatabaseLastUsedRegEventID', $regEventID);
-        }
-              
-        // Compile template data
-        $templateData = array(
-            'option'                => $option,
-            'haveEvent'             => $haveEvent,
-            'eventID'               => $eventID,
-            'haveRegEvent'          => $haveRegEvent,
-            'haveRegEventRecurrences' => $haveRegEventRecurrences,
-            'haveRegEventTimes'     => $haveRegEventTimes,
-            'regEventFirstTime'     => $regEventFirstTime,
-            'regEventLastTime'      => $regEventLastTime,
-            'regEventID'            => $regEventID,
-            'regEvent'              => $regEvent,
-            'regEventUpdated'       => $regEventUpdated,
-            'regEventUpdateError'   => $regEventUpdateError,
-            'regEventAdded'         => $regEventAdded ,
-            'reason'                => $reason
-        );
-
-        // echo "<pre>".print_r($templateData,1)."</pre>";
-        
-        // Return status, any suggested view, and any data to controller
-        return array(
-            'status'        => true,
-            'modelRedirect' => false,
-            'view'          => 'admin/registrations/'.$template,
-            'data'          => $templateData
-        );
-
-    }
-
-
-}
diff --git a/models/admin/registrations/events-SAVE.php b/models/admin/registrations/events-SAVE.php
deleted file mode 100644 (file)
index b1bbe7e..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Registrations Dashboard
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Registrations data abstract
-require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
-
-class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Registrations Event ID
-     *
-     * @var $eventID
-     * @access public
-     */
-    public $regEventID = false;
-
-    /**
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * Run constructor for the REgistrations data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-        parent::__construct(false, false, true);
-
-    }
-
-    public function modelAction($actionData = false)
-    {  
-
-        $option                 = 'list';
-        $template               = 'list.html';
-        $haveEvent              = false;
-        $eventID                = false;
-        $haveRegEvent           = false;
-        $regEventID             = false;
-        $regEventUpdated        = false;
-        $regEventUpdateError    = false;
-        $regEventAdded          = false;
-        $reason                 = false;
-        
-        // Get any provided option
-        if (isset($_REQUEST['option'])) {
-            $option = $_REQUEST['option'];
-        }
-
-        // Check for a supplied regEvent record ID
-        if (isset($_REQUEST['regEventID']) && $_REQUEST['regEventID'] != '') {
-            $regEventID = ($_REQUEST['regEventID'] - 0);
-            if ($regEventID > 0) {
-                $regEvent = $this->getEntry($regEventID);
-                if ($regEvent) {
-                    $haveRegEvent = true;
-                }
-            }
-        }
-        
-        // If we don't have a reg event ID, then check for an event ID and make sure it's a positive integer
-        if (!$haveRegEvent && isset($_REQUEST['event']) && $_REQUEST['event'] != '') {
-            $eventID = ($_REQUEST['event']-0);
-        }
-        
-        // If we don't have a regEvent or likely event ID, force option to a list
-        if (!$haveRegEvent && !$eventID) {
-            $option = 'list';
-        }
-    
-        switch( $option ) {
-            
-            case 'update':
-                
-                // Try to update the reg event
-                $regEvent = $this->updateEntry($regEventID);
-                
-                // If there's some type of failure, flag that for the view file
-                if ($regEvent['status']) {
-                    $regEventUpdated = true;
-                } else {
-                    $regEventUpdateError = true;
-                }
-
-                $template = 'eventEdit.html';
-                
-                break;
-                
-            
-            case 'add':
-            case 'edit':
-
-                if ($option == 'add') {
-
-                    // Verify that event is not already listed
-                    $regEvent = $this->getEntry($eventID, 'event');
-                    if (!$regEvent) {
-                        
-                        // Get data on this event from events add-on
-                        $eventData = apply_filters('glm-member-db-events-get-event', $eventID);
-          
-                        // Did we get event data?
-                        if ($eventData) {
-                            
-                            // Add event to registrations
-                            $sql = "
-                                INSERT INTO ".$this->table." 
-                                    (
-                                    event,
-                                    event_name,
-                                    event_code,
-                                    notify_email,
-                                    admin_active,
-                                    active,
-                                    attendees,
-                                    attendee_max,
-                                    attendee_max_per_reg,
-                                    reg_hold_minutes,
-                                    cart_hold_days,
-                                    registration_account_options,
-                                    payment_methods,
-                                    restricted_payment_methods,
-                                    terms
-                                    )
-                                  VALUES
-                                    (
-                                    ".$eventData['id'].",
-                                    '".$eventData['name']."',
-                                    '".$eventData['name_slug']."',
-                                    '".$eventData['admin_email']."',
-                                    false,
-                                    false,
-                                    true,
-                                    0,
-                                    0,
-                                    60,
-                                    10,
-                                    0,
-                                    0,
-                                    0,
-                                    ''
-                                    )      
-                            ;";
-                            $this->wpdb->query($sql);
-                            $regEventID = $this->wpdb->insert_id;
-                            
-                            if ($regEventID) {
-                                $regEventUpdated = true;
-                            }
-                        
-                        }
-                        
-                    } else {
-                        $reason = "Trying to add an event that is already listed in Registrations.";
-                    }
-                    
-                }
-
-                // If there's no problem yet, try to get the regEvent data for edit
-                if ($reason == '') {
-                    if ($regEventID) {
-                        $regEvent = $this->editEntry($regEventID);
-                        if ($regEvent) {
-                            $haveRegEvent = true;
-                        }
-                    }
-                }
-                
-                $template = 'eventEdit.html';
-                break;
-                
-            default:
-
-                echo "OOOPPPPSSSSS! Should not get here.....";
-                exit;
-                
-                break;
-
-            
-        }
-        
-        echo "---------------------------------------------------";
-        // Compile template data
-        $templateData = array(
-            'haveEvent'             => $haveEvent,
-            'eventID'               => $eventID,
-            'haveRegEvent'          => $haveRegEvent,
-            'regEventID'            => $regEventID,
-            'regEvent'              => $regEvent,
-            'regEventUpdated'       => $regEventUpdated,
-            'regEventUpdateError'   => $regEventUpdateError,
-            'regEventAdded'         => $regEventAdded ,
-            'reason'                => $reason
-        );
-        
-        // Return status, any suggested view, and any data to controller
-        return array(
-            'status'        => true,
-            'modelRedirect' => false,
-            'view'          => 'admin/registrations/'.$template,
-            'data'          => $templateData
-        );
-
-    }
-
-
-}
index 589d7a0..8f8cc2a 100644 (file)
@@ -33,13 +33,6 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
      * @access public
      */
     public $config;
-    /**
-     * Registrations Event ID
-     *
-     * @var $eventID
-     * @access public
-     */
-    public $regEventID = false;
 
     /**
      * Constructor
@@ -106,6 +99,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
         $alphaSelected             = false;
         $haveRegEvents             = false;
         $regEventsCount            = false;
+        $list                      = false;
         $namesList                 = false;
         $regEvent                  = false;
         $regEventID                = false;
@@ -118,6 +112,9 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
         $regEventUpdateError       = false;
         $regEventAdded             = false;
         $reason                    = false;
+        $regEventSample            = false;
+        $regEventJason             = false;
+        $regClassJSON              = false;
         
         // Get any provided option
         if (isset($_REQUEST['option'])) {
@@ -147,6 +144,44 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
         
             case 'configureEvent':
                 
+// This obviously still needs work - not really updated since stolen from front-end code                
+                $scripts = array(
+                'backbone-local' => 'js/lib/backbone.localStorage.min.js',
+                'regApp'         => 'js/regApp.js',
+                );
+                foreach ( $scripts as $scriptName => $scriptPath ) {
+                    wp_register_script(
+                        $scriptName,
+                        GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . $scriptPath,
+                        array( 'jquery', 'backbone', 'underscore' ),
+                        '1.0',
+                        true
+                        );
+                }
+                wp_enqueue_script( array( 'backbone', 'jquery' ) );
+                wp_enqueue_script( array_keys( $scripts ) );
+                $regEvent = array();
+                
+                // including test data for now
+                include GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . '/data/event_setup.php';
+                
+                $regClass = $regEventSample['reg_class'];
+                         
+                // Find the regClass rate to be used
+                // There will only be one as this is based on the date.
+                //$regClassRate
+                
+                $eventData = array();
+                
+                unset($regClass['reg_rate']);
+                
+                // Build the Class array of json objects for the classes.
+                $jsonClasses = array();
+                foreach ( $regClass as $rClass ) {
+                    $jsonClasses[] = json_encode( $rClass );
+                }
+                $regClassJSON = '[' . implode( ',', $jsonClasses ) . ']';
                 $view = 'eventEditLevels';
                 
                 break;
@@ -158,11 +193,11 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
                 if ($option == 'add') {
                     
                     // Verify that event is not already listed
-                    $regEvent = $this->getEntry($eventID, 'event');
+                    $regEvent = $this->getEntry($regEventID, 'event');
                     if (!$regEvent) {
                         
                         // Get data on this event from events add-on
-                        $eventData = apply_filters('glm-member-db-events-get-event', $eventID);
+                        $eventData = apply_filters('glm-member-db-events-get-event', $regEventID);
                         
                         // Did we get event data?
                         if ($eventData) {
@@ -247,7 +282,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
                     $regEventUpdateError = true;
                 }
                 
-                $template = 'eventEdit';
+                $view = 'eventEdit';
                 
                 break;
                 
@@ -472,7 +507,13 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
             'regEventUpdated'         => $regEventUpdated,
             'regEventUpdateError'     => $regEventUpdateError,
             'regEventAdded'           => $regEventAdded,
-            'reason'                  => $reason
+            'reason'                  => $reason,
+            
+            'entry'          => $regEventSample,
+            'thisJsUrl'      => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
+            'regEventJSON'   => json_encode( $regEventSample['reg_event'] ),
+            'regClassJSON' => $regClassJSON,
+            
         );
                 
         // Return status, any suggested view, and any data to controller
diff --git a/models/admin/registrations/index-SAVE.php b/models/admin/registrations/index-SAVE.php
deleted file mode 100644 (file)
index 0e2fa5f..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Registrations Dashboard
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Registrations data abstract
-// require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegistrations.php';
-
-class GlmMembersAdmin_registrations_index // extends GlmDataRegistrations
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Registrations Event ID
-     *
-     * @var $eventID
-     * @access public
-     */
-    public $regEventID = false;
-
-    /**
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * Run constructor for the REgistrations data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-//        parent::__construct(false, false, true);
-
-    }
-
-    public function modelAction($actionData = false)
-    {
-
-        // Compile template data
-        $templateData = array(
-        );
-             // Return status, any suggested view, and any data to controller
-        return array(
-            'status'        => true,
-            'modelRedirect' => false,
-            'view'          => 'admin/registrations/index.html',
-            'data'          => $templateData
-        );
-
-    }
-
-
-}
index 376ecfa..9b510a1 100644 (file)
@@ -159,7 +159,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest
                     $cart = $regCartSupport->getRegistrationCart($requestID);
 
                     // If a valid cart was returned
-                    if ($cart && $requestCart['status']) {
+                    if ($cart && $cart['status']) {
                         $haveRequest = true;
                     } else {
                         $errorMsg = $cart['errorMsg'];
index 78bd8bf..ba8faec 100644 (file)
@@ -63,14 +63,14 @@ add_filter(
             if ($regEvent) {
 
                 // Return link title and URL for this event in registrations
-                return array('title' => 'Registrations', 'url' => GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE."registrations-event&regEventID=".$regEvent['id']);
+                return array('title' => 'Registrations', 'url' => GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE."registrations-events&option=eventDashboard&regEventID=".$regEvent['id']);
 
             }
 
         }
 
         // Since we must not have had a good event ID or didn't find the event in registrations, return title and url to add this event to registrations
-        return array('title' => 'Add Registrations To Event', 'url' => GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE."registrations-event&option=add&event=".$eventId);
+        return array('title' => 'Add Registrations To Event', 'url' => GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE."registrations-events&option=eventDashboard&option=add&event=".$eventId);
 
     },
     10,
index d89063d..45b55e1 100644 (file)
@@ -2,6 +2,6 @@
 <h2>Event Registrations</h2>
 <h2 class="nav-tab-wrapper">
     <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-accounts" class="nav-tab{if $option==dashboard} nav-tab-active{/if}">Dashboard</a>
-    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-accounts&option=accountDashboard" class="nav-tab{if $option==accountDashboard} nav-tab-active{/if}">Selected Account</a>
+    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-accounts&option=accountDashboard" class="nav-tab{if $option==accountDashboard} nav-tab-active{/if}">Last Selected Account</a>
 </h2>
 <div id="glm-admin-content-container">
index a7ae558..2a6d6ab 100644 (file)
@@ -26,7 +26,7 @@
     <p class="glm-required">(Items in red are required)</p>
        
     <form action="{$thisUrl}?page={$thisPage}" method="post" id="regEventForm">
-           <input type="hidden" name="glm_action" value="event">
+           <input type="hidden" name="glm_action" value="events">
            <input type="hidden" name="option" value="update">
            <input type="hidden" name="regEventID" value="{$regEventID}">
 
@@ -190,7 +190,7 @@ NEED TO ADD TESTS FOR CHANGES IN INPUT<br>
             </tr>
         </table>
         
-        <p><input id="updateRegEvent" type="submit" value="Update Registrations for this event"></p>
+        <p><input id="updateRegEvent" type="submit" value="Update This Event"></p>
         
     </form>
 
index c6b8114..a2c93ca 100644 (file)
         <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=edit&regEventID={$regEventID}" class="nav-tab">Edit Registration Settings</a>
         <a onClick="return false;" class="nav-tab nav-tab-active">Registration Levels & Charges</a>
     </h2>       
+    
+    
+    
+    
+    {* Event Registration App - Backbone.js *}
+    {* Underscore Templates for the Event Registration App *}
+    {literal}
+    <script type="text/template" id="regEvent-template">
+    <h2><%= event_name %></h2>
+    <div class="glm-reg-compcode-entry">
+        <input type="text" placeholder="Enter Comp Code Here" />
+    </div>
+    <div>
+        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+        <p>Maximum Registrants: <%- attendee_max %></p>
+    </div>
+
+    <div class="glm-reg-entryforms clearfix">
+        <div class="glm-reg-dates">
+            <h4>Pick your registration dates</h4>
+            <input type="date" placeholder="Enter Date" />
+            <input type="text" placeholder="Enter Time" />
+        </div>
+        <div class="glm-reg-submit">
+            <input type="submit" value="Continue to Cart" />
+        </div>
+    </div>
+    </script>
+    <script type="text/template" id="account-template">
+    <a class="glm-reg-level-registrant-delete">Delete</a>
+    <label class="registrant-label">
+        <span class="glm-reg-level-registrant-email"><%= email %></span>
+    </label>
+    <div class="registrant-edit">
+        <input type="text" class="editEmail" value="<%- email %>">
+        <input type="submit" class="saveRegistrant" value="Save">
+    </div>
+    </script>
+    <script type="text/template" id="regClass-template">
+    <h3><%= name %> Count: <%= reg_count %></h3>
+    <p><%= descr %></p>
+    <div>
+        <div>Current Rate: <%= reg_rate_name %></div>
+        <div>Base Price: $<%= reg_rate_base_price %></div>
+        <div>Per Registrant: $<%= reg_rate_per_reg %></div>
+    </div>
+    <div class="registrant-add clearfix">
+        <input type="text" class="addEmail" placeholder="Enter Email Address">
+        <input type="submit" class="addRegistrant" value="Add">
+    </div>
+    </script>
+    <script type="text/template" id="eventReg-account-login">
+    <h4>Login</h4>
+    <a class="glm-reg-account-login" id="loginCancel">Close</a>
+    <input class="login">
+    <input class="password">
+    <input type="submit" class="accountLogin" value="Login">
+    </script>
+    {/literal}
+    <div class="glm-reg-event-list" id="regApp">
+        <div class="glm-reg-account">
+            <a class="glm-reg-account-login" id="appLogin">Login</a>
+        </div>
+    </div>
+    {* Bootstrap the models needed on page load *}
+    {* Need to have RegEvent model created *}
+    {* And create the RegClasses collection *}
+    <script>
+    var appLoginUrl = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=login';
+    var ajaxUrl = '{$ajaxUrl}?action=glm_members_admin_ajax';
+    var app = {
+        Models: {},
+        Collections: {},
+        Views: {},
+    };
+    jQuery(function($){
+        app.Models.regEvent = new app.Models.RegEvent;
+        app.Models.regEvent.set( {$regEventJSON} );
+        app.Models.regEvent.setClasses( {$regClassJSON} );
+        new app.Views.App();
+    });
+    </script>
+    
+    
+
+
 
 {/if} <!-- no problem reasons -->
 
-    <script type="text/javascript">
-        jQuery(document).ready(function($) {
-           
-            
-        });
-    </script>
     
 {include file='admin/footer.html'}
 
index 064bf70..43e10b5 100644 (file)
@@ -2,6 +2,6 @@
 <h2>Event Registrations</h2>
 <h2 class="nav-tab-wrapper">
     <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events" class="nav-tab{if $option==dashboard} nav-tab-active{/if}">Dashboard</a>
-    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard" class="nav-tab{if $option==eventDashboard} nav-tab-active{/if}">Selected Event</a>
+    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard" class="nav-tab{if $option==eventDashboard} nav-tab-active{/if}">Last Selected Event</a>
 </h2>
 <div id="glm-admin-content-container">
index 686505d..6fd6326 100644 (file)
@@ -43,7 +43,7 @@
                         <div class="glm-small-12 glm-column">
                             {$cart.request.bill_addr1}
                         </div>
-                    {if $cart.request.addr2}
+                    {if $cart.request.bill_addr2}
                         <div class="glm-small-12 glm-column">
                             {$cart.request.bill_addr2}
                         </div>
index 4b33685..271097a 100644 (file)
@@ -2,6 +2,6 @@
 <h2>Event Registrations</h2>
 <h2 class="nav-tab-wrapper">
     <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests" class="nav-tab{if $option==dashboard} nav-tab-active{/if}">Requests Dashboard</a>
-    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard" class="nav-tab{if $option==requestDashboard} nav-tab-active{/if}">Selected Request</a>
+    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard" class="nav-tab{if $option==requestDashboard} nav-tab-active{/if}">Last Selected Request</a>
 </h2>
 <div id="glm-admin-content-container">