From: Steve Sutton Date: Thu, 23 May 2019 20:26:18 +0000 (-0400) Subject: Updates for working with uptra on the search. X-Git-Tag: v2.12.4~1^2~17^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=f77483fa1f3f0124c8ad2a97421a1c34177f48fb;p=WP-Plugins%2Fglm-member-db.git Updates for working with uptra on the search. Taking what was started from wmta. Adding shortcode attributes. --- diff --git a/classes/data/dataRegions.php b/classes/data/dataRegions.php index cb3c2466..5b8248e5 100644 --- a/classes/data/dataRegions.php +++ b/classes/data/dataRegions.php @@ -182,6 +182,7 @@ class GlmDataRegions extends GlmDataAbstract $where .= ") "; } + // echo '
$where: ' . print_r( $where, true ) . '
'; // Get a list of all regions (optionally for active members only) $regions = $this->getList($where); diff --git a/models/front/members/list.php b/models/front/members/list.php index a1eab391..98f17d44 100755 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -72,7 +72,9 @@ $GLOBALS['showOpts'] = array( 'logo-filler' => 'list_show_logo_filler', 'live-cam' => 'list_show_live_cam', 'packages' => 'list_show_packages', - 'packages-link' => 'list_show_packages_link' + 'packages-link' => 'list_show_packages_link', + 'list-ajax-pagination' => 'list_ajax_pagination', + 'list-pagination-count' => 'list_pagination_count', ); // Load Members data abstract @@ -245,12 +247,28 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo static $start = 1; static $limit = false; + # Ajax Paging attributes + static $ajaxPagination = false; + static $listCount = false; + // If this is the first instance, then set these paramters if (!$thisInstance['instanceCount']) { - $paging = $this->config['settings']['list_pagination']; // Now this is in management - $limit = $this->config['settings']['list_pagination_count']; // Now this is in management + $paging = $this->config['settings']['list_pagination']; // Now this is in management + $limit = $this->config['settings']['list_pagination_count']; // Now this is in management + } + + $listCount = $this->config['settings']['list_pagination_count']; + $ajaxPagination = $this->config['settings']['list_ajax_pagination']; + if ( isset( $actionData['request']['list-pagination-count'] ) && $lCount = filter_var( $actionData['request']['list-pagination-count'], FILTER_VALIDATE_INT ) ) { + $listCount = $lCount; + $limit = $listCount; + } + if ( isset( $actionData['request']['list-ajax-pagination'] ) ) { + $ajaxPagination = $actionData['request']['list-ajax-pagination']; } + // echo '
$limit: ' . print_r( $limit, true ) . '
'; + // Pre-load settings array with management settings as default using the list above $settings = array(); reset($GLOBALS['showOpts']); @@ -425,8 +443,9 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo // Get regions for possible use in search pick list for regions used in active member info records. require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php'; - $Regions = new GlmDataRegions($this->wpdb, $this->config); - $regionData = $Regions->getListForSearch(true, $actionData); + $Regions = new GlmDataRegions( $this->wpdb, $this->config ); + $regionData = $Regions->getListForSearch( true, $actionData ); + // echo '
$regionData: ' . print_r( $regionData, true ) . '
'; // Get cities for possible use in search pick list for cities used in active member info records. require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'; @@ -518,10 +537,15 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo } } } + // echo '
$regionData: ' . print_r( $regionData, true ) . '
'; // Check for user region selection $categoryRegionList = ''; $categoryRegionSep = ''; - if (isset($_REQUEST) && is_array($regionData) && (isset($_REQUEST['regionUserSearch']) && count($_REQUEST['regionUserSearch']) > 0) || (isset($_REQUEST['regionSearch']) && $_REQUEST['regionSearch'] != "")) { + if ( isset( $_REQUEST ) + && is_array( $regionData ) + && ( isset( $_REQUEST['regionUserSearch'] ) && count( $_REQUEST['regionUserSearch'] ) > 0 ) + || ( isset( $_REQUEST['regionSearch']) && $_REQUEST['regionSearch'] != "" ) + ) { foreach ($regionData as $r) { $id = $r['id']; $regionData[$id]['default'] = false; @@ -1043,6 +1067,9 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo END AS distance"; $order = " distance ASC, city ASC, member_name ASC "; + // echo '
$order: ' . print_r( $order, true ) . '
'; + // echo '
$cityName: ' . print_r( $cityName, true ) . '
'; + // echo '
$distanceQuery: ' . print_r( $distanceQuery, true ) . '
'; } else { $appendSelect = ""; $order = " member_name ASC "; @@ -1056,6 +1083,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo // $where .= " "; // echo '
$where: ' . print_r( $where, true ) . '
'; + // echo '
$appendSelect: ' . print_r( $appendSelect, true ) . '
'; ${$resultParam} = $this->getList( $where.$alphaWhere, // where @@ -1071,6 +1099,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo // When not full text search sort according to settings } else { + // echo '
$where: ' . print_r( $where, true ) . '
'; // Get stats for the current selection $membersFound = $this->getStats(str_replace('T.', '', $where)); @@ -1318,8 +1347,12 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo 'ajaxLoader' => ( defined( 'GLM_MEMBER_LIST_AJAX_LOADER' ) && GLM_MEMBER_LIST_AJAX_LOADER ) ? true : false, 'ajaxNext' => ( isset( $_REQUEST['ajaxNext'] ) ) ? true : false, + 'isSearch' => ( isset( $_REQUEST['s'] ) ) ? true : false, 'wpSearch' => ( isset( $_REQUEST['s'] ) ) ? stripslashes( $_REQUEST['s'] ) : '', + 'ajaxPagination' => $ajaxPagination, + 'listCount' => $listCount, + ); if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) { @@ -1353,7 +1386,12 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo public function getDistanceQuery( $lat, $lng ) { $foo = " - (pow(sin(((T.lat * pi()/180.0) - ($lat * pi()/180.0)) / 2.0), 2) + cos(($lat * pi() / 180.0)) * cos((T.lat * pi() / 180.0)) * pow(sin(((T.lon * pi() / 180.0) - ($lng * pi() / 180.0)) / 2.0), 2))"; + ( + pow(sin(((T.lat * pi()/180.0) - ($lat * pi()/180.0)) / 2.0), 2) + + cos(($lat * pi() / 180.0)) + * cos((T.lat * pi() / 180.0)) + * pow(sin(((T.lon * pi() / 180.0) - ($lng * pi() / 180.0)) / 2.0), 2) + )"; return "ceil(3956 * 2 * atan2(sqrt($foo), diff --git a/setup/shortcodes.php b/setup/shortcodes.php index af5b8ec1..1720e33e 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -152,6 +152,8 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) { 'amenity-groups' => 'amenity-groups', 'packages' => 'list_show_packages', 'packages-link' => 'list_show_packages_link', + 'list-ajax-pagination' => false, + 'list-pagination-count' => false, ) ), 'glm-member-detail' => array( diff --git a/views/front/members/list.html b/views/front/members/list.html index 48204cad..149a958b 100755 --- a/views/front/members/list.html +++ b/views/front/members/list.html @@ -325,13 +325,15 @@ {apply_filters('glm-member-db-front-members-list-listHeaderBottom', '')} + {$searchParams = "&textSearch={$textSearch}{if $isSearch}&s={$wpSearch|escape:'html'}{/if}&categorySearch={$catSearchSelected}®ionSearch={$regionSearchSelected}&citySearch={$citySearchSelected}"} + {* Alpha List *} {if $showSettings.list_show_search_alpha && !$isSearchPage} {/if} @@ -339,11 +341,11 @@ {* Page selection top *} {if $paging} - {if ( $prevStart || $nextStart ) && !$settings.list_ajax_pagination} + {if ( $prevStart || $nextStart ) && !$ajaxPagination}
- < Previous page - Next page > + < Previous page + Next page >

{/if} @@ -357,7 +359,7 @@ {* Members List *} - {if $settings.list_ajax_pagination} + {if $ajaxPagination}
loading...
@@ -377,15 +379,15 @@
{if $paging} - {if ( $prevStart || $nextStart ) && !$settings.list_ajax_pagination} + {if ( $prevStart || $nextStart ) && !$ajaxPagination}

{/if} - {if $nextStart && $settings.list_ajax_pagination} + {if $nextStart && $ajaxPagination} [ Load More ] {/if}
@@ -418,11 +420,12 @@
{* glm-member-db-list *} {/if} + {debug}