iCount = count($aList); if ( $this->iCount == 0) { return new UIContentBlock(); } $this->sClass = $sClass; $this->aList = $aList; $this->sFilter = $sFilter; $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]; } } /** * @return int */ public function GetIdx(): int { return $this->iIdx+1; } /** * @return int */ public function GetCount(): int { return $this->iCount; } private function GetUrlFromId($iId) { $sUrl = iTopStandardURLMaker::MakeObjectURL($this->sClass, $iId).'&filter='.urlencode($this->sFilter); return $sUrl; } /** * @return int|mixed */ public function GetUrlFirst() { return $this->GetUrlFromId( $this->iIdFirst); } /** * @return int|mixed */ public function GetUrlPrev() { return $this->GetUrlFromId( $this->iIdPrev); } /** * @return int|mixed */ public function GetUrlNext() { return $this->GetUrlFromId( $this->iIdNext); } /** * @return int|mixed */ public function GetUrlLast() { return $this->GetUrlFromId( $this->iIdLast); } /** * @return string */ public function GetList(): string { return json_encode($this->aList); } public function GetUrlSearch(){ $sAbsoluteUrl = utils::GetAbsoluteUrlAppRoot(); return "{$sAbsoluteUrl}pages/UI.php?operation=search&filter=".urlencode(urlencode('["'.$this->sFilter.'",[],[]]')); } /** * @return bool */ public function HasPrec(): bool { return $this->iIdx > 0; } /** * @return bool */ public function HasNext(): bool { return $this->iIdx+1 < $this->iCount; } }