'; var $Last =''; var $Next =''; var $Prev =''; //Text that will be shown befor the total pages var $ShowTotalPagesString="Pages:"; //the parameter that will be used in the url to set the number of the first item in a page var $ScriptVariable="st"; //url of script (defaults to $PHP_SELF) var $ScriptFile=""; //array of parameters ( array(parameter => value,parameter => value) ) var $Parameters=""; //array of parameters ( array(parameter => value,parameter => value) ) var $filter=0; var $pg_count=""; // number of pages var $pg_string=""; // Internal variables used generated by the class var $ParamString=""; var $StartItem; //intenal message var $message; function Create_Pagelinks() { $this->First="\"navigace-first\""; $this->Last ="\"navigace-last\""; $this->Next ="\"navigace-next\""; $this->Prev ="\"navigace-previous\""; // $this->C_form ="
"; $check = $this->check_variables(); if ($check==0) { // $PageString=$this->C_form; // $PageString="
"; //Determin how many pages there are $TotalPages=ceil($this->TotalItems/$this->ItemsPerPage); if ($this->ShowTotalPages){ $this->pg_string = "(" . $this->ShowTotalPagesString . " " .$TotalPages .") "; $this->pg_count = $TotalPages; } //Determin on wich page we are $CurrentPage = (floor($this->StartItem/$this->ItemsPerPage))+1; if ($CurrentPage > $TotalPages) $CurrentPage = $TotalPages; //if page is not 1 create Prev and first if set to true if ($CurrentPage>1) { if ($this->FirstLast==true) { $PageString .=''.$this->First.' '; } if ($this->PrevNext==true) { $PageString .=''.$this->Prev.' '; } } //Make Trailing Pages if ($this->UsePoints) { if ($CurrentPage-$this->TrailingPages>1) $PageString .=$this->Points . " "; } $NumberedPages = ($this->TrailingPages*2)+1; for ($i=0;$i<$NumberedPages;++$i) { $Pagenumber = $CurrentPage + $i - $this->TrailingPages; if ($Pagenumber<$CurrentPage && $Pagenumber > 0){ $PageString .='' . $Pagenumber . ' '; } if ($Pagenumber==$CurrentPage){ $url = $this->ScriptFile . '-' . $this->ParamString . $this->ScriptVariable . ''; $PageString .= "".$CurrentPage." "; } if ($Pagenumber>$CurrentPage && $Pagenumber <= $TotalPages){ $PageString .='' . $Pagenumber . ' '; } } if ($this->UsePoints) { if ($CurrentPage + $this->TrailingPages < $TotalPages) $PageString .= $this->Points ." "; } //if page is not last create Next and Last if set to true if ($CurrentPage<$TotalPages) { if ($this->PrevNext==true) { $PageString .=''.$this->Next.' '; } if ($this->FirstLast==true) { $PageString .=''.$this->Last.' '; } } }else{ $PageString=$this->message; } return $PageString; } function check_variables() { $this->message="";$ok=0; if ((int)($this->TotalItems)<0) $this->TotalItems=0; $this->TotalItems=floor($this->TotalItems); if ($this->TotalItems==0) { $this->message .= '0 records loaded...'; $ok = 1; } if ((int)($this->ItemsPerPage)<1) $this->ItemsPerPage=1; $this->ItemsPerPage=floor($this->ItemsPerPage); $this->StartItem=$_REQUEST[$this->ScriptVariable]; if (!$this->StartItem) $this->StartItem = 0; if ((int)($this->StartItem)<0) $this->StartItem = 0; if ((int)($this->StartItem)>$this->TotalItems){ if($this->TotalItems){ $this->StartItem=$this->TotalItems-$this->ItemsPerPage; }else{$this->StartItem=0;} } $this->StartItem=floor($this->StartItem); if ((int)($this->TrailingPages)<0) $this->TrailingPages=0; $this->TrailingPages=floor($this->TrailingPages); if (!$this->PrevNext && $this->TrailingPages<1) $this->TrailingPages=1; if (!$this->ScriptFile) $this->ScriptFile=$_SERVER["PHP_SELF"]; $this->ParamString=""; foreach ($this->Parameters as $key => $value) { // $this->ParamString .="$key-$value-"; $this->ParamString .="$value-"; } return $ok; } } ?>