'; var $TableEndTag = ''; var $TotalText = "共有记录:[COUNT]条"; function Pager($fileName=NULL) { $this->FileName=$fileName; } function GetStart(){ $pageIndex=$this->PageIndex; if ($pageIndex > $this->GetPageCount()) $pageIndex=$this->GetPageCount(); elseif($pageIndex<=0) $pageIndex=1; return ($pageIndex - 1) * $this->PageSize; } function Render() { //$this->BtnCount=$buttonCount; $pagerStyle=$this->Style; $pageIndex=$this->PageIndex; if ($pageIndex== "" || $pageIndex==0) $pageIndex = 1; $pageCount=$this->GetPageCount(); $othervalue = $this->OtherValue; if ($pageCount <=0) echo $this->EmptyDataText; else{ if (!empty($this->ClassName)) $table_class="class='".$this->ClassName."'"; echo str_replace("[CLASS]",$table_class,$this->TableBeginTag); if (strtolower($pagerStyle) == "normal" || strtolower($pagerStyle) == "google" || strtolower($pagerStyle) == ""){ $this->CreateTotalCell(); if ($pageIndex > 1){ $this->CreateCell($this->FirstText,$this->FirstImage,1,$othervalue); $this->CreateCell($this->PrevText,$this->PrevImage,$pageIndex - 1,$othervalue); } } if (strtolower($pagerStyle) == "normal" || strtolower($pagerStyle)=="") $this->CreatenormalPager($othervalue); elseif(strtolower($pagerStyle) == "google") $this->CreateGooglePager($othervalue); else exit("Undefined PagerStyle!"); if (strtolower($pagerStyle) == "normal" || strtolower($pagerStyle) == "google" || strtolower($pagerStyle)==""){ if ($pageIndex < $pageCount){ $this->CreateCell($this->NextText,$this->NextImage,$pageIndex + 1,$othervalue); $this->CreateCell($this->LastText,$this->LastImage,$pageCount,$othervalue); } } echo $this->TableEndTag; } } function GetPageCount() { if ($this->RecordCount % $this->PageSize > 0) return intval($this->RecordCount / $this->PageSize) + 1; else return intval($this->RecordCount / $this->PageSize); } function CreateGooglePager($othervalue) { $pageCount=$this->GetPageCount(); $pageIndex=$this->PageIndex; if ($pageIndex == "" || $pageIndex <=0) $pageIndex=1; elseif ($pageIndex > $pageCount) $pageIndex = $pageCount; $per_num = $this->BtnCount; $next_num = $this->BtnCount - 1; $min = $pageIndex - $per_num; //计算起始页 $max = $pageIndex + $next_num; //计算终止页 for ($i = $min; $i <= $max; $i++) { if ($i < 1) continue; if ($i > $pageCount) break; $this->CreateNumCell($i,$pageIndex == $i,$othervalue); } } function CreatenormalPager($othervalue) { $pageCount=$this->GetPageCount(); $alter = 2; $startPage = 1; $pageIndex=$this->PageIndex; if ($pageIndex == "" || $pageIndex <=0) $pageIndex=1; elseif ($pageIndex > $pageCount) $pageIndex = $pageCount; $endPage = $this->BtnCount; if ($pageCount <= $endPage) $endPage = $pageCount; if ($pageIndex > $alter){ $startPage = $pageIndex - $alter; $endPage = $endPage + ($pageIndex - $alter) - 1; } if ($endPage > $pageCount){ $startPage -= ($endPage - $pageCount); $endPage = $pageCount; } if ($pageIndex > $pageCount) $pageIndex = $pageCount; for ($i = $startPage; $i <= $endPage; $i++) $this->CreateNumCell($i,$pageIndex == $i,$othervalue); } function CreateCell($firstText,$imageUrl,$pageIndex,$othervalue) { $file_name=$this->FileName; $str_q=$this->QueryString; if (empty($imageUrl)) $str_table_cell="$firstText\n"; else $str_table_cell="\n"; echo $str_table_cell; } function CreateNumCell($pageIndex,$isCurPage,$othervalue) { $file_name=$this->FileName; $str_q=$this->QueryString; if (!$isCurPage) $str_table_cell="$pageIndex\n"; else $str_table_cell="$pageIndex\n"; echo $str_table_cell; } function CreateTotalCell() { $totalText=$this->TotalText; $totalText=str_replace("[COUNT]",$this->RecordCount,$totalText); $str_table_cell="$totalText  \n"; echo $str_table_cell; } } ?>Access denied for user 'greg'@'%' to database 'nissanclubdb'