Event Amenity setting now using the event management name for amenities (beer types).
Event amenities now working on edit event page.
Event amenities now working for the setting page.
Setting: add edit delete amenities working.
Event edit page: adding editing deleting amenities to event working.
public $dateRange = "start_time >= now()";
public $postFirstAndLastTimes = false;
public $postCategories = true;
+ public $postAmenities = true;
/**
* Constructor
$r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
}
+ if ( isset( $this->postAmenities ) && $this->postAmenities ) {
+ $sql = "
+ SELECT EC.event AS event_id, C.id, C.name
+ FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "amenities AS C,
+ ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "amenity_event AS EC
+ WHERE C.id = EC.amenity
+ AND EC.event = ".$r['id']."
+ ;";
+ $r['amenities'] = $this->wpdb->get_results($sql, ARRAY_A);
+ }
+
if ($this->postAddTimes) {
include_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataTimes.php';
$timeData = new GlmDataEventsTimes( $this->wpdb, $this->config );
// Get a list of categories
$Categories = new GlmDataEventsCategories($this->wpdb, $this->config);
$categories = $Categories->getListSortedParentChild(false);
-
+
// Get a list of amenities
$Amenities = new GlmDataEventsAmenities($this->wpdb, $this->config);
$amenities = $Amenities->getList(false);
$this->updateCategories();
$categories = $Categories->getListSortedParentChild(false);
-
+
$this->updateAmenities();
$amenities = $Amenities->getList(false);
$event = $this->editEntry($this->eventID);
+ //echo '<pre>$event: ' . print_r( $event, true ) . '</pre>';
+
if ($event['status']) {
$haveEvent = true;
}
$this->updateCategories();
$categories = $Categories->getListSortedParentChild(false);
-
+
$this->updateAmenities();
$amenities = $Amenities->getList(false);
while (list($k, $v) = each($categories)) {
$categories[$k]['selected'] = false;
}
-
+
// Check if there is a category filter (multi-select)
if (isset($_REQUEST['filterCategories']) && count($_REQUEST['filterCategories']) > 0) {
// require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEventAmenities.php';
// echo "Test 1";
// $Amenities = new GlmDataEventsAmenities($this->wpdb, $this->config);
-//
+//
// $this->amenities = $Amenities->getList("T.id = ".$this->eventID);
// echo "<pre>Test 2:" . print_r($this->amenities, true) . " End Test 2</pre>";
-//
+//
// // Get list of Amenities selected for this Event
// $this->eventAmenities = $Amenities->getAmenityRef($this->eventID);
// echo "<pre>Test 3:" . print_r($this->eventAmenities, true) . " End Test 3</pre>";
'limit' => $limit,
'namesList' => $namesList,
'eventDefaultState' => $this->config['settings']['event_default_state'],
-
+
);
// Return status, any suggested view, and any data to controller
}
}
-
+
/*
* Check for new Cities being added
*
// Try to get the first (should be only) entry for general settings.
$event_settings = $this->editEntry(1);
+ //echo '<pre>$event_settings: ' . print_r( $event_settings, true ) . '</pre>';
if ($event_settings === false) {
*/
// Load Amenities data abstract
-require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEventAmenities.php';
-require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEventGroups.php';
+require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataAmenities.php';
/*
* This class performs the work for the default action of the "Members" menu
*/
public function modelAction ( $actionData = false )
{
- echo "TEST 1";
- $success = true;
- $haveAmenities = false;
- $haveGroups = false;
- $amenities = false;
- $error = false;
- $option2 = '';
- $newAmenity = $this->newEntry();
+ $success = true;
+ $haveAmenities = false;
+ $haveGroups = false;
+ $amenities = false;
+ $error = false;
+ $option2 = '';
+ $newAmenity = $this->newEntry();
+ $enable_members = $this->config['settings']['enable_members'];
// Check if a category ID is supplied
$id = 0;
if ( isset( $_REQUEST['id'] ) ) {
$id = $_REQUEST['id'] - 0;
}
- echo "TEST 1.3";
- $groupData = new GlmDataEventGroups( $this->wpdb, $this->config );
- echo "TEST 1.4";
// If there's an action option
if ( isset( $_REQUEST['option'] ) ) {
switch( $_REQUEST['option'] ) {
case 'updateGroup':
if ( $id > 0 ) {
$groupData->updateEntry( $id );
- }
+ }
break;
case 'deleteGroup':
array( 'group_id' => $id ),
array( '%d' )
);
- }
+ }
break;
default:
- echo "TEST 4";
$option2 = false;
break;
}
}
- echo "TEST 1.4";
if ( isset( $_REQUEST['option2'] ) ) {
$option2 = $_REQUEST['option2'];
}
- echo "TEST 1.5";
// Get a current list of amenities
$amenities = $this->getList();
- echo "TEST 2";
- echo '<pre>$amenities: ' . print_r($amenities, true) . '</pre>';
if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) {
glmMembersAdmin::addNotice( $amenities, 'DataBlock', 'Amenities Data' );
}
- echo "TEST 3";
// If we have list entries - even if it's an empty list
$success = true;
$haveAmenities = false;
$haveAmenities = true;
}
}
- echo "TEST 4";
- $groups = $groupData->getList();
- echo '<pre>$groups: ' . print_r($groups, true) . '</pre>';
-
- if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) {
- glmMembersAdmin::addNotice( $groups, 'DataBlock', 'Amenity Groups Data' );
- }
-
- if ( $groups !== false ) {
- $success = true;
-
- // If we have any entries.
- if ( count( $groups ) > 0 ) {
- $haveGroups = true;
- }
- }
-
// If we had a fatal error, redirect to the error page
if ($error) {
return array(
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice( $amenities, 'DataBlock', 'Amenities Data' );
}
- echo "TEST FIN";
// Compile template data
$templateData = array(
- 'haveAmenities' => $haveAmenities,
- 'haveGroups' => $haveGroups,
- 'amenities' => $amenities,
- 'groups' => $groups,
- 'option2' => $option2,
- 'newAmenity' => $newAmenity,
+ 'enable_members' => $enable_members,
+ 'haveAmenities' => $haveAmenities,
+ 'haveGroups' => $haveGroups,
+ 'amenities' => $amenities,
+ 'groups' => null,
+ 'option2' => $option2,
+ 'newAmenity' => $newAmenity,
);
// Return status, suggested view, and data to controller
return $addOnTabs;
}
);
-
+
add_filter('glm-member-db-add-tab-for-settings',
function($addOnTabs) {
+ //echo '<pre>$config: ' . print_r( $GLOBALS['config'], true ) . '</pre>';
$newTabs = array(
array(
- 'text' => 'Event Amenities',
+ 'text' => 'Event ' . $GLOBALS['config']['settings']['term_event_amenities_plural'],
'menu' => 'settings',
'action' => 'eventAmenities'
),
);
}
-}
\ No newline at end of file
+}
{else}
<a href="{$thisUrl}?page={$thisPage}&glm_action=list" class="button button-secondary glm-button glm-right">Return to Events List</a>
{/if}
-
+
{if $option == 'edit' || $option == 'update'}
<a id="deleteEventButton" class="button button-secondary glm-button glm-right">Delete this Event</a>
<h2>Edit Event</h2>
{else}
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="list">
-
+
{/if}
{/if}
<input type="hidden" name="ref_type" value="{$ref_type_numb.Member}">
<div id="eventCalendar"></div>
<p>
<b>NOTE:</b> This calendar does not show changes you have made until you have
- clicked on the "Update Event" button to save your changes.
+ clicked on the "Update Event" button to save your changes.
</td>
</tr>
</table>
<!-- Admin Contact -->
{include file='admin/events/editAdminContact.html'}
-
+
<input id="updateEvent" type="submit" value="{if $haveEvent}Update Event{else}Save New Event{/if}">
</form>
recurrencesInited = true;
}
- if (table == 'glm-table-location') {
-
+ if (table == 'glm-table-location') {
+
if (!locationsInited) {
-
+
// Make sure there's at least one location
{if !$locations}
addNewLocationForm();
{/if}
-
+
initLocations();
initNewCity();
locationsInited = true;
-
+
}
// Check Use Member Location checkbox
memberID = $('#memberSelect').val();
if (memberID == '') {
-
- // No member selected - Clear checkbox, Dissable checkbox, Show location
+
+ // No member selected - Clear checkbox, Dissable checkbox, Show location
$('#useMemberLocationCheckbox').prop('checked', false);
$('#useMemberLocationCheckbox').prop('disabled', true);
$('#useMemberMessage').addClass('glm-hidden');
$('#notUseMemberMessage').removeClass('glm-hidden');
$('#locationContainer').removeClass('glm-hidden');
-
+
} else {
-
+
// Member set - Enable checkbox
$('#useMemberLocationCheckbox').prop('disabled', false);
$('#useMemberMessage').removeClass('glm-hidden');
$('#notUseMemberMessage').addClass('glm-hidden');
-
+
}
}
-
+
if (table == 'glm-table-calendar' && !fullCalendarLoaded) {
// **** Should probably move all this to a function and check if it's been initialized already
}
-*/
+*/
{/if}
});
fullCalendarLoaded = true;
-
+
}
// Count remaining characters in field
$('.glm-char-count').keyup( function() {
glmCharsRemaining($(this));
});
-
+
});
/*
// Get lat and lon from the input fields
var glmLat = $('#glmLat_' + locID).val();
var glmLng = $('#glmLng_' + locID).val();
-
+
// If Lat and Lon for this event are currently set to default, then set that location to mapLocationAuto true.
mapLocationAuto[locID] = false;
if (glmLat == {$settings.maps_default_lat} || glmLng == {$settings.maps_default_lon}) {
- mapLocationAuto[locID] = true;
+ mapLocationAuto[locID] = true;
}
-
+
// Delete a location
$('.delete-location').on( 'click', function() {
locID = $(this).attr('data-id');
initMap(locID);
initNewCity();
-
+
// Listen for changes in the lat/lon inputs
$('.latLonRecenter').on('click', function() {
mapLocationAuto[locID] = false;
locID = $(this).attr('data-id');
-
+
// Get lat and lon from the input fields
var glmLat = $('#glmLat_' + locID).val();
var glmLng = $('#glmLng_' + locID).val();
-
+
location[locID] = new google.maps.LatLng(glmLat, glmLng);
-
+
initMap(locID);
-
+
return false;
-
+
});
}
-
+
/*
* This is used to initialize all of the locations when the location tab is first clicked.
$('#' + recurID + '_recurUpdated').val(recurID);
glmPageUpdateRequired();
});
-
- initDateDelete();
+
+ initDateDelete();
initCalendars();
-
+
} // Init Recurrence
$('.recur-spec-date-delete').unbind();
$('.recur-spec-date-delete').on('click', function() {
if (confirm("Do you want to delete this date?")) {
- $(this).remove();
+ $(this).remove();
glmPageUpdateRequired();
}
});
}
-
- // Initialize specific date selection calendards
+
+ // Initialize specific date selection calendards
function initCalendars() {
-
+
// Initialize Calendar for date selection
var renderedExistingEvents = 0;
$('.recur-calendar').on('click', function() {
recurID = $(this).attr('data-id');
recurName = $('#recurSchedName_' + recurID).val();
-
+
if (recurName == undefined || recurName == '') {
recurName = '(no schedule name)';
}
$('#recurCalendarDialog_' + recurID).attr('title', 'Select Dates for ' + recurName);
-
+
$('#recurCalendarDialog_' + recurID).dialog({
minWidth: 600
});
// Color to change calendar cell to (in rgb so it compares to our test below)
var calClickColor = 'rgb(173, 216, 230)';
- var newCalEventID = 0;
-
+ var newCalEventID = 0;
+
var thisCal = $('#recurCalendar_' + recurID).fullCalendar({
header : {
left: 'title',
fixedWeekCount : false,
eventAfterAllRender: function(view) {
-
- // Since this will be called again when we add the events below,
+
+ // Since this will be called again when we add the events below,
// we have to detect if it's a second call
if (renderedExistingEvents != recurID) {
renderedExistingEvents = recurID;
-
+
// Collect specified dates for this recurrence
$('.recur-spec-date-' + recurID).each(function() {
var date = $(this).val();
var dateID = $(this).attr('data-id');
-
+
var e = {
id: dateID,
start: date,
title: 'Selected'
};
$('#recurCalendar_' + recurID).fullCalendar( 'renderEvent', e, true);
-
+
});
}
},
-
+
// Event handler for when a date is clicked
dayClick: function(date, allDay, jsEvent, view) {
-
+
var dateHasEvent = false;
-
+
// Check if there's an event for this date
thisCal.fullCalendar('clientEvents', function (event) {
if (moment(event.start).isSame(date, 'day')) {
-
+
// Say that we had an event already
dateHasEvent = true;
-
+
// Remove the event from the calendar
thisCal.fullCalendar( 'removeEvents', event.id);
-
+
// Remove the event from the selected dates list
$('#recurSpecDate_' + recurID + '_' + event.id).remove();
-
+
}
});
-
+
// If there wasn't an event already, add one now
if (!dateHasEvent) {
-
+
// Create event for this date
var e = {
id: ++newCalEventID,
start: date,
title: 'Selected'
};
-
- // Add an event to this date
+
+ // Add an event to this date
thisCal.fullCalendar( 'renderEvent', e, true);
-
+
// Add this edate to our selected dates list
$('#recurSpecDates_' + recurID).append(
'<span id="recurSpecDate_' + recurID + '_' + newCalEventID + '" class="button glm-button-small recur-spec-date-delete"><input name="Recur' + recurID + '_specDate[' + newCalEventID + ']" type="hidden" data-id="' + recurID + '" value="' + date.format() + '" class="recur-spec-date-' + recurID + '">' + date.format() + '</span>'
);
-
+
initDateDelete();
-
+
}
-
+
glmPageUpdateRequired();
$('#' + recurID + '_recurUpdated').val(recurID);
},
-
+
// Event handler for when an event is clicked
eventClick: function(calEvent, jsEvent, view) {
-
+
var id = calEvent.id;
-
+
// Remove the event from the calendar
thisCal.fullCalendar( 'removeEvents', id);
-
+
// Remove the event from the selected dates list
$('#recurSpecDate_' + recurID + '_' + id).remove();
glmPageUpdateRequired();
-
- }
-
+
+ }
+
}); // fullCalendar
-
+
}); // Click on "Show Calendar"
- }
-
+ }
+
/*
* Category Selection
*/
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
-
+
/*
* Amenity Selection
*/
// Get the ID, name, and parent of the amenity
var amenityValue = $('#amenitySelect').val();
var amenityName = $('#amenitySelect').find(':selected').text();
- var amenityParent = $('#amenitySelect').find(':selected').attr('data-parent');
// Check if the amenity has already been added
var found = false;
// Check if there's a parent
parentName = '';
- if (amenityParent != '') {
- parentName = amenityParent + ': ';
- }
// If not found, Add the amenity
if (!found) {
/*
* Misc support items
*/
-
+
// Hide description of cost if Free is checked
$('#freeEventCheckbox').on('click', function() {
if ($('#freeEventCheckbox')[0].checked) {
$('#descriptionOfCostField').removeClass('glm-hidden');
}
});
-
+
// Hide location if use member location checked
$('#useMemberLocationCheckbox').on('click', function() {
if ($(this)[0].checked) {
$('.glm-char-count').keyup( function() {
glmCharsRemaining($(this));
});
-
+
// Set masking for phone number fields - see http://digitalbush.com/projects/masked-input-plugin/
$.mask.definitions['e'] = "[A-Za-z0-9: ]";
$(".glm-phone-input").mask("999-999-9999? eeeeeeeeeee");
-
+
// Flash certain elements for a short time after display
$(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
</td>
</tr>
<tr>
- <th>Amenities</th>
+ <th>{$settings.term_event_amenities_plural}</th>
<td class="glm-item-container">
<!-- Add new amenity dialog -->
- <div id="newAmenityButton" class="button button-secondary glm-right">Add a new Amenity</div>
- <div id="newAmenityDialog" class="glm-dialog-box" title="Enter a New Amenity">
+ <div id="newAmenityButton" class="button button-secondary glm-right">Add a new {$settings.term_event_amenities_singular}</div>
+ <div id="newAmenityDialog" class="glm-dialog-box" title="Enter a New {$settings.term_event_amenities_singular}">
<table class="glm-admin-table">
<tr>
- <th class="glm-required">Amenity Name:</th>
+ <th class="glm-required">{$settings.term_event_amenities_singular} Name:</th>
<td id="newAmenityNameTD">
<input id="newAmenityName" type="text" name="newAmenityName" class="glm-form-text-input">
<div id="newCatNameRequired"></div>
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newAmenityCancel" class="button button-primary glm-right">Cancel</a>
- <input id="newAmenitySubmit" type="submit" value="Add new Amenity">
+ <input id="newAmenitySubmit" type="submit" value="Add new {$settings.term_event_amenities_singular}">
</div>
<!-- Amenity Selection -->
</option>
{/foreach}
{else}
- <option id="" value="">(No Amenities Listed - Select "Add a new Amenity" to the right. )</option>
+ <option id="" value="">(No Amenities Listed - Select "Add a new {$settings.term_event_amenities_singular}" to the right. )</option>
{/if}
- </select> Select a amenity to add to box below.<br>
+ </select> Select a {$settings.term_event_amenities_singular} to add to box below.<br>
<div id="activeAmenities" class="glm-dynSelect-box">
{if isset($event.fieldData.amenities) && $event.fieldData.amenities}
<option value=""></option>
{foreach from=$eventsSettings.fieldData.event_default_state.list item=v}
<option value="{$v.value}"
- {if ($eventsSettings.fieldData.event_default_state.value == NULL and $settings.default_state == $v.value)
- or $eventsSettings.fieldData.event_default_state.value == $v.value}
+ {if ($eventsSettings.fieldData.event_default_state.value == NULL and $settings.default_state == $v.value)
+ or $eventsSettings.fieldData.event_default_state.value == $v.value}
selected="selected"
{/if}>
{$v.name} {if $v.value == $settings.default_state} (main plugin default) {/if}
<tr>
<th></th>
<td>
- <div class="current-calendar-view">
+ <div class="current-calendar-view">
<label style="font-weight: bold;font-size: 16px;"> Current View:</label><label style="font-size: 14px;"> {if $eventsSettings.fieldData.calendar_view}{$eventsSettings.fieldData.calendar_view}{else} agenda (default){/if} </label>
</div>
</td>
<tr>
<th></th>
<td>
- <input type="checkbox" name="activate_event_amenities">Activate Event Amenities<br><br>
+ <input type="checkbox" name="use_event_amenities" {if $eventsSettings.fieldData.use_event_amenities.value}checked{/if}>Activate Event Amenities<br><br>
</td>
</tr>
<tr>
<th></th>
<td>
<div class="">
-
+
</div>
</td>
</tr>
<th></th>
<td>
<div class="">
-
+
</div>
</td>
</tr>
$('#' + table).removeClass('glm-hidden');
});
-
+
// Flash certain elements for a short time after display
$(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-
+
if('{$eventsSettings.fieldData.calendar_view}'){
$("#calendar-view").val('{$eventsSettings.fieldData.calendar_view}');
} else {
{include file='admin/settings/header.html'}
<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
- <a id="glm-amenities-list" data-show-table="glm-table-event-amenities" class="glm-settings-tab nav-tab nav-tab-active">Event Amenities List</a>
- <a id="glm-groups-list" data-show-table="glm-table-event-groups" class="glm-settings-tab nav-tab">Groups</a>
+ <a id="glm-amenities-list" data-show-table="glm-table-event-amenities" class="glm-settings-tab nav-tab nav-tab-active">Event {$settings.term_event_amenities_plural} List</a>
</h2>
-<table id="glm-table-event-amenities" class="glm-admin-table glm-settings-table{if $option2!=''} glm-hidden{/if}">
+<table id="glm-table-event-amenities" class="glm-admin-table glm-settings-table{if $option2!=''} glm-hidden{/if}" style="width: 90%;">
<tr><td colspan="2">
<!-- Add Event Amenities Button and Dialog Box -->
- <div id="newAmenityButton" class="button button-primary glm-right">Add an Amenity</div>
- <div id="newAmenityDialog" class="glm-dialog-box" title="Enter a New Amenity">
+ <div id="newAmenityButton" class="button button-primary glm-right">Add {$settings.term_event_amenities_singular}</div>
+ <div id="newAmenityDialog" class="glm-dialog-box" title="Enter a New {$settings.term_event_amenities_singular}">
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="eventAmenities">
<input type="hidden" name="option" value="addNew">
<!-- This is only temporary until we reinstate the "Used With" selection below -->
- <input type="hidden" name="ref_type" value="20">
-
<table class="glm-admin-table">
<tr>
- <th class="glm-required">Amenity Name:</th>
+ <th class="glm-required">{$settings.term_event_amenities_singular} Name:</th>
<td>
<input type="text" name="name" class="glm-form-text-input">
</td>
</tr>
- <!--
- <tr>
- <th>Description:</th>
- <td>
- <textarea name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- -->
- <tr>
- <td colspan="2">
- <table style="width: 100%;">
- <thead>
- <tr>
- <td>Groups</td>
- </tr>
- </thead>
- {if $haveGroups}
- {foreach $groups as $group}
- <tr>
- <td>
- <label>
- <input type="hidden" name="grouped[group][{$group.id}]" value="0">
- <input type="checkbox" name="grouped[group][{$group.id}]" value="1">
- {$group.name}
- </label>
- </td>
- <td>
- <label>
- <input type="hidden" name="grouped[searchable][{$group.id}]" value="0">
- <input type="checkbox" name="grouped[searchable][{$group.id}]" value="1">
- Searchable
- </label>
- </td>
- </tr>
- {/foreach}
- {/if}
- </table>
- </td>
- </tr>
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="newAmenityCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new Amenity" class="button button-primary">
-
+ <input type="submit" value="Add new {$settings.term_event_amenities_singular}" class="button button-primary">
+
</form>
</div>
<!-- Delete Event Amenities Button -->
- <div id="deleteAmenityDialog" class="glm-dialog-box" title="Delete Amenity">
+ <div id="deleteAmenityDialog" class="glm-dialog-box" title="Delete {$settings.term_event_amenities_singular}">
<center>
- <p>Are you sure you want to delete this amenity?</p>
- <p><div id="deleteAmenityConfirm" class="button button-primary">Yes, delete this amenity</div></p>
+ <p>Are you sure you want to delete this {$settings.term_event_amenities_singular}?</p>
+ <p><div id="deleteAmenityConfirm" class="button button-primary">Yes, delete this {$settings.term_event_amenities_singular}</div></p>
<p><div id="deleteAmenityCancel" class="button button-primary">Cancel</div></p>
</center>
</div>
<!-- Edit Event Amenities Dialog Box -->
- <div id="editAmenityDialog" class="glm-dialog-box" title="Edit this Amenity">
+ <div id="editAmenityDialog" class="glm-dialog-box" title="Edit this {$settings.term_event_amenities_singular}">
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="eventAmenities">
<input type="hidden" name="option" value="update">
<input id="editAmenityID" type="hidden" name="id" value="">
<!-- This is only temporary until we reinstate the "Used With" selection below -->
- <input type="hidden" name="ref_type" value="20">
-
<table class="glm-admin-table">
<tr>
- <th class="glm-required">Amenity Name:</th>
+ <th class="glm-required">{$settings.term_event_amenities_singular} Name:</th>
<td>
<input id="editAmenityName" type="text" name="name" class="glm-form-text-input">
</td>
</tr>
- <!--
- <tr>
- <th>Description:</th>
- <td>
- <textarea id="editAmenityDescr" name="descr" class="glm-form-textarea"></textarea>
- </td>
- </tr>
- <tr>
- <th>Short Description:</th>
- <td>
- <input id="editAmenityShortDescr" type="text" name="short_descr" class="glm-form-text-input">
- </td>
- </tr>
- -->
- <tr>
- <td colspan="2">
- <table style="width: 100%;">
- <thead>
- <tr>
- <td>Groups</td>
- </tr>
- </thead>
- {if $haveGroups}
- {foreach $groups as $group}
- <tr>
- <td>
- <label>
- <input type="hidden" name="grouped[group][{$group.id}]" value="0">
- <input id="editAmenityGroup_{$group.id}" class="amenityGroup" type="checkbox" name="grouped[group][{$group.id}]" value="1">
- {$group.name}
- </label>
- </td>
- <td>
- <label>
- <input type="hidden" name="grouped[searchable][{$group.id}]" value="0">
- <input id="editAmenityGroupSearchable_{$group.id}" class="amenitySearch" type="checkbox" name="grouped[searchable][{$group.id}]" value="1">
- Searchable
- </label>
- </td>
- </tr>
- {/foreach}
- {/if}
- </table>
- </td>
- </tr>
</table>
<p><span class="glm-required">*</span> Required</p>
<a id="editAmenityCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this Amenity">
-
+ <input type="submit" value="Update this {$settings.term_event_amenities_singular}">
+
</form>
</div>
-
-
- <h2>Event Amenities</h2>
- <table class="wp-list-table wideFat fixed posts glm-admin-table">
+
+ <h2 style="clear:both;">Event {$settings.term_event_amenities_plural}</h2>
+
+ <table class="wp-list-table wideFat fixed posts glm-admin-table" style="width: 90%;">
<thead>
<tr>
- <th>Amenity</th>
- <th>Used With</th>
- <th>Groups</th>
- <!--
- <th>Description</th>
- <th>Short Description</th>
- -->
+ <th>{$settings.term_event_amenities_singular}</th>
<th> </th>
</tr>
</thead>
<tr class="alternate">
{/if}
<td>
- <a class="editAmenity" data-amenityID="{$t.id}" data-refTypeID="{$t.ref_type.value}" data-amenityUsesValue="{$t.uses_value.value}" data-groupjson='{$t.groups_json}'>{$t.name}</a>
- </td>
- <td id="editAmenityRefType_{$t.id}">
- {$t.ref_type.name}
- </td>
- <td id="editAmenityGroups">
- {foreach $t.groups as $group}
- {$groups[$group.group_id].name}
- {/foreach}
+ <a class="editAmenity" data-amenityID="{$t.id}" data-amenityUsesValue="{$t.uses_value.value}">{$t.name}</a>
</td>
- <!--
- <td id="editAmenityDescr_{$t.id}">
- {$t.descr}
- </td>
- <td id="editAmenityShortDescr_{$t.id}">
- {$t.short_descr}
- </td>
- -->
<td>
<div class="deleteAmenityButton button button-secondary glm-button-small glm-right" data-amenityID="{$t.id}">Delete</div>
</td>
</table>
<script type="text/javascript">
jQuery(document).ready(function($) {
-
+
$("#newAmenityDialog").dialog({
autoOpen: false,
minWidth: 400,
$('.editAmenity').click( function() {
var amenityID = $(this).attr('data-amenityID');
var amenityName = $(this).text();
- var amenityRefTypeID = $(this).attr('data-refTypeID');
var amenityUsesValue = parseInt($(this).attr('data-amenityUsesValue'));
var amenityDescr = $('#editAmenityDescr_' + amenityID).html();
var amenityShortDescr = $('#editAmenityShortDescr_' + amenityID).html();
- var amenityGroups = JSON.parse($(this).attr('data-groupjson'));
$('#editAmenityID').val(amenityID);
$('#editAmenityName').val(amenityName.trim());
- $('#editAmenityRef').val(amenityRefTypeID);
$('#editAmenityUsesValue').prop('checked', amenityUsesValue);
- //$('#editAmenityDescr').val(amenityDescr.trim());
- //$('#editAmenityShortDescr').val(amenityShortDescr.trim());
$('.amenityGroup').each(function(){
$(this).prop('checked', false);
});
$('.amenitySearch').each(function(){
$(this).prop('checked', false);
});
- for ( var group in amenityGroups ) {
- console.log( amenityGroups[group] );
- $('#editAmenityGroup_' + amenityGroups[group].group_id).prop('checked', true);
- if ( amenityGroups[group].searchable == "1" ) {
- $('#editAmenityGroupSearchable_' + amenityGroups[group].group_id).prop('checked', true);
- }
- }
$("#editAmenityDialog").dialog("open");
});
$('#editAmenityCancel').click( function() {
});
$('#deleteAmenityConfirm').click( function() {
$("#deleteAmenityDialog").dialog("close");
- window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=amenities&option=delete&id=" + id;
+ window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=eventAmenities&option=delete&id=" + id;
});
$('#deleteAmenityCancel').click( function() {
$("#deleteAmenityDialog").dialog("close");
// Clear tabl highlights and hide all tables
$('.glm-settings-tab').removeClass('nav-tab-active');
$('.glm-settings-table').addClass('glm-hidden');
-
+
// Highlight selected tab
$(this).addClass('nav-tab-active');
-
+
// Show selected table
var table = $(this).attr('data-show-table');
$('#' + table).removeClass('glm-hidden');
-
- });
-
- });
-</script>
-<table id="glm-table-event-groups" class="glm-admin-table glm-settings-table{if $option2!='group'} glm-hidden{/if}">
- <tr>
- <td colspan="2">
- <!-- Add Group Button and Dialog Box -->
- <div id="newGroupButton" class="button button-primary glm-right">Add a Group</div>
- <div id="newGroupDialog" class="glm-dialog-box" title="Enter a New Group">
- <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="eventAmenities">
- <input type="hidden" name="option" value="addNewGroup">
- <input type="hidden" name="option2" value="group">
-
- <!-- This is only temporary until we reinstate the "Used With" selection below -->
- <input type="hidden" name="ref_type" value="20">
-
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Group Name:</th>
- <td>
- <input type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newGroupCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new Group" class="button button-primary">
-
- </form>
- </div>
-
- <!-- Delete Group Button -->
- <div id="deleteGroupDialog" class="glm-dialog-box" title="Delete Group">
- <center>
- <p>Are you sure you want to delete this group?</p>
- <p><div id="deleteGroupConfirm" class="button button-primary">Yes, delete this group</div></p>
- <p><div id="deleteGroupCancel" class="button button-primary">Cancel</div></p>
- </center>
- </div>
-
- <!-- Edit Amenities Dialog Box -->
- <div id="editGroupDialog" class="glm-dialog-box" title="Edit this Group">
- <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="eventAmenities">
- <input type="hidden" name="option" value="updateGroup">
- <input type="hidden" name="option2" value="group">
- <input id="editGroupID" type="hidden" name="id" value="">
-
- <!-- This is only temporary until we reinstate the "Used With" selection below -->
- <input type="hidden" name="ref_type" value="20">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Group Name:</th>
- <td>
- <input id="editGroupName" type="text" name="name" class="glm-form-text-input">
- </td>
- </tr>
-
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="editGroupCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this Group">
-
- </form>
- </div>
-
- <h2>Groups</h2>
- <table class="wp-list-table widefat fixed posts glm-admin-table">
- <thead>
- <tr>
- <th>Group</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
- {if $haveGroups}
- {assign var="i" value="0"}
- {foreach $groups as $t}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>
- <a class="editGroup" data-groupID="{$t.id}" data-refTypeID="{$t.ref_type.value}">{$t.name}</a>
- </td>
- <td>
- <div class="deleteGroupButton button button-secondary glm-button-small glm-right" data-groupID="{$t.id}">Delete</div>
- </td>
- </tr>
- {/foreach}
- {else}
- <tr class="alternate"><td colspan="2">(no groups listed)</td></tr>
- {/if}
- </tbody>
- </table>
-
- </tr>
-</table>
-<script type="text/javascript">
- jQuery(document).ready(function($) {
-
- $("#newGroupDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#editGroupDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $("#deleteGroupDialog").dialog({
- autoOpen: false,
- minWidth: 400,
- dialogClass: "glm-dialog-no-close"
- });
- $('#newGroupButton').click( function() {
- $("#newGroupDialog").dialog("open");
- });
- $('.editGroup').click( function() {
- var groupID = $(this).attr('data-groupID');
- var groupName = $(this).text();
- $('#editGroupID').val(groupID);
- $('#editGroupName').val(groupName.trim());
- $("#editGroupDialog").dialog("open");
- });
- $('#editGroupCancel').click( function() {
- $("#editGroupDialog").dialog("close");
- });
- $('#newGroupCancel').click( function() {
- $("#newGroupDialog").dialog("close");
- });
-
- var group_id = false;
- $('.deleteGroupButton').click( function() {
- group_id = $(this).attr('data-groupID');
- $("#deleteGroupDialog").dialog("open");
- });
- $('#deleteGroupConfirm').click( function() {
- $("#deleteGroupDialog").dialog("close");
- window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=amenities&option=deleteGroup&id=" + group_id + "&option2=group";
- });
- $('#deleteGroupCancel').click( function() {
- $("#deleteGroupDialog").dialog("close");
});
});
</script>
-
-
+
{include file='admin/footer.html'}