Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
sessionpagenavigationstorage.php
1
<?php
2
3
namespace
Bitrix\Main\Grid\Pagination\Storage
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\Data\LocalStorage\SessionLocalStorage
;
7
use
Bitrix\Main\Grid\Pagination\PageNavigationStorage
;
8
use
Bitrix\Main\UI\PageNavigation
;
9
10
final
class
SessionPageNavigationStorage
implements
PageNavigationStorage
11
{
12
private
const
STORAGE_ID =
'grid-pagination-storage'
;
13
private
SessionLocalStorage
$storage;
14
15
public
function
__construct
(?
SessionLocalStorage
$storage =
null
)
16
{
17
$this->storage =
18
$storage
19
??
Application::getInstance
()->getSessionLocalStorageManager()->
get
(self::STORAGE_ID)
20
;
21
}
22
23
public
function
fill
(
PageNavigation
$pagination): void
24
{
25
$data = $this->storage->get($pagination->
getId
());
26
if
(is_array($data) && isset($data[
'current'
]))
27
{
28
$pagination->
setCurrentPage
((
int
)$data[
'current'
]);
29
}
30
}
31
32
public
function
save
(
PageNavigation
$pagination): void
33
{
34
$this->storage->set(
35
$pagination->
getId
(),
36
[
37
'current'
=> $pagination->
getCurrentPage
(),
38
]
39
);
40
}
41
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getInstance
static getInstance()
Definition
application.php:95
Bitrix\Main\Data\LocalStorage\SessionLocalStorage
Definition
sessionlocalstorage.php:5
Bitrix\Main\Data\LocalStorage\SessionLocalStorage\get
& get($key)
Definition
sessionlocalstorage.php:62
Bitrix\Main\Grid\Pagination\Storage\SessionPageNavigationStorage
Definition
sessionpagenavigationstorage.php:11
Bitrix\Main\Grid\Pagination\Storage\SessionPageNavigationStorage\fill
fill(PageNavigation $pagination)
Definition
sessionpagenavigationstorage.php:23
Bitrix\Main\Grid\Pagination\Storage\SessionPageNavigationStorage\__construct
__construct(?SessionLocalStorage $storage=null)
Definition
sessionpagenavigationstorage.php:15
Bitrix\Main\Grid\Pagination\Storage\SessionPageNavigationStorage\save
save(PageNavigation $pagination)
Definition
sessionpagenavigationstorage.php:32
Bitrix\Main\UI\PageNavigation
Definition
pagenavigation.php:27
Bitrix\Main\UI\PageNavigation\getCurrentPage
getCurrentPage()
Definition
pagenavigation.php:154
Bitrix\Main\UI\PageNavigation\getId
getId()
Definition
pagenavigation.php:225
Bitrix\Main\UI\PageNavigation\setCurrentPage
setCurrentPage($n)
Definition
pagenavigation.php:144
Bitrix\Main\Grid\Pagination\PageNavigationStorage
Definition
pagenavigationstorage.php:16
Bitrix\Main\Grid\Pagination\Storage
Definition
sessionpagenavigationstorage.php:3
modules
main
lib
grid
pagination
storage
sessionpagenavigationstorage.php
Создано системой
1.10.0