add initial version of ReviewController

This commit is contained in:
wlx 2011-09-25 10:20:11 +00:00
parent 85c153458b
commit 8a19e26ad5
3 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,45 @@
<?php
class ReviewController extends Zend_Controller_Action
{
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->db=Zend_Registry::get('db');
}
function indexAction()
{
//最新10个收稿
$sql="select m.uuid,m.title,s.ts_created from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=0 order by s.ts_created desc limit 10";
$this->view->mdreceived = $this->db->fetchAll($sql);
//最新10个接收
$sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=1 order by s.ts_created desc limit 10";
$this->view->mdaccepted = $this->db->fetchAll($sql);
//最新10个送审
$sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status in (2,3,4) order by s.ts_created desc limit 10";
$this->view->mdinreview = $this->db->fetchAll($sql);
//最新10个已审
$sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=5 order by s.ts_created desc limit 10";
$this->view->mdreviewed = $this->db->fetchAll($sql);
}
/*
* 数据浏览
*/
function browseAction()
{
$md=new MetadataTable();
$db=$md->getAdapter();
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$limit=10;
$offset=$limit*($page-1);
$state=$db->query('select count(*) from metadata');
$row=$state->fetchAll();
$sum=$row[0]['count'];
$select=$db->select();
$select->from('metadata','*')->order('id desc')->limitPage($page,$limit);
$this->view->metadata = $db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$limit);
}
}

View File

@ -0,0 +1,25 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->metadata);
$this->headTitle('全部浏览');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/review">元数据评审</a>');
$this->breadcrumb('浏览');
$this->breadcrumb()->setSeparator(' > ');
?>
<?php echo $this->page->getNavigation(); ?>
<?php foreach($this->metadata as $md) : ?>
<hr />
<div class="mditem">
<div class="thumb"><img src="/metadata/thumb/id/<?php echo $md['id'];?>" /></div>
<h2><a href="/metadata/view/id/<?php echo $md['id'];?>"><?php echo $this->escape($md['title']);?></a>
<a href="/metadata/xml/id/<?php echo $md['id'];?>"><img src="/images/xml.gif" /></a>
<a href="/metadata/convert/format/iso19139/id/<?php echo $md['id'];?>"><img src="/images/iso19139.gif" /></a>
<a href="/metadata/convert/format/fgdc/id/<?php echo $md['id'];?>"><img src="/images/fgdc.gif" /></a>
<a href="/metadata/map/id/<?php echo $md['id']; ?>"><img src="/images/map.gif" /></a>
</h2>
<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>
<?php endforeach; ?>

View File

@ -0,0 +1,44 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($config->title->mdreview);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/review">元数据评审</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='rightPanel'>
<div class="title"><a href="/review/received">元数据:收稿</a></div>
<ul>
<?php foreach($this->mdreceived as $md) : ?>
<div class="mditem">
<li> <img src="/images/westdc_20w.gif" /> <a href="<?php echo $this->url(array('controller'=>'mdreview',
'action'=>'view', 'id'=>$md['id']));?>"><?php echo $this->escape($md['title']);?></a> </li>
</div>
<?php endforeach; ?></ul>
<div class="title"><a href="/review/accepted">元数据:已接收</a></div>
<ul>
<?php foreach($this->mdaccepted as $md) : ?>
<div class="mditem">
<li> <img src="/images/westdc_20w.gif" /> <a href="<?php echo $this->url(array('controller'=>'mdreview',
'action'=>'view', 'id'=>$md['id']));?>"><?php echo $this->escape($md['title']);?></a> </li>
</div>
<?php endforeach; ?></ul>
<div class="title"><a href="/review/inreview">元数据:送审中</a></div>
<ul>
<?php foreach($this->mdinreview as $md) : ?>
<div class="mditem">
<li> <img src="/images/westdc_20w.gif" /> <a href="<?php echo $this->url(array('controller'=>'mdreview',
'action'=>'view', 'id'=>$md['id']));?>"><?php echo $this->escape($md['title']);?></a> </li>
</div>
<?php endforeach; ?></ul>
<div class="title"><a href="/review/reviewed">元数据:已评审</a></div>
<ul>
<?php foreach($this->mdaccepted as $md) : ?>
<div class="mditem">
<li> <img src="/images/westdc_20w.gif" /> <a href="<?php echo $this->url(array('controller'=>'mdreview',
'action'=>'view', 'id'=>$md['id']));?>"><?php echo $this->escape($md['title']);?></a> </li>
</div>
<?php endforeach; ?></ul>
</div>