'event_name' => array (
'field' => 'event_name',
'type' => 'text',
- 'required' => true,
- 'use' => 'a'
+ 'required' => false,
+ 'use' => 'lgned'
),
// A short code used to reference this event
// Try to get the base information - and extended data from the Event add-on if requested
if ($id > 0) {
- $eventData = $this->getEntry($id, 'id', $forEdit);
+ $eventData = $this->getEntry($id, 'id', ' TRUE ', $forEdit);
if (!$eventData) {
return false;
}
//echo "<pre>".print_r($regEventSample,1)."</pre>";
+/* Sample actual data for reference for a complete event (this one doesn't include classes and times yet)
+
+Array
+(
+ [id] => 61
+ [event] => 2
+ [event_name] => Active Time
+ [event_code] => active-time
+ [notify_email] => cscott@gaslightmedia.com
+ [admin_active] => Array
+ (
+ [list] =>
+ [value] => 0
+ [name] => No
+ )
+
+ [active] => Array
+ (
+ [list] =>
+ [value] => 1
+ [name] => Yes
+ )
+
+ [time_specific] => Array
+ (
+ [list] =>
+ [value] => 0
+ [name] => No
+ )
+
+ [attendees] => Array
+ (
+ [list] =>
+ [value] => 0
+ [name] => No
+ )
+
+ [attendee_max] => 0
+ [attendee_max_per_reg] => 0
+ [reg_hold_minutes] => 60
+ [cart_hold_days] => 10
+ [registration_account_options] => Array
+ (
+ [bitmap] => Array
+ (
+ [1] => Array
+ (
+ [name] => Guest Registration
+ [nameEsc] => Guest Registration
+ [value] => 1
+ [default] => 1
+ )
+
+ [2] => Array
+ (
+ [name] => Saved Registration Accounts
+ [nameEsc] => Saved Registration Accounts
+ [value] => 2
+ [default] => 1
+ )
+
+ [3] => Array
+ (
+ [name] => Member Contact Registrations
+ [nameEsc] => Member Contact Registrations
+ [value] => 3
+ [default] => 1
+ )
+
+ )
+
+ [value] => 14
+ [names] => Array
+ (
+ [1] => Guest Registration
+ [2] => Saved Registration Accounts
+ [3] => Member Contact Registrations
+ )
+
+ )
+
+ [payment_methods] => Array
+ (
+ [bitmap] => Array
+ (
+ [1] => Array
+ (
+ [name] => No Charge
+ [nameEsc] => No Charge
+ [value] => 1
+ [default] =>
+ )
+
+ [2] => Array
+ (
+ [name] => Comp Code
+ [nameEsc] => Comp Code
+ [value] => 2
+ [default] => 1
+ )
+
+ [3] => Array
+ (
+ [name] => Cash
+ [nameEsc] => Cash
+ [value] => 3
+ [default] =>
+ )
+
+ [4] => Array
+ (
+ [name] => Check
+ [nameEsc] => Check
+ [value] => 4
+ [default] =>
+ )
+
+ [5] => Array
+ (
+ [name] => Credit Card
+ [nameEsc] => Credit Card
+ [value] => 5
+ [default] => 1
+ )
+
+ [6] => Array
+ (
+ [name] => Call from Merchant
+ [nameEsc] => Call from Merchant
+ [value] => 6
+ [default] =>
+ )
+
+ [99] => Array
+ (
+ [name] => Undefined
+ [nameEsc] => Undefined
+ [value] => 99
+ [default] =>
+ )
+
+ )
+
+ [value] => 36
+ [names] => Array
+ (
+ [2] => Comp Code
+ [5] => Credit Card
+ )
+
+ )
+
+ [restricted_payment_methods] => Array
+ (
+ [bitmap] => Array
+ (
+ [1] => Array
+ (
+ [name] => No Charge
+ [nameEsc] => No Charge
+ [value] => 1
+ [default] => 1
+ )
+
+ [2] => Array
+ (
+ [name] => Comp Code
+ [nameEsc] => Comp Code
+ [value] => 2
+ [default] =>
+ )
+
+ [3] => Array
+ (
+ [name] => Cash
+ [nameEsc] => Cash
+ [value] => 3
+ [default] => 1
+ )
+
+ [4] => Array
+ (
+ [name] => Check
+ [nameEsc] => Check
+ [value] => 4
+ [default] => 1
+ )
+
+ [5] => Array
+ (
+ [name] => Credit Card
+ [nameEsc] => Credit Card
+ [value] => 5
+ [default] =>
+ )
+
+ [6] => Array
+ (
+ [name] => Call from Merchant
+ [nameEsc] => Call from Merchant
+ [value] => 6
+ [default] =>
+ )
+
+ [99] => Array
+ (
+ [name] => Undefined
+ [nameEsc] => Undefined
+ [value] => 99
+ [default] =>
+ )
+
+ )
+
+ [value] => 26
+ [names] => Array
+ (
+ [1] => No Charge
+ [3] => Cash
+ [4] => Check
+ )
+
+ )
+
+ [descr] => This is a description of registrations for this event. This is not the same as the event description that is stored in the Events add-on. This one is specific to registrations for this event.
+ [terms] => asdasdasdasd
+ [reg_file] =>
+ [reg_file_title] => asdasdasd
+ [form_revision] => 0
+ [notes] => asdasdaaddadadad
+ [reg_time] =>
+ [reg_class] => Array
+ (
+ [22] => Array
+ (
+ [id] => 22
+ [reg_event] => 61
+ [name] => Admiral Class
+ [descr] => This is our Admiral Class registration level.
+ [reg_rate] => Array
+ (
+ [17] => Array
+ (
+ [id] => 17
+ [reg_event] => 61
+ [reg_class] => 22
+ [name] => Rate Name
+ [start_days] => 100
+ [end_days] => 50
+ [base_rate] => $20.00
+ [per_registrant] => $10.00
+ [registrant_credits] => 1
+ )
+
+ )
+
+ )
+
+ )
+
+)
+
+*/
// Defaults
defaults: {
id: null,
- parent: 0,
+// parent: 0,
reg_event: 0,
name: '',
descr: '',
$regEventAdded = false;
$reason = false;
$regEventSample = false;
- $regEventJason = false;
- $regClassJSON = false;
-
+ $regEventJSON = false;
+ $regClassesJSON = false;
+ $regTimesJSON = false;
+
// Get any provided option
if (isset($_REQUEST['option'])) {
$option = $_REQUEST['option'];
$regEventID = false;
}
-
-
switch ($option) {
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/adminRegApp.js',
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
+ // Get all current registration event data
+ $regEvent = $this->getEventConfig($regEventID, false, false, true);
- $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 );
+ // Make all arrays of arrays non-associative to make Backbone happy
+ foreach ($regEvent['reg_class'] as $k=>$v) {
+ $regEvent['reg_class'][$k]['reg_rate'] = array_values($regEvent['reg_class'][$k]['reg_rate']);
}
- $regClassJSON = '[' . implode( ',', $jsonClasses ) . ']';
-
+ $regEvent['reg_class'] = array_values($regEvent['reg_class']);
+ $regEvent['reg_time'] = array_values($regEvent['reg_time']);
+
+ // Separate Event, Classes, and Times and send those as separate JSONs
+ $regClassesJSON = json_encode($regEvent['reg_class']);
+ $regTimesJSON = json_encode($regEvent['reg_time']);
+
+ // Get rid of class and time arrays so we just have the event data
+ unset($regEvent['reg_class']);
+ unset($regEvent['reg_time']);
+ $regEventJSON = json_encode($regEvent);
+
$view = 'eventEditLevels';
break;
// Try to get the event configuration including recurrences and times
$this->postProcAddedEventData = true;
- $regEvent = $this->getEventConfig($regEventID, true, true, true);
+ $regEvent = $this->getEventConfig($regEventID, true, false, true);
// If we have the event data
if ($regEvent) {
'regEventAdded' => $regEventAdded,
'reason' => $reason,
- 'entry' => $regEventSample,
- 'thisJsUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
- 'regEventJSON' => json_encode( $regEventSample['reg_event'] ),
- 'regClassJSON' => $regClassJSON,
-
+ 'entry' => $regEventSample,
+ 'thisJsUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js',
+ 'regEventJSON' => $regEventJSON,
+ 'regClassesJSON' => $regClassesJSON,
+ 'regTimesJSON' => $regTimesJSON
);
// Return status, any suggested view, and any data to controller
<table id="glm-table-settings" class="glm-registrations-table">
<tr>
- <th {if $regEvent.fieldRequired.event_name}class="glm-required-nowrap-left-align"{else}class="glm-nowrap-left-align"{/if}>Event Name</th>
- <td {if $regEvent.fieldFail.event_name}class="glm-form-bad-input" data-tabid="glm-event_name"{/if}>
- <input type="text" name="event_name" value="{$regEvent.fieldData.event_name}" class="glm-form-text-input-medium">
- {if $regEvent.fieldFail.event_name}<p>{$regEvent.fieldFail.event_name}</p>{/if}<br>
+ <th class="glm-nowrap-left-align">Event Name</th>
+ <td>
+ {$regEvent.fieldData.event_name}
</td>
</tr>
<tr>
<script type="text/template" id="regEvent-template">
<div style="margin-bottom: 1em;">
<a id="add-reg-level" class="button button-secondary glm-button glm-right">Add a Registration Level</a>
- <h3>Registration Levels</h3>
- </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">
+ <h3>Event: <%= event_name %></h3>
+ <p><%= descr %></p>
</div>
</script>
<input class="class-descr" type="text" name="reg_descr_<% if (id) { %><%- id %><% } else { %> new <% } %>" size="90" value="<% if (descr) { %><%- descr %><% } %>">
</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 type="text/template" id="regRate-template">
+ <div>Registration Rate Template</div>
</script>
-
+
{/literal}
-
+
<div class="glm-reg-event-list" id="regApp">
</div>
{* And create the RegClasses collection *}
<script>
//var $=jQuery.noConflict();
- var appLoginUrl = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=login';
var ajaxUrl = '{$ajaxUrl}?action=glm_members_admin_ajax';
var app = {
- Models: { Front: {}, Admin: {} },
- Collections: { Front: {}, Admin: {} },
- Views: { Front: {}, Admin: {} },
+ Models: { Admin: {} },
+ Collections: { Admin: {} },
+ Views: { Admin: {} },
};
var regEvent = '';
jQuery(function($){
- regEvent = new app.Models.Admin.RegEvent;
- regEvent.set( {$regEventJSON} );
- regEvent.setClasses( {$regClassJSON} );
+ regEvent = new app.Models.Admin.RegEvent;
+ regEvent.setClasses({$regClassesJSON});
+// regEvent.setTimes({$regTimesJSON});
+ regEvent.set( {$regEventJSON} );
new app.Views.Admin.EventEditLevels();
});
</script>
<tr class="alternate">
{/if}
<td style="width: 50px;">
- {$r.id}
+ <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard®EventID={$r.id}">{$r.id}</a>
</td>
<td>
<a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard®EventID={$r.id}">{$r.event_name}</a>