修改了分页类中提供的样式
This commit is contained in:
parent
ac2fc22970
commit
505d5a9776
|
@ -1,107 +1,106 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->data);
|
||||
|
||||
$this->headTitle('高级搜索');
|
||||
if (!empty($this->codename)) $this->headTitle($this->codename);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/metadata.css');
|
||||
$this->headLink()->appendStylesheet('/css/search.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
||||
$this->breadcrumb('高级搜索');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->headScript()->appendFile('http://maps.google.cn/maps?file=api&v=2&key='.$this->config->google->maps->api);
|
||||
?>
|
||||
<div id='tools'>
|
||||
<?= $this->partial('data/tools.phtml'); ?>
|
||||
</div>
|
||||
<?php if (!empty($this->metadata)) :
|
||||
echo $this->page->getNavigation();?>
|
||||
<hr />
|
||||
|
||||
<?php
|
||||
foreach($this->metadata as $md) : ?>
|
||||
<div class="mditem">
|
||||
<div class="thumb"><img src="/service/thumb/id/<?php echo $md['id'];?>" /></div>
|
||||
<h2><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a>
|
||||
</h2>
|
||||
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php echo $this->page->getNavigation();?>
|
||||
<?php else: ?>
|
||||
<script src="/js/dragzoom.js" type="text/javascript"></script>
|
||||
<div id="map"></div>
|
||||
<div id="spatial">
|
||||
<form id="search" enctype="application/x-www-form-urlencoded" action="/data/advancesearch" method="post">
|
||||
<fieldset><legend>时间范围</legend><ul>
|
||||
<li><span>开始时间:</span>
|
||||
<input name="start" type="text" id="start" />
|
||||
</li>
|
||||
<li><span>结束时间:</span>
|
||||
<input name="end" type="text" id="end" />
|
||||
</li></ul></fieldset>
|
||||
<fieldset><legend>空间范围</legend><ul>
|
||||
<li><span>东:</span>
|
||||
|
||||
<input name="e" id="e" type="text" /></li>
|
||||
<li><span>南:</span>
|
||||
<input name="s" id="s" type="text" /></li>
|
||||
<li><span>西:</span>
|
||||
<input name="w" id="w" type="text" /></li>
|
||||
<li><span>北:</span>
|
||||
<input name="n" id="n" type="text" /></li></ul></fieldset>
|
||||
<span>关键词:</span><input name="q" id="q" type="text" />
|
||||
<input id="search" type="submit" value="搜索" onclick="dosubmit()" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function dosubmit()
|
||||
{
|
||||
theForm.action="/data/advancesearch";
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var map = new GMap2(document.getElementById("map"));
|
||||
map.setCenter(new GLatLng(36, 103.5, 5));
|
||||
map.addControl(new GSmallMapControl());
|
||||
map.addControl(new GMapTypeControl());
|
||||
map.setMapType(G_HYBRID_MAP);
|
||||
var txte=document.getElementById("e");
|
||||
var txtw=document.getElementById("w");
|
||||
var txtn=document.getElementById("n");
|
||||
var txts=document.getElementById("s");
|
||||
/* first set of options is for the visual overlay.*/
|
||||
var boxStyleOpts = {
|
||||
opacity: .2,
|
||||
border: "2px solid red"
|
||||
}
|
||||
|
||||
/* second set of options is for everything else */
|
||||
var otherOpts = {
|
||||
buttonHTML: "<img src='/images/zoom-button.gif' />",
|
||||
buttonZoomingHTML: "<img src='/images/zoom-button-activated.gif' />",
|
||||
buttonStartingStyle: {width: '24px', height: '24px'}
|
||||
};
|
||||
|
||||
/* third set of options specifies callbacks */
|
||||
var callbacks = {
|
||||
dragend: function(nw,ne,se,sw,nwpx,nepx,sepx,swpx){txte.value=ne.lng();txtn.value=ne.lat();txts.value=sw.lat();txtw.value=sw.lng();}
|
||||
};
|
||||
|
||||
map.addControl(new DragZoomControl(boxStyleOpts, otherOpts, callbacks));
|
||||
</script>
|
||||
|
||||
<div id="help">
|
||||
<fieldset><legend>搜索说明</legend><ul><li>关键词:您可以使用一个关键词,比如“沙漠”,也可以使用多个关键词,中间用空格分开。</li>
|
||||
<li>空间范围:这是以度为单位的十进制数字。比如,东经125度30分,可以输入为125.5。您也可以通过下面的在线地图工具直接在图上拉框选择一个范围,空间坐标会自动转换到文本框中。</li>
|
||||
<li>时间范围:指数据的时间范围,从开始时间到结束时间,若结束时间不填,则是一个时间点。时间格式为YYYY-MM-DD。</li>
|
||||
<li>还不清楚?您可以到<a href="http://forum.westgis.ac.cn/viewforum.php?f=30">论坛</a>提问。</li>
|
||||
</ul></fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->data);
|
||||
$this->headTitle('高级搜索');
|
||||
if (!empty($this->codename)) $this->headTitle($this->codename);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/metadata.css');
|
||||
$this->headLink()->appendStylesheet('/css/search.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
||||
$this->breadcrumb('高级搜索');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->headScript()->appendFile('http://maps.google.cn/maps?file=api&v=2&key='.$this->config->google->maps->api);
|
||||
?>
|
||||
<div>
|
||||
<?= $this->partial('data/tools.phtml'); ?>
|
||||
</div>
|
||||
<?php if (!empty($this->metadata)) :
|
||||
echo $this->page->getNavigation();?>
|
||||
<hr />
|
||||
|
||||
<?php
|
||||
foreach($this->metadata as $md) : ?>
|
||||
<div class="mditem">
|
||||
<div class="thumb"><img src="/service/thumb/id/<?php echo $md['id'];?>" /></div>
|
||||
<h2><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a>
|
||||
</h2>
|
||||
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php echo $this->page->getNavigation();?>
|
||||
<?php else: ?>
|
||||
<script src="/js/dragzoom.js" type="text/javascript"></script>
|
||||
<div id="map"></div>
|
||||
<div id="spatial">
|
||||
<form id="search" enctype="application/x-www-form-urlencoded" action="/data/advancesearch" method="post">
|
||||
<fieldset><legend>时间范围</legend><ul>
|
||||
<li><span>开始时间:</span>
|
||||
<input name="start" type="text" id="start" />
|
||||
</li>
|
||||
<li><span>结束时间:</span>
|
||||
<input name="end" type="text" id="end" />
|
||||
</li></ul></fieldset>
|
||||
<fieldset><legend>空间范围</legend><ul>
|
||||
<li><span>东:</span>
|
||||
|
||||
<input name="e" id="e" type="text" /></li>
|
||||
<li><span>南:</span>
|
||||
<input name="s" id="s" type="text" /></li>
|
||||
<li><span>西:</span>
|
||||
<input name="w" id="w" type="text" /></li>
|
||||
<li><span>北:</span>
|
||||
<input name="n" id="n" type="text" /></li></ul></fieldset>
|
||||
<span>关键词:</span><input name="q" id="q" type="text" />
|
||||
<input id="search" type="submit" value="搜索" onclick="dosubmit()" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function dosubmit()
|
||||
{
|
||||
theForm.action="/data/advancesearch";
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var map = new GMap2(document.getElementById("map"));
|
||||
map.setCenter(new GLatLng(36, 103.5, 5));
|
||||
map.addControl(new GSmallMapControl());
|
||||
map.addControl(new GMapTypeControl());
|
||||
map.setMapType(G_HYBRID_MAP);
|
||||
var txte=document.getElementById("e");
|
||||
var txtw=document.getElementById("w");
|
||||
var txtn=document.getElementById("n");
|
||||
var txts=document.getElementById("s");
|
||||
/* first set of options is for the visual overlay.*/
|
||||
var boxStyleOpts = {
|
||||
opacity: .2,
|
||||
border: "2px solid red"
|
||||
}
|
||||
|
||||
/* second set of options is for everything else */
|
||||
var otherOpts = {
|
||||
buttonHTML: "<img src='/images/zoom-button.gif' />",
|
||||
buttonZoomingHTML: "<img src='/images/zoom-button-activated.gif' />",
|
||||
buttonStartingStyle: {width: '24px', height: '24px'}
|
||||
};
|
||||
|
||||
/* third set of options specifies callbacks */
|
||||
var callbacks = {
|
||||
dragend: function(nw,ne,se,sw,nwpx,nepx,sepx,swpx){txte.value=ne.lng();txtn.value=ne.lat();txts.value=sw.lat();txtw.value=sw.lng();}
|
||||
};
|
||||
|
||||
map.addControl(new DragZoomControl(boxStyleOpts, otherOpts, callbacks));
|
||||
</script>
|
||||
|
||||
<div id="help">
|
||||
<fieldset><legend>搜索说明</legend><ul><li>关键词:您可以使用一个关键词,比如“沙漠”,也可以使用多个关键词,中间用空格分开。</li>
|
||||
<li>空间范围:这是以度为单位的十进制数字。比如,东经125度30分,可以输入为125.5。您也可以通过下面的在线地图工具直接在图上拉框选择一个范围,空间坐标会自动转换到文本框中。</li>
|
||||
<li>时间范围:指数据的时间范围,从开始时间到结束时间,若结束时间不填,则是一个时间点。时间格式为YYYY-MM-DD。</li>
|
||||
<li>还不清楚?您可以到<a href="http://forum.westgis.ac.cn/viewforum.php?f=30">论坛</a>提问。</li>
|
||||
</ul></fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php endif; ?>
|
|
@ -1,227 +1,229 @@
|
|||
<?php
|
||||
class Pagination
|
||||
{
|
||||
private $_navigationItemCount = 5; //导航栏显示导航总页数
|
||||
private $_pageSize = null; //每页项目数
|
||||
private $_align = "left"; //导航栏显示位置
|
||||
private $_itemCount = null; //总项目数
|
||||
private $_pageCount = null; //总页数
|
||||
private $_currentPage = null; //当前页
|
||||
private $_front = null; //前端控制器
|
||||
private $_PageParaName = "page"; //页面参数名称
|
||||
|
||||
private $_firstPageString = "|<<"; //导航栏中第一页显示的字符
|
||||
private $_nextPageString = ">>"; //导航栏中前一页显示的字符
|
||||
private $_previousPageString = "<<"; //导航栏中后一页显示的字符
|
||||
private $_lastPageString = ">>|"; //导航栏中最后一页显示的字符
|
||||
private $_typestr="元数据";
|
||||
|
||||
public function __construct($itemCount, $page=1,$pageSize=10,$typestr="元数据")
|
||||
{
|
||||
if(!is_numeric($itemCount) || (!is_numeric($pageSize)))
|
||||
throw new Exception("Pagination Error:not Number");
|
||||
$this->_itemCount = $itemCount;
|
||||
$this->_pageSize = $pageSize;
|
||||
$this->_typestr=$typestr;
|
||||
$this->_front = Zend_Controller_Front::getInstance();
|
||||
|
||||
$this->_pageCount = ceil($itemCount/$pageSize); //总页数
|
||||
//$page = $this->_front->getRequest()->getParam($this->_PageParaName);
|
||||
if(empty($page) || (!is_numeric($page))) //为空或不是数字,设置当前页为1
|
||||
{
|
||||
$this->_currentPage = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($page < 1)
|
||||
$page = 1;
|
||||
if($page > $this->_pageCount)
|
||||
$page = $this->_pageCount;
|
||||
$this->_currentPage = $page;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前页
|
||||
* @param int 当前页
|
||||
*/
|
||||
public function getCurrentPage()
|
||||
{
|
||||
return $this->_currentPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回导航栏目
|
||||
* @return string 导航html
|
||||
*/
|
||||
public function getNavigation()
|
||||
{
|
||||
if ($this->_itemCount<$this->_pageSize) return '';
|
||||
$navigation = '<div class="PageNavigation">';
|
||||
$navigation .= "共有".$this->_typestr."<em>$this->_itemCount</em>条 \n";
|
||||
|
||||
$pageCote = ceil($this->_currentPage / ($this->_navigationItemCount - 1)) - 1; //当前页处于第几栏分页
|
||||
$pageCoteCount = ceil($this->_pageCount / ($this->_navigationItemCount - 1)); //总分页栏
|
||||
$pageStart = $pageCote * ($this->_navigationItemCount -1) + 1; //分页栏中起始页
|
||||
$pageEnd = $pageStart + $this->_navigationItemCount - 1; //分页栏中终止页
|
||||
if($this->_pageCount < $pageEnd)
|
||||
{
|
||||
$pageEnd = $this->_pageCount;
|
||||
}
|
||||
if($pageCote > 0) //首页导航
|
||||
{
|
||||
$navigation .= '<a href="'.$this->createHref(1)."\">$this->_firstPageString</a> ";
|
||||
}
|
||||
if($this->_currentPage != 1) //上一页导航
|
||||
{
|
||||
$navigation .= '<a href="'.$this->createHref($this->_currentPage-1);
|
||||
$navigation .= "\">$this->_previousPageString</a> ";
|
||||
}
|
||||
while ($pageStart <= $pageEnd) //构造数字导航区
|
||||
{
|
||||
if($pageStart == $this->_currentPage)
|
||||
{
|
||||
$navigation .= "<strong>$pageStart</strong> ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$navigation .= '<a href="'.$this->createHref($pageStart)."\">$pageStart</a> ";
|
||||
}
|
||||
$pageStart++;
|
||||
}
|
||||
if($this->_currentPage != $this->_pageCount) //下一页导航
|
||||
{
|
||||
$navigation .= '<a href="'.$this->createHref($this->_currentPage+1)."\">$this->_nextPageString</a> ";
|
||||
}
|
||||
if($pageCote < $pageCoteCount-1) //未页导航
|
||||
{
|
||||
$navigation .= '<a href="'.$this->createHref($this->_pageCount)."\">$this->_lastPageString</a> ";
|
||||
}
|
||||
//添加直接导航框
|
||||
$navigation .= '<input type="text" size="3" onkeydown="if(event.keyCode==13){window.location=\' ';
|
||||
$navigation .= $this->createHref().'\'+this.value;return false;}" />';
|
||||
$navigation .= "</div>";
|
||||
return $navigation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取得导航栏显示导航总页数
|
||||
*
|
||||
* @return int 导航栏显示导航总页数
|
||||
*/
|
||||
public function getNavigationItemCount()
|
||||
{
|
||||
return $this->_navigationItemCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置导航栏显示导航总页数
|
||||
*
|
||||
* @param int $navigationCount:导航栏显示导航总页数
|
||||
*/
|
||||
public function setNavigationItemCoun($navigationCount)
|
||||
{
|
||||
if(is_numeric($navigationCount))
|
||||
{
|
||||
$this->_navigationItemCount = $navigationCount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置首页显示字符
|
||||
* @param string $firstPageString 首页显示字符
|
||||
*/
|
||||
public function setFirstPageString($firstPageString)
|
||||
{
|
||||
$this->_firstPageString = $firstPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置上一页导航显示字符
|
||||
* @param string $previousPageString:上一页显示字符
|
||||
*/
|
||||
public function setPreviousPageString($previousPageString)
|
||||
{
|
||||
$this->_previousPageString = $previousPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置下一页导航显示字符
|
||||
* @param string $nextPageString:下一页显示字符
|
||||
*/
|
||||
public function setNextPageString($nextPageString)
|
||||
{
|
||||
$this->_nextPageString = $nextPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置未页导航显示字符
|
||||
* @param string $nextPageString:未页显示字符
|
||||
*/
|
||||
public function setLastPageString($lastPageString)
|
||||
{
|
||||
$this->_lastPageString = $lastPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置导航字符显示位置
|
||||
* @param string $align:导航位置
|
||||
*/
|
||||
public function setAlign($align)
|
||||
{
|
||||
$align = strtolower($align);
|
||||
if($align == "center")
|
||||
{
|
||||
$this->_align = "center";
|
||||
}elseif($align == "right")
|
||||
{
|
||||
$this->_align = "right";
|
||||
}else
|
||||
{
|
||||
$this->_align = "left";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设置页面参数名称
|
||||
* @param string $pageParamName:页面参数名称
|
||||
*/
|
||||
public function setPageParamName($pageParamName)
|
||||
{
|
||||
$this->_PageParaName = $pageParamName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取页面参数名称
|
||||
* @return string 页面参数名称
|
||||
*/
|
||||
public function getPageParamName()
|
||||
{
|
||||
return $this->_PageParaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成导航链接地址
|
||||
* @param int $targetPage:导航页
|
||||
* @return string 链接目标地址
|
||||
*/
|
||||
private function createHref($targetPage = null)
|
||||
{
|
||||
$params = $this->_front->getRequest()->getParams();
|
||||
$controller = $params["controller"];
|
||||
$action = $params["action"];
|
||||
|
||||
$targetUrl = "/$controller/$action";
|
||||
foreach ($params as $key => $value)
|
||||
{
|
||||
if($key != "controller" && $key != "module" && $key != "action" && $key != $this->_PageParaName)
|
||||
{
|
||||
$targetUrl .= "/$key/$value";
|
||||
}
|
||||
}
|
||||
if(isset($targetPage)) //指定目标页
|
||||
$targetUrl .= "/$this->_PageParaName/$targetPage";
|
||||
else
|
||||
$targetUrl .= "/$this->_PageParaName/";
|
||||
return $targetUrl;
|
||||
}
|
||||
<?php
|
||||
class Pagination
|
||||
{
|
||||
private $_navigationItemCount = 5; //导航栏显示导航总页数
|
||||
private $_pageSize = null; //每页项目数
|
||||
private $_align = "left"; //导航栏显示位置
|
||||
private $_itemCount = null; //总项目数
|
||||
private $_pageCount = null; //总页数
|
||||
private $_currentPage = null; //当前页
|
||||
private $_front = null; //前端控制器
|
||||
private $_PageParaName = "page"; //页面参数名称
|
||||
|
||||
private $_firstPageString = "|<<"; //导航栏中第一页显示的字符
|
||||
private $_nextPageString = ">>"; //导航栏中前一页显示的字符
|
||||
private $_previousPageString = "<<"; //导航栏中后一页显示的字符
|
||||
private $_lastPageString = ">>|"; //导航栏中最后一页显示的字符
|
||||
private $_typestr="元数据";
|
||||
|
||||
public function __construct($itemCount, $page=1,$pageSize=10,$typestr="元数据")
|
||||
{
|
||||
if(!is_numeric($itemCount) || (!is_numeric($pageSize)))
|
||||
throw new Exception("Pagination Error:not Number");
|
||||
$this->_itemCount = $itemCount;
|
||||
$this->_pageSize = $pageSize;
|
||||
$this->_typestr=$typestr;
|
||||
$this->_front = Zend_Controller_Front::getInstance();
|
||||
|
||||
$this->_pageCount = ceil($itemCount/$pageSize); //总页数
|
||||
//$page = $this->_front->getRequest()->getParam($this->_PageParaName);
|
||||
if(empty($page) || (!is_numeric($page))) //为空或不是数字,设置当前页为1
|
||||
{
|
||||
$this->_currentPage = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($page < 1)
|
||||
$page = 1;
|
||||
if($page > $this->_pageCount)
|
||||
$page = $this->_pageCount;
|
||||
$this->_currentPage = $page;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前页
|
||||
* @param int 当前页
|
||||
*/
|
||||
public function getCurrentPage()
|
||||
{
|
||||
return $this->_currentPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回导航栏目
|
||||
* @return string 导航html
|
||||
*/
|
||||
public function getNavigation()
|
||||
{
|
||||
if ($this->_itemCount<$this->_pageSize) return '';
|
||||
$navigation = '<div class="pagination" style="line-height:14px">';
|
||||
$navigation .= "<ul>";
|
||||
$navigation .= "<li><span>共有".$this->_typestr."<em>$this->_itemCount</em>条</span></li> \n";
|
||||
|
||||
$pageCote = ceil($this->_currentPage / ($this->_navigationItemCount - 1)) - 1; //当前页处于第几栏分页
|
||||
$pageCoteCount = ceil($this->_pageCount / ($this->_navigationItemCount - 1)); //总分页栏
|
||||
$pageStart = $pageCote * ($this->_navigationItemCount -1) + 1; //分页栏中起始页
|
||||
$pageEnd = $pageStart + $this->_navigationItemCount - 1; //分页栏中终止页
|
||||
|
||||
if($this->_pageCount < $pageEnd)
|
||||
{
|
||||
$pageEnd = $this->_pageCount;
|
||||
}
|
||||
if($pageCote > 0) //首页导航
|
||||
{
|
||||
$navigation .= '<li><a href="'.$this->createHref(1)."\">$this->_firstPageString</a></li> ";
|
||||
}
|
||||
if($this->_currentPage != 1) //上一页导航
|
||||
{
|
||||
$navigation .= '<li><a href="'.$this->createHref($this->_currentPage-1);
|
||||
$navigation .= "\">$this->_previousPageString</a></li> ";
|
||||
}
|
||||
while ($pageStart <= $pageEnd) //构造数字导航区
|
||||
{
|
||||
if($pageStart == $this->_currentPage)
|
||||
{
|
||||
$navigation .= '<li class="active"><a href="javascript:;">'.$pageStart.'</a></li> ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$navigation .= '<li><a href="'.$this->createHref($pageStart)."\">$pageStart</a></li> ";
|
||||
}
|
||||
$pageStart++;
|
||||
}
|
||||
if($this->_currentPage != $this->_pageCount) //下一页导航
|
||||
{
|
||||
$navigation .= '<li><a href="'.$this->createHref($this->_currentPage+1)."\">$this->_nextPageString</a></li> ";
|
||||
}
|
||||
if($pageCote < $pageCoteCount-1) //未页导航
|
||||
{
|
||||
$navigation .= '<li><a href="'.$this->createHref($this->_pageCount)."\">$this->_lastPageString</a></li> ";
|
||||
}
|
||||
//添加直接导航框
|
||||
$navigation .= '<input type="text" size="3" class="input-mini" onkeydown="if(event.keyCode==13){window.location=\' ';
|
||||
$navigation .= $this->createHref().'\'+this.value;return false;}" />';
|
||||
$navigation .= "</ul></div>";
|
||||
return $navigation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取得导航栏显示导航总页数
|
||||
*
|
||||
* @return int 导航栏显示导航总页数
|
||||
*/
|
||||
public function getNavigationItemCount()
|
||||
{
|
||||
return $this->_navigationItemCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置导航栏显示导航总页数
|
||||
*
|
||||
* @param int $navigationCount:导航栏显示导航总页数
|
||||
*/
|
||||
public function setNavigationItemCoun($navigationCount)
|
||||
{
|
||||
if(is_numeric($navigationCount))
|
||||
{
|
||||
$this->_navigationItemCount = $navigationCount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置首页显示字符
|
||||
* @param string $firstPageString 首页显示字符
|
||||
*/
|
||||
public function setFirstPageString($firstPageString)
|
||||
{
|
||||
$this->_firstPageString = $firstPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置上一页导航显示字符
|
||||
* @param string $previousPageString:上一页显示字符
|
||||
*/
|
||||
public function setPreviousPageString($previousPageString)
|
||||
{
|
||||
$this->_previousPageString = $previousPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置下一页导航显示字符
|
||||
* @param string $nextPageString:下一页显示字符
|
||||
*/
|
||||
public function setNextPageString($nextPageString)
|
||||
{
|
||||
$this->_nextPageString = $nextPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置未页导航显示字符
|
||||
* @param string $nextPageString:未页显示字符
|
||||
*/
|
||||
public function setLastPageString($lastPageString)
|
||||
{
|
||||
$this->_lastPageString = $lastPageString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置导航字符显示位置
|
||||
* @param string $align:导航位置
|
||||
*/
|
||||
public function setAlign($align)
|
||||
{
|
||||
$align = strtolower($align);
|
||||
if($align == "center")
|
||||
{
|
||||
$this->_align = "center";
|
||||
}elseif($align == "right")
|
||||
{
|
||||
$this->_align = "right";
|
||||
}else
|
||||
{
|
||||
$this->_align = "left";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设置页面参数名称
|
||||
* @param string $pageParamName:页面参数名称
|
||||
*/
|
||||
public function setPageParamName($pageParamName)
|
||||
{
|
||||
$this->_PageParaName = $pageParamName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取页面参数名称
|
||||
* @return string 页面参数名称
|
||||
*/
|
||||
public function getPageParamName()
|
||||
{
|
||||
return $this->_PageParaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成导航链接地址
|
||||
* @param int $targetPage:导航页
|
||||
* @return string 链接目标地址
|
||||
*/
|
||||
private function createHref($targetPage = null)
|
||||
{
|
||||
$params = $this->_front->getRequest()->getParams();
|
||||
$controller = $params["controller"];
|
||||
$action = $params["action"];
|
||||
|
||||
$targetUrl = "/$controller/$action";
|
||||
foreach ($params as $key => $value)
|
||||
{
|
||||
if($key != "controller" && $key != "module" && $key != "action" && $key != $this->_PageParaName)
|
||||
{
|
||||
$targetUrl .= "/$key/$value";
|
||||
}
|
||||
}
|
||||
if(isset($targetPage)) //指定目标页
|
||||
$targetUrl .= "/$this->_PageParaName/$targetPage";
|
||||
else
|
||||
$targetUrl .= "/$this->_PageParaName/";
|
||||
return $targetUrl;
|
||||
}
|
||||
}
|
|
@ -87,4 +87,4 @@ legend { background:#fff;}
|
|||
.paginationControl A:hover {border:#2b66a5 1px solid;COLOR: #000;BACKGROUND-COLOR:lightyellow}
|
||||
.paginationControl A:active {border:#2b66a5 1px solid;COLOR: #000;BACKGROUND-COLOR:lightyellow}
|
||||
.paginationControl SPAN.current {border:navy 1px solid;margin-right:2px;padding:2px 5px;FONT-WEIGHT: bold;COLOR: #fff;BACKGROUND-COLOR: #2e6ab1}
|
||||
.paginationControl SPAN.disabled {border:#929292 1px solid;padding:2px 5px;COLOR: #929292; MARGIN-RIGHT: 2px;}
|
||||
.paginationControl SPAN.disabled {border:#929292 1px solid;padding:2px 5px;COLOR: #929292; MARGIN-RIGHT: 2px;}
|
||||
|
|
Loading…
Reference in New Issue