Update alpha list to use last name.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 24 Sep 2018 18:30:31 +0000 (14:30 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 24 Sep 2018 18:30:31 +0000 (14:30 -0400)
Updating the alpha keys to use the last name of the staff.

classes/data/dataStaff.php
models/front/staff/list.php

index 524f2a0..19b7042 100644 (file)
@@ -197,7 +197,7 @@ class GlmDataStaff extends GlmDataAbstract
     {
 
         $sql = "
-           SELECT DISTINCT LEFT(T.fname, 1) AS alpha
+           SELECT DISTINCT LEFT(T.lname, 1) AS alpha
              FROM ".GLM_MEMBERS_STAFF_PLUGIN_DB_PREFIX. "staff T
             WHERE true
                   $where
index 044f2b0..a6a28c2 100644 (file)
@@ -105,12 +105,11 @@ class GlmMembersFront_staff_list extends GlmDatastaff
 
     public function modelAction($actionData = false)
     {
-        $success_load = false;
+        $success_load    = false;
         $success_message = "";
-        $option = false;
-        $view_file = 'list';
-        $view = 'list';
-
+        $option          = false;
+        $view_file       = 'list';
+        $view            = 'list';
         $where              = '';
         $whereSep           = '';
         $filterName         = false;
@@ -119,10 +118,8 @@ class GlmMembersFront_staff_list extends GlmDatastaff
         $staffFound         = false;
         $filteredStaffFound = false;
         $list               = false;
-
         $buildings          = false;
         $departments        = false;
-
         $thisPage           = false;
         $thisAction         = false;
         $prevStart          = false;
@@ -130,8 +127,6 @@ class GlmMembersFront_staff_list extends GlmDatastaff
         $limit              = false;
         $alphaSelected      = false;
 
-    
-
         // Paging Parameters
         $textSearch    = '';
         $paging        = true;//$this->config['settings']['list_pagination']; // Now this is in management
@@ -141,7 +136,7 @@ class GlmMembersFront_staff_list extends GlmDatastaff
         $nextStart     = false;
         $start         = 1;
         $limit         = 15;//$this->config['settings']['list_pagination_count']; // Now this is in management
-        
+
         if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
             $option = $_REQUEST['option'];
         }
@@ -151,7 +146,7 @@ class GlmMembersFront_staff_list extends GlmDatastaff
         } else {
             $actionData['request']['text-search'] = false;
         }
-        
+
         if (isset($_REQUEST['alpha'])) {
             $actionData['request']['alpha'] = $_REQUEST['alpha'];
         } else {
@@ -234,13 +229,13 @@ class GlmMembersFront_staff_list extends GlmDatastaff
             // Check for alpha selected
             if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) {
                 $alphaSelected = strtoupper($actionData['request']['alpha']);
-                $alphaWhere .= " AND T.fname LIKE '$alphaSelected%'";
-                
+                $alphaWhere .= " AND T.lname LIKE '$alphaSelected%'";
+
             }
 
             // Get full list for all other filters, but not filtered by alpha (that would be silly)
             $alphaList = $this->getAlphaList($where, $alphaSelected);
-            
+
         }
 
         // If we're not paging, then force $start and $limit to false to data abstract returns everything.
@@ -257,7 +252,7 @@ class GlmMembersFront_staff_list extends GlmDatastaff
         // Get stats for number of members found matching current selection criteria (includes alpha selection)
         $filteredStaffFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere));
 
-        
+
         $sortOrder = apply_filters( 'glm-member-db-front-search-query-orderby', 'fname' );
         $sortOrder = 'fname';
         ${$resultParam} = $this->getList($where.$alphaWhere, $sortOrder, true, 'id', $start, $limit);
@@ -301,53 +296,50 @@ class GlmMembersFront_staff_list extends GlmDatastaff
 
 
         //$staff_data = $this->getList();
-           
+
         switch ($option) {
 
             case "list":
                 $view_file = 'list';
-            
+
                 break;
-            
+
             default:
-        
+
                 break;
         }
         $success_load = "Yes";
-        
 
-        
+
+
         // Compile template datas
         $templateData = array(
-            'list'         => $list,
-            'staffData'    => $list,
-            'successLoad'  => $success_load,
+            'list'               => $list,
+            'staffData'          => $list,
+            'successLoad'        => $success_load,
             'haveStaff'          => $haveStaff,
             'staff'              => $list,
             'staffFound'         => $staffFound,
-            'haveFilter'           => $haveFilter,
-            'filterName'           => stripslashes($filterName),
-            'textSearch'           => $textSearch,
-            'alphaList'            => $alphaList,
-            'alphaSelected'        => $alphaSelected,
-            'view'                 => $view,
-
-            'departments'          => $departments,
-            'buildings'            => $buildings,
-
-            // Paging parameters
+            'haveFilter'         => $haveFilter,
+            'filterName'         => stripslashes($filterName),
+            'textSearch'         => $textSearch,
+            'alphaList'          => $alphaList,
+            'alphaSelected'      => $alphaSelected,
+            'view'               => $view,
+            'departments'        => $departments,
+            'buildings'          => $buildings,
             'filteredStaffFound' => $filteredStaffFound,
-            'numbDisplayed'        => $numbDisplayed,
-            'lastDisplayed'        => $lastDisplayed,
-            'paging'               => $paging,
-            'prevStart'            => $prevStart,
-            'nextStart'            => $nextStart,
-            'start'                => $start,
-            'limit'                => $limit,
-            'thisPage'             => $thisPage,
-            'thisAction'           => $thisAction,
-            'limit'                => $limit,
-            'alphaSelected'        => $alphaSelected,
+            'numbDisplayed'      => $numbDisplayed,
+            'lastDisplayed'      => $lastDisplayed,
+            'paging'             => $paging,
+            'prevStart'          => $prevStart,
+            'nextStart'          => $nextStart,
+            'start'              => $start,
+            'limit'              => $limit,
+            'thisPage'           => $thisPage,
+            'thisAction'         => $thisAction,
+            'limit'              => $limit,
+            'alphaSelected'      => $alphaSelected,
         );
 
         // Return status, any suggested view, and any data to controller