'use' => 'a'
),
- // Current expire date - Now always getting from the payment_code table
+ // Ref Type (event, level, etc)
+ 'reg_type' => array(
+ 'field' => 'payment_code',
+ 'as' => 'ref_type',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'payment_code',
+ 'p_field' => 'ref_type',
+ 'required' => true,
+ 'use' => 'lgneud'
+ ),
+
+ // Ref Dest (event, level, etc ID)
+ 'reg_dest' => array(
+ 'field' => 'payment_code',
+ 'as' => 'ref_dest',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'payment_code',
+ 'p_field' => 'ref_dest',
+ 'required' => true,
+ 'use' => 'lgneud'
+ ),
+
+ // Expire date from the payment_code table
'expire_date' => array(
'field' => 'payment_code',
'as' => 'expire_date',
$regPayCodes = $this->getList("T.reg_request = $requestId");
- if (!regPayCodes) {
+ if (!$regPayCodes) {
return false;
}
$haveEvents = true;
// Check for event payment code
+ $this->cart['events'][$eventKey]['payCodes'] = array();
+ if ($this->cart['payCodes']) {
+echo "1";
+ foreach ($this->cart['payCodes'] as $code) {
+echo "2";
+ $thisDiscount = 0;
+ if ($code['ref_type'] == $this->config['pay_code_ref_type_numb']['Event'] &&
+ $code['ref_dest'] == $event['reg_event']) {
+echo "3";
+ switch ($code['code_type']) {
+ case 'Free':
+ $thisDiscount = $eventCharges;
+ $eventDiscounts = $totalCharges;
+ break;
+
+ case 'Amount':
+ $thisDiscount = $code['amount'];
+ $eventDiscounts += $thisDiscount;
+ break;
+
+ Case 'Percent':
+ $thisDiscount = ($eventCharges * ($code['amount']/100));
+ $eventDiscounts += $thisDiscount;
+ break;
+ }
+
+ $code['thisDiscount'] = $thisDiscount;
+ $this->cart['events'][$eventKey]['payCodes'][$code['id']] = $code;
+ }
+ }
+ }
+echo "<pre>".print_r($this->cart['events'][$eventKey]['payCodes'],1)."</pre>";
// Save totals for this event
$this->cart['events'][$eventKey]['eventRegistrants'] = $eventRegistrants;
$this->cart['events'][$eventKey]['eventCharges'] = $eventCharges;
} // Each event
// Check for global payment code
+ $this->cart['globalPayCodes'] = array();
+ if ($this->cart['payCodes']) {
+ foreach ($this->cart['payCodes'] as $code) {
+ $thisDiscount = 0;
+ if ($code['ref_type'] == $this->config['pay_code_ref_type_numb']['Global']) {
+ switch ($code['code_type']) {
+ case 'Free':
+ $thisDiscount = $totalCharges;
+ $totalDiscounts = $totalCharges;
+ break;
+
+ case 'Amount':
+ $thisDiscount = $code['amount'];
+ $totalDiscounts += $thisDiscount;
+ break;
+
+ Case 'Percent':
+ $thisDiscount = ($totalCharges * ($code['amount']/100));
+ $totalDiscounts += $thisDiscount;
+ break;
+ }
+
+ $code['thisDiscount'] = $thisDiscount;
+ $this->cart['globalPayCodes'][$code['id']] = $code;
+ }
+ }
+ }
} // Have events
$this->cart['totalRegistrants'] = $totalRegistrants;
$this->cart['totalCharges'] = $totalCharges;
$this->cart['totalDiscounts'] = $totalDiscounts;
+ $this->cart['grandTotal'] = $totalCharges - $totalDiscounts;
// Update request last_update timestamp
-// *** update cart last_update time
+ $this->wpdb->update(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
+ array(
+ 'total' => $this->cart['grandTotal'],
+ 'total_discounts' => $this->cart['totalDiscounts'],
+ 'last_update' => current_time('mysql', 1)
+ ),
+ array( 'id' => $requestId ),
+ array(
+ '%f',
+ '%f',
+ '%s'
+ )
+ );
- // Check if Event Time exists in Events add-on
// echo "<pre>".print_r($this->cart,1)."</pre>";
public function modelAction($actionData = false)
{
+ // *** Need to move the parameters below to their appropriate sub-model file ***
+
$messages = array();
$option = 'dashboard';
$view = false;
$havePayCodes = false;
$payCodes = false;
$newPayCode = false;
+ $refPaycodeType = false;
$classes = false;
$haveRegistrants = false;
$registrants = false;
}
+ // Check for invalid reg event id, otherwise store the good one
if (!$regEventID || $regEventID <= 0) {
$regEventID = false;
+ } else {
+ update_option('glmMembersDatabaseRegistrationsRegEventID', $regEventID);
}
- if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
- trigger_error("Registration Events: Admin option = $option ", E_USER_NOTICE);
+ /*
+ * Load the proper sub-model file to perform the select $option
+ */
+ $modelFile = $option;
+ if ($option == 'add' || $option == 'edit') {
+ $modelFile = 'addEdit';
}
- switch ($option) {
-
- case 'paymentCodes':
-
- require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataPaymentCode.php';
- $PayCode = new GlmDataRegistrationsPaymentCode($this->wpdb, $this->config);
-
- if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') {
- switch($_REQUEST['option2']) {
-
- case 'new':
- $PayCode->insertEntry();
- break;
-
- case 'update':
- $payCodeId = ($_REQUEST['payCodeId'] - 0);
- $x = $PayCode->updateEntry($payCodeId);
- break;
-
- case 'delete':
- $payCodeId = ($_REQUEST['payCodeId'] - 0);
- if ( $payCodeId > 0 ) {
- $PayCode->deleteEntry( $payCodeId, true );
- }
- break;
- }
- }
-
- $newPayCode = $PayCode->newEntry();
-
- // *** NEED TO FIX ref_type to include other possible one for events
- $payCodes = $PayCode->getList("T.ref_type = 20 AND T.ref_dest = $regEventID");
-
- if ($payCodes) {
- $havePayCodes = true;
- }
-
- $regEvent = $this->getEntry($regEventID);
-
- $view = 'eventPaymentCodes';
-
- break;
-
- case 'notificationsUpdate':
-
- // New and updated notifications
- if (isset($_REQUEST['name']) && is_array($_REQUEST['name'])) {
-
- foreach ($_REQUEST['name'] as $key=>$val) {
-
- // Make sure key is positive integer
- $id = ($key-0);
- if ($id > 0) {
-
- // Update existing entry
- $this->wpdb->update(
- GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification',
- array(
- 'name' => $_REQUEST['name'][$id],
- 'notification_days' => $_REQUEST['notification_days'][$id],
- 'message' => $_REQUEST['message'][$id]
- ),
- array( 'id' => $id ),
- array( '%s', '%d', '%s' ),
- array( '%d' )
- );
-
- // Otherwise if the id is less than 0 it must be a new one
- } elseif ($id < 0) {
-
- // Insert a new entry
- $this->wpdb->insert(
- GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification',
- array(
- 'reg_event' => $regEventID,
- 'name' => $_REQUEST['name'][$id],
- 'notification_days' => $_REQUEST['notification_days'][$id],
- 'message' => $_REQUEST['message'][$id]
- ),
- array( '%d', '%s', '%d', '%s' )
- );
- }
- }
- }
-
- // Delete Notifications
- if (isset($_REQUEST['delete']) && is_array($_REQUEST['delete'])) {
-
- $ids = '';
- foreach ($_REQUEST['delete'] as $key=>$val) {
-
- // Make sure key is positive integer
- $id = ($key-0);
- if ($id > 0) {
- $this->wpdb->delete( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', array( 'ID' => $id ), array( '%d' ) );
- }
-
- }
- }
-
-
- $regNotifyUpdated = true;
-
- // Fall through to get the data again
-
- case 'notifications':
-
- require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegNotification.php';
- $Notifications = new GlmDataRegistrationsRegNotification($this->wpdb, $this->config);
-
- $regNotifications = $Notifications->getList("T.reg_event = $regEventID", 'notification_days');
-
- $regEvent = $this->getEntry($regEventID);
-
- $view = 'eventNotifications';
-
- break;
-
- case 'registrants':
-
- $whereParts = array();
-
- if (isset($_REQUEST['textSearch']) && trim($_REQUEST['textSearch'] != '')) {
- $textSearch = trim($_REQUEST['textSearch']);
- $whereParts[] = "concat( T.fname, ' ', T.lname) LIKE '%".$textSearch."%'";
-
- // Clean up for use in redisplaying search value
- $textSearch = stripslashes($textSearch);
- }
-
- require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php';
- $Registrants = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config);
-
- // Get the regEvent data
- $regEvent = $this->getEntry($regEventID);
-
- // Filter for complete if given
- if ( isset( $_REQUEST['complete'] ) && filter_var( $_REQUEST['complete'], FILTER_VALIDATE_BOOLEAN) ) {
- $completed = true;
- $whereParts[] = "T.reg_request in (
- SELECT id
- FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request
- WHERE status = {$this->config['submission_status_numb']['COMPLETE']})";
- }
-
- // Get list of all registrants for this event
- $where = implode( ' AND ', $whereParts );
-
- // Check if we're doing paging
- if ( isset( $_REQUEST['pageSelect'] ) ) {
-
- // If request is for Next
- if ( $_REQUEST['pageSelect'][0] == 'N' ) {
- $newStart = $_REQUEST['nextStart'] - 0;
-
- // Otherwise it must be Previous
- } else {
- $newStart = $_REQUEST['prevStart'] - 0;
- }
-
- if ($newStart > 0) {
- $start = $newStart;
- }
- }
-
- $customFieldsPluginActive = apply_filters( 'glm-members-customfields-plugin-active', false );
-
- $listResult = $Registrants->getFullRegistrantsData($regEventID, $where, $start, $limit);
- // echo '<pre>$listResult: ' . print_r( $listResult['list'], true ) . '</pre>';
-
- // Get count of registrants listed
- $registrantCount = $listResult['totalCount'];
-
- // If the number of registrants is less than a page, don't do paging
- if ($registrantCount <= $limit) {
- // $paging = false;
- }
-
- // Get paging results
- $numbDisplayed = $listResult['returned'];
- $lastDisplayed = $listResult['last'];
- if ($start == 1) {
- $prevStart = false;
- } else {
- $prevStart = $start - $limit;
- if ($start < 1) {
- $start = 1;
- }
- }
- if ($listResult['returned'] == $limit) {
- $nextStart = $start + $limit;
- }
- $registrants = $listResult['list'];
-
- $success = true;
- $haveRegistrants = false;
- if ($registrants !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($registrants) > 0) {
- $haveRegistrants = true;
- }
- }
- // echo "<pre>".print_r($registrants,1)."</pre>";
-
- $view = 'eventRegistrants';
-
- break;
-
- case 'eventCustomFields':
-
- require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegClass.php';
- $RegClasses = new GlmDataRegistrationsRegClass($this->wpdb, $this->config);
- $classes = $RegClasses->getList("T.reg_event = $regEventID");
-
- $regEvent = $this->getEntry($regEventID);
-
- $view = 'eventEditCustomFields';
-
- break;
-
- case 'configureEvent':
-
- $scripts = array(
- 'backbone-local' => 'js/lib/backbone.localStorage.min.js',
- 'regApp' => 'js/adminRegApp.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( 'jquery', 'backbone' ) );
- wp_enqueue_script( array_keys( $scripts ) );
- $regEvent = array();
-
- // Get all current registration event data
- $regEvent = $this->getEventConfig($regEventID, false, false, true);
-
- // Make all arrays of arrays non-associative to make Backbone happy
- if (is_array($regEvent['reg_class'])) {
- foreach ($regEvent['reg_class'] as $k=>$v) {
- if (is_array($regEvent['reg_class'][$k]['reg_rate'])) {
- $regEvent['reg_class'][$k]['reg_rate'] = array_values($regEvent['reg_class'][$k]['reg_rate']);
- }
- }
- }
- if (is_array($regEvent['reg_class'])) {
- $regEvent['reg_class'] = array_values($regEvent['reg_class']);
- $regClassesJSON = json_encode($regEvent['reg_class']);
- }
- if (is_array($regEvent['reg_time'])) {
- $regEvent['reg_time'] = array_values($regEvent['reg_time']);
- $regTimesJSON = json_encode($regEvent['reg_time']);
- }
-
- // Get rid of class and time arrays so we just have the event data
- unset($regEvent['reg_class']);
- unset($regEvent['reg_time']);
- $regEventJSON = json_encode($regEvent);
-
- $view = 'eventEditLevels';
-
- break;
-
- case 'add':
- case 'edit':
-
- $problem = false;
-
- // If we're adding a new reg event
- if ($option == 'add') {
-
- $eventData = false;
- $eventID = ($_REQUEST['event']-0);
-
- // Verify that event is not already listed
- $regEvent = $this->getEntry($eventID, 'event');
- if (!$regEvent) {
-
- // Get data on this event from events add-on
- if ($eventID > 0) {
- $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,
- time_specific,
- attendees,
- attendee_max,
- attendee_max_per_reg,
- reg_hold_minutes,
- cart_hold_days,
- reg_hours_before,
- registration_account_options,
- payment_methods,
- restricted_payment_methods,
- terms
- )
- VALUES
- (
- ".$eventData['id'].",
- '".$eventData['name']."',
- '".$eventData['name_slug']."',
- '".$eventData['admin_email']."',
- true,
- false,
- true,
- true,
- 0,
- 0,
- 60,
- 10,
- 24,
- 14,
- 94,
- 26,
- ''
- )
- ;";
- $this->wpdb->query($sql);
- $regEventID = $this->wpdb->insert_id;
- if ($regEventID) {
-
- $regEventUpdated = true;
-
- // Create all needed reg_time entries
- $this->checkEventTimes($regEventID);
-
- }
-
- }
-
-
- } else {
- $messages[] = "Trying to add an event that is already listed in Registrations.";
- $problem = true;
- }
-
- }
-
- // If there's no problem yet, try to get the regEvent data for edit
- if (!$problem) {
- if ($regEventID) {
- $regEvent = $this->editEntry($regEventID);
- if ($regEvent) {
- $haveRegEvent = true;
- }
- }
- }
-
- //echo "<pre>".print_r($regEvent,1)."</pre>";
-
- $view = 'eventEdit';
-
- break;
-
- 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;
- }
-
- $view = 'eventEdit';
-
- break;
-
-
- case 'delete':
-
- $regEventDeleted = false;
-
- // If we don't have a registration Event ID
- if (!$regEventID) {
- $messages[] = 'Request to delete registrations for an event but ID for this was not supplied.';
- } else {
-
- // Check if we received a confirmation override to delete a reg event that has completed registrations
- if (isset($_REQUEST['deleteConfirmation']) && $_REQUEST['deleteConfirmation'] == 'DELETE') {
-
- // Check that we have reg_event entry for this ID
- $regEvent = $this->getEntry($regEventID);
-
- if (!$regEvent) {
- $messages[] = 'Request to delete registrations for an event but unable to find registration setup for this event.';
- } else {
-
- // Delete registrations for this event
- $regEventDeleted = $this->deleteRegEvent($regEventID);
-
- if (!$regEventDeleted) {
- $messages[] = 'Attempt to delete registrations for this event failed. Nothing has been deleted';
- }
- }
-
- } else {
- $messages[] = 'You did not properly confirm your request by entering "DELETE". No dates and times were added.';
- }
-
- }
-
- if ($regEventDeleted) {
-
- // Return status, any suggested view, and any data to controller
- return array(
- 'status' => true,
- 'modelRedirect' => false,
- 'view' => 'admin/registrations/registrationEventDeleted.html',
- 'data' => array()
- );
- break;
-
- }
-
- // Registration event was not deleted so falling through to eventDashboard to display reasons or ask for confirmation
-
- case 'eventDashboard':
-
- $regEvent = $this->getEventConfig($regEventID, true, false, true, false, true);
-
- // Check if there's a request to add event times from the event
- if (isset($_REQUEST) && isset($_REQUEST['getTimesFromEvent']) && $_REQUEST['getTimesFromEvent'] == 'yes') {
-
- // Check that the user entered the correct confirmation string
- if (isset($_REQUEST['addConfirmation']) && $_REQUEST['addConfirmation'] == 'ADD') {
-
- // Get the event data again along with any new times
- $regEvent = $this->getEventConfig($regEventID, true, false, true);
-
- $messages[] = 'Per your request, any dates and times specified in the event schedules that were not already added here, have now been added.';
-
- }else{
- $messages[] = 'You did not properly confirm your request by entering "ADD". No dates and times were added.';
- }
-
- }
-
- // If this isn't a time specific event - check for new event non-date-specific only time entry
- if (!$regEvent['time_specific']['value']) {
- $regEvent = $this->checkEventTimes(false, false, true);
- }
-
- if ($regEvent !== false) {
-
- $haveRegEvent = true;
- $regEventFirstTime = $regEvent['first_datetime'];
- $regEventLastTime = $regEvent['last_datetime'];
-
- // if there's a user notice, add it to messages
- if (isset($regEvent['message']) && $regEvent['message']) {
- $messages[] = $regEvent['message'];
- }
-
- }
-
- // Check if we have any times for this reg_event
- if (is_array($regEvent['reg_time']) || count($regEVent['reg_time']) > 0) {
- $haveRegEventTimes = true;
- } else {
- $messages[] = 'There are no dates for registrations for this event.';
- }
-
- $view = 'eventDashboard';
-
- break;
-
- case 'dashboard':
- default:
-
- // If doing alpha list
- if (isset($_REQUEST['alpha'])) {
- $actionData['request']['alpha'] = $_REQUEST['alpha'];
- }
-
- // If user clicked a page request then we need to check the savedAlpha value
- if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) {
- $actionData['request']['alpha'] = $_REQUEST['savedAlpha'];
- }
-
- if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) {
- $alphaSelected = strtoupper($actionData['request']['alpha']);
- $alphaWhere .= " AND T.event_name LIKE '$alphaSelected%'";
- }
-
- $where = ' TRUE ';
- if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search'] != '')) {
- $textSearch = trim($_REQUEST['text_search']);
- $where = "event_name LIKE '%".$textSearch."%'";
-
- // Clean up for use in redisplaying search value
- $textSearch = stripslashes($textSearch);
- }
-
- // Get full list for all other filters, but not filtered by alpha (that would be silly)
- $alphaList = $this->getAlphaList('');
-
- // Get count of reg event listed
- $regEventsCount = $this->getStats($where);
-
- // Get a current list of reg events
- $listResult = $this->getSimpleRegEventsList($where.$alphaWhere, 'event_name', true, 'id', $start, $limit, true, true);
-
- // Get paging results
- $numbDisplayed = $listResult['returned'];
- $lastDisplayed = $listResult['last'];
- if ($start == 1) {
- $prevStart = false;
- } else {
- $prevStart = $start - $limit;
- if ($start < 1) {
- $start = 1;
- }
- }
- if ($listResult['returned'] == $limit) {
- $nextStart = $start + $limit;
- }
-
- // since we're doing paging, we have to break out just the event data
- $list = $listResult['list'];
- unset($listResult);
-
- // If we have list entries - even if it's an empty list
- $success = true;
- $haveRegEvents = false;
- if ($list !== false) {
-
- $success = true;
-
- // If we have any entries
- if (count($list) > 0) {
- $haveRegEvents = true;
- }
- }
-
- // Get full list of event names matching the current where clause for text search box
- $namesList = $this->getSimpleRegEventsList($where);
-
- $view = 'eventsDashboard';
-
- break;
+ $subModel = GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/registrations/events_'.$modelFile.'.php';
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ trigger_error("Registration Events: Sub-Controller calling: $subModel", E_USER_NOTICE);
}
- // If we have a valid account ID, save that for future use
- if ($regEventID > 0) {
- update_option('glmMembersDatabaseRegistrationsRegEventID', $regEventID);
- }
+ require_once $subModel;
- // calculate default calendar date for event dashboard
- $defaultCalTime = time();
- if (isset($regEventFirstTime) && $regEventFirstTime['timestamp']+0 > 0) {
- $defaultCalTime = $regEventFirstTime['timestamp'];
- }
+ /*
+ * *** Need to move the template data compilation to the individual sub-model files.
+ */
// Compile template data
$templateData = array(
'haveMessages' => count($messages) > 0,
'havePayCodes' => $havePayCodes,
'payCodes' => $payCodes,
'newPayCode' => $newPayCode,
- 'eventPaycodeType' => $this->config['pay_code_ref_type_numb']['Event'],
+ 'eventPaycodeType' => $refPaycodeType,
'currentUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_ADMIN_URL,
'thisJsUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
'regEventJSON' => $regEventJSON,
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Add/Edit
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_delete.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$problem = false;
+
+// If we're adding a new reg event
+if ($option == 'add') {
+
+ $eventData = false;
+ $eventID = ($_REQUEST['event']-0);
+
+ // Verify that event is not already listed
+ $regEvent = $this->getEntry($eventID, 'event');
+ if (!$regEvent) {
+
+ // Get data on this event from events add-on
+ if ($eventID > 0) {
+ $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,
+ time_specific,
+ attendees,
+ attendee_max,
+ attendee_max_per_reg,
+ reg_hold_minutes,
+ cart_hold_days,
+ reg_hours_before,
+ registration_account_options,
+ payment_methods,
+ restricted_payment_methods,
+ terms
+ )
+ VALUES
+ (
+ ".$eventData['id'].",
+ '".$eventData['name']."',
+ '".$eventData['name_slug']."',
+ '".$eventData['admin_email']."',
+ true,
+ false,
+ true,
+ true,
+ 0,
+ 0,
+ 60,
+ 10,
+ 24,
+ 14,
+ 94,
+ 26,
+ ''
+ )
+ ;";
+ $this->wpdb->query($sql);
+ $regEventID = $this->wpdb->insert_id;
+ if ($regEventID) {
+
+ $regEventUpdated = true;
+
+ // Create all needed reg_time entries
+ $this->checkEventTimes($regEventID);
+
+ }
+
+ }
+
+
+ } else {
+ $messages[] = "Trying to add an event that is already listed in Registrations.";
+ $problem = true;
+ }
+
+}
+
+// If there's no problem yet, try to get the regEvent data for edit
+if (!$problem) {
+ if ($regEventID) {
+ $regEvent = $this->editEntry($regEventID);
+ if ($regEvent) {
+ $haveRegEvent = true;
+ }
+ }
+}
+
+//echo "<pre>".print_r($regEvent,1)."</pre>";
+
+$view = 'eventEdit';
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Configure Event
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_configureEvent.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$scripts = array(
+ 'backbone-local' => 'js/lib/backbone.localStorage.min.js',
+ 'regApp' => 'js/adminRegApp.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( 'jquery', 'backbone' ) );
+wp_enqueue_script( array_keys( $scripts ) );
+$regEvent = array();
+
+// Get all current registration event data
+$regEvent = $this->getEventConfig($regEventID, false, false, true);
+
+// Make all arrays of arrays non-associative to make Backbone happy
+if (is_array($regEvent['reg_class'])) {
+ foreach ($regEvent['reg_class'] as $k=>$v) {
+ if (is_array($regEvent['reg_class'][$k]['reg_rate'])) {
+ $regEvent['reg_class'][$k]['reg_rate'] = array_values($regEvent['reg_class'][$k]['reg_rate']);
+ }
+ }
+}
+if (is_array($regEvent['reg_class'])) {
+ $regEvent['reg_class'] = array_values($regEvent['reg_class']);
+ $regClassesJSON = json_encode($regEvent['reg_class']);
+}
+if (is_array($regEvent['reg_time'])) {
+ $regEvent['reg_time'] = array_values($regEvent['reg_time']);
+ $regTimesJSON = json_encode($regEvent['reg_time']);
+}
+
+// Get rid of class and time arrays so we just have the event data
+unset($regEvent['reg_class']);
+unset($regEvent['reg_time']);
+$regEventJSON = json_encode($regEvent);
+
+$view = 'eventEditLevels';
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Events Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_dashboard.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// If doing alpha list
+if (isset($_REQUEST['alpha'])) {
+ $actionData['request']['alpha'] = $_REQUEST['alpha'];
+}
+
+// If user clicked a page request then we need to check the savedAlpha value
+if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) {
+ $actionData['request']['alpha'] = $_REQUEST['savedAlpha'];
+}
+
+if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) {
+ $alphaSelected = strtoupper($actionData['request']['alpha']);
+ $alphaWhere .= " AND T.event_name LIKE '$alphaSelected%'";
+}
+
+$where = ' TRUE ';
+if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search'] != '')) {
+ $textSearch = trim($_REQUEST['text_search']);
+ $where = "event_name LIKE '%".$textSearch."%'";
+
+ // Clean up for use in redisplaying search value
+ $textSearch = stripslashes($textSearch);
+}
+
+// Get full list for all other filters, but not filtered by alpha (that would be silly)
+$alphaList = $this->getAlphaList('');
+
+// Get count of reg event listed
+$regEventsCount = $this->getStats($where);
+
+// Get a current list of reg events
+$listResult = $this->getSimpleRegEventsList($where.$alphaWhere, 'event_name', true, 'id', $start, $limit, true, true);
+
+// Get paging results
+$numbDisplayed = $listResult['returned'];
+$lastDisplayed = $listResult['last'];
+if ($start == 1) {
+ $prevStart = false;
+} else {
+ $prevStart = $start - $limit;
+ if ($start < 1) {
+ $start = 1;
+ }
+}
+if ($listResult['returned'] == $limit) {
+ $nextStart = $start + $limit;
+}
+
+// since we're doing paging, we have to break out just the event data
+$list = $listResult['list'];
+unset($listResult);
+
+// If we have list entries - even if it's an empty list
+$success = true;
+$haveRegEvents = false;
+if ($list !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($list) > 0) {
+ $haveRegEvents = true;
+ }
+}
+
+// Get full list of event names matching the current where clause for text search box
+$namesList = $this->getSimpleRegEventsList($where);
+
+$view = 'eventsDashboard';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Delete
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_delete.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$regEventDeleted = false;
+
+// If we don't have a registration Event ID
+if (!$regEventID) {
+ $messages[] = 'Request to delete registrations for an event but ID for this was not supplied.';
+} else {
+
+ // Check if we received a confirmation override to delete a reg event that has completed registrations
+ if (isset($_REQUEST['deleteConfirmation']) && $_REQUEST['deleteConfirmation'] == 'DELETE') {
+
+ // Check that we have reg_event entry for this ID
+ $regEvent = $this->getEntry($regEventID);
+
+ if (!$regEvent) {
+ $messages[] = 'Request to delete registrations for an event but unable to find registration setup for this event.';
+ } else {
+
+ // Delete registrations for this event
+ $regEventDeleted = $this->deleteRegEvent($regEventID);
+
+ if (!$regEventDeleted) {
+ $messages[] = 'Attempt to delete registrations for this event failed. Nothing has been deleted';
+ }
+ }
+
+ } else {
+ $messages[] = 'You did not properly confirm your request by entering "DELETE". No dates and times were added.';
+ }
+
+}
+
+if ($regEventDeleted) {
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'admin/registrations/registrationEventDeleted.html',
+ 'data' => array()
+ );
+ break;
+
+}
+
+// Registration event was not deleted so falling through to eventDashboard to display reasons or ask for confirmation
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/registrations/events_dashboard.php';
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Custom Fields
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_eventCustomFields.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegClass.php';
+$RegClasses = new GlmDataRegistrationsRegClass($this->wpdb, $this->config);
+$classes = $RegClasses->getList("T.reg_event = $regEventID");
+
+$regEvent = $this->getEntry($regEventID);
+
+$view = 'eventEditCustomFields';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Events Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_eventDashboard.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$regEvent = $this->getEventConfig($regEventID, true, false, true, false, true);
+
+// Check if there's a request to add event times from the event
+if (isset($_REQUEST) && isset($_REQUEST['getTimesFromEvent']) && $_REQUEST['getTimesFromEvent'] == 'yes') {
+
+ // Check that the user entered the correct confirmation string
+ if (isset($_REQUEST['addConfirmation']) && $_REQUEST['addConfirmation'] == 'ADD') {
+
+ // Get the event data again along with any new times
+ $regEvent = $this->getEventConfig($regEventID, true, false, true);
+
+ $messages[] = 'Per your request, any dates and times specified in the event schedules that were not already added here, have now been added.';
+
+ }else{
+ $messages[] = 'You did not properly confirm your request by entering "ADD". No dates and times were added.';
+ }
+
+}
+
+// If this isn't a time specific event - check for new event non-date-specific only time entry
+if (!$regEvent['time_specific']['value']) {
+ $regEvent = $this->checkEventTimes(false, false, true);
+}
+
+if ($regEvent !== false) {
+
+ $haveRegEvent = true;
+ $regEventFirstTime = $regEvent['first_datetime'];
+ $regEventLastTime = $regEvent['last_datetime'];
+
+ // if there's a user notice, add it to messages
+ if (isset($regEvent['message']) && $regEvent['message']) {
+ $messages[] = $regEvent['message'];
+ }
+
+}
+
+// Check if we have any times for this reg_event
+if (is_array($regEvent['reg_time']) || count($regEVent['reg_time']) > 0) {
+ $haveRegEventTimes = true;
+} else {
+ $messages[] = 'There are no dates for registrations for this event.';
+}
+
+// calculate default calendar date for event dashboard
+$defaultCalTime = time();
+if (isset($regEventFirstTime) && $regEventFirstTime['timestamp']+0 > 0) {
+ $defaultCalTime = $regEventFirstTime['timestamp'];
+}
+
+$view = 'eventDashboard';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Global Payment Codes
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_globalCodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataPaymentCode.php';
+$PayCode = new GlmDataRegistrationsPaymentCode($this->wpdb, $this->config);
+
+if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') {
+ switch($_REQUEST['option2']) {
+
+ case 'new':
+ $PayCode->insertEntry();
+ break;
+
+ case 'update':
+ $payCodeId = ($_REQUEST['payCodeId'] - 0);
+ $x = $PayCode->updateEntry($payCodeId);
+ break;
+
+ case 'delete':
+ $payCodeId = ($_REQUEST['payCodeId'] - 0);
+ if ( $payCodeId > 0 ) {
+ $PayCode->deleteEntry( $payCodeId, true );
+ }
+ break;
+ }
+}
+
+// Create a new paycode entry array for creating new codes
+$newPayCode = $PayCode->newEntry();
+
+// Specify the pay code type number that should be used.
+$refPaycodeType = $this->config['pay_code_ref_type_numb']['Global'];
+
+// Get a list of current global codes
+$payCodes = $PayCode->getList("T.ref_type = $refPaycodeType");
+if ($payCodes) {
+ $havePayCodes = true;
+}
+
+
+$view = 'eventPaymentCodes';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Notifications
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_notifications.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegNotification.php';
+$Notifications = new GlmDataRegistrationsRegNotification($this->wpdb, $this->config);
+
+$regNotifications = $Notifications->getList("T.reg_event = $regEventID", 'notification_days');
+
+$regEvent = $this->getEntry($regEventID);
+
+$view = 'eventNotifications';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Notifications Update
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_notificationsUpdate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// New and updated notifications
+if (isset($_REQUEST['name']) && is_array($_REQUEST['name'])) {
+
+ foreach ($_REQUEST['name'] as $key=>$val) {
+
+ // Make sure key is positive integer
+ $id = ($key-0);
+ if ($id > 0) {
+
+ // Update existing entry
+ $this->wpdb->update(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification',
+ array(
+ 'name' => $_REQUEST['name'][$id],
+ 'notification_days' => $_REQUEST['notification_days'][$id],
+ 'message' => $_REQUEST['message'][$id]
+ ),
+ array( 'id' => $id ),
+ array( '%s', '%d', '%s' ),
+ array( '%d' )
+ );
+
+ // Otherwise if the id is less than 0 it must be a new one
+ } elseif ($id < 0) {
+
+ // Insert a new entry
+ $this->wpdb->insert(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification',
+ array(
+ 'reg_event' => $regEventID,
+ 'name' => $_REQUEST['name'][$id],
+ 'notification_days' => $_REQUEST['notification_days'][$id],
+ 'message' => $_REQUEST['message'][$id]
+ ),
+ array( '%d', '%s', '%d', '%s' )
+ );
+ }
+ }
+}
+
+// Delete Notifications
+if (isset($_REQUEST['delete']) && is_array($_REQUEST['delete'])) {
+
+ $ids = '';
+ foreach ($_REQUEST['delete'] as $key=>$val) {
+
+ // Make sure key is positive integer
+ $id = ($key-0);
+ if ($id > 0) {
+ $this->wpdb->delete( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', array( 'ID' => $id ), array( '%d' ) );
+ }
+
+ }
+}
+
+
+$regNotifyUpdated = true;
+
+// Fall through to get the data again
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/registrations/events_notifications.php';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Events Payment Codes
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_paymentCodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataPaymentCode.php';
+$PayCode = new GlmDataRegistrationsPaymentCode($this->wpdb, $this->config);
+
+if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') {
+ switch($_REQUEST['option2']) {
+
+ case 'new':
+ $PayCode->insertEntry();
+ break;
+
+ case 'update':
+ $payCodeId = ($_REQUEST['payCodeId'] - 0);
+ $x = $PayCode->updateEntry($payCodeId);
+ break;
+
+ case 'delete':
+ $payCodeId = ($_REQUEST['payCodeId'] - 0);
+ if ( $payCodeId > 0 ) {
+ $PayCode->deleteEntry( $payCodeId, true );
+ }
+ break;
+ }
+}
+
+$newPayCode = $PayCode->newEntry();
+
+// Specify the pay code type number that should be used.
+$refPaycodeType = $this->config['pay_code_ref_type_numb']['Event'];
+
+$payCodes = $PayCode->getList("T.ref_type = $refPaycodeType");
+
+if ($payCodes) {
+ $havePayCodes = true;
+}
+
+$regEvent = $this->getEntry($regEventID);
+
+$view = 'eventPaymentCodes';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Registrants
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_registrants.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$whereParts = array();
+
+if (isset($_REQUEST['textSearch']) && trim($_REQUEST['textSearch'] != '')) {
+ $textSearch = trim($_REQUEST['textSearch']);
+ $whereParts[] = "concat( T.fname, ' ', T.lname) LIKE '%".$textSearch."%'";
+
+ // Clean up for use in redisplaying search value
+ $textSearch = stripslashes($textSearch);
+}
+
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php';
+$Registrants = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config);
+
+// Get the regEvent data
+$regEvent = $this->getEntry($regEventID);
+
+// Filter for complete if given
+if ( isset( $_REQUEST['complete'] ) && filter_var( $_REQUEST['complete'], FILTER_VALIDATE_BOOLEAN) ) {
+ $completed = true;
+ $whereParts[] = "T.reg_request in (
+ SELECT id
+ FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request
+ WHERE status = {$this->config['submission_status_numb']['COMPLETE']})";
+}
+
+// Get list of all registrants for this event
+$where = implode( ' AND ', $whereParts );
+
+// Check if we're doing paging
+if ( isset( $_REQUEST['pageSelect'] ) ) {
+
+ // If request is for Next
+ if ( $_REQUEST['pageSelect'][0] == 'N' ) {
+ $newStart = $_REQUEST['nextStart'] - 0;
+
+ // Otherwise it must be Previous
+ } else {
+ $newStart = $_REQUEST['prevStart'] - 0;
+ }
+
+ if ($newStart > 0) {
+ $start = $newStart;
+ }
+}
+
+$customFieldsPluginActive = apply_filters( 'glm-members-customfields-plugin-active', false );
+
+$listResult = $Registrants->getFullRegistrantsData($regEventID, $where, $start, $limit);
+// echo '<pre>$listResult: ' . print_r( $listResult['list'], true ) . '</pre>';
+
+// Get count of registrants listed
+$registrantCount = $listResult['totalCount'];
+
+// If the number of registrants is less than a page, don't do paging
+if ($registrantCount <= $limit) {
+ // $paging = false;
+}
+
+// Get paging results
+$numbDisplayed = $listResult['returned'];
+$lastDisplayed = $listResult['last'];
+if ($start == 1) {
+ $prevStart = false;
+} else {
+ $prevStart = $start - $limit;
+ if ($start < 1) {
+ $start = 1;
+ }
+}
+if ($listResult['returned'] == $limit) {
+ $nextStart = $start + $limit;
+}
+$registrants = $listResult['list'];
+
+$success = true;
+$haveRegistrants = false;
+if ($registrants !== false) {
+
+ $success = true;
+
+ // If we have any entries
+ if (count($registrants) > 0) {
+ $haveRegistrants = true;
+ }
+}
+// echo "<pre>".print_r($registrants,1)."</pre>";
+
+$view = 'eventRegistrants';
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Registrations Event Updatge
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release events_update.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+
+// 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;
+}
+
+$view = 'eventEdit';
<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}">Dashboard For Last Selected Event</a>
+ <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=globalCodes" class="nav-tab{if $option==globalCodes} nav-tab-active{/if}">Global Payment Codes</a>
</h2>
<div id="glm-admin-content-container">
{include file='admin/registrations/eventHeader.html'}
-{include file='admin/registrations/eventSubTabs.html'}
+{if $option != 'globalCodes'}
+ {include file='admin/registrations/eventSubTabs.html'}
+{/if}
<div>
- <a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Event Payment Code</a>
- <h1>Registration Event Payment Codes</h1>
+{if $option == 'globalCodes'}
+ <h1>Global Payment Codes</h1>
+{else}
+ <h1>Event Payment Codes</h1>
+{/if}
</div>
<div> </div>
<!-- Add Registration Payment Code Button and Dialog Box -->
<div id="newPaymentCodeDialog" class="glm-dialog-box" title="Enter a New Payment Code" stye="">
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+{if $option == 'globalCodes'}
+ <input type="hidden" name="option" value="globalCodes">
+{else}
<input type="hidden" name="option" value="paymentCodes">
+{/if}
<input type="hidden" name="option2" value="new">
<table class="glm-admin-table">
<tr>
<tr>
<td>
<input type="hidden" value="{$eventPaycodeType}" name="ref_type">
+{if $option == 'globalCodes'}
+ <input type="hidden" value="0" name="ref_dest">
+{else}
<input type="hidden" value="{$regEventID}" name="ref_dest">
+{/if}
</td>
</tr>
<tr>
<!-- Edit Registration Payment Code Dialog Box -->
<div id="editPaymentCodeDialog" class="glm-dialog-box" title="Edit this Payment Code">
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+{if $option == 'globalCodes'}
+ <input type="hidden" name="option" value="globalCodes">
+{else}
<input type="hidden" name="option" value="paymentCodes">
+{/if}
<input type="hidden" name="option2" value="update">
<input id="payCodeId" type="hidden" name="payCodeId" value="">
</tr>
</thead>
<tbody>
+ <tr><td colspan="6"> </td></tr>
+ <tr>
+{if $option == 'globalCodes'}
+ <th colspan="5"><h3>Payment codes that apply to any event</h3></th>
+ <td><a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Global Payment Code</a></td>
+{else}
+ <th colspan="5"><h3>Payment codes that apply to any registrations for this event</h3></th>
+ <td><a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Event Payment Code</a></td>
+{/if}
+ </tr>
{if $havePayCodes}
{assign var="i" value="0"}
{foreach $payCodes as $p}
});
$('#deletePaymentCodeConfirm').click( function() {
$("#deletePaymentCodeDialog").dialog("close");
+{if $option == 'globalCodes'}
+ window.location.href = "{$thisUrl}?page={$thisPage}&option=globalCodes&option2=delete&payCodeId=" + id;
+{else}
window.location.href = "{$thisUrl}?page={$thisPage}&option=paymentCodes&option2=delete&payCodeId=" + id;
+{/if}
});
$('#deletePaymentCodeCancel').click( function() {
$("#deletePaymentCodeDialog").dialog("close");
<hr class="glm-reg-class-separator">
{/if}
{/foreach} {* classes *}
+ {if $event}
+ {foreach $event.payCodes as $payCode}
+ <div class="row glm-reg-cart-event-discount">
+ <div class="small-8 medium-8 column glm-reg-right glm-reg-cart-label">
+ Discount Code: "{$payCode.code}",
+ {if $payCode.code_type == 'Free'}Free{/if}
+ {if $payCode.code_type =='Amount'}${$payCode.amount|number_format:2}{/if}
+ {if $payCode.code_type == 'Percent'}{$payCode.amount}%{/if}
+ </div>
+ <div class="small-4 medium-4 column glm-reg-right glm-reg-cart-data">
+ ${$payCode.thisDiscount|number_format:2}
+ </div>
+ </div>
+ {/foreach}
+ {/if}
{if $event.eventDiscounts > 0}
<div class="row glm-reg-cart-event-discount">
<div class="small-8 medium-8 column glm-reg-right glm-reg-cart-label">
{$terms.reg_term_registration_cap} Request Totals
</div>
</div>
+{if $cart.globalPayCodes}
+ {foreach $cart.globalPayCodes as $payCode}
+ <div class="row glm-reg-cart-event-discount">
+ <div class="small-8 medium-8 column glm-reg-right glm-reg-cart-label">
+ Discount Code: "{$payCode.code}",
+ {if $payCode.code_type == 'Free'}Free{/if}
+ {if $payCode.code_type =='Amount'}${$payCode.amount|number_format:2}{/if}
+ {if $payCode.code_type == 'Percent'}{$payCode.amount}%{/if}
+ </div>
+ <div class="small-4 medium-4 column glm-reg-right glm-reg-cart-data">
+ ${$payCode.thisDiscount|number_format:2}
+ </div>
+ </div>
+ {/foreach}
+{/if}
{if $cart.totalDiscounts > 0}
<div class="row glm-reg-cart-total-discounts">
<div class="small-12 medium-8 column glm-reg-right glm-reg-cart-label">
Total {$terms.reg_term_attendee_plur}: {$cart.totalRegistrants}
</div>
<div class="small-12 medium-4 column glm-reg-right glm-reg-cart-total">
- Total: ${$cart.totalCharges|number_format:2}
+ Total Cost: ${$cart.grandTotal|number_format:2}
</div>
</div>
</div>