From 84a8b57720b418179f218883c74444355012eab5 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 4 Apr 2017 15:42:32 -0400 Subject: [PATCH] fixing js error missing brackets, adding AND OR operators to the get params for the pagination --- css/front.css | 37 ++++++++++++++++- js/front.js | 30 +++++++++++++- models/front/obits/search.php | 14 +++---- views/front/obits/searchResults.html | 60 ++++++++++++++++++---------- 4 files changed, 110 insertions(+), 31 deletions(-) diff --git a/css/front.css b/css/front.css index 7c36c20..f85f65f 100644 --- a/css/front.css +++ b/css/front.css @@ -95,7 +95,7 @@ .search-results-label{ max-width: 105px; display: inline; - margin-left: 100px !important; +/* margin-left: 100px !important;*/ font-weight: bold; } .search-container .results-limit-container { @@ -161,6 +161,9 @@ input.sidebar-criteria{ max-width: 250px; float: left !important; } +table.footable{ +/* margin-top: 85px;*/ +} .glm-alpha-link, .detail-link{ color: #1d3961; } @@ -193,4 +196,36 @@ input.sidebar-criteria{ } .search-container .placeholder{ padding: 2px; +} +.results-page .results-limit-container{ + float: right; +} +.print-results-container{ + float: right; + margin-right: 20px; + margin-top: 15px; +} +.pagination-nav{ + margin: 20px 0; + float: left; +} +.display-number{ + margin-top: 10px; +} + +@media(min-width: 1024px ){ + .alpha-header{ + padding-left: 0; + } + .search-limit-container{ + padding-left: 0; + } + .pagination-header{ + padding-left: 0; + } +} +@media(min-width: 643px){ + .search-limit-container{ + margin-top: 30px; + } } \ No newline at end of file diff --git a/js/front.js b/js/front.js index 742a93c..53d0c98 100644 --- a/js/front.js +++ b/js/front.js @@ -1,4 +1,5 @@ $(document).ready(function(){ + $(".expand-collapse").on("click", function(e){ if( $(this).text() === "Show Options" ){ $(this).text("Hide Options"); @@ -31,7 +32,6 @@ $(document).ready(function(){ $('.alpha-link').on("click", function(){ console.log("test"); $('#obits-search').submit(); - console.log("test"); }); if( $(window).width() < 1024 ){ @@ -40,8 +40,36 @@ $(document).ready(function(){ }); } + $(window).on("resize", function(){ + if( $(window).width() > 1024){ + if( $('.sidebar-container').css("display") === "none" ){ + $('.sidebar-container').css("display","block"); + } + + } else { + $('.sidebar-container').css("display","none"); + + } + if( $(window).width() > 640 ) { + if($('.not-input').css("display") === "none"){ + $('.not-input').css("display","block"); + } + if($('.logic-input').css("display") === "none"){ + $('.logic-input').css("display","block"); + } + } else { + $('.not-input').css("display","none"); + $('.logic-input').css("display","none"); + } + }); + $('#results-limit').on('change', function(){ // $('#obits-search').submit(); }); + $('.print-results-link').on("click", function(e){ + + e.preventDefault(); + }); + }); \ No newline at end of file diff --git a/models/front/obits/search.php b/models/front/obits/search.php index 5fba23d..dcdefb8 100644 --- a/models/front/obits/search.php +++ b/models/front/obits/search.php @@ -115,7 +115,6 @@ class GlmMembersFront_obits_search extends GlmDataObits $per_page = isset( $_REQUEST['results-limit']) ? (int)filter_var( $_REQUEST['results-limit'], FILTER_SANITIZE_STRING) : 50; - // only execute search if the search button is clicked or there are search params in the url if ( isset( $_REQUEST['searchButton'] ) || !empty( $_GET['alpha'] ) || !empty( $_GET['pageSelect'] ) ){ @@ -152,6 +151,7 @@ class GlmMembersFront_obits_search extends GlmDataObits 'spouse_partner' => isset($_GET['spouse']) ? filter_var($_GET['spouse'],FILTER_SANITIZE_STRING) : '', 'maiden_other' => isset($_GET['maiden']) ? filter_var($_GET['maiden'],FILTER_SANITIZE_STRING) : '', ); + // get the alpha key if ( isset( $_REQUEST['alpha'] ) ){ $alpha_key = filter_var( $_REQUEST['alpha'], FILTER_SANITIZE_STRING ); @@ -241,12 +241,12 @@ class GlmMembersFront_obits_search extends GlmDataObits foreach($get_values as $key=>$value){ if($value !== ''){ - $where .= "$key LIKE '%$value%' AND "; + $where .= "$key LIKE '%$value%' $clause "; } } // remove the last AND or OR statement from the query string - $where = substr($where, 0, -5); +// $where = substr($where, 0, -5); } else { @@ -272,7 +272,7 @@ class GlmMembersFront_obits_search extends GlmDataObits } $obits = $this->getList($where, 'last_name', $fieldVals = true, $idField = 'id', $start, $per_page); - + echo $where; $returned = $obits['returned']; // Get paging results @@ -325,7 +325,7 @@ class GlmMembersFront_obits_search extends GlmDataObits $view = 'searchResults'; } - + $clause = preg_replace('/\s+/', '', $clause); // Compile template data $templateData = array( 'birth_death_range' => $birth_death_range, @@ -346,8 +346,8 @@ class GlmMembersFront_obits_search extends GlmDataObits 'alpha_key' => $alpha_key, 'search' => $form_fields, 'get_params' => $get_fields, - 'empty_search' => $empty_search - + 'empty_search' => $empty_search, + 'clause' => $clause ); // Return status, any suggested view, and any data to controller return array( diff --git a/views/front/obits/searchResults.html b/views/front/obits/searchResults.html index d1e2864..bc16001 100644 --- a/views/front/obits/searchResults.html +++ b/views/front/obits/searchResults.html @@ -6,8 +6,8 @@
-