$catSearchSelected = false;
$regionSearchSelected = false;
+ // Paging Parmeters
+ $paging = true; // This might be better set in a management field
+ $numbDisplayed = false;
+ $lastDisplayed = false;
+ $prevStart = false;
+ $nextStart = false;
+ $start = 1;
+ $limit = 20; // Set to the number of listings per page
+
// Check for URL parameter override of shortcode parameters
if (isset($_REQUEST['categorySearch'])) {
$actionData['request']['category-search'] = $_REQUEST['categorySearch'];
if (isset($_REQUEST['alpha'])) {
$actionData['request']['alpha'] = $_REQUEST['alpha'];
}
+ // If user clicked a page request then we need to check the savedAlpha value
+ if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) {
+ $actionData['request']['alpha'] = $_REQUEST['savedAlpha'];
+ }
if (isset($_REQUEST['amenitySearch'])) {
$actionData['request']['amenity-search'] = $_REQUEST['amenitySearch'];
}
$blankStart = true;
}
+ // Check if we're doing paging
+ if (isset($_REQUEST['pageSelect'])) {
+
+ // If request is for Next
+ if ($_REQUEST['pageSelect'] == 'Next') {
+ $newStart = $_REQUEST['nextStart'] - 0;
+
+ // Otherwise it must be Previous
+ } else {
+ $newStart = $_REQUEST['prevStart'] - 0;
+ }
+
+ if ($newStart > 0) {
+ $start = $newStart;
+ }
+ }
+
+ // If we're not paging, then force $start and $limit to false to data abstract returns everything.
+ $resultParam = 'listResult';
+ if (!$paging) {
+ $start = false;
+ $limit = false;
+ $resultParam = 'list';
+ }
+
/*
* Get a current list of members - unless this is a blank start
*/
// Get stats for the current selection
$membersFound = $this->getStats(str_replace('T.', '', $where));
+ // Get stats for number of members found matching current selection criteria (includes alpha selection)
+ $filteredMembersFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere));
+
// Get member list sorted as specified
switch ($this->config['settings']['list_order_list']) {
// Pseudo-Random list order
case $this->config['sort_order_numb']['Pseudo-Random']:
- $list = $this->getList($where.$alphaWhere, 'pseudo-random');
+ ${$resultParam} = $this->getList($where.$alphaWhere, 'pseudo-random', true, 'id', $start, $limit);
break;
// Default is alpha-numeric list order
default:
case $this->config['sort_order_numb']['Alpha-Numeric']:
- $list = $this->getList($where.$alphaWhere, 'member_name');
+ ${$resultParam} = $this->getList($where.$alphaWhere, 'member_name', true, 'id', $start, $limit);
break;
}
}
+ if ($paging) {
+
+ // Get paging results - With paging getList() returns an array with additional paging data
+ $numbDisplayed = $listResult['returned'];
+ $lastDisplayed = $listResult['last'];
+ if ($start == 1) {
+ $prevStart = false;
+ } else {
+ $prevStart = $start - $limit;
+ if ($start < 1) {
+ $start = 1;
+ }
+ }
+
+ if ($start + $limit <= $filteredMembersFound) {
+ $nextStart = $start + $limit;
+ }
+
+ // since we're doing paging, we have to break out just the member data
+ $list = $listResult['list'];
+ unset($listResult);
+
+ }
+
// If we have list entries - even if it's an empty list
$success = true;
$haveMembers = false;
'alphaSelected' => $alphaSelected,
'blankStart' => $blankStart,
'view' => $view,
+
+ // Paging parameters
+ 'filteredMembersFound' => $filteredMembersFound,
+ 'numbDisplayed' => $numbDisplayed,
+ 'lastDisplayed' => $lastDisplayed,
+ 'paging' => $paging,
+ 'prevStart' => $prevStart,
+ 'nextStart' => $nextStart,
+ 'start' => $start,
+ 'limit' => $limit,
+
);
// Return status, suggested view, and data to controller - also return any modified settings
">
{include file='front/members/header.html'}
{apply_filters('glm-member-db-front-members-list-pageTop', '')}
+
<div class="glm-member-list-inner-wrapper">
{if $settings.list_show_map}
<div id="glm-member-list-map-toggle" class="button glm-button">Map</div>
{/foreach}
</div>
{/if}
+
+ {if $paging}
+ <br>
+ <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}®ionSearch={$regionSearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>Previous page</a>
+ <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}®ionSearch={$regionSearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page</a>
+ <br>
+ showing {$start} through {$lastDisplayed} of {$filteredMembersFound}
+ {/if}
+
+
{if $view == grid}
<ul class="small-block-grid-1 medium-block-grid-2 large-block-grid-3">
{foreach $members as $member}
</div>
{/if} {*end grid view check*}
+
+ {if $paging}
+ <br>
+ <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}®ionSearch={$regionSearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>Previous page</a>
+ <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}®ionSearch={$regionSearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page</a>
+ <br>
+ showing {$start} through {$lastDisplayed} of {$filteredMembersFound}
+ {/if}
+
{apply_filters('glm-member-db-front-members-list-pageBottom', '')}
{else}
<div>(no {$terms.term_member_plur} listed)</div>