在线和离线数据列表中添加排序判断

This commit is contained in:
Li Jianxuan 2014-03-18 08:53:19 +00:00
parent c004ae0813
commit 42162ae13d
1 changed files with 66 additions and 2 deletions

View File

@ -147,7 +147,39 @@ class IndexController extends AbstractActionController
{
$this->ViewModel->setTemplate("layout/metadata/datalist");
$metadata = new \Westdc\Metadata\Metadata;
$order = $this->params()->fromQuery('order');
$sort = $this->params()->fromQuery('sort');
$source = $this->params()->fromQuery('source');
$metadata = new \Westdc\Metadata\Outlink;
if(!empty($order))
{
if($order == "ts_created")
$metadata->opt->order = "m.ts_created";
if($order == "title")
$metadata->opt->order = "m.title";
if($order == "viewed")
$metadata->opt->order = "md.viewed";
}
if(!empty($sort))
{
if($sort == "asc")
$metadata->opt->sort = "asc";
if($sort == "desc")
$metadata->opt->sort = "desc";
}
if(!empty($source))
{
# $source = iconv("GB2312","UTF-8",$source);
if($source == "青海湖")
$metadata->opt->where = array(" ol.host='http://deep.qherc.org' ");
if($source == "三江源")
$metadata->opt->where = array(" ol.host='http://www.sanjiangyuan.org.cn' ");
}
$metadata->opt->where = array(' m.datatype=0 ');
view::addPaginator($metadata->fetchAll(),$this,10,'layout/metadata/pagination/onlinelist');
@ -158,7 +190,39 @@ class IndexController extends AbstractActionController
{
$this->ViewModel->setTemplate("layout/metadata/datalist");
$metadata = new \Westdc\Metadata\Metadata;
$order = $this->params()->fromQuery('order');
$sort = $this->params()->fromQuery('sort');
$source = $this->params()->fromQuery('source');
$metadata = new \Westdc\Metadata\Outlink;
if(!empty($order))
{
if($order == "ts_created")
$metadata->opt->order = "m.ts_created";
if($order == "title")
$metadata->opt->order = "m.title";
if($order == "viewed")
$metadata->opt->order = "md.viewed";
}
if(!empty($sort))
{
if($sort == "asc")
$metadata->opt->sort = "asc";
if($sort == "desc")
$metadata->opt->sort = "desc";
}
if(!empty($source))
{
# $source = iconv("GB2312","UTF-8",$source);
if($source == "青海湖")
$metadata->opt->where = array(" ol.host='http://deep.qherc.org' ");
if($source == "三江源")
$metadata->opt->where = array(" ol.host='http://www.sanjiangyuan.org.cn' ");
}
$metadata->opt->where = array(' m.datatype=1 ');
view::addPaginator($metadata->fetchAll(),$this,10,'layout/metadata/pagination/offlinelist');