Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
pagenavigation.php
1
<?php
9
namespace
Bitrix\Sender\UI
;
10
11
use
Bitrix\Main\Application
;
12
use
Bitrix\Main\UI
;
13
18
class
PageNavigation
extends
UI\PageNavigation
19
{
20
protected
$sessionKeyName
=
'sender_page_navigation'
;
21
27
public
function
resetSessionVar
()
28
{
29
if
(isset($_SESSION[$this->sessionKeyName]))
30
{
31
unset($_SESSION[$this->sessionKeyName]);
32
}
33
}
34
35
protected
function
setSessionVar
($page = 1,
$allRecords
=
false
)
36
{
37
if
(!isset($_SESSION[$this->sessionKeyName]))
38
{
39
$_SESSION[$this->sessionKeyName] = array();
40
}
41
42
$_SESSION[$this->sessionKeyName][
$this->id
] = [
43
'page'
=> $page,
44
'allRecords'
=>
$allRecords
45
];
46
}
47
48
protected
function
getSessionVar
()
49
{
50
if
(!isset($_SESSION[$this->sessionKeyName]))
51
{
52
return
1;
53
}
54
55
if
(!isset($_SESSION[$this->sessionKeyName][$this->
id
]))
56
{
57
return
1;
58
}
59
60
return
$_SESSION[$this->sessionKeyName][
$this->id
];
61
}
62
66
public
function
initFromUri
()
67
{
68
parent::initFromUri();
69
70
$page =
$this->currentPage
;
71
$request =
Application::getInstance
()->getContext()->getRequest();
72
if
($request->get(
'apply_filter'
) ===
'Y'
)
73
{
74
$page = 1;
75
}
76
if
(!$page && $request->get(
'grid_action'
) ===
'pagination'
)
77
{
78
$page = 1;
79
}
80
81
if
($page > 0)
82
{
83
$this->
setSessionVar
($page, $this->allRecords);
84
}
85
else
86
{
87
$page = is_array($this->
getSessionVar
()) ? ($this->
getSessionVar
()[
'page'
] ?? 0) : 0;
88
}
89
90
$page = $page > 0 ? $page : 1;
91
$this->
setCurrentPage
($page);
92
$this->allRecords = is_array($this->
getSessionVar
()) ? ($this->
getSessionVar
()[
'allRecords'
] ??
false
) :
false
;
93
}
94
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getInstance
static getInstance()
Definition
application.php:95
Bitrix\Main\UI\PageNavigation
Definition
pagenavigation.php:27
Bitrix\Main\UI\PageNavigation\$allRecords
$allRecords
Definition
pagenavigation.php:34
Bitrix\Main\UI\PageNavigation\setCurrentPage
setCurrentPage($n)
Definition
pagenavigation.php:144
Bitrix\Main\UI\PageNavigation\$id
$id
Definition
pagenavigation.php:28
Bitrix\Main\UI\PageNavigation\$currentPage
$currentPage
Definition
pagenavigation.php:32
Bitrix\Sender\UI\PageNavigation\$sessionKeyName
$sessionKeyName
Definition
pagenavigation.php:20
Bitrix\Sender\UI\PageNavigation\resetSessionVar
resetSessionVar()
Definition
pagenavigation.php:27
Bitrix\Sender\UI\PageNavigation\initFromUri
initFromUri()
Definition
pagenavigation.php:66
Bitrix\Sender\UI\PageNavigation\setSessionVar
setSessionVar($page=1, $allRecords=false)
Definition
pagenavigation.php:35
Bitrix\Sender\UI\PageNavigation\getSessionVar
getSessionVar()
Definition
pagenavigation.php:48
Bitrix\Main\UI
Bitrix\Sender\UI
modules
sender
lib
ui
pagenavigation.php
Создано системой
1.10.0