|
@@ -24,7 +24,7 @@ discard block |
|
|
block discarded – undo |
|
24
|
24
|
* |
|
25
|
25
|
* @param egw_record $_definition |
|
26
|
26
|
*/ |
|
27
|
|
- public function export( $_stream, importexport_definition $_definition) { |
|
|
27
|
+ public function export($_stream, importexport_definition $_definition) { |
|
28
|
28
|
|
|
29
|
29
|
$options = $_definition->plugin_options; |
|
30
|
30
|
$this->uicontacts = new addressbook_ui(); |
|
@@ -32,8 +32,8 @@ discard block |
|
|
block discarded – undo |
|
32
|
32
|
|
|
33
|
33
|
// Addressbook defines its own export imits |
|
34
|
34
|
$limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
|
35
|
|
- $export_limit = Api\Storage\Merge::getExportLimit($app='addressbook'); |
|
36
|
|
- if($export_limit == 'no' && !$limit_exception) { |
|
|
35
|
+ $export_limit = Api\Storage\Merge::getExportLimit($app = 'addressbook'); |
|
|
36
|
+ if ($export_limit == 'no' && !$limit_exception) { |
|
37
|
37
|
return; |
|
38
|
38
|
} |
|
39
|
39
|
|
|
@@ -44,29 +44,29 @@ discard block |
|
|
block discarded – undo |
|
44
|
44
|
if ($options['selection'] == 'search') { |
|
45
|
45
|
// uicontacts selection with checkbox 'use_all' |
|
46
|
46
|
$query = Api\Cache::getSession('addressbook', 'index'); |
|
47
|
|
- $query['num_rows'] = -1; // all |
|
48
|
|
- $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
49
|
|
- if(!array_key_exists('filter',$query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id']; |
|
|
47
|
+ $query['num_rows'] = -1; // all |
|
|
48
|
+ $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
|
49
|
+ if (!array_key_exists('filter', $query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id']; |
|
50
|
50
|
$readonlys = null; |
|
51
|
|
- $this->uicontacts->get_rows($query,$this->selection,$readonlys, true); // only return the ids |
|
|
51
|
+ $this->uicontacts->get_rows($query, $this->selection, $readonlys, true); // only return the ids |
|
52
|
52
|
} |
|
53
|
|
- elseif ( $options['selection'] == 'all' ) { |
|
|
53
|
+ elseif ($options['selection'] == 'all') { |
|
54
|
54
|
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) { |
|
55
|
55
|
$col_filter['account_id'] = null; |
|
56
|
56
|
} |
|
57
|
|
- $this->selection = ExecMethod2('addressbook.addressbook_bo.search', array(), true, '', '','',false,'AND',false,$col_filter); |
|
|
57
|
+ $this->selection = ExecMethod2('addressbook.addressbook_bo.search', array(), true, '', '', '', false, 'AND', false, $col_filter); |
|
58
|
58
|
//$this->uicontacts->get_rows($query,$this->selection,$readonlys,true); |
|
59
|
59
|
} else { |
|
60
|
|
- $this->selection = explode(',',$options['selection']); |
|
|
60
|
+ $this->selection = explode(',', $options['selection']); |
|
61
|
61
|
} |
|
62
|
62
|
$GLOBALS['egw_info']['flags']['currentapp'] = $old_app; |
|
63
|
63
|
|
|
64
|
|
- if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
|
64
|
+ if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
65
|
65
|
$this->selection = array_slice($this->selection, 0, $export_limit); |
|
66
|
66
|
} |
|
67
|
67
|
|
|
68
|
68
|
foreach ($this->selection as &$_contact) { |
|
69
|
|
- if(is_array($_contact) && ($_contact['id'] || $_contact['contact_id'])) |
|
|
69
|
+ if (is_array($_contact) && ($_contact['id'] || $_contact['contact_id'])) |
|
70
|
70
|
{ |
|
71
|
71
|
$_contact = $_contact[$_contact['id'] ? 'id' : 'contact_id']; |
|
72
|
72
|
} |
|
@@ -75,7 +75,7 @@ discard block |
|
|
block discarded – undo |
|
75
|
75
|
// vCard opens & closes the file itself, so we can't just pass in the stream |
|
76
|
76
|
$fp = tempnam($GLOBALS['egw_info']['server']['temp_dir'], 'egw'); |
|
77
|
77
|
|
|
78
|
|
- $vcard = new addressbook_vcal('addressbook','text/vcard'); |
|
|
78
|
+ $vcard = new addressbook_vcal('addressbook', 'text/vcard'); |
|
79
|
79
|
$vcard->export($this->selection, $fp); |
|
80
|
80
|
|
|
81
|
81
|
fwrite($_stream, file_get_contents($fp)); |
|
@@ -118,7 +118,7 @@ discard block |
|
|
block discarded – undo |
|
118
|
118
|
*/ |
|
119
|
119
|
public function get_filename() |
|
120
|
120
|
{ |
|
121
|
|
- if(is_array($this->selection) && count($this->selection) == 1) |
|
|
121
|
+ if (is_array($this->selection) && count($this->selection) == 1) |
|
122
|
122
|
{ |
|
123
|
123
|
return $this->uicontacts->link_title($this->selection[0]); |
|
124
|
124
|
} |