a71b394e |
1 | <?php |
2 | /** |
3 | * util_addressbook.php |
4 | * |
5 | * Functions to make working with address books easier |
6 | * |
7 | * @copyright © 1999-2006 The SquirrelMail Project Team |
8 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
9 | * @version $Id$ |
10 | * @package squirrelmail |
11 | * @subpackage templates |
12 | */ |
13 | |
14 | /** |
15 | * Display a column header with sort buttons |
16 | * |
17 | * @param string $field which field to display |
18 | * @author Steve Brown |
19 | * @since 1.5.2 |
20 | */ |
21 | function addAbookSort ($field) { |
22 | global $abook_sort_order; |
23 | |
24 | switch ($field) { |
25 | case 'nickname': |
26 | $str = _("Nickname"); |
27 | $alt = _("sort by nickname"); |
28 | $down = 0; |
29 | $up = 1; |
30 | $has_sort = true; |
31 | break; |
32 | case 'fullname': |
33 | $str = _("Name"); |
34 | $alt = _("sort by name"); |
35 | $down = 2; |
36 | $up = 3; |
37 | $has_sort = true; |
38 | break; |
39 | case 'email': |
40 | $str = _("E-mail"); |
41 | $alt = _("sort by email"); |
42 | $down = 4; |
43 | $up = 5; |
44 | $has_sort = true; |
45 | break; |
46 | case 'info': |
47 | $str = _("Info"); |
48 | $alt = _("sort by info"); |
49 | $down = 6; |
50 | $up = 7; |
51 | $has_sort = true; |
52 | break; |
53 | default: |
54 | return 'BAD SORT FIELD GIVEN: "'.$field.'"'; |
55 | } |
56 | |
57 | return $str . ($has_sort ? show_abook_sort_button($abook_sort_order, $alt, $down, $up) : ''); |
58 | } |
59 | |
60 | /** |
61 | * Create a link to compose an email to the email address given. |
62 | * |
63 | * @param array $row contact as given to the addressbook_list.tpl template |
64 | * @author Steve Brown |
65 | * @since 1.5.2 |
66 | */ |
67 | function composeLink ($row) { |
68 | return makeComposeLink('src/compose.php?send_to=' . |
69 | rawurlencode($row['FullAddress']), |
70 | htmlspecialchars($row['Email'])); |
71 | } |
72 | ?> |