Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
  protected function getPager()
2
  {
3
    $pager = $this->configuration->getPager('<?php echo $this->getModelClass() ?>');
4
    $pager->setCriteria($this->buildCriteria());
5
    $pager->setPage($this->getPage());
6
    $pager->setPeerMethod($this->configuration->getPeerMethod());
7
    $pager->setPeerCountMethod($this->configuration->getPeerCountMethod());
8
    $pager->init();
9
 
10
    return $pager;
11
  }
12
 
13
  protected function setPage($page)
14
  {
15
    $this->getUser()->setAttribute('<?php echo $this->getModuleName() ?>.page', $page, 'admin_module');
16
  }
17
 
18
  protected function getPage()
19
  {
20
    return $this->getUser()->getAttribute('<?php echo $this->getModuleName() ?>.page', 1, 'admin_module');
21
  }
22
 
23
  protected function buildCriteria()
24
  {
25
<?php if ($this->configuration->hasFilterForm()): ?>
26
    if (null === $this->filters)
27
    {
28
      $this->filters = $this->configuration->getFilterForm($this->getFilters());
29
    }
30
 
31
    $criteria = $this->filters->buildCriteria($this->getFilters());
32
<?php else: ?>
33
    $criteria = new Criteria();
34
<?php endif; ?>
35
 
36
    $this->addSortCriteria($criteria);
37
 
38
    $event = $this->dispatcher->filter(new sfEvent($this, 'admin.build_criteria'), $criteria);
39
    $criteria = $event->getReturnValue();
40
 
41
    return $criteria;
42
  }