Now have registration event Alpha links and text search working on Registrations...
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 21 Aug 2017 18:20:56 +0000 (14:20 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 21 Aug 2017 18:20:56 +0000 (14:20 -0400)
models/admin/registrations/event.php
models/admin/registrations/list.php
views/admin/registrations/list.html

index a709b63..26e2621 100644 (file)
@@ -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) {
index ae60948..62ed55f 100644 (file)
@@ -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);        
         
         
         
index 6088c70..d9deace 100644 (file)
 
     </form>
 </div>
-    <script type="text/javascript">
-        jQuery(document).ready(function($) {
-
-            // Filter triggers
-            $(".listFilter" ).change( function() {
-
-                var filter = '';
-
-                // Check for archived filter
-                if ($("#filterArchived").attr('checked')) {
-                    filter += '&filterArchived=true';
-                }
-
-                // Check for pending data filter
-                if ($("#filterPending").attr('checked')) {
-                    filter += '&filterPending=true';
-                }
-
-                // Check for featured data filter
-                if ($("#filterFeatured").attr('checked')) {
-                    filter += '&filterFeatured=true';
-                }
-
-                window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=list" + filter;
-
-                return false;
-            });
-
-
-/******* THE REST OF THIS NEEDS TO BE REWRITTEN FOR THIS APPLICATION *********/
-            
-            
-            /*
-             *
-             * 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.name|unescape:'html'|replace:'"':''}", value: "{$m.name|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
-    {/foreach}
-             ];
-
-             // Autocomplete for list Text Search
-             $( ".glmMembersSearch" ).autocomplete({
-
-                 source: availableTags,
-                 html: true,
-                 position: { my : "right top", at: "right bottom" },
-                 select: function( event, ui ) {
-                     var memberID = ui.item.id;
-                     window.location.replace("{$adminUrl}?page=glm-members-admin-menu-member&glm_action=index&member=" + memberID );
-                 },
-                 response: function(event, ui) {
-                     if (!ui.content.length) {
-                         var noResult = { value:"",label:"No results found" };
-                         ui.content.push(noResult);
-                     }
-                 }
-             });
-
-             // Autocomplete for export Text field
-             $( ".exportMembersSearch" ).autocomplete({
-
-                 source: availableTags,
-                 html: true,
-                 position: { my : "right top", at: "right bottom" },
-                 response: function(event, ui) {
-                     if (!ui.content.length) {
-                         var noResult = { value:"",label:"No results found" };
-                         ui.content.push(noResult);
-                     }
-                 }
-             });
+<script type="text/javascript">
+    jQuery(document).ready(function($) {
+
+        // Filter triggers
+        $(".listFilter" ).change( function() {
+
+            var filter = '';
+
+            // Check for archived filter
+            if ($("#filterArchived").attr('checked')) {
+                filter += '&filterArchived=true';
+            }
 
-             // 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();
-*/
+            // Check for pending data filter
+            if ($("#filterPending").attr('checked')) {
+                filter += '&filterPending=true';
+            }
 
+            // Check for featured data filter
+            if ($("#filterFeatured").attr('checked')) {
+                filter += '&filterFeatured=true';
+            }
+
+            window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=list" + filter;
+
+            return false;
         });
-    </script>
+
+        /*
+         *
+         * 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&regEventID=" + 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();
+
+    });
+</script>
 
 
 {include file='admin/footer.html'}