@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use EGroupware\Api; |
17 | 17 | |
18 | 18 | // explicit import not namespaced classes |
19 | -use calendar_boupdate; // we detect if it is not available |
|
19 | +use calendar_boupdate; // we detect if it is not available |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Contacts document merge |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | * @param boolean $ignore_acl =false true: no acl check |
56 | 56 | * @return array|boolean |
57 | 57 | */ |
58 | - protected function get_replacements($id,&$content=null,$ignore_acl=false) |
|
58 | + protected function get_replacements($id, &$content = null, $ignore_acl = false) |
|
59 | 59 | { |
60 | - if (!($replacements = $this->contact_replacements($id,'',$ignore_acl, $content))) |
|
60 | + if (!($replacements = $this->contact_replacements($id, '', $ignore_acl, $content))) |
|
61 | 61 | { |
62 | 62 | return false; |
63 | 63 | } |
64 | - if($content && strpos($content, '$$#') !== false) |
|
64 | + if ($content && strpos($content, '$$#') !== false) |
|
65 | 65 | { |
66 | - $this->cf_link_to_expand($this->contacts->read($id, $ignore_acl), $content, $replacements,'addressbook'); |
|
66 | + $this->cf_link_to_expand($this->contacts->read($id, $ignore_acl), $content, $replacements, 'addressbook'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // Links |
70 | 70 | $replacements += $this->get_all_links('addressbook', $id, '', $content); |
71 | - if (!(strpos($content,'$$calendar/') === false)) |
|
71 | + if (!(strpos($content, '$$calendar/') === false)) |
|
72 | 72 | { |
73 | - $replacements += $this->calendar_replacements($id,!(strpos($content,'$$calendar/-1/') === false)); |
|
73 | + $replacements += $this->calendar_replacements($id, !(strpos($content, '$$calendar/-1/') === false)); |
|
74 | 74 | } |
75 | 75 | return $replacements; |
76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param boolean $last_event_too =false also include information about the last event |
83 | 83 | * @return array |
84 | 84 | */ |
85 | - protected function calendar_replacements($id,$last_event_too=false) |
|
85 | + protected function calendar_replacements($id, $last_event_too = false) |
|
86 | 86 | { |
87 | 87 | if (!class_exists('calendar_boupdate')) return array(); |
88 | 88 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $events = array(); |
103 | 103 | } |
104 | - if ($last_event_too==true) |
|
104 | + if ($last_event_too == true) |
|
105 | 105 | { |
106 | 106 | $last = $calendar->search(array( |
107 | 107 | 'end' => $calendar->now_su, |
@@ -111,41 +111,41 @@ discard block |
||
111 | 111 | 'order' => 'cal_start DESC', |
112 | 112 | 'enum_recurring' => true |
113 | 113 | )); |
114 | - $events['-1'] = $last ? array_shift($last) : array(); // returned events are indexed by cal_id! |
|
114 | + $events['-1'] = $last ? array_shift($last) : array(); // returned events are indexed by cal_id! |
|
115 | 115 | } |
116 | 116 | $replacements = array(); |
117 | - $n = 1; // Returned events are indexed by cal_id, need to index sequentially |
|
118 | - foreach($events as $key => $event) |
|
117 | + $n = 1; // Returned events are indexed by cal_id, need to index sequentially |
|
118 | + foreach ($events as $key => $event) |
|
119 | 119 | { |
120 | 120 | // Use -1 for previous key |
121 | - if($key < 0) $n = $key; |
|
121 | + if ($key < 0) $n = $key; |
|
122 | 122 | |
123 | - foreach($calendar->event2array($event) as $name => $data) |
|
123 | + foreach ($calendar->event2array($event) as $name => $data) |
|
124 | 124 | { |
125 | - if (substr($name,-4) == 'date') $name = substr($name,0,-4); |
|
126 | - $replacements['$$calendar/'.$n.'/'.$name.'$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data']; |
|
125 | + if (substr($name, -4) == 'date') $name = substr($name, 0, -4); |
|
126 | + $replacements['$$calendar/'.$n.'/'.$name.'$$'] = is_array($data['data']) ? implode(', ', $data['data']) : $data['data']; |
|
127 | 127 | } |
128 | - foreach(array('start','end') as $what) |
|
128 | + foreach (array('start', 'end') as $what) |
|
129 | 129 | { |
130 | - foreach(array( |
|
130 | + foreach (array( |
|
131 | 131 | 'date' => $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], |
132 | 132 | 'day' => 'l', |
133 | 133 | 'time' => $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i', |
134 | 134 | ) as $name => $format) |
135 | 135 | { |
136 | - $value = $event[$what] ? date($format,$event[$what]) : ''; |
|
136 | + $value = $event[$what] ? date($format, $event[$what]) : ''; |
|
137 | 137 | if ($format == 'l') $value = lang($value); |
138 | 138 | $replacements['$$calendar/'.$n.'/'.$what.$name.'$$'] = $value; |
139 | 139 | } |
140 | 140 | } |
141 | - $duration = ($event['end'] - $event['start'])/60; |
|
142 | - $replacements['$$calendar/'.$n.'/duration$$'] = floor($duration/60).lang('h').($duration%60 ? $duration%60 : ''); |
|
141 | + $duration = ($event['end'] - $event['start']) / 60; |
|
142 | + $replacements['$$calendar/'.$n.'/duration$$'] = floor($duration / 60).lang('h').($duration % 60 ? $duration % 60 : ''); |
|
143 | 143 | |
144 | 144 | ++$n; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Need to set some keys if there is no previous event |
148 | - if($last_event_too && count($events['-1']) == 0) { |
|
148 | + if ($last_event_too && count($events['-1']) == 0) { |
|
149 | 149 | $replacements['$$calendar/-1/start$$'] = ''; |
150 | 150 | $replacements['$$calendar/-1/end$$'] = ''; |
151 | 151 | $replacements['$$calendar/-1/owner$$'] = ''; |
@@ -168,18 +168,18 @@ discard block |
||
168 | 168 | echo '<tr><td colspan="4"><h3>'.lang('Contact fields:')."</h3></td></tr>"; |
169 | 169 | |
170 | 170 | $n = 0; |
171 | - foreach($this->contacts->contact_fields as $name => $label) |
|
171 | + foreach ($this->contacts->contact_fields as $name => $label) |
|
172 | 172 | { |
173 | - if (in_array($name,array('tid','label','geo'))) continue; // dont show them, as they are not used in the UI atm. |
|
173 | + if (in_array($name, array('tid', 'label', 'geo'))) continue; // dont show them, as they are not used in the UI atm. |
|
174 | 174 | |
175 | - if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) // main values, which should be in the first column |
|
175 | + if (in_array($name, array('email', 'org_name', 'tel_work', 'url')) && $n&1) // main values, which should be in the first column |
|
176 | 176 | { |
177 | 177 | echo "</tr>\n"; |
178 | 178 | $n++; |
179 | 179 | } |
180 | 180 | if (!($n&1)) echo '<tr>'; |
181 | 181 | echo '<td>{{'.$name.'}}</td><td>'.$label.'</td>'; |
182 | - if($name == 'cat_id') |
|
182 | + if ($name == 'cat_id') |
|
183 | 183 | { |
184 | 184 | if ($n&1) echo "</tr>\n"; |
185 | 185 | echo '<td>{{categories}}</td><td>'.lang('Category path').'</td>'; |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
193 | - foreach($this->contacts->customfields as $name => $field) |
|
193 | + foreach ($this->contacts->customfields as $name => $field) |
|
194 | 194 | { |
195 | 195 | echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n"; |
196 | 196 | } |
197 | 197 | |
198 | 198 | echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>"; |
199 | - foreach(array( |
|
199 | + foreach (array( |
|
200 | 200 | 'link' => lang('HTML link to the current record'), |
201 | 201 | 'links' => lang('Titles of any entries linked to the current record, excluding attached files'), |
202 | 202 | 'attachments' => lang('List of files linked to the current record'), |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | Api\Translation::add_app('calendar'); |
225 | 225 | echo '<tr><td colspan="4"><h3>'.lang('Calendar fields:')." # = 1, 2, ..., 20, -1</h3></td></tr>"; |
226 | - foreach(array( |
|
226 | + foreach (array( |
|
227 | 227 | 'title' => lang('Title'), |
228 | 228 | 'description' => lang('Description'), |
229 | 229 | 'participants' => lang('Participants'), |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | 'owner' => lang('Owner'), |
246 | 246 | ) as $name => $label) |
247 | 247 | { |
248 | - if (in_array($name,array('start','end')) && $n&1) // main values, which should be in the first column |
|
248 | + if (in_array($name, array('start', 'end')) && $n&1) // main values, which should be in the first column |
|
249 | 249 | { |
250 | 250 | echo "</tr>\n"; |
251 | 251 | $n++; |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | * @param int|string $export_limit =null export-limit, default $GLOBALS['egw_info']['server']['export_limit'] |
275 | 275 | * @return array see nextmatch_widget::egw_actions |
276 | 276 | */ |
277 | - public static function document_action($dirs, $group=0, $caption='Insert in document', $prefix='document_', $default_doc='', |
|
278 | - $export_limit=null) |
|
277 | + public static function document_action($dirs, $group = 0, $caption = 'Insert in document', $prefix = 'document_', $default_doc = '', |
|
278 | + $export_limit = null) |
|
279 | 279 | { |
280 | 280 | $actions = parent::document_action($dirs, $group, $caption, $prefix, $default_doc, $export_limit); |
281 | 281 | |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | // Just email already filtered out |
293 | 293 | $action['children'] = $action['children']['message/rfc822']['children']; |
294 | 294 | } |
295 | - if(strpos($action['egw_open'], 'edit-mail') === 0) |
|
295 | + if (strpos($action['egw_open'], 'edit-mail') === 0) |
|
296 | 296 | { |
297 | 297 | unset($action['confirm_multiple']); |
298 | 298 | $action['onExecute'] = 'javaScript:app.addressbook.merge_mail'; |
299 | 299 | } |
300 | 300 | else if ($action['children']) |
301 | 301 | { |
302 | - foreach($action['children'] as &$child) |
|
302 | + foreach ($action['children'] as &$child) |
|
303 | 303 | { |
304 | 304 | static::customise_mail_actions($child); |
305 | 305 | } |