2017 © Pedro Peláez
 

library cutator

Simple pagination class for PHP 5.3. Define you value, get the result.

image

scullwm/cutator

Simple pagination class for PHP 5.3. Define you value, get the result.

  • Wednesday, May 21, 2014
  • by ScullWM
  • Repository
  • 1 Watchers
  • 0 Stars
  • 116 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Cutator

Simple pagination class for PHP 5.3. Define you value, get the result., (*1)

Total Downloads Build Status, (*2)

Why

If you don't wan't to install thousand dependency for simple offset calcul, (*3)

Simple Usage

setTotalItem(850);           // no default value
$var->setItemsPerPage(10);         // default value 10
$var->setCurrentPage(8);           // default value 1
$var->setShowFirstLast(false);     // default value false
$var->setMaxLinks(10);             // default value 10

// Can be defined in a single line
$var->setTotalItem(850)->setItemsPerPage(10)->setCurrentPage(8)->setShowFirstLast(false)->setMaxLinks(10);

$var->getTotalPage();              // 85 Return integer: number of page needed 
$var->getOffset();                 // 70 Return integer: offset starting value 
$var->getHaveToPaginate();         // True Return boolean: do you need to display pagination 
$var->getNextPage();               // 9 Return integer 
$var->getPreviousPage();           // 7 Return integer

$t = $var->getBasicView();         // Return array: return simple array for creating pager

print_r($t);

/*
Array
(
    [3] => 3
    [4] => 4
    [5] => 5
    [6] => 6
    [7] => 7
    [8] => 8
    [9] => 9
    [10] => 10
    [11] => 11
    [12] => 12
)
*/
?>

View And url Generator Usage

setUrlGenerator($urlGenerator);

$cutator = new Cutator\Cutator();
$cutator->setView($view);

$cutator->setUrlInfo('liste');

echo $cutator->getTemplateView();
?>

Tests

Test with Atoum php vendor/atoum/atoum/bin/atoum -f tests/units/Cutator.php, (*4)

Todo

  • Create extension for array pagination
  • Write more tests
  • Write Extension for Silex (serviceProvider)

The Versions

21/05 2014

dev-master

9999999-dev http://github.com/scullwm/Cutator

Simple pagination class for PHP 5.3. Define you value, get the result.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

pagination paginator pager offset recordset

20/05 2014

dev-dev

dev-dev http://github.com/scullwm/Cutator

Simple pagination class for PHP 5.3. Define you value, get the result.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

The Development Requires

pagination paginator pager offset recordset