• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/subelement.php
  • Класс: CAdminSubResult
  • Вызов: CAdminSubResult::GetNavPrint
public function GetNavPrint($title, $show_allways=true, $StyleText="", $template_path=false, $arDeleteParam=false)
{
	if($template_path === false)
		$template_path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/iblock/admin/templates/navigation.php";

	/** @noinspection PhpUnusedLocalVariableInspection */
	$add_anchor = $this->add_anchor;

	/** @noinspection PhpUnusedLocalVariableInspection */
	$sBegin = GetMessage("nav_begin");
	/** @noinspection PhpUnusedLocalVariableInspection */
	$sEnd = GetMessage("nav_end");
	/** @noinspection PhpUnusedLocalVariableInspection */
	$sNext = GetMessage("nav_next");
	/** @noinspection PhpUnusedLocalVariableInspection */
	$sPrev = GetMessage("nav_prev");
	/** @noinspection PhpUnusedLocalVariableInspection */
	$sAll = GetMessage("nav_all");
	/** @noinspection PhpUnusedLocalVariableInspection */
	$sPaged = GetMessage("nav_paged");

	$nPageWindow = $this->nPageWindow;

	if(!$show_allways)
	{
		if ($this->NavRecordCount == 0 || ($this->NavPageCount == 1 && $this->NavShowAll == false))
			return '';
	}

	$sUrlPath = $this->list_url;
	$strNavQueryString = $this->list_url_params;
	if (strncmp($strNavQueryString, '&', 1) !== 0)
	{
		$strNavQueryString = '&' . $strNavQueryString;
	}
	$strNavQueryString = htmlspecialcharsbx($strNavQueryString);

	if($template_path!==false && !file_exists($template_path) && file_exists($_SERVER["DOCUMENT_ROOT"].$template_path))
		$template_path = $_SERVER["DOCUMENT_ROOT"].$template_path;

	if($this->bDescPageNumbering === true)
	{
		if($this->NavPageNomer + floor($nPageWindow/2) >= $this->NavPageCount)
			$nStartPage = $this->NavPageCount;
		else
		{
			if($this->NavPageNomer + floor($nPageWindow/2) >= $nPageWindow)
				$nStartPage = $this->NavPageNomer + floor($nPageWindow/2);
			else
			{
				if($this->NavPageCount >= $nPageWindow)
					$nStartPage = $nPageWindow;
				else
					$nStartPage = $this->NavPageCount;
			}
		}

		if($nStartPage - $nPageWindow >= 0)
			$nEndPage = $nStartPage - $nPageWindow + 1;
		else
			$nEndPage = 1;
	}
	else
	{
		if($this->NavPageNomer > floor($nPageWindow/2) + 1 && $this->NavPageCount > $nPageWindow)
			$nStartPage = $this->NavPageNomer - floor($nPageWindow/2);
		else
			$nStartPage = 1;

		if($this->NavPageNomer <= $this->NavPageCount - floor($nPageWindow/2) && $nStartPage + $nPageWindow-1 <= $this->NavPageCount)
			$nEndPage = $nStartPage + $nPageWindow - 1;
		else
		{
			$nEndPage = $this->NavPageCount;
			if($nEndPage - $nPageWindow + 1 >= 1)
				$nStartPage = $nEndPage - $nPageWindow + 1;
		}
	}

	$this->nStartPage = $nStartPage;
	$this->nEndPage = $nEndPage;

	if($template_path!==false && file_exists($template_path))
	{
		ob_start();
		/** @noinspection PhpIncludeInspection */
		include($template_path);
		$res = ob_get_contents();
		ob_end_clean();
		$this->bFirstPrintNav = false;
		return $res;
	}
	else
	{
		return '';
	}
}