From: Chuck Scott Date: Mon, 14 Aug 2017 15:49:42 +0000 (-0400) Subject: Interim update during development of Event/Regstrations linking code. X-Git-Tag: v1.0.0^2~468 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=fd2ce046e386c4f0d923d534f3522af237894faf;p=WP-Plugins%2Fglm-member-db-registrations.git Interim update during development of Event/Regstrations linking code. Reorcanization of front-end models. --- diff --git a/activate.php b/activate.php index bb07afd..11dbb5c 100644 --- a/activate.php +++ b/activate.php @@ -16,7 +16,8 @@ // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } /* diff --git a/config/plugin.ini b/config/plugin.ini index a2c58b8..f8cc7f3 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -23,14 +23,13 @@ registration_account_option[1] = 'Guest Registration' registration_account_option[2] = 'Saved Registration Accounts' registration_account_option[3] = 'Member Contact Registrations' -registration_account_option['Guest'] = 1 -registration_account_option['Saved'] = 2 -registration_account_option['Member'] = 3 +registration_account_option_numb['Guest'] = 1 +registration_account_option_numb['Saved'] = 2 +registration_account_option_numb['Member'] = 3 ; ; Payment Method - Use as Bitmap Index or List ; -payment_method[0] = 'Not Yet Defined' payment_method[1] = 'No Charge' payment_method[2] = 'Comp Code' payment_method[3] = 'Cash' @@ -38,7 +37,6 @@ payment_method[4] = 'Check' payment_method[5] = 'Credit Card' payment_method[6] = 'Call from Merchant' -payment_method_numb['Not Yet Defined'] = 0 payment_method_numb['No Charge'] = 1 payment_method_numb['Comp Code'] = 2 payment_method_numb['Cash'] = 3 diff --git a/deactivate.php b/deactivate.php index 4e6e743..f077e2c 100644 --- a/deactivate.php +++ b/deactivate.php @@ -15,7 +15,8 @@ // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } /* diff --git a/defines.php b/defines.php index 84c7f23..67bce71 100644 --- a/defines.php +++ b/defines.php @@ -5,6 +5,12 @@ * Set standard defined parameters */ +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); +} + // NOTE: Plugin & Database versions are defined in "/glm-member-db.php". define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_NAME', 'Gaslight Media Event Registrations'); diff --git a/index.php b/index.php index 1629e26..3b9c19b 100644 --- a/index.php +++ b/index.php @@ -22,7 +22,13 @@ * @version 0.0.1 */ -/* +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); +} + + /* * Plugin and Database Versions * * Note that the database version matches the version of the last @@ -65,12 +71,6 @@ if (GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION != get_option('glmMembersRegistrati * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -// Check that we're being called by WordPress. -if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); -} - /* * Some initial setup and tests */ diff --git a/models/admin/registrations/accounts.php b/models/admin/registrations/accounts.php index aaceb75..17bcaa2 100644 --- a/models/admin/registrations/accounts.php +++ b/models/admin/registrations/accounts.php @@ -128,7 +128,7 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount } - $view = 'editAccount'; + $view = 'accountEdit'; switch ( $option ) { case 'add': diff --git a/models/admin/registrations/events.php b/models/admin/registrations/events.php index 3e8c90f..cc3da3c 100644 --- a/models/admin/registrations/events.php +++ b/models/admin/registrations/events.php @@ -14,9 +14,9 @@ */ // Load Registrations data abstract -// require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegistrations.php'; +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php'; -class GlmMembersAdmin_registrations_events // extends GlmDataRegistrations +class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent { /** @@ -81,21 +81,169 @@ class GlmMembersAdmin_registrations_events // extends GlmDataRegistrations * 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); + parent::__construct(false, false, true); } public function modelAction($actionData = false) - { + { + + $option = 'list'; + $template = 'list.html'; + $haveEvent = false; + $eventID = false; + $haveRegEvent = false; + $regEventID = false; + $reason = false; + + // Get any provided option + if (isset($_REQUEST['option'])) { + $option = $_REQUEST['option']; + } + + // Check for a supplied regEvent record ID + if (isset($_REQUEST['regEvent']) && $_REQUEST['regEvent'] != '') { + $regEventID = ($_REQUEST['regEvent'] - 0); + if ($regEventID > 0) { + $regEvent = $this->getEntry($regEventID); + if ($regEvent) { + $haveRegEvent = true; + } + } + } + + // Check for an event ID and make sure it's a positive integer + if (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 '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']."', + true, + ".($eventData['status']['value'] == 10 ? 'true' : 'false').", + true, + 0, + 0, + 60, + 10, + 0, + 0, + 0, + '' + ) + ;"; + $this->wpdb->query($sql); + $regEventID = $this->wpdb->insert_id; + + } + + } 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': + if ($regEventID) { + $regEvent = $this->editEntry($regEventID); + if ($regEvent) { + $haveRegEvent = true; + } + } + + if (!$haveRegEvent) { + $reason = 'Unable to load registration event data.'; + } + + $template = 'eventDashboard.html'; + break; + + case 'list': + default: + + $regEventList = $this->getList(); + + $template = 'eventList.html'; + break; + + } + + // Compile template data $templateData = array( + 'haveEvent' => $haveEvent, + 'eventID' => $eventID, + 'haveRegEvent' => $haveRegEvent, + 'regEventID' => $regEventID, + 'regEvent' => $regEvent, + 'reason' => $reason ); - // Return status, any suggested view, and any data to controller + + // Return status, any suggested view, and any data to controller return array( 'status' => true, 'modelRedirect' => false, - 'view' => 'admin/registrations/events.html', + 'view' => 'admin/registrations/'.$template, 'data' => $templateData ); diff --git a/models/admin/registrations/requests.php b/models/admin/registrations/requests.php index 307cc6b..c72671a 100644 --- a/models/admin/registrations/requests.php +++ b/models/admin/registrations/requests.php @@ -136,7 +136,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest $errorMsg = $requestCart['errorMsg']; } - $view = 'editRequest.html'; + $view = 'requestEdit.html'; break; diff --git a/models/front/registrations/account.php b/models/front/registrations/account.php new file mode 100644 index 0000000..ee63b2c --- /dev/null +++ b/models/front/registrations/account.php @@ -0,0 +1,97 @@ +wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + // Run constructor for members data class + parent::__construct(false, false); + + } + + public function modelAction($actionData = false) + { + + + // Get any provided option + if (isset($_REQUEST['option'])) { + $option = $_REQUEST['option']; + } + + // Get account ID if supplied + if (isset($_REQUEST['account'])) { + + // Make sure it's numeric + $this->accountID = ($_REQUEST['account'] - 0); + + if ($this->accountID <= 0) { + $this->accountID = false; + } + + } + + $view = 'summary'; + + switch ( $option ) { + + } + + // 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 + ); + + } + } diff --git a/models/front/registrations/cart.php b/models/front/registrations/cart.php new file mode 100644 index 0000000..ada99c0 --- /dev/null +++ b/models/front/registrations/cart.php @@ -0,0 +1,83 @@ +accountID = ($_REQUEST['account'] - 0); + + if ($this->accountID <= 0) { + $this->accountID = false; + } + } + + $view = 'cart'; + + switch ( $option ) { + + } + + // 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 + ); + + } + } diff --git a/models/front/registrations/checkout.php b/models/front/registrations/checkout.php new file mode 100644 index 0000000..2a91f0a --- /dev/null +++ b/models/front/registrations/checkout.php @@ -0,0 +1,83 @@ +accountID = ($_REQUEST['account'] - 0); + + if ($this->accountID <= 0) { + $this->accountID = false; + } + } + + $view = 'checkout'; + + switch ( $option ) { + + } + + // 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 + ); + + } + } diff --git a/models/front/registrations/index.php b/models/front/registrations/index.php new file mode 100644 index 0000000..42179bf --- /dev/null +++ b/models/front/registrations/index.php @@ -0,0 +1,103 @@ +wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + /* + * Perform Model Action + * + * This method determines which registrations page is requested, loads and runs that + * model, then returns the result array back to the controller. + * + * @return array Status and data array + * + * 'status' + * + * True if successful and false if there was a fatal failure. + * + * 'menuItemRedirect' + * + * If not false, provides a menu item the controller should + * execute after this one. Normally if this is used, there would also be a + * modelRedirect value supplied as well. + * + * 'modelRedirect' + * + * If not false, provides an action the controller should execute after + * this one. + * + * 'view' + * + * A suggested view name that the controller 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. + * + */ + public function modelAction($actionData = false) + { + + // Check for valid page - if not valid default to "list" + $page = $actionData['request']['page']; + + // Make sure the specified page is valid or default to "list" + if (!in_array($page, array('list', 'select', 'cart', 'checkout', 'summary', 'login', 'account'))) { + $page = 'list'; + } + + // Load the specified model + $pageFile = GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/front/registrations/'.$page.'.php'; + require_once($pageFile); + + // load and run the model + $regClass = 'GlmMembersFront_registrations_'.$page; + $regModel = new $regClass($this->wpdb, $this->config); + $regResult = $regModel->modelAction($actionData); + + return $regResult; + + } + } diff --git a/models/front/registrations/list.php b/models/front/registrations/list.php new file mode 100644 index 0000000..bef41e1 --- /dev/null +++ b/models/front/registrations/list.php @@ -0,0 +1,83 @@ +accountID = ($_REQUEST['account'] - 0); + + if ($this->accountID <= 0) { + $this->accountID = false; + } + } + + $view = 'list'; + + switch ( $option ) { + + } + + // 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 + ); + + } + } diff --git a/models/front/registrations/registrationAccountSummary.php b/models/front/registrations/registrationAccountSummary.php deleted file mode 100644 index 6b0e568..0000000 --- a/models/front/registrations/registrationAccountSummary.php +++ /dev/null @@ -1,97 +0,0 @@ -wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - // Run constructor for members data class - parent::__construct(false, false); - - } - - public function modelAction($actionData = false) - { - - - // Get any provided option - if (isset($_REQUEST['option'])) { - $option = $_REQUEST['option']; - } - - // Get account ID if supplied - if (isset($_REQUEST['account'])) { - - // Make sure it's numeric - $this->accountID = ($_REQUEST['account'] - 0); - - if ($this->accountID <= 0) { - $this->accountID = false; - } - - } - - $view = 'registrationAccountSummary'; - - switch ( $option ) { - - } - - // 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 - ); - - } - } diff --git a/models/front/registrations/registrationCart.php b/models/front/registrations/registrationCart.php deleted file mode 100644 index 166addd..0000000 --- a/models/front/registrations/registrationCart.php +++ /dev/null @@ -1,83 +0,0 @@ -accountID = ($_REQUEST['account'] - 0); - - if ($this->accountID <= 0) { - $this->accountID = false; - } - } - - $view = 'registrationCart'; - - switch ( $option ) { - - } - - // 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 - ); - - } - } diff --git a/models/front/registrations/registrationCheckout.php b/models/front/registrations/registrationCheckout.php deleted file mode 100644 index 658eeab..0000000 --- a/models/front/registrations/registrationCheckout.php +++ /dev/null @@ -1,83 +0,0 @@ -accountID = ($_REQUEST['account'] - 0); - - if ($this->accountID <= 0) { - $this->accountID = false; - } - } - - $view = 'registrationCheckout'; - - switch ( $option ) { - - } - - // 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 - ); - - } - } diff --git a/models/front/registrations/registrationSelect.php b/models/front/registrations/registrationSelect.php deleted file mode 100644 index 346ba4b..0000000 --- a/models/front/registrations/registrationSelect.php +++ /dev/null @@ -1,132 +0,0 @@ -accountID = ($_REQUEST['account'] - 0); - - if ($this->accountID <= 0) { - $this->accountID = false; - } - } - - $view = 'registrationSelect'; - - switch ( $option ) { - - } - - $events = array( - 1 => array( - 'id' => 1, - 'title' => 'PHP Payment Gateways', - 'short_desc' => 'Setting up your developer account and testing payment gateways', - 'levels' => array( - 3 => array( - 'id' => 3, - 'title' => 'General Admittance', - 'registrants' => array( - 1 => array( - 'id' => 1, - 'fname' => 'Dan', - 'lname' => 'Smith', - 'email' => 'dan@smith.com', - ), - 3 => array( - 'id' => 3, - 'fname' => 'Tony', - 'lname' => 'Johnson', - 'email' => 'tj@website.com', - ), - ), - ), - ), - ), - 2 => array( - 'id' => 2, - 'title' => 'Mailchimp Newsletters', - 'short_desc' => 'Learning how to setup test and use mailchimp to the fullest.', - 'levels' => array( - 4 => array( - 'id' => 4, - 'title' => 'General Admittance', - 'registrants' => array( - 2 => array( - 'id' => 2, - 'fname' => 'John', - 'lname' => 'Handler', - 'email' => 'johny@handler.com', - ), - ), - ), - ), - ) - ); - //echo '
$events: ' . print_r( $events, true ) . '
'; - - // Compile template data - $templateData = array( - 'events' => $events, - ); - // Return status, any suggested view, and any data to controller - return array( - 'status' => true, - 'modelRedirect' => false, - 'view' => 'front/registrations/' . $view . '.html', - 'data' => $templateData - ); - - } - } diff --git a/models/front/registrations/registrationSummary.php b/models/front/registrations/registrationSummary.php deleted file mode 100644 index 3027348..0000000 --- a/models/front/registrations/registrationSummary.php +++ /dev/null @@ -1,83 +0,0 @@ -accountID = ($_REQUEST['account'] - 0); - - if ($this->accountID <= 0) { - $this->accountID = false; - } - } - - $view = 'registrationSummary'; - - switch ( $option ) { - - } - - // 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 - ); - - } - } diff --git a/models/front/registrations/select.php b/models/front/registrations/select.php new file mode 100644 index 0000000..0b8abda --- /dev/null +++ b/models/front/registrations/select.php @@ -0,0 +1,118 @@ +wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + public function modelAction($actionData = false) + { + $events = array(); + + // Get any provided option + if (isset($_REQUEST['option'])) { + $option = $_REQUEST['option']; + } + + // Get account ID if supplied + if (isset($_REQUEST['account'])) { + + // Make sure it's numeric + $this->accountID = ($_REQUEST['account'] - 0); + + if ($this->accountID <= 0) { + $this->accountID = false; + } + } + + $view = 'select'; + + switch ( $option ) { + + } + + $events = array( + 1 => array( + 'id' => 1, + 'title' => 'PHP Payment Gateways', + 'short_desc' => 'Setting up your developer account and testing payment gateways', + 'levels' => array( + 3 => array( + 'id' => 3, + 'title' => 'General Admittance', + 'registrants' => array( + 1 => array( + 'id' => 1, + 'fname' => 'Dan', + 'lname' => 'Smith', + 'email' => 'dan@smith.com', + ), + 3 => array( + 'id' => 3, + 'fname' => 'Tony', + 'lname' => 'Johnson', + 'email' => 'tj@website.com', + ), + ), + ), + ), + ), + 2 => array( + 'id' => 2, + 'title' => 'Mailchimp Newsletters', + 'short_desc' => 'Learning how to setup test and use mailchimp to the fullest.', + 'levels' => array( + 4 => array( + 'id' => 4, + 'title' => 'General Admittance', + 'registrants' => array( + 2 => array( + 'id' => 2, + 'fname' => 'John', + 'lname' => 'Handler', + 'email' => 'johny@handler.com', + ), + ), + ), + ), + ) + ); + //echo '
$events: ' . print_r( $events, true ) . '
'; + + // Compile template data + $templateData = array( + 'events' => $events, + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'front/registrations/' . $view . '.html', + 'data' => $templateData + ); + + } + } diff --git a/models/front/registrations/summary.php b/models/front/registrations/summary.php new file mode 100644 index 0000000..f1167a9 --- /dev/null +++ b/models/front/registrations/summary.php @@ -0,0 +1,83 @@ +accountID = ($_REQUEST['account'] - 0); + + if ($this->accountID <= 0) { + $this->accountID = false; + } + } + + $view = 'summary'; + + switch ( $option ) { + + } + + // 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 + ); + + } + } diff --git a/setup/adminHooks.php b/setup/adminHooks.php index c2b0eaf..54e529f 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -46,13 +46,32 @@ add_filter('glm-member-db-admin-management-hooksHelp', function($content) { // Add a filter to include a link to either create registrations for an event or to update that. add_filter( 'glm_members_add_link_to_event_list_entry', - function( $content, $eventId ){ - + function( $content ){ + // Check if there's an existing reg_event record for the supplied event ID. - require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php'; + $RegEvent = new GlmDataRegistrationsRegEvent($this->wpdb, $this->config); + + // If we were passed a valid Event ID + $eventId = $content-0; + if ($eventId > 0) { + // Try to get get the registrations data for this event + $regEvent = $RegEvent->getEntry($eventId, 'event'); + + // If we received valid registrations data for this event then it's already in registrations + 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-events&option=dashboard&event=".$eventId); + + } + + } + + // 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-events&option=add&event=".$eventId); - return ''; }, 10, 2 diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 67d3f9a..5145682 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -78,7 +78,7 @@ add_submenu_page( ); add_submenu_page( 'glm-members-admin-menu-members', - 'Registration Events', + 'Registration Accounts', '    Accounts', 'glm_members_members', 'glm-members-admin-menu-registrations-accounts', diff --git a/setup/shortcodes.php b/setup/shortcodes.php index cb9b811..297d7f8 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -87,57 +87,119 @@ */ $glmMembersRegistrationsShortcodes = array( - 'glm-registration-summary' => array( + + // Short code for all registrations related pages. "page" parameter sets page to be produced. + 'glm-members-registrations' => array( 'plugin' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'menu' => 'registrations', - 'action' => 'registrationSummary', + 'action' => 'index', 'table' => false, 'attributes' => array( - 'id' => false, - 'member_only' => false, + 'page' => false, + 'cart' => false, + 'event' => false, + 'time' => false, + 'datetime' => false, + 'time' => false, + 'account' => false, + ) - ), - 'glm-registration-account-summary' => array( - 'plugin' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'menu' => 'registrations', - 'action' => 'registrationAccountSummary', - 'table' => false, - 'attributes' => array( - 'id' => false, - 'member_only' => false, - ) - ), - 'glm-registration-select' => array( - 'plugin' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'menu' => 'registrations', - 'action' => 'registrationSelect', - 'table' => false, - 'attributes' => array( - 'id' => false, - 'member_only' => false, - ) - ), - 'glm-registration-checkout' => array( - 'plugin' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'menu' => 'registrations', - 'action' => 'registrationCheckout', - 'table' => false, - 'attributes' => array( - 'id' => false, - 'member_only' => false, - ) - ), - 'glm-registration-cart' => array( - 'plugin' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'menu' => 'registrations', - 'action' => 'registrationCart', - 'table' => false, - 'attributes' => array( - 'id' => false, - 'member_only' => false, - ) - ), + ) + ); -$glmMembersRegistrationsShortcodesDescription = ''; +$glmMembersRegistrationsShortcodesDescription = ' + ShortcodeAttributeDescription + + [glm-members-registrations] +   + + By default shows a list of current and upcoming events that are set to accept + registrations. The added "page" parameter can be used to specify the desired + registrations page. + + + +   + page="{registrations page}" + + The "page" attribute is used to select the registrations page that should be + produced. Below is a list of possible pages. +

+ + + + + + + + + + +
List Types
(none)Default page - same as "list" below
listList of events available for registration
selectRegistration selection for a particular event
cartCart page (if logged in there may more more than one that could be displayed)
checkoutCheckout page for selected cart
summarySuccessful checkout summary
loginAccount Login page
accountAccount dashboard page
+

+ + + +   + cart="{ID of a specific cart}" + + The "cart" attribute is used to specify the ID of a particular user cart. + Note that if a user is logged in to a registrations "account", that they may have one + or more completed carts and one or more carts in progress. + + + +   + event="{event ID or event code}" + + The "event" attribute is used to specify the ID of an event for registration. + This may also be the "event code" for an event that offers registrations. + + + +   + datetime="{date/time ID}" + + This specifies the ID of a specific date/time instance for date and time specific events. + This ID must match an existing ID in the schedule for the event as set by and "Event Schedule" in + the Events plugin. + + + +   + date="{a text date}" + + A date string used to search for matching event instances, primarily for the "Registrations List" page. + This can be used to list the times for all events that can take reservations on that date or + can be used along with the "event" ID attribute to list all times on that date for the specified + event. Additionally both "date" and "time" can be used to together to list all occurances on a + specific date and at a specific time. + + + +   + time="{a text time}" + + A time string used to search for matching event instances, primarily for the "Registrations List" page. + This can be used to list the dates for all events that can take reservations at that particular time of day or + can be used along with the "event" ID attribute to list all dates for that time for the specified + event. Additionally both "date" and "time" can be used to together to list all occurances on a + specific date and at a specific time. + + + +   + account="{ID of a specific user account}" + + This is the ID of a specific registration user account. Registration "accounts" hold information on + a particular person. That person/account may have been registered for one or more event or may have + submitted one or more registreation carts.
+ This is primarily used to specify the + currently logged-in account, but it is more likely to be obtained from currently logged-in + information that is stored along with some type of browser storage or session. Use of an account + that is not currently logged in may be permitted in some restricted cases. + + +'; diff --git a/setup/validActions.php b/setup/validActions.php index 208e067..37c0f22 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -61,27 +61,23 @@ $glmMembersRegistrationsAddOnValidActions = array( 'adminActions' => array( 'registrations' => array( 'index' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'list' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'events' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'accounts' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'requests' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG + 'requests' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'accounts' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG ), 'management' => array( 'registrations' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'regterms' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'regterms' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG ), 'settings' => array( 'registrationsPaymentCode' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'registrationsMisc' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'registrationsMisc' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG ), ), 'frontActions' => array( 'registrations' => array( - 'registrationSummary' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'registrationAccountSummary' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'registrationSelect' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'registrationCheckout' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'registrationCart' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'index' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG + ) ), ); diff --git a/uninstall.php b/uninstall.php index 81189e2..dd1262c 100644 --- a/uninstall.php +++ b/uninstall.php @@ -18,7 +18,8 @@ die('uninstall not configured - See plugin uninstall.php script!'); // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } //if uninstall not called from WordPress exit diff --git a/views/admin/registrations/accountEdit.html b/views/admin/registrations/accountEdit.html new file mode 100644 index 0000000..58f9a2d --- /dev/null +++ b/views/admin/registrations/accountEdit.html @@ -0,0 +1,515 @@ +{include file='admin/registrations/header.html'} + + Return to Account List + + {if $option == 'edit' || $option == 'update'} + Delete this Account +
+
+

Cancel

+

+
+
+

WARNING:

+

+ Clicking the "Delete this Account" button above will + delete all of the data and images associated with this contact. + +

+

+ Once deleted, this information will no longer be available and cannot be retrieved! +

+
+
+

Edit Account + {else} +

Add new Account + {/if} +     + {if $accountUpdated}Account Updated{/if} + {if $accountUpdateError}Account Update Error{/if} + {if $accountAdded}Account Added{/if} + {if $accountAddError}Account Add Error{/if} +

+ + +
+ + {if $haveAccount} + + + {else} + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +{include file='admin/footer.html'} diff --git a/views/admin/registrations/editAccount.html b/views/admin/registrations/editAccount.html deleted file mode 100644 index 58f9a2d..0000000 --- a/views/admin/registrations/editAccount.html +++ /dev/null @@ -1,515 +0,0 @@ -{include file='admin/registrations/header.html'} - - Return to Account List - - {if $option == 'edit' || $option == 'update'} - Delete this Account -
-
-

Cancel

-

-
-
-

WARNING:

-

- Clicking the "Delete this Account" button above will - delete all of the data and images associated with this contact. - -

-

- Once deleted, this information will no longer be available and cannot be retrieved! -

-
-
-

Edit Account - {else} -

Add new Account - {/if} -     - {if $accountUpdated}Account Updated{/if} - {if $accountUpdateError}Account Update Error{/if} - {if $accountAdded}Account Added{/if} - {if $accountAddError}Account Add Error{/if} -

- - -
- - {if $haveAccount} - - - {else} - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -{include file='admin/footer.html'} diff --git a/views/admin/registrations/editRequest.html b/views/admin/registrations/editRequest.html deleted file mode 100644 index 3eeb609..0000000 --- a/views/admin/registrations/editRequest.html +++ /dev/null @@ -1,111 +0,0 @@ - -{include file='admin/registrations/header.html'} - -
-

Check Reguest & Update Holds

-
- - {if $option == 'edit' || $option == 'update'} -*** Edit or Update *** - {else} - {$req = $cart.request} - - - - - - {if $req.notes} - - {/if} - -
- - - - - - - - - - - - - - - - - -
- - - - -
Registrations Selected
- - - {foreach $cart.events as $event} - - - - {foreach $event.classes as $class} - - - - {foreach $class.rates as $rate} - - - - {foreach $rate.registrants as $registrant} - - - - {/foreach} - {/foreach} - {/foreach} - - {/foreach} -
EventStart Date/TimeClassRateCreditsRegistrantsCharge
{$event.event_name}{$event.event_datetime.datetime}
 {$class.class_name}
 {$rate.rate_name}{$rate.registrant_credits} {$rate.base_rate}
 {$registrant.fname} {$registrant.lname}{$rate.per_registrant}
-
- - {/if} - -{include file='admin/footer.html'} diff --git a/views/admin/registrations/eventDashboard.html b/views/admin/registrations/eventDashboard.html new file mode 100644 index 0000000..9a37798 --- /dev/null +++ b/views/admin/registrations/eventDashboard.html @@ -0,0 +1,6 @@ +{include file='admin/registrations/header.html'} + +

Registrations Event Dashboard

+ +{include file='admin/footer.html'} + diff --git a/views/admin/registrations/eventEdit.html b/views/admin/registrations/eventEdit.html new file mode 100644 index 0000000..7bd2b66 --- /dev/null +++ b/views/admin/registrations/eventEdit.html @@ -0,0 +1,175 @@ +{include file='admin/registrations/header.html'} + +

Registrations Event Edit

+ + +{$x='event_name'} +{$regEvent.fieldData.$x} + + +{include + 'admin/registrations/text_input.html' + fieldName='event_name' + fieldPrompt='Event Name' + fieldValue=$regEvent.fieldData.event_name + fieldFail=$regEvent.fieldFail.event_name +} + + +{if $reason} +

{$reason}

+{else} + + + Return to Account List + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event Name + + {if $regEvent.fieldFail.event_name}

{$regEvent.fieldFail.event_name}

{/if}
+
Event Registration Code + + {if $regEvent.fieldFail.event_code}

{$regEvent.fieldFail.event_code}

{/if}
+
Notify E-Mail Address + + {if $regEvent.fieldFail.notify_email}

{$regEvent.fieldFail.notify_email}

{/if}
+
Admin Active + + {if $regEvent.fieldFail.admin_active}

{$regEvent.fieldFail.admin_active}

{/if}
+
Registrations Active + + {if $regEvent.fieldFail.active}

{$regEvent.fieldFail.active}

{/if}
+
Multiple Attendees per Submission + + {if $regEvent.fieldFail.attendees}

{$regEvent.fieldFail.attendees}

{/if}
+
Maximum # of Attendees + + {if $regEvent.fieldFail.attendee_max}

{$regEvent.fieldFail.attendee_max}

{/if}
+
Maximum # of Attendees Per Submission + + {if $regEvent.fieldFail.attendee_max_per_reg}

{$regEvent.fieldFail.attendee_max_per_reg}

{/if}
+
Attendees in Cart Hold Time + + {if $regEvent.fieldFail.reg_hold_minutes}

{$regEvent.fieldFail.reg_hold_minutes}

{/if}
+
Cart Hold Days Without Checkout + + {if $regEvent.fieldFail.cart_hold_days}

{$regEvent.fieldFail.cart_hold_days}

{/if}
+
Account Options + {foreach from=$regEvent.fieldData.registration_account_options.bitmap item=v} + {$v.name}
+ {/foreach} + {if $regEvent.fieldFail.registration_account_options}

{$regEvent.fieldFail.registration_account_options}

{/if}
+
Payment Methods + {foreach from=$regEvent.fieldData.payment_methods.bitmap item=v} + {$v.name}
+ {/foreach} + {if $regEvent.fieldFail.payment_methods}

{$regEvent.fieldFail.payment_methods}

{/if}
+
Restricted Payment Methods (Admin use only) + {foreach from=$regEvent.fieldData.resitricted_payment_methods.bitmap item=v} + {$v.name}
+ {/foreach} + {if $regEvent.fieldFail.resitricted_payment_methods}

{$regEvent.fieldFail.resitricted_payment_methods}

{/if}
+
Terms and Conditions for Registration + + {if $regEvent.fieldFail.terms} +

{$regEvent.fieldFail.terms}

+ {/if}
+
File + {if $regEvent.fieldData.reg_file} + Replace this file: + {$regEvent.fieldData.reg_file}    + Delete File
+ {else} + New file: + {/if} +
File Title + + {if $regEvent.fieldFail.reg_file_title}

{$regEvent.fieldFail.reg_file_title}

{/if}
+
Notes + + {if $regEvent.fieldFail.notes} +

{$regEvent.fieldFail.notes}

+ {/if}
+
+
+ + +{/if} + +{include file='admin/footer.html'} + diff --git a/views/admin/registrations/eventList.html b/views/admin/registrations/eventList.html new file mode 100644 index 0000000..45c42e7 --- /dev/null +++ b/views/admin/registrations/eventList.html @@ -0,0 +1,6 @@ +{include file='admin/registrations/header.html'} + +

Registrations Event List

+ +{include file='admin/footer.html'} + diff --git a/views/admin/registrations/events.html b/views/admin/registrations/events.html deleted file mode 100644 index f32dffd..0000000 --- a/views/admin/registrations/events.html +++ /dev/null @@ -1,6 +0,0 @@ -{include file='admin/registrations/header.html'} - -

Registrations Events List

- -{include file='admin/footer.html'} - diff --git a/views/admin/registrations/requestEdit.html b/views/admin/registrations/requestEdit.html new file mode 100644 index 0000000..3eeb609 --- /dev/null +++ b/views/admin/registrations/requestEdit.html @@ -0,0 +1,111 @@ + +{include file='admin/registrations/header.html'} + +
+

Check Reguest & Update Holds

+
+ + {if $option == 'edit' || $option == 'update'} +*** Edit or Update *** + {else} + {$req = $cart.request} + + + + + + {if $req.notes} + + {/if} + +
+ + + + + + + + + + + + + + + + + +
+ + + + +
Registrations Selected
+ + + {foreach $cart.events as $event} + + + + {foreach $event.classes as $class} + + + + {foreach $class.rates as $rate} + + + + {foreach $rate.registrants as $registrant} + + + + {/foreach} + {/foreach} + {/foreach} + + {/foreach} +
EventStart Date/TimeClassRateCreditsRegistrantsCharge
{$event.event_name}{$event.event_datetime.datetime}
 {$class.class_name}
 {$rate.rate_name}{$rate.registrant_credits} {$rate.base_rate}
 {$registrant.fname} {$registrant.lname}{$rate.per_registrant}
+
+ + {/if} + +{include file='admin/footer.html'} diff --git a/views/admin/registrations/text_input.html b/views/admin/registrations/text_input.html new file mode 100644 index 0000000..814d6fd --- /dev/null +++ b/views/admin/registrations/text_input.html @@ -0,0 +1,8 @@ + + + +

title = {$fieldPrompt}

+

name = {$fieldName}

+

value = {$fieldValue}

+

fail = {$fieldFail}

+ diff --git a/views/front/registrations/account.html b/views/front/registrations/account.html new file mode 100644 index 0000000..e69de29 diff --git a/views/front/registrations/cart.html b/views/front/registrations/cart.html new file mode 100644 index 0000000..e69de29 diff --git a/views/front/registrations/checkout.html b/views/front/registrations/checkout.html new file mode 100644 index 0000000..e69de29 diff --git a/views/front/registrations/list.html b/views/front/registrations/list.html new file mode 100644 index 0000000..8eee247 --- /dev/null +++ b/views/front/registrations/list.html @@ -0,0 +1 @@ +This is a list \ No newline at end of file diff --git a/views/front/registrations/login.html b/views/front/registrations/login.html new file mode 100644 index 0000000..e69de29 diff --git a/views/front/registrations/registrationAccountSummary.html b/views/front/registrations/registrationAccountSummary.html deleted file mode 100644 index e69de29..0000000 diff --git a/views/front/registrations/registrationCart.html b/views/front/registrations/registrationCart.html deleted file mode 100644 index e69de29..0000000 diff --git a/views/front/registrations/registrationCheckout.html b/views/front/registrations/registrationCheckout.html deleted file mode 100644 index e69de29..0000000 diff --git a/views/front/registrations/registrationSelect.html b/views/front/registrations/registrationSelect.html deleted file mode 100644 index 1f1f640..0000000 --- a/views/front/registrations/registrationSelect.html +++ /dev/null @@ -1,31 +0,0 @@ -
- {foreach $events as $event} -
-

{$event.title}

-
- -
-

{$event.short_desc}

-
-
-

Pick your registration dates

- - -
- {foreach $event.levels as $level} -
-

{$level.title}

- + - {foreach $level.registrants as $reg} -
{$reg.fname} {$reg.lname} {$reg.email}
- {/foreach} -
- {/foreach} -
- -
-
-
- {/foreach} - -
diff --git a/views/front/registrations/registrationSummary.html b/views/front/registrations/registrationSummary.html deleted file mode 100644 index e69de29..0000000 diff --git a/views/front/registrations/select.html b/views/front/registrations/select.html new file mode 100644 index 0000000..1f1f640 --- /dev/null +++ b/views/front/registrations/select.html @@ -0,0 +1,31 @@ +
+ {foreach $events as $event} +
+

{$event.title}

+
+ +
+

{$event.short_desc}

+
+
+

Pick your registration dates

+ + +
+ {foreach $event.levels as $level} +
+

{$level.title}

+ + + {foreach $level.registrants as $reg} +
{$reg.fname} {$reg.lname} {$reg.email}
+ {/foreach} +
+ {/foreach} +
+ +
+
+
+ {/foreach} + +
diff --git a/views/front/registrations/summary.html b/views/front/registrations/summary.html new file mode 100644 index 0000000..e69de29