perfect the paginator service and zend db service,add new functions in review service
This commit is contained in:
parent
9a7e8c9b1e
commit
32806de819
|
@ -30,10 +30,6 @@ class Paginator implements ServiceManagerAwareInterface{
|
||||||
{
|
{
|
||||||
$this->serviceManager = $serviceManager;
|
$this->serviceManager = $serviceManager;
|
||||||
|
|
||||||
$this->setPageLimit();
|
|
||||||
$this->setPageRange();
|
|
||||||
$this->setRoute();
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +93,16 @@ class Paginator implements ServiceManagerAwareInterface{
|
||||||
{
|
{
|
||||||
$page = $ctl->params()->fromRoute('page');
|
$page = $ctl->params()->fromRoute('page');
|
||||||
|
|
||||||
|
if(empty($this->pageLimit))
|
||||||
|
$this->setPageLimit();
|
||||||
|
|
||||||
|
if(empty($this->pageRange))
|
||||||
|
$this->setPageRange();
|
||||||
|
|
||||||
|
if(empty($this->route))
|
||||||
|
$this->setRoute();
|
||||||
|
|
||||||
|
|
||||||
if(is_array($data))
|
if(is_array($data))
|
||||||
$data = new ArrayAdapter($data);
|
$data = new ArrayAdapter($data);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Westdc\Review;
|
||||||
use Zend\ServiceManager\ServiceManager;
|
use Zend\ServiceManager\ServiceManager;
|
||||||
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
||||||
use Westdc\EventModel\AbstractEventManager;
|
use Westdc\EventModel\AbstractEventManager;
|
||||||
|
use Zend\Db\Sql\Select;
|
||||||
|
|
||||||
class Review extends AbstractEventManager implements ServiceManagerAwareInterface{
|
class Review extends AbstractEventManager implements ServiceManagerAwareInterface{
|
||||||
|
|
||||||
|
@ -124,10 +125,37 @@ class Review extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
{$this->limitSql}";
|
{$this->limitSql}";
|
||||||
|
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
return $rs->fetchAll();
|
return $rs->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
}//getDraft()
|
}//getDraft()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取被取消评审的元数据
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getCanceled()
|
||||||
|
{
|
||||||
|
$this->processOptions();
|
||||||
|
|
||||||
|
$searchJoin = "";
|
||||||
|
if(isset($this->opt->keyword) && !empty($this->opt->keyword))
|
||||||
|
{
|
||||||
|
$searchJoin = " AND md.title LIKE '%{$this->opt->keyword}%'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($this->orderSql))
|
||||||
|
{
|
||||||
|
$this->orderSql = "ORDER BY m.ts_created DESC";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT m.id,md.title,md.uuid,m.status,m.ts_created FROM mdstatus m
|
||||||
|
RIGHT JOIN metadata md ON md.uuid=m.uuid
|
||||||
|
WHERE m.status=".self::REVIEW_STATUS_CANCELED." $searchJoin
|
||||||
|
{$this->orderSql} {$this->sortSql}
|
||||||
|
{$this->limitSql}";
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
return $rs->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消评审
|
* 取消评审
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Db {
|
||||||
|
|
||||||
public function getZendDb(){
|
public function getZendDb(){
|
||||||
|
|
||||||
$dbObject = new WestdcDb\Db($adapter);
|
$dbObject = new WestdcDb\Db();
|
||||||
|
|
||||||
return $dbObject->getAdapter();
|
return $dbObject->getAdapter();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue