-Matt
On Sun, Aug 8, 2010 at 11:04 PM, Y D <dossany@gmail.com> wrote:
Hello everyone,
I am using ZEND PAGINATOR, and but my
$paginator->setItemCountPerPage(10);
doesn't seem to work. I am using some joins in my query, can that be a problem? This is the video I refered to for implementing Paginator
http://www.youtube.com/watch?v=f4fujot7Xlc
Below is my code;
$table = new Model_Documents_Document();
// retrieve with from part set, important when joining
$session = new Zend_Session_Namespace('usersession');
$userName = $session->username;
$select = $table->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
$select->setIntegrityCheck(FALSE)
->join('ARC_DOCUMENT_TRANS', 'ARC_DOCUMENT_TRANS.DOCUMENT_ID = ARC_DOCUMENT.DOCUMENT_ID')
->joinleft('GNL_ROLE', 'ARC_DOCUMENT_TRANS.ROLE_ID = GNL_ROLE.ROLE_ID', 'GNL_ROLE.ROLE_NAME');
$select
->joinleft("USERS", "ARC_DOCUMENT_TRANS.RECIPIENT = USERS.USER_ID AND USERS.USER_ID='$userName'", "USERS.FULL_NAME")
->joinleft("ARC_DOCUMENT_READ","ARC_DOCUMENT_TRANS.TRANSACTION_ID = ARC_DOCUMENT_READ.TRANSACTION_ID AND ARC_DOCUMENT_READ.READ_BY='$userName'","READ_BY")
->joinleft("GNL_DOCUMENT_DELIVERY","GNL_DOCUMENT_DELIVERY.DOCUMENT_ID = ARC_DOCUMENT.DOCUMENT_ID")
->joinleft('ARC_DOC_CLASS', 'ARC_DOCUMENT.DOCUMENT_ID = ARC_DOC_CLASS.DOCUMENT_ID', 'ARC_DOC_CLASS.CLASS_ID')
->joinleft('ARC_GNL_CLASSIFICATION', 'ARC_DOC_CLASS.CLASS_ID = ARC_GNL_CLASSIFICATION.CLASS_ID', 'ARC_GNL_CLASSIFICATION.INDEX_ID')
->joinleft('ARC_DOC_FILES', 'ARC_DOC_FILES.DOCUMENT_ID = ARC_DOCUMENT.DOCUMENT_ID')
->columns("ARC_DOCUMENT_TRANS.TRANSACTION_ID,ARC_DOCUMENT_TRANS.CREATED_BY,ARC_DOCUMENT_TRANS.DOCUMENT_ID,TO_CHAR(ARC_DOCUMENT_TRANS.CREATION_DATE,'DD/MM/YYYY') CD,ARC_DOCUMENT_TRANS.DOCUMENT_ID,TO_CHAR(ARC_DOCUMENT_TRANS.CREATION_DATE,'DD/MM/YYYY HH:MI:SS AM') CDFULL, ARC_DOCUMENT_TRANS.LAST_STEP, ARC_DOCUMENT_TRANS.ROLE_ID,ARC_DOCUMENT_TRANS.RECIPIENT,ARC_DOCUMENT.DESTINATION_ID DESTID,ROWNUM RC")
->where('NVL(ARC_DOCUMENT.DELETED,0) =?',"0")
->where("($inout OR ARC_DOCUMENT.DOC_TYPE_ID IS NOT NULL)")
->where('ARC_DOCUMENT.REQUEST_TYPE=?',"general")
->where("$filter")
->where('EXISTS (SELECT 1 FROM GNL_ROLE_USERS R WHERE ((ARC_DOCUMENT_TRANS.ROLE_ID=R.ROLE_ID AND R.USER_ID=?) OR (ARC_DOCUMENT_TRANS.RECIPIENT =?))) OR ARC_DOCUMENT.CREATED_BY=?',$userName)
->order('ARC_DOCUMENT_TRANS.CREATION_DATE DESC');
$rows = $table->fetchAll($select);
$paginator = Zend_Paginator::factory($rows);
$paginator->setItemCountPerPage(10);
$paginator->setCurrentPageNumber($this->_request->getParam('page'));
if($usepaginator==0)$this->view->ARC_DOCUMENT = $paginator;
else $this->view->ARC_DOCUMENT =$rows;
--
Regards,
YD
没有评论:
发表评论