#302 增加了查看单条数据的作者列表功能

This commit is contained in:
Li Jianxuan 2012-03-21 07:57:13 +00:00
parent dfc99ecdb9
commit 219518ce83
1 changed files with 28 additions and 0 deletions

View File

@ -1158,6 +1158,34 @@ class AuthorController extends Zend_Controller_Action
}//newsAction() 数据新闻
function viewauthorsAction(){
$this->_helper->viewRenderer('view-authors');
$uuid = $this->_request->getParam('uuid');
if(preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{
$sql = "SELECT u.realname,u.unit,u.email,m.title,m.description FROM normalmetadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid
LEFT JOIN users u ON u.id=a.userid
WHERE status>=0 AND m.uuid=?
ORDER BY status DESC,a.id DESC";
$sth = $this->db->prepare($sql);
$sth->execute(array($uuid));
$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{
$this->view->error = "参数有误";
}
}
}