添加分单位浏览功能

This commit is contained in:
wlx 2013-04-16 09:38:28 +00:00
parent 336e352d20
commit 1890f8f8dd
4 changed files with 70 additions and 4 deletions

View File

@ -1940,6 +1940,28 @@ class DataController extends Zend_Controller_Action
public function jsonexit($data){ public function jsonexit($data){
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
return true; return true;
} }
function organizationAction()
{
$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 in ('pointOfContact','resourceProvider','owner')");
$this->view->organisation=$state->fetchAll();
if (!empty($name)) {
$this->view->codename=$name;
$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.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 {
//提供全部分类列表
}
}
} }

View File

@ -38,8 +38,8 @@ $this->headTitle()->setSeparator(' - ');
<li><a class="btn" href="/data/map"><i class="icon-globe"></i>空间浏览</a></li> <li><a class="btn" href="/data/map"><i class="icon-globe"></i>空间浏览</a></li>
<li><a class="btn" href="/data/timemap"><i class="icon-film"></i>时空浏览</a></li> <li><a class="btn" href="/data/timemap"><i class="icon-film"></i>时空浏览</a></li>
<li><a class="btn" href="/data/organization"><i class="icon-filter"></i>单位浏览</a></li> <li><a class="btn" href="/data/organization"><i class="icon-filter"></i>单位浏览</a></li>
<li><a class="btn" href="/data/fund"><i class="icon-money"></i>项目浏览</a></li> <li><a class="btn disabled" href="/data/fund"><i class="icon-money"></i>项目浏览</a></li>
<li><a class="btn" href="/data/author"><i class="icon-user-md"></i>作者浏览</a></li> <li><a class="btn disabled" href="/data/author"><i class="icon-user-md"></i>作者浏览</a></li>
<li><a class="btn" href="/knowledge"><i class="icon-exchange"></i>文献浏览</a></li> <li><a class="btn" href="/knowledge"><i class="icon-exchange"></i>文献浏览</a></li>
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,43 @@
<?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/organization">分单位浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row-fluid">
<div><?= $this->breadcrumb() ?> </div>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php if (!empty($this->paginator)) : ?>
<h3>当前浏览:<?php echo $this->codename; ?></h3>
<div class="pagenavi"><?= $this->paginator; ?></div>
<ul id="datalist">
<?php foreach($this->paginator as $md) : ?>
<div class="media well well-small">
<a class="pull-left" href="#">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>" data-src="holder.js/128x128">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php else : ?>
<div class="row-fluid">
<ul class="nav nav-pills">
<?php foreach($this->organisation as $cg) : ?>
<li><a href='/data/organization/name/<?php echo $cg['organisation']; ?>'><?php print($cg['organisation']); ?></a></li>
<?php endforeach; ?>
</ul></div>
<?php endif; ?>

View File

@ -13,7 +13,8 @@ $this->breadcrumb()->setSeparator(' > ');
<div class="span2"> <div class="span2">
<?= $this->partial('heihe/navi.phtml'); ?> <?= $this->partial('heihe/navi.phtml'); ?>
</div> </div>
<div class="span10"> <div class="span10">
<div><?= $this->breadcrumb() ?> </div>
<div id="intro"> <div id="intro">
<p> <p>
各类社会经济数据。 各类社会经济数据。