添加了排序和按单位查询功能

This commit is contained in:
Li Jianxuan 2014-03-17 03:56:27 +00:00
parent f33f58a49d
commit 6fa6a06734
1 changed files with 30 additions and 1 deletions

View File

@ -104,7 +104,36 @@ 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(!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' ");
}
view::addPaginator($metadata->fetchAll(),$this,10,'layout/metadata/pagination/browse');