Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
reversepagenavigation.php
1
<?php
8
namespace
Bitrix\Main\UI
;
9
10
class
ReversePageNavigation
extends
PageNavigation
11
{
16
public
function
__construct
(
$id
, $count)
17
{
18
parent::__construct(
$id
);
19
$this->
setRecordCount
($count);
20
}
21
26
public
function
getPageCount
()
27
{
28
if
($this->allRecords)
29
{
30
return
1;
31
}
32
$maxPages = (int)floor($this->recordCount/$this->pageSize);
33
if
($this->recordCount > 0 && $maxPages == 0)
34
{
35
$maxPages = 1;
36
}
37
return
$maxPages;
38
}
39
44
public
function
getCurrentPage
()
45
{
46
if
($this->currentPage !==
null
)
47
{
48
return
$this->currentPage
;
49
}
50
return
$this->
getPageCount
();
51
}
52
57
public
function
getOffset
()
58
{
59
if
($this->allRecords)
60
{
61
return
0;
62
}
63
64
$offset = 0;
65
$pageCount = $this->
getPageCount
();
66
$currentPage
= $this->
getCurrentPage
();
67
68
if
($currentPage <> $pageCount)
69
{
70
//counting the last page (wich is the first one on reverse paging)
71
$offset += ($this->recordCount %
$this->pageSize
);
72
}
73
74
$offset += ($pageCount -
$currentPage
) * $this->pageSize;
75
76
return
$offset;
77
}
78
83
public
function
getLimit
()
84
{
85
if
($this->allRecords)
86
{
87
return
$this->
getRecordCount
();
88
}
89
if
($this->
getCurrentPage
() == $this->
getPageCount
())
90
{
91
//the last page (displayed first)
92
return
$this->pageSize + ($this->recordCount %
$this->pageSize
);
93
}
94
else
95
{
96
return
$this->pageSize
;
97
}
98
}
99
}
Bitrix\Main\UI\PageNavigation
Definition
pagenavigation.php:27
Bitrix\Main\UI\PageNavigation\getRecordCount
getRecordCount()
Definition
pagenavigation.php:187
Bitrix\Main\UI\PageNavigation\setRecordCount
setRecordCount($n)
Definition
pagenavigation.php:177
Bitrix\Main\UI\PageNavigation\$pageSize
$pageSize
Definition
pagenavigation.php:30
Bitrix\Main\UI\PageNavigation\$id
$id
Definition
pagenavigation.php:28
Bitrix\Main\UI\PageNavigation\$currentPage
$currentPage
Definition
pagenavigation.php:32
Bitrix\Main\UI\ReversePageNavigation
Definition
reversepagenavigation.php:11
Bitrix\Main\UI\ReversePageNavigation\__construct
__construct($id, $count)
Definition
reversepagenavigation.php:16
Bitrix\Main\UI\ReversePageNavigation\getCurrentPage
getCurrentPage()
Definition
reversepagenavigation.php:44
Bitrix\Main\UI\ReversePageNavigation\getPageCount
getPageCount()
Definition
reversepagenavigation.php:26
Bitrix\Main\UI\ReversePageNavigation\getLimit
getLimit()
Definition
reversepagenavigation.php:83
Bitrix\Main\UI\ReversePageNavigation\getOffset
getOffset()
Definition
reversepagenavigation.php:57
Bitrix\Main\UI
modules
main
lib
ui
reversepagenavigation.php
Создано системой
1.10.0