1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
lazyloadtotalcount.php
См. документацию.
1<?php
2
4
7use Closure;
8
10{
11 private ?Closure $totalCountCalculator = null;
12
18 abstract public function getId(): string;
19
20
28 public function setTotalCountCalculator(Closure $value): void
29 {
30 $this->totalCountCalculator = $value;
31 }
32
33 private function getCalculateTotalCountAction(PageNavigation $pagination): CalculateTotalCountAction
34 {
35 return new CalculateTotalCountAction($this->totalCountCalculator, $pagination);
36 }
37
45 public function getTotalRowsCountHtml(): string
46 {
47 return '<lazy-load-total-count grid-id="' . htmlspecialcharsbx($this->getId()) . '" />';
48 }
49
50 public function setRawRowsWithLazyLoadPagination(Closure $getRawRowsCallback): void
51 {
52 $params = $this->getOrmParams();
53 $pagination = $this->getPagination();
54
55 if (empty($pagination) || empty($params['limit']))
56 {
57 $this->setRawRows(
58 $getRawRowsCallback($params)
59 );
60
61 return;
62 }
63
64 $params['limit']++;
65 $rows = [];
66 $rowsCount = 0;
67
68 foreach ($getRawRowsCallback($params) as $row)
69 {
70 $rowsCount++;
71 if ($rowsCount > $pagination->getPageSize())
72 {
73 break;
74 }
75
76 $rows[] = $row;
77 }
78
79 $rowsCount += $params['offset'] ?? 0;
80 $pagination->setRecordCount($rowsCount);
81
82 $this->setRawRows($rows);
83 }
84
85 protected function getActions(): array
86 {
87 $actions = parent::getActions();
88 $actions[] = $this->getCalculateTotalCountAction($this->getPagination());
89
90 return $actions;
91 }
92}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
setTotalCountCalculator(Closure $value)
Определения lazyloadtotalcount.php:28
setRawRowsWithLazyLoadPagination(Closure $getRawRowsCallback)
Определения lazyloadtotalcount.php:50
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$rows
Определения options.php:264