iCount = count($aList); if ($this->iCount == 0) { return new UIContentBlock(); } $this->sClass = $sClass; $this->aList = $aList; $this->sFilter = $sFilter; $this->sBackUrl = $sBackUrl; $this->iIdx = $iIdx; if ($this->iIdx>0) { $this->iIdFirst = $aList[0]; $this->iIdPrev = $aList[$iIdx - 1]; } if ($this->iIdx < $this->iCount -1) { $this->iIdNext = $aList[$iIdx + 1]; $this->iIdLast = $aList[$this->iCount - 1]; } $this->sPostedFields = $sPostedFieldsForBackUrl; } /** * @return int */ public function GetIdx(): int { return $this->iIdx + 1; } /** * @return string */ public function GetPostedFields(): string { return $this->sPostedFields; } /** * @return int */ public function GetCount(): int { return $this->iCount; } private function GetUrlFromId($iId) { $sUrl = iTopStandardURLMaker::MakeObjectURL($this->sClass, $iId); return $sUrl; } /** * @return string */ public function GetUrlFirst(): string { return $this->GetUrlFromId($this->iIdFirst); } /** * @return string */ public function GetUrlPrev(): string { return $this->GetUrlFromId($this->iIdPrev); } /** * @return string */ public function GetUrlNext(): string { return $this->GetUrlFromId($this->iIdNext); } /** * @return int|mixed */ public function GetUrlLast(): string { return $this->GetUrlFromId($this->iIdLast); } /** * @return string */ public function GetBackUrl(): string { return $this->sBackUrl; } /** * @return string */ public function GetFilter(): string { return $this->sFilter; } /** * @return string */ public function GetList(): string { return json_encode($this->aList); } /** * @return bool */ public function HasPrec(): bool { return $this->iIdx > 0; } /** * @return bool */ public function HasNext(): bool { return $this->iIdx+1 < $this->iCount; } }