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->setQuery($this->buildQuery());
5
    $pager->setPage($this->getPage());
6
    $pager->init();
7
 
8
    return $pager;
9
  }
10
 
11
  protected function setPage($page)
12
  {
13
    $this->getUser()->setAttribute('<?php echo $this->getModuleName() ?>.page', $page, 'admin_module');
14
  }
15
 
16
  protected function getPage()
17
  {
18
    return $this->getUser()->getAttribute('<?php echo $this->getModuleName() ?>.page', 1, 'admin_module');
19
  }
20
 
21
  protected function buildQuery()
22
  {
23
    $tableMethod = $this->configuration->getTableMethod();
24
<?php if ($this->configuration->hasFilterForm()): ?>
25
    if (null === $this->filters)
26
    {
27
      $this->filters = $this->configuration->getFilterForm($this->getFilters());
28
    }
29
 
30
    $this->filters->setTableMethod($tableMethod);
31
 
32
    $query = $this->filters->buildQuery($this->getFilters());
33
<?php else: ?>
34
    $query = Doctrine_Core::getTable('<?php echo $this->getModelClass() ?>')
35
      ->createQuery('a');
36
 
37
    if ($tableMethod)
38
    {
39
      $query = Doctrine_Core::getTable('<?php echo $this->getModelClass() ?>')->$tableMethod($query);
40
    }
41
<?php endif; ?>
42
 
43
    $this->addSortQuery($query);
44
 
45
    $event = $this->dispatcher->filter(new sfEvent($this, 'admin.build_query'), $query);
46
    $query = $event->getReturnValue();
47
 
48
    return $query;
49
  }