Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/09/2010, 10:21
daniko_013
 
Fecha de Ingreso: abril-2010
Ubicación: Lima-Peru
Mensajes: 94
Antigüedad: 14 años, 11 meses
Puntos: 2
Respuesta: Paginación con ZF

hola GatorV gracia por responder, este es mi codigo:

el order/pagination/pagination_control.phtml

Código PHP:
<?php
if ($this->pageCount): ?>
<div class="paginationControl">
<!-- Previous page link -->
<?php if (isset($this->previous)): ?>
  <a href="<?php echo $this->url(array('page'
      
=> $this->previous)); ?>">< Anterior</a> |
<?php else: ?>
  <span class="disabled">< Anterior</span> |
<?php endif; ?>

<!-- Numbered page links -->
<?php foreach ($this->pagesInRange as $page): ?>
  <?php if ($page != $this->current): ?>
    <a href="<?php echo $this->url(array('page'
    
=> $page)); ?>"><?php echo $page?></a> |
  <?php else: ?>
    <?php echo $page?> |
  <?php endif; ?>
<?php 
endforeach; ?>

<!-- Next page link -->
<?php if (isset($this->next)): ?>
  <a href="<?php echo $this->url(array('page'
  
=> $this->next)); ?>">Siguiente ></a>
<?php else: ?>
  <span class="disabled">Siguiente ></span>
<?php endif; ?>
</div>
<?php endif; ?>
El el controlador tengo:
Código PHP:
public function resultAction()
    {  

        
                if (
$this->getRequest()->isPost()) {
        
$formData $this->getRequest()->getPost();
            if (
$form->isValid($formData)) {

                            
$anho=$form->getValue('anho');
                            
$num $form->getValue('num');
                            
$state$form->getValue('estado');
                            
$order = new Admin_Model_OrderDao();
                       
$orden=$order->listOrderEstado($state);
                            

                            
                               
                                }
                                


            
    }
    
    
$page $this->_getParam('page'1);
            
// número de registros a mostrar por página
            
$registros_pagina 30;
            
// número máximo de páginas a mostrar en el paginador
            
$rango_paginas 5;
               
// $this->view->orden = $order->beginOrder();


               
$paginador Zend_Paginator::factory($ordentm);
              
$paginador->setItemCountPerPage($registros_pagina)
                      ->
setCurrentPageNumber($page)
                      ->
setPageRange($rango_paginas);
                
$this->view->orden $paginador;

    } 
y las vista:

Código PHP:
<table class="table_list_order" align="center" >
       <tr class="table_header">

               <th>OS</th>
               <th>Cliente</th>
               <th>Depósito</th>
               <th>Mercancía</th>
               <th>Nave</th>
               <th>ETA</th>
               <th>Nº DUA</th>
               <th>Línea/Cons</th>
               <th>B/L Madre</th>
               <th>B/L Hijo</th>
               <th>Factura</th>
               <th>Carga</th>
               <th>Estado</th>
               <th>Editar</th>
               <th>Eliminar</th>
               <th>Doc.</th>
               <th>Inci.</th>

       </tr>
       <?php
       $ban
=0;
       foreach(
$this->orden as $order):
       
$canales=$this->escape($order['canal']);
       
/*if($canales=='naranja'||$canales=='verde'||$canales=='rojo'){ */
       
if(($ban 2)==0){
       
?>

    <tr class="row_odd">
    <?php }else {?>
    <tr class="row_even">
    <?php $id=$this->escape($order['id']);
          
?>

        <th><?php echo $this->escape($order['numero']);?></th>
        <th><?php echo $this->escape($order['abreviatura']);?></th>
        <?php
          $mod
=$this->escape($order['modalidad']);
          if(
$mod=='anticipado' || $mod=='urgente'){
                if(
$mod=='anticipado'){?>
                   <th class="modAnticipado"><?php echo $this->escape($order['name_terminal']);?></th>
              <?php  }
              if(
$mod=='urgente'){?>
                   <th class="modUrgente"><?php echo $this->escape($order['name_terminal']);?></th>
              <?php  }
          }else{
?>
              <th><?php echo $this->escape($order['name_terminal']);?></th>
          <?php }
        
?>

        <th><?php echo $this->escape($order['mercancia']);?></th>
        <th><?php echo $this->escape($order['nave']);?></th>
        <?php if($this->escape($order['eta'])==NULL || $this->escape($order['eta'])=='0000-00-00'){?>
            <th></th>
        <?php }else{?>
            <th><?php $eta1=explode("-",$this->escape($order['eta']));
                  echo 
$eta1[2]."/".$eta1[1]."/".$eta1[0];?></th>
    <?php     }

        
$canales=$this->escape($order['canal']);
       if(
$canales=='naranja'||$canales=='verde'||$canales=='rojo'){
        if(
$canales=='verde'){?>
        <th class="cell_green"><?php echo $this->escape($order['num_decl']);?></th><?php }?>
        <?php if($canales=='naranja'){?>
        <th class="cell_orange"><?php echo $this->escape($order['num_decl']);?></th><?php }?>
        <?php if($canales=='rojo'){?>
        <th class="cell_red"><?php echo $this->escape($order['num_decl']);?></th><?php }}else{?>
        <th><?php echo $this->escape($order['num_decl']);?></th><?php }?>
        <th><?php
              
echo $this->escape($order['linea']);
              echo 
"/";
             echo 
$this->escape($order['consolidador']);

        
?></th>
        <th><?php echo $this->escape($order['bl_madre']);?></th>
        <th><?php echo $this->escape($order['bl_hijo']);?></th>
        <th><?php echo $this->escape($order['factura']);?></th>
        <th><?php if($this->escape($order['embarque']=='contenedor')){
              echo 
$this->escape($order['cantidad']);
              echo 
"x";
             echo 
$this->escape($order['tamanhio']);
        }else{

                 echo 
$this->escape($order['embarque']);
             }

        
?></th>

        <th><?php echo $this->escape($order['estado']); ?></th>
        <th width="30" align="center">
            <a href="<?php echo $this->url(array('controller'=>'order','action'=>'edit','id'=>$order['id']));?>"><img src="<?php echo $this->baseUrl().'/images/edit-icon.gif'?> "border="0" title="Editar"></img></a>
            </th>
            <th width="30" align="center">
            <a href="<?php echo $this->url(array('controller'=>'order','action'=>'delete','id'=>$order['id']));?>"><img src="<?php echo $this->baseUrl().'/images/delete-icon.gif'?> "border="0" title="Eliminar" ></img></a>
        </th>
        <th width="30" align="center">
        <?php $certi=$this->escape($order['certificado']);
               if(
$certi=='ninguno' || $certi==' '){?>
                    <a href="<?php echo $this->url(array('controller'=>'order','action'=>'documents','id'=>$order['id']));?>"><img src="<?php echo $this->baseUrl().'/images/document-icon.gif'?> "border="0"></img></a>
              <?php  }else{?>
                       <a href="<?php echo $this->url(array('controller'=>'order','action'=>'documents','id'=>$order['id']));?>"><img src="<?php echo $this->baseUrl().'/images/documentos_restriccion.png'?> "border="0" title="Certificado <?php echo $certi?>"></img></a>
            <?php }

        
?>

        </th>
        <th width="30" align="center">
            <a href="<?php echo $this->url(array('controller'=>'order','action'=>'incedence','id'=>$order['id']));?>"><img src="<?php echo $this->baseUrl().'/images/incide-icon.gif'?> "border="0" title="Incidencias"></img></a>
            <input type="hidden" name="numero_for_inci" value="<?php echo $this->escape($order['numero']);?>" />
        </th>
    </tr>

    <?php $ban ++; endforeach;?>


    <tr  class="row_odd">
<th colspan="17" align=center>
<?php
echo $this->paginationControl($this->orden,
    
'Sliding',
    
'order/pagination/pagination_control.phtml');
?></th></tr>

</table>
<form id="form1" name="form1" method="post" action="<?php echo $this->url(array('action'=>'busqueda')); ?>">
  <input type="hidden" name="cliente_id" value="<?php echo $this->cliente_id;?>"/>
  <input type="hidden" name="status" value="<?php echo $this->status;?>"/>
  <input type="hidden" name="num_orden" value="<?php echo $this->num_orden;?>"/>
  <label>
  <input type="submit"  name="Submit" value="Exportar" class="nuevo1" />
  </label>
</form>