实现分单位浏览

This commit is contained in:
wlx 2012-07-12 09:56:03 +00:00
parent 6f090abbdf
commit 06fdb86d88
3 changed files with 68 additions and 1 deletions

View File

@ -303,6 +303,25 @@ class DataController extends Zend_Controller_Action
//提供全部分类列表 //提供全部分类列表
} }
} }
function organisationAction()
{
$page = $this->_request->getParam('page');
$name = $this->_request->getParam('name');
$state=$this->db->query("select distinct responsible.organisation from responsible left join role on role.resid=responsible.id where role.role='pointOfContact'");
$this->view->organisation=$state->fetchAll();
if (!empty($name)) {
$this->view->codename=$name;
$sql="select count(m.id) from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role='pointOfContact' and s.organisation=?";
$row=$this->db->fetchRow($sql,array($name));
$sum=$row['count'];
$select=$this->db->select();
$select->from('normalmetadata as m','*')->joinLeft('role as r','m.uuid=r.uuid')->joinLeft('responsible as s','r.resid=s.id')->where('r.role=?','pointOfContact')->where('s.organisation=?',$name)->order('m.title')->limitPage($page,$this->limit);
$this->view->metadata=$this->db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$this->limit);
} else {
//提供全部分类列表
}
}
/* /*
* 时间浏览方式 * 时间浏览方式
* todo:实现xml的缓存基于时间的缓存每天基于元数据修改的缓存每次导入后都重新生成一次。 * todo:实现xml的缓存基于时间的缓存每天基于元数据修改的缓存每次导入后都重新生成一次。

View File

@ -0,0 +1,44 @@
<?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->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/data/organisation">分单位浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.masonry.min.js');
?>
<div id="organisation">
<div id="organisation_nav" class="full clear">
<div class="title fleft">
单位
</div>
<div class="organisation fright clear">
<ul>
<?php foreach($this->organisation as $cg) : ?>
<li><a href='/data/organisation/name/<?php echo $cg['organisation']; ?>'><?php print($cg['organisation']); ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="clearfix"></div>
<div class="datalist clear mt12">
<ul id="datalist">
<?php if($this->metadata) : foreach($this->metadata as $md) : ?>
<li id="data_<?php echo $md['uuid']; ?>" class="databox box-shadow">
<div class="subject text-shadow"><a href="/data/<?php echo $md['uuid']; ?>"><?php echo $this->escape($md['title']);?></a><div class="more"><a href="/data/<?php echo $md['uuid']; ?>">查看详细</a></div></div>
<div class="data_content clear">
<div class="thumb box-shadow"><img src="/service/thumb/id/<?php echo $md['id'];?>" /></div>
<div class="description"><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></div>
</div>
</li>
<?php endforeach;endif; ?>
</ul>
</div>
<div class="page">
<?php if ($this->page) echo $this->page->getNavigation(); ?>
</div>
</div>
</div>

View File

@ -216,7 +216,11 @@ input[type="submit"]:hover,.btn:hover, .btn:focus, .btn:active {outline:medium n
#category_nav .title{width:150px;background:#d9efff;font-size:16px;font-weight:bold;text-align:center;height:70px;line-height:70px;} #category_nav .title{width:150px;background:#d9efff;font-size:16px;font-weight:bold;text-align:center;height:70px;line-height:70px;}
#category_nav .categorys{width:800px;background:#f2f9ff;padding:0px;} #category_nav .categorys{width:800px;background:#f2f9ff;padding:0px;}
#category_nav .categorys ul{padding:0 0 0 5px;margin:0px;} #category_nav .categorys ul{padding:0 0 0 5px;margin:0px;}
#category_nav .categorys ul li{float:left;height:35px;line-height:35px;width:15%;} #category_nav .categorys ul li{float:left;height:35px;line-height:35px;width:15%;}
#organisation_nav .organisation{width:800px;background:#f2f9ff;padding:0px;}
#organisation_nav .organisation ul{padding:0 0 0 5px;margin:0px;}
#organisation_nav .organisation ul li{float:left;height:35px;line-height:35px;width:30%;}
#organisation_nav .title{width:150px;background:#d9efff;font-size:16px;font-weight:bold;text-align:center;height:105px;line-height:80px;}
.datalist ul{padding:0px;margin:0;} .datalist ul{padding:0px;margin:0;}
.datalist ul li{width:99%;padding:0px;margin:0px;margin-top:10px;background:#f2f9ff;} .datalist ul li{width:99%;padding:0px;margin:0px;margin-top:10px;background:#f2f9ff;}