• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/ui/pagenavigation.php
  • Класс: BitrixMainUIhelps
  • Вызов: helps::initFromUri
public function initFromUri()
{
	$navParams = array();

	$request = BitrixMainContext::getCurrent()->getRequest();

	if(($value = $request->getQuery($this->id)) !== null)
	{
		//parameters are in the QUERY_STRING
		$params = explode("-", $value);
		for($i = 0, $n = count($params); $i < $n; $i += 2)
		{
			$navParams[$params[$i]] = $params[$i+1];
		}
	}
	else
	{
		//probably parametrs are in the SEF URI
		$matches = array();
		if(preg_match("'/".preg_quote($this->id, "'")."/page-([\d]+|all)+(/size-([\d]+))?'", $request->getRequestUri(), $matches))
		{
			$navParams["page"] = $matches[1];
			if(isset($matches[3]))
			{
				$navParams["size"] = $matches[3];
			}
		}
	}

	if(isset($navParams["size"]))
	{
		//set page size from user request
		if(in_array($navParams["size"], $this->pageSizes))
		{
			$this->setPageSize((int)$navParams["size"]);
		}
	}

	if(isset($navParams["page"]))
	{
		if($navParams["page"] == "all" && $this->allowAll == true)
		{
			//show all records in one page
			$this->allRecords = true;
		}
		else
		{
			//set current page within boundaries
			$currentPage = (int)$navParams["page"];
			if($currentPage >= 1)
			{
				if($this->recordCount !== null)
				{
					$maxPage = $this->getPageCount();
					if($currentPage > $maxPage)
					{
						$currentPage = $maxPage;
					}
				}
				$this->setCurrentPage($currentPage);
			}
		}
	}
}