I actually changed this to a dropdown.
Originally I had buttons but this might get out of hand. So I changed it to a dropdown. I also added the ability to show what page you are on. This isn’t perfect, but perhaps someone can make it better. This is very similar to my original modification. Here is my code.
File: include/ListView/ListViewData.php
Starting on Line 560 add:
$listModule = $seed->module_dir;
$moduleUpper = strtoupper($seed->module_dir);
$moduleString = $listModule . 2 . "_" . $moduleUpper . "_offset";
$pgButtons[] = "";
$pageLimit = $this->getLimit();
$numberOfLoops = (int) ($totalCount / $pageLimit) ;
$pageData['perPage'] = $this->getLimit();
$pageData['pgNums'] = $pgButtons;
$pgDropdown[] = "";
for ($a=0; $a <= $numberOfLoops ; $a++) {
$pgOffSet = $a * $this->getLimit();
$pga = $a + 1;
array_push($pgDropdown, "<option value='$pgOffSet,$moduleString'>$pga</option>");
}
$pageData['pgNumsDrop'] = $pgDropdown;
File themes/SuitP/include/ListView/ListViewPaginationBottom.tpl
Starting on Line 43:
<script language="JavaScript" type="text/javascript">
{literal}
window.onload = function() {
var last = {/literal}{$pageData.offsets.lastOffsetOnPage}{literal};
var perPage = {/literal}{$pageData.perPage}{literal};
var page = Math.floor (last /perPage) - 1;
document.getElementById('pgdropTop').selectedIndex = page;
document.getElementById('pgdropBottom').selectedIndex = page;
};
function leaveChangeBottom(){
pageString = document.getElementById('pgdropBottom').value;
var pgArray = pageString.split(",");
sListView.save_checks(parseInt(pgArray[0]),pgArray[1]);
}
{/literal}
</script>
Then again on line 96:
<select id="pgdropBottom" onchange="leaveChangeBottom()">
{foreach from=$pageData.pgNumsDrop item=optionDrop}
{$optionDrop}
{/foreach}
File themes/SuitP/include/ListView/ListViewPaginationTop.tpl
Starting on Line 43:
<script language="JavaScript" type="text/javascript">
{literal}
window.onload = function() {
var last = {/literal}{$pageData.offsets.lastOffsetOnPage}{literal};
var perPage = {/literal}{$pageData.perPage}{literal};
var page = Math.floor (last /perPage) - 1;
document.getElementById('pgdropTop').selectedIndex = page;
document.getElementById('pgdropBottom').selectedIndex = page;
};
function leaveChangeTop(){
pageString = document.getElementById('pgdropTop').value;
var pgArray = pageString.split(",");
sListView.save_checks(parseInt(pgArray[0]),pgArray[1]);
}
{/literal}
</script>
Then Line 94:
<select id="pgdropTop" onchange="leaveChangeTop()">
{foreach from=$pageData.pgNumsDrop item=optionDrop}
{$optionDrop}
{/foreach}
</select>
If you have custom modules the above will work. Custom modules do not add an ‘s’ at the end. Whereas Accounts turns ACCOUNTS and it needs to be ACCOUNT. If you are not using custom modules then you need to add this in ListViewData.php. I turned this into an IF statement. (If not custom module then don’t do)
It would go in ListViewData.php underneath the line: $moduleUpper = strtoupper($seed->module_dir);
$moduleUpper = substr($moduleUpper, 0, -1);
Mine looks like this:
$listModule = $seed->module_dir;
$moduleUpper = strtoupper($seed->module_dir);
if ($moduleUpper == "CST_MODULE1" || $moduleUpper == "CST_MODULE2"){
}else{
$moduleUpper = substr($moduleUpper, 0, -1);
}