@@ -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'], |