~ubuntu-branches/debian/sid/php-horde-turba/sid

« back to all changes in this revision

Viewing changes to turba-4.1.1/lib/View/List/AlphaFilter.php

  • Committer: Package Import Robot
  • Author(s): Mathieu Parent
  • Date: 2013-08-11 13:16:25 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130811131625-z91stjvq51jr9onv
Tags: 4.1.1-1
New upstream version 4.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * The Turba_View_List:: class provides an interface for objects that
 
4
 * visualize Turba_List objects.
 
5
 *
 
6
 * @author  Chuck Hagenbuch <chuck@horde.org>
 
7
 * @author  Jon Parise <jon@csh.rit.edu>
 
8
 * @package Turba
 
9
 */
 
10
/**
 
11
 * Skips objects whose name does not start with the specified letter
 
12
 */
 
13
class Turba_View_List_AlphaFilter
 
14
{
 
15
    protected $_alpha;
 
16
    protected $_format;
 
17
 
 
18
    public function __construct($alpha)
 
19
    {
 
20
        $this->_alpha = Horde_String::lower($alpha);
 
21
        $this->_format = $GLOBALS['prefs']->getValue('name_sort');
 
22
    }
 
23
 
 
24
    public function skip($ob)
 
25
    {
 
26
        $name = Turba::formatName($ob, $this->_format);
 
27
        if ($this->_alpha != '*' &&
 
28
            Horde_String::lower(substr($name, 0, 1)) != $this->_alpha) {
 
29
            return true;
 
30
        }
 
31
 
 
32
        return false;
 
33
    }
 
34
 
 
35
}
 
 
b'\\ No newline at end of file'