2010年7月29日星期四

[fw-db] Need help with Pagination

$mod = new Model_Documents_Document();
$select = $mod->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
$select->setIntegrityCheck(FALSE);
$select->joinleft('ZCFPRJ_ORGANIZATIONS_V', 'ARC_DOCUMENT.SENDER_ID = ZCFPRJ_ORGANIZATIONS_V.ORGANIZATION_ID', 'ZCFPRJ_ORGANIZATIONS_V.NAME')
->join('ARC_DOC_DESTINATION', 'ARC_DOC_DESTINATION.DESTINATION_ID = ARC_DOCUMENT.DESTINATION_ID')
->join('ARC_DOCUMENT_TRANS', 'ARC_DOCUMENT_TRANS.DOCUMENT_ID = ARC_DOCUMENT.DOCUMENT_ID')
;
$select->where('ARC_DOCUMENT.DELETED=1')
->where('ARC_DOCUMENT.OUTBOX_NUMBER IS NOT NULL')
->where('ARC_DOCUMENT_TRANS.LAST_STEP=?','Y');

$select->columns('ARC_DOCUMENT.CREATED_BY');
$select->order('ARC_DOCUMENT.CREATED_DATE DESC');
$this->view->deleteddocs = $mod->fetchAll($select);<table border="1" class="sortable">
<tr align="center">

<th width="7%">&nbsp;</th>
<th>#</th>
<th><?php echo $docnumlabel?></th>
<th><?php echo $docdatelabel?></th>
<th><?php echo $subjectlabel?></th>
<th><?php echo $destinationlabel?></th>
<th><?php echo $sourcelabel?></th>
<th><?php echo $senderlabel?></th>
</tr>

<?php
$counter=0;
$mod = new Model_Documents_Griddyview();
$docsmod = new Model_Documents_Document();

foreach($this->deleteddocs as $docs) :
$counter+=1;
?>
<tr align="center">
<td>
<a href="../documents/undelete?DOCUMENT_ID=<?php echo $docs->DOCUMENT_ID;?>&url=admin/deleteddocsoutbox"><?php echo $restorelabel?></a>

</td>
<td><b><?php echo $counter;?></b></td>
<td><b><?php echo $this->escape($docs->OUTBOX_NUMBER);?></b></td>
<td><b><?php echo $this->escape($docs->CREATED_DATE);?></b></td>
<td><b><a href="../documents/docdetail?ISINBOX=1&DOCUMENT_ID=<?php echo $docs->DOCUMENT_ID;?>&TRANSACTION_ID=<?php echo $docs->TRANSACTION_ID; ?>" ><?php echo $docs->SUBJECT;?></a>
</td>
<td><?php echo $this->escape($docs->DESTINATION_DESC_A);?></td>
<td><?php

if ($docs->SENDER_ID == 0 ) {
ECHO 'مؤسسة زايد للأعمال الخيرية والإنسانية';
}
else echo $docs->NAME;
?>
</td>
<td><?php echo $mod->getFullName($this->escape($docs->CREATED_BY));?></td>

</tr>

<?php endforeach; ?>
</table>
Hi all,

I am in desperate need to put pagination on the TABLE my clients view...I have seen there is a way Zend is dealing with it using ZEND_PAGINATOR but the explanation seemed a bit confusing to me.

Can anybody please help me out over here...Here is actually what I want For example;

1. The Number of Data Rows fetched are 450
2. The code only show 50 Records (ROWS)
3. For next the user has to click the NEXT PAGE link at the bottom or top.
4. The Next Page link is not active on Last page.
5. There is Previous page as well but ofcourse not active on the first page.

Please find the attached files to have an idea of how I am fetching the data using the query.

Your earliest respond awaited.

Thanks in advance
--
Regards,
YD

没有评论: