From bf82b5a1e5fd35628420b1c3f764999ec1063d88 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 16 Jan 2018 15:18:59 -0500 Subject: [PATCH] adding filter for front end list and search for cities getting cities by contact, returning list of cities associated with contacts for search --- models/front/contacts/list.php | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/models/front/contacts/list.php b/models/front/contacts/list.php index 9ef2cd5..7390f3c 100644 --- a/models/front/contacts/list.php +++ b/models/front/contacts/list.php @@ -188,7 +188,34 @@ class GlmMembersFront_contacts_list extends GlmDataContacts )"; $haveFilter = true; } - + // Filter by selected city + if (isset($_REQUEST['citySearch']) && $_REQUEST['citySearch'] !== "") { + $citySearch = esc_sql($_REQUEST['citySearch']); + $where .= " AND ( + city = $citySearch + )"; + $haveFilter = true; + } + + // Filter by name string supplied + if (isset($_REQUEST['filterName']) && $_REQUEST['filterName'] !== "") { + $filterName = esc_sql($_REQUEST['filterName']); + $where .= " AND ( + lname LIKE '%$filterName%' OR + fname LIKE '%$filterName%' + )"; + $haveFilter = true; + } + // Filter by company string supplied + if (isset($_REQUEST['filterOrganization']) && $_REQUEST['filterOrganization'] !== "") { + $filterOrganization = esc_sql($_REQUEST['filterOrganization']); + $where .= " AND ( + org LIKE '%$filterOrganization%' + )"; + $haveFilter = true; + } + + // Filter by text string supplied if (isset($_REQUEST['filterText'])) { $filterText = esc_sql($_REQUEST['filterText']); @@ -285,8 +312,6 @@ class GlmMembersFront_contacts_list extends GlmDataContacts } - - if ($paging) { //Get paging results $numbDisplayed = $listResult['returned']; @@ -333,6 +358,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts $haveCounties = true; } + // Compile template data $templateData = array( 'option' => $option, @@ -351,6 +377,7 @@ class GlmMembersFront_contacts_list extends GlmDataContacts 'countyList' => $countyList, 'haveCounties' => $haveCounties, 'countySearch' => $countySearch, + 'citySearch' => $citySearch, 'haveFilter' => $haveFilter, 'contactMembers' => $contactMembers, 'alphaList' => $alphaList, -- 2.17.1