Make sort links and add form return to the same backend that is currently being viewed
[squirrelmail.git] / functions / template / abook_util.php
CommitLineData
caa596b2 1<?php
2
3/**
4 * abook_util.php
5 *
6 * The following functions are utility functions for templates. Do not
7 * echo output in these functions.
8 *
9 * @copyright &copy; 2005-2008 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11 * @version $Id$
12 * @package squirrelmail
13 */
14
15
16/**
17 * Display a column header with sort buttons
18 *
19 * @param string $field Which field to display
20 * @param int $backend The abook backend to be shown when
21 * sort link is clicked
22 *
23 * @author Steve Brown
24 * @since 1.5.2
25 */
26function addAbookSort ($field, $backend) {
27 global $abook_sort_order, $nbsp;
28
29 switch ($field) {
30 case 'nickname':
31 $str = _("Nickname");
32 $alt = _("Sort by nickname");
33 $down = 0;
34 $up = 1;
35 $has_sort = true;
36 break;
37 case 'fullname':
38 $str = _("Name");
39 $alt = _("Sort by name");
40 $down = 2;
41 $up = 3;
42 $has_sort = true;
43 break;
44 case 'email':
45 $str = _("E-mail");
46 $alt = _("Sort by email");
47 $down = 4;
48 $up = 5;
49 $has_sort = true;
50 break;
51 case 'info':
52 $str = _("Info");
53 $alt = _("Sort by info");
54 $down = 6;
55 $up = 7;
56 $has_sort = true;
57 break;
58 default:
59 return 'BAD SORT FIELD GIVEN: "'.$field.'"';
60 }
61
62 // show_abook_sort_button() creates a hyperlink (using hyperlink.tpl) that encompases an image, using a getImage() call
63 return $str . ($has_sort ? $nbsp . show_abook_sort_button($abook_sort_order, $alt, $down, $up, array('new_bnum' => $backend)) : '');
64}
65
66