Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
  protected function addSortCriteria($criteria)
2
  {
3
    if (array(null, null) == ($sort = $this->getSort()))
4
    {
5
      return;
6
    }
7
 
8
    $column = <?php echo constant($this->getModelClass().'::PEER') ?>::translateFieldName($sort[0], BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
9
    if ('asc' == $sort[1])
10
    {
11
      $criteria->addAscendingOrderByColumn($column);
12
    }
13
    else
14
    {
15
      $criteria->addDescendingOrderByColumn($column);
16
    }
17
  }
18
 
19
  protected function getSort()
20
  {
21
    if (null !== $sort = $this->getUser()->getAttribute('<?php echo $this->getModuleName() ?>.sort', null, 'admin_module'))
22
    {
23
      return $sort;
24
    }
25
 
26
    $this->setSort($this->configuration->getDefaultSort());
27
 
28
    return $this->getUser()->getAttribute('<?php echo $this->getModuleName() ?>.sort', null, 'admin_module');
29
  }
30
 
31
  protected function setSort(array $sort)
32
  {
33
    if (null !== $sort[0] && null === $sort[1])
34
    {
35
      $sort[1] = 'asc';
36
    }
37
 
38
    $this->getUser()->setAttribute('<?php echo $this->getModuleName() ?>.sort', $sort, 'admin_module');
39
  }
40
 
41
  protected function isValidSortColumn($column)
42
  {
43
    return in_array($column, BasePeer::getFieldnames('<?php echo $this->getModelClass() ?>', BasePeer::TYPE_FIELDNAME));
44
  }