public function testLastOnPage() { $page = 1; $total = 111; $per_page = 10; $pagination = LMSPaginationFactory::getPagination($page, $total, $per_page); $this->assertEquals(10, $pagination->getLastOnPage()); $pagination->setPage(3); $this->assertEquals(30, $pagination->getLastOnPage()); $pagination->setPage(12); $this->assertEquals(111, $pagination->getLastOnPage()); }
if (!isset($_GET['d'])) { $SESSION->restore('cld', $d); } else { $d = $_GET['d']; } $SESSION->save('cld', $d); if (!isset($_GET['page'])) { $SESSION->restore('clp', $_GET['page']); } $page = !$_GET['page'] ? 1 : intval($_GET['page']); $per_page = intval(ConfigHelper::getConfig('phpui.customerlist_pagelimit', 100)); $offset = ($page - 1) * $per_page; $summary = $LMS->GetCustomerList($o, $s, $n, $g, NULL, NULL, 'AND', $ng, $d, null, null, true); $total = intval($summary['total']); $customerlist = $LMS->GetCustomerList($o, $s, $n, $g, NULL, NULL, 'AND', $ng, $d, $per_page, $offset); $pagination = LMSPaginationFactory::getPagination($page, $total, $per_page, ConfigHelper::checkConfig('phpui.short_pagescroller')); $listdata['below'] = $summary['below']; $listdata['over'] = $summary['over']; $listdata['total'] = $customerlist['total']; $listdata['order'] = $customerlist['order']; $listdata['direction'] = $customerlist['direction']; $listdata['network'] = $n; $listdata['nodegroup'] = $ng; $listdata['customergroup'] = $g; $listdata['division'] = $d; $listdata['state'] = $s; $SESSION->save('clp', $page); unset($customerlist['total']); unset($customerlist['state']); unset($customerlist['order']); unset($customerlist['below']);
public function testIfLongFactoryFlagWorks() { $pagination = \LMSPaginationFactory::getPagination(1, 1, 1, false); $this->assertInstanceOf('LMSPaginationLong', $pagination); }