summaryrefslogtreecommitdiff
path: root/program/steps/addressbook/export.inc
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-01-11 14:39:23 +0100
committerThomas Bruederli <thomas@roundcube.net>2013-01-11 14:39:23 +0100
commit9a6c38e14895bd093627e12f2fcf2c6ff1e3af3c (patch)
tree26a847ee6e28a7c7bd53c89dbf1aa11b8fa70882 /program/steps/addressbook/export.inc
parentc59ef9542a93a5cbacd99fe3dcfc0975bc749a12 (diff)
New feature to export only selected contacts from addressbook (by Phil Weir)
Diffstat (limited to 'program/steps/addressbook/export.inc')
-rw-r--r--program/steps/addressbook/export.inc23
1 files changed, 23 insertions, 0 deletions
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index 850795c85..bf0657b74 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -56,6 +56,29 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search
$result = new rcube_result_set($count);
$result->records = array_values($records);
}
+// selected contacts
+else if (!empty($_REQUEST['_cid'])) {
+ $sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name');
+ $records = array();
+
+ $cids = explode(',', get_input_value('_cid', RCUBE_INPUT_GET));
+ $CONTACTS = rcmail_contact_source(null, true);
+
+ // Get records from all sources
+ foreach ($cids as $cid) {
+ $record = $CONTACTS->get_record($cid, true);
+ $key = rcmail_contact_key($record, $sort_col);
+ $records[$key] = $record;
+ unset($record);
+ }
+
+ ksort($records, SORT_LOCALE_STRING);
+
+ // create resultset object
+ $count = count($records);
+ $result = new rcube_result_set($count);
+ $result->records = array_values($records);
+}
// selected directory/group
else {
$CONTACTS = rcmail_contact_source(null, true);