Commit d674b8ea authored by guilhermeblanco's avatar guilhermeblanco

Added Doctrine_Pager_Range::isInRange, which checks if a given page is in the range

parent 499eaf6c
...@@ -141,6 +141,20 @@ abstract class Doctrine_Pager_Range ...@@ -141,6 +141,20 @@ abstract class Doctrine_Pager_Range
} }
/**
* isInRange
*
* Check if a given page is in the range
*
* @param $page Page to be checked
* @return boolean
*/
public function isInRange($page)
{
return (array_search($page, $this->rangeAroundPage()) !== false);
}
/** /**
* _initialize * _initialize
* *
......
...@@ -75,6 +75,9 @@ $pager_range->getOptions(); ...@@ -75,6 +75,9 @@ $pager_range->getOptions();
// Returns the custom Doctrine_Pager_Range implementation offset option // Returns the custom Doctrine_Pager_Range implementation offset option
$pager_range->getOption($option); $pager_range->getOption($option);
// Check if a given page is in the range
$pager_range->isInRange($page);
// Return the range around the current page (obtained from Doctrine_Pager // Return the range around the current page (obtained from Doctrine_Pager
// associated to the $pager_range instance) // associated to the $pager_range instance)
$pager_range->rangeAroundPage(); $pager_range->rangeAroundPage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment