From: Chuck Scott Date: Mon, 21 Aug 2017 18:20:56 +0000 (-0400) Subject: Now have registration event Alpha links and text search working on Registrations... X-Git-Tag: v1.0.0^2~461 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=5ddf95dbfc05732ee329c30c7264e14acf681d5e;p=WP-Plugins%2Fglm-member-db-registrations.git Now have registration event Alpha links and text search working on Registrations list. --- diff --git a/models/admin/registrations/event.php b/models/admin/registrations/event.php index a709b63..26e2621 100644 --- a/models/admin/registrations/event.php +++ b/models/admin/registrations/event.php @@ -104,20 +104,16 @@ class GlmMembersAdmin_registrations_event extends GlmDataRegistrationsRegEvent if (isset($_REQUEST['option'])) { $option = $_REQUEST['option']; } - - - // Check for a supplied regEvent record ID + + // Check for a supplied regEvent record ID and make sure it's and integer if (isset($_REQUEST['regEventID']) && $_REQUEST['regEventID'] != '') { - - // Ensure ID is a positive integer $regEventID = ($_REQUEST['regEventID'] - 0); - - // If no ID was supplied try to get last used reg event ID - if ($regEventID <= 0) { - $regEventID = get_option('glmMembersDatabaseLastUsedRegEventID'); - } - } + + // If no ID was supplied try to get last used reg event ID + if ($regEventID <= 0) { + $regEventID = get_option('glmMembersDatabaseLastUsedRegEventID'); + } // If we have a positive Int reg event ID, try to get the reg event data if ($regEventID > 0) { diff --git a/models/admin/registrations/list.php b/models/admin/registrations/list.php index ae60948..62ed55f 100644 --- a/models/admin/registrations/list.php +++ b/models/admin/registrations/list.php @@ -118,9 +118,9 @@ class GlmMembersAdmin_registrations_list extends GlmDataRegistrationsRegEvent if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) { $alphaSelected = strtoupper($actionData['request']['alpha']); - $alphaWhere .= " AND T.name LIKE '$alphaSelected%'"; + $alphaWhere .= " AND T.event_name LIKE '$alphaSelected%'"; } - + // Get full list for all other filters, but not filtered by alpha (that would be silly) $alphaList = $this->getAlphaList(' AND '.$where, $alphaSelected); @@ -165,9 +165,8 @@ class GlmMembersAdmin_registrations_list extends GlmDataRegistrationsRegEvent } } - - - + // Get full list of event names matching the current where clause for text search box + $namesList = $this->getSimpleRegEventsList($where); diff --git a/views/admin/registrations/list.html b/views/admin/registrations/list.html index 6088c70..d9deace 100644 --- a/views/admin/registrations/list.html +++ b/views/admin/registrations/list.html @@ -70,96 +70,77 @@ - + + /* + * + * Do autocomplete search for registration events + * label: What will be searched + * value: What will be displayed when selected + * id: Member id added so we can go to the member while showing what was selected + * Also note that autocomplete does not properly render HTML codes, so we + * "unescape" them for HTML in Smarty. + */ + + var availableTags = [ + {foreach $namesList as $m} + { label: "{$m.event_name|unescape:'html'|replace:'"':''}", value: "{$m.event_name|unescape:'html'|replace:'"':''}", id: '{$m.id}' }, + {/foreach} + ]; + + // Autocomplete for list Text Search + $( ".glmRegEventsSearch" ).autocomplete({ + + source: availableTags, + html: true, + position: { my : "right top", at: "right bottom" }, + select: function( event, ui ) { + var regEventID = ui.item.id; + window.location.replace("{$adminUrl}?page=glm-members-admin-menu-registrations-event®EventID=" + regEventID ); + }, + response: function(event, ui) { + if (!ui.content.length) { + var noResult = { value:"",label:"No results found" }; + ui.content.push(noResult); + } + } + }); + + // Restrict autocomplete list to a certain height with scrollbar + $('.ui-autocomplete').css('height','200px').css('overflow-y','scroll'); + + // Expand multi-select on hover + $('#filterCategories').multiselect(); + $('#exportFilterCategories').multiselect(); + + }); + {include file='admin/footer.html'}