debug = 0; $acName = $this->_request->getActionName(); if(in_array($acName,array("cold","bg","ar","bdk","eb"))) { $this->view->pageIn = "collapse1"; } if(in_array($acName,array("forest","dyk","plg"))) { $this->view->pageIn = "collapse2"; } if(in_array($acName,array("arid","hzz","yk",'zy','zynoc','lzg','lzs'))) { $this->view->pageIn = "collapse3"; } if(in_array($acName,array("meteo","autometeo","mobilemeteo","ec",'las','normalmeteo','regionalmeteo','doppler','hydro','airsounding'))) { $this->view->pageIn = "collapse4"; } if(in_array($acName,array("radiometer","airebone","lidar","widas",'asd'))) { $this->view->pageIn = "collapse5"; } if(in_array($acName,array("satellite"))) { $this->view->pageIn = "collapse6"; } if(in_array($acName,array("surveystd","document"))) { $this->view->pageIn = "collapse7"; } $this->view->pageID = "water-".$acName; } function indexAction() { $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER - Watershed Allied Telemetry Experimental Research','about'); } function documentAction() { $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(*) from reference where language<>'zh' and id in (select refid from mdref where uuid in (select m.uuid from en.normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on s.id=d.sourceid where s.code='water'))"); $sum=$row[0]['count']; $sql="select * from reference where language<>'zh' and id in (select refid from mdref where uuid in (select m.uuid from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on s.id=d.sourceid where s.code='water')) order by reference limit ? offset ?"; $this->view->refs=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit,"Publications"); $this->view->offset=$offset+1; } function coldAction() { $this->getmd('the cold region hydrology experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Cold region hydrology experiment','about'); $this->_helper->viewRenderer('base'); } function bgAction() { $this->getmd('Binggou watershed foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Binggou watershed foci experimental area','about'); $this->_helper->viewRenderer('base'); } function arAction() { $this->getmd("A''rou foci experimental area",'place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive("WATER: Arou foci experimental area",'about'); $this->_helper->viewRenderer('base'); } function bdkAction() { $this->getmd('Biandukou (BDK) foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Biandukou (BDK) foci experimental area','about'); $this->_helper->viewRenderer('base'); } function ebAction() { $this->getmd('Ebao foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Ebao foci experimental area','about'); $this->_helper->viewRenderer('base'); } function forestAction() { $this->getmd('the forest hydrology experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Forest hydrology experimental area','about'); $this->_helper->viewRenderer('base'); } function dykAction() { $this->getmd('Dayekou watershed foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Dayekou watershed foci experimental area','about'); $this->_helper->viewRenderer('base'); } function plgAction() { $this->getmd('Pailugou watershed (PLG) foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Pailugou watershed (PLG) foci experimental area','about'); $this->_helper->viewRenderer('base'); } function aridAction() { $this->getmd('the arid region hydrology experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Arid region hydrology experimental area','about'); $this->_helper->viewRenderer('base'); } function hzzAction() { $this->getmd('Huazhaizi foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Huazhaizi foci experimental area','about'); $this->_helper->viewRenderer('base'); } function ykAction() { $this->getmd('Yingke oasis station','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Yingke oasis station','about'); $this->_helper->viewRenderer('base'); } function zyAction() { $this->getmd('Zhangye city (ZY) foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Zhangye city (ZY) foci experimental area','about'); $this->_helper->viewRenderer('base'); } function zynocAction() { $this->getmd('National observatory on climatology at Zhangye (ZYNOC)','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: National observatory on climatology at Zhangye (ZYNOC)','about'); $this->_helper->viewRenderer('base'); } function lzgAction() { $this->getmd('Linze grassland foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Linze grassland foci experimental area','about'); $this->_helper->viewRenderer('base'); } function lzsAction() { $this->getmd('Linze station foci experimental area','place'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Linze station foci experimental area','about'); $this->_helper->viewRenderer('base'); } function meteoAction() { $this->getmd('meteorology and hydrology','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: meteorology and hydrology','about'); $this->_helper->viewRenderer('base'); } function autometeoAction() { $this->getmd('the meteorological observation','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: the meteorological observation','about'); $this->_helper->viewRenderer('base'); } function mobilemeteoAction() { $this->getmd('the mobile meteorological observation','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: the mobile meteorological observation','about'); $this->_helper->viewRenderer('base'); } function ecAction() { $this->getmd('eddy covariance','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: eddy covariance','about'); $this->_helper->viewRenderer('base'); } function lasAction() { $this->getmd('the large aperture scintillometer','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: the large aperture scintillometer','about'); $this->_helper->viewRenderer('base'); } function normalmeteoAction() { $this->getmd('the routine meteorological observation','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: the routine meteorological observation','about'); $this->_helper->viewRenderer('base'); } function regionalmeteoAction() { $this->getmd('the regional meteorological observation','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: the regional meteorological observation','about'); $this->_helper->viewRenderer('base'); } function dopplerAction() { $this->getmd('dual-polarization Doppler weather radar','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: dual-polarization Doppler weather radar','about'); $this->_helper->viewRenderer('base'); } function hydroAction() { $this->getmd('hydrology','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: hydrology','about'); $this->_helper->viewRenderer('base'); } function airsoundingAction() { $this->getmd('atmospheric profile','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: atmospheric profile','about'); $this->_helper->viewRenderer('base'); } function aireboneAction() { $this->getmd('airborne remote sensing','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: airborne remote sensing','about'); $this->_helper->viewRenderer('base'); } function radiometerAction() { $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $state=$this->db->query("select count(*) from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword ilike '%microwave radiometer') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing')"); $row=$state->fetchAll(); $sum=$row[0]['count']; $sql="select uuid,title from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword ilike '%microwave radiometer') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing') order by timebegin,title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->offset=$offset+1; $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: Microwave radiometers','about'); $this->_helper->viewRenderer('base'); } function lidarAction() { $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $state=$this->db->query("select count(*) from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword='lidar') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing')"); $row=$state->fetchAll(); $sum=$row[0]['count']; $sql="select uuid,title from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword='lidar') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing') order by timebegin,title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->offset=$offset+1; $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: LiDAR','about'); $this->_helper->viewRenderer('base'); } function widasAction() { $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $state=$this->db->query("select count(*) from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword='Wide-angle Infrared Dual-mode line/area Array Scanner,WiDAS') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing')"); $row=$state->fetchAll(); $sum=$row[0]['count']; $sql="select uuid,title from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword='Wide-angle Infrared Dual-mode line/area Array Scanner,WiDAS') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing') order by timebegin,title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->offset=$offset+1; $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: WiDAS','about'); $this->_helper->viewRenderer('base'); } function asdAction() { $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $state=$this->db->query("select count(*) from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword='SWPHI') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing')"); $row=$state->fetchAll(); $sum=$row[0]['count']; $sql="select uuid,title from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='theme' and keyword='SWPHI') and id in (select id from en.keyword where keytype='theme' and keyword='airborne remote sensing') order by timebegin,title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->offset=$offset+1; $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: OMIS-II','about'); $this->_helper->viewRenderer('base'); } function satelliteAction() { $this->getmd('satellite remote sensing','theme'); $archive = new Archive($this->db); $this->view->info = $archive->getOneArchive('WATER: satellite remote sensing','about'); $this->_helper->viewRenderer('base'); } function tagAction() { $key = $this->_request->getParam('key'); $keytype = $this->_request->getParam('keytype'); $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); if (!empty($key)) { $this->view->codename=$key; $sql=$this->db->quoteInto("select count(k.id) from en.keyword k left join en.normalmetadata m on k.id=m.id where length(k.keyword)>0 and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and k.keyword=?",$key); $state=$this->db->query($sql); $row=$state->fetchAll(); $sum=$row[0]['count']; $sql="select uuid,title,id,description from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keyword='".$key."') order by timebegin,title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); } else { $sql="select k.keyword,count(*),k.keytype from en.keyword k left join en.normalmetadata m on k.id=m.id where length(k.keyword)>0 and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') "; if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" and k.keytype='".$keytype."'"; $sql.=' group by k.keyword,k.keytype order by k.keytype,k.keyword,count desc'; $state=$this->db->query($sql); $this->view->keytype=$keytype; $this->view->keywords=$state->fetchAll(); } } function searchAction() { $this->view->addHelperPath('helper','Zend_View_Helper_'); $form=new SearchForm(); $this->view->form=$form; //$form->submit->setLabel('快速搜索'); $key=$this->_request->getParam('q'); if (!empty($key)) { $search=new Search($key); $where=$search->sql_expr(array("title","description")); $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(*) from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and ".$where); $sum=$row[0]['count']; $sql="select uuid,title,id,description from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and ".$where." order by timebegin,title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->key=$key; $this->view->offset=$offset+1; } } function timemapAction() { $sql="select id,uuid,west,south,north,east,title,timebegin,timeend from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and timebegin is not null and timebegin::date>date('2007-01-01')"; $this->view->rows=$this->db->fetchAll($sql); } function timelineAction() { $fn="watertime.xml"; $rows=$this->db->fetchAll("select ts_created from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') order by ts_created desc limit 1"); $last_update=strtotime($rows[0]['ts_created']); if (!file_exists($fn) || (filemtime($fn)<$last_update)) { $dateformat="M j Y"; $rows=$this->db->fetchAll("select id,uuid,description,title,timebegin,timeend from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and timebegin is not null order by timebegin,title"); $timexml=''; foreach($rows as $row) { $timexml.=''; $desc_length=mb_strlen($row['description'],"UTF-8"); $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8"); if ($desc_length>300) $desc.=" ..."; $timexml.=htmlspecialchars($desc); $timexml.="\n"; } $timexml.=''; $fp=fopen($fn,'w'); fwrite($fp,$timexml); fclose($fp); } } function categoryAction() { $code = (int)$this->_request->getParam('code'); $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from category where code=".$code.")"); $sum=$row[0]['count']; $this->view->category=$this->db->fetchAll('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh'); if ($code>0 && $code<20) { $sql="select uuid,title,description,id from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select distinct id from category where code=".$code.") order by timebegin,title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->offset=$offset+1; $row=$this->db->fetchRow("select name,name_zh from categorycode where code=?",$code); $this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']); } else { //提供全部分类列表 } } private function getmd($keyword,$type='theme') { $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); if (!is_array($keyword)) { $keyword=array($keyword); } $key="("; foreach($keyword as $k) { $key.="'".$k."',"; } $key=substr($key,0,-1); $key.=")"; $keyword=$key; $state=$this->db->query("select count(m.*) from en.normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='water' and m.id in (select id from en.keyword where keytype='".$type."' and keyword in ".$keyword.")"); $row=$state->fetchAll(); $sum=$row[0]['count']; //@todo: add order with title $sql="select uuid,title from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keytype='".$type."' and keyword in ".$keyword.") order by title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->offset=$offset+1; } //获取多项条件并列关系的数据并必须满足limited条件 //$keyword:字符串或字符串数组 //$limited:限制字符串 private function getmdlimited($keyword,$limited) { $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); if (!is_array($keyword)) { $keyword=array($keyword); } $key="("; foreach($keyword as $k) { $key.="'".$k."',"; } $key=substr($key,0,-1); $key.=")"; $keyword=$key; $state=$this->db->query("select count(m.*) from en.normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='water' and m.id in (select id from en.keyword where keyword='".$limited."') and m.id in (select id from en.keyword where keyword in ".$keyword.")"); $row=$state->fetchAll(); $sum=$row[0]['count']; //@todo: add order with title $sql="select uuid,title from en.normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='water') and id in (select id from en.keyword where keyword='".$limited."') and id in (select id from en.keyword where keyword in ".$keyword.") order by title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); $this->view->offset=$offset+1; } //基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者) function authorAction() { $ac = $this->_request->getParam('ac'); $id = (int)$this->_request->getParam('id'); if ($ac=='verified') { //已经认证过的数据作者 $this->view->tabID='author-verified'; $this->view->ac='verified'; if ($id) { //列出作者的数据 $sql="select username,realname from users where id=?"; $this->view->author=$this->db->fetchRow($sql,array($id)); $sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and a.userid=?"; $sth = $this->db->prepare($sql); $sth->execute(array($id)); $rows = $sth->fetchAll(); $paginator = Zend_Paginator::factory($rows); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; } else { //已经认证过的数据作者 $sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname"; $sth = $this->db->prepare($sql); $sth->execute(); $rows = $sth->fetchAll(); $paginator = Zend_Paginator::factory($rows); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(50); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; } } else if ($ac=='unverified' || empty($ac)) { //未认证的数据作者 $this->view->tabID='author-unverified'; $this->view->ac='unverified'; if ($id) { //列出数据 $sql="select individual as username from responsible where id=?"; $this->view->author=$this->db->fetchRow($sql,array($id)); $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and r.role in ('pointOfContact','resourceProvider','owner') and s.id=?"; $sth = $this->db->prepare($sql); $sth->execute(array($id)); $rows = $sth->fetchAll(); $paginator = Zend_Paginator::factory($rows); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; } else { //列出所有作者 $sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and role.role in ('pointOfContact','resourceProvider','owner')"; $sth = $this->db->prepare($sql); $sth->execute(); $rows = $sth->fetchAll(); $paginator = Zend_Paginator::factory($rows); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(50); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; } } } function organizationAction() { $page = $this->_request->getParam('page'); $name = $this->_request->getParam('name'); $state=$this->db->query("select distinct responsible.organisation from en.responsible left join en.role on role.resid=responsible.id where role.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and role.role in ('pointOfContact','resourceProvider','owner')"); $this->view->organisation=$state->fetchAll(); if (!empty($name)) { $this->view->codename=$name; $sql="select distinct m.* from en.normalmetadata m left join en.role r on m.uuid=r.uuid left join en.responsible s on r.resid=s.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and r.role in ('pointOfContact','resourceProvider','owner') and s.organisation=?"; $sth = $this->db->prepare($sql); $sth->execute(array($name)); $rows = $sth->fetchAll(); $paginator = Zend_Paginator::factory($rows); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; } else { //提供全部分类列表 } } }