issue #0001643: Add a paginator for "ciblage" and "enrichissements"

This commit is contained in:
Michael RICOIS 2013-11-22 13:22:27 +00:00
parent e930a8bbeb
commit 0b1512f9b1
9 changed files with 68 additions and 8 deletions

View File

@ -15,14 +15,16 @@ class DashboardController extends Zend_Controller_Action
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$request = $this->getRequest();
$type = $request->getParam('type', null);
$this->view->type = $type;
$criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limit(5);
->order('dateAjout DESC');
//->limit(5);
$rows = $criteresM->fetchAll($sql);
@ -51,7 +53,17 @@ class DashboardController extends Zend_Controller_Action
$results[] = $info;
}
//paginate results list
$paginator = Zend_Paginator::factory($results);
$this->view->paginator = $paginator;
$itemCount = 5;
$page = $this->_getParam('page', 1);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($itemCount);
$this->view->assign('itemCount', $itemCount);
//end
$this->view->comptages = $results;
//
@ -70,8 +82,17 @@ class DashboardController extends Zend_Controller_Action
->where('c.login = ?', $user->username)
->order('i.dateAdded DESC');
$this->view->enrichissements = $enrichissements->fetchAll($sql);
$enrichissements = $enrichissements->fetchAll($sql);
//paginate results list
$paginatorEnrichissements = Zend_Paginator::factory($enrichissements);
$this->view->enrichissements = $paginatorEnrichissements;
$itemCountEnrichissements = 2;
$pageEnrichissements = $this->_getParam('pageEnrichissements', 1);
$paginatorEnrichissements->setCurrentPageNumber($pageEnrichissements);
$paginatorEnrichissements->setItemCountPerPage($itemCountEnrichissements);
$this->view->assign('itemCountEnrichissements', $itemCountEnrichissements);
//end
}
public function ciblagesAction()

BIN
application/languages/fr.mo Normal file

Binary file not shown.

View File

@ -0,0 +1,19 @@
<?php if ($this->pageCount) { ?>
<!-- First page link -->
<?php if (isset($this->previous)) { ?>
<a href="<?php echo $this->url(array('page' => $this->first)); ?>"><img src="/themes/default/images/pagination/first.png" title='Première page'/></a>
<?php } ?>
<!-- Previous page link -->
<?php if (isset($this->previous)) { ?>
<a href="<?php echo $this->url(array('page' => $this->previous)); ?>"><img src="/themes/default/images/pagination/prev.png" title='Page précédente'/></a>
<?php } ?>
&nbsp;
<!-- Next page link -->
<?php if (isset($this->next)) { ?>
<a href="<?php echo $this->url(array('page' => $this->next)); ?>"><img src="/themes/default/images/pagination/next.png" title='Page suivante'/></a>
<?php } ?>
<!-- Last page link -->
<?php if (isset($this->next)) { ?>
<a href="<?php echo $this->url(array('page' => $this->last)); ?>"><img src="/themes/default/images/pagination/last.png" title='Dernière page'/></a>
<?php } ?>
<?php } ?>

View File

@ -0,0 +1,19 @@
<?php if ($this->pageCount) { ?>
<!-- First page link -->
<?php if (isset($this->previous)) { ?>
<a href="<?php echo $this->url(array('pageEnrichissements' => $this->first)); ?>"><img src="/themes/default/images/pagination/first.png" title='Première page'/></a>
<?php } ?>
<!-- Previous page link -->
<?php if (isset($this->previous)) { ?>
<a href="<?php echo $this->url(array('pageEnrichissements' => $this->previous)); ?>"><img src="/themes/default/images/pagination/prev.png" title='Page précédente'/></a>
<?php } ?>
&nbsp;
<!-- Next page link -->
<?php if (isset($this->next)) { ?>
<a href="<?php echo $this->url(array('pageEnrichissements' => $this->next)); ?>"><img src="/themes/default/images/pagination/next.png" title='Page suivante'/></a>
<?php } ?>
<!-- Last page link -->
<?php if (isset($this->next)) { ?>
<a href="<?php echo $this->url(array('pageEnrichissements' => $this->last)); ?>"><img src="/themes/default/images/pagination/last.png" title='Dernière page'/></a>
<?php } ?>
<?php } ?>

View File

@ -39,7 +39,7 @@
</tr>
</thead>
<tbody>
<?php foreach($this->comptages as $name => $item):?>
<?php foreach($this->paginator as $name => $item):?>
<tr>
<td class="reference"><?=$item['reference']?></td>
<td class="update resultat"><?=number_format($item['resultat'], 0, ',', ' ')?></td>
@ -51,6 +51,7 @@
<?php endforeach;?>
</tbody>
</table>
<?php echo $this->paginationControl($this->paginator,'Sliding','dashboard/controlsCiblages.phtml'); ?>
<?php else:?>
<p><?=$this->translate('Aucun ciblage')?>.<p>
<?php endif;?>
@ -70,8 +71,7 @@
</tr>
</thead>
<tbody>
<?php $i=0;foreach($this->enrichissements as $item):?>
<?php if($i++ == 5)break;?>
<?php foreach($this->enrichissements as $item):?>
<tr>
<td><?=$item['reference']?></td>
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
@ -89,6 +89,7 @@
<?php endforeach;?>
</tbody>
</table>
<?php echo $this->paginationControl($this->enrichissements,'Sliding','dashboard/controlsEnrichissements.phtml'); ?>
<?php else:?>
<p><?=$this->translate('Aucun enrichissement')?>.<p>
<?php endif;?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB