// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2017 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: zhangyajun <[email protected]>
// +----------------------------------------------------------------------
namespace think\paginator\driver;
use think\Paginator;
class BootstrapDetailed extends Paginator
{
/**
* 上一页按钮
* @param string $text
* @return string
*/
protected function getPreviousButton($text = "上一页")
{
if ($this->currentPage() <= 1) {
return $this->getDisabledTextWrapper($text);
}
$url = $this->url(
$this->currentPage() - 1
);
return $this->getPageLinkWrapper($url, $text);
}
//总数标签
protected function totalshow()
{
$totalhtml="
共".$this->total."条记录 第".$this->currentPage()."页/共".$this->lastPage()."页
";
return $totalhtml;
}
//尾页标签
protected function showlastpage($text = '尾页')
{
if($this->currentPage()==$this->lastPage())
{
return $this->getDisabledTextWrapper($text);
}
$url = $this->url($this->lastPage());
return $this->getPageLinkWrapper($url, $text);
}
//首页标签
protected function showfirstpage($text = '首页')
{
if
($this->currentPage()==1)
{
return $this->getDisabledTextWrapper($text);
}
$url = $this->url(1);
return $this->getPageLinkWrapper($url, $text);
}
//后五页
protected function afivepage($text = '后五页')
{
if($this->lastPage()currentPage()+5)
{
return $this->getDisabledTextWrapper($text);
}
$url = $this->url($this->currentPage()+5);
return $this->getPageLinkWrapper($url, $text);
}
//前五页
protected function bfivepage($text = '前五页')
{
if($this->currentPage()<5)
{
return $this->getDisabledTextWrapper($text);
}
$url = $this->url($this->currentPage()-5);
return $this->getPageLinkWrapper($url, $text);
}
/**
* 下一页按钮
* @param string $text
* @return string
*/
protected function getNextButton($text = '下一页')
{
if (!$this->hasMore) {
return $this->getDisabledTextWrapper($text);
}
$url = $this->url($this->currentPage() + 1);
return $this->getPageLinkWrapper($url, $text);
}
//跳转到哪页
protected function gopage()
{
return $gotohtml="
";
// return $totalhtml;;
}
/**
* 页码按钮
* @return string
*/
protected function getLinks()
{
if ($this->simple)
return '';
$block = [
'first' => null,
'slider' => null,
'last' => null
];
$side = 2;
$window = $side * 2;
if ($this->lastPage < $window +1) {
$block['slider'] = $this->getUrlRange(1, $this->lastPage);
} elseif ($this->currentPage <= $window-1) {
$block['slider'] = $this->getUrlRange(1, $window +