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

View File

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