fix logic error.

This commit is contained in:
wlx 2010-01-07 14:33:12 +00:00
parent 0010e4a6b7
commit 3a1ca54939
2 changed files with 13 additions and 7 deletions

View File

@ -236,6 +236,7 @@ class DataController extends Zend_Controller_Action
function seriesAction() function seriesAction()
{ {
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
if (empty($id)) $id=0;
if (!is_numeric($id)) if (!is_numeric($id))
{ {
$name=$id; $name=$id;
@ -244,15 +245,20 @@ class DataController extends Zend_Controller_Action
$md=new SeriesTable(); $md=new SeriesTable();
$db=$md->getAdapter(); $db=$md->getAdapter();
if (empty($id)) { if (empty($id)) {
if (empty($name)) $this->_redirect('/data'); if (!empty($name))
$where=$db->quoteInto('name = ?',$name); {
$row=$md->fetchRow($where); $where=$db->quoteInto('name = ?',$name);
$row=$md->fetchRow($where);
}
} else { } else {
$where=$db->quoteInto('id = ?',$id); $where=$db->quoteInto('id = ?',$id);
$row=$md->fetchRow($where); $row=$md->fetchRow($where);
} }
if (!$row) $this->_redirect('/data'); if (!empty($id) or !empty($name))
$id=$row->id; {
if (!$row) $this->_redirect('/data');
$id=$row->id;
}
$page=(int)$this->_request->getParam('page'); $page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1; if (empty($page)) $page=1;
$limit=10; $limit=10;

View File

@ -33,6 +33,6 @@ $this->breadcrumb()->setSeparator(' > ');
</h2> </h2>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span> <span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
</div> </div>
<?php endforeach; endif; ?> <?php endforeach; ?>
</div> </div>
<?php echo $this->page->getNavigation(); ?> <?php echo $this->page->getNavigation(); endif; ?>