mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged revisions 46560 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-privacy ........ r46560 | aoneil | 2007-12-11 10:09:07 +1300 (Tue, 11 Dec 2007) | 2 lines Added FirstItem() and LastItem() functions, which return the number of the first and last items in the current page ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@46777 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a42c2f9bdb
commit
ed2277aa8d
@ -309,6 +309,18 @@ class DataObjectSet extends ViewableData implements Iterator {
|
|||||||
return $this->TotalPages() > 1;
|
return $this->TotalPages() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function FirstItem() {
|
||||||
|
return isset($this->pageStart) ? $this->pageStart + 1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function LastItem() {
|
||||||
|
if(isset($this->pageStart)) {
|
||||||
|
return min($this->pageStart + $this->pageLength, $this->totalSize);
|
||||||
|
} else {
|
||||||
|
return min($this->pageLength, $this->totalSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the URL of the previous page.
|
* Returns the URL of the previous page.
|
||||||
* @return string
|
* @return string
|
||||||
@ -1006,4 +1018,4 @@ function column_sort_callback_basic($a, $b) {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user