@@ -225,7 +225,7 @@ |
||
225 | 225 | |
226 | 226 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
227 | 227 | $link['link_id'] != $info['info_link_id'] && |
228 | - ($link['app'] != $action || $link['id'] != $action_id) && |
|
228 | + ($link['app'] != $action || $link['id'] != $action_id) && |
|
229 | 229 | ($show_links == 'all' || ($show_links == 'links') === ($link['app'] != Link::VFS_APPNAME))) |
230 | 230 | { |
231 | 231 | $info['filelinks'][] = $link; |
@@ -294,6 +294,8 @@ discard block |
||
294 | 294 | * @param array &$query |
295 | 295 | * @param array &$rows |
296 | 296 | * @param array &$readonlys |
297 | + * @param type|null $rows |
|
298 | + * @param type|null $readonlys |
|
297 | 299 | * @return int |
298 | 300 | */ |
299 | 301 | function get_rows(&$query,&$rows,&$readonlys) |
@@ -569,7 +571,6 @@ discard block |
||
569 | 571 | * Hook for timesheet to set some extra data and links |
570 | 572 | * |
571 | 573 | * @param array $data |
572 | - * @param int $data[id] info_id |
|
573 | 574 | * @return array with key => value pairs to set in new timesheet and link_app/link_id arrays |
574 | 575 | */ |
575 | 576 | function timesheet_set($data) |
@@ -595,7 +596,6 @@ discard block |
||
595 | 596 | * Hook for calendar to set some extra data and links |
596 | 597 | * |
597 | 598 | * @param array $data event-array preset by calendar plus |
598 | - * @param int $data[entry_id] info_id |
|
599 | 599 | * @return array with key => value pairs to set in new event and link_app/link_id arrays |
600 | 600 | */ |
601 | 601 | function calendar_set($data) |
@@ -683,11 +683,11 @@ discard block |
||
683 | 683 | /** |
684 | 684 | * Shows the infolog list |
685 | 685 | * |
686 | - * @param array/string $values etemplate content or 'reset_action_view' if called by index.php to reset an action-view |
|
686 | + * @param integer $values etemplate content or 'reset_action_view' if called by index.php to reset an action-view |
|
687 | 687 | * @param string $action if set only entries liked to that $action:$action_id are shown |
688 | 688 | * @param string $action_id if set only entries liked to that $action:$action_id are shown |
689 | - * @param mixed $called_as is how we got called, for a hook eg. the call-params of that page containing the hook |
|
690 | - * @param boolean $e$extra_app_header * @param boolean $return_html=false |
|
689 | + * @param integer $called_as is how we got called, for a hook eg. the call-params of that page containing the hook |
|
690 | + * @param boolean $extra_app_header * @param boolean $return_html |
|
691 | 691 | * @param string $own_referer='' this is our own referer |
692 | 692 | * @param string $action_title='' app_header for the action, if '' we try the link-title |
693 | 693 | */ |
@@ -1515,9 +1515,9 @@ discard block |
||
1515 | 1515 | /** |
1516 | 1516 | * Closes an infolog |
1517 | 1517 | * |
1518 | - * @param int|array $values=0 info_id (default _GET[info_id]) |
|
1518 | + * @param int|array $values info_id (default _GET[info_id]) |
|
1519 | 1519 | * @param string $_referer='' |
1520 | - * @param boolean $closesingle=false |
|
1520 | + * @param boolean $closesingle |
|
1521 | 1521 | */ |
1522 | 1522 | function close($values=0,$_referer='',$closesingle=false,$skip_notification = false) |
1523 | 1523 | { |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | /** |
1566 | 1566 | * Deletes an InfoLog entry |
1567 | 1567 | * |
1568 | - * @param array|int $values info_id (default _GET[info_id]) |
|
1568 | + * @param integer $values info_id (default _GET[info_id]) |
|
1569 | 1569 | * @param string $_referer |
1570 | 1570 | * @param string $called_by |
1571 | 1571 | * @param boolean $skip_notification Do not send notification of deletion |
@@ -90,7 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | function __construct() |
92 | 92 | { |
93 | - if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') translation::add_app('infolog'); |
|
93 | + if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') |
|
94 | + { |
|
95 | + translation::add_app('infolog'); |
|
96 | + } |
|
94 | 97 | |
95 | 98 | // Make sure Global category is infolog - on first load, it may not be |
96 | 99 | if($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
@@ -164,13 +167,19 @@ discard block |
||
164 | 167 | $done = $info['info_status'] == 'done' || $info['info_status'] == 'billed' || $info['info_status'] == 'cancelled'; //cancelled is regarded as a completed status as well in bo |
165 | 168 | // regard an infolog as done/billed/cancelled if its percentage is 100% when there is to status like the above for that type |
166 | 169 | if (!$done && !isset($this->bo->status[$info['info_type']]['done']) && !isset($this->bo->status[$info['info_type']]['billed']) && |
167 | - !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) $done = true ; |
|
170 | + !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) |
|
171 | + { |
|
172 | + $done = true ; |
|
173 | + } |
|
168 | 174 | $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']] . ($done ? '_done' : ''); |
169 | 175 | if (!$done && $info['info_enddate'] < $this->bo->user_time_now) |
170 | 176 | { |
171 | 177 | $info['end_class'] = 'infolog_overdue'; |
172 | 178 | } |
173 | - if (!isset($info['info_anz_subs'])) $info['info_anz_subs'] = $this->bo->anzSubs($id); |
|
179 | + if (!isset($info['info_anz_subs'])) |
|
180 | + { |
|
181 | + $info['info_anz_subs'] = $this->bo->anzSubs($id); |
|
182 | + } |
|
174 | 183 | $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id |
175 | 184 | $info['info_percent'] = (int) $info['info_percent'].'%'; |
176 | 185 | $editrights = $this->bo->check_access($info,EGW_ACL_EDIT); |
@@ -203,12 +212,21 @@ discard block |
||
203 | 212 | { |
204 | 213 | $info['class'] .= 'rowNoSubs '; |
205 | 214 | } |
206 | - if ($info['info_id_parent']) $info['class'] .= 'infolog_rowHasParent '; |
|
207 | - if ($info['info_anz_subs'] > 0) $info['class'] .= 'infolog_rowHasSubs '; |
|
215 | + if ($info['info_id_parent']) |
|
216 | + { |
|
217 | + $info['class'] .= 'infolog_rowHasParent '; |
|
218 | + } |
|
219 | + if ($info['info_anz_subs'] > 0) |
|
220 | + { |
|
221 | + $info['class'] .= 'infolog_rowHasSubs '; |
|
222 | + } |
|
208 | 223 | |
209 | 224 | $info['row_mod'] = $info['info_datemodified']; |
210 | 225 | |
211 | - if (!$show_links) $show_links = $this->prefs['show_links']; |
|
226 | + if (!$show_links) |
|
227 | + { |
|
228 | + $show_links = $this->prefs['show_links']; |
|
229 | + } |
|
212 | 230 | if (($show_links != 'none' && $show_links != 'no_describtion' || |
213 | 231 | $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) && |
214 | 232 | (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true)))) |
@@ -218,9 +236,16 @@ discard block |
||
218 | 236 | { |
219 | 237 | // incl. link modification time into row_mod (link's lastmod is always in server-time!) |
220 | 238 | $link_mod = egw_time::server2user($link['lastmod']); |
221 | - if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod; |
|
239 | + if ($info['row_mod'] < $link_mod) |
|
240 | + { |
|
241 | + $info['row_mod'] = $link_mod; |
|
242 | + } |
|
222 | 243 | |
223 | - if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
244 | + if ($link['deleted']) |
|
245 | + { |
|
246 | + continue; |
|
247 | + } |
|
248 | + // skip deleted links, but incl. them in row_mod! |
|
224 | 249 | |
225 | 250 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
226 | 251 | $link['link_id'] != $info['info_link_id'] && |
@@ -233,14 +258,20 @@ discard block |
||
233 | 258 | { |
234 | 259 | $info['pm_id'] = $link['id']; |
235 | 260 | } |
236 | - if ($link['app'] == 'timesheet') $timesheets[] = $link['id']; |
|
261 | + if ($link['app'] == 'timesheet') |
|
262 | + { |
|
263 | + $timesheets[] = $link['id']; |
|
264 | + } |
|
237 | 265 | } |
238 | 266 | if ($this->prefs['show_times'] && isset($GLOBALS['egw_info']['user']['apps']['timesheet']) && $timesheets) |
239 | 267 | { |
240 | 268 | $sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets); |
241 | 269 | $info['info_sum_timesheets'] = $sum['duration']; |
242 | 270 | // incl. max timesheet modification in row_mod |
243 | - if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified']; |
|
271 | + if ($info['row_mod'] < $sum['max_modified']) |
|
272 | + { |
|
273 | + $info['row_mod'] = $sum['max_modified']; |
|
274 | + } |
|
244 | 275 | } |
245 | 276 | } |
246 | 277 | $info['info_type_label'] = $this->bo->enums['type'][$info['info_type']]; |
@@ -255,10 +286,13 @@ discard block |
||
255 | 286 | } |
256 | 287 | $readonlys["edit_percent[$id]"] = true; |
257 | 288 | } |
258 | - elseif($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
289 | + elseif($readonlys["edit_percent[$id]"]) |
|
290 | + { |
|
291 | + // show percent, but button is switched off |
|
259 | 292 | { |
260 | 293 | $info['info_percent2'] = $info['info_percent']; |
261 | 294 | } |
295 | + } |
|
262 | 296 | if ($this->prefs['show_id'] == 1 || $this->prefs['show_id'] == 2 && $details) |
263 | 297 | { |
264 | 298 | $info['info_number'] = $info['info_id']; |
@@ -331,10 +365,16 @@ discard block |
||
331 | 365 | $query['col_filter'] = array('info_id_parent' => $query['col_filter']['info_id_parent']); |
332 | 366 | } |
333 | 367 | $orginal_colfilter = $query['col_filter']; |
334 | - if (isset($parent_id)) $query['col_filter']['info_id_parent'] = (string)$parent_id; |
|
368 | + if (isset($parent_id)) |
|
369 | + { |
|
370 | + $query['col_filter']['info_id_parent'] = (string)$parent_id; |
|
371 | + } |
|
335 | 372 | |
336 | 373 | //echo "<p>infolog_ui.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]',col_filter=".print_r($query['col_filter'],True).",sort=$query[sort],order=$query[order])</p>\n"; |
337 | - if (!isset($query['start'])) $query['start'] = 0; |
|
374 | + if (!isset($query['start'])) |
|
375 | + { |
|
376 | + $query['start'] = 0; |
|
377 | + } |
|
338 | 378 | |
339 | 379 | // handle action and linked filter (show only entries linked to a certain other entry) |
340 | 380 | $link_filters = array(); |
@@ -363,7 +403,10 @@ discard block |
||
363 | 403 | $app = $link['app']; |
364 | 404 | $id = $link['id']; |
365 | 405 | } |
366 | - if(!is_array($id)) $id = explode(',',$id); |
|
406 | + if(!is_array($id)) |
|
407 | + { |
|
408 | + $id = explode(',',$id); |
|
409 | + } |
|
367 | 410 | if (!($linked = egw_link::get_links_multiple($app,$id,true,'infolog','',$query['col_filter']['info_status'] == 'deleted'))) |
368 | 411 | { |
369 | 412 | $rows = array(); // no infologs linked to selected link --> no rows to return |
@@ -412,7 +455,10 @@ discard block |
||
412 | 455 | } |
413 | 456 | } |
414 | 457 | // Template change forces the UI to do a full update first, no point in getting rows right now |
415 | - if($old_template && $old_template != $query['template']) return 0; |
|
458 | + if($old_template && $old_template != $query['template']) |
|
459 | + { |
|
460 | + return 0; |
|
461 | + } |
|
416 | 462 | |
417 | 463 | // do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific |
418 | 464 | // so we have to check that as well |
@@ -473,12 +519,18 @@ discard block |
||
473 | 519 | $parent_first = count($parents) == 1; |
474 | 520 | $parent_index = 0; |
475 | 521 | // et2 nextmatch listens to total, and only displays that many rows, so add parent in or we'll lose the last row |
476 | - if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
522 | + if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) |
|
523 | + { |
|
524 | + $query['total']++; |
|
525 | + } |
|
477 | 526 | |
478 | 527 | // Check to see if we need to remove description |
479 | 528 | foreach($infos as $id => $info) |
480 | 529 | { |
481 | - if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) $info['info_addr'] = str_replace(',',', ',$info['info_addr']); |
|
530 | + if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) |
|
531 | + { |
|
532 | + $info['info_addr'] = str_replace(',',', ',$info['info_addr']); |
|
533 | + } |
|
482 | 534 | if (!$query['csv_export'] || !is_array($query['csv_export'])) |
483 | 535 | { |
484 | 536 | $info['links'] =& $links[$id]; |
@@ -502,7 +554,10 @@ discard block |
||
502 | 554 | { |
503 | 555 | foreach(array_keys($main) as $n) |
504 | 556 | { |
505 | - if ($n[0] == '#' && !in_array($n, $columselection)) unset($main[$n]); |
|
557 | + if ($n[0] == '#' && !in_array($n, $columselection)) |
|
558 | + { |
|
559 | + unset($main[$n]); |
|
560 | + } |
|
506 | 561 | } |
507 | 562 | break; |
508 | 563 | } |
@@ -519,8 +574,14 @@ discard block |
||
519 | 574 | } |
520 | 575 | unset($links); |
521 | 576 | |
522 | - if ($query['cat_id']) $rows['no_cat_id'] = true; |
|
523 | - if ($query['no_actions']) $rows['no_actions'] = true; |
|
577 | + if ($query['cat_id']) |
|
578 | + { |
|
579 | + $rows['no_cat_id'] = true; |
|
580 | + } |
|
581 | + if ($query['no_actions']) |
|
582 | + { |
|
583 | + $rows['no_actions'] = true; |
|
584 | + } |
|
524 | 585 | $rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']); |
525 | 586 | if($clear_status_filter) |
526 | 587 | { |
@@ -528,7 +589,10 @@ discard block |
||
528 | 589 | } |
529 | 590 | |
530 | 591 | // switch cf column off, if we have no cf's |
531 | - if (!$query['custom_fields']) $rows['no_customfields'] = true; |
|
592 | + if (!$query['custom_fields']) |
|
593 | + { |
|
594 | + $rows['no_customfields'] = true; |
|
595 | + } |
|
532 | 596 | |
533 | 597 | if ($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'none' && |
534 | 598 | !isset($GLOBALS['egw_info']['user']['apps']['admin'])) |
@@ -560,7 +624,11 @@ discard block |
||
560 | 624 | } |
561 | 625 | } |
562 | 626 | |
563 | - if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
627 | + if (isset($linked)) |
|
628 | + { |
|
629 | + $query['col_filter']['linked'] = $linked; |
|
630 | + } |
|
631 | + // add linked back to the colfilter |
|
564 | 632 | |
565 | 633 | return $query['total']; |
566 | 634 | } |
@@ -577,7 +645,10 @@ discard block |
||
577 | 645 | $set = array(); |
578 | 646 | if ((int)$data['id'] && ($info = $this->bo->read($data['id']))) |
579 | 647 | { |
580 | - if ($info['info_cat']) $set['cat_id'] = $info['info_cat']; |
|
648 | + if ($info['info_cat']) |
|
649 | + { |
|
650 | + $set['cat_id'] = $info['info_cat']; |
|
651 | + } |
|
581 | 652 | |
582 | 653 | foreach(egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true) as $link) |
583 | 654 | { |
@@ -615,7 +686,10 @@ discard block |
||
615 | 686 | 'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted'] |
616 | 687 | )); |
617 | 688 | unset($event['entry_id']); |
618 | - if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
689 | + if (!$event['end']) |
|
690 | + { |
|
691 | + $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
692 | + } |
|
619 | 693 | |
620 | 694 | // Match categories by name |
621 | 695 | $event['category'] = $GLOBALS['egw']->categories->name2id(categories::id2name($infolog['info_cat'])); |
@@ -674,7 +748,10 @@ discard block |
||
674 | 748 | // Copy same custom fields |
675 | 749 | foreach(array_keys(config::get_customfields('calendar')) as $name) |
676 | 750 | { |
677 | - if ($this->bo->customfields[$name]) $event['#'.$name] = $infolog['#'.$name]; |
|
751 | + if ($this->bo->customfields[$name]) |
|
752 | + { |
|
753 | + $event['#'.$name] = $infolog['#'.$name]; |
|
754 | + } |
|
678 | 755 | } |
679 | 756 | //error_log(__METHOD__.'('.array2string($data).') infolog='.array2string($infolog).' returning '.array2string($event)); |
680 | 757 | return $event; |
@@ -824,13 +901,19 @@ discard block |
||
824 | 901 | $values['nm']['sort'] = 'DESC'; |
825 | 902 | } |
826 | 903 | |
827 | - if (!$values['nm']['session_for'] && $this->called_by) $values['nm']['session_for'] = $this->called_by; |
|
904 | + if (!$values['nm']['session_for'] && $this->called_by) |
|
905 | + { |
|
906 | + $values['nm']['session_for'] = $this->called_by; |
|
907 | + } |
|
828 | 908 | |
829 | 909 | $action_id = $values['action_id'] = $action ? $action_id : $nm['action_id']; |
830 | 910 | $action_title = $values['action_title'] = $action ? $action_title : $nm['action_title']; |
831 | 911 | $action = $values['action'] = $action ? $action : $nm['action']; |
832 | 912 | } |
833 | - if($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
913 | + if($_GET['search']) |
|
914 | + { |
|
915 | + $values['nm']['search'] = $_GET['search']; |
|
916 | + } |
|
834 | 917 | |
835 | 918 | if ($values['nm']['add']) |
836 | 919 | { |
@@ -880,7 +963,10 @@ discard block |
||
880 | 963 | switch ($action) |
881 | 964 | { |
882 | 965 | case 'sp': |
883 | - if (!is_array($action_id) && strpos($action_id, 'infolog:') === 0) $action_id = (int)substr($action_id, 8); |
|
966 | + if (!is_array($action_id) && strpos($action_id, 'infolog:') === 0) |
|
967 | + { |
|
968 | + $action_id = (int)substr($action_id, 8); |
|
969 | + } |
|
884 | 970 | if ((is_array($action_id) && !$this->bo->read(current($action_id))) || !$this->bo->read($action_id)) |
885 | 971 | { |
886 | 972 | $action = ''; |
@@ -927,7 +1013,10 @@ discard block |
||
927 | 1013 | // Allow add actions even when there's no rows |
928 | 1014 | $values['nm']['placeholder_actions'] = array('new'); |
929 | 1015 | |
930 | - if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
1016 | + if(!isset($values['nm']['filter2'])) |
|
1017 | + { |
|
1018 | + $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
1019 | + } |
|
931 | 1020 | |
932 | 1021 | // disable columns for main entry as set in the pref for details or no details |
933 | 1022 | $values['nm']['columnselection_pref'] = 'nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows') |
@@ -953,7 +1042,10 @@ discard block |
||
953 | 1042 | { |
954 | 1043 | foreach (array_keys($values['nm']['col_filter']) as $colfk) |
955 | 1044 | { |
956 | - if (is_int($colfk)) unset($values['nm']['col_filter']); |
|
1045 | + if (is_int($colfk)) |
|
1046 | + { |
|
1047 | + unset($values['nm']['col_filter']); |
|
1048 | + } |
|
957 | 1049 | } |
958 | 1050 | } |
959 | 1051 | $values['action'] = $persist['action'] = $values['nm']['action'] = $action; |
@@ -996,7 +1088,10 @@ discard block |
||
996 | 1088 | // does not take implicit rights as delegated into account, so they will not be available as filters |
997 | 1089 | foreach($this->bo->group_owners as $type => $group) |
998 | 1090 | { |
999 | - if (!isset($this->bo->grants[$group])) unset($sel_options['info_type'][$type]); |
|
1091 | + if (!isset($this->bo->grants[$group])) |
|
1092 | + { |
|
1093 | + unset($sel_options['info_type'][$type]); |
|
1094 | + } |
|
1000 | 1095 | } |
1001 | 1096 | |
1002 | 1097 | |
@@ -1045,7 +1140,11 @@ discard block |
||
1045 | 1140 | unset($types['delete']); |
1046 | 1141 | foreach($types as $type => &$data) |
1047 | 1142 | { |
1048 | - if ($type=='email') continue;//requirement by sales that it should not be shown in right - click - action dialog |
|
1143 | + if ($type=='email') |
|
1144 | + { |
|
1145 | + continue; |
|
1146 | + } |
|
1147 | + //requirement by sales that it should not be shown in right - click - action dialog |
|
1049 | 1148 | $data = array( |
1050 | 1149 | 'caption' => $data, |
1051 | 1150 | 'icon' => $type, |
@@ -1345,7 +1444,10 @@ discard block |
||
1345 | 1444 | return $failed == 0; |
1346 | 1445 | |
1347 | 1446 | case 'document': |
1348 | - if (!$settings) $settings = $this->prefs['default_document']; |
|
1447 | + if (!$settings) |
|
1448 | + { |
|
1449 | + $settings = $this->prefs['default_document']; |
|
1450 | + } |
|
1349 | 1451 | $document_merge = new infolog_merge(); |
1350 | 1452 | $msg = $document_merge->download($settings, $checked, '', $this->prefs['document_dir']); |
1351 | 1453 | $failed = count($checked); |
@@ -1531,11 +1633,16 @@ discard block |
||
1531 | 1633 | #_debug_array($info); |
1532 | 1634 | $status = $info['info_status']; |
1533 | 1635 | // closed stati assumed array('done','billed','cancelled') |
1534 | - if (isset($this->bo->status[$info['info_type']]['done'])) { |
|
1636 | + if (isset($this->bo->status[$info['info_type']]['done'])) |
|
1637 | + { |
|
1535 | 1638 | $status ='done'; |
1536 | - } elseif (isset($this->bo->status[$info['info_type']]['billed'])) { |
|
1639 | + } |
|
1640 | + elseif (isset($this->bo->status[$info['info_type']]['billed'])) |
|
1641 | + { |
|
1537 | 1642 | $status ='billed'; |
1538 | - } elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) { |
|
1643 | + } |
|
1644 | + elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) |
|
1645 | + { |
|
1539 | 1646 | $status ='cancelled'; |
1540 | 1647 | } |
1541 | 1648 | #_debug_array($status); |
@@ -1549,17 +1656,25 @@ discard block |
||
1549 | 1656 | $this->bo->write($values, true,true,true,$skip_notification); |
1550 | 1657 | |
1551 | 1658 | $query = array('action'=>'sp','action_id'=>$info_id); |
1552 | - if (!$closesingle) { |
|
1659 | + if (!$closesingle) |
|
1660 | + { |
|
1553 | 1661 | foreach((array)$this->bo->search($query) as $info) |
1554 | 1662 | { |
1555 | - if ($info['info_id_parent'] == $info_id) // search also returns linked entries! |
|
1663 | + if ($info['info_id_parent'] == $info_id) |
|
1664 | + { |
|
1665 | + // search also returns linked entries! |
|
1556 | 1666 | { |
1557 | - $this->close($info['info_id'],$referer,$closesingle,$skip_notification); // we call ourselfs recursive to process subs from subs too |
|
1667 | + $this->close($info['info_id'],$referer,$closesingle,$skip_notification); |
|
1668 | + } |
|
1669 | + // we call ourselfs recursive to process subs from subs too |
|
1558 | 1670 | } |
1559 | 1671 | } |
1560 | 1672 | } |
1561 | 1673 | } |
1562 | - if ($referer) $this->tmpl->location($referer); |
|
1674 | + if ($referer) |
|
1675 | + { |
|
1676 | + $this->tmpl->location($referer); |
|
1677 | + } |
|
1563 | 1678 | } |
1564 | 1679 | |
1565 | 1680 | /** |
@@ -1575,10 +1690,13 @@ discard block |
||
1575 | 1690 | $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
1576 | 1691 | $referer = is_array($values) ? $values['referer'] : $_referer; |
1577 | 1692 | |
1578 | - if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) // entries without subs get confirmed by javascript |
|
1693 | + if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) |
|
1694 | + { |
|
1695 | + // entries without subs get confirmed by javascript |
|
1579 | 1696 | { |
1580 | 1697 | $values = array('delete' => true); |
1581 | 1698 | } |
1699 | + } |
|
1582 | 1700 | //echo "<p>infolog_ui::delete(".print_r($values,true).",'$referer','$called_by') info_id=$info_id</p>\n"; |
1583 | 1701 | |
1584 | 1702 | if (is_array($values) || $info_id <= 0) |
@@ -1587,11 +1705,16 @@ discard block |
||
1587 | 1705 | { |
1588 | 1706 | $deleted = $this->bo->delete($info_id,$values['delete_subs'],$values['info_id_parent'], $skip_notification); |
1589 | 1707 | } |
1590 | - if ($called_by) // direct call from the same request |
|
1708 | + if ($called_by) |
|
1709 | + { |
|
1710 | + // direct call from the same request |
|
1591 | 1711 | { |
1592 | 1712 | return $deleted ? lang('InfoLog entry deleted') : ''; |
1593 | 1713 | } |
1594 | - if ($values['called_by'] == 'edit') // we run in the edit popup => give control back to edit |
|
1714 | + } |
|
1715 | + if ($values['called_by'] == 'edit') |
|
1716 | + { |
|
1717 | + // we run in the edit popup => give control back to edit |
|
1595 | 1718 | { |
1596 | 1719 | $this->edit(array( |
1597 | 1720 | 'info_id' => $info_id, |
@@ -1600,6 +1723,7 @@ discard block |
||
1600 | 1723 | 'msg' => $deleted ? lang('Infolog entry deleted') : '', |
1601 | 1724 | )); |
1602 | 1725 | } |
1726 | + } |
|
1603 | 1727 | return $referer ? $this->tmpl->location($referer) : $this->index(); |
1604 | 1728 | } |
1605 | 1729 | $readonlys = $values = array(); |
@@ -1648,10 +1772,17 @@ discard block |
||
1648 | 1772 | $no_popup = $content['no_popup']; unset($content['no_popup']); |
1649 | 1773 | |
1650 | 1774 | list($button) = @each($content['button']); |
1651 | - if (!$button && $action) $button = $action; // action selectbox |
|
1775 | + if (!$button && $action) |
|
1776 | + { |
|
1777 | + $button = $action; |
|
1778 | + } |
|
1779 | + // action selectbox |
|
1652 | 1780 | //info_cc expects an comma separated string |
1653 | 1781 | //error_log(__METHOD__.__LINE__.array2string($content)); |
1654 | - if (empty($content['info_cc'])) $content['info_cc'] = ""; |
|
1782 | + if (empty($content['info_cc'])) |
|
1783 | + { |
|
1784 | + $content['info_cc'] = ""; |
|
1785 | + } |
|
1655 | 1786 | if (is_array($content['info_cc'])) |
1656 | 1787 | { |
1657 | 1788 | foreach($content['info_cc'] as $i => $value) |
@@ -1661,7 +1792,10 @@ discard block |
||
1661 | 1792 | //error_log(__METHOD__.__LINE__.$value.'->'.array2string($addresses[0])); |
1662 | 1793 | $content['info_cc'][$i]=$addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
1663 | 1794 | } |
1664 | - if (!empty($content['info_cc'])) $content['info_cc'] = implode(',',$content['info_cc']); |
|
1795 | + if (!empty($content['info_cc'])) |
|
1796 | + { |
|
1797 | + $content['info_cc'] = implode(',',$content['info_cc']); |
|
1798 | + } |
|
1665 | 1799 | } |
1666 | 1800 | unset($content['button']); |
1667 | 1801 | if ($button) |
@@ -1800,9 +1934,12 @@ discard block |
||
1800 | 1934 | egw_link::link('infolog',$info_id,$content['link_to']['to_id']); |
1801 | 1935 | $content['link_to']['to_id'] = $info_id; |
1802 | 1936 | } |
1803 | - if ($info_link_id && strpos($info_link_id,':') !== false) // updating info_link_id if necessary |
|
1937 | + if ($info_link_id && strpos($info_link_id,':') !== false) |
|
1938 | + { |
|
1939 | + // updating info_link_id if necessary |
|
1804 | 1940 | { |
1805 | 1941 | list($app,$id) = explode(':',$info_link_id); |
1942 | + } |
|
1806 | 1943 | $link = egw_link::get_link('infolog',$info_id,$app,$id); |
1807 | 1944 | if ((int) $content['info_link_id'] != (int) $link['link_id']) |
1808 | 1945 | { |
@@ -1824,12 +1961,19 @@ discard block |
||
1824 | 1961 | } |
1825 | 1962 | elseif ($button == 'delete' && $info_id > 0) |
1826 | 1963 | { |
1827 | - if (!$referer && $action) $referer = array( |
|
1964 | + if (!$referer && $action) |
|
1965 | + { |
|
1966 | + $referer = array( |
|
1828 | 1967 | 'menuaction' => 'infolog.infolog_ui.index', |
1829 | 1968 | 'action' => $action, |
1830 | 1969 | 'action_id' => $action_id |
1831 | 1970 | ); |
1832 | - if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first |
|
1971 | + } |
|
1972 | + if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) |
|
1973 | + { |
|
1974 | + return; |
|
1975 | + } |
|
1976 | + // checks ACL first |
|
1833 | 1977 | |
1834 | 1978 | egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
1835 | 1979 | } |
@@ -1879,13 +2023,20 @@ discard block |
||
1879 | 2023 | $type = $type ? $type : get_var('type', array('POST','GET')); |
1880 | 2024 | $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : |
1881 | 2025 | common::get_referer('/index.php?menuaction=infolog.infolog_ui.index')); |
1882 | - if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer |
|
2026 | + if (strpos($referer, 'msg=') !== false) |
|
2027 | + { |
|
2028 | + $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); |
|
2029 | + } |
|
2030 | + // remove previou/old msg from referer |
|
1883 | 2031 | $no_popup = $_GET['no_popup']; |
1884 | 2032 | $print = (int) $_REQUEST['print']; |
1885 | 2033 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
1886 | 2034 | |
1887 | 2035 | $content = $this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id ); |
1888 | - if (!(strpos($content['info_addr'],',')===false) && strpos($content['info_addr'],', ')===false) $content['info_addr'] = str_replace(',',', ',$content['info_addr']); |
|
2036 | + if (!(strpos($content['info_addr'],',')===false) && strpos($content['info_addr'],', ')===false) |
|
2037 | + { |
|
2038 | + $content['info_addr'] = str_replace(',',', ',$content['info_addr']); |
|
2039 | + } |
|
1889 | 2040 | foreach(array('info_subject', 'info_des') as $key) |
1890 | 2041 | { |
1891 | 2042 | if(!isset($content[$key]) || strlen($content[$key]) < 75) |
@@ -1909,10 +2060,16 @@ discard block |
||
1909 | 2060 | if (strlen($word)>75) |
1910 | 2061 | { |
1911 | 2062 | $buff = html::activate_links($word); |
1912 | - if (strlen($buff) == strlen($word)) // no links -> try to break overlong words |
|
2063 | + if (strlen($buff) == strlen($word)) |
|
2064 | + { |
|
2065 | + // no links -> try to break overlong words |
|
1913 | 2066 | { |
1914 | 2067 | if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word); |
1915 | - if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word); |
|
2068 | + } |
|
2069 | + if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) |
|
2070 | + { |
|
2071 | + $word = str_replace('.','. ',$word); |
|
2072 | + } |
|
1916 | 2073 | $word = wordwrap($word, 75, ' ', true); |
1917 | 2074 | } |
1918 | 2075 | } |
@@ -1933,7 +2090,11 @@ discard block |
||
1933 | 2090 | { |
1934 | 2091 | $content['info_cat'] = $this->prefs['cat_add_default']; |
1935 | 2092 | } |
1936 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
2093 | + if ($_GET['msg']) |
|
2094 | + { |
|
2095 | + $content['msg'] = strip_tags($_GET['msg']); |
|
2096 | + } |
|
2097 | + // dont allow HTML! |
|
1937 | 2098 | |
1938 | 2099 | switch($this->prefs['set_start']) |
1939 | 2100 | { |
@@ -1944,13 +2105,19 @@ discard block |
||
1944 | 2105 | if ((int)$content['info_link_id'] > 0 && !egw_link::get_link($content['info_link_id'])) |
1945 | 2106 | { |
1946 | 2107 | $content['info_link_id'] = 0; // link has been deleted |
1947 | - if (!$content['info_custom_link']) $content['info_from'] = ''; |
|
2108 | + if (!$content['info_custom_link']) |
|
2109 | + { |
|
2110 | + $content['info_from'] = ''; |
|
2111 | + } |
|
1948 | 2112 | } |
1949 | - if (!$info_id && $action_id && $action == 'sp') // new SubProject |
|
2113 | + if (!$info_id && $action_id && $action == 'sp') |
|
2114 | + { |
|
2115 | + // new SubProject |
|
1950 | 2116 | { |
1951 | 2117 | if (!$this->bo->check_access($action_id,EGW_ACL_ADD)) |
1952 | 2118 | { |
1953 | 2119 | return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); |
2120 | + } |
|
1954 | 2121 | } |
1955 | 2122 | } |
1956 | 2123 | else |
@@ -1984,10 +2151,16 @@ discard block |
||
1984 | 2151 | case 'copy': |
1985 | 2152 | $info_id = 0; |
1986 | 2153 | $this->create_copy($content, $action == 'sp'); |
1987 | - if ($action == 'sp') // for sub-entries use type or category, like for new entries |
|
2154 | + if ($action == 'sp') |
|
2155 | + { |
|
2156 | + // for sub-entries use type or category, like for new entries |
|
1988 | 2157 | { |
1989 | 2158 | if ($type) $content['info_type'] = $type; |
1990 | - if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
2159 | + } |
|
2160 | + if (is_numeric($_REQUEST['cat_id'])) |
|
2161 | + { |
|
2162 | + $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
2163 | + } |
|
1991 | 2164 | } |
1992 | 2165 | unset($action); // it get stored in $content and will cause an other copy after [apply] |
1993 | 2166 | break; |
@@ -2016,7 +2189,10 @@ discard block |
||
2016 | 2189 | { |
2017 | 2190 | foreach((array)$set['link_app'] as $i => $l_app) |
2018 | 2191 | { |
2019 | - if (($l_id=$set['link_id'][$i])) egw_link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
2192 | + if (($l_id=$set['link_id'][$i])) |
|
2193 | + { |
|
2194 | + egw_link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
2195 | + } |
|
2020 | 2196 | } |
2021 | 2197 | unset($set['link_app']); |
2022 | 2198 | unset($set['link_id']); |
@@ -2035,8 +2211,15 @@ discard block |
||
2035 | 2211 | break; // normal edit |
2036 | 2212 | } |
2037 | 2213 | case 'new': // new entry, set some defaults, if not set by infolog_set hook |
2038 | - if (empty($content['info_startdate'])) $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
2039 | - if (empty($content['info_priority'])) $content['info_priority'] = 1; // normal |
|
2214 | + if (empty($content['info_startdate'])) |
|
2215 | + { |
|
2216 | + $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
2217 | + } |
|
2218 | + if (empty($content['info_priority'])) |
|
2219 | + { |
|
2220 | + $content['info_priority'] = 1; |
|
2221 | + } |
|
2222 | + // normal |
|
2040 | 2223 | $content['info_owner'] = $this->user; |
2041 | 2224 | if ($type != '' && empty($content['info_type'])) |
2042 | 2225 | { |
@@ -2046,8 +2229,14 @@ discard block |
||
2046 | 2229 | { |
2047 | 2230 | $content['info_type'] = $GLOBALS['egw_info']['user']['preferences']['infolog']['preferred_type']; |
2048 | 2231 | } |
2049 | - if (empty($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2050 | - if (empty($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2232 | + if (empty($content['info_status'])) |
|
2233 | + { |
|
2234 | + $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2235 | + } |
|
2236 | + if (empty($content['info_percent'])) |
|
2237 | + { |
|
2238 | + $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2239 | + } |
|
2051 | 2240 | break; |
2052 | 2241 | } |
2053 | 2242 | if (!isset($this->bo->enums['type'][$content['info_type']])) |
@@ -2150,12 +2339,18 @@ discard block |
||
2150 | 2339 | |
2151 | 2340 | $content['duration_format'] = $this->duration_format; |
2152 | 2341 | $content['hours_per_workday'] = $this->hours_per_workday; |
2153 | - if ($this->prefs['show_id']) $content['info_number'] = $info_id; |
|
2342 | + if ($this->prefs['show_id']) |
|
2343 | + { |
|
2344 | + $content['info_number'] = $info_id; |
|
2345 | + } |
|
2154 | 2346 | |
2155 | 2347 | $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
2156 | 2348 | |
2157 | 2349 | $old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id']; |
2158 | - if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id; |
|
2350 | + if (!isset($content['pm_id']) && $old_pm_id) |
|
2351 | + { |
|
2352 | + $content['pm_id'] = $old_pm_id; |
|
2353 | + } |
|
2159 | 2354 | |
2160 | 2355 | if ($info_id && $this->bo->history) |
2161 | 2356 | { |
@@ -2225,7 +2420,10 @@ discard block |
||
2225 | 2420 | //$content['info_des'] = substr($content['info_des'],0,1793); |
2226 | 2421 | //echo "<p>infolog_ui.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); |
2227 | 2422 | //$content['info_cc'] is expected (by the widget) to be an array of emailaddresses, but is stored as comma separated string |
2228 | - if (!empty($content['info_cc'])&&!is_array($content['info_cc']))$content['info_cc'] = explode(',',$content['info_cc']); |
|
2423 | + if (!empty($content['info_cc'])&&!is_array($content['info_cc'])) |
|
2424 | + { |
|
2425 | + $content['info_cc'] = explode(',',$content['info_cc']); |
|
2426 | + } |
|
2229 | 2427 | $this->tmpl->exec('infolog.infolog_ui.edit',$content,$sel_options,$readonlys,$preserv+array( // preserved values |
2230 | 2428 | 'info_id' => $info_id, |
2231 | 2429 | 'action' => $action, |
@@ -2253,7 +2451,11 @@ discard block |
||
2253 | 2451 | foreach ($exclude_fields as $field) |
2254 | 2452 | { |
2255 | 2453 | unset($content[$field]); |
2256 | - if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
2454 | + if ($field == 'info_from') |
|
2455 | + { |
|
2456 | + unset($content['info_link_id']); |
|
2457 | + } |
|
2458 | + // both together is called contact in UI |
|
2257 | 2459 | } |
2258 | 2460 | if ($create_sub) |
2259 | 2461 | { |
@@ -2281,13 +2483,25 @@ discard block |
||
2281 | 2483 | $content['info_type'] = $types[0]; |
2282 | 2484 | } |
2283 | 2485 | // get a consistent status, percent and date-completed |
2284 | - if (!isset($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2285 | - if (!isset($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2486 | + if (!isset($content['info_status'])) |
|
2487 | + { |
|
2488 | + $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2489 | + } |
|
2490 | + if (!isset($content['info_percent'])) |
|
2491 | + { |
|
2492 | + $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2493 | + } |
|
2286 | 2494 | $content['info_datecompleted'] =$content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
2287 | 2495 | |
2288 | - if (!isset($content['info_cat'])) $content['info_cat'] = $this->prefs['cat_add_default']; |
|
2496 | + if (!isset($content['info_cat'])) |
|
2497 | + { |
|
2498 | + $content['info_cat'] = $this->prefs['cat_add_default']; |
|
2499 | + } |
|
2289 | 2500 | |
2290 | - if(!is_array($content['link_to'])) $content['link_to'] = array(); |
|
2501 | + if(!is_array($content['link_to'])) |
|
2502 | + { |
|
2503 | + $content['link_to'] = array(); |
|
2504 | + } |
|
2291 | 2505 | $content['link_to']['to_app'] = 'infolog'; |
2292 | 2506 | $content['link_to']['to_id'] = 0; |
2293 | 2507 | // Get links to be copied, if not excluded |
@@ -2318,7 +2532,10 @@ discard block |
||
2318 | 2532 | { |
2319 | 2533 | $linkinfos = egw_link::get_link($info_link_id); |
2320 | 2534 | $content['info_contact'] = $linkinfos['link_app1']=='infolog'? $linkinfos['link_app2'].':'.$linkinfos['link_id2']:$linkinfos['link_app1'].':'.$linkinfos['link_id1']; |
2321 | - if (stripos($content['info_contact'],'projectmanager')!==false) $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2']; |
|
2535 | + if (stripos($content['info_contact'],'projectmanager')!==false) |
|
2536 | + { |
|
2537 | + $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2']; |
|
2538 | + } |
|
2322 | 2539 | } |
2323 | 2540 | unset($content['info_link_id']); |
2324 | 2541 | } |
@@ -2646,7 +2863,10 @@ discard block |
||
2646 | 2863 | } |
2647 | 2864 | foreach($this->bo->customfields as $name => $data) |
2648 | 2865 | { |
2649 | - if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) continue; |
|
2866 | + if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) |
|
2867 | + { |
|
2868 | + continue; |
|
2869 | + } |
|
2650 | 2870 | |
2651 | 2871 | $fields['#'.$name] = array( |
2652 | 2872 | 'label' => $data['label'], |
@@ -48,32 +48,32 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @var string |
50 | 50 | */ |
51 | - var $duration_format = ','; // comma is necessary! |
|
51 | + var $duration_format = ','; // comma is necessary! |
|
52 | 52 | |
53 | 53 | var $icons = array( |
54 | 54 | 'type' => array( |
55 | - 'task' => 'task.gif', 'task_alt' => 'Task', |
|
56 | - 'phone' => 'phone.gif', 'phone_alt' => 'Phonecall', |
|
57 | - 'note' => 'note.gif', 'note_alt' => 'Note', |
|
58 | - 'confirm' => 'confirm.gif', 'confirm_alt' => 'Confirmation', |
|
59 | - 'reject' => 'reject.gif', 'reject_alt' => 'Reject', |
|
60 | - 'email' => 'email.gif', 'email_alt' => 'Email' ), |
|
55 | + 'task' => 'task.gif', 'task_alt' => 'Task', |
|
56 | + 'phone' => 'phone.gif', 'phone_alt' => 'Phonecall', |
|
57 | + 'note' => 'note.gif', 'note_alt' => 'Note', |
|
58 | + 'confirm' => 'confirm.gif', 'confirm_alt' => 'Confirmation', |
|
59 | + 'reject' => 'reject.gif', 'reject_alt' => 'Reject', |
|
60 | + 'email' => 'email.gif', 'email_alt' => 'Email' ), |
|
61 | 61 | 'action' => array( |
62 | - 'new' => 'new.gif', 'new_alt' => 'Add Sub', |
|
63 | - 'view' => 'view.gif', 'view_alt' => 'View Subs', |
|
64 | - 'parent' => 'parent.gif', 'parent_alt' => 'View other Subs', |
|
65 | - 'edit' => 'edit.gif', 'edit_alt' => 'Edit', |
|
66 | - 'addfile' => 'addfile.gif', 'addfile_alt' => 'Add a file', |
|
67 | - 'delete' => 'delete.gif', 'delete_alt' => 'Delete', |
|
68 | - 'close' => 'done.gif', 'close_alt' => 'Close' , |
|
69 | - 'close_all' => 'done_all.gif', 'close_all_alt' => 'Close' ), |
|
62 | + 'new' => 'new.gif', 'new_alt' => 'Add Sub', |
|
63 | + 'view' => 'view.gif', 'view_alt' => 'View Subs', |
|
64 | + 'parent' => 'parent.gif', 'parent_alt' => 'View other Subs', |
|
65 | + 'edit' => 'edit.gif', 'edit_alt' => 'Edit', |
|
66 | + 'addfile' => 'addfile.gif', 'addfile_alt' => 'Add a file', |
|
67 | + 'delete' => 'delete.gif', 'delete_alt' => 'Delete', |
|
68 | + 'close' => 'done.gif', 'close_alt' => 'Close', |
|
69 | + 'close_all' => 'done_all.gif', 'close_all_alt' => 'Close' ), |
|
70 | 70 | 'status' => array( |
71 | - 'billed' => 'billed.gif', 'billed_alt' => 'billed', |
|
72 | - 'done' => 'done.gif', 'done_alt' => 'done', |
|
71 | + 'billed' => 'billed.gif', 'billed_alt' => 'billed', |
|
72 | + 'done' => 'done.gif', 'done_alt' => 'done', |
|
73 | 73 | 'will-call' => 'will-call.gif', 'will-call_alt' => 'will-call', |
74 | - 'call' => 'call.gif', 'call_alt' => 'call', |
|
75 | - 'ongoing' => 'ongoing.gif', 'ongoing_alt' => 'ongoing', |
|
76 | - 'offer' => 'offer.gif', 'offer_alt' => 'offer' ) |
|
74 | + 'call' => 'call.gif', 'call_alt' => 'call', |
|
75 | + 'ongoing' => 'ongoing.gif', 'ongoing_alt' => 'ongoing', |
|
76 | + 'offer' => 'offer.gif', 'offer_alt' => 'offer' ) |
|
77 | 77 | ); |
78 | 78 | var $filters; |
79 | 79 | var $messages = array( |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') translation::add_app('infolog'); |
94 | 94 | |
95 | 95 | // Make sure Global category is infolog - on first load, it may not be |
96 | - if($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
|
96 | + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
|
97 | 97 | { |
98 | 98 | $GLOBALS['egw']->categories = new categories(); |
99 | 99 | } |
@@ -104,18 +104,18 @@ discard block |
||
104 | 104 | |
105 | 105 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
106 | 106 | |
107 | - $this->prefs =& $GLOBALS['egw_info']['user']['preferences']['infolog']; |
|
107 | + $this->prefs = & $GLOBALS['egw_info']['user']['preferences']['infolog']; |
|
108 | 108 | |
109 | 109 | // read the duration format from project-manager |
110 | 110 | if ($GLOBALS['egw_info']['apps']['projectmanager']) |
111 | 111 | { |
112 | 112 | $pm_config = config::read('projectmanager'); |
113 | - $this->duration_format = str_replace(',','',implode('', (array)$pm_config['duration_units'])); |
|
113 | + $this->duration_format = str_replace(',', '', implode('', (array)$pm_config['duration_units'])); |
|
114 | 114 | //error_log(__METHOD__."() ".__LINE__." duration_format=$this->duration_format, duration_unit=".array2string($pm_config['duration_units'])); |
115 | 115 | $this->hours_per_workday = $pm_config['hours_per_workday']; |
116 | 116 | unset($pm_config); |
117 | 117 | } |
118 | - $this->filters =& $this->bo->filters; |
|
118 | + $this->filters = & $this->bo->filters; |
|
119 | 119 | /* these are just for testing of the notifications |
120 | 120 | for($i = -1; $i <= 3; ++$i) |
121 | 121 | { |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | $this->filters['responsible-open-date'.date('Y-m-d',time()+$i*24*60*60)] = "responsible starting in $i day(s)"; |
135 | 135 | } |
136 | 136 | */ |
137 | - $GLOBALS['infolog_ui'] =& $this; // make ourself availible for ExecMethod of get_rows function |
|
137 | + $GLOBALS['infolog_ui'] = & $this; // make ourself availible for ExecMethod of get_rows function |
|
138 | 138 | |
139 | 139 | // can be removed for next release / infolog update |
140 | - if (!$GLOBALS['egw']->hooks->hook_exists('calendar_set','infolog')) |
|
140 | + if (!$GLOBALS['egw']->hooks->hook_exists('calendar_set', 'infolog')) |
|
141 | 141 | { |
142 | - $GLOBALS['egw']->hooks->register_single_app_hook('infolog','calendar_set'); |
|
142 | + $GLOBALS['egw']->hooks->register_single_app_hook('infolog', 'calendar_set'); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param int $details |
155 | 155 | * @return array |
156 | 156 | */ |
157 | - function get_info($info,&$readonlys,$action='',$action_id='',$show_links=false,$details = 1) |
|
157 | + function get_info($info, &$readonlys, $action = '', $action_id = '', $show_links = false, $details = 1) |
|
158 | 158 | { |
159 | 159 | if (!is_array($info)) |
160 | 160 | { |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | $done = $info['info_status'] == 'done' || $info['info_status'] == 'billed' || $info['info_status'] == 'cancelled'; //cancelled is regarded as a completed status as well in bo |
165 | 165 | // regard an infolog as done/billed/cancelled if its percentage is 100% when there is to status like the above for that type |
166 | 166 | if (!$done && !isset($this->bo->status[$info['info_type']]['done']) && !isset($this->bo->status[$info['info_type']]['billed']) && |
167 | - !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) $done = true ; |
|
168 | - $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']] . ($done ? '_done' : ''); |
|
167 | + !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent'] == 100) $done = true; |
|
168 | + $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']].($done ? '_done' : ''); |
|
169 | 169 | if (!$done && $info['info_enddate'] < $this->bo->user_time_now) |
170 | 170 | { |
171 | 171 | $info['end_class'] = 'infolog_overdue'; |
172 | 172 | } |
173 | 173 | if (!isset($info['info_anz_subs'])) $info['info_anz_subs'] = $this->bo->anzSubs($id); |
174 | - $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id |
|
175 | - $info['info_percent'] = (int) $info['info_percent'].'%'; |
|
176 | - $editrights = $this->bo->check_access($info,EGW_ACL_EDIT); |
|
174 | + $this->bo->link_id2from($info, $action, $action_id); // unset from for $action:$action_id |
|
175 | + $info['info_percent'] = (int)$info['info_percent'].'%'; |
|
176 | + $editrights = $this->bo->check_access($info, EGW_ACL_EDIT); |
|
177 | 177 | $isresposible = $this->bo->is_responsible($info); |
178 | 178 | if ((!($editrights || // edit rights or more then standard responsible rights |
179 | - $isresposible && array_diff($this->bo->responsible_edit,array('info_status','info_percent','info_datecompleted'))))) |
|
179 | + $isresposible && array_diff($this->bo->responsible_edit, array('info_status', 'info_percent', 'info_datecompleted'))))) |
|
180 | 180 | { |
181 | 181 | $info['class'] .= 'rowNoEdit '; |
182 | 182 | } |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | { |
196 | 196 | $info['class'] .= 'rowNoCloseAll '; |
197 | 197 | } |
198 | - if (!$this->bo->check_access($info,EGW_ACL_DELETE)) |
|
198 | + if (!$this->bo->check_access($info, EGW_ACL_DELETE)) |
|
199 | 199 | { |
200 | 200 | $info['class'] .= 'rowNoDelete '; |
201 | 201 | } |
202 | - if (!$this->bo->check_access($info,EGW_ACL_ADD)) |
|
202 | + if (!$this->bo->check_access($info, EGW_ACL_ADD)) |
|
203 | 203 | { |
204 | 204 | $info['class'] .= 'rowNoSubs '; |
205 | 205 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if (!$show_links) $show_links = $this->prefs['show_links']; |
212 | 212 | if (($show_links != 'none' && $show_links != 'no_describtion' || |
213 | 213 | $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) && |
214 | - (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true)))) |
|
214 | + (isset($info['links']) || ($info['links'] = egw_link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true, true)))) |
|
215 | 215 | { |
216 | 216 | $timesheets = array(); |
217 | 217 | foreach ($info['links'] as $link) |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $link_mod = egw_time::server2user($link['lastmod']); |
221 | 221 | if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod; |
222 | 222 | |
223 | - if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
223 | + if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
224 | 224 | |
225 | 225 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
226 | 226 | $link['link_id'] != $info['info_link_id'] && |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | if ($this->prefs['show_times'] && isset($GLOBALS['egw_info']['user']['apps']['timesheet']) && $timesheets) |
239 | 239 | { |
240 | - $sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets); |
|
240 | + $sum = ExecMethod('timesheet.timesheet_bo.sum', $timesheets); |
|
241 | 241 | $info['info_sum_timesheets'] = $sum['duration']; |
242 | 242 | // incl. max timesheet modification in row_mod |
243 | 243 | if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified']; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | $readonlys["edit_percent[$id]"] = true; |
257 | 257 | } |
258 | - elseif($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
258 | + elseif ($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
259 | 259 | { |
260 | 260 | $info['info_percent2'] = $info['info_percent']; |
261 | 261 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | protected static function filter(array $query) |
277 | 277 | { |
278 | 278 | $filter = $query['filter'] ? 'filter' : ($query['cat_id'] ? 'cat_id' : null); |
279 | - foreach((array)$query['col_filter'] as $name => $value) |
|
279 | + foreach ((array)$query['col_filter'] as $name => $value) |
|
280 | 280 | { |
281 | 281 | if ((string)$value !== '') |
282 | 282 | { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param array &$readonlys |
297 | 297 | * @return int |
298 | 298 | */ |
299 | - function get_rows(&$query,&$rows,&$readonlys) |
|
299 | + function get_rows(&$query, &$rows, &$readonlys) |
|
300 | 300 | { |
301 | 301 | //error_log(__METHOD__."() query[csv_export]=".array2string($query['csv_export']).", query[filter]=".array2string($query['filter']).", query[col_filter]=".array2string(array_diff($query['col_filter'],array('',0))).' '.function_backtrace()); |
302 | 302 | if (!$query['csv_export']) |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | //error_log(__METHOD__."() prefs[listNoSubs]=".array2string($this->prefs['listNoSubs'])." --> parent_id=$parent_id"); |
315 | 315 | unset($query['col_filter']['parent_id']); |
316 | - if(!$query['action']) |
|
316 | + if (!$query['action']) |
|
317 | 317 | { |
318 | 318 | egw_cache::setSession('infolog', $query['session_for'].'session_data', $query); |
319 | 319 | } |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | $query['row_modified'] = 'row_mod'; |
323 | 323 | $query['parent_id'] = 'info_id_parent'; |
324 | 324 | $query['is_parent'] = 'info_anz_subs'; |
325 | - $query['action_var'] = 'multi_action'; // as 'action' is already used in infolog |
|
325 | + $query['action_var'] = 'multi_action'; // as 'action' is already used in infolog |
|
326 | 326 | } |
327 | 327 | // nextmatch opened an infolog containing children --> do not filter them, always show all children |
328 | - elseif($query['csv_export'] === 'children') |
|
328 | + elseif ($query['csv_export'] === 'children') |
|
329 | 329 | { |
330 | 330 | $query['filter'] = $query['search'] = $query['cat_id'] = ''; |
331 | 331 | $query['col_filter'] = array('info_id_parent' => $query['col_filter']['info_id_parent']); |
@@ -345,17 +345,17 @@ discard block |
||
345 | 345 | $links['linked'] = array(); |
346 | 346 | unset($query['col_filter']['linked']); |
347 | 347 | } |
348 | - if($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id']) |
|
348 | + if ($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id']) |
|
349 | 349 | { |
350 | 350 | $link_filters['action'] = array('app'=>$query['action'], 'id' => $query['action_id']); |
351 | 351 | $links['action'] = array(); |
352 | 352 | } |
353 | - foreach($link_filters as $key => $link) |
|
353 | + foreach ($link_filters as $key => $link) |
|
354 | 354 | { |
355 | - if(!is_array($link)) |
|
355 | + if (!is_array($link)) |
|
356 | 356 | { |
357 | 357 | // Legacy string style |
358 | - list($app,$id) = explode(':',$link); |
|
358 | + list($app, $id) = explode(':', $link); |
|
359 | 359 | } |
360 | 360 | else |
361 | 361 | { |
@@ -363,25 +363,25 @@ discard block |
||
363 | 363 | $app = $link['app']; |
364 | 364 | $id = $link['id']; |
365 | 365 | } |
366 | - if(!is_array($id)) $id = explode(',',$id); |
|
367 | - if (!($linked = egw_link::get_links_multiple($app,$id,true,'infolog','',$query['col_filter']['info_status'] == 'deleted'))) |
|
366 | + if (!is_array($id)) $id = explode(',', $id); |
|
367 | + if (!($linked = egw_link::get_links_multiple($app, $id, true, 'infolog', '', $query['col_filter']['info_status'] == 'deleted'))) |
|
368 | 368 | { |
369 | - $rows = array(); // no infologs linked to selected link --> no rows to return |
|
369 | + $rows = array(); // no infologs linked to selected link --> no rows to return |
|
370 | 370 | return 0; |
371 | 371 | } |
372 | 372 | |
373 | 373 | |
374 | - foreach($linked as $infos) |
|
374 | + foreach ($linked as $infos) |
|
375 | 375 | { |
376 | - $links[$key] = array_merge($links[$key],$infos); |
|
376 | + $links[$key] = array_merge($links[$key], $infos); |
|
377 | 377 | } |
378 | 378 | $links[$key] = array_unique($links[$key]); |
379 | - if($key == 'linked') |
|
379 | + if ($key == 'linked') |
|
380 | 380 | { |
381 | 381 | $linked = array('app' => $app, 'id' => $id, 'title' => (count($id) == 1 ? egw_link::title($app, $id) : lang('multiple'))); |
382 | 382 | } |
383 | 383 | } |
384 | - if(count($links)) |
|
384 | + if (count($links)) |
|
385 | 385 | { |
386 | 386 | $query['col_filter']['info_id'] = count($links) > 1 ? call_user_func_array('array_intersect', $links) : $links[$key]; |
387 | 387 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $old_template = $query['template']; |
391 | 391 | |
392 | 392 | // Reset custom, type-specific template if type was cleared (without changing it for home) |
393 | - if(!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0) |
|
393 | + if (!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0) |
|
394 | 394 | { |
395 | 395 | $query['template'] = 'infolog.index.rows'; |
396 | 396 | } |
@@ -401,10 +401,10 @@ discard block |
||
401 | 401 | if ($tpl->read('infolog.index.rows.'.$query['col_filter']['info_type'])) |
402 | 402 | { |
403 | 403 | $query['template'] = $tpl->name; |
404 | - $query['custom_fields'] = true; // read the custom fields too |
|
404 | + $query['custom_fields'] = true; // read the custom fields too |
|
405 | 405 | } |
406 | 406 | // If status is not valid for selected type, clear status filter |
407 | - if($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' && |
|
407 | + if ($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' && |
|
408 | 408 | !in_array($query['col_filter']['info_status'], array_keys($this->bo->status[$query['col_filter']['info_type']]))) |
409 | 409 | { |
410 | 410 | $query['col_filter']['info_status'] = ''; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } |
413 | 413 | } |
414 | 414 | // Template change forces the UI to do a full update first, no point in getting rows right now |
415 | - if($old_template && $old_template != $query['template']) return 0; |
|
415 | + if ($old_template && $old_template != $query['template']) return 0; |
|
416 | 416 | |
417 | 417 | // do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific |
418 | 418 | // so we have to check that as well |
@@ -425,14 +425,14 @@ discard block |
||
425 | 425 | |
426 | 426 | if (!$query['selectcols'] && $columselection) |
427 | 427 | { |
428 | - $columselection = is_array($columselection) ? $columselection : explode(',',$columselection); |
|
428 | + $columselection = is_array($columselection) ? $columselection : explode(',', $columselection); |
|
429 | 429 | } |
430 | 430 | else |
431 | 431 | { |
432 | - $columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',',$query['selectcols'])) : array(); |
|
432 | + $columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',', $query['selectcols'])) : array(); |
|
433 | 433 | } |
434 | 434 | // do we need to query the cf's |
435 | - $query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields',$columselection)); |
|
435 | + $query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields', $columselection)); |
|
436 | 436 | |
437 | 437 | $infos = $this->bo->search($query); |
438 | 438 | $query['col_filter'] = $orginal_colfilter; |
@@ -450,12 +450,12 @@ discard block |
||
450 | 450 | $query['default_cols'] = '!cat_id,info_datemodified,info_used_time_info_planned_time,info_used_time_info_planned_time_info_replanned_time,info_id'; |
451 | 451 | } |
452 | 452 | // set old show_times pref, that get_info calculates the cumulated time of the timesheets (we only check used&planned to work for both time cols) |
453 | - $this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']],'info_used_time_info_planned_time') !== false; |
|
453 | + $this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']], 'info_used_time_info_planned_time') !== false; |
|
454 | 454 | |
455 | 455 | // query all links and sub counts in one go |
456 | 456 | if ($infos && (!$query['csv_export'] || !is_array($query['csv_export']))) |
457 | 457 | { |
458 | - $links = egw_link::get_links_multiple('infolog',array_keys($infos),true,'','link_lastmod DESC',true); // true=incl. deleted |
|
458 | + $links = egw_link::get_links_multiple('infolog', array_keys($infos), true, '', 'link_lastmod DESC', true); // true=incl. deleted |
|
459 | 459 | $anzSubs = $this->bo->anzSubs(array_keys($infos)); |
460 | 460 | } |
461 | 461 | $rows = array(); |
@@ -466,27 +466,27 @@ discard block |
||
466 | 466 | $parents = $query['action'] == 'sp' && $query['action_id'] ? (array)$query['action_id'] : array(); |
467 | 467 | if (count($parents) == 1 && is_array($query['action_id'])) |
468 | 468 | { |
469 | - $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header |
|
469 | + $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | 473 | $parent_first = count($parents) == 1; |
474 | 474 | $parent_index = 0; |
475 | 475 | // et2 nextmatch listens to total, and only displays that many rows, so add parent in or we'll lose the last row |
476 | - if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
476 | + if ($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
477 | 477 | |
478 | 478 | // Check to see if we need to remove description |
479 | - foreach($infos as $id => $info) |
|
479 | + foreach ($infos as $id => $info) |
|
480 | 480 | { |
481 | - if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) $info['info_addr'] = str_replace(',',', ',$info['info_addr']); |
|
481 | + if (!(strpos($info['info_addr'], ',') === false) && strpos($info['info_addr'], ', ') === false) $info['info_addr'] = str_replace(',', ', ', $info['info_addr']); |
|
482 | 482 | if (!$query['csv_export'] || !is_array($query['csv_export'])) |
483 | 483 | { |
484 | - $info['links'] =& $links[$id]; |
|
484 | + $info['links'] = & $links[$id]; |
|
485 | 485 | $info['info_anz_subs'] = (int)$anzSubs[$id]; |
486 | - $info = $this->get_info($info,$readonlys,null,null,false,$details); |
|
486 | + $info = $this->get_info($info, $readonlys, null, null, false, $details); |
|
487 | 487 | } |
488 | 488 | // for subs view ('sp') add parent(s) in front of subs once(!) |
489 | - if ( $parent_first && ($main = $this->bo->read($query['action_id'])) || |
|
489 | + if ($parent_first && ($main = $this->bo->read($query['action_id'])) || |
|
490 | 490 | $parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false && |
491 | 491 | ($main = $this->bo->read($info['info_id_parent']))) |
492 | 492 | { |
@@ -496,11 +496,11 @@ discard block |
||
496 | 496 | // as read() always read them all, while search() only reads the selected ones |
497 | 497 | if ($query['custom_fields']) |
498 | 498 | { |
499 | - foreach($columselection as $col) |
|
499 | + foreach ($columselection as $col) |
|
500 | 500 | { |
501 | 501 | if ($col[0] == '#') |
502 | 502 | { |
503 | - foreach(array_keys($main) as $n) |
|
503 | + foreach (array_keys($main) as $n) |
|
504 | 504 | { |
505 | 505 | if ($n[0] == '#' && !in_array($n, $columselection)) unset($main[$n]); |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | } |
511 | 511 | $parent_first = false; |
512 | - if($query['start'] == 0) |
|
512 | + if ($query['start'] == 0) |
|
513 | 513 | { |
514 | 514 | array_splice($rows, $id, 0, array($main)); |
515 | 515 | unset($parents[$parent_index]); |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | if ($query['cat_id']) $rows['no_cat_id'] = true; |
523 | 523 | if ($query['no_actions']) $rows['no_actions'] = true; |
524 | 524 | $rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']); |
525 | - if($clear_status_filter) |
|
525 | + if ($clear_status_filter) |
|
526 | 526 | { |
527 | 527 | $rows['info_status'] = ''; |
528 | 528 | } |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang($this->filters[$query['filter']]); |
555 | 555 | } |
556 | 556 | if ($query['action'] && ($title = $query['action_title'] || is_array($query['action_id']) ? |
557 | - $query['action_title'] : egw_link::title($query['action']=='sp'?'infolog':$query['action'],$query['action_id']))) |
|
557 | + $query['action_title'] : egw_link::title($query['action'] == 'sp' ? 'infolog' : $query['action'], $query['action_id']))) |
|
558 | 558 | { |
559 | 559 | $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$title; |
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
563 | - if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
563 | + if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
564 | 564 | |
565 | 565 | return $query['total']; |
566 | 566 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | { |
580 | 580 | if ($info['info_cat']) $set['cat_id'] = $info['info_cat']; |
581 | 581 | |
582 | - foreach(egw_link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true) as $link) |
|
582 | + foreach (egw_link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true) as $link) |
|
583 | 583 | { |
584 | 584 | if ($link['app'] != 'timesheet' && $link['app'] != egw_link::VFS_APPNAME) |
585 | 585 | { |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | { |
605 | 605 | return $data; |
606 | 606 | } |
607 | - $event = array_merge($data,array( |
|
607 | + $event = array_merge($data, array( |
|
608 | 608 | 'category' => $GLOBALS['egw']->categories->check_list(EGW_ACL_READ, $infolog['info_cat']), |
609 | 609 | 'priority' => $infolog['info_priority'] + 1, |
610 | 610 | 'public' => $infolog['info_access'] != 'private', |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | 'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted'] |
616 | 616 | )); |
617 | 617 | unset($event['entry_id']); |
618 | - if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
618 | + if (!$event['end']) $event['end'] = $event['start'] + (int)$GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60; |
|
619 | 619 | |
620 | 620 | // Match categories by name |
621 | 621 | $event['category'] = $GLOBALS['egw']->categories->name2id(categories::id2name($infolog['info_cat'])); |
@@ -624,38 +624,38 @@ discard block |
||
624 | 624 | $event['owner'] = $user = $GLOBALS['egw_info']['user']['account_id']; |
625 | 625 | |
626 | 626 | // add/modify participants according to prefs |
627 | - $prefs = explode(',',$this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user'); |
|
627 | + $prefs = explode(',', $this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user'); |
|
628 | 628 | |
629 | 629 | // if no default participants (selected calendars) --> remove all |
630 | - if (!in_array('selected',$prefs)) |
|
630 | + if (!in_array('selected', $prefs)) |
|
631 | 631 | { |
632 | 632 | $event['participants'] = $event['participant_types'] = array(); |
633 | 633 | } |
634 | 634 | // Add responsible as participant |
635 | - if (in_array('responsible',$prefs)) |
|
635 | + if (in_array('responsible', $prefs)) |
|
636 | 636 | { |
637 | - foreach($infolog['info_responsible'] as $responsible) |
|
637 | + foreach ($infolog['info_responsible'] as $responsible) |
|
638 | 638 | { |
639 | 639 | $event['participants'][$responsible] = $event['participant_types']['u'][$responsible] = |
640 | - calendar_so::combine_status($user==$responsible?'A':'U'); |
|
640 | + calendar_so::combine_status($user == $responsible ? 'A' : 'U'); |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | // Add linked contact as participant |
644 | - if (in_array('contact',$prefs) && $infolog['info_link']['app'] == 'addressbook') |
|
644 | + if (in_array('contact', $prefs) && $infolog['info_link']['app'] == 'addressbook') |
|
645 | 645 | { |
646 | - $event['participants'][calendar_so::combine_user('c',$infolog['info_link']['id'])] = |
|
646 | + $event['participants'][calendar_so::combine_user('c', $infolog['info_link']['id'])] = |
|
647 | 647 | $event['participant_types']['c'][$infolog['info_link']['id']] = calendar_so::combine_status('U'); |
648 | 648 | } |
649 | - if (in_array('owner',$prefs)) |
|
649 | + if (in_array('owner', $prefs)) |
|
650 | 650 | { |
651 | 651 | $event['participants'][$infolog['info_owner']] = $event['participant_types']['u'][$infolog['info_owner']] = |
652 | - calendar_so::combine_status('A',1,'CHAIR'); |
|
652 | + calendar_so::combine_status('A', 1, 'CHAIR'); |
|
653 | 653 | } |
654 | 654 | // Add current user, if set or no other participants, which is not allowed |
655 | - if (in_array('user',$prefs)) |
|
655 | + if (in_array('user', $prefs)) |
|
656 | 656 | { |
657 | 657 | $event['participants'][$user] = $event['participant_types']['u'][$user] = |
658 | - calendar_so::combine_status('A',1,'CHAIR'); |
|
658 | + calendar_so::combine_status('A', 1, 'CHAIR'); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | // Add infolog link to calendar entry |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | $event['link_id'][] = $infolog['info_link']['id']; |
664 | 664 | |
665 | 665 | // Copy infolog's links |
666 | - foreach(egw_link::get_links('infolog',$infolog['info_id'],'','link_lastmod DESC',true) as $link) |
|
666 | + foreach (egw_link::get_links('infolog', $infolog['info_id'], '', 'link_lastmod DESC', true) as $link) |
|
667 | 667 | { |
668 | 668 | if ($link['app'] != egw_link::VFS_APPNAME) |
669 | 669 | { |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | } |
673 | 673 | } |
674 | 674 | // Copy same custom fields |
675 | - foreach(array_keys(config::get_customfields('calendar')) as $name) |
|
675 | + foreach (array_keys(config::get_customfields('calendar')) as $name) |
|
676 | 676 | { |
677 | 677 | if ($this->bo->customfields[$name]) $event['#'.$name] = $infolog['#'.$name]; |
678 | 678 | } |
@@ -691,9 +691,9 @@ discard block |
||
691 | 691 | * @param string $own_referer='' this is our own referer |
692 | 692 | * @param string $action_title='' app_header for the action, if '' we try the link-title |
693 | 693 | */ |
694 | - function index($values = null,$action='',$action_id='',$called_as=0,$extra_app_header=False,$return_html=False,$own_referer='',$action_title='') |
|
694 | + function index($values = null, $action = '', $action_id = '', $called_as = 0, $extra_app_header = False, $return_html = False, $own_referer = '', $action_title = '') |
|
695 | 695 | { |
696 | - unset($extra_app_header); // not used, but dont want to change signature |
|
696 | + unset($extra_app_header); // not used, but dont want to change signature |
|
697 | 697 | if (is_array($values)) |
698 | 698 | { |
699 | 699 | $called_as = $values['called_as']; |
@@ -702,22 +702,22 @@ discard block |
||
702 | 702 | elseif ($own_referer === '') |
703 | 703 | { |
704 | 704 | $own_referer = common::get_referer(); |
705 | - if (strpos($own_referer,'menuaction=infolog.infolog_ui.edit') !== false) |
|
705 | + if (strpos($own_referer, 'menuaction=infolog.infolog_ui.edit') !== false) |
|
706 | 706 | { |
707 | - $own_referer = $GLOBALS['egw']->session->appsession('own_session','infolog'); |
|
707 | + $own_referer = $GLOBALS['egw']->session->appsession('own_session', 'infolog'); |
|
708 | 708 | } |
709 | 709 | else |
710 | 710 | { |
711 | - $GLOBALS['egw']->session->appsession('own_session','infolog',$own_referer); |
|
711 | + $GLOBALS['egw']->session->appsession('own_session', 'infolog', $own_referer); |
|
712 | 712 | } |
713 | 713 | } |
714 | 714 | |
715 | 715 | // Handle legacy buttons like actions |
716 | - if(is_array($values)) |
|
716 | + if (is_array($values)) |
|
717 | 717 | { |
718 | - foreach(array('document', 'view', 'delete') as $button) |
|
718 | + foreach (array('document', 'view', 'delete') as $button) |
|
719 | 719 | { |
720 | - if(isset($values['nm']['rows'][$button])) |
|
720 | + if (isset($values['nm']['rows'][$button])) |
|
721 | 721 | { |
722 | 722 | list($id) = @each($values['nm']['rows'][$button]); |
723 | 723 | $values['nm']['multi_action'] = $button; |
@@ -737,27 +737,27 @@ discard block |
||
737 | 737 | // Some processing to add values in for links and cats |
738 | 738 | $multi_action = $values['nm']['multi_action']; |
739 | 739 | // Action has an additional action - add / delete, etc. Buttons named <multi-action>_action[action_name] |
740 | - if(in_array($multi_action, array('link', 'responsible'))) |
|
740 | + if (in_array($multi_action, array('link', 'responsible'))) |
|
741 | 741 | { |
742 | 742 | // eTemplate ignores the _popup namespace, but et2 doesn't |
743 | - if($values[$multi_action.'_popup']) |
|
743 | + if ($values[$multi_action.'_popup']) |
|
744 | 744 | { |
745 | - $popup =& $values[$multi_action.'_popup']; |
|
745 | + $popup = & $values[$multi_action.'_popup']; |
|
746 | 746 | } |
747 | 747 | else |
748 | 748 | { |
749 | - $popup =& $values; |
|
749 | + $popup = & $values; |
|
750 | 750 | } |
751 | - $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action']); |
|
752 | - if($multi_action == 'link') |
|
751 | + $values['nm']['multi_action'] .= '_'.key($popup[$multi_action.'_action']); |
|
752 | + if ($multi_action == 'link') |
|
753 | 753 | { |
754 | - $popup[$multi_action] = $popup['link']['app'] . ':'.$popup['link']['id']; |
|
754 | + $popup[$multi_action] = $popup['link']['app'].':'.$popup['link']['id']; |
|
755 | 755 | } |
756 | - else if(is_array($popup[$multi_action])) |
|
756 | + else if (is_array($popup[$multi_action])) |
|
757 | 757 | { |
758 | - $popup[$multi_action] = implode(',',$popup[$multi_action]); |
|
758 | + $popup[$multi_action] = implode(',', $popup[$multi_action]); |
|
759 | 759 | } |
760 | - $values['nm']['multi_action'] .= '_' . $popup[$multi_action]; |
|
760 | + $values['nm']['multi_action'] .= '_'.$popup[$multi_action]; |
|
761 | 761 | unset($values[$multi_action.'_popup']); |
762 | 762 | unset($values[$multi_action]); |
763 | 763 | } |
@@ -765,18 +765,18 @@ discard block |
||
765 | 765 | if ($this->action($values['nm']['multi_action'], $values['nm']['selected'], $values['nm']['select_all'], |
766 | 766 | $success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications'])) |
767 | 767 | { |
768 | - $msg .= lang('%1 entries %2',$success,$action_msg); |
|
768 | + $msg .= lang('%1 entries %2', $success, $action_msg); |
|
769 | 769 | egw_framework::message($msg); |
770 | 770 | } |
771 | - elseif(is_null($msg)) |
|
771 | + elseif (is_null($msg)) |
|
772 | 772 | { |
773 | - $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
774 | - egw_framework::message($msg,'error'); |
|
773 | + $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
774 | + egw_framework::message($msg, 'error'); |
|
775 | 775 | } |
776 | - elseif($msg) |
|
776 | + elseif ($msg) |
|
777 | 777 | { |
778 | - $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); |
|
779 | - egw_framework::message($msg,'error'); |
|
778 | + $msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed); |
|
779 | + egw_framework::message($msg, 'error'); |
|
780 | 780 | } |
781 | 781 | unset($values['nm']['multi_action']); |
782 | 782 | unset($values['nm']['select_all']); |
@@ -784,9 +784,9 @@ discard block |
||
784 | 784 | } |
785 | 785 | if (!$action) |
786 | 786 | { |
787 | - $action = is_array($values) && $values['action'] ? $values['action'] : get_var('action',array('POST','GET')); |
|
788 | - $action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET')); |
|
789 | - $action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET')); |
|
787 | + $action = is_array($values) && $values['action'] ? $values['action'] : get_var('action', array('POST', 'GET')); |
|
788 | + $action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id', array('POST', 'GET')); |
|
789 | + $action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : get_var('action_title', array('POST', 'GET')); |
|
790 | 790 | } |
791 | 791 | //echo "<p>".__METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values); |
792 | 792 | if (!is_array($values)) |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | $action_id = 0; |
800 | 800 | $action_title = ''; |
801 | 801 | } |
802 | - if($_GET['ajax'] === 'true') |
|
802 | + if ($_GET['ajax'] === 'true') |
|
803 | 803 | { |
804 | 804 | $nm['action'] = ''; |
805 | 805 | $nm['action_id'] = 0; |
@@ -815,8 +815,7 @@ discard block |
||
815 | 815 | |
816 | 816 | if (isset($_GET['filter']) && $_GET['filter'] != 'default' || !isset($values['nm']['filter']) && !$this->called_by) |
817 | 817 | { |
818 | - $values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] : |
|
819 | - $this->prefs['defaultFilter']; |
|
818 | + $values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] : $this->prefs['defaultFilter']; |
|
820 | 819 | } |
821 | 820 | if (!isset($values['nm']['order']) || !$values['nm']['order']) |
822 | 821 | { |
@@ -830,21 +829,21 @@ discard block |
||
830 | 829 | $action_title = $values['action_title'] = $action ? $action_title : $nm['action_title']; |
831 | 830 | $action = $values['action'] = $action ? $action : $nm['action']; |
832 | 831 | } |
833 | - if($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
832 | + if ($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
834 | 833 | |
835 | 834 | if ($values['nm']['add']) |
836 | 835 | { |
837 | 836 | $values['add'] = $values['nm']['add']; |
838 | 837 | unset($values['nm']['add']); |
839 | 838 | } |
840 | - unset($values['nm']['rows']['checked']); // not longer used, but hides button actions |
|
839 | + unset($values['nm']['rows']['checked']); // not longer used, but hides button actions |
|
841 | 840 | |
842 | 841 | if ($values['add'] || $values['cancel'] || isset($values['main'])) |
843 | 842 | { |
844 | 843 | if ($values['add']) |
845 | 844 | { |
846 | 845 | list($type) = each($values['add']); |
847 | - return $this->edit(0,$action,$action_id,$type,$called_as); |
|
846 | + return $this->edit(0, $action, $action_id, $type, $called_as); |
|
848 | 847 | } |
849 | 848 | elseif ($values['cancel'] && $own_referer) |
850 | 849 | { |
@@ -855,14 +854,14 @@ discard block |
||
855 | 854 | } |
856 | 855 | else |
857 | 856 | { |
858 | - list($do,$do2) = each($values['main']); |
|
857 | + list($do, $do2) = each($values['main']); |
|
859 | 858 | list($do_id) = @each($do2); |
860 | - switch((string)$do) |
|
859 | + switch ((string)$do) |
|
861 | 860 | { |
862 | 861 | case 'close': |
863 | - $closesingle=true; |
|
862 | + $closesingle = true; |
|
864 | 863 | case 'close_all': |
865 | - $this->close($do_id,$called_as,$closesingle); |
|
864 | + $this->close($do_id, $called_as, $closesingle); |
|
866 | 865 | break; |
867 | 866 | case 'view': |
868 | 867 | $value = array(); |
@@ -900,7 +899,7 @@ discard block |
||
900 | 899 | $this->tmpl->read('infolog.index'); |
901 | 900 | $values['nm']['options-filter'] = $this->filters; |
902 | 901 | $values['nm']['get_rows'] = 'infolog.infolog_ui.get_rows'; |
903 | - $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'],array('all','no_describtion')) ? array() : array( |
|
902 | + $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'], array('all', 'no_describtion')) ? array() : array( |
|
904 | 903 | '' => 'default', |
905 | 904 | )) + array( |
906 | 905 | 'no_describtion' => 'no details', |
@@ -921,35 +920,35 @@ discard block |
||
921 | 920 | else |
922 | 921 | { |
923 | 922 | // Allow saving parent ID into favorites |
924 | - $values['nm']['favorites'] = array('action','action_id'); |
|
923 | + $values['nm']['favorites'] = array('action', 'action_id'); |
|
925 | 924 | } |
926 | 925 | |
927 | 926 | // Allow add actions even when there's no rows |
928 | 927 | $values['nm']['placeholder_actions'] = array('new'); |
929 | 928 | |
930 | - if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
929 | + if (!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
931 | 930 | |
932 | 931 | // disable columns for main entry as set in the pref for details or no details |
933 | 932 | $values['nm']['columnselection_pref'] = 'nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows') |
934 | - .($values['nm']['filter2']=='all' ? '-details' : ''); |
|
933 | + .($values['nm']['filter2'] == 'all' ? '-details' : ''); |
|
935 | 934 | if ($action == 'sp') |
936 | 935 | { |
937 | 936 | $pref = $values['nm']['columnselection_pref']; |
938 | - foreach(array('info_used_time_info_planned_time_info_replanned_time','info_datemodified','info_owner_info_responsible','customfields') as $name) |
|
937 | + foreach (array('info_used_time_info_planned_time_info_replanned_time', 'info_datemodified', 'info_owner_info_responsible', 'customfields') as $name) |
|
939 | 938 | { |
940 | - $values['main']['no_'.$name] = strpos($this->prefs[$pref],$name) === false; |
|
939 | + $values['main']['no_'.$name] = strpos($this->prefs[$pref], $name) === false; |
|
941 | 940 | } |
942 | 941 | if (!$values['main']['no_customfields']) |
943 | 942 | { |
944 | 943 | // set the column-header of the main table for the customfields. |
945 | - foreach(array_keys($this->bo->customfields) as $lname) |
|
944 | + foreach (array_keys($this->bo->customfields) as $lname) |
|
946 | 945 | { |
947 | - $values['main']['customfields'].=$lname."\n"; |
|
946 | + $values['main']['customfields'] .= $lname."\n"; |
|
948 | 947 | } |
949 | 948 | } |
950 | 949 | } |
951 | 950 | $values['nm']['header_row'] = 'infolog.index.header_right'; |
952 | - if ($values['nm']['filter']=='bydate') |
|
951 | + if ($values['nm']['filter'] == 'bydate') |
|
953 | 952 | { |
954 | 953 | foreach (array_keys($values['nm']['col_filter']) as $colfk) |
955 | 954 | { |
@@ -982,7 +981,7 @@ discard block |
||
982 | 981 | { |
983 | 982 | $values['css'] .= '<style type="text/css">@media screen { .infoDes { '. |
984 | 983 | ' max-height: '. |
985 | - (($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35). // dono why em is not real lines |
|
984 | + (($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35).// dono why em is not real lines |
|
986 | 985 | 'em; overflow: auto; }}</style>'; |
987 | 986 | } |
988 | 987 | |
@@ -994,13 +993,13 @@ discard block |
||
994 | 993 | |
995 | 994 | // remove group-types user has not any rights to as filter |
996 | 995 | // does not take implicit rights as delegated into account, so they will not be available as filters |
997 | - foreach($this->bo->group_owners as $type => $group) |
|
996 | + foreach ($this->bo->group_owners as $type => $group) |
|
998 | 997 | { |
999 | 998 | if (!isset($this->bo->grants[$group])) unset($sel_options['info_type'][$type]); |
1000 | 999 | } |
1001 | 1000 | |
1002 | 1001 | |
1003 | - return $this->tmpl->exec('infolog.infolog_ui.index',$values,$sel_options,$readonlys,$persist,$return_html ? -1 : 0); |
|
1002 | + return $this->tmpl->exec('infolog.infolog_ui.index', $values, $sel_options, $readonlys, $persist, $return_html ? -1 : 0); |
|
1004 | 1003 | } |
1005 | 1004 | |
1006 | 1005 | /** |
@@ -1015,9 +1014,9 @@ discard block |
||
1015 | 1014 | if ($this->bo->group_owners) |
1016 | 1015 | { |
1017 | 1016 | // remove types owned by groups the user has no edit grant |
1018 | - foreach($this->bo->group_owners as $type => $group) |
|
1017 | + foreach ($this->bo->group_owners as $type => $group) |
|
1019 | 1018 | { |
1020 | - if (!($this->bo->grants[$group] & EGW_ACL_EDIT)) |
|
1019 | + if (!($this->bo->grants[$group]&EGW_ACL_EDIT)) |
|
1021 | 1020 | { |
1022 | 1021 | unset($types[$type]); |
1023 | 1022 | } |
@@ -1034,7 +1033,7 @@ discard block |
||
1034 | 1033 | */ |
1035 | 1034 | private function get_actions(array $query) |
1036 | 1035 | { |
1037 | - for($i = 0; $i <= 100; $i += 10) |
|
1036 | + for ($i = 0; $i <= 100; $i += 10) |
|
1038 | 1037 | { |
1039 | 1038 | $percent[$i] = $i.'%'; |
1040 | 1039 | } |
@@ -1043,9 +1042,9 @@ discard block |
||
1043 | 1042 | $types_add = array(); |
1044 | 1043 | // Do not add deleted type to add or change menus |
1045 | 1044 | unset($types['delete']); |
1046 | - foreach($types as $type => &$data) |
|
1045 | + foreach ($types as $type => &$data) |
|
1047 | 1046 | { |
1048 | - if ($type=='email') continue;//requirement by sales that it should not be shown in right - click - action dialog |
|
1047 | + if ($type == 'email') continue; //requirement by sales that it should not be shown in right - click - action dialog |
|
1049 | 1048 | $data = array( |
1050 | 1049 | 'caption' => $data, |
1051 | 1050 | 'icon' => $type, |
@@ -1057,7 +1056,7 @@ discard block |
||
1057 | 1056 | |
1058 | 1057 | $icons = null; |
1059 | 1058 | $statis = $this->bo->get_status($query['col_filter']['info_type'], $icons); |
1060 | - foreach($statis as $type => &$data) |
|
1059 | + foreach ($statis as $type => &$data) |
|
1061 | 1060 | { |
1062 | 1061 | $data = array( |
1063 | 1062 | 'caption' => $data, |
@@ -1072,7 +1071,7 @@ discard block |
||
1072 | 1071 | 'allowOnMultiple' => false, |
1073 | 1072 | 'url' => 'menuaction=infolog.infolog_ui.edit&info_id=$id', |
1074 | 1073 | 'popup' => egw_link::get_registry('infolog', 'add_popup'), |
1075 | - 'group' => $group=1, |
|
1074 | + 'group' => $group = 1, |
|
1076 | 1075 | ), |
1077 | 1076 | 'parent' => array( |
1078 | 1077 | 'caption' => 'View parent with children', |
@@ -1143,7 +1142,7 @@ discard block |
||
1143 | 1142 | 'icon' => 'completed', |
1144 | 1143 | ), |
1145 | 1144 | 'cat' => nextmatch_widget::category_action( |
1146 | - 'infolog',$group,'Change category','cat_' |
|
1145 | + 'infolog', $group, 'Change category', 'cat_' |
|
1147 | 1146 | ), |
1148 | 1147 | 'responsible' => array( |
1149 | 1148 | 'caption' => 'Delegation', |
@@ -1179,7 +1178,7 @@ discard block |
||
1179 | 1178 | 'onExecute' => 'javaScript:app.infolog.infolog_menu_print' |
1180 | 1179 | ) |
1181 | 1180 | ); |
1182 | - ++$group; // integration with other apps |
|
1181 | + ++$group; // integration with other apps |
|
1183 | 1182 | if ($GLOBALS['egw_info']['user']['apps']['filemanager']) |
1184 | 1183 | { |
1185 | 1184 | $actions['filemanager'] = array( |
@@ -1197,7 +1196,7 @@ discard block |
||
1197 | 1196 | 'caption' => 'Schedule appointment', |
1198 | 1197 | 'group' => $group, |
1199 | 1198 | 'url' => 'menuaction=calendar.calendar_uiforms.edit&'. |
1200 | - egw_link::get_registry('calendar', 'add_app') . '[]=infolog&'.egw_link::get_registry('calendar','add_id').'[]=$id', |
|
1199 | + egw_link::get_registry('calendar', 'add_app').'[]=infolog&'.egw_link::get_registry('calendar', 'add_id').'[]=$id', |
|
1201 | 1200 | 'allowOnMultiple' => false, |
1202 | 1201 | 'popup' => egw_link::get_registry('calendar', 'add_popup'), |
1203 | 1202 | ); |
@@ -1221,7 +1220,7 @@ discard block |
||
1221 | 1220 | 'hint' => 'Convert to a ticket', |
1222 | 1221 | 'group' => $group, |
1223 | 1222 | 'url' => 'menuaction=tracker.tracker_ui.edit&'. |
1224 | - egw_link::get_registry('tracker', 'add_app') . '[]=infolog&'.egw_link::get_registry('tracker','add_id').'[]=$id', |
|
1223 | + egw_link::get_registry('tracker', 'add_app').'[]=infolog&'.egw_link::get_registry('tracker', 'add_id').'[]=$id', |
|
1225 | 1224 | 'allowOnMultiple' => false, |
1226 | 1225 | 'popup' => egw_link::get_registry('tracker', 'add_popup'), |
1227 | 1226 | ); |
@@ -1234,7 +1233,7 @@ discard block |
||
1234 | 1233 | $actions['ical'] = array( |
1235 | 1234 | 'icon' => 'ical', |
1236 | 1235 | 'caption' => 'Export iCal', |
1237 | - 'postSubmit' => true, // download needs post submit to work |
|
1236 | + 'postSubmit' => true, // download needs post submit to work |
|
1238 | 1237 | 'group' => $group, |
1239 | 1238 | 'allowOnMultiple' => true, |
1240 | 1239 | ); |
@@ -1286,14 +1285,14 @@ discard block |
||
1286 | 1285 | $success = $failed = 0; |
1287 | 1286 | if ($use_all) |
1288 | 1287 | { |
1289 | - @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
1290 | - $query['num_rows'] = -1; // all |
|
1288 | + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
1289 | + $query['num_rows'] = -1; // all |
|
1291 | 1290 | $result = $readonlys = null; |
1292 | - $this->get_rows($query,$result,$readonlys); |
|
1291 | + $this->get_rows($query, $result, $readonlys); |
|
1293 | 1292 | $checked = array(); |
1294 | - foreach($result as $key => $info) |
|
1293 | + foreach ($result as $key => $info) |
|
1295 | 1294 | { |
1296 | - if(is_numeric($key)) |
|
1295 | + if (is_numeric($key)) |
|
1297 | 1296 | { |
1298 | 1297 | $checked[] = $info['info_id']; |
1299 | 1298 | } |
@@ -1304,29 +1303,29 @@ discard block |
||
1304 | 1303 | list($action, $settings) = explode('_', $_action, 2); |
1305 | 1304 | |
1306 | 1305 | // Actions that can handle a list of IDs |
1307 | - switch($action) |
|
1306 | + switch ($action) |
|
1308 | 1307 | { |
1309 | 1308 | case 'link': |
1310 | 1309 | list($add_remove, $link) = explode('_', $settings, 2); |
1311 | - list($app, $link_id) = explode(strpos($link,':') !== false ? ':' : ',', $link); |
|
1312 | - if(!$link_id) |
|
1310 | + list($app, $link_id) = explode(strpos($link, ':') !== false ? ':' : ',', $link); |
|
1311 | + if (!$link_id) |
|
1313 | 1312 | { |
1314 | 1313 | $action_msg = 'linked'; |
1315 | 1314 | $msg = lang('You need to select an entry for linking.'); |
1316 | 1315 | break; |
1317 | 1316 | } |
1318 | 1317 | $title = egw_link::title($app, $link_id); |
1319 | - foreach($checked as $id) |
|
1318 | + foreach ($checked as $id) |
|
1320 | 1319 | { |
1321 | - if(!$this->bo->check_access($id, EGW_ACL_EDIT)) |
|
1320 | + if (!$this->bo->check_access($id, EGW_ACL_EDIT)) |
|
1322 | 1321 | { |
1323 | 1322 | $failed++; |
1324 | 1323 | continue; |
1325 | 1324 | } |
1326 | - if($add_remove == 'add') |
|
1325 | + if ($add_remove == 'add') |
|
1327 | 1326 | { |
1328 | 1327 | $action_msg = lang('linked to %1', $title); |
1329 | - if(egw_link::link('infolog', $id, $app, $link_id)) |
|
1328 | + if (egw_link::link('infolog', $id, $app, $link_id)) |
|
1330 | 1329 | { |
1331 | 1330 | $success++; |
1332 | 1331 | } |
@@ -1353,20 +1352,20 @@ discard block |
||
1353 | 1352 | case 'ical': |
1354 | 1353 | // infolog_ical lets horde be auto-loaded, so it must go first |
1355 | 1354 | $boical = new infolog_ical(); |
1356 | - html::content_header('todo.ics','text/calendar'); |
|
1355 | + html::content_header('todo.ics', 'text/calendar'); |
|
1357 | 1356 | echo $boical->exportvCalendar($checked); |
1358 | 1357 | common::egw_exit(); |
1359 | 1358 | |
1360 | 1359 | } |
1361 | 1360 | |
1362 | 1361 | // Actions that need to loop |
1363 | - foreach($checked as $id) |
|
1362 | + foreach ($checked as $id) |
|
1364 | 1363 | { |
1365 | - if(!$entry = $this->bo->read($id)) |
|
1364 | + if (!$entry = $this->bo->read($id)) |
|
1366 | 1365 | { |
1367 | 1366 | continue; |
1368 | 1367 | } |
1369 | - switch($action) |
|
1368 | + switch ($action) |
|
1370 | 1369 | { |
1371 | 1370 | case 'close': |
1372 | 1371 | $action_msg = lang('closed'); |
@@ -1376,8 +1375,8 @@ discard block |
||
1376 | 1375 | |
1377 | 1376 | case 'delete': |
1378 | 1377 | $action_msg = $settings == 'sub' ? lang(' (and children) deleted') : lang('deleted'); |
1379 | - $result = $this->bo->delete($id, $settings=='sub', false, $skip_notifications); |
|
1380 | - if($result == true) |
|
1378 | + $result = $this->bo->delete($id, $settings == 'sub', false, $skip_notifications); |
|
1379 | + if ($result == true) |
|
1381 | 1380 | { |
1382 | 1381 | $success++; |
1383 | 1382 | } |
@@ -1390,14 +1389,14 @@ discard block |
||
1390 | 1389 | case 'type': |
1391 | 1390 | $action_msg = lang('changed type'); |
1392 | 1391 | // Dont allow to change the type, if user has no delete rights from the group-owner |
1393 | - if ($id && !($this->bo->grants[$entry['info_owner']] & EGW_ACL_DELETE)) |
|
1392 | + if ($id && !($this->bo->grants[$entry['info_owner']]&EGW_ACL_DELETE)) |
|
1394 | 1393 | { |
1395 | 1394 | $failed++; |
1396 | 1395 | break; |
1397 | 1396 | } |
1398 | 1397 | $entry['info_type'] = $settings; |
1399 | 1398 | try { |
1400 | - $this->bo->write($entry, true,true,true,$skip_notifications,true); // Throw exceptions |
|
1399 | + $this->bo->write($entry, true, true, true, $skip_notifications, true); // Throw exceptions |
|
1401 | 1400 | } |
1402 | 1401 | catch (egw_exception_wrong_userinput $e) |
1403 | 1402 | { |
@@ -1412,11 +1411,11 @@ discard block |
||
1412 | 1411 | $action_msg = lang('changed completion to %1%', $settings); |
1413 | 1412 | $entry['info_percent'] = $settings; |
1414 | 1413 | // Done and not-started entries will get changed right back if we don't change the status too |
1415 | - if(in_array($entry['info_status'],array('not-started','done','billed','cancelled','archive'))) |
|
1414 | + if (in_array($entry['info_status'], array('not-started', 'done', 'billed', 'cancelled', 'archive'))) |
|
1416 | 1415 | { |
1417 | 1416 | $entry['info_status'] = 'ongoing'; |
1418 | 1417 | } |
1419 | - if($entry['info_percent'] == 0) |
|
1418 | + if ($entry['info_percent'] == 0) |
|
1420 | 1419 | { |
1421 | 1420 | $entry['info_status'] = 'not-started'; |
1422 | 1421 | } |
@@ -1424,7 +1423,7 @@ discard block |
||
1424 | 1423 | { |
1425 | 1424 | $entry['info_status'] = 'done'; |
1426 | 1425 | } |
1427 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1426 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1428 | 1427 | { |
1429 | 1428 | $success++; |
1430 | 1429 | } |
@@ -1436,24 +1435,23 @@ discard block |
||
1436 | 1435 | |
1437 | 1436 | case 'undelete': // set it to valid status != 'deleted' for that type |
1438 | 1437 | $settings = isset($this->bo->status[$entry['info_type']]['done']) ? |
1439 | - $this->bo->status[$entry['info_type']]['done'] : |
|
1440 | - $this->bo->status['defaults'][$entry['info_type']]; |
|
1438 | + $this->bo->status[$entry['info_type']]['done'] : $this->bo->status['defaults'][$entry['info_type']]; |
|
1441 | 1439 | // fall-through |
1442 | 1440 | case 'status': |
1443 | - if(isset($this->bo->status[$entry['info_type']][$settings])) |
|
1441 | + if (isset($this->bo->status[$entry['info_type']][$settings])) |
|
1444 | 1442 | { |
1445 | 1443 | $action_msg = lang('changed status to %1', lang($this->bo->status[$entry['info_type']][$settings])); |
1446 | - if(!in_array($settings,array('done','billed','cancelled','archive')) && $entry['info_percent'] == 100) |
|
1444 | + if (!in_array($settings, array('done', 'billed', 'cancelled', 'archive')) && $entry['info_percent'] == 100) |
|
1447 | 1445 | { |
1448 | 1446 | // Done entries will get changed right back if we don't change the completion too |
1449 | 1447 | $entry['info_percent'] = 10; |
1450 | 1448 | } |
1451 | - if(in_array($settings, array('not-started')) && $entry['info_percent'] > 0) |
|
1449 | + if (in_array($settings, array('not-started')) && $entry['info_percent'] > 0) |
|
1452 | 1450 | { |
1453 | 1451 | $entry['info_percent'] = 0; |
1454 | 1452 | } |
1455 | 1453 | $entry['info_status'] = $settings; |
1456 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1454 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1457 | 1455 | { |
1458 | 1456 | $success++; |
1459 | 1457 | } |
@@ -1466,7 +1464,7 @@ discard block |
||
1466 | 1464 | break; |
1467 | 1465 | |
1468 | 1466 | case 'cat': |
1469 | - if($settings) |
|
1467 | + if ($settings) |
|
1470 | 1468 | { |
1471 | 1469 | $cat_name = categories::id2name($settings); |
1472 | 1470 | $action_msg = lang('changed category to %1', $cat_name); |
@@ -1476,7 +1474,7 @@ discard block |
||
1476 | 1474 | $action_msg = lang('removed category'); |
1477 | 1475 | } |
1478 | 1476 | $entry['info_cat'] = $settings; |
1479 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1477 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1480 | 1478 | { |
1481 | 1479 | $success++; |
1482 | 1480 | } |
@@ -1488,17 +1486,17 @@ discard block |
||
1488 | 1486 | |
1489 | 1487 | case 'responsible': |
1490 | 1488 | list($add_remove, $user_str) = explode('_', $settings, 2); |
1491 | - $action_msg = ($add_remove == 'add' ? lang('added') : lang('removed')) . ' '; |
|
1489 | + $action_msg = ($add_remove == 'add' ? lang('added') : lang('removed')).' '; |
|
1492 | 1490 | $names = array(); |
1493 | 1491 | $users = explode(',', $user_str); |
1494 | - foreach($users as $account_id) |
|
1492 | + foreach ($users as $account_id) |
|
1495 | 1493 | { |
1496 | 1494 | $names[] = common::grab_owner_name($account_id); |
1497 | 1495 | } |
1498 | 1496 | $action_msg .= implode(', ', $names); |
1499 | 1497 | $function = $add_remove == 'add' ? 'array_merge' : 'array_diff'; |
1500 | 1498 | $entry['info_responsible'] = array_unique($function($entry['info_responsible'], (array)$users)); |
1501 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1499 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1502 | 1500 | { |
1503 | 1501 | $success++; |
1504 | 1502 | } |
@@ -1519,10 +1517,10 @@ discard block |
||
1519 | 1517 | * @param string $_referer='' |
1520 | 1518 | * @param boolean $closesingle=false |
1521 | 1519 | */ |
1522 | - function close($values=0,$_referer='',$closesingle=false,$skip_notification = false) |
|
1520 | + function close($values = 0, $_referer = '', $closesingle = false, $skip_notification = false) |
|
1523 | 1521 | { |
1524 | 1522 | //echo "<p>".__METHOD__."($values,$referer,$closeall)</p>\n"; |
1525 | - $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1523 | + $info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1526 | 1524 | $referer = is_array($values) ? $values['referer'] : $_referer; |
1527 | 1525 | |
1528 | 1526 | if ($info_id) |
@@ -1532,11 +1530,11 @@ discard block |
||
1532 | 1530 | $status = $info['info_status']; |
1533 | 1531 | // closed stati assumed array('done','billed','cancelled') |
1534 | 1532 | if (isset($this->bo->status[$info['info_type']]['done'])) { |
1535 | - $status ='done'; |
|
1533 | + $status = 'done'; |
|
1536 | 1534 | } elseif (isset($this->bo->status[$info['info_type']]['billed'])) { |
1537 | - $status ='billed'; |
|
1535 | + $status = 'billed'; |
|
1538 | 1536 | } elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) { |
1539 | - $status ='cancelled'; |
|
1537 | + $status = 'cancelled'; |
|
1540 | 1538 | } |
1541 | 1539 | #_debug_array($status); |
1542 | 1540 | $values = array( |
@@ -1546,15 +1544,15 @@ discard block |
||
1546 | 1544 | 'info_percent'=> 100, |
1547 | 1545 | 'info_datecompleted' => $this->bo->now_su, |
1548 | 1546 | ); |
1549 | - $this->bo->write($values, true,true,true,$skip_notification); |
|
1547 | + $this->bo->write($values, true, true, true, $skip_notification); |
|
1550 | 1548 | |
1551 | - $query = array('action'=>'sp','action_id'=>$info_id); |
|
1549 | + $query = array('action'=>'sp', 'action_id'=>$info_id); |
|
1552 | 1550 | if (!$closesingle) { |
1553 | - foreach((array)$this->bo->search($query) as $info) |
|
1551 | + foreach ((array)$this->bo->search($query) as $info) |
|
1554 | 1552 | { |
1555 | 1553 | if ($info['info_id_parent'] == $info_id) // search also returns linked entries! |
1556 | 1554 | { |
1557 | - $this->close($info['info_id'],$referer,$closesingle,$skip_notification); // we call ourselfs recursive to process subs from subs too |
|
1555 | + $this->close($info['info_id'], $referer, $closesingle, $skip_notification); // we call ourselfs recursive to process subs from subs too |
|
1558 | 1556 | } |
1559 | 1557 | } |
1560 | 1558 | } |
@@ -1570,9 +1568,9 @@ discard block |
||
1570 | 1568 | * @param string $called_by |
1571 | 1569 | * @param boolean $skip_notification Do not send notification of deletion |
1572 | 1570 | */ |
1573 | - function delete($values=0,$_referer='',$called_by='',$skip_notification=False) |
|
1571 | + function delete($values = 0, $_referer = '', $called_by = '', $skip_notification = False) |
|
1574 | 1572 | { |
1575 | - $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1573 | + $info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1576 | 1574 | $referer = is_array($values) ? $values['referer'] : $_referer; |
1577 | 1575 | |
1578 | 1576 | if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) // entries without subs get confirmed by javascript |
@@ -1583,9 +1581,9 @@ discard block |
||
1583 | 1581 | |
1584 | 1582 | if (is_array($values) || $info_id <= 0) |
1585 | 1583 | { |
1586 | - if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id,EGW_ACL_DELETE)) |
|
1584 | + if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id, EGW_ACL_DELETE)) |
|
1587 | 1585 | { |
1588 | - $deleted = $this->bo->delete($info_id,$values['delete_subs'],$values['info_id_parent'], $skip_notification); |
|
1586 | + $deleted = $this->bo->delete($info_id, $values['delete_subs'], $values['info_id_parent'], $skip_notification); |
|
1589 | 1587 | } |
1590 | 1588 | if ($called_by) // direct call from the same request |
1591 | 1589 | { |
@@ -1595,7 +1593,7 @@ discard block |
||
1595 | 1593 | { |
1596 | 1594 | $this->edit(array( |
1597 | 1595 | 'info_id' => $info_id, |
1598 | - 'button' => array('deleted' => true), // not delete! |
|
1596 | + 'button' => array('deleted' => true), // not delete! |
|
1599 | 1597 | 'referer' => $referer, |
1600 | 1598 | 'msg' => $deleted ? lang('Infolog entry deleted') : '', |
1601 | 1599 | )); |
@@ -1603,7 +1601,7 @@ discard block |
||
1603 | 1601 | return $referer ? $this->tmpl->location($referer) : $this->index(); |
1604 | 1602 | } |
1605 | 1603 | $readonlys = $values = array(); |
1606 | - $values['main'][1] = $this->get_info($info_id,$readonlys['main']); |
|
1604 | + $values['main'][1] = $this->get_info($info_id, $readonlys['main']); |
|
1607 | 1605 | |
1608 | 1606 | $this->tmpl->read('infolog.delete'); |
1609 | 1607 | |
@@ -1624,7 +1622,7 @@ discard block |
||
1624 | 1622 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete'); |
1625 | 1623 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete'); |
1626 | 1624 | |
1627 | - $this->tmpl->exec('infolog.infolog_ui.delete',$values,array(),$readonlys,$persist,$called_by == 'edit' ? 2 : 0); |
|
1625 | + $this->tmpl->exec('infolog.infolog_ui.delete', $values, array(), $readonlys, $persist, $called_by == 'edit' ? 2 : 0); |
|
1628 | 1626 | } |
1629 | 1627 | |
1630 | 1628 | /** |
@@ -1636,77 +1634,77 @@ discard block |
||
1636 | 1634 | * @param string $type Type of log-entry: note,todo,task |
1637 | 1635 | * @param string $referer array with param/get-vars of the refering page |
1638 | 1636 | */ |
1639 | - function edit($content = null,$action = '',$action_id=0,$type='',$referer='') |
|
1637 | + function edit($content = null, $action = '', $action_id = 0, $type = '', $referer = '') |
|
1640 | 1638 | { |
1641 | 1639 | if (($submit = is_array($content))) |
1642 | 1640 | { |
1643 | 1641 | //echo "infolog_ui::edit: content="; _debug_array($content); |
1644 | 1642 | $info_id = $content['info_id']; |
1645 | - $action = $content['action']; unset($content['action']); |
|
1643 | + $action = $content['action']; unset($content['action']); |
|
1646 | 1644 | $action_id = $content['action_id']; unset($content['action_id']); |
1647 | - $referer = $content['referer']; unset($content['referer']); |
|
1648 | - $no_popup = $content['no_popup']; unset($content['no_popup']); |
|
1645 | + $referer = $content['referer']; unset($content['referer']); |
|
1646 | + $no_popup = $content['no_popup']; unset($content['no_popup']); |
|
1649 | 1647 | |
1650 | 1648 | list($button) = @each($content['button']); |
1651 | - if (!$button && $action) $button = $action; // action selectbox |
|
1649 | + if (!$button && $action) $button = $action; // action selectbox |
|
1652 | 1650 | //info_cc expects an comma separated string |
1653 | 1651 | //error_log(__METHOD__.__LINE__.array2string($content)); |
1654 | 1652 | if (empty($content['info_cc'])) $content['info_cc'] = ""; |
1655 | 1653 | if (is_array($content['info_cc'])) |
1656 | 1654 | { |
1657 | - foreach($content['info_cc'] as $i => $value) |
|
1655 | + foreach ($content['info_cc'] as $i => $value) |
|
1658 | 1656 | { |
1659 | 1657 | //imap_rfc822 should not be used, but it works reliable here, until we have some regex solution or use horde stuff |
1660 | 1658 | $addresses = imap_rfc822_parse_adrlist($value, ''); |
1661 | 1659 | //error_log(__METHOD__.__LINE__.$value.'->'.array2string($addresses[0])); |
1662 | - $content['info_cc'][$i]=$addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
|
1660 | + $content['info_cc'][$i] = $addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
|
1663 | 1661 | } |
1664 | - if (!empty($content['info_cc'])) $content['info_cc'] = implode(',',$content['info_cc']); |
|
1662 | + if (!empty($content['info_cc'])) $content['info_cc'] = implode(',', $content['info_cc']); |
|
1665 | 1663 | } |
1666 | 1664 | unset($content['button']); |
1667 | 1665 | if ($button) |
1668 | 1666 | { |
1669 | 1667 | // Copy or schedule Infolog |
1670 | - if (in_array($button,array('copy','schedule','ical','tracker'))) |
|
1668 | + if (in_array($button, array('copy', 'schedule', 'ical', 'tracker'))) |
|
1671 | 1669 | { |
1672 | 1670 | $action = $button; |
1673 | - if (!$info_id || $this->bo->check_access($info_id,EGW_ACL_EDIT)) |
|
1671 | + if (!$info_id || $this->bo->check_access($info_id, EGW_ACL_EDIT)) |
|
1674 | 1672 | { |
1675 | - $button = 'apply'; // need to store infolog first |
|
1673 | + $button = 'apply'; // need to store infolog first |
|
1676 | 1674 | } |
1677 | 1675 | } |
1678 | 1676 | //Validate the enddate must be grather than startdate |
1679 | 1677 | if (!empty($content['info_enddate']) && !empty($content['info_startdate'])) |
1680 | 1678 | { |
1681 | - $duration_date = $content['info_enddate']-$content['info_startdate']; |
|
1679 | + $duration_date = $content['info_enddate'] - $content['info_startdate']; |
|
1682 | 1680 | if ($duration_date < 0) |
1683 | 1681 | { |
1684 | 1682 | $this->tmpl->set_validation_error('info_startdate', lang('Startdate must be before Enddate!!!')); |
1685 | - $button = $action = ''; // stop save or apply |
|
1683 | + $button = $action = ''; // stop save or apply |
|
1686 | 1684 | } |
1687 | 1685 | } |
1688 | 1686 | //echo "<p>infolog_ui::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content); |
1689 | 1687 | if (($button == 'save' || $button == 'apply') && isset($content['info_subject']) && empty($content['info_subject'])) |
1690 | 1688 | { |
1691 | - $this->tmpl->set_validation_error('info_subject',lang('Field must not be empty !!!')); |
|
1692 | - $button = $action = ''; // stop save or apply |
|
1689 | + $this->tmpl->set_validation_error('info_subject', lang('Field must not be empty !!!')); |
|
1690 | + $button = $action = ''; // stop save or apply |
|
1693 | 1691 | } |
1694 | 1692 | if (($button == 'save' || $button == 'apply') && $info_id) |
1695 | 1693 | { |
1696 | 1694 | $old = $this->bo->read($info_id); |
1697 | - if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT))) |
|
1695 | + if (!($edit_acl = $this->bo->check_access($info_id, EGW_ACL_EDIT))) |
|
1698 | 1696 | { |
1699 | 1697 | $status_only = $this->bo->is_responsible($old); |
1700 | - $undelete = $this->bo->check_access($old,EGW_ACL_UNDELETE); |
|
1698 | + $undelete = $this->bo->check_access($old, EGW_ACL_UNDELETE); |
|
1701 | 1699 | } |
1702 | 1700 | } |
1703 | 1701 | if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete)) |
1704 | 1702 | { |
1705 | - $operation = $info_id ? 'edit' : 'add'; |
|
1703 | + $operation = $info_id ? 'edit' : 'add'; |
|
1706 | 1704 | if ($content['info_contact']) |
1707 | 1705 | { |
1708 | 1706 | $old_link_id = (int)$content['info_link_id']; |
1709 | - if(is_array($content['info_contact'])) |
|
1707 | + if (is_array($content['info_contact'])) |
|
1710 | 1708 | { |
1711 | 1709 | // eTemplate2 returns the array all ready |
1712 | 1710 | $app = $content['info_contact']['app']; |
@@ -1719,11 +1717,11 @@ discard block |
||
1719 | 1717 | } |
1720 | 1718 | elseif ($app && $id) |
1721 | 1719 | { |
1722 | - if(!is_array($content['link_to'])) |
|
1720 | + if (!is_array($content['link_to'])) |
|
1723 | 1721 | { |
1724 | 1722 | $content['link_to'] = array(); |
1725 | 1723 | } |
1726 | - $content['info_link_id'] = (int)($info_link_id = egw_link::link('infolog',$content['link_to']['to_id'],$app,$id)); |
|
1724 | + $content['info_link_id'] = (int)($info_link_id = egw_link::link('infolog', $content['link_to']['to_id'], $app, $id)); |
|
1727 | 1725 | } |
1728 | 1726 | else |
1729 | 1727 | { |
@@ -1733,7 +1731,7 @@ discard block |
||
1733 | 1731 | { |
1734 | 1732 | $link = egw_link::get_link($old_link_id); |
1735 | 1733 | // remove selected project, if removed link is that project |
1736 | - if($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $content['old_pm_id']) |
|
1734 | + if ($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $content['old_pm_id']) |
|
1737 | 1735 | { |
1738 | 1736 | unset($content['pm_id'], $content['old_pm_id']); |
1739 | 1737 | } |
@@ -1747,39 +1745,38 @@ discard block |
||
1747 | 1745 | } |
1748 | 1746 | if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) |
1749 | 1747 | { |
1750 | - $content['info_link_id'] = 0; // as field has to be int |
|
1748 | + $content['info_link_id'] = 0; // as field has to be int |
|
1751 | 1749 | } |
1752 | 1750 | $active_tab = $content['tabs']; |
1753 | 1751 | if (!($info_id = $this->bo->write($content, true, true, true, $content['no_notifications']))) |
1754 | 1752 | { |
1755 | - $content['msg'] = $info_id !== 0 || !$content['info_id'] ? lang('Error: saving the entry') : |
|
1756 | - lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
|
1757 | - lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'. |
|
1758 | - htmlspecialchars(egw::link('/index.php',array( |
|
1753 | + $content['msg'] = $info_id !== 0 || !$content['info_id'] ? lang('Error: saving the entry') : lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
|
1754 | + lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.', '<a href="'. |
|
1755 | + htmlspecialchars(egw::link('/index.php', array( |
|
1759 | 1756 | 'menuaction' => 'infolog.infolog_ui.edit', |
1760 | 1757 | 'info_id' => $content['info_id'], |
1761 | 1758 | 'no_popup' => $no_popup, |
1762 | 1759 | 'referer' => $referer, |
1763 | - ))).'">','</a>'); |
|
1764 | - $button = $action = ''; // not exiting edit |
|
1760 | + ))).'">', '</a>'); |
|
1761 | + $button = $action = ''; // not exiting edit |
|
1765 | 1762 | $info_id = $content['info_id']; |
1766 | 1763 | } |
1767 | 1764 | else |
1768 | 1765 | { |
1769 | - $GLOBALS['egw']->preferences->add('infolog','preferred_type',$content['info_type']); |
|
1770 | - $GLOBALS['egw']->preferences->save_repository(false,'user',false); |
|
1766 | + $GLOBALS['egw']->preferences->add('infolog', 'preferred_type', $content['info_type']); |
|
1767 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', false); |
|
1771 | 1768 | $content['msg'] = lang('InfoLog entry saved'); |
1772 | - egw_framework::refresh_opener($content['msg'],'infolog',$info_id,$operation); |
|
1769 | + egw_framework::refresh_opener($content['msg'], 'infolog', $info_id, $operation); |
|
1773 | 1770 | } |
1774 | 1771 | $content['tabs'] = $active_tab; |
1775 | - if ((int) $content['pm_id'] != (int) $content['old_pm_id']) |
|
1772 | + if ((int)$content['pm_id'] != (int)$content['old_pm_id']) |
|
1776 | 1773 | { |
1777 | 1774 | //echo "<p>pm_id changed: $content[old_pm_id] -> $content[pm_id]</p>\n"; |
1778 | 1775 | // update links accordingly, if selected project changed |
1779 | 1776 | if ($content['pm_id']) |
1780 | 1777 | { |
1781 | 1778 | //echo "<p>this->link->link('infolog',{$content['link_to']['to_id']},'projectmanager',{$content['pm_id']});</p>"; |
1782 | - egw_link::link('infolog',$content['link_to']['to_id'],'projectmanager',$content['pm_id']); |
|
1779 | + egw_link::link('infolog', $content['link_to']['to_id'], 'projectmanager', $content['pm_id']); |
|
1783 | 1780 | // making the project the selected link, if no other link selected |
1784 | 1781 | if (!$info_link_id || $info_link_id == 'projectmanager:'.$content['old_pm_id']) |
1785 | 1782 | { |
@@ -1789,7 +1786,7 @@ discard block |
||
1789 | 1786 | if ($content['old_pm_id']) |
1790 | 1787 | { |
1791 | 1788 | //echo "<p>this->link->unlink2(0,infolog,{$content['link_to']['to_id']},0,'projectmanager',{$content['old_pm_id']});</p>\n"; |
1792 | - egw_link::unlink2(0,infolog,$content['link_to']['to_id'],0,'projectmanager',$content['old_pm_id']); |
|
1789 | + egw_link::unlink2(0, infolog, $content['link_to']['to_id'], 0, 'projectmanager', $content['old_pm_id']); |
|
1793 | 1790 | } |
1794 | 1791 | $content['old_pm_id'] = $content['pm_id']; |
1795 | 1792 | } |
@@ -1797,14 +1794,14 @@ discard block |
||
1797 | 1794 | if ($info_id && is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) |
1798 | 1795 | { |
1799 | 1796 | //echo "<p>writing links for new entry $info_id</p>\n"; _debug_array($content['link_to']['to_id']); |
1800 | - egw_link::link('infolog',$info_id,$content['link_to']['to_id']); |
|
1797 | + egw_link::link('infolog', $info_id, $content['link_to']['to_id']); |
|
1801 | 1798 | $content['link_to']['to_id'] = $info_id; |
1802 | 1799 | } |
1803 | - if ($info_link_id && strpos($info_link_id,':') !== false) // updating info_link_id if necessary |
|
1800 | + if ($info_link_id && strpos($info_link_id, ':') !== false) // updating info_link_id if necessary |
|
1804 | 1801 | { |
1805 | - list($app,$id) = explode(':',$info_link_id); |
|
1806 | - $link = egw_link::get_link('infolog',$info_id,$app,$id); |
|
1807 | - if ((int) $content['info_link_id'] != (int) $link['link_id']) |
|
1802 | + list($app, $id) = explode(':', $info_link_id); |
|
1803 | + $link = egw_link::get_link('infolog', $info_id, $app, $id); |
|
1804 | + if ((int)$content['info_link_id'] != (int)$link['link_id']) |
|
1808 | 1805 | { |
1809 | 1806 | $content['info_link_id'] = $link['link_id']; |
1810 | 1807 | |
@@ -1816,9 +1813,9 @@ discard block |
||
1816 | 1813 | 'info_owner' => $content['info_owner'], |
1817 | 1814 | ); |
1818 | 1815 | //echo "<p>updating info_link_id: ".print_r($to_write,true)."</p>\n"; |
1819 | - $this->bo->write($to_write,False,true,true,true); // last true = no notifications, as no real change |
|
1816 | + $this->bo->write($to_write, False, true, true, true); // last true = no notifications, as no real change |
|
1820 | 1817 | // we need eg. the new modification date, for further updates |
1821 | - $content = array_merge($content,$to_write); |
|
1818 | + $content = array_merge($content, $to_write); |
|
1822 | 1819 | } |
1823 | 1820 | } |
1824 | 1821 | } |
@@ -1829,33 +1826,33 @@ discard block |
||
1829 | 1826 | 'action' => $action, |
1830 | 1827 | 'action_id' => $action_id |
1831 | 1828 | ); |
1832 | - if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first |
|
1829 | + if (!($content['msg'] = $this->delete($info_id, $referer, 'edit'))) return; // checks ACL first |
|
1833 | 1830 | |
1834 | - egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
|
1831 | + egw_framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete'); |
|
1835 | 1832 | } |
1836 | 1833 | // called again after delete confirmation dialog |
1837 | - elseif ($button == 'deleted' && $content['msg']) |
|
1834 | + elseif ($button == 'deleted' && $content['msg']) |
|
1838 | 1835 | { |
1839 | - egw_framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
|
1836 | + egw_framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete'); |
|
1840 | 1837 | } |
1841 | 1838 | if ($button == 'save' || $button == 'cancel' || $button == 'delete' || $button == 'deleted') |
1842 | 1839 | { |
1843 | 1840 | if ($no_popup) |
1844 | 1841 | { |
1845 | - egw::redirect_link($referer,array('msg' => $content['msg'])); |
|
1842 | + egw::redirect_link($referer, array('msg' => $content['msg'])); |
|
1846 | 1843 | } |
1847 | 1844 | egw_framework::window_close(); |
1848 | 1845 | } |
1849 | 1846 | } |
1850 | 1847 | // on a type-change, set the status to the default status of that type, if the actual status is not supported by the new type |
1851 | - if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']])) |
|
1848 | + if (!array_key_exists($content['info_status'], $this->bo->status[$content['info_type']])) |
|
1852 | 1849 | { |
1853 | 1850 | $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
1854 | 1851 | // Make sure we don't end up with invalid status / percent combinations |
1855 | 1852 | if ($content['info_status'] != 'done') |
1856 | 1853 | { |
1857 | 1854 | $content['info_datecompleted'] = ''; |
1858 | - if((int)$content['info_percent'] === 100) |
|
1855 | + if ((int)$content['info_percent'] === 100) |
|
1859 | 1856 | { |
1860 | 1857 | $content['info_percent'] = 10; |
1861 | 1858 | } |
@@ -1864,7 +1861,7 @@ discard block |
||
1864 | 1861 | { |
1865 | 1862 | $content['info_percent'] = 100; |
1866 | 1863 | } |
1867 | - if($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0) |
|
1864 | + if ($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0) |
|
1868 | 1865 | { |
1869 | 1866 | $content['info_percent'] = 10; |
1870 | 1867 | } |
@@ -1873,25 +1870,24 @@ discard block |
||
1873 | 1870 | else // new call via GET |
1874 | 1871 | { |
1875 | 1872 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
1876 | - $action = $action ? $action : get_var('action', array('POST','GET')); |
|
1877 | - $action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET')); |
|
1878 | - $info_id = $content ? $content : get_var('info_id', array('POST','GET')); |
|
1879 | - $type = $type ? $type : get_var('type', array('POST','GET')); |
|
1880 | - $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : |
|
1881 | - common::get_referer('/index.php?menuaction=infolog.infolog_ui.index')); |
|
1882 | - if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer |
|
1873 | + $action = $action ? $action : get_var('action', array('POST', 'GET')); |
|
1874 | + $action_id = $action_id ? $action_id : get_var('action_id', array('POST', 'GET')); |
|
1875 | + $info_id = $content ? $content : get_var('info_id', array('POST', 'GET')); |
|
1876 | + $type = $type ? $type : get_var('type', array('POST', 'GET')); |
|
1877 | + $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : common::get_referer('/index.php?menuaction=infolog.infolog_ui.index')); |
|
1878 | + if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/', '\\1', $referer); // remove previou/old msg from referer |
|
1883 | 1879 | $no_popup = $_GET['no_popup']; |
1884 | - $print = (int) $_REQUEST['print']; |
|
1880 | + $print = (int)$_REQUEST['print']; |
|
1885 | 1881 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
1886 | 1882 | |
1887 | - if (!($content = $this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id ))) |
|
1883 | + if (!($content = $this->bo->read($info_id || $action != 'sp' ? $info_id : $action_id))) |
|
1888 | 1884 | { |
1889 | 1885 | egw_framework::window_close(lang('Permission denied!')); |
1890 | 1886 | } |
1891 | - if (!(strpos($content['info_addr'],',')===false) && strpos($content['info_addr'],', ')===false) $content['info_addr'] = str_replace(',',', ',$content['info_addr']); |
|
1892 | - foreach(array('info_subject', 'info_des') as $key) |
|
1887 | + if (!(strpos($content['info_addr'], ',') === false) && strpos($content['info_addr'], ', ') === false) $content['info_addr'] = str_replace(',', ', ', $content['info_addr']); |
|
1888 | + foreach (array('info_subject', 'info_des') as $key) |
|
1893 | 1889 | { |
1894 | - if(!isset($content[$key]) || strlen($content[$key]) < 75) |
|
1890 | + if (!isset($content[$key]) || strlen($content[$key]) < 75) |
|
1895 | 1891 | { |
1896 | 1892 | continue; |
1897 | 1893 | } |
@@ -1899,66 +1895,66 @@ discard block |
||
1899 | 1895 | $clarray = array(); |
1900 | 1896 | foreach ($contlines as &$line) |
1901 | 1897 | { |
1902 | - if(strlen($line) < 75) |
|
1898 | + if (strlen($line) < 75) |
|
1903 | 1899 | { |
1904 | 1900 | $clarray[] = $line; |
1905 | 1901 | continue; |
1906 | 1902 | } |
1907 | 1903 | $cont = explode(' ', $line); |
1908 | 1904 | $ckarray = array(); |
1909 | - foreach($cont as &$word) |
|
1905 | + foreach ($cont as &$word) |
|
1910 | 1906 | { |
1911 | 1907 | // set blank behind all , and . if words are too long, apply wordwrap afterwards to make sure we get |
1912 | - if (strlen($word)>75) |
|
1908 | + if (strlen($word) > 75) |
|
1913 | 1909 | { |
1914 | 1910 | $buff = html::activate_links($word); |
1915 | 1911 | if (strlen($buff) == strlen($word)) // no links -> try to break overlong words |
1916 | 1912 | { |
1917 | - if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word); |
|
1918 | - if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word); |
|
1913 | + if (!(strpos($word, ',') === false) && strpos($word, ', ') === false) $word = str_replace(',', ', ', $word); |
|
1914 | + if (!(strpos($word, '.') === false) && strpos($word, '. ') === false) $word = str_replace('.', '. ', $word); |
|
1919 | 1915 | $word = wordwrap($word, 75, ' ', true); |
1920 | 1916 | } |
1921 | 1917 | } |
1922 | - $ckarray[] =$word; |
|
1918 | + $ckarray[] = $word; |
|
1923 | 1919 | } |
1924 | - $line = join(' ',$ckarray); |
|
1920 | + $line = join(' ', $ckarray); |
|
1925 | 1921 | unset($ckarray); |
1926 | 1922 | $clarray[] = $line; |
1927 | 1923 | } |
1928 | - $content[$key] = join("\n",$clarray); |
|
1924 | + $content[$key] = join("\n", $clarray); |
|
1929 | 1925 | unset($clarray); |
1930 | 1926 | } |
1931 | 1927 | if (is_numeric($_REQUEST['cat_id'])) |
1932 | 1928 | { |
1933 | - $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
1929 | + $content['info_cat'] = (int)$_REQUEST['cat_id']; |
|
1934 | 1930 | } |
1935 | 1931 | if (!$content) |
1936 | 1932 | { |
1937 | 1933 | $content['info_cat'] = $this->prefs['cat_add_default']; |
1938 | 1934 | } |
1939 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
1935 | + if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
1940 | 1936 | |
1941 | - switch($this->prefs['set_start']) |
|
1937 | + switch ($this->prefs['set_start']) |
|
1942 | 1938 | { |
1943 | - case 'date': default: $set_startdate = mktime(0,0,0,date('m',$this->bo->user_time_now),date('d',$this->bo->user_time_now),date('Y',$this->bo->user_time_now)); break; |
|
1939 | + case 'date': default: $set_startdate = mktime(0, 0, 0, date('m', $this->bo->user_time_now), date('d', $this->bo->user_time_now), date('Y', $this->bo->user_time_now)); break; |
|
1944 | 1940 | case 'datetime': $set_startdate = $this->bo->user_time_now; break; |
1945 | 1941 | case 'empty': $set_startdate = 0; break; |
1946 | 1942 | } |
1947 | 1943 | if ((int)$content['info_link_id'] > 0 && !egw_link::get_link($content['info_link_id'])) |
1948 | 1944 | { |
1949 | - $content['info_link_id'] = 0; // link has been deleted |
|
1945 | + $content['info_link_id'] = 0; // link has been deleted |
|
1950 | 1946 | if (!$content['info_custom_link']) $content['info_from'] = ''; |
1951 | 1947 | } |
1952 | 1948 | if (!$info_id && $action_id && $action == 'sp') // new SubProject |
1953 | 1949 | { |
1954 | - if (!$this->bo->check_access($action_id,EGW_ACL_ADD)) |
|
1950 | + if (!$this->bo->check_access($action_id, EGW_ACL_ADD)) |
|
1955 | 1951 | { |
1956 | - return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); |
|
1952 | + return $referer ? $this->tmpl->location($referer) : $this->index(0, $action, $action_id); |
|
1957 | 1953 | } |
1958 | 1954 | } |
1959 | 1955 | else |
1960 | 1956 | { |
1961 | - $undelete = $this->bo->check_access($info_id,EGW_ACL_UNDELETE); |
|
1957 | + $undelete = $this->bo->check_access($info_id, EGW_ACL_UNDELETE); |
|
1962 | 1958 | } |
1963 | 1959 | $content['links'] = $content['link_to'] = array( |
1964 | 1960 | 'to_id' => $info_id, |
@@ -1966,12 +1962,12 @@ discard block |
||
1966 | 1962 | ); |
1967 | 1963 | } |
1968 | 1964 | // new call via GET or some actions handled here, as they can happen both ways ($_GET[action] or button/action in GUI) |
1969 | - if (!$submit || in_array($action,array('sp','copy','schedule','ical','to_tracker'))) |
|
1965 | + if (!$submit || in_array($action, array('sp', 'copy', 'schedule', 'ical', 'to_tracker'))) |
|
1970 | 1966 | { |
1971 | 1967 | switch ($action) |
1972 | 1968 | { |
1973 | 1969 | case 'schedule': |
1974 | - egw::redirect_link('/index.php',array( |
|
1970 | + egw::redirect_link('/index.php', array( |
|
1975 | 1971 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
1976 | 1972 | 'link_app' => 'infolog', |
1977 | 1973 | 'link_id' => $info_id, |
@@ -1979,7 +1975,7 @@ discard block |
||
1979 | 1975 | break; |
1980 | 1976 | case 'ical': |
1981 | 1977 | $boical = new infolog_ical(); |
1982 | - $result = $boical->exportVTODO($content,'2.0','PUBLISH',false); |
|
1978 | + $result = $boical->exportVTODO($content, '2.0', 'PUBLISH', false); |
|
1983 | 1979 | html::content_header('todo.ics', 'text/calendar'); |
1984 | 1980 | echo $result; |
1985 | 1981 | common::egw_exit(); |
@@ -1990,23 +1986,23 @@ discard block |
||
1990 | 1986 | if ($action == 'sp') // for sub-entries use type or category, like for new entries |
1991 | 1987 | { |
1992 | 1988 | if ($type) $content['info_type'] = $type; |
1993 | - if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
1989 | + if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int)$_REQUEST['cat_id']; |
|
1994 | 1990 | } |
1995 | - unset($action); // it get stored in $content and will cause an other copy after [apply] |
|
1991 | + unset($action); // it get stored in $content and will cause an other copy after [apply] |
|
1996 | 1992 | break; |
1997 | 1993 | case 'to_tracker': |
1998 | - egw::redirect_link('/index.php',array( |
|
1994 | + egw::redirect_link('/index.php', array( |
|
1999 | 1995 | 'menuaction' => 'tracker.tracker_ui.edit', |
2000 | 1996 | egw_link::get_registry('tracker', 'add_app').'[]' => 'infolog', |
2001 | - egw_link::get_registry('tracker','add_id').'[]' => $info_id, |
|
1997 | + egw_link::get_registry('tracker', 'add_id').'[]' => $info_id, |
|
2002 | 1998 | )); |
2003 | 1999 | break; |
2004 | 2000 | case 'projectmanager': |
2005 | 2001 | $pm_links = array($action_id); |
2006 | 2002 | default: // to allow other apps to participate |
2007 | 2003 | $content['info_subject'] = egw_link::title($action, $id); |
2008 | - $action_ids = explode(',',$action_id); |
|
2009 | - if(count($action_ids) == 1) |
|
2004 | + $action_ids = explode(',', $action_id); |
|
2005 | + if (count($action_ids) == 1) |
|
2010 | 2006 | { |
2011 | 2007 | $content['info_contact'] = $action.':'.$action_id; |
2012 | 2008 | } |
@@ -2015,11 +2011,11 @@ discard block |
||
2015 | 2011 | egw_link::link('infolog', $content['link_to']['to_id'], $action, $id); |
2016 | 2012 | |
2017 | 2013 | // calling "infolog_set" hook for first, in case app wants to set some more values |
2018 | - if (!$n && ($set = $GLOBALS['egw']->hooks->single(array('location'=>'infolog_set','id'=>$action_id),$action))) |
|
2014 | + if (!$n && ($set = $GLOBALS['egw']->hooks->single(array('location'=>'infolog_set', 'id'=>$action_id), $action))) |
|
2019 | 2015 | { |
2020 | - foreach((array)$set['link_app'] as $i => $l_app) |
|
2016 | + foreach ((array)$set['link_app'] as $i => $l_app) |
|
2021 | 2017 | { |
2022 | - if (($l_id=$set['link_id'][$i])) egw_link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
2018 | + if (($l_id = $set['link_id'][$i])) egw_link::link('infolog', $content['link_to']['to_id'], $l_app, $l_id); |
|
2023 | 2019 | } |
2024 | 2020 | unset($set['link_app']); |
2025 | 2021 | unset($set['link_id']); |
@@ -2033,12 +2029,12 @@ discard block |
||
2033 | 2029 | { |
2034 | 2030 | if (!isset($pm_links)) |
2035 | 2031 | { |
2036 | - $pm_links = egw_link::get_links('infolog',$info_id,'projectmanager'); |
|
2032 | + $pm_links = egw_link::get_links('infolog', $info_id, 'projectmanager'); |
|
2037 | 2033 | } |
2038 | - break; // normal edit |
|
2034 | + break; // normal edit |
|
2039 | 2035 | } |
2040 | 2036 | case 'new': // new entry, set some defaults, if not set by infolog_set hook |
2041 | - if (empty($content['info_startdate'])) $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
2037 | + if (empty($content['info_startdate'])) $content['info_startdate'] = (int)$_GET['startdate'] ? (int)$_GET['startdate'] : $set_startdate; |
|
2042 | 2038 | if (empty($content['info_priority'])) $content['info_priority'] = 1; // normal |
2043 | 2039 | $content['info_owner'] = $this->user; |
2044 | 2040 | if ($type != '' && empty($content['info_type'])) |
@@ -2063,9 +2059,9 @@ discard block |
||
2063 | 2059 | if ($this->bo->group_owners) |
2064 | 2060 | { |
2065 | 2061 | // remove types owned by groups the user has no edit grant (current type is made readonly) |
2066 | - foreach($this->bo->group_owners as $type => $group) |
|
2062 | + foreach ($this->bo->group_owners as $type => $group) |
|
2067 | 2063 | { |
2068 | - if (!($this->bo->grants[$group] & EGW_ACL_EDIT)) |
|
2064 | + if (!($this->bo->grants[$group]&EGW_ACL_EDIT)) |
|
2069 | 2065 | { |
2070 | 2066 | if ($type == $content['info_type']) |
2071 | 2067 | { |
@@ -2083,7 +2079,7 @@ discard block |
||
2083 | 2079 | { |
2084 | 2080 | $content['info_owner'] = $this->bo->group_owners[$content['info_type']]; |
2085 | 2081 | // Dont allow to change the type, if user has no delete rights from the group-owner |
2086 | - if ($info_id && !($this->bo->grants[$content['info_owner']] & EGW_ACL_DELETE)) |
|
2082 | + if ($info_id && !($this->bo->grants[$content['info_owner']]&EGW_ACL_DELETE)) |
|
2087 | 2083 | { |
2088 | 2084 | //echo "<p>setting type to r/o as user has no delete rights from group #$group</p>\n"; |
2089 | 2085 | $readonlys['info_type'] = true; |
@@ -2091,7 +2087,7 @@ discard block |
||
2091 | 2087 | // disable info_access for group-owners |
2092 | 2088 | $readonlys['info_access'] = true; |
2093 | 2089 | } |
2094 | - elseif($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g') |
|
2090 | + elseif ($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g') |
|
2095 | 2091 | { |
2096 | 2092 | $content['info_owner'] = $this->user; |
2097 | 2093 | } |
@@ -2103,18 +2099,18 @@ discard block |
||
2103 | 2099 | unset($preserv['links']); unset($preserv['link_to']); |
2104 | 2100 | |
2105 | 2101 | // for no edit rights or implizit edit of responsible user make all fields readonly, but status and percent |
2106 | - if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT) && !$undelete) |
|
2102 | + if ($info_id && !$this->bo->check_access($info_id, EGW_ACL_EDIT) && !$undelete) |
|
2107 | 2103 | { |
2108 | - $readonlys['__ALL__'] = true; // make all fields not explicitly set readonly |
|
2104 | + $readonlys['__ALL__'] = true; // make all fields not explicitly set readonly |
|
2109 | 2105 | if ($this->bo->is_responsible($content)) |
2110 | 2106 | { |
2111 | - foreach($this->bo->responsible_edit as $name) |
|
2107 | + foreach ($this->bo->responsible_edit as $name) |
|
2112 | 2108 | { |
2113 | 2109 | $readonlys[$name] = false; |
2114 | 2110 | } |
2115 | 2111 | $readonlys['button[edit]'] = $readonlys['button[save]'] = $readonlys['button[apply]'] = $readonlys['no_notifications'] = false; |
2116 | 2112 | } |
2117 | - $readonlys['action'] = $readonlys['button[cancel]'] = false; // always allowed |
|
2113 | + $readonlys['action'] = $readonlys['button[cancel]'] = false; // always allowed |
|
2118 | 2114 | } |
2119 | 2115 | elseif (!$info_id) |
2120 | 2116 | { |
@@ -2127,16 +2123,16 @@ discard block |
||
2127 | 2123 | $this->tmpl->setElementAttribute('button[save]', 'label', 'Un-Delete'); |
2128 | 2124 | } |
2129 | 2125 | |
2130 | - if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE))) |
|
2126 | + if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id, EGW_ACL_DELETE))) |
|
2131 | 2127 | { |
2132 | - $content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not |
|
2128 | + $content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not |
|
2133 | 2129 | } |
2134 | 2130 | $GLOBALS['egw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]); |
2135 | 2131 | |
2136 | 2132 | // use a typ-specific template (infolog.edit.xyz), if one exists, otherwise fall back to the generic one |
2137 | 2133 | if (!$this->tmpl->read('infolog.edit.'.$content['info_type'])) |
2138 | 2134 | { |
2139 | - $this->tmpl->read($print ? 'infolog.edit.print':'infolog.edit'); |
|
2135 | + $this->tmpl->read($print ? 'infolog.edit.print' : 'infolog.edit'); |
|
2140 | 2136 | } |
2141 | 2137 | if ($this->bo->has_customfields($content['info_type'])) |
2142 | 2138 | { |
@@ -2148,14 +2144,14 @@ discard block |
||
2148 | 2144 | } |
2149 | 2145 | if (!isset($GLOBALS['egw_info']['user']['apps']['projectmanager'])) |
2150 | 2146 | { |
2151 | - $readonlys['tabs']['project'] = true; // disable the project tab |
|
2147 | + $readonlys['tabs']['project'] = true; // disable the project tab |
|
2152 | 2148 | } |
2153 | 2149 | |
2154 | 2150 | $content['duration_format'] = $this->duration_format; |
2155 | 2151 | $content['hours_per_workday'] = $this->hours_per_workday; |
2156 | 2152 | if ($this->prefs['show_id']) $content['info_number'] = $info_id; |
2157 | 2153 | |
2158 | - $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
|
2154 | + $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
|
2159 | 2155 | |
2160 | 2156 | $old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id']; |
2161 | 2157 | if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id; |
@@ -2173,7 +2169,7 @@ discard block |
||
2173 | 2169 | 'Pr' => $this->bo->enums['priority'], |
2174 | 2170 | 'Ow' => 'select-account', |
2175 | 2171 | //'Ac', // info_access: private||public |
2176 | - 'St' => $this->bo->status[$content['info_type']]+array('deleted' => 'deleted'), |
|
2172 | + 'St' => $this->bo->status[$content['info_type']] + array('deleted' => 'deleted'), |
|
2177 | 2173 | 'Pe' => 'select-percent', |
2178 | 2174 | 'Co' => 'date-time', |
2179 | 2175 | 'st' => 'date-time', |
@@ -2190,7 +2186,7 @@ discard block |
||
2190 | 2186 | ); |
2191 | 2187 | $history_stati = array(); |
2192 | 2188 | $tracking = new infolog_tracking($this); |
2193 | - foreach($tracking->field2history as $field => $history) |
|
2189 | + foreach ($tracking->field2history as $field => $history) |
|
2194 | 2190 | { |
2195 | 2191 | $history_stati[$history] = $tracking->field2label[$field]; |
2196 | 2192 | } |
@@ -2220,7 +2216,7 @@ discard block |
||
2220 | 2216 | { |
2221 | 2217 | $sel_options['action']['schedule'] = array('label' => 'Schedule', 'title' => 'Schedule appointment'); |
2222 | 2218 | } |
2223 | - egw_framework::validate_file('.','edit','infolog'); |
|
2219 | + egw_framework::validate_file('.', 'edit', 'infolog'); |
|
2224 | 2220 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '. |
2225 | 2221 | ($content['status_only'] ? lang('Edit Status') : lang('Edit')); |
2226 | 2222 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd')); |
@@ -2228,15 +2224,15 @@ discard block |
||
2228 | 2224 | //$content['info_des'] = substr($content['info_des'],0,1793); |
2229 | 2225 | //echo "<p>infolog_ui.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); |
2230 | 2226 | //$content['info_cc'] is expected (by the widget) to be an array of emailaddresses, but is stored as comma separated string |
2231 | - if (!empty($content['info_cc'])&&!is_array($content['info_cc']))$content['info_cc'] = explode(',',$content['info_cc']); |
|
2232 | - $this->tmpl->exec('infolog.infolog_ui.edit',$content,$sel_options,$readonlys,$preserv+array( // preserved values |
|
2227 | + if (!empty($content['info_cc']) && !is_array($content['info_cc']))$content['info_cc'] = explode(',', $content['info_cc']); |
|
2228 | + $this->tmpl->exec('infolog.infolog_ui.edit', $content, $sel_options, $readonlys, $preserv + array( // preserved values |
|
2233 | 2229 | 'info_id' => $info_id, |
2234 | 2230 | 'action' => $action, |
2235 | 2231 | 'action_id' => $action_id, |
2236 | 2232 | 'referer' => $referer, |
2237 | 2233 | 'no_popup' => $no_popup, |
2238 | 2234 | 'old_pm_id' => $old_pm_id, |
2239 | - ),$no_popup ? 0 : 2); |
|
2235 | + ), $no_popup ? 0 : 2); |
|
2240 | 2236 | } |
2241 | 2237 | |
2242 | 2238 | /** |
@@ -2247,16 +2243,16 @@ discard block |
||
2247 | 2243 | * @param array &$content |
2248 | 2244 | * @param boolean $create_sub true: create a sub-entry instead of a copy, default false to create a copy |
2249 | 2245 | */ |
2250 | - private function create_copy(array &$content, $create_sub=false) |
|
2246 | + private function create_copy(array &$content, $create_sub = false) |
|
2251 | 2247 | { |
2252 | - $info_id = $content['info_id']; // it will be unset by exclude-fields |
|
2248 | + $info_id = $content['info_id']; // it will be unset by exclude-fields |
|
2253 | 2249 | |
2254 | 2250 | // empty fields configured to be excluded (also contains id, uid, ...) |
2255 | 2251 | $exclude_fields = $create_sub ? $this->bo->sub_excludefields : $this->bo->copy_excludefields; |
2256 | 2252 | foreach ($exclude_fields as $field) |
2257 | 2253 | { |
2258 | 2254 | unset($content[$field]); |
2259 | - if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
2255 | + if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
2260 | 2256 | } |
2261 | 2257 | if ($create_sub) |
2262 | 2258 | { |
@@ -2265,9 +2261,9 @@ discard block |
||
2265 | 2261 | // no startdate or startdate in the past --> set startdate from pref |
2266 | 2262 | if (!isset($content['info_startdate']) || $content['info_startdate'] < $this->bo->user_time_now) |
2267 | 2263 | { |
2268 | - switch($this->prefs['set_start']) |
|
2264 | + switch ($this->prefs['set_start']) |
|
2269 | 2265 | { |
2270 | - case 'date': default: $set_startdate = mktime(0,0,0,date('m',$this->bo->user_time_now),date('d',$this->bo->user_time_now),date('Y',$this->bo->user_time_now)); break; |
|
2266 | + case 'date': default: $set_startdate = mktime(0, 0, 0, date('m', $this->bo->user_time_now), date('d', $this->bo->user_time_now), date('Y', $this->bo->user_time_now)); break; |
|
2271 | 2267 | case 'datetime': $set_startdate = $this->bo->user_time_now; break; |
2272 | 2268 | case 'empty': $set_startdate = 0; break; |
2273 | 2269 | } |
@@ -2286,17 +2282,17 @@ discard block |
||
2286 | 2282 | // get a consistent status, percent and date-completed |
2287 | 2283 | if (!isset($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
2288 | 2284 | if (!isset($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
2289 | - $content['info_datecompleted'] =$content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
|
2285 | + $content['info_datecompleted'] = $content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
|
2290 | 2286 | |
2291 | 2287 | if (!isset($content['info_cat'])) $content['info_cat'] = $this->prefs['cat_add_default']; |
2292 | 2288 | |
2293 | - if(!is_array($content['link_to'])) $content['link_to'] = array(); |
|
2289 | + if (!is_array($content['link_to'])) $content['link_to'] = array(); |
|
2294 | 2290 | $content['link_to']['to_app'] = 'infolog'; |
2295 | 2291 | $content['link_to']['to_id'] = 0; |
2296 | 2292 | // Get links to be copied, if not excluded |
2297 | - if (!in_array('link_to',$exclude_fields) || !in_array('attachments',$exclude_fields)) |
|
2293 | + if (!in_array('link_to', $exclude_fields) || !in_array('attachments', $exclude_fields)) |
|
2298 | 2294 | { |
2299 | - foreach(egw_link::get_links($content['link_to']['to_app'], $info_id) as $link) |
|
2295 | + foreach (egw_link::get_links($content['link_to']['to_app'], $info_id) as $link) |
|
2300 | 2296 | { |
2301 | 2297 | if ($link['app'] != egw_link::VFS_APPNAME && !in_array('link_to', $exclude_fields)) |
2302 | 2298 | { |
@@ -2320,19 +2316,19 @@ discard block |
||
2320 | 2316 | if (!isset($content['info_contact']) || empty($content['info_contact']) || $content['info_contact'] === 'copy:') |
2321 | 2317 | { |
2322 | 2318 | $linkinfos = egw_link::get_link($info_link_id); |
2323 | - $content['info_contact'] = $linkinfos['link_app1']=='infolog'? $linkinfos['link_app2'].':'.$linkinfos['link_id2']:$linkinfos['link_app1'].':'.$linkinfos['link_id1']; |
|
2324 | - if (stripos($content['info_contact'],'projectmanager')!==false) $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2']; |
|
2319 | + $content['info_contact'] = $linkinfos['link_app1'] == 'infolog' ? $linkinfos['link_app2'].':'.$linkinfos['link_id2'] : $linkinfos['link_app1'].':'.$linkinfos['link_id1']; |
|
2320 | + if (stripos($content['info_contact'], 'projectmanager') !== false) $content['pm_id'] = $linkinfos['link_app1'] == 'projectmanager' ? $linkinfos['link_id1'] : $linkinfos['link_id2']; |
|
2325 | 2321 | } |
2326 | 2322 | unset($content['info_link_id']); |
2327 | 2323 | } |
2328 | - $content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(EGW_ACL_ADD,0,$this->owner) ? $this->user : $this->owner; |
|
2324 | + $content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(EGW_ACL_ADD, 0, $this->owner) ? $this->user : $this->owner; |
|
2329 | 2325 | |
2330 | 2326 | if (!empty($content['info_subject'])) |
2331 | 2327 | { |
2332 | 2328 | if ($create_sub) |
2333 | 2329 | { |
2334 | 2330 | $config = config::read('infolog'); |
2335 | - $prefix = lang(empty($config['sub_prefix']) ? 'Re:': $config['sub_prefix']); |
|
2331 | + $prefix = lang(empty($config['sub_prefix']) ? 'Re:' : $config['sub_prefix']); |
|
2336 | 2332 | } |
2337 | 2333 | else |
2338 | 2334 | { |
@@ -2342,17 +2338,17 @@ discard block |
||
2342 | 2338 | } |
2343 | 2339 | if (!$create_sub) |
2344 | 2340 | { |
2345 | - $content['msg'] .= ($content['msg']?"\n":'').lang('Infolog copied - the copy can now be edited'); |
|
2341 | + $content['msg'] .= ($content['msg'] ? "\n" : '').lang('Infolog copied - the copy can now be edited'); |
|
2346 | 2342 | } |
2347 | 2343 | } |
2348 | 2344 | |
2349 | - function icon($cat,$id,$status='') |
|
2345 | + function icon($cat, $id, $status = '') |
|
2350 | 2346 | { |
2351 | 2347 | if (!$status || !($icon = $this->icons[$cat][$id.'_'.$status])) |
2352 | 2348 | { |
2353 | 2349 | $icon = $this->icons[$cat][$id]; |
2354 | 2350 | } |
2355 | - if ($icon && !is_readable(common::get_image_dir() . '/' . $icon)) |
|
2351 | + if ($icon && !is_readable(common::get_image_dir().'/'.$icon)) |
|
2356 | 2352 | { |
2357 | 2353 | $icon = False; |
2358 | 2354 | } |
@@ -2363,7 +2359,7 @@ discard block |
||
2363 | 2359 | $alt = $id; |
2364 | 2360 | } |
2365 | 2361 | } |
2366 | - return $icon ? html::image('infolog',$icon,lang($alt),'border=0') : lang($alt); |
|
2362 | + return $icon ? html::image('infolog', $icon, lang($alt), 'border=0') : lang($alt); |
|
2367 | 2363 | } |
2368 | 2364 | |
2369 | 2365 | /** |
@@ -2375,7 +2371,7 @@ discard block |
||
2375 | 2371 | */ |
2376 | 2372 | function array_stripslashes($arr) |
2377 | 2373 | { |
2378 | - foreach($arr as $key => $val) |
|
2374 | + foreach ($arr as $key => $val) |
|
2379 | 2375 | { |
2380 | 2376 | if (is_array($val)) |
2381 | 2377 | { |
@@ -2436,27 +2432,27 @@ discard block |
||
2436 | 2432 | 'info_cc' => 'CC', |
2437 | 2433 | ); |
2438 | 2434 | // add customfields to field list |
2439 | - foreach(config::get_customfields('infolog') as $name => $data) |
|
2435 | + foreach (config::get_customfields('infolog') as $name => $data) |
|
2440 | 2436 | { |
2441 | 2437 | $excludefields['#'.$name] = $data['label']; |
2442 | 2438 | } |
2443 | 2439 | $sub_excludefields = $excludefields; |
2444 | - unset($sub_excludefields['info_id_parent']); // always set to parent! |
|
2440 | + unset($sub_excludefields['info_id_parent']); // always set to parent! |
|
2445 | 2441 | |
2446 | 2442 | $config = config::read('infolog'); |
2447 | 2443 | |
2448 | - if($content) |
|
2444 | + if ($content) |
|
2449 | 2445 | { |
2450 | 2446 | // Save |
2451 | 2447 | $button = key($content['button']); |
2452 | - if($button == 'save' || $button == 'apply') |
|
2448 | + if ($button == 'save' || $button == 'apply') |
|
2453 | 2449 | { |
2454 | - $this->bo->responsible_edit = array('info_status','info_percent','info_datecompleted'); |
|
2450 | + $this->bo->responsible_edit = array('info_status', 'info_percent', 'info_datecompleted'); |
|
2455 | 2451 | |
2456 | 2452 | if ($content['responsible_edit']) |
2457 | 2453 | { |
2458 | - $extra = array_intersect($content['responsible_edit'],array_keys($fields)); |
|
2459 | - $this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit,$extra)); |
|
2454 | + $extra = array_intersect($content['responsible_edit'], array_keys($fields)); |
|
2455 | + $this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit, $extra)); |
|
2460 | 2456 | } |
2461 | 2457 | config::save_value('copy_excludefields', $content['copy_excludefields'] ? $content['copy_excludefields'] : null, 'infolog'); |
2462 | 2458 | config::save_value('sub_excludefields', $content['sub_excludefields'] ? $content['sub_excludefields'] : array('*NONE*'), 'infolog'); |
@@ -2467,12 +2463,12 @@ discard block |
||
2467 | 2463 | config::save_value('sub_prefix', $content['sub_prefix'], 'infolog'); |
2468 | 2464 | |
2469 | 2465 | // Notifications |
2470 | - $notifications =& $config[infolog_tracking::CUSTOM_NOTIFICATION]; |
|
2466 | + $notifications = & $config[infolog_tracking::CUSTOM_NOTIFICATION]; |
|
2471 | 2467 | $notifications[$content['notification_type']] = $content['notification']; |
2472 | - config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications,'infolog'); |
|
2468 | + config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications, 'infolog'); |
|
2473 | 2469 | } |
2474 | 2470 | |
2475 | - if($button == 'save' || $button == 'cancel') |
|
2471 | + if ($button == 'save' || $button == 'cancel') |
|
2476 | 2472 | { |
2477 | 2473 | egw::redirect_link('/index.php', array( |
2478 | 2474 | 'menuaction' => 'admin.admin_ui.index', |
@@ -2495,7 +2491,7 @@ discard block |
||
2495 | 2491 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Site configuration'); |
2496 | 2492 | |
2497 | 2493 | // Load selected custom notification |
2498 | - if(!$content['notification_type']) |
|
2494 | + if (!$content['notification_type']) |
|
2499 | 2495 | { |
2500 | 2496 | $content['notification_type'] = '~global~'; |
2501 | 2497 | } |
@@ -2519,7 +2515,7 @@ discard block |
||
2519 | 2515 | ); |
2520 | 2516 | $preserve['notification_old_type'] = $content['notification_type']; |
2521 | 2517 | $this->tmpl->read('infolog.config'); |
2522 | - $this->tmpl->exec('infolog.infolog_ui.admin',$content,$sel_options,array(),$preserve); |
|
2518 | + $this->tmpl->exec('infolog.infolog_ui.admin', $content, $sel_options, array(), $preserve); |
|
2523 | 2519 | } |
2524 | 2520 | |
2525 | 2521 | /** |
@@ -2528,13 +2524,13 @@ discard block |
||
2528 | 2524 | * @param array $mailContent = null content of mail |
2529 | 2525 | * @return array |
2530 | 2526 | */ |
2531 | - function mail_import(array $mailContent=null) |
|
2527 | + function mail_import(array $mailContent = null) |
|
2532 | 2528 | { |
2533 | 2529 | // It would get called from compose as a popup with egw_data |
2534 | 2530 | if (!is_array($mailContent) && ($_GET['egw_data'])) |
2535 | 2531 | { |
2536 | 2532 | // get the mail raw data |
2537 | - egw_link::get_data ($_GET['egw_data']); |
|
2533 | + egw_link::get_data($_GET['egw_data']); |
|
2538 | 2534 | return false; |
2539 | 2535 | } |
2540 | 2536 | |
@@ -2565,7 +2561,7 @@ discard block |
||
2565 | 2561 | function hook_view($args) |
2566 | 2562 | { |
2567 | 2563 | // Load JS for infolog actions |
2568 | - egw_framework::validate_file('.','app','infolog'); |
|
2564 | + egw_framework::validate_file('.', 'app', 'infolog'); |
|
2569 | 2565 | |
2570 | 2566 | switch ($args['location']) |
2571 | 2567 | { |
@@ -2593,7 +2589,7 @@ discard block |
||
2593 | 2589 | { |
2594 | 2590 | return False; |
2595 | 2591 | } |
2596 | - $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks |
|
2592 | + $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks |
|
2597 | 2593 | |
2598 | 2594 | // Set to calling app, so actions wind up in the correct place client side |
2599 | 2595 | $GLOBALS['egw_info']['flags']['currentapp'] = $app; |
@@ -2601,11 +2597,11 @@ discard block |
||
2601 | 2597 | translation::add_app('infolog'); |
2602 | 2598 | |
2603 | 2599 | // Still want infolog categories though |
2604 | - $GLOBALS['egw']->categories = new categories('','infolog'); |
|
2605 | - $this->index(null,$app,$args[$view_id],array( |
|
2600 | + $GLOBALS['egw']->categories = new categories('', 'infolog'); |
|
2601 | + $this->index(null, $app, $args[$view_id], array( |
|
2606 | 2602 | 'menuaction' => $view, |
2607 | 2603 | isset($view_id2) ? $view_id2 : $view_id => $args[$view_id] |
2608 | - ),True); |
|
2604 | + ), True); |
|
2609 | 2605 | } |
2610 | 2606 | |
2611 | 2607 | /** |
@@ -2614,26 +2610,26 @@ discard block |
||
2614 | 2610 | * @param string $type infolog type to include only the matching custom fields if set |
2615 | 2611 | * @return array |
2616 | 2612 | */ |
2617 | - function csv_export_fields($type=null) |
|
2613 | + function csv_export_fields($type = null) |
|
2618 | 2614 | { |
2619 | 2615 | $fields = array( |
2620 | 2616 | 'info_type' => lang('Type'), |
2621 | 2617 | 'info_from' => lang('Contact'), |
2622 | 2618 | 'info_addr' => lang('Phone/Email'), |
2623 | 2619 | // 'info_link_id' => lang('primary link'), |
2624 | - 'info_cat' => array('label' => lang('Category'),'type' => 'select-cat'), |
|
2620 | + 'info_cat' => array('label' => lang('Category'), 'type' => 'select-cat'), |
|
2625 | 2621 | 'info_priority' => lang('Priority'), |
2626 | - 'info_owner' => array('label' => lang('Owner'),'type' => 'select-account'), |
|
2622 | + 'info_owner' => array('label' => lang('Owner'), 'type' => 'select-account'), |
|
2627 | 2623 | 'info_access' => lang('Access'), |
2628 | 2624 | 'info_status' => lang('Status'), |
2629 | 2625 | 'info_percent' => lang('Completed'), |
2630 | 2626 | 'info_datecompleted' => lang('Date completed'), |
2631 | 2627 | 'info_datemodified' => lang('Last modified'), |
2632 | - 'info_modifier' => array('label' => lang('Modifier'),'type' => 'select-account'), |
|
2628 | + 'info_modifier' => array('label' => lang('Modifier'), 'type' => 'select-account'), |
|
2633 | 2629 | 'info_location' => lang('Location'), |
2634 | 2630 | 'info_startdate' => lang('Startdate'), |
2635 | 2631 | 'info_enddate' => lang('Enddate'), |
2636 | - 'info_responsible' => array('label' => lang('Responsible'),'type' => 'select-account'), |
|
2632 | + 'info_responsible' => array('label' => lang('Responsible'), 'type' => 'select-account'), |
|
2637 | 2633 | 'info_subject' => lang('Subject'), |
2638 | 2634 | 'info_des' => lang('Description'), |
2639 | 2635 | 'info_id' => lang('Id'), |
@@ -2643,13 +2639,13 @@ discard block |
||
2643 | 2639 | 'pl_id' => lang('pricelist'), |
2644 | 2640 | 'info_price' => lang('price'), |
2645 | 2641 | ); |
2646 | - foreach($this->bo->timestamps as $name) |
|
2642 | + foreach ($this->bo->timestamps as $name) |
|
2647 | 2643 | { |
2648 | - $fields[$name] = array('label' => $fields[$name],'type' => 'date-time'); |
|
2644 | + $fields[$name] = array('label' => $fields[$name], 'type' => 'date-time'); |
|
2649 | 2645 | } |
2650 | - foreach($this->bo->customfields as $name => $data) |
|
2646 | + foreach ($this->bo->customfields as $name => $data) |
|
2651 | 2647 | { |
2652 | - if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) continue; |
|
2648 | + if ($data['type2'] && $type && !in_array($type, explode(',', $data['type2']))) continue; |
|
2653 | 2649 | |
2654 | 2650 | $fields['#'.$name] = array( |
2655 | 2651 | 'label' => $data['label'], |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | var $productName = ''; |
68 | 68 | |
69 | 69 | /** |
70 | - * Shall we use the UID extensions of the description field? |
|
71 | - * |
|
72 | - * @var boolean |
|
73 | - */ |
|
70 | + * Shall we use the UID extensions of the description field? |
|
71 | + * |
|
72 | + * @var boolean |
|
73 | + */ |
|
74 | 74 | var $uidExtension = false; |
75 | 75 | |
76 | 76 | /** |
@@ -509,10 +509,10 @@ discard block |
||
509 | 509 | * @param boolean $merge =false merge data with existing entry (no longer used) |
510 | 510 | * @param int $user =null delegate new task to this account_id, default null |
511 | 511 | * @param string $charset =null The encoding charset for $text. Defaults to |
512 | - * utf-8 for new format, iso-8859-1 for old format. |
|
513 | - * @param string $caldav_name =null CalDAV URL name-part for new entries |
|
514 | - * @param array $callback_data =null array with callback and further parameters, first param is task to save |
|
515 | - * signature array callback($task, $param1, ...) |
|
512 | + * utf-8 for new format, iso-8859-1 for old format. |
|
513 | + * @param string $caldav_name =null CalDAV URL name-part for new entries |
|
514 | + * @param array $callback_data =null array with callback and further parameters, first param is task to save |
|
515 | + * signature array callback($task, $param1, ...) |
|
516 | 516 | * @return int|boolean integer info_id or false on error |
517 | 517 | */ |
518 | 518 | function importVTODO(&$_vcalData, $_taskID=-1, $merge=false, $user=null, $charset=null, $caldav_name=null, |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @param int $contentID =null infolog_id (or null, if unkown) |
598 | 598 | * @param boolean $relax =false if true, a weaker match algorithm is used |
599 | 599 | * @param string $charset The encoding charset for $text. Defaults to |
600 | - * utf-8 for new format, iso-8859-1 for old format. |
|
600 | + * utf-8 for new format, iso-8859-1 for old format. |
|
601 | 601 | * |
602 | 602 | * @return array of infolog_ids of matching entries |
603 | 603 | */ |
@@ -642,8 +642,8 @@ discard block |
||
642 | 642 | * @param string $_vcalData VTODO data |
643 | 643 | * @param int $_taskID =-1 infolog_id of the entry |
644 | 644 | * @param string $charset The encoding charset for $text. Defaults to |
645 | - * utf-8 for new format, iso-8859-1 for old format. |
|
646 | - * |
|
645 | + * utf-8 for new format, iso-8859-1 for old format. |
|
646 | + * |
|
647 | 647 | * @return array infolog entry or false on error |
648 | 648 | */ |
649 | 649 | function vtodotoegw($_vcalData, $_taskID=-1, $charset=null) |
@@ -1010,8 +1010,8 @@ discard block |
||
1010 | 1010 | * @param int $_noteID =-1 info_id, default -1 = new entry |
1011 | 1011 | * @param boolean $merge =false merge data with existing entry (no longer used) |
1012 | 1012 | * @param string $charset The encoding charset for $text. Defaults to |
1013 | - * utf-8 for new format, iso-8859-1 for old format. |
|
1014 | - * |
|
1013 | + * utf-8 for new format, iso-8859-1 for old format. |
|
1014 | + * |
|
1015 | 1015 | * @return int|boolean integer info_id or false on error |
1016 | 1016 | */ |
1017 | 1017 | function importVNOTE(&$_vcalData, $_type, $_noteID=-1, $merge=false, $charset=null) |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | * @param int $contentID=null infolog_id (or null, if unkown) |
1046 | 1046 | * @param boolean $relax=false if true, a weaker match algorithm is used |
1047 | 1047 | * @param string $charset The encoding charset for $text. Defaults to |
1048 | - * utf-8 for new format, iso-8859-1 for old format. |
|
1048 | + * utf-8 for new format, iso-8859-1 for old format. |
|
1049 | 1049 | * |
1050 | 1050 | * @return infolog_id of a matching entry or false, if nothing was found |
1051 | 1051 | */ |
@@ -1067,8 +1067,8 @@ discard block |
||
1067 | 1067 | * @param string $_type content type (eg.g text/plain) |
1068 | 1068 | * @param int $_noteID =-1 infolog_id of the entry |
1069 | 1069 | * @param string $charset The encoding charset for $text. Defaults to |
1070 | - * utf-8 for new format, iso-8859-1 for old format. |
|
1071 | - * |
|
1070 | + * utf-8 for new format, iso-8859-1 for old format. |
|
1071 | + * |
|
1072 | 1072 | * @return array infolog entry or false on error |
1073 | 1073 | */ |
1074 | 1074 | function vnotetoegw($_data, $_type, $_noteID=-1, $charset=null) |
@@ -104,7 +104,10 @@ discard block |
||
104 | 104 | function __construct(&$_clientProperties = array()) |
105 | 105 | { |
106 | 106 | parent::__construct(); |
107 | - if ($this->log) $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-infolog-vcal"; |
|
107 | + if ($this->log) |
|
108 | + { |
|
109 | + $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-infolog-vcal"; |
|
110 | + } |
|
108 | 111 | $this->clientProperties = $_clientProperties; |
109 | 112 | } |
110 | 113 | |
@@ -150,7 +153,10 @@ discard block |
||
150 | 153 | } |
151 | 154 | else |
152 | 155 | { |
153 | - if (!($taskData = $this->read($task, true, 'server'))) return false; |
|
156 | + if (!($taskData = $this->read($task, true, 'server'))) |
|
157 | + { |
|
158 | + return false; |
|
159 | + } |
|
154 | 160 | } |
155 | 161 | |
156 | 162 | if ($taskData['info_id_parent']) |
@@ -190,11 +196,17 @@ discard block |
||
190 | 196 | array2string($taskData)."\n",3,$this->logfile); |
191 | 197 | } |
192 | 198 | |
193 | - if (!isset($vcal)) $vcal = new Horde_Icalendar; |
|
199 | + if (!isset($vcal)) |
|
200 | + { |
|
201 | + $vcal = new Horde_Icalendar; |
|
202 | + } |
|
194 | 203 | $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
195 | 204 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']),array(),false); |
196 | 205 | $vcal->setAttribute('VERSION',$_version,array(),false); |
197 | - if ($_method) $vcal->setAttribute('METHOD',$_method,array(),false); |
|
206 | + if ($_method) |
|
207 | + { |
|
208 | + $vcal->setAttribute('METHOD',$_method,array(),false); |
|
209 | + } |
|
198 | 210 | |
199 | 211 | $tzid = $this->tzid; |
200 | 212 | if ($tzid && $tzid != 'UTC') |
@@ -273,7 +285,10 @@ discard block |
||
273 | 285 | // __FILE__, __LINE__, PEAR_LOG_INFO); |
274 | 286 | } |
275 | 287 | |
276 | - if (empty($value) && ($size < 0 || $noTruncate)) continue; |
|
288 | + if (empty($value) && ($size < 0 || $noTruncate)) |
|
289 | + { |
|
290 | + continue; |
|
291 | + } |
|
277 | 292 | |
278 | 293 | if ($field == 'RELATED-TO') |
279 | 294 | { |
@@ -402,7 +417,10 @@ discard block |
||
402 | 417 | { |
403 | 418 | if ($name[2] == ':') |
404 | 419 | { |
405 | - if (($v = json_php_unserialize($value)) && is_array($v)) $value = $v; |
|
420 | + if (($v = json_php_unserialize($value)) && is_array($v)) |
|
421 | + { |
|
422 | + $value = $v; |
|
423 | + } |
|
406 | 424 | foreach((array)$value as $compvData) |
407 | 425 | { |
408 | 426 | $comp = Horde_Icalendar::newComponent(substr($name,3), $vevent); |
@@ -530,7 +548,10 @@ discard block |
||
530 | 548 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
531 | 549 | } |
532 | 550 | |
533 | - if (!$taskData) return false; |
|
551 | + if (!$taskData) |
|
552 | + { |
|
553 | + return false; |
|
554 | + } |
|
534 | 555 | |
535 | 556 | // keep the dates |
536 | 557 | $this->time2time($taskData, $this->tzid, false); |
@@ -576,7 +597,10 @@ discard block |
||
576 | 597 | // remove all iCal fields not supported by EGroupware (stored like custom fields) |
577 | 598 | foreach(array_keys($old) as $name) |
578 | 599 | { |
579 | - if (substr($name,0,2) == '##') unset($old[$name]); |
|
600 | + if (substr($name,0,2) == '##') |
|
601 | + { |
|
602 | + unset($old[$name]); |
|
603 | + } |
|
580 | 604 | } |
581 | 605 | // merge in again all infolog fields not supported by iCal or not allowed to change |
582 | 606 | $taskData = array_merge($taskData, $old); |
@@ -722,7 +746,10 @@ discard block |
||
722 | 746 | $component->setAttribute('PERCENT-COMPLETE', $percent_completed = $status == 'COMPLETED' ? |
723 | 747 | 100 : ($status == 'NEEDS-ACTION' ? 0 : 10)); |
724 | 748 | } |
725 | - if ($this->log) error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n",3,$this->logfile); |
|
749 | + if ($this->log) |
|
750 | + { |
|
751 | + error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n",3,$this->logfile); |
|
752 | + } |
|
726 | 753 | } |
727 | 754 | // new task without status --> set a default status of NEEDS-ACTION, as otherwise task is marked closed |
728 | 755 | elseif($_taskID <= 0 && !is_scalar($x_infolog_status) && !is_scalar($completed)) |
@@ -731,12 +758,18 @@ discard block |
||
731 | 758 | } |
732 | 759 | else |
733 | 760 | { |
734 | - if ($this->log) error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed)?'='.$completed:' not set')." --> leaving status and percent unchanged",3,$this->logfile); |
|
761 | + if ($this->log) |
|
762 | + { |
|
763 | + error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed)?'='.$completed:' not set')." --> leaving status and percent unchanged",3,$this->logfile); |
|
764 | + } |
|
735 | 765 | } |
736 | 766 | } |
737 | 767 | foreach ($component->getAllAttributes() as $attribute) |
738 | 768 | { |
739 | - if (!$attribute['value'] && $attribute['value'] !== '0') continue; |
|
769 | + if (!$attribute['value'] && $attribute['value'] !== '0') |
|
770 | + { |
|
771 | + continue; |
|
772 | + } |
|
740 | 773 | |
741 | 774 | switch ($attribute['name']) |
742 | 775 | { |
@@ -921,7 +954,10 @@ discard block |
||
921 | 954 | */ |
922 | 955 | function exportVNOTE($_noteID, $_type, $charset='UTF-8') |
923 | 956 | { |
924 | - if(!($note = $this->read($_noteID, true, 'server'))) return false; |
|
957 | + if(!($note = $this->read($_noteID, true, 'server'))) |
|
958 | + { |
|
959 | + return false; |
|
960 | + } |
|
925 | 961 | |
926 | 962 | $note = Api\Translation::convert($note, |
927 | 963 | Api\Translation::charset(), $charset); |
@@ -1023,11 +1059,20 @@ discard block |
||
1023 | 1059 | array2string($_vcalData)."\n",3,$this->logfile); |
1024 | 1060 | } |
1025 | 1061 | |
1026 | - if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID, $charset))) return false; |
|
1062 | + if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID, $charset))) |
|
1063 | + { |
|
1064 | + return false; |
|
1065 | + } |
|
1027 | 1066 | |
1028 | - if($_noteID > 0) $note['info_id'] = $_noteID; |
|
1067 | + if($_noteID > 0) |
|
1068 | + { |
|
1069 | + $note['info_id'] = $_noteID; |
|
1070 | + } |
|
1029 | 1071 | |
1030 | - if (empty($note['info_status'])) $note['info_status'] = 'done'; |
|
1072 | + if (empty($note['info_status'])) |
|
1073 | + { |
|
1074 | + $note['info_status'] = 'done'; |
|
1075 | + } |
|
1031 | 1076 | |
1032 | 1077 | if ($this->log) |
1033 | 1078 | { |
@@ -1051,9 +1096,15 @@ discard block |
||
1051 | 1096 | */ |
1052 | 1097 | function searchVNOTE($_vcalData, $_type, $contentID=null, $relax=false, $charset=null) |
1053 | 1098 | { |
1054 | - if (!($note = $this->vnotetoegw($_vcalData, $_type, $contentID, $charset))) return array(); |
|
1099 | + if (!($note = $this->vnotetoegw($_vcalData, $_type, $contentID, $charset))) |
|
1100 | + { |
|
1101 | + return array(); |
|
1102 | + } |
|
1055 | 1103 | |
1056 | - if ($contentID) $note['info_id'] = $contentID; |
|
1104 | + if ($contentID) |
|
1105 | + { |
|
1106 | + $note['info_id'] = $contentID; |
|
1107 | + } |
|
1057 | 1108 | |
1058 | 1109 | unset($note['info_startdate']); |
1059 | 1110 | |
@@ -1105,7 +1156,10 @@ discard block |
||
1105 | 1156 | { |
1106 | 1157 | $_data = Api\Translation::convert($_data, $charset, 'utf-8'); |
1107 | 1158 | } |
1108 | - if (!$vnote->parsevCalendar($_data, 'VCALENDAR')) return false; |
|
1159 | + if (!$vnote->parsevCalendar($_data, 'VCALENDAR')) |
|
1160 | + { |
|
1161 | + return false; |
|
1162 | + } |
|
1109 | 1163 | |
1110 | 1164 | $components = $vnote->getComponent(); |
1111 | 1165 | foreach ($components as $component) |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param string $_version ='2.0' |
113 | 113 | * @param string $_method =null only set for iTip messages |
114 | 114 | * @param string $charset ='UTF-8' |
115 | - * @return string|boolean string with vCal or false on error (eg. no permission to read the event) |
|
115 | + * @return false|string string with vCal or false on error (eg. no permission to read the event) |
|
116 | 116 | */ |
117 | 117 | function exportVCalendar(array $tasks, $_version='2.0', $_method=null, $charset='UTF-8') |
118 | 118 | { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param string $charset ='UTF-8' encoding of the vcalendar, default UTF-8 |
138 | 138 | * @param Horde_Icalendar $vcal =null optional iCalendar object to add vtodo to |
139 | 139 | * |
140 | - * @return string|boolean string with vCal or false on error (eg. no permission to read the event) |
|
140 | + * @return false|string string with vCal or false on error (eg. no permission to read the event) |
|
141 | 141 | */ |
142 | 142 | function exportVTODO($task, $_version='2.0',$_method='PUBLISH', $charset='UTF-8',Horde_Icalendar $vcal=null) |
143 | 143 | { |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * @param string $_type content type (e.g. text/plain) |
917 | 917 | * @param string $charset ='UTF-8' encoding of the vcalendar, default UTF-8 |
918 | 918 | * |
919 | - * @return string|boolean VNOTE representation of the infolog entry or false on error |
|
919 | + * @return false|string VNOTE representation of the infolog entry or false on error |
|
920 | 920 | */ |
921 | 921 | function exportVNOTE($_noteID, $_type, $charset='UTF-8') |
922 | 922 | { |
@@ -1041,8 +1041,7 @@ discard block |
||
1041 | 1041 | * Search a matching infolog entry for the VNOTE data |
1042 | 1042 | * |
1043 | 1043 | * @param string $_vcalData VNOTE |
1044 | - * @param int $contentID=null infolog_id (or null, if unkown) |
|
1045 | - * @param boolean $relax=false if true, a weaker match algorithm is used |
|
1044 | + * @param int $contentID infolog_id (or null, if unkown) |
|
1046 | 1045 | * @param string $charset The encoding charset for $text. Defaults to |
1047 | 1046 | * utf-8 for new format, iso-8859-1 for old format. |
1048 | 1047 | * |
@@ -20,39 +20,39 @@ discard block |
||
20 | 20 | * @var array $priority_egw2ical conversion of the priority egw => ical |
21 | 21 | */ |
22 | 22 | var $priority_egw2ical = array( |
23 | - 0 => 9, // low |
|
24 | - 1 => 5, // normal |
|
25 | - 2 => 3, // high |
|
26 | - 3 => 1, // urgent |
|
23 | + 0 => 9, // low |
|
24 | + 1 => 5, // normal |
|
25 | + 2 => 3, // high |
|
26 | + 3 => 1, // urgent |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @var array $priority_ical2egw conversion of the priority ical => egw |
31 | 31 | */ |
32 | 32 | var $priority_ical2egw = array( |
33 | - 9 => 0, 8 => 0, 7 => 0, // low |
|
34 | - 6 => 1, 5 => 1, 4 => 1, 0 => 1, // normal |
|
35 | - 3 => 2, 2 => 2, // high |
|
36 | - 1 => 3, // urgent |
|
33 | + 9 => 0, 8 => 0, 7 => 0, // low |
|
34 | + 6 => 1, 5 => 1, 4 => 1, 0 => 1, // normal |
|
35 | + 3 => 2, 2 => 2, // high |
|
36 | + 1 => 3, // urgent |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * @var array $priority_egw2funambol conversion of the priority egw => funambol |
41 | 41 | */ |
42 | 42 | var $priority_egw2funambol = array( |
43 | - 0 => 0, // low |
|
44 | - 1 => 1, // normal |
|
45 | - 2 => 2, // high |
|
46 | - 3 => 2, // urgent |
|
43 | + 0 => 0, // low |
|
44 | + 1 => 1, // normal |
|
45 | + 2 => 2, // high |
|
46 | + 3 => 2, // urgent |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @var array $priority_funambol2egw conversion of the priority funambol => egw |
51 | 51 | */ |
52 | 52 | var $priority_funambol2egw = array( |
53 | - 0 => 0, // low |
|
54 | - 1 => 1, // normal |
|
55 | - 2 => 3, // high |
|
53 | + 0 => 0, // low |
|
54 | + 1 => 1, // normal |
|
55 | + 2 => 3, // high |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @var boolean |
91 | 91 | */ |
92 | 92 | var $log = false; |
93 | - var $logfile="/tmp/log-infolog-vcal"; |
|
93 | + var $logfile = "/tmp/log-infolog-vcal"; |
|
94 | 94 | |
95 | 95 | |
96 | 96 | /** |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @param string $charset ='UTF-8' |
115 | 115 | * @return string|boolean string with vCal or false on error (eg. no permission to read the event) |
116 | 116 | */ |
117 | - function exportVCalendar(array $tasks, $_version='2.0', $_method=null, $charset='UTF-8') |
|
117 | + function exportVCalendar(array $tasks, $_version = '2.0', $_method = null, $charset = 'UTF-8') |
|
118 | 118 | { |
119 | 119 | $vcal = new Horde_Icalendar; |
120 | 120 | |
121 | - foreach($tasks as $task) |
|
121 | + foreach ($tasks as $task) |
|
122 | 122 | { |
123 | 123 | if (!$this->exportVTODO($task, $_version, $_method, $charset, $vcal)) |
124 | 124 | { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return string|boolean string with vCal or false on error (eg. no permission to read the event) |
141 | 141 | */ |
142 | - function exportVTODO($task, $_version='2.0',$_method='PUBLISH', $charset='UTF-8',Horde_Icalendar $vcal=null) |
|
142 | + function exportVTODO($task, $_version = '2.0', $_method = 'PUBLISH', $charset = 'UTF-8', Horde_Icalendar $vcal = null) |
|
143 | 143 | { |
144 | 144 | if (is_array($task)) |
145 | 145 | { |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | { |
165 | 165 | if (!preg_match('/\[UID:.+\]/m', $taskData['info_des'])) |
166 | 166 | { |
167 | - $taskData['info_des'] .= "\n[UID:" . $taskData['info_uid'] . "]"; |
|
167 | + $taskData['info_des'] .= "\n[UID:".$taskData['info_uid']."]"; |
|
168 | 168 | if ($taskData['info_id_parent'] != '') |
169 | 169 | { |
170 | - $taskData['info_des'] .= "\n[PARENT_UID:" . $taskData['info_id_parent'] . "]"; |
|
170 | + $taskData['info_des'] .= "\n[PARENT_UID:".$taskData['info_id_parent']."]"; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | |
184 | 184 | if ($this->log) |
185 | 185 | { |
186 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
187 | - array2string($taskData)."\n",3,$this->logfile); |
|
186 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
187 | + array2string($taskData)."\n", 3, $this->logfile); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | if (!isset($vcal)) $vcal = new Horde_Icalendar; |
191 | - $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
192 | - strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']),array(),false); |
|
193 | - $vcal->setAttribute('VERSION',$_version,array(),false); |
|
194 | - if ($_method) $vcal->setAttribute('METHOD',$_method,array(),false); |
|
191 | + $vcal->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
192 | + strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']), array(), false); |
|
193 | + $vcal->setAttribute('VERSION', $_version, array(), false); |
|
194 | + if ($_method) $vcal->setAttribute('METHOD', $_method, array(), false); |
|
195 | 195 | |
196 | 196 | $tzid = $this->tzid; |
197 | 197 | if ($tzid && $tzid != 'UTC') |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
212 | - $vevent = Horde_Icalendar::newComponent('VTODO',$vcal); |
|
212 | + $vevent = Horde_Icalendar::newComponent('VTODO', $vcal); |
|
213 | 213 | |
214 | 214 | if (!isset($this->clientProperties['SUMMARY']['Size'])) |
215 | 215 | { |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | $noTruncate = $this->clientProperties[$field]['NoTruncate']; |
234 | 234 | if ($this->log && $size > 0) |
235 | 235 | { |
236 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
237 | - "() $field Size: $size, NoTruncate: " . |
|
238 | - ($noTruncate ? 'TRUE' : 'FALSE') . "\n",3,$this->logfile); |
|
236 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
237 | + "() $field Size: $size, NoTruncate: ". |
|
238 | + ($noTruncate ? 'TRUE' : 'FALSE')."\n", 3, $this->logfile); |
|
239 | 239 | } |
240 | 240 | //Horde::logMessage("VTODO $field Size: $size, NoTruncate: " . |
241 | 241 | // ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -252,19 +252,19 @@ discard block |
||
252 | 252 | { |
253 | 253 | if ($this->log) |
254 | 254 | { |
255 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
256 | - "() $field omitted due to maximum size $size\n",3,$this->logfile); |
|
255 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
256 | + "() $field omitted due to maximum size $size\n", 3, $this->logfile); |
|
257 | 257 | } |
258 | 258 | //Horde::logMessage("VTODO $field omitted due to maximum size $size", |
259 | 259 | // __FILE__, __LINE__, PEAR_LOG_WARNING); |
260 | 260 | continue; // skip field |
261 | 261 | } |
262 | 262 | // truncate the value to size |
263 | - $value = substr($value, 0, $size -1); |
|
263 | + $value = substr($value, 0, $size - 1); |
|
264 | 264 | if ($this->log) |
265 | 265 | { |
266 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
267 | - "() $field truncated to maximum size $size\n",3,$this->logfile); |
|
266 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
267 | + "() $field truncated to maximum size $size\n", 3, $this->logfile); |
|
268 | 268 | } |
269 | 269 | //Horde::logMessage("VTODO $field truncated to maximum size $size", |
270 | 270 | // __FILE__, __LINE__, PEAR_LOG_INFO); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | if ($_version == '1.0' && preg_match('/[^\x20-\x7F]/', $value)) |
285 | 285 | { |
286 | - $options['CHARSET'] = $charset; |
|
286 | + $options['CHARSET'] = $charset; |
|
287 | 287 | switch ($this->productManufacturer) |
288 | 288 | { |
289 | 289 | case 'groupdav': |
@@ -325,25 +325,23 @@ discard block |
||
325 | 325 | self::setDateOrTime($vevent, 'COMPLETED', $taskData['info_datecompleted'], $tzid); |
326 | 326 | } |
327 | 327 | |
328 | - $vevent->setAttribute('DTSTAMP',time()); |
|
329 | - $vevent->setAttribute('CREATED', $taskData['info_created'] ? $taskData['info_created'] : |
|
330 | - $GLOBALS['egw']->contenthistory->getTSforAction('infolog_task',$taskData['info_id'],'add')); |
|
331 | - $vevent->setAttribute('LAST-MODIFIED', $taskData['info_datemodified'] ? $taskData['info_datemodified'] : |
|
332 | - $GLOBALS['egw']->contenthistory->getTSforAction('infolog_task',$taskData['info_id'],'modify')); |
|
333 | - $vevent->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE'); |
|
334 | - $vevent->setAttribute('STATUS',$this->status2vtodo($taskData['info_status'])); |
|
328 | + $vevent->setAttribute('DTSTAMP', time()); |
|
329 | + $vevent->setAttribute('CREATED', $taskData['info_created'] ? $taskData['info_created'] : $GLOBALS['egw']->contenthistory->getTSforAction('infolog_task', $taskData['info_id'], 'add')); |
|
330 | + $vevent->setAttribute('LAST-MODIFIED', $taskData['info_datemodified'] ? $taskData['info_datemodified'] : $GLOBALS['egw']->contenthistory->getTSforAction('infolog_task', $taskData['info_id'], 'modify')); |
|
331 | + $vevent->setAttribute('CLASS', $taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE'); |
|
332 | + $vevent->setAttribute('STATUS', $this->status2vtodo($taskData['info_status'])); |
|
335 | 333 | // we try to preserv the original infolog status as X-INFOLOG-STATUS, so we can restore it, if the user does not modify STATUS |
336 | - $vevent->setAttribute('X-INFOLOG-STATUS',$taskData['info_status']); |
|
337 | - $vevent->setAttribute('PERCENT-COMPLETE',$taskData['info_percent']); |
|
334 | + $vevent->setAttribute('X-INFOLOG-STATUS', $taskData['info_status']); |
|
335 | + $vevent->setAttribute('PERCENT-COMPLETE', $taskData['info_percent']); |
|
338 | 336 | if ($this->productManufacturer == 'funambol' && |
339 | 337 | (strpos($this->productName, 'outlook') !== false |
340 | 338 | || strpos($this->productName, 'pocket pc') !== false)) |
341 | 339 | { |
342 | - $priority = (int) $this->priority_egw2funambol[$taskData['info_priority']]; |
|
340 | + $priority = (int)$this->priority_egw2funambol[$taskData['info_priority']]; |
|
343 | 341 | } |
344 | 342 | else |
345 | 343 | { |
346 | - $priority = (int) $this->priority_egw2ical[$taskData['info_priority']]; |
|
344 | + $priority = (int)$this->priority_egw2ical[$taskData['info_priority']]; |
|
347 | 345 | } |
348 | 346 | $vevent->setAttribute('PRIORITY', $priority); |
349 | 347 | |
@@ -352,7 +350,7 @@ discard block |
||
352 | 350 | (count($taskData['info_responsible']) > 1 || |
353 | 351 | $taskData['info_responsible'][0] != $taskData['info_onwer'])) |
354 | 352 | { |
355 | - if (($url = $GLOBALS['egw']->accounts->id2name($taskData['info_owner'],'account_email'))) |
|
353 | + if (($url = $GLOBALS['egw']->accounts->id2name($taskData['info_owner'], 'account_email'))) |
|
356 | 354 | { |
357 | 355 | $url = 'MAILTO:'.$url; |
358 | 356 | } |
@@ -360,13 +358,13 @@ discard block |
||
360 | 358 | { |
361 | 359 | $url = 'urn:uuid:'.common::generate_uid('accounts', $taskData['info_owner']); |
362 | 360 | } |
363 | - $vevent->setAttribute('ORGANIZER',$url,array( |
|
364 | - 'CN' => $GLOBALS['egw']->accounts->id2name($taskData['info_owner'],'account_fullname'), |
|
361 | + $vevent->setAttribute('ORGANIZER', $url, array( |
|
362 | + 'CN' => $GLOBALS['egw']->accounts->id2name($taskData['info_owner'], 'account_fullname'), |
|
365 | 363 | 'X-EGROUPWARE-UID' => $taskData['info_owner'], |
366 | 364 | ), true); |
367 | - foreach($taskData['info_responsible'] as $responsible) |
|
365 | + foreach ($taskData['info_responsible'] as $responsible) |
|
368 | 366 | { |
369 | - if (($url = $GLOBALS['egw']->accounts->id2name($responsible,'account_email'))) |
|
367 | + if (($url = $GLOBALS['egw']->accounts->id2name($responsible, 'account_email'))) |
|
370 | 368 | { |
371 | 369 | $url = 'MAILTO:'.$url; |
372 | 370 | } |
@@ -376,15 +374,15 @@ discard block |
||
376 | 374 | } |
377 | 375 | if ($responsible > 0) |
378 | 376 | { |
379 | - $vevent->setAttribute('ATTENDEE',$url,array( |
|
380 | - 'CN' => $GLOBALS['egw']->accounts->id2name($responsible,'account_fullname'), |
|
377 | + $vevent->setAttribute('ATTENDEE', $url, array( |
|
378 | + 'CN' => $GLOBALS['egw']->accounts->id2name($responsible, 'account_fullname'), |
|
381 | 379 | 'CUTYPE' => 'INDIVIDUAL', |
382 | 380 | 'X-EGROUPWARE-UID' => $responsible, |
383 | 381 | ), true); |
384 | 382 | } |
385 | 383 | elseif ($responsible < 0) |
386 | 384 | { |
387 | - $vevent->setAttribute('ATTENDEE',$url,array( |
|
385 | + $vevent->setAttribute('ATTENDEE', $url, array( |
|
388 | 386 | 'CN' => $GLOBALS['egw']->accounts->id2name($responsible), |
389 | 387 | 'CUTYPE' => 'GROUP', |
390 | 388 | 'X-EGROUPWARE-UID' => $responsible, |
@@ -395,17 +393,17 @@ discard block |
||
395 | 393 | // for CalDAV add all X-Properties previously parsed |
396 | 394 | if ($this->productManufacturer == 'groupdav') |
397 | 395 | { |
398 | - foreach($taskData as $name => $value) |
|
396 | + foreach ($taskData as $name => $value) |
|
399 | 397 | { |
400 | 398 | if (substr($name, 0, 2) == '##') |
401 | 399 | { |
402 | 400 | if ($name[2] == ':') |
403 | 401 | { |
404 | 402 | if (($v = json_php_unserialize($value)) && is_array($v)) $value = $v; |
405 | - foreach((array)$value as $compvData) |
|
403 | + foreach ((array)$value as $compvData) |
|
406 | 404 | { |
407 | - $comp = Horde_Icalendar::newComponent(substr($name,3), $vevent); |
|
408 | - $comp->parsevCalendar($compvData,substr($name,3)); |
|
405 | + $comp = Horde_Icalendar::newComponent(substr($name, 3), $vevent); |
|
406 | + $comp->parsevCalendar($compvData, substr($name, 3)); |
|
409 | 407 | $vevent->addComponent($comp); |
410 | 408 | } |
411 | 409 | } |
@@ -425,8 +423,8 @@ discard block |
||
425 | 423 | $retval = $vcal->exportvCalendar(); |
426 | 424 | if ($this->log) |
427 | 425 | { |
428 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
429 | - array2string($retval)."\n",3,$this->logfile); |
|
426 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
427 | + array2string($retval)."\n", 3, $this->logfile); |
|
430 | 428 | } |
431 | 429 | // Horde::logMessage("exportVTODO:\n" . print_r($retval, true), |
432 | 430 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -455,7 +453,7 @@ discard block |
||
455 | 453 | } |
456 | 454 | $tz = self::$tz_cache[$tzid]; |
457 | 455 | } |
458 | - elseif(is_null($tzid)) |
|
456 | + elseif (is_null($tzid)) |
|
459 | 457 | { |
460 | 458 | $tz = egw_time::$user_timezone; |
461 | 459 | } |
@@ -463,9 +461,9 @@ discard block |
||
463 | 461 | { |
464 | 462 | $tz = egw_time::$server_timezone; |
465 | 463 | } |
466 | - if (!is_a($time,'DateTime')) |
|
464 | + if (!is_a($time, 'DateTime')) |
|
467 | 465 | { |
468 | - $time = new egw_time($time,egw_time::$server_timezone); |
|
466 | + $time = new egw_time($time, egw_time::$server_timezone); |
|
469 | 467 | } |
470 | 468 | $time->setTimezone($tz); |
471 | 469 | |
@@ -514,16 +512,16 @@ discard block |
||
514 | 512 | * signature array callback($task, $param1, ...) |
515 | 513 | * @return int|boolean integer info_id or false on error |
516 | 514 | */ |
517 | - function importVTODO(&$_vcalData, $_taskID=-1, $merge=false, $user=null, $charset=null, $caldav_name=null, |
|
518 | - array $callback_data=null) |
|
515 | + function importVTODO(&$_vcalData, $_taskID = -1, $merge = false, $user = null, $charset = null, $caldav_name = null, |
|
516 | + array $callback_data = null) |
|
519 | 517 | { |
520 | - unset($merge); // no longer used, but required by function signature |
|
518 | + unset($merge); // no longer used, but required by function signature |
|
521 | 519 | |
522 | 520 | if ($this->tzid) |
523 | 521 | { |
524 | 522 | date_default_timezone_set($this->tzid); |
525 | 523 | } |
526 | - $taskData = $this->vtodotoegw($_vcalData,$_taskID, $charset); |
|
524 | + $taskData = $this->vtodotoegw($_vcalData, $_taskID, $charset); |
|
527 | 525 | if ($this->tzid) |
528 | 526 | { |
529 | 527 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
@@ -554,8 +552,8 @@ discard block |
||
554 | 552 | |
555 | 553 | if ($this->log) |
556 | 554 | { |
557 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
558 | - array2string($taskData)."\n",3,$this->logfile); |
|
555 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
556 | + array2string($taskData)."\n", 3, $this->logfile); |
|
559 | 557 | } |
560 | 558 | |
561 | 559 | if ($caldav_name) |
@@ -564,18 +562,18 @@ discard block |
||
564 | 562 | } |
565 | 563 | |
566 | 564 | // make sure not to empty fields not supported by iCal or not allowed to change by CalDAV |
567 | - if ($_taskID > 0 && ($old = $this->read($_taskID,true,'server'))) |
|
565 | + if ($_taskID > 0 && ($old = $this->read($_taskID, true, 'server'))) |
|
568 | 566 | { |
569 | 567 | // remove all values supported by iCal standard |
570 | 568 | $old = array_diff_key($old, array_flip(array( |
571 | - 'info_subject','info_des','info_location','info_cat','info_responsible', |
|
572 | - 'info_startdate','info_enddate','info_priority','info_location', |
|
573 | - 'info_access','info_status','info_percent','info_datecompleted', |
|
569 | + 'info_subject', 'info_des', 'info_location', 'info_cat', 'info_responsible', |
|
570 | + 'info_startdate', 'info_enddate', 'info_priority', 'info_location', |
|
571 | + 'info_access', 'info_status', 'info_percent', 'info_datecompleted', |
|
574 | 572 | ))); |
575 | 573 | // remove all iCal fields not supported by EGroupware (stored like custom fields) |
576 | - foreach(array_keys($old) as $name) |
|
574 | + foreach (array_keys($old) as $name) |
|
577 | 575 | { |
578 | - if (substr($name,0,2) == '##') unset($old[$name]); |
|
576 | + if (substr($name, 0, 2) == '##') unset($old[$name]); |
|
579 | 577 | } |
580 | 578 | // merge in again all infolog fields not supported by iCal or not allowed to change |
581 | 579 | $taskData = array_merge($taskData, $old); |
@@ -600,7 +598,7 @@ discard block |
||
600 | 598 | * |
601 | 599 | * @return array of infolog_ids of matching entries |
602 | 600 | */ |
603 | - function searchVTODO($_vcalData, $contentID=null, $relax=false, $charset=null) |
|
601 | + function searchVTODO($_vcalData, $contentID = null, $relax = false, $charset = null) |
|
604 | 602 | { |
605 | 603 | $result = array(); |
606 | 604 | |
@@ -645,12 +643,12 @@ discard block |
||
645 | 643 | * |
646 | 644 | * @return array infolog entry or false on error |
647 | 645 | */ |
648 | - function vtodotoegw($_vcalData, $_taskID=-1, $charset=null) |
|
646 | + function vtodotoegw($_vcalData, $_taskID = -1, $charset = null) |
|
649 | 647 | { |
650 | 648 | if ($this->log) |
651 | 649 | { |
652 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n" . |
|
653 | - array2string($_vcalData)."\n",3,$this->logfile); |
|
650 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n". |
|
651 | + array2string($_vcalData)."\n", 3, $this->logfile); |
|
654 | 652 | } |
655 | 653 | |
656 | 654 | $vcal = new Horde_Icalendar; |
@@ -663,7 +661,7 @@ discard block |
||
663 | 661 | if ($this->log) |
664 | 662 | { |
665 | 663 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
666 | - "(): No vCalendar Container found!\n",3,$this->logfile); |
|
664 | + "(): No vCalendar Container found!\n", 3, $this->logfile); |
|
667 | 665 | } |
668 | 666 | return false; |
669 | 667 | } |
@@ -686,7 +684,7 @@ discard block |
||
686 | 684 | if ($this->log) |
687 | 685 | { |
688 | 686 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
689 | - "(): Not a vTODO container, skipping...\n",3,$this->logfile); |
|
687 | + "(): Not a vTODO container, skipping...\n", 3, $this->logfile); |
|
690 | 688 | } |
691 | 689 | continue; |
692 | 690 | } |
@@ -713,24 +711,23 @@ discard block |
||
713 | 711 | ($this->_status2vtodo[$x_infolog_status] === 'COMPLETED') != is_scalar($completed)) |
714 | 712 | { |
715 | 713 | $percent_completed = $component->getAttributeDefault('PERCENT-COMPLETE', null); |
716 | - $status = $completed && is_scalar($completed) ? 'COMPLETED' : |
|
717 | - ($percent_completed && is_scalar($percent_completed) && $percent_completed > 0 ? 'IN-PROCESS' : 'NEEDS-ACTION'); |
|
714 | + $status = $completed && is_scalar($completed) ? 'COMPLETED' : ($percent_completed && is_scalar($percent_completed) && $percent_completed > 0 ? 'IN-PROCESS' : 'NEEDS-ACTION'); |
|
718 | 715 | $component->setAttribute('STATUS', $status); |
719 | 716 | if (!is_scalar($percent_completed)) |
720 | 717 | { |
721 | 718 | $component->setAttribute('PERCENT-COMPLETE', $percent_completed = $status == 'COMPLETED' ? |
722 | 719 | 100 : ($status == 'NEEDS-ACTION' ? 0 : 10)); |
723 | 720 | } |
724 | - if ($this->log) error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n",3,$this->logfile); |
|
721 | + if ($this->log) error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n", 3, $this->logfile); |
|
725 | 722 | } |
726 | 723 | // new task without status --> set a default status of NEEDS-ACTION, as otherwise task is marked closed |
727 | - elseif($_taskID <= 0 && !is_scalar($x_infolog_status) && !is_scalar($completed)) |
|
724 | + elseif ($_taskID <= 0 && !is_scalar($x_infolog_status) && !is_scalar($completed)) |
|
728 | 725 | { |
729 | 726 | $component->setAttribute('STATUS', 'NEEDS-ACTION'); |
730 | 727 | } |
731 | 728 | else |
732 | 729 | { |
733 | - if ($this->log) error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed)?'='.$completed:' not set')." --> leaving status and percent unchanged",3,$this->logfile); |
|
730 | + if ($this->log) error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed) ? '='.$completed : ' not set')." --> leaving status and percent unchanged", 3, $this->logfile); |
|
734 | 731 | } |
735 | 732 | } |
736 | 733 | foreach ($component->getAllAttributes() as $attribute) |
@@ -774,7 +771,7 @@ discard block |
||
774 | 771 | case 'DURATION': |
775 | 772 | if (!isset($taskData['info_startdate'])) |
776 | 773 | { |
777 | - $taskData['info_startdate'] = $component->getAttributeDefault('DTSTART', null); |
|
774 | + $taskData['info_startdate'] = $component->getAttributeDefault('DTSTART', null); |
|
778 | 775 | } |
779 | 776 | $attribute['value'] += $taskData['info_startdate']; |
780 | 777 | $taskData['##DURATION'] = $attribute['value']; |
@@ -786,11 +783,11 @@ discard block |
||
786 | 783 | break; |
787 | 784 | |
788 | 785 | case 'COMPLETED': |
789 | - $taskData['info_datecompleted'] = self::date2ts($attribute['value']); |
|
786 | + $taskData['info_datecompleted'] = self::date2ts($attribute['value']); |
|
790 | 787 | break; |
791 | 788 | |
792 | 789 | case 'DTSTART': |
793 | - $taskData['info_startdate'] = self::date2ts($attribute['value']); |
|
790 | + $taskData['info_startdate'] = self::date2ts($attribute['value']); |
|
794 | 791 | break; |
795 | 792 | |
796 | 793 | case 'PRIORITY': |
@@ -800,16 +797,16 @@ discard block |
||
800 | 797 | (strpos($this->productName, 'outlook') !== false |
801 | 798 | || strpos($this->productName, 'pocket pc') !== false)) |
802 | 799 | { |
803 | - $taskData['info_priority'] = (int) $this->priority_funambol2egw[$attribute['value']]; |
|
800 | + $taskData['info_priority'] = (int)$this->priority_funambol2egw[$attribute['value']]; |
|
804 | 801 | } |
805 | 802 | else |
806 | 803 | { |
807 | - $taskData['info_priority'] = (int) $this->priority_ical2egw[$attribute['value']]; |
|
804 | + $taskData['info_priority'] = (int)$this->priority_ical2egw[$attribute['value']]; |
|
808 | 805 | } |
809 | 806 | } |
810 | 807 | else |
811 | 808 | { |
812 | - $taskData['info_priority'] = 1; // default = normal |
|
809 | + $taskData['info_priority'] = 1; // default = normal |
|
813 | 810 | } |
814 | 811 | break; |
815 | 812 | |
@@ -832,7 +829,7 @@ discard block |
||
832 | 829 | case 'CATEGORIES': |
833 | 830 | if (!empty($attribute['value'])) |
834 | 831 | { |
835 | - $cats = $this->find_or_add_categories(explode(',',$attribute['value']), $_taskID); |
|
832 | + $cats = $this->find_or_add_categories(explode(',', $attribute['value']), $_taskID); |
|
836 | 833 | $taskData['info_cat'] = $cats[0]; |
837 | 834 | } |
838 | 835 | break; |
@@ -845,7 +842,7 @@ discard block |
||
845 | 842 | break; |
846 | 843 | |
847 | 844 | case 'PERCENT-COMPLETE': |
848 | - $taskData['info_percent'] = (int) $attribute['value']; |
|
845 | + $taskData['info_percent'] = (int)$attribute['value']; |
|
849 | 846 | break; |
850 | 847 | |
851 | 848 | case 'ATTENDEE': |
@@ -887,10 +884,10 @@ discard block |
||
887 | 884 | break; |
888 | 885 | } |
889 | 886 | // store included, but unsupported components like valarm as x-properties |
890 | - foreach($component->getComponents() as $comp) |
|
887 | + foreach ($component->getComponents() as $comp) |
|
891 | 888 | { |
892 | 889 | $name = '##:'.strtoupper($comp->getType()); |
893 | - $compvData = $comp->exportvCalendar($comp,'utf-8'); |
|
890 | + $compvData = $comp->exportvCalendar($comp, 'utf-8'); |
|
894 | 891 | if (isset($taskData[$name])) |
895 | 892 | { |
896 | 893 | $taskData[$name] = array($taskData[$name]); |
@@ -903,8 +900,8 @@ discard block |
||
903 | 900 | } |
904 | 901 | if ($this->log) |
905 | 902 | { |
906 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n" . |
|
907 | - ($taskData ? array2string($taskData) : 'FALSE') . "\n",3,$this->logfile); |
|
903 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n". |
|
904 | + ($taskData ? array2string($taskData) : 'FALSE')."\n", 3, $this->logfile); |
|
908 | 905 | } |
909 | 906 | return $taskData; |
910 | 907 | } |
@@ -918,14 +915,14 @@ discard block |
||
918 | 915 | * |
919 | 916 | * @return string|boolean VNOTE representation of the infolog entry or false on error |
920 | 917 | */ |
921 | - function exportVNOTE($_noteID, $_type, $charset='UTF-8') |
|
918 | + function exportVNOTE($_noteID, $_type, $charset = 'UTF-8') |
|
922 | 919 | { |
923 | - if(!($note = $this->read($_noteID, true, 'server'))) return false; |
|
920 | + if (!($note = $this->read($_noteID, true, 'server'))) return false; |
|
924 | 921 | |
925 | 922 | $note = translation::convert($note, |
926 | 923 | translation::charset(), $charset); |
927 | 924 | |
928 | - switch ($_type) |
|
925 | + switch ($_type) |
|
929 | 926 | { |
930 | 927 | case 'text/plain': |
931 | 928 | $txt = $note['info_subject']."\n\n".$note['info_des']; |
@@ -939,10 +936,10 @@ discard block |
||
939 | 936 | translation::charset(), $charset); |
940 | 937 | } |
941 | 938 | $vnote = new Horde_Icalendar_Vnote(); |
942 | - $vnote->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
939 | + $vnote->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
943 | 940 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
944 | 941 | $vnote->setAttribute('VERSION', '1.1'); |
945 | - foreach (array( 'SUMMARY' => $note['info_subject'], |
|
942 | + foreach (array('SUMMARY' => $note['info_subject'], |
|
946 | 943 | 'BODY' => $note['info_des'], |
947 | 944 | 'CATEGORIES' => $note['info_cat'], |
948 | 945 | ) as $field => $value) |
@@ -950,7 +947,7 @@ discard block |
||
950 | 947 | $options = array(); |
951 | 948 | if (preg_match('/[^\x20-\x7F]/', $value)) |
952 | 949 | { |
953 | - $options['CHARSET'] = $charset; |
|
950 | + $options['CHARSET'] = $charset; |
|
954 | 951 | switch ($this->productManufacturer) |
955 | 952 | { |
956 | 953 | case 'groupdav': |
@@ -980,21 +977,21 @@ discard block |
||
980 | 977 | } |
981 | 978 | if ($note['info_startdate']) |
982 | 979 | { |
983 | - $vnote->setAttribute('CREATED',$note['info_startdate']); |
|
980 | + $vnote->setAttribute('CREATED', $note['info_startdate']); |
|
984 | 981 | } |
985 | 982 | else |
986 | 983 | { |
987 | - $vnote->setAttribute('CREATED',$GLOBALS['egw']->contenthistory->getTSforAction('infolog_note',$_noteID,'add')); |
|
984 | + $vnote->setAttribute('CREATED', $GLOBALS['egw']->contenthistory->getTSforAction('infolog_note', $_noteID, 'add')); |
|
988 | 985 | } |
989 | - $vnote->setAttribute('LAST-MODIFIED',$GLOBALS['egw']->contenthistory->getTSforAction('infolog_note',$_noteID,'modify')); |
|
986 | + $vnote->setAttribute('LAST-MODIFIED', $GLOBALS['egw']->contenthistory->getTSforAction('infolog_note', $_noteID, 'modify')); |
|
990 | 987 | |
991 | 988 | #$vnote->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE'); |
992 | 989 | |
993 | 990 | $retval = $vnote->exportvCalendar(); |
994 | 991 | if ($this->log) |
995 | 992 | { |
996 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
997 | - array2string($retval)."\n",3,$this->logfile); |
|
993 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
994 | + array2string($retval)."\n", 3, $this->logfile); |
|
998 | 995 | } |
999 | 996 | return $retval; |
1000 | 997 | } |
@@ -1013,25 +1010,25 @@ discard block |
||
1013 | 1010 | * |
1014 | 1011 | * @return int|boolean integer info_id or false on error |
1015 | 1012 | */ |
1016 | - function importVNOTE(&$_vcalData, $_type, $_noteID=-1, $merge=false, $charset=null) |
|
1013 | + function importVNOTE(&$_vcalData, $_type, $_noteID = -1, $merge = false, $charset = null) |
|
1017 | 1014 | { |
1018 | - unset($merge); // no longer used, but required by function signature |
|
1015 | + unset($merge); // no longer used, but required by function signature |
|
1019 | 1016 | if ($this->log) |
1020 | 1017 | { |
1021 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
1022 | - array2string($_vcalData)."\n",3,$this->logfile); |
|
1018 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
1019 | + array2string($_vcalData)."\n", 3, $this->logfile); |
|
1023 | 1020 | } |
1024 | 1021 | |
1025 | 1022 | if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID, $charset))) return false; |
1026 | 1023 | |
1027 | - if($_noteID > 0) $note['info_id'] = $_noteID; |
|
1024 | + if ($_noteID > 0) $note['info_id'] = $_noteID; |
|
1028 | 1025 | |
1029 | 1026 | if (empty($note['info_status'])) $note['info_status'] = 'done'; |
1030 | 1027 | |
1031 | 1028 | if ($this->log) |
1032 | 1029 | { |
1033 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
1034 | - array2string($note)."\n",3,$this->logfile); |
|
1030 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
1031 | + array2string($note)."\n", 3, $this->logfile); |
|
1035 | 1032 | } |
1036 | 1033 | |
1037 | 1034 | return $this->write($note, true, true, false); |
@@ -1048,7 +1045,7 @@ discard block |
||
1048 | 1045 | * |
1049 | 1046 | * @return infolog_id of a matching entry or false, if nothing was found |
1050 | 1047 | */ |
1051 | - function searchVNOTE($_vcalData, $_type, $contentID=null, $relax=false, $charset=null) |
|
1048 | + function searchVNOTE($_vcalData, $_type, $contentID = null, $relax = false, $charset = null) |
|
1052 | 1049 | { |
1053 | 1050 | if (!($note = $this->vnotetoegw($_vcalData, $_type, $contentID, $charset))) return array(); |
1054 | 1051 | |
@@ -1070,12 +1067,12 @@ discard block |
||
1070 | 1067 | * |
1071 | 1068 | * @return array infolog entry or false on error |
1072 | 1069 | */ |
1073 | - function vnotetoegw($_data, $_type, $_noteID=-1, $charset=null) |
|
1070 | + function vnotetoegw($_data, $_type, $_noteID = -1, $charset = null) |
|
1074 | 1071 | { |
1075 | 1072 | if ($this->log) |
1076 | 1073 | { |
1077 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n" . |
|
1078 | - array2string($_data)."\n",3,$this->logfile); |
|
1074 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n". |
|
1075 | + array2string($_data)."\n", 3, $this->logfile); |
|
1079 | 1076 | } |
1080 | 1077 | $note = false; |
1081 | 1078 | |
@@ -1129,7 +1126,7 @@ discard block |
||
1129 | 1126 | case 'CATEGORIES': |
1130 | 1127 | if ($attribute['value']) |
1131 | 1128 | { |
1132 | - $cats = $this->find_or_add_categories(explode(',',$attribute['value']), $_noteID); |
|
1129 | + $cats = $this->find_or_add_categories(explode(',', $attribute['value']), $_noteID); |
|
1133 | 1130 | $note['info_cat'] = $cats[0]; |
1134 | 1131 | } |
1135 | 1132 | break; |
@@ -1140,8 +1137,8 @@ discard block |
||
1140 | 1137 | } |
1141 | 1138 | if ($this->log) |
1142 | 1139 | { |
1143 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n" . |
|
1144 | - ($note ? array2string($note) : 'FALSE') ."\n",3,$this->logfile); |
|
1140 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n". |
|
1141 | + ($note ? array2string($note) : 'FALSE')."\n", 3, $this->logfile); |
|
1145 | 1142 | } |
1146 | 1143 | return $note; |
1147 | 1144 | } |
@@ -1154,7 +1151,7 @@ discard block |
||
1154 | 1151 | * @param string $_productManufacturer |
1155 | 1152 | * @param string $_productName |
1156 | 1153 | */ |
1157 | - function setSupportedFields($_productManufacturer='', $_productName='') |
|
1154 | + function setSupportedFields($_productManufacturer = '', $_productName = '') |
|
1158 | 1155 | { |
1159 | 1156 | $state = &$_SESSION['SyncML.state']; |
1160 | 1157 | if (isset($state)) |
@@ -1206,10 +1203,10 @@ discard block |
||
1206 | 1203 | if ($this->log) |
1207 | 1204 | { |
1208 | 1205 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
1209 | - '(' . $this->productManufacturer . |
|
1210 | - ', '. $this->productName .', ' . |
|
1211 | - ($this->tzid ? $this->tzid : egw_time::$user_timezone->getName()) . |
|
1212 | - ")\n" , 3, $this->logfile); |
|
1206 | + '('.$this->productManufacturer. |
|
1207 | + ', '.$this->productName.', '. |
|
1208 | + ($this->tzid ? $this->tzid : egw_time::$user_timezone->getName()). |
|
1209 | + ")\n", 3, $this->logfile); |
|
1213 | 1210 | } |
1214 | 1211 | |
1215 | 1212 | //Horde::logMessage('setSupportedFields(' . $this->productManufacturer . ', ' |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | if (!is_array($content)) |
36 | 36 | { |
37 | - $content= array(); |
|
37 | + $content = array(); |
|
38 | 38 | } |
39 | 39 | else |
40 | 40 | { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password'); |
57 | 57 | $tmpl = new Etemplate('preferences.password'); |
58 | 58 | |
59 | - $tmpl->exec('preferences.preferences_password.change', $content,array(),array(),array(),2); |
|
59 | + $tmpl->exec('preferences.preferences_password.change', $content, array(), array(), array(), 2); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -2,7 +2,7 @@ |
||
2 | 2 | // dummy setup file |
3 | 3 | if (strpos($_SERVER['PHP_SELF'],'/setup/') === false) |
4 | 4 | { |
5 | - header('Location: /egroupware/setup/'); |
|
6 | - exit; |
|
5 | + header('Location: /egroupware/setup/'); |
|
6 | + exit; |
|
7 | 7 | } |
8 | 8 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | // dummy setup file |
3 | -if (strpos($_SERVER['PHP_SELF'],'/setup/') === false) |
|
3 | +if (strpos($_SERVER['PHP_SELF'], '/setup/') === false) |
|
4 | 4 | { |
5 | 5 | header('Location: /egroupware/setup/'); |
6 | 6 | exit; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Exports records as defined in $_definition |
31 | 31 | * |
32 | - * @param egw_record $_definition |
|
32 | + * @param importexport_definition $_definition |
|
33 | 33 | */ |
34 | 34 | public function export( $_stream, importexport_definition $_definition) { |
35 | 35 | $options = $_definition->plugin_options; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @param egw_record $_definition |
24 | 24 | */ |
25 | - public function export( $_stream, importexport_definition $_definition) { |
|
25 | + public function export($_stream, importexport_definition $_definition) { |
|
26 | 26 | |
27 | 27 | $options = $_definition->plugin_options; |
28 | 28 | $this->uicontacts = new addressbook_ui(); |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | // Addressbook defines its own export imits |
32 | 32 | $limit_exception = bo_merge::is_export_limit_excepted(); |
33 | - $export_limit = bo_merge::getExportLimit($app='addressbook'); |
|
33 | + $export_limit = bo_merge::getExportLimit($app = 'addressbook'); |
|
34 | 34 | if (!$limit_exception) $export_object->export_limit = $export_limit; // we may not need that after all |
35 | - if($export_limit == 'no' && !$limit_exception) { |
|
35 | + if ($export_limit == 'no' && !$limit_exception) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
@@ -42,29 +42,29 @@ discard block |
||
42 | 42 | |
43 | 43 | if ($options['selection'] == 'search') { |
44 | 44 | // uicontacts selection with checkbox 'use_all' |
45 | - $query = $GLOBALS['egw']->session->appsession('index','addressbook'); |
|
46 | - $query['num_rows'] = -1; // all |
|
47 | - $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
48 | - if(!array_key_exists('filter',$query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id']; |
|
49 | - $this->uicontacts->get_rows($query,$this->selection,$readonlys, true); // only return the ids |
|
45 | + $query = $GLOBALS['egw']->session->appsession('index', 'addressbook'); |
|
46 | + $query['num_rows'] = -1; // all |
|
47 | + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
48 | + if (!array_key_exists('filter', $query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id']; |
|
49 | + $this->uicontacts->get_rows($query, $this->selection, $readonlys, true); // only return the ids |
|
50 | 50 | } |
51 | - elseif ( $options['selection'] == 'all' ) { |
|
51 | + elseif ($options['selection'] == 'all') { |
|
52 | 52 | if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) { |
53 | 53 | $col_filter['account_id'] = null; |
54 | 54 | } |
55 | - $this->selection = ExecMethod2('addressbook.addressbook_bo.search', array(), true, '', '','',false,'AND',false,$col_filter); |
|
55 | + $this->selection = ExecMethod2('addressbook.addressbook_bo.search', array(), true, '', '', '', false, 'AND', false, $col_filter); |
|
56 | 56 | //$this->uicontacts->get_rows($query,$this->selection,$readonlys,true); |
57 | 57 | } else { |
58 | - $this->selection = explode(',',$options['selection']); |
|
58 | + $this->selection = explode(',', $options['selection']); |
|
59 | 59 | } |
60 | 60 | $GLOBALS['egw_info']['flags']['currentapp'] = $old_app; |
61 | 61 | |
62 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
62 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
63 | 63 | $this->selection = array_slice($this->selection, 0, $export_limit); |
64 | 64 | } |
65 | 65 | |
66 | 66 | foreach ($this->selection as &$_contact) { |
67 | - if(is_array($_contact) && ($_contact['id'] || $_contact['contact_id'])) |
|
67 | + if (is_array($_contact) && ($_contact['id'] || $_contact['contact_id'])) |
|
68 | 68 | { |
69 | 69 | $_contact = $_contact[$_contact['id'] ? 'id' : 'contact_id']; |
70 | 70 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // vCard opens & closes the resource itself, but this doesn't seem to matter |
74 | 74 | $meta = stream_get_meta_data($_stream); |
75 | 75 | |
76 | - $vcard = new addressbook_vcal('addressbook','text/vcard'); |
|
76 | + $vcard = new addressbook_vcal('addressbook', 'text/vcard'); |
|
77 | 77 | $vcard->export($this->selection, $meta['uri']); |
78 | 78 | } |
79 | 79 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function get_filename() |
116 | 116 | { |
117 | - if(is_array($this->selection) && count($this->selection) == 1) |
|
117 | + if (is_array($this->selection) && count($this->selection) == 1) |
|
118 | 118 | { |
119 | 119 | return $this->uicontacts->link_title($this->selection[0]); |
120 | 120 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * export addressbook contacts as vcard |
16 | 16 | */ |
17 | -class addressbook_export_vcard implements importexport_iface_export_plugin { |
|
17 | +class addressbook_export_vcard implements importexport_iface_export_plugin |
|
18 | +{ |
|
18 | 19 | |
19 | 20 | |
20 | 21 | /** |
@@ -22,7 +23,8 @@ discard block |
||
22 | 23 | * |
23 | 24 | * @param egw_record $_definition |
24 | 25 | */ |
25 | - public function export( $_stream, importexport_definition $_definition) { |
|
26 | + public function export( $_stream, importexport_definition $_definition) |
|
27 | + { |
|
26 | 28 | |
27 | 29 | $options = $_definition->plugin_options; |
28 | 30 | $this->uicontacts = new addressbook_ui(); |
@@ -31,8 +33,13 @@ discard block |
||
31 | 33 | // Addressbook defines its own export imits |
32 | 34 | $limit_exception = bo_merge::is_export_limit_excepted(); |
33 | 35 | $export_limit = bo_merge::getExportLimit($app='addressbook'); |
34 | - if (!$limit_exception) $export_object->export_limit = $export_limit; // we may not need that after all |
|
35 | - if($export_limit == 'no' && !$limit_exception) { |
|
36 | + if (!$limit_exception) |
|
37 | + { |
|
38 | + $export_object->export_limit = $export_limit; |
|
39 | + } |
|
40 | + // we may not need that after all |
|
41 | + if($export_limit == 'no' && !$limit_exception) |
|
42 | + { |
|
36 | 43 | return; |
37 | 44 | } |
38 | 45 | |
@@ -40,30 +47,40 @@ discard block |
||
40 | 47 | $old_app = $GLOBALS['egw_info']['flags']['currentapp']; |
41 | 48 | $GLOBALS['egw_info']['flags']['currentapp'] = 'addressbook'; |
42 | 49 | |
43 | - if ($options['selection'] == 'search') { |
|
50 | + if ($options['selection'] == 'search') |
|
51 | + { |
|
44 | 52 | // uicontacts selection with checkbox 'use_all' |
45 | 53 | $query = $GLOBALS['egw']->session->appsession('index','addressbook'); |
46 | 54 | $query['num_rows'] = -1; // all |
47 | 55 | $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
48 | - if(!array_key_exists('filter',$query)) $query['filter'] = $GLOBALS['egw_info']['user']['account_id']; |
|
56 | + if(!array_key_exists('filter',$query)) |
|
57 | + { |
|
58 | + $query['filter'] = $GLOBALS['egw_info']['user']['account_id']; |
|
59 | + } |
|
49 | 60 | $this->uicontacts->get_rows($query,$this->selection,$readonlys, true); // only return the ids |
50 | 61 | } |
51 | - elseif ( $options['selection'] == 'all' ) { |
|
52 | - if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) { |
|
62 | + elseif ( $options['selection'] == 'all' ) |
|
63 | + { |
|
64 | + if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) |
|
65 | + { |
|
53 | 66 | $col_filter['account_id'] = null; |
54 | 67 | } |
55 | 68 | $this->selection = ExecMethod2('addressbook.addressbook_bo.search', array(), true, '', '','',false,'AND',false,$col_filter); |
56 | 69 | //$this->uicontacts->get_rows($query,$this->selection,$readonlys,true); |
57 | - } else { |
|
70 | + } |
|
71 | + else |
|
72 | + { |
|
58 | 73 | $this->selection = explode(',',$options['selection']); |
59 | 74 | } |
60 | 75 | $GLOBALS['egw_info']['flags']['currentapp'] = $old_app; |
61 | 76 | |
62 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
77 | + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
78 | + { |
|
63 | 79 | $this->selection = array_slice($this->selection, 0, $export_limit); |
64 | 80 | } |
65 | 81 | |
66 | - foreach ($this->selection as &$_contact) { |
|
82 | + foreach ($this->selection as &$_contact) |
|
83 | + { |
|
67 | 84 | if(is_array($_contact) && ($_contact['id'] || $_contact['contact_id'])) |
68 | 85 | { |
69 | 86 | $_contact = $_contact[$_contact['id'] ? 'id' : 'contact_id']; |
@@ -82,7 +99,8 @@ discard block |
||
82 | 99 | * |
83 | 100 | * @return string name |
84 | 101 | */ |
85 | - public static function get_name() { |
|
102 | + public static function get_name() |
|
103 | + { |
|
86 | 104 | return lang('Addressbook vCard export'); |
87 | 105 | } |
88 | 106 | |
@@ -91,7 +109,8 @@ discard block |
||
91 | 109 | * |
92 | 110 | * @return string descriprion |
93 | 111 | */ |
94 | - public static function get_description() { |
|
112 | + public static function get_description() |
|
113 | + { |
|
95 | 114 | return lang("Exports contacts from your Addressbook into a vCard File."); |
96 | 115 | } |
97 | 116 | |
@@ -100,11 +119,13 @@ discard block |
||
100 | 119 | * |
101 | 120 | * @return string suffix |
102 | 121 | */ |
103 | - public static function get_filesuffix() { |
|
122 | + public static function get_filesuffix() |
|
123 | + { |
|
104 | 124 | return 'vcf'; |
105 | 125 | } |
106 | 126 | |
107 | - public static function get_mimetype() { |
|
127 | + public static function get_mimetype() |
|
128 | + { |
|
108 | 129 | return 'text/x-vcard'; |
109 | 130 | } |
110 | 131 | |
@@ -127,14 +148,16 @@ discard block |
||
127 | 148 | * |
128 | 149 | * @return string html |
129 | 150 | */ |
130 | - public function get_options_etpl() { |
|
151 | + public function get_options_etpl() |
|
152 | + { |
|
131 | 153 | } |
132 | 154 | |
133 | 155 | /** |
134 | 156 | * returns slectors of this plugin via xajax |
135 | 157 | * |
136 | 158 | */ |
137 | - public function get_selectors_etpl() { |
|
159 | + public function get_selectors_etpl() |
|
160 | + { |
|
138 | 161 | return array( |
139 | 162 | 'name' => 'addressbook.export_vcard_selectors', |
140 | 163 | 'content' => 'all', |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Exports records as defined in $_definition |
31 | 31 | * |
32 | - * @param egw_record $_definition |
|
32 | + * @param importexport_definition $_definition |
|
33 | 33 | */ |
34 | 34 | public function export( $_stream, importexport_definition $_definition) { |
35 | 35 | $options = $_definition->plugin_options; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param egw_record $_definition |
23 | 23 | */ |
24 | - public function export( $_stream, importexport_definition $_definition) { |
|
24 | + public function export($_stream, importexport_definition $_definition) { |
|
25 | 25 | $options = $_definition->plugin_options; |
26 | 26 | $this->bo = new calendar_bo(); |
27 | 27 | $boical = new calendar_ical(); |
@@ -32,34 +32,34 @@ discard block |
||
32 | 32 | $limit_exception = bo_merge::is_export_limit_excepted(); |
33 | 33 | if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar'); |
34 | 34 | |
35 | - if($options['selection'] == 'criteria') |
|
35 | + if ($options['selection'] == 'criteria') |
|
36 | 36 | { |
37 | 37 | $query = array( |
38 | 38 | 'start' => $options['criteria']['start'], |
39 | - 'end' => strtotime('+1 day',$options['criteria']['end'])-1, |
|
39 | + 'end' => strtotime('+1 day', $options['criteria']['end']) - 1, |
|
40 | 40 | 'categories' => $options['categories'], |
41 | 41 | 'daywise' => false, |
42 | 42 | 'users' => $options['criteria']['owner'], |
43 | 43 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
44 | 44 | ); |
45 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
45 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
46 | 46 | $query['offset'] = 0; |
47 | - $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
47 | + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
48 | 48 | } |
49 | - $events =& $this->bo->search($query); |
|
49 | + $events = & $this->bo->search($query); |
|
50 | 50 | } |
51 | 51 | // Scheduled export will use 'all', which we don't allow through UI |
52 | 52 | elseif ($options['selection'] == 'search_results' || $options['selection'] == 'all') |
53 | 53 | { |
54 | - $states = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
55 | - if($states['view'] == 'listview') |
|
54 | + $states = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
55 | + if ($states['view'] == 'listview') |
|
56 | 56 | { |
57 | - $query = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); |
|
58 | - $query['num_rows'] = -1; // all |
|
57 | + $query = $GLOBALS['egw']->session->appsession('calendar_list', 'calendar'); |
|
58 | + $query['num_rows'] = -1; // all |
|
59 | 59 | $query['start'] = 0; |
60 | 60 | $query['cfs'] = $cfs; |
61 | 61 | |
62 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
62 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
63 | 63 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
64 | 64 | } |
65 | 65 | $ui = new calendar_uilist(); |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | } |
69 | 69 | else |
70 | 70 | { |
71 | - $query = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
71 | + $query = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
72 | 72 | $query['users'] = explode(',', $query['owner']); |
73 | 73 | $query['num_rows'] = -1; |
74 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
74 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
75 | 75 | { |
76 | - $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
76 | + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
77 | 77 | } |
78 | 78 | |
79 | - switch($states['view']) |
|
79 | + switch ($states['view']) |
|
80 | 80 | { |
81 | 81 | case 'month': |
82 | 82 | $query += calendar_export_csv::get_query_month($states); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | default: |
91 | 91 | // Let UI set the date ranges |
92 | 92 | $ui = new calendar_uiviews($query); |
93 | - if(method_exists($ui, $states['view'])) |
|
93 | + if (method_exists($ui, $states['view'])) |
|
94 | 94 | { |
95 | 95 | ob_start(); |
96 | 96 | $ui->$states['view'](); |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | // compile list of unique cal_id's, as iCal should contain whole series, not recurrences |
113 | 113 | // calendar_ical->exportVCal needs to read events again, to get them in server-time |
114 | 114 | $ids = array(); |
115 | - foreach($events as $event) |
|
115 | + foreach ($events as $event) |
|
116 | 116 | { |
117 | 117 | $id = is_array($event) ? $event['id'] : $event; |
118 | 118 | if (($id = (int)$id)) $ids[$id] = $id; |
119 | 119 | } |
120 | 120 | |
121 | - $ical =& $boical->exportVCal($ids,'2.0','PUBLISH',false); |
|
121 | + $ical = & $boical->exportVCal($ids, '2.0', 'PUBLISH', false); |
|
122 | 122 | fwrite($_stream, $ical); |
123 | 123 | } |
124 | 124 |
@@ -14,14 +14,16 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * iCal export plugin of calendar |
16 | 16 | */ |
17 | -class calendar_export_ical extends calendar_export_csv { |
|
17 | +class calendar_export_ical extends calendar_export_csv |
|
18 | +{ |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Exports records as defined in $_definition |
21 | 22 | * |
22 | 23 | * @param egw_record $_definition |
23 | 24 | */ |
24 | - public function export( $_stream, importexport_definition $_definition) { |
|
25 | + public function export( $_stream, importexport_definition $_definition) |
|
26 | + { |
|
25 | 27 | $options = $_definition->plugin_options; |
26 | 28 | $this->bo = new calendar_bo(); |
27 | 29 | $boical = new calendar_ical(); |
@@ -30,7 +32,10 @@ discard block |
||
30 | 32 | $cfs = array(); |
31 | 33 | |
32 | 34 | $limit_exception = bo_merge::is_export_limit_excepted(); |
33 | - if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar'); |
|
35 | + if (!$limit_exception) |
|
36 | + { |
|
37 | + $export_limit = bo_merge::getExportLimit('calendar'); |
|
38 | + } |
|
34 | 39 | |
35 | 40 | if($options['selection'] == 'criteria') |
36 | 41 | { |
@@ -42,7 +47,8 @@ discard block |
||
42 | 47 | 'users' => $options['criteria']['owner'], |
43 | 48 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
44 | 49 | ); |
45 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
50 | + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
51 | + { |
|
46 | 52 | $query['offset'] = 0; |
47 | 53 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
48 | 54 | } |
@@ -59,7 +65,8 @@ discard block |
||
59 | 65 | $query['start'] = 0; |
60 | 66 | $query['cfs'] = $cfs; |
61 | 67 | |
62 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
68 | + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
69 | + { |
|
63 | 70 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
64 | 71 | } |
65 | 72 | $ui = new calendar_uilist(); |
@@ -115,7 +122,10 @@ discard block |
||
115 | 122 | foreach($events as $event) |
116 | 123 | { |
117 | 124 | $id = is_array($event) ? $event['id'] : $event; |
118 | - if (($id = (int)$id)) $ids[$id] = $id; |
|
125 | + if (($id = (int)$id)) |
|
126 | + { |
|
127 | + $ids[$id] = $id; |
|
128 | + } |
|
119 | 129 | } |
120 | 130 | |
121 | 131 | $ical =& $boical->exportVCal($ids,'2.0','PUBLISH',false); |
@@ -127,7 +137,8 @@ discard block |
||
127 | 137 | * |
128 | 138 | * @return string name |
129 | 139 | */ |
130 | - public static function get_name() { |
|
140 | + public static function get_name() |
|
141 | + { |
|
131 | 142 | return lang('Calendar iCal export'); |
132 | 143 | } |
133 | 144 | |
@@ -136,7 +147,8 @@ discard block |
||
136 | 147 | * |
137 | 148 | * @return string descriprion |
138 | 149 | */ |
139 | - public static function get_description() { |
|
150 | + public static function get_description() |
|
151 | + { |
|
140 | 152 | return lang("Exports events from your Calendar in iCal format."); |
141 | 153 | } |
142 | 154 | |
@@ -145,11 +157,13 @@ discard block |
||
145 | 157 | * |
146 | 158 | * @return string suffix |
147 | 159 | */ |
148 | - public static function get_filesuffix() { |
|
160 | + public static function get_filesuffix() |
|
161 | + { |
|
149 | 162 | return 'ics'; |
150 | 163 | } |
151 | 164 | |
152 | - public static function get_mimetype() { |
|
165 | + public static function get_mimetype() |
|
166 | + { |
|
153 | 167 | return 'text/calendar'; |
154 | 168 | } |
155 | 169 | |
@@ -157,14 +171,16 @@ discard block |
||
157 | 171 | * return html for options. |
158 | 172 | * |
159 | 173 | */ |
160 | - public function get_options_etpl() { |
|
174 | + public function get_options_etpl() |
|
175 | + { |
|
161 | 176 | } |
162 | 177 | |
163 | 178 | /** |
164 | 179 | * returns selectors of this plugin |
165 | 180 | * |
166 | 181 | */ |
167 | - public function get_selectors_etpl($definition = null) { |
|
182 | + public function get_selectors_etpl($definition = null) |
|
183 | + { |
|
168 | 184 | $data = parent::get_selectors_etpl($definition); |
169 | 185 | return $data; |
170 | 186 | } |
@@ -127,8 +127,7 @@ |
||
127 | 127 | /** |
128 | 128 | * Show files shared |
129 | 129 | * |
130 | - * @param array $content=null |
|
131 | - * @param string $msg='' |
|
130 | + * @param array $content |
|
132 | 131 | */ |
133 | 132 | public function index(array $content=null) |
134 | 133 | { |
@@ -131,7 +131,10 @@ discard block |
||
131 | 131 | ($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount'])) |
132 | 132 | { |
133 | 133 | $url = str_replace('$path',$path,$content['mounts']['url']); |
134 | - if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path; |
|
134 | + if (empty($url) && $this->versioning) |
|
135 | + { |
|
136 | + $url = Versioning\StreamWrapper::PREFIX.$path; |
|
137 | + } |
|
135 | 138 | |
136 | 139 | if ($content['mounts']['enable'] && !$this->versioning) |
137 | 140 | { |
@@ -227,16 +230,25 @@ discard block |
||
227 | 230 | $content['versionedpath'] = '/'; |
228 | 231 | $content['mtime'] = 100; |
229 | 232 | } |
230 | - if (true) $content = array( |
|
233 | + if (true) |
|
234 | + { |
|
235 | + $content = array( |
|
231 | 236 | 'versionedpath' => $content['versionedpath'], |
232 | 237 | 'mtime' => $content['mtime'], |
233 | 238 | ); |
239 | + } |
|
234 | 240 | if ($this->versioning) |
235 | 241 | { |
236 | 242 | // statistical information |
237 | 243 | $content += Versioning\StreamWrapper::summary(); |
238 | - if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
239 | - if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
244 | + if ($content['total_files']) |
|
245 | + { |
|
246 | + $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
247 | + } |
|
248 | + if ($content['total_size']) |
|
249 | + { |
|
250 | + $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
251 | + } |
|
240 | 252 | } |
241 | 253 | if (!($content['is_root']=Vfs::$is_root)) |
242 | 254 | { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | // sudo handling |
63 | 63 | parent::__construct(); |
64 | - self::$is_setup = egw_session::appsession('is_setup','filemanager'); |
|
64 | + self::$is_setup = egw_session::appsession('is_setup', 'filemanager'); |
|
65 | 65 | |
66 | 66 | if (class_exists('EGroupware\Stylite\Vfs\Versioning\StreamWrapper')) |
67 | 67 | { |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | * @param array $content=null |
76 | 76 | * @param string $msg='' |
77 | 77 | */ |
78 | - public function index(array $content=null, $msg='', $msg_type=null) |
|
78 | + public function index(array $content = null, $msg = '', $msg_type = null) |
|
79 | 79 | { |
80 | 80 | if (is_array($content)) |
81 | 81 | { |
82 | 82 | //_debug_array($content); |
83 | 83 | if ($content['sudo']) |
84 | 84 | { |
85 | - $msg = $this->sudo($content['user'],$content['password'],self::$is_setup) ? |
|
85 | + $msg = $this->sudo($content['user'], $content['password'], self::$is_setup) ? |
|
86 | 86 | lang('Root access granted.') : lang('Wrong username or password!'); |
87 | 87 | $msg_type = Vfs::$is_root ? 'success' : 'error'; |
88 | 88 | } |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | $backup = Vfs::$is_root; |
94 | 94 | Vfs::$is_root = true; |
95 | 95 | $msg = Vfs::mount($url, $path) ? |
96 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
96 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
97 | 97 | Vfs::$is_root = $backup; |
98 | 98 | } |
99 | 99 | elseif (Vfs::$is_root) |
100 | 100 | { |
101 | 101 | if ($content['logout']) |
102 | 102 | { |
103 | - $msg = $this->sudo('','',self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.'); |
|
103 | + $msg = $this->sudo('', '', self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.'); |
|
104 | 104 | $msg_type = !Vfs::$is_root ? 'success' : 'error'; |
105 | 105 | } |
106 | 106 | if ($content['mounts']['disable'] || self::$is_setup && $content['mounts']['umount']) |
@@ -116,18 +116,18 @@ discard block |
||
116 | 116 | if (!in_array($path, self::$protected_path) && $path != '/') |
117 | 117 | { |
118 | 118 | $msg = Vfs::umount($path) ? |
119 | - lang('%1 successful unmounted.',$path) : lang('Error unmounting %1!',$path); |
|
119 | + lang('%1 successful unmounted.', $path) : lang('Error unmounting %1!', $path); |
|
120 | 120 | } |
121 | 121 | else // re-mount / with sqlFS, to disable versioning |
122 | 122 | { |
123 | - $msg = Vfs::mount($url=sqlfs_stream_wrapper::SCHEME.'://default'.$path,$path) ? |
|
124 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
123 | + $msg = Vfs::mount($url = sqlfs_stream_wrapper::SCHEME.'://default'.$path, $path) ? |
|
124 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | if (($path = $content['mounts']['path']) && |
128 | 128 | ($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount'])) |
129 | 129 | { |
130 | - $url = str_replace('$path',$path,$content['mounts']['url']); |
|
130 | + $url = str_replace('$path', $path, $content['mounts']['url']); |
|
131 | 131 | if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path; |
132 | 132 | |
133 | 133 | if ($content['mounts']['enable'] && !$this->versioning) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | elseif (!Vfs::file_exists($path) || !Vfs::is_dir($path)) |
139 | 139 | { |
140 | - $msg = lang('Path %1 not found or not a directory!',$path); |
|
140 | + $msg = lang('Path %1 not found or not a directory!', $path); |
|
141 | 141 | $msg_type = 'error'; |
142 | 142 | } |
143 | 143 | // dont allow to change mount of /apps or /templates (eg. switching on versioning) |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | } |
149 | 149 | else |
150 | 150 | { |
151 | - $msg = Vfs::mount($url,$path) ? |
|
152 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
151 | + $msg = Vfs::mount($url, $path) ? |
|
152 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | if ($content['allow_delete_versions'] != $GLOBALS['egw_info']['server']['allow_delete_versions']) |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | 'hidden' => true, |
195 | 195 | 'depth' => true, |
196 | 196 | 'path_preg' => '#/\.(attic|versions)/#', |
197 | - )+(!(int)$content['mtime'] ? array() : array( |
|
198 | - 'mtime' => ($content['mtime']<0?'-':'+').(int)$content['mtime'], |
|
197 | + ) + (!(int)$content['mtime'] ? array() : array( |
|
198 | + 'mtime' => ($content['mtime'] < 0 ? '-' : '+').(int)$content['mtime'], |
|
199 | 199 | )), function($path) use (&$deleted, &$errors) |
200 | 200 | { |
201 | 201 | if (($is_dir = Vfs::is_dir($path)) && Vfs::rmdir($path) || |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | }); |
211 | 211 | } |
212 | - $time = number_format(microtime(true)-$starttime, 1); |
|
212 | + $time = number_format(microtime(true) - $starttime, 1); |
|
213 | 213 | $msg = ($errors ? lang('%1 errors deleting!', $errors)."\n\n" : ''). |
214 | 214 | lang('%1 files or directories deleted in %2 seconds.', $deleted, $time); |
215 | 215 | $msg_type = $errors ? 'error' : 'info'; |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | { |
233 | 233 | // statistical information |
234 | 234 | $content += Versioning\StreamWrapper::summary(); |
235 | - if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
236 | - if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
235 | + if ($content['total_files']) $content['percent_files'] = number_format(100.0 * $content['version_files'] / $content['total_files'], 1).'%'; |
|
236 | + if ($content['total_size']) $content['percent_size'] = number_format(100.0 * $content['version_size'] / $content['total_size'], 1).'%'; |
|
237 | 237 | } |
238 | - if (!($content['is_root']=Vfs::$is_root)) |
|
238 | + if (!($content['is_root'] = Vfs::$is_root)) |
|
239 | 239 | { |
240 | 240 | if (empty($msg)) |
241 | 241 | { |
@@ -251,16 +251,16 @@ discard block |
||
251 | 251 | |
252 | 252 | $n = 2; |
253 | 253 | $content['mounts'] = array(); |
254 | - foreach(Vfs::mount() as $path => $url) |
|
254 | + foreach (Vfs::mount() as $path => $url) |
|
255 | 255 | { |
256 | 256 | $content['mounts'][$n++] = array( |
257 | 257 | 'path' => $path, |
258 | 258 | 'url' => $url, |
259 | 259 | ); |
260 | 260 | $readonlys["disable[$path]"] = !$this->versioning || !Vfs::$is_root || |
261 | - Vfs::parse_url($url,PHP_URL_SCHEME) != $this->versioning; |
|
261 | + Vfs::parse_url($url, PHP_URL_SCHEME) != $this->versioning; |
|
262 | 262 | } |
263 | - $readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true; // do not allow to unmount / or /apps |
|
263 | + $readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true; // do not allow to unmount / or /apps |
|
264 | 264 | $readonlys['url'] = !self::$is_setup; |
265 | 265 | |
266 | 266 | $sel_options['allow_delete_versions'] = array( |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | ); |
272 | 272 | // show [Mount /etemplates] button for admin, if not already mounted and available |
273 | 273 | $readonlys['etemplates'] = !class_exists('\EGroupware\Stylite\Vfs\Merge\StreamWrapper') || |
274 | - ($fs_tab=Vfs::mount($url)) && isset($fs_tab['/etemplates']) || |
|
274 | + ($fs_tab = Vfs::mount($url)) && isset($fs_tab['/etemplates']) || |
|
275 | 275 | !isset($GLOBALS['egw_info']['user']['apps']['admin']); |
276 | 276 | //_debug_array($content); |
277 | 277 | |
278 | 278 | $tpl = new etemplate_new('filemanager.admin'); |
279 | 279 | $GLOBALS['egw_info']['flags']['app_header'] = lang('VFS mounts and versioning'); |
280 | - $tpl->exec('filemanager.filemanager_admin.index',$content,$sel_options,$readonlys); |
|
280 | + $tpl->exec('filemanager.filemanager_admin.index', $content, $sel_options, $readonlys); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | } |
298 | 298 | $content = '<p>'.implode("</p>\n<p>", (array)$msgs)."</p>\n"; |
299 | 299 | |
300 | - $content .= html::form('<p>'.($check_only&&is_array($msgs)?html::submit_button('fix', lang('Fix reported problems')):''). |
|
300 | + $content .= html::form('<p>'.($check_only && is_array($msgs) ? html::submit_button('fix', lang('Fix reported problems')) : ''). |
|
301 | 301 | html::submit_button('cancel', lang('Cancel')).'</p>', |
302 | - '','/index.php',array('menuaction'=>'filemanager.filemanager_admin.fsck')); |
|
302 | + '', '/index.php', array('menuaction'=>'filemanager.filemanager_admin.fsck')); |
|
303 | 303 | |
304 | 304 | $GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true); |
305 | 305 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * Create a session or if the user has no account return authenticate header and 401 Unauthorized |
32 | 32 | * |
33 | 33 | * @param array &$account |
34 | - * @return int session-id |
|
34 | + * @return string session-id |
|
35 | 35 | */ |
36 | 36 | function check_access(&$account) |
37 | 37 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | if (isset($_GET['auth'])) |
33 | 33 | { |
34 | - list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) = explode(':',base64_decode($_GET['auth']),2); |
|
34 | + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode($_GET['auth']), 2); |
|
35 | 35 | } |
36 | 36 | return egw_digest_auth::autocreate_session_callback($account); |
37 | 37 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | 'noheader' => True, |
43 | 43 | 'currentapp' => preg_match('|/webdav.php/apps/([A-Za-z0-9_-]+)/|', $_SERVER['REQUEST_URI'], $matches) ? $matches[1] : 'filemanager', |
44 | 44 | 'autocreate_session_callback' => 'check_access', |
45 | - 'no_exception_handler' => 'basic_auth', // we use a basic auth exception handler (sends exception message as basic auth realm) |
|
46 | - 'auth_realm' => 'EGroupware WebDAV server', // cant use vfs_webdav_server::REALM as autoloading and include path not yet setup! |
|
45 | + 'no_exception_handler' => 'basic_auth', // we use a basic auth exception handler (sends exception message as basic auth realm) |
|
46 | + 'auth_realm' => 'EGroupware WebDAV server', // cant use vfs_webdav_server::REALM as autoloading and include path not yet setup! |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | require_once('../phpgwapi/inc/class.egw_digest_auth.inc.php'); |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | |
73 | 73 | // temporary mount ownCloud default /clientsync as /home/$user, if not explicitly mounted |
74 | 74 | // so ownCloud dir contains users home-dir by default |
75 | -if (strpos($_SERVER['REQUEST_URI'],'/webdav.php/clientsync') !== false && |
|
76 | - ($fstab=egw_vfs::mount()) && !isset($fstab['/clientsync'])) |
|
75 | +if (strpos($_SERVER['REQUEST_URI'], '/webdav.php/clientsync') !== false && |
|
76 | + ($fstab = egw_vfs::mount()) && !isset($fstab['/clientsync'])) |
|
77 | 77 | { |
78 | 78 | $is_root_backup = egw_vfs::$is_root; |
79 | 79 | egw_vfs::$is_root = true; |
80 | - $ok = egw_vfs::mount($url='vfs://default/home/$user', $clientsync='/clientsync', null, false); |
|
80 | + $ok = egw_vfs::mount($url = 'vfs://default/home/$user', $clientsync = '/clientsync', null, false); |
|
81 | 81 | egw_vfs::$is_root = $is_root_backup; |
82 | 82 | //error_log("mounting ownCloud default '$clientsync' as '$url' ".($ok ? 'successful' : 'failed!')); |
83 | 83 | } |
@@ -198,7 +198,7 @@ |
||
198 | 198 | /** |
199 | 199 | * This portlet accepts files and links |
200 | 200 | * |
201 | - * @return boolean|String[] |
|
201 | + * @return string[] |
|
202 | 202 | */ |
203 | 203 | public function accept_drop() |
204 | 204 | { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @param boolean $need_reload Flag to indicate that the portlet needs to be reloaded (exec will be called) |
51 | 51 | */ |
52 | - public function __construct(Array &$context = array(), &$need_reload = false) |
|
52 | + public function __construct(array &$context = array(), &$need_reload = false) |
|
53 | 53 | { |
54 | 54 | if (false) parent::__construct(); |
55 | 55 |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | public function __construct(Array &$context = array(), &$need_reload = false) |
48 | 48 | { |
49 | 49 | // Process dropped data into something useable |
50 | - if($context['dropped_data']) |
|
50 | + if ($context['dropped_data']) |
|
51 | 51 | { |
52 | 52 | list($context['entry']['app'], $context['entry']['id']) = explode('::', $context['dropped_data'][0], 2); |
53 | 53 | unset($context['dropped_data']); |
54 | 54 | $need_reload = true; |
55 | 55 | } |
56 | - if($context['entry'] && is_array($context['entry'])); |
|
56 | + if ($context['entry'] && is_array($context['entry'])); |
|
57 | 57 | { |
58 | 58 | $this->title = $context['entry']['title'] = egw_link::title($context['entry']['app'], $context['entry']['id']); |
59 | 59 | |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | * @param id String unique ID, provided to the portlet so it can make sure content is |
91 | 91 | * unique, if needed. |
92 | 92 | */ |
93 | - public function exec($id = null, etemplate_new &$etemplate = null) |
|
93 | + public function exec($id = null, etemplate_new&$etemplate = null) |
|
94 | 94 | { |
95 | 95 | // Check for custom template for app |
96 | 96 | $custom_template = false; |
97 | - if($this->context && $this->context['entry'] && $this->context['entry']['app'] && |
|
98 | - $etemplate->read($this->context['entry']['app'] . '.' . $this->template_name)) |
|
97 | + if ($this->context && $this->context['entry'] && $this->context['entry']['app'] && |
|
98 | + $etemplate->read($this->context['entry']['app'].'.'.$this->template_name)) |
|
99 | 99 | { |
100 | 100 | // No action needed, custom template loaded as side-effect |
101 | 101 | $custom_template = true; |
@@ -113,45 +113,45 @@ discard block |
||
113 | 113 | ); |
114 | 114 | |
115 | 115 | // Try to load entry |
116 | - if($this->context['entry'] && $this->context['entry']['app']) |
|
116 | + if ($this->context['entry'] && $this->context['entry']['app']) |
|
117 | 117 | { |
118 | 118 | |
119 | 119 | // Always load app's css |
120 | 120 | egw_framework::includeCSS($this->context['entry']['app'], 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) || |
121 | - egw_framework::includeCSS($this->context['entry']['app'],'app'); |
|
121 | + egw_framework::includeCSS($this->context['entry']['app'], 'app'); |
|
122 | 122 | |
123 | 123 | try |
124 | 124 | { |
125 | - $classname = $this->context['entry']['app'] . '_egw_record'; |
|
126 | - if(class_exists($classname)) |
|
125 | + $classname = $this->context['entry']['app'].'_egw_record'; |
|
126 | + if (class_exists($classname)) |
|
127 | 127 | { |
128 | 128 | $record = new $classname($this->context['entry']['id']); |
129 | - if($record && $record->get_record_array()) |
|
129 | + if ($record && $record->get_record_array()) |
|
130 | 130 | { |
131 | 131 | // If there's a custom template, send the full record |
132 | - if($custom_template) |
|
132 | + if ($custom_template) |
|
133 | 133 | { |
134 | 134 | $content += $record->get_record_array(); |
135 | 135 | } |
136 | - if($content['image'] == false) |
|
136 | + if ($content['image'] == false) |
|
137 | 137 | { |
138 | 138 | $content['image'] = $record->get_icon(); |
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
143 | - catch(Exception $e) |
|
143 | + catch (Exception $e) |
|
144 | 144 | { |
145 | - error_log("Problem loading record " . array2string($this->context['entry'])); |
|
145 | + error_log("Problem loading record ".array2string($this->context['entry'])); |
|
146 | 146 | throw $e; |
147 | 147 | } |
148 | 148 | |
149 | 149 | // Set a fallback image |
150 | - if($content['image'] == false) |
|
150 | + if ($content['image'] == false) |
|
151 | 151 | { |
152 | - if($this->context['entry'] && $this->context['entry']['app']) |
|
152 | + if ($this->context['entry'] && $this->context['entry']['app']) |
|
153 | 153 | { |
154 | - $content['image'] = $this->context['entry']['app'] . '/navbar'; |
|
154 | + $content['image'] = $this->context['entry']['app'].'/navbar'; |
|
155 | 155 | } |
156 | 156 | else |
157 | 157 | { |
@@ -161,22 +161,22 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | // Filemanager support - links need app = 'file' and type set |
164 | - if($this->context && $this->context['entry'] && $this->context['entry']['app'] == 'filemanager') |
|
164 | + if ($this->context && $this->context['entry'] && $this->context['entry']['app'] == 'filemanager') |
|
165 | 165 | { |
166 | 166 | $this->context['entry']['app'] = 'file'; |
167 | 167 | $this->context['entry']['path'] = $this->context['entry']['title'] = $this->context['entry']['id']; |
168 | 168 | $this->context['entry']['type'] = egw_vfs::mime_content_type($this->context['entry']['id']); |
169 | - $content['image'] = egw_framework::link('/etemplate/thumbnail.php',array('path' => $this->context['entry']['id'])); |
|
169 | + $content['image'] = egw_framework::link('/etemplate/thumbnail.php', array('path' => $this->context['entry']['id'])); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $content += $this->context; |
173 | 173 | |
174 | - if(!is_array($content['entry'])) |
|
174 | + if (!is_array($content['entry'])) |
|
175 | 175 | { |
176 | 176 | $content['entry'] = null; |
177 | 177 | } |
178 | 178 | |
179 | - $etemplate->exec('home.home_link_portlet.exec',$content); |
|
179 | + $etemplate->exec('home.home_link_portlet.exec', $content); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -240,6 +240,6 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function accept_drop() |
242 | 242 | { |
243 | - return array('file','link'); |
|
243 | + return array('file', 'link'); |
|
244 | 244 | } |
245 | 245 | } |