4 +-----------------------------------------------------------------------+
5 | program/steps/addressbook/list.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Send contacts list to client (as remote response) |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: list.inc 88 2005-12-03 16:54:12Z roundcube $
22 $REMOTE_REQUEST = TRUE;
24 // count contacts for this user
25 $sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
26 FROM ".get_table_name('contacts')."
29 $_SESSION['user_id']);
31 $sql_arr = $DB->fetch_assoc($sql_result);
32 $rowcount = $sql_arr['rows'];
34 // update message count display
35 $pages = ceil($rowcount/$CONFIG['pagesize']);
36 $commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_rowcount_text($rowcount));
37 $commands .= sprintf("this.set_env('pagecount', %d);\n", $pages);
39 $start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize'];
41 // get contacts from DB
42 $sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
48 $_SESSION['user_id']);
50 $commands .= rcmail_js_contacts_list($sql_result);
53 rcube_remote_response($commands);