51 $obj = is_object(
$res);
52 if ($obj && is_subclass_of(
$res,
"CAllDBResult"))
54 $this->result =
$res->result;
55 $this->nSelectedCount =
$res->nSelectedCount;
56 $this->arResult =
$res->arResult;
57 $this->arResultAdd =
$res->arResultAdd;
58 $this->bNavStart =
$res->bNavStart;
59 $this->NavPageNomer =
$res->NavPageNomer;
60 $this->bShowAll =
$res->bShowAll;
61 $this->NavNum =
$res->NavNum;
62 $this->NavPageCount =
$res->NavPageCount;
63 $this->NavPageSize =
$res->NavPageSize;
64 $this->NavShowAll =
$res->NavShowAll;
65 $this->NavRecordCount =
$res->NavRecordCount;
66 $this->bFirstPrintNav =
$res->bFirstPrintNav;
67 $this->PAGEN =
$res->PAGEN;
68 $this->SIZEN =
$res->SIZEN;
69 $this->bFromArray =
$res->bFromArray;
70 $this->bFromLimited =
$res->bFromLimited;
71 $this->nPageWindow =
$res->nPageWindow;
72 $this->bDescPageNumbering =
$res->bDescPageNumbering;
73 $this->SqlTraceIndex =
$res->SqlTraceIndex;
75 $this->arUserFields =
$res->arUserFields;
83 $this->result =
$res->getResource();
84 $this->resultObject =
$res;
88 $this->arResult =
$res;
120 'bDescPageNumbering',
133 if ($this->bNavStart || $this->bFromArray)
135 if (!is_array($this->arResult))
141 next($this->arResult);
146 if ($this->SqlTraceIndex)
153 if ($this->SqlTraceIndex)
156 $exec_time = round(microtime(
true) -
$start_time, 10);
157 $DB->addDebugTime($this->SqlTraceIndex, $exec_time);
158 $DB->timeQuery += $exec_time;
170 if ($this->resultObject !==
null)
172 $res = $this->resultObject->fetch();
200 abstract protected function Seek(
int $offset): void;
202 function NavQuery($strSql, $cnt, $arNavStartParams, $bIgnoreErrors =
false)
206 if (isset($arNavStartParams[
"SubstitutionFunction"]))
208 $arNavStartParams[
"SubstitutionFunction"]($this, $strSql, $cnt, $arNavStartParams);
215 $this->NavRecordCount = $cnt;
217 if ($this->NavShowAll)
223 $this->NavPageCount = ($this->NavPageSize > 0 ? floor($this->NavRecordCount / $this->NavPageSize) : 0);
227 if ($this->NavPageSize > 0)
231 if ($this->NavPageCount == 0 && $makeweight > 0)
233 $this->NavPageCount = 1;
240 $NavFirstRecordShow = 0;
241 if ($this->NavPageNomer != $this->NavPageCount)
243 $NavFirstRecordShow += $makeweight;
247 $NavLastRecordShow = $makeweight + ($this->NavPageCount - $this->NavPageNomer + 1) * $this->NavPageSize;
251 if ($this->NavPageSize > 0 && ($this->NavRecordCount % $this->NavPageSize > 0))
253 $this->NavPageCount++;
257 $this->
calculatePageNumber(1,
true, (
bool)($arNavStartParams[
"checkOutOfRange"] ??
false));
258 if ($this->NavPageNomer ===
null)
264 $NavFirstRecordShow = $this->NavPageSize * ($this->NavPageNomer - 1);
268 $NavAdditionalRecords = 0;
269 if (
is_set($arNavStartParams,
"iNavAddRecords"))
271 $NavAdditionalRecords = $arNavStartParams[
"iNavAddRecords"];
274 if (!$this->NavShowAll)
276 $strSql .=
" LIMIT " . ($NavLastRecordShow - $NavFirstRecordShow + $NavAdditionalRecords) .
" OFFSET " . $NavFirstRecordShow;
279 if (is_object($this->
DB))
281 $res_tmp = $this->
DB->
Query($strSql, $bIgnoreErrors);
285 $res_tmp =
$DB->Query($strSql, $bIgnoreErrors);
289 if ($bIgnoreErrors && ($res_tmp ===
false))
294 $this->result = $res_tmp->result;
295 $this->
DB = $res_tmp->DB;
297 if ($this->SqlTraceIndex)
303 $temp_arrray_add = [];
309 if (intval($NavLastRecordShow - $NavFirstRecordShow) > 0 && $tmp_cnt > ($NavLastRecordShow - $NavFirstRecordShow))
311 $temp_arrray_add[] =
$ar;
315 $temp_arrray[] =
$ar;
319 if ($this->SqlTraceIndex)
322 $exec_time = round(microtime(
true) -
$start_time, 10);
323 $DB->addDebugTime($this->SqlTraceIndex, $exec_time);
324 $DB->timeQuery += $exec_time;
327 $this->arResult = (!empty($temp_arrray) ? $temp_arrray :
false);
328 $this->arResultAdd = (!empty($temp_arrray_add) ? $temp_arrray_add :
false);
329 $this->nSelectedCount = $cnt;
331 $this->bFromLimited =
true;
341 if (is_array($this->arResultAdd) && !empty($this->arResultAdd))
354 if ($this->NavRecordCount == 0 || ($this->NavPageCount == 1 && !$this->NavShowAll))
362 public function NavPrint(
$title, $show_allways =
false, $StyleText =
"text", $template_path =
false)
367 public function GetNavPrint(
$title, $show_allways =
false, $StyleText =
"text", $template_path =
false, $arDeleteParam =
false)
383 if ($this->NavRecordCount == 0 || ($this->NavPageCount == 1 && !$this->NavShowAll))
392 if (is_array($arDeleteParam))
394 $arDel = array_merge($arDel, $arDeleteParam);
397 if ($strNavQueryString <>
"")
402 if ($template_path !==
false && !file_exists($template_path) && file_exists(
$_SERVER[
"DOCUMENT_ROOT"] . $template_path))
404 $template_path =
$_SERVER[
"DOCUMENT_ROOT"] . $template_path;
407 if ($this->bDescPageNumbering ===
true)
409 if ($this->NavPageNomer + floor(
$nPageWindow / 2) >= $this->NavPageCount)
470 if ($template_path !==
false && file_exists($template_path))
494 include($template_path);
495 $res = ob_get_contents();
497 $this->bFirstPrintNav =
false;
501 if ($this->bFirstPrintNav)
504 $this->bFirstPrintNav =
false;
507 $res .=
'<font class="' . $StyleText .
'">' .
$title .
' ';
508 if ($this->bDescPageNumbering ===
true)
511 $NavFirstRecordShow = 0;
512 if ($this->NavPageNomer != $this->NavPageCount)
514 $NavFirstRecordShow += $makeweight;
517 $NavFirstRecordShow += ($this->NavPageCount -
$this->NavPageNomer) * $this->NavPageSize + 1;
519 if ($this->NavPageCount == 1)
525 $NavLastRecordShow = $makeweight + ($this->NavPageCount - $this->NavPageNomer + 1) * $this->NavPageSize;
528 $res .= $NavFirstRecordShow;
529 $res .=
' - ' . $NavLastRecordShow;
532 $res .=
"\n<br>\n</font>";
534 $res .=
'<font class="' . $StyleText .
'">';
536 if ($this->NavPageNomer < $this->NavPageCount)
538 $res .=
'<a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . $this->NavPageCount . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sBegin .
'</a> | <a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . ($this->NavPageNomer + 1) . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sPrev .
'</a>';
542 $res .= $sBegin .
' | ' . $sPrev;
545 $res .=
' | ';
550 $NavRecordGroupPrint = $this->NavPageCount - $NavRecordGroup + 1;
551 if ($NavRecordGroup == $this->NavPageNomer)
553 $res .=
'<b>' . $NavRecordGroupPrint .
'</b> ';
557 $res .=
'<a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . $NavRecordGroup . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $NavRecordGroupPrint .
'</a> ';
562 if ($this->NavPageNomer > 1)
564 $res .=
'<a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . ($this->NavPageNomer - 1) . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sNext .
'</a> | <a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=1' . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sEnd .
'</a> ';
568 $res .= $sNext .
' | ' . $sEnd .
' ';
573 $res .= ($this->NavPageNomer - 1) * $this->NavPageSize + 1;
575 if ($this->NavPageNomer != $this->NavPageCount)
585 $res .=
"\n<br>\n</font>";
587 $res .=
'<font class="' . $StyleText .
'">';
589 if ($this->NavPageNomer > 1)
591 $res .=
'<a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=1' . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sBegin .
'</a> | <a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . ($this->NavPageNomer - 1) . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sPrev .
'</a>';
595 $res .= $sBegin .
' | ' . $sPrev;
598 $res .=
' | ';
603 if ($NavRecordGroup == $this->NavPageNomer)
605 $res .=
'<b>' . $NavRecordGroup .
'</b> ';
609 $res .=
'<a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . $NavRecordGroup . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $NavRecordGroup .
'</a> ';
614 if ($this->NavPageNomer < $this->NavPageCount)
616 $res .=
'<a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . ($this->NavPageNomer + 1) . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sNext .
'</a> | <a href="' . $sUrlPath .
'?PAGEN_' . $this->NavNum .
'=' . $this->NavPageCount . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sEnd .
'</a> ';
620 $res .= $sNext .
' | ' . $sEnd .
' ';
626 $res .= $this->NavShowAll ?
'| <a href="' . $sUrlPath .
'?SHOWALL_' . $this->NavNum .
'=0' . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sPaged .
'</a> ' :
'| <a href="' . $sUrlPath .
'?SHOWALL_' . $this->NavNum .
'=1' . $strNavQueryString .
'#nav_start' .
$add_anchor .
'">' . $sAll .
'</a> ';
635 return $this->
NavNext(
true, $strPrefix, $bDoEncode);
640 return $this->
NavNext(
true, $strPrefix,
true,
false);
643 public function GetNext($bTextHtmlAuto =
true, $use_tilda =
true)
647 if (!$this->arGetNextCache)
649 $this->arGetNextCache = [];
650 foreach (
$arRes as $FName => $arFValue)
652 $this->arGetNextCache[$FName] = array_key_exists($FName .
"_TYPE",
$arRes);
658 foreach (
$arRes as $FName => $arFValue)
660 if (isset($this->arGetNextCache[$FName]) && $this->arGetNextCache[$FName] && $bTextHtmlAuto)
664 elseif (is_array($arFValue))
668 elseif ($arFValue !=
'' && preg_match(
"/[;&<>\"]/", $arFValue))
674 $arTilda[$FName] = $arFValue;
676 $arTilda[
"~" . $FName] = $arFValue;
682 foreach (
$arRes as $FName => $arFValue)
684 if ($this->arGetNextCache[$FName] && $bTextHtmlAuto)
688 elseif (is_array($arFValue))
692 elseif (preg_match(
"/[;&<>\"]/", $arFValue))
705 return "|" . ($NavParams[
"SHOW_ALL"] ?
"" : $NavParams[
"PAGEN"]) .
"|" . $NavParams[
"SHOW_ALL"] .
"|";
715 if (is_array($nPageSize))
718 if (isset(
$params[
"iNumPage"]))
720 $iNumPage =
$params[
"iNumPage"];
722 if (isset(
$params[
"nPageSize"]))
724 $nPageSize =
$params[
"nPageSize"];
726 if (isset(
$params[
"bDescPageNumbering"]))
730 if (isset(
$params[
"bShowAll"]))
734 if (isset(
$params[
"NavShowAll"]))
744 $nPageSize = intval($nPageSize);
747 $PAGEN_NAME =
"PAGEN_" . (
$NavNum + 1);
748 $SHOWALL_NAME =
"SHOWALL_" . (
$NavNum + 1);
750 global ${$PAGEN_NAME}, ${$SHOWALL_NAME};
752 if ($iNumPage ===
false)
754 $PAGEN = ${$PAGEN_NAME} ?? 0;
762 $SHOWALL = ${$SHOWALL_NAME};
774 $localStorage =
$application->getLocalSession(
'navigation');
775 $session = $localStorage->getData();
802 $SHOW_ALL = (
$bShowAll && (isset($SHOWALL) ? ($SHOWALL == 1) : ($inSession && isset($session[
$SESS_ALL]) && $session[
$SESS_ALL] == 1)));
814 $localStorage->set(
$SESS_ALL, $SHOW_ALL);
824 if (is_array($nPageSize) && isset($nPageSize[
"bShowAll"]))
826 $this->bShowAll = $nPageSize[
"bShowAll"];
833 $this->bNavStart =
true;
839 $this->NavShowAll =
$arParams[
"SHOW_ALL"];
841 $this->SESS_SIZEN =
$arParams[
"SESS_SIZEN"] ??
null;
842 $this->SESS_PAGEN =
$arParams[
"SESS_PAGEN"] ??
null;
843 $this->SESS_ALL =
$arParams[
"SESS_ALL"] ??
null;
850 if ($this->NavNum > 1)
864 if ($this->bFromLimited)
869 if (is_array($nPageSize))
878 if ($this->bFromArray)
880 $this->NavRecordCount =
count($this->arResult);
881 if ($this->NavRecordCount < 1)
886 if ($this->NavShowAll)
891 $this->NavPageCount = floor($this->NavRecordCount / $this->NavPageSize);
892 if ($this->NavRecordCount % $this->NavPageSize > 0)
894 $this->NavPageCount++;
900 $NavFirstRecordShow = $this->NavPageSize * ($this->NavPageNomer - 1);
903 $this->arResult = array_slice($this->arResult, $NavFirstRecordShow, $NavLastRecordShow - $NavFirstRecordShow);
911 protected function calculatePageNumber(
int $defaultNumber = 1,
bool $useSession =
true,
bool $checkOutOfRange =
false)
916 if ($this->PAGEN > 0 && $this->PAGEN <= $this->NavPageCount)
921 elseif ($useSession && $this->SESS_PAGEN &&
$application->getKernelSession()->isStarted())
923 $localStorage =
$application->getLocalSession(
'navigation');
924 $session = $localStorage->getData();
926 if ($session[$this->SESS_PAGEN] > 0 && $session[$this->SESS_PAGEN] <= $this->NavPageCount)
935 if ($checkOutOfRange !==
true)
937 $this->NavPageNomer = $defaultNumber;
941 $this->NavPageNomer =
null;
953 $this->NavRecordCount =
$count;
960 if ($this->NavRecordCount < 1)
965 if ($this->NavShowAll)
971 $this->NavPageCount = floor($this->NavRecordCount / $this->NavPageSize);
972 if ($this->NavRecordCount % $this->NavPageSize > 0)
974 $this->NavPageCount++;
981 $NavFirstRecordShow = $this->NavPageSize * ($this->NavPageNomer - 1);
984 if ($this->SqlTraceIndex)
989 $this->
Seek($NavFirstRecordShow);
991 $this->arResult = [];
992 for (
$i = $NavFirstRecordShow;
$i < $NavLastRecordShow;
$i++)
996 $this->arResult[] =
$res;
1004 if ($this->SqlTraceIndex)
1007 $exec_time = round(microtime(
true) -
$start_time, 10);
1008 $DB->addDebugTime($this->SqlTraceIndex, $exec_time);
1009 $DB->timeQuery += $exec_time;
1022 $this->nSelectedCount =
false;
1025 $this->arResult =
$arr;
1026 $this->bFromArray =
true;
1029 public function NavNext($bSetGlobalVars =
true, $strPrefix =
"str_", $bDoEncode =
true, $bSkipEntities =
true)
1032 if (
$arr && $bSetGlobalVars)
1036 $varname = $strPrefix .
$key;
1039 if ($bDoEncode && !is_array(
$val) && !is_object(
$val))
1059 public function GetPageNavString($navigationTitle, $templateName =
"", $showAlways =
false, $parentComponent =
null)
1061 return $this->
GetPageNavStringEx($dummy, $navigationTitle, $templateName, $showAlways, $parentComponent);
1073 "NAV_TITLE" => $navigationTitle,
1074 "NAV_RESULT" => $this,
1075 "SHOW_ALWAYS" => $showAlways,
1081 "bitrix:system.pagenavigation",
1086 "HIDE_ICONS" =>
"Y",
1098 $this->usedUserFields =
false;
1106 $this->arUserFields =
false;
1114 if ($this->arUserFields)
1117 if ($this->usedUserFields ===
false)
1119 $this->usedUserFields = [];
1120 foreach ($this->arUserFields as $userField)
1122 if (isset($userField[
'FIELD_NAME']) && array_key_exists($userField[
'FIELD_NAME'],
$res))
1124 $this->usedUserFields[] = $userField;
1129 foreach ($this->usedUserFields as $userField)
1131 $name = $userField[
'FIELD_NAME'];
1132 if ($userField[
'MULTIPLE'] ===
'Y')
1154 if ($this->arReplacedAliases)
1156 foreach ($this->arReplacedAliases as $tech => $human)
GetNavPrint($title, $show_allways=false, $StyleText="text", $template_path=false, $arDeleteParam=false)
SetUserFields($arUserFields)
NavQuery($strSql, $cnt, $arNavStartParams, $bIgnoreErrors=false)
ExtractEditFields($strPrefix="str_")
GetPageNavStringEx(&$navComponentObject, $navigationTitle, $templateName="", $showAlways=false, $parentComponent=null, $componentParams=[])
static GetNavParams($nPageSize=0, $bShowAll=true, $iNumPage=false)
ExtractFields($strPrefix="str_", $bDoEncode=true)
NavPrint($title, $show_allways=false, $StyleText="text", $template_path=false)
NavStart($nPageSize=0, $bShowAll=true, $iNumPage=false)
NavNext($bSetGlobalVars=true, $strPrefix="str_", $bDoEncode=true, $bSkipEntities=true)
InitNavStartVars($nPageSize=0, $bShowAll=true, $iNumPage=false)
GetNext($bTextHtmlAuto=true, $use_tilda=true)
calculatePageNumber(int $defaultNumber=1, bool $useSession=true, bool $checkOutOfRange=false)
static NavStringForCache($nPageSize=0, $bShowAll=true, $iNumPage=false)
GetPageNavString($navigationTitle, $templateName="", $showAlways=false, $parentComponent=null)
$NavRecordCountChangeDisable
static GetOptionString($module_id, $name, $def="", $site=false)
global $USER_FIELD_MANAGER
$_SERVER["DOCUMENT_ROOT"]
FormatText($strText, $strTextType="text")
GetPagePath($page=false, $get_index_page=null)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']