@@ -25,11 +25,11 @@ |
||
25 | 25 | // Used in conversions |
26 | 26 | static $types = array( |
27 | 27 | 'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'), |
28 | - 'select-cat' => array('info_cat'), |
|
29 | - 'select-account' => array('info_owner','info_responsible','info_modifier'), |
|
30 | - 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'), |
|
28 | + 'select-cat' => array('info_cat'), |
|
29 | + 'select-account' => array('info_owner','info_responsible','info_modifier'), |
|
30 | + 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'), |
|
31 | 31 | 'links' => array('info_link_id'), |
32 | - ); |
|
32 | + ); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * constructor |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | static $types = array( |
27 | 27 | 'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'), |
28 | 28 | 'select-cat' => array('info_cat'), |
29 | - 'select-account' => array('info_owner','info_responsible','info_modifier'), |
|
30 | - 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'), |
|
29 | + 'select-account' => array('info_owner', 'info_responsible', 'info_modifier'), |
|
30 | + 'date-time' => array('info_startdate', 'info_enddate', 'info_datecompleted', 'info_datemodified', 'info_created'), |
|
31 | 31 | 'links' => array('info_link_id'), |
32 | 32 | ); |
33 | 33 | |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $_identifier |
39 | 39 | */ |
40 | - public function __construct( $_identifier='' ){ |
|
40 | + public function __construct($_identifier = '') { |
|
41 | 41 | $this->identifier = $_identifier; |
42 | - if(self::$bo == null) self::$bo = new infolog_bo(); |
|
43 | - if($_identifier) { |
|
42 | + if (self::$bo == null) self::$bo = new infolog_bo(); |
|
43 | + if ($_identifier) { |
|
44 | 44 | $rec = self::$bo->read($this->identifier); |
45 | 45 | if (is_array($rec)) $this->set_record($rec); |
46 | 46 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @todo add some checks |
96 | 96 | * @return void |
97 | 97 | */ |
98 | - public function set_record(array $_record){ |
|
98 | + public function set_record(array $_record) { |
|
99 | 99 | $this->record = $_record; |
100 | 100 | } |
101 | 101 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return string identifier |
135 | 135 | */ |
136 | - public function save ( $_dst_identifier ) { |
|
136 | + public function save($_dst_identifier) { |
|
137 | 137 | |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $_dst_identifier |
144 | 144 | * @return string dst_identifier |
145 | 145 | */ |
146 | - public function copy ( $_dst_identifier ) { |
|
146 | + public function copy($_dst_identifier) { |
|
147 | 147 | |
148 | 148 | } |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param string $_dst_identifier |
155 | 155 | * @return string dst_identifier |
156 | 156 | */ |
157 | - public function move ( $_dst_identifier ) { |
|
157 | + public function move($_dst_identifier) { |
|
158 | 158 | |
159 | 159 | } |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * delets current record from backend |
163 | 163 | * |
164 | 164 | */ |
165 | - public function delete () { |
|
165 | + public function delete() { |
|
166 | 166 | |
167 | 167 | } |
168 | 168 |
@@ -37,12 +37,20 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $_identifier |
39 | 39 | */ |
40 | - public function __construct( $_identifier='' ){ |
|
40 | + public function __construct( $_identifier='' ) |
|
41 | + { |
|
41 | 42 | $this->identifier = $_identifier; |
42 | - if(self::$bo == null) self::$bo = new infolog_bo(); |
|
43 | - if($_identifier) { |
|
43 | + if(self::$bo == null) |
|
44 | + { |
|
45 | + self::$bo = new infolog_bo(); |
|
46 | + } |
|
47 | + if($_identifier) |
|
48 | + { |
|
44 | 49 | $rec = self::$bo->read($this->identifier); |
45 | - if (is_array($rec)) $this->set_record($rec); |
|
50 | + if (is_array($rec)) |
|
51 | + { |
|
52 | + $this->set_record($rec); |
|
53 | + } |
|
46 | 54 | } |
47 | 55 | } |
48 | 56 | |
@@ -51,7 +59,8 @@ discard block |
||
51 | 59 | * |
52 | 60 | * @param string $_attribute_name |
53 | 61 | */ |
54 | - public function __get($_attribute_name) { |
|
62 | + public function __get($_attribute_name) |
|
63 | + { |
|
55 | 64 | return $this->record[$_attribute_name]; |
56 | 65 | } |
57 | 66 | |
@@ -61,7 +70,8 @@ discard block |
||
61 | 70 | * @param string $_attribute_name |
62 | 71 | * @param data $data |
63 | 72 | */ |
64 | - public function __set($_attribute_name, $data) { |
|
73 | + public function __set($_attribute_name, $data) |
|
74 | + { |
|
65 | 75 | $this->record[$_attribute_name] = $data; |
66 | 76 | } |
67 | 77 | |
@@ -73,7 +83,8 @@ discard block |
||
73 | 83 | * |
74 | 84 | * @return array complete record as associative array |
75 | 85 | */ |
76 | - public function get_record_array() { |
|
86 | + public function get_record_array() |
|
87 | + { |
|
77 | 88 | return $this->record; |
78 | 89 | } |
79 | 90 | |
@@ -82,7 +93,8 @@ discard block |
||
82 | 93 | * |
83 | 94 | *@return string tiltle |
84 | 95 | */ |
85 | - public function get_title() { |
|
96 | + public function get_title() |
|
97 | + { |
|
86 | 98 | return self::$bo->link_title($this->record); |
87 | 99 | } |
88 | 100 | |
@@ -92,7 +104,8 @@ discard block |
||
92 | 104 | * @todo add some checks |
93 | 105 | * @return void |
94 | 106 | */ |
95 | - public function set_record(array $_record){ |
|
107 | + public function set_record(array $_record) |
|
108 | + { |
|
96 | 109 | $this->record = $_record; |
97 | 110 | } |
98 | 111 | |
@@ -101,7 +114,8 @@ discard block |
||
101 | 114 | * |
102 | 115 | * @return string identifier of current record |
103 | 116 | */ |
104 | - public function get_identifier() { |
|
117 | + public function get_identifier() |
|
118 | + { |
|
105 | 119 | return $this->identifier; |
106 | 120 | } |
107 | 121 | |
@@ -111,7 +125,8 @@ discard block |
||
111 | 125 | * |
112 | 126 | * @return string Full URL of an icon, or appname/icon_name |
113 | 127 | */ |
114 | - public function get_icon() { |
|
128 | + public function get_icon() |
|
129 | + { |
|
115 | 130 | $icon = 'infolog/navbar'; |
116 | 131 | $ui = new infolog_ui(); |
117 | 132 | if (!($icon = $ui->icons['type'][$this->info_type])) |
@@ -130,7 +145,8 @@ discard block |
||
130 | 145 | * |
131 | 146 | * @return string identifier |
132 | 147 | */ |
133 | - public function save ( $_dst_identifier ) { |
|
148 | + public function save ( $_dst_identifier ) |
|
149 | + { |
|
134 | 150 | |
135 | 151 | } |
136 | 152 | |
@@ -140,7 +156,8 @@ discard block |
||
140 | 156 | * @param string $_dst_identifier |
141 | 157 | * @return string dst_identifier |
142 | 158 | */ |
143 | - public function copy ( $_dst_identifier ) { |
|
159 | + public function copy ( $_dst_identifier ) |
|
160 | + { |
|
144 | 161 | |
145 | 162 | } |
146 | 163 | |
@@ -151,7 +168,8 @@ discard block |
||
151 | 168 | * @param string $_dst_identifier |
152 | 169 | * @return string dst_identifier |
153 | 170 | */ |
154 | - public function move ( $_dst_identifier ) { |
|
171 | + public function move ( $_dst_identifier ) |
|
172 | + { |
|
155 | 173 | |
156 | 174 | } |
157 | 175 | |
@@ -159,7 +177,8 @@ discard block |
||
159 | 177 | * delets current record from backend |
160 | 178 | * |
161 | 179 | */ |
162 | - public function delete () { |
|
180 | + public function delete () |
|
181 | + { |
|
163 | 182 | |
164 | 183 | } |
165 | 184 | |
@@ -167,7 +186,8 @@ discard block |
||
167 | 186 | * destructor |
168 | 187 | * |
169 | 188 | */ |
170 | - public function __destruct() { |
|
189 | + public function __destruct() |
|
190 | + { |
|
171 | 191 | } |
172 | 192 | |
173 | 193 | } // end of egw_addressbook_record |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $context['appname'] = 'infolog'; |
33 | 33 | |
34 | 34 | // Let parent handle the basic stuff |
35 | - parent::__construct($context,$need_reload); |
|
35 | + parent::__construct($context, $need_reload); |
|
36 | 36 | |
37 | 37 | $ui = new infolog_ui(); |
38 | 38 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($tpl->read('infolog.index.rows.'.$query['col_filter']['info_type'])) |
74 | 74 | { |
75 | 75 | $query['template'] = $tpl->name; |
76 | - $query['custom_fields'] = true; // read the custom fields too |
|
76 | + $query['custom_fields'] = true; // read the custom fields too |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | $ui = new infolog_ui(); |
@@ -105,27 +105,27 @@ discard block |
||
105 | 105 | // Some processing to add values in for links and cats |
106 | 106 | $multi_action = $values['nm']['multi_action']; |
107 | 107 | // Action has an additional action - add / delete, etc. Buttons named <multi-action>_action[action_name] |
108 | - if(in_array($multi_action, array('link', 'responsible'))) |
|
108 | + if (in_array($multi_action, array('link', 'responsible'))) |
|
109 | 109 | { |
110 | 110 | // eTemplate ignores the _popup namespace, but et2 doesn't |
111 | - if($values[$multi_action.'_popup']) |
|
111 | + if ($values[$multi_action.'_popup']) |
|
112 | 112 | { |
113 | - $popup =& $values[$multi_action.'_popup']; |
|
113 | + $popup = & $values[$multi_action.'_popup']; |
|
114 | 114 | } |
115 | 115 | else |
116 | 116 | { |
117 | - $popup =& $values; |
|
117 | + $popup = & $values; |
|
118 | 118 | } |
119 | - $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action']); |
|
120 | - if($multi_action == 'link') |
|
119 | + $values['nm']['multi_action'] .= '_'.key($popup[$multi_action.'_action']); |
|
120 | + if ($multi_action == 'link') |
|
121 | 121 | { |
122 | - $popup[$multi_action] = $popup['link']['app'] . ':'.$popup['link']['id']; |
|
122 | + $popup[$multi_action] = $popup['link']['app'].':'.$popup['link']['id']; |
|
123 | 123 | } |
124 | - else if(is_array($popup[$multi_action])) |
|
124 | + else if (is_array($popup[$multi_action])) |
|
125 | 125 | { |
126 | - $popup[$multi_action] = implode(',',$popup[$multi_action]); |
|
126 | + $popup[$multi_action] = implode(',', $popup[$multi_action]); |
|
127 | 127 | } |
128 | - $values['nm']['multi_action'] .= '_' . $popup[$multi_action]; |
|
128 | + $values['nm']['multi_action'] .= '_'.$popup[$multi_action]; |
|
129 | 129 | unset($values[$multi_action.'_popup']); |
130 | 130 | unset($values[$multi_action]); |
131 | 131 | } |
@@ -133,24 +133,24 @@ discard block |
||
133 | 133 | if ($ui->action($values['nm']['multi_action'], $values['nm']['selected'], $values['nm']['select_all'], |
134 | 134 | $success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications'])) |
135 | 135 | { |
136 | - $msg .= lang('%1 entries %2',$success,$action_msg); |
|
137 | - Api\Json\Response::get()->apply('egw.message',array($msg,'success')); |
|
138 | - foreach($values['nm']['selected'] as &$id) |
|
136 | + $msg .= lang('%1 entries %2', $success, $action_msg); |
|
137 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'success')); |
|
138 | + foreach ($values['nm']['selected'] as &$id) |
|
139 | 139 | { |
140 | 140 | $id = 'infolog::'.$id; |
141 | 141 | } |
142 | 142 | // Directly request an update - this will get infolog tab too |
143 | - Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($values['nm']['selected'])); |
|
143 | + Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($values['nm']['selected'])); |
|
144 | 144 | } |
145 | - elseif(is_null($msg)) |
|
145 | + elseif (is_null($msg)) |
|
146 | 146 | { |
147 | - $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
148 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
147 | + $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
148 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
149 | 149 | } |
150 | - elseif($msg) |
|
150 | + elseif ($msg) |
|
151 | 151 | { |
152 | - $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); |
|
153 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
152 | + $msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed); |
|
153 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
154 | 154 | } |
155 | 155 | unset($values['nm']['multi_action']); |
156 | 156 | unset($values['nm']['select_all']); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | * Construct the portlet |
28 | 28 | * |
29 | 29 | */ |
30 | - public function __construct(Array &$context = array(), &$need_reload = false) |
|
30 | + public function __construct(array &$context = array(), &$need_reload = false) |
|
31 | 31 | { |
32 | 32 | $context['appname'] = 'infolog'; |
33 | 33 |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | private $boinfolog; |
75 | 75 | |
76 | 76 | /** |
77 | - * For figuring out if a record has changed |
|
78 | - * |
|
79 | - * @var infolog_tracking:: |
|
80 | - */ |
|
77 | + * For figuring out if a record has changed |
|
78 | + * |
|
79 | + * @var infolog_tracking:: |
|
80 | + */ |
|
81 | 81 | protected $tracking; |
82 | 82 | |
83 | 83 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | protected $errors = array(); |
102 | 102 | |
103 | 103 | /** |
104 | - * List of actions, and how many times that action was taken |
|
104 | + * List of actions, and how many times that action was taken |
|
105 | 105 | */ |
106 | 106 | protected $results = array(); |
107 | 107 | |
@@ -466,37 +466,37 @@ discard block |
||
466 | 466 | } |
467 | 467 | |
468 | 468 | /** |
469 | - * Returns warnings that were encountered during importing |
|
470 | - * Maximum of one warning message per record, but you can append if you need to |
|
471 | - * |
|
472 | - * @return Array ( |
|
473 | - * record_# => warning message |
|
474 | - * ) |
|
475 | - */ |
|
469 | + * Returns warnings that were encountered during importing |
|
470 | + * Maximum of one warning message per record, but you can append if you need to |
|
471 | + * |
|
472 | + * @return Array ( |
|
473 | + * record_# => warning message |
|
474 | + * ) |
|
475 | + */ |
|
476 | 476 | public function get_warnings() { |
477 | 477 | return $this->warnings; |
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
481 | - * Returns errors that were encountered during importing |
|
482 | - * Maximum of one error message per record, but you can append if you need to |
|
483 | - * |
|
484 | - * @return Array ( |
|
485 | - * record_# => error message |
|
486 | - * ) |
|
487 | - */ |
|
481 | + * Returns errors that were encountered during importing |
|
482 | + * Maximum of one error message per record, but you can append if you need to |
|
483 | + * |
|
484 | + * @return Array ( |
|
485 | + * record_# => error message |
|
486 | + * ) |
|
487 | + */ |
|
488 | 488 | public function get_errors() { |
489 | 489 | return $this->errors; |
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
493 | - * Returns a list of actions taken, and the number of records for that action. |
|
494 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
495 | - * |
|
496 | - * @return Array ( |
|
497 | - * action => record count |
|
498 | - * ) |
|
499 | - */ |
|
493 | + * Returns a list of actions taken, and the number of records for that action. |
|
494 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
495 | + * |
|
496 | + * @return Array ( |
|
497 | + * action => record count |
|
498 | + * ) |
|
499 | + */ |
|
500 | 500 | public function get_results() { |
501 | 501 | return $this->results; |
502 | 502 | } |
@@ -112,7 +112,8 @@ discard block |
||
112 | 112 | * @param string $_charset |
113 | 113 | * @param definition $_definition |
114 | 114 | */ |
115 | - public function import( $_stream, importexport_definition $_definition ) { |
|
115 | + public function import( $_stream, importexport_definition $_definition ) |
|
116 | + { |
|
116 | 117 | $import_csv = new importexport_import_csv( $_stream, array( |
117 | 118 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
118 | 119 | 'charset' => $_definition->plugin_options['charset'], |
@@ -144,9 +145,12 @@ discard block |
||
144 | 145 | $import_csv->conversion_class = $this; |
145 | 146 | |
146 | 147 | //check if file has a header lines |
147 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
148 | + if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) |
|
149 | + { |
|
148 | 150 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
149 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
151 | + } |
|
152 | + elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) |
|
153 | + { |
|
150 | 154 | // First method is preferred |
151 | 155 | $import_csv->skip_records(1); |
152 | 156 | } |
@@ -178,7 +182,10 @@ discard block |
||
178 | 182 | $success = false; |
179 | 183 | |
180 | 184 | // don't import empty records |
181 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
185 | + if( count( array_unique( $record ) ) < 2 ) |
|
186 | + { |
|
187 | + continue; |
|
188 | + } |
|
182 | 189 | |
183 | 190 | $lookups = $_lookups; |
184 | 191 | |
@@ -236,7 +243,10 @@ discard block |
||
236 | 243 | { |
237 | 244 | $record['info_owner'] = $_definition->plugin_options['record_owner']; |
238 | 245 | } |
239 | - if (!isset($record['info_owner'])) $record['info_owner'] = $GLOBALS['egw_info']['user']['account_id']; |
|
246 | + if (!isset($record['info_owner'])) |
|
247 | + { |
|
248 | + $record['info_owner'] = $GLOBALS['egw_info']['user']['account_id']; |
|
249 | + } |
|
240 | 250 | |
241 | 251 | // Responsible has to be an array |
242 | 252 | $record['info_responsible'] = $record['info_responsible'] ? explode(',',$record['info_responsible']) : 0; |
@@ -261,27 +271,42 @@ discard block |
||
261 | 271 | { |
262 | 272 | // exists |
263 | 273 | case 'exists' : |
264 | - if($record[$condition['string']]) { |
|
274 | + if($record[$condition['string']]) |
|
275 | + { |
|
265 | 276 | $query['col_filter'] = array( $condition['string'] => $record[$condition['string']],); |
266 | 277 | // Needed to query custom fields |
267 | - if($condition['string'][0] == '#') $query['custom_fields'] = true; |
|
278 | + if($condition['string'][0] == '#') |
|
279 | + { |
|
280 | + $query['custom_fields'] = true; |
|
281 | + } |
|
268 | 282 | $results = $this->boinfolog->search($query); |
269 | 283 | } |
270 | 284 | |
271 | - if ( is_array( $results ) && count( array_keys( $results )) >= 1) { |
|
285 | + if ( is_array( $results ) && count( array_keys( $results )) >= 1) |
|
286 | + { |
|
272 | 287 | // apply action to all records matching this exists condition |
273 | 288 | $action = $condition['true']; |
274 | - foreach ( (array)$results as $contact ) { |
|
289 | + foreach ( (array)$results as $contact ) |
|
290 | + { |
|
275 | 291 | $record['info_id'] = $contact['info_id']; |
276 | 292 | $record['info_owner'] = $contact['info_owner']; |
277 | - if ( $_definition->plugin_options['update_cats'] == 'add' ) { |
|
278 | - if ( !is_array( $contact['cat_id'] ) ) $contact['cat_id'] = explode( ',', $contact['cat_id'] ); |
|
279 | - if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
293 | + if ( $_definition->plugin_options['update_cats'] == 'add' ) |
|
294 | + { |
|
295 | + if ( !is_array( $contact['cat_id'] ) ) |
|
296 | + { |
|
297 | + $contact['cat_id'] = explode( ',', $contact['cat_id'] ); |
|
298 | + } |
|
299 | + if ( !is_array( $record['cat_id'] ) ) |
|
300 | + { |
|
301 | + $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
302 | + } |
|
280 | 303 | $record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $contact['cat_id'] ) ) ); |
281 | 304 | } |
282 | 305 | $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
283 | 306 | } |
284 | - } else { |
|
307 | + } |
|
308 | + else |
|
309 | + { |
|
285 | 310 | $action = $condition['false']; |
286 | 311 | $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
287 | 312 | } |
@@ -292,7 +317,10 @@ discard block |
||
292 | 317 | die('condition / action not supported!!!'); |
293 | 318 | break; |
294 | 319 | } |
295 | - if ($action['last']) break; |
|
320 | + if ($action['last']) |
|
321 | + { |
|
322 | + break; |
|
323 | + } |
|
296 | 324 | } |
297 | 325 | } |
298 | 326 | else |
@@ -300,7 +328,10 @@ discard block |
||
300 | 328 | // unconditional insert |
301 | 329 | $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
302 | 330 | } |
303 | - if($success) $count++; |
|
331 | + if($success) |
|
332 | + { |
|
333 | + $count++; |
|
334 | + } |
|
304 | 335 | if($this->warnings[$import_csv->get_current_position()]) |
305 | 336 | { |
306 | 337 | $this->warnings[$import_csv->get_current_position()] .= "\nRecord:\n" .array2string($record); |
@@ -323,7 +354,8 @@ discard block |
||
323 | 354 | private function action ( $_action, $_data, $record_num = 0 ) |
324 | 355 | { |
325 | 356 | $result = true; |
326 | - switch ($_action) { |
|
357 | + switch ($_action) |
|
358 | + { |
|
327 | 359 | case 'none' : |
328 | 360 | return true; |
329 | 361 | case 'update' : |
@@ -398,7 +430,10 @@ discard block |
||
398 | 430 | $info_link_id = $_data['info_link_id']; |
399 | 431 | foreach(array_keys(self::$special_fields) as $field) |
400 | 432 | { |
401 | - if(!$_data[$field]) continue; |
|
433 | + if(!$_data[$field]) |
|
434 | + { |
|
435 | + continue; |
|
436 | + } |
|
402 | 437 | if(strpos($field, 'link') === 0) |
403 | 438 | { |
404 | 439 | list($app, $app_id) = explode(':', $_data[$field],2); |
@@ -438,7 +473,8 @@ discard block |
||
438 | 473 | * |
439 | 474 | * @return string name |
440 | 475 | */ |
441 | - public static function get_name() { |
|
476 | + public static function get_name() |
|
477 | + { |
|
442 | 478 | return lang('Infolog CSV import'); |
443 | 479 | } |
444 | 480 | |
@@ -447,7 +483,8 @@ discard block |
||
447 | 483 | * |
448 | 484 | * @return string descriprion |
449 | 485 | */ |
450 | - public static function get_description() { |
|
486 | + public static function get_description() |
|
487 | + { |
|
451 | 488 | return lang("Imports entries into the infolog from a CSV File. CSV means 'Comma Separated Values'. However in the options Tab you can also choose other seperators."); |
452 | 489 | } |
453 | 490 | |
@@ -456,7 +493,8 @@ discard block |
||
456 | 493 | * |
457 | 494 | * @return string suffix (comma seperated) |
458 | 495 | */ |
459 | - public static function get_filesuffix() { |
|
496 | + public static function get_filesuffix() |
|
497 | + { |
|
460 | 498 | return 'csv'; |
461 | 499 | } |
462 | 500 | |
@@ -482,7 +520,8 @@ discard block |
||
482 | 520 | * |
483 | 521 | * @return string etemplate name |
484 | 522 | */ |
485 | - public function get_selectors_etpl() { |
|
523 | + public function get_selectors_etpl() |
|
524 | + { |
|
486 | 525 | // lets do it! |
487 | 526 | } |
488 | 527 | |
@@ -494,7 +533,8 @@ discard block |
||
494 | 533 | * record_# => warning message |
495 | 534 | * ) |
496 | 535 | */ |
497 | - public function get_warnings() { |
|
536 | + public function get_warnings() |
|
537 | + { |
|
498 | 538 | return $this->warnings; |
499 | 539 | } |
500 | 540 | |
@@ -506,7 +546,8 @@ discard block |
||
506 | 546 | * record_# => error message |
507 | 547 | * ) |
508 | 548 | */ |
509 | - public function get_errors() { |
|
549 | + public function get_errors() |
|
550 | + { |
|
510 | 551 | return $this->errors; |
511 | 552 | } |
512 | 553 | |
@@ -518,7 +559,8 @@ discard block |
||
518 | 559 | * action => record count |
519 | 560 | * ) |
520 | 561 | */ |
521 | - public function get_results() { |
|
562 | + public function get_results() |
|
563 | + { |
|
522 | 564 | return $this->results; |
523 | 565 | } |
524 | 566 | // end of iface_export_plugin |
@@ -528,7 +570,10 @@ discard block |
||
528 | 570 | { |
529 | 571 | static $boprojects=null; |
530 | 572 | |
531 | - if (!$num_or_title) return false; |
|
573 | + if (!$num_or_title) |
|
574 | + { |
|
575 | + return false; |
|
576 | + } |
|
532 | 577 | |
533 | 578 | if (!is_object($boprojects)) |
534 | 579 | { |
@@ -573,12 +618,16 @@ discard block |
||
573 | 618 | } |
574 | 619 | |
575 | 620 | // Couldn't find field, give an error - something's wrong |
576 | - if(!$cfs[$custom_field] && !$cfs[substr($custom_field,1)]) { |
|
621 | + if(!$cfs[$custom_field] && !$cfs[substr($custom_field,1)]) |
|
622 | + { |
|
577 | 623 | $this->errors[$record_num] .= lang('No custom field "%1" for %2.', |
578 | 624 | $custom_field, lang($app)); |
579 | 625 | return false; |
580 | 626 | } |
581 | - if($custom_field[0] != '#') $custom_field = '#' . $custom_field; |
|
627 | + if($custom_field[0] != '#') |
|
628 | + { |
|
629 | + $custom_field = '#' . $custom_field; |
|
630 | + } |
|
582 | 631 | |
583 | 632 | // Search |
584 | 633 | if(Link::get_registry($app, 'query')) |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | private static $plugin_options = array( |
27 | - 'fieldsep', // char |
|
28 | - 'charset', // string |
|
29 | - 'contact_owner', // int |
|
30 | - 'update_cats', // string {override|add} overides record |
|
27 | + 'fieldsep', // char |
|
28 | + 'charset', // string |
|
29 | + 'contact_owner', // int |
|
30 | + 'update_cats', // string {override|add} overides record |
|
31 | 31 | // with cat(s) from csv OR add the cat from |
32 | 32 | // csv file to exeisting cat(s) of record |
33 | 33 | 'num_header_lines', // int number of header lines |
34 | 34 | 'field_conversion', // array( $csv_col_num => conversion) |
35 | - 'field_mapping', // array( $csv_col_num => adb_filed) |
|
36 | - 'conditions', /* => array containing condition arrays: |
|
35 | + 'field_mapping', // array( $csv_col_num => adb_filed) |
|
36 | + 'conditions', /* => array containing condition arrays: |
|
37 | 37 | 'type' => exists, // exists |
38 | 38 | 'string' => '#kundennummer', |
39 | 39 | 'true' => array( |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * actions wich could be done to data entries |
61 | 61 | */ |
62 | - protected static $actions = array( 'none', 'update', 'insert', 'delete', ); |
|
62 | + protected static $actions = array('none', 'update', 'insert', 'delete',); |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * conditions for actions |
66 | 66 | * |
67 | 67 | * @var array |
68 | 68 | */ |
69 | - protected static $conditions = array( 'exists' ); |
|
69 | + protected static $conditions = array('exists'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @var definition |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @param string $_charset |
117 | 117 | * @param definition $_definition |
118 | 118 | */ |
119 | - public function import( $_stream, importexport_definition $_definition ) { |
|
120 | - $import_csv = new importexport_import_csv( $_stream, array( |
|
119 | + public function import($_stream, importexport_definition $_definition) { |
|
120 | + $import_csv = new importexport_import_csv($_stream, array( |
|
121 | 121 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
122 | 122 | 'charset' => $_definition->plugin_options['charset'], |
123 | 123 | )); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
128 | 128 | |
129 | 129 | // dry run? |
130 | - $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; |
|
130 | + $this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false; |
|
131 | 131 | |
132 | 132 | // fetch the infolog bo |
133 | 133 | $this->boinfolog = new infolog_bo(); |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | $import_csv->conversion_class = $this; |
149 | 149 | |
150 | 150 | //check if file has a header lines |
151 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
151 | + if (isset($_definition->plugin_options['num_header_lines']) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
152 | 152 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
153 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
153 | + } elseif (isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
154 | 154 | // First method is preferred |
155 | 155 | $import_csv->skip_records(1); |
156 | 156 | } |
@@ -177,53 +177,53 @@ discard block |
||
177 | 177 | $this->errors = array(); |
178 | 178 | $this->warnings = array(); |
179 | 179 | |
180 | - while ( $record = $import_csv->get_record() ) |
|
180 | + while ($record = $import_csv->get_record()) |
|
181 | 181 | { |
182 | 182 | $success = false; |
183 | 183 | |
184 | 184 | // don't import empty records |
185 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
185 | + if (count(array_unique($record)) < 2) continue; |
|
186 | 186 | |
187 | 187 | $lookups = $_lookups; |
188 | 188 | |
189 | 189 | // Early detection of type, to load appropriate statuses |
190 | - foreach(array($lookups['info_type'], array_map('strtolower',array_map('lang',$lookups['info_type']))) as $types) |
|
190 | + foreach (array($lookups['info_type'], array_map('strtolower', array_map('lang', $lookups['info_type']))) as $types) |
|
191 | 191 | { |
192 | - if($record['info_type'] && $key = array_search(strtolower($record['info_type']),$types)) |
|
192 | + if ($record['info_type'] && $key = array_search(strtolower($record['info_type']), $types)) |
|
193 | 193 | { |
194 | 194 | $lookups['info_status'] = $this->boinfolog->status[$key]; |
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
198 | 198 | $result = importexport_import_csv::convert($record, infolog_egw_record::$types, 'infolog', $lookups, $_definition->plugin_options['convert']); |
199 | - if($result) |
|
199 | + if ($result) |
|
200 | 200 | { |
201 | 201 | $this->warnings[$import_csv->get_current_position()] = $result; |
202 | 202 | } |
203 | 203 | |
204 | 204 | // Make sure type is valid |
205 | - if(!$record['info_type'] || $record['info_type'] && !$this->boinfolog->enums['type'][$record['info_type']]) |
|
205 | + if (!$record['info_type'] || $record['info_type'] && !$this->boinfolog->enums['type'][$record['info_type']]) |
|
206 | 206 | { |
207 | 207 | // Check for translated type |
208 | - $un_trans = Api\Translation::get_message_id($record['info_type'],'infolog'); |
|
209 | - if($record['info_type'] && $this->boinfolog->enums['type'][$un_trans]) |
|
208 | + $un_trans = Api\Translation::get_message_id($record['info_type'], 'infolog'); |
|
209 | + if ($record['info_type'] && $this->boinfolog->enums['type'][$un_trans]) |
|
210 | 210 | { |
211 | 211 | $record['info_type'] = $un_trans; |
212 | 212 | } |
213 | 213 | else |
214 | 214 | { |
215 | - $this->errors[$import_csv->get_current_position()] .= ($this->errors[$import_csv->get_current_position()] ? "\n":''). |
|
215 | + $this->errors[$import_csv->get_current_position()] .= ($this->errors[$import_csv->get_current_position()] ? "\n" : ''). |
|
216 | 216 | lang('Unknown type: %1', $record['info_type']); |
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | 220 | // Set default status for type, if not specified |
221 | - if(!$record['info_status'] && $record['info_type']) |
|
221 | + if (!$record['info_status'] && $record['info_type']) |
|
222 | 222 | { |
223 | 223 | $record['info_status'] = $this->boinfolog->status['defaults'][$record['info_type']]; |
224 | 224 | } |
225 | 225 | |
226 | - if($_definition->plugin_options['override_values']) |
|
226 | + if ($_definition->plugin_options['override_values']) |
|
227 | 227 | { |
228 | 228 | $egw_record = new infolog_egw_record(); |
229 | 229 | $egw_record->set_record($record); |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // Set owner, unless it's supposed to come from CSV file |
235 | - if($_definition->plugin_options['owner_from_csv']) |
|
235 | + if ($_definition->plugin_options['owner_from_csv']) |
|
236 | 236 | { |
237 | - if(!is_numeric($record['info_owner'])) |
|
237 | + if (!is_numeric($record['info_owner'])) |
|
238 | 238 | { |
239 | 239 | $this->errors[$import_csv->get_current_position()] = lang( |
240 | 240 | 'Invalid owner ID: %1. Might be a bad field translation. Used %2 instead.', |
@@ -251,51 +251,51 @@ discard block |
||
251 | 251 | if (!isset($record['info_owner'])) $record['info_owner'] = $GLOBALS['egw_info']['user']['account_id']; |
252 | 252 | |
253 | 253 | // Responsible has to be an array |
254 | - $record['info_responsible'] = $record['info_responsible'] ? explode(',',$record['info_responsible']) : 0; |
|
254 | + $record['info_responsible'] = $record['info_responsible'] ? explode(',', $record['info_responsible']) : 0; |
|
255 | 255 | |
256 | 256 | // Special values |
257 | 257 | if ($record['addressbook'] && !is_numeric($record['addressbook'])) |
258 | 258 | { |
259 | - list($lastname,$firstname,$org_name) = explode(',',$record['addressbook']); |
|
260 | - $record['addressbook'] = importexport_basic_import_csv::addr_id($lastname,$firstname,$org_name); |
|
259 | + list($lastname, $firstname, $org_name) = explode(',', $record['addressbook']); |
|
260 | + $record['addressbook'] = importexport_basic_import_csv::addr_id($lastname, $firstname, $org_name); |
|
261 | 261 | } |
262 | 262 | if ($record['projectmanager'] && !is_numeric($record['projectmanager'])) |
263 | 263 | { |
264 | 264 | $record['projectmanager'] = self::project_id($record['projectmanager']); |
265 | 265 | } |
266 | 266 | |
267 | - if ( $_definition->plugin_options['conditions'] ) |
|
267 | + if ($_definition->plugin_options['conditions']) |
|
268 | 268 | { |
269 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) |
|
269 | + foreach ($_definition->plugin_options['conditions'] as $condition) |
|
270 | 270 | { |
271 | 271 | $results = array(); |
272 | - switch ( $condition['type'] ) |
|
272 | + switch ($condition['type']) |
|
273 | 273 | { |
274 | 274 | // exists |
275 | 275 | case 'exists' : |
276 | - if($record[$condition['string']]) { |
|
277 | - $query['col_filter'] = array( $condition['string'] => $record[$condition['string']],); |
|
276 | + if ($record[$condition['string']]) { |
|
277 | + $query['col_filter'] = array($condition['string'] => $record[$condition['string']],); |
|
278 | 278 | // Needed to query custom fields |
279 | - if($condition['string'][0] == '#') $query['custom_fields'] = true; |
|
279 | + if ($condition['string'][0] == '#') $query['custom_fields'] = true; |
|
280 | 280 | $results = $this->boinfolog->search($query); |
281 | 281 | } |
282 | 282 | |
283 | - if ( is_array( $results ) && count( array_keys( $results )) >= 1) { |
|
283 | + if (is_array($results) && count(array_keys($results)) >= 1) { |
|
284 | 284 | // apply action to all records matching this exists condition |
285 | 285 | $action = $condition['true']; |
286 | - foreach ( (array)$results as $contact ) { |
|
286 | + foreach ((array)$results as $contact) { |
|
287 | 287 | $record['info_id'] = $contact['info_id']; |
288 | 288 | $record['info_owner'] = $contact['info_owner']; |
289 | - if ( $_definition->plugin_options['update_cats'] == 'add' ) { |
|
290 | - if ( !is_array( $contact['cat_id'] ) ) $contact['cat_id'] = explode( ',', $contact['cat_id'] ); |
|
291 | - if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
292 | - $record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $contact['cat_id'] ) ) ); |
|
289 | + if ($_definition->plugin_options['update_cats'] == 'add') { |
|
290 | + if (!is_array($contact['cat_id'])) $contact['cat_id'] = explode(',', $contact['cat_id']); |
|
291 | + if (!is_array($record['cat_id'])) $record['cat_id'] = explode(',', $record['cat_id']); |
|
292 | + $record['cat_id'] = implode(',', array_unique(array_merge($record['cat_id'], $contact['cat_id']))); |
|
293 | 293 | } |
294 | - $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
|
294 | + $success = $this->action($action['action'], $record, $import_csv->get_current_position()); |
|
295 | 295 | } |
296 | 296 | } else { |
297 | 297 | $action = $condition['false']; |
298 | - $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
|
298 | + $success = ($this->action($action['action'], $record, $import_csv->get_current_position())); |
|
299 | 299 | } |
300 | 300 | break; |
301 | 301 | |
@@ -310,16 +310,16 @@ discard block |
||
310 | 310 | else |
311 | 311 | { |
312 | 312 | // unconditional insert |
313 | - $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
|
313 | + $success = $this->action('insert', $record, $import_csv->get_current_position()); |
|
314 | 314 | } |
315 | - if($success) $count++; |
|
316 | - if($this->warnings[$import_csv->get_current_position()]) |
|
315 | + if ($success) $count++; |
|
316 | + if ($this->warnings[$import_csv->get_current_position()]) |
|
317 | 317 | { |
318 | - $this->warnings[$import_csv->get_current_position()] .= "\nRecord:\n" .array2string($record); |
|
318 | + $this->warnings[$import_csv->get_current_position()] .= "\nRecord:\n".array2string($record); |
|
319 | 319 | } |
320 | - if($this->errors[$import_csv->get_current_position()]) |
|
320 | + if ($this->errors[$import_csv->get_current_position()]) |
|
321 | 321 | { |
322 | - $this->errors[$import_csv->get_current_position()] .= "\nRecord:\n" .array2string($record); |
|
322 | + $this->errors[$import_csv->get_current_position()] .= "\nRecord:\n".array2string($record); |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | return $count; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $_data contact data for the action |
333 | 333 | * @return bool success or not |
334 | 334 | */ |
335 | - private function action ( $_action, $_data, $record_num = 0 ) |
|
335 | + private function action($_action, $_data, $record_num = 0) |
|
336 | 336 | { |
337 | 337 | $result = true; |
338 | 338 | switch ($_action) { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | // Only update if there are changes |
343 | 343 | $old = $this->boinfolog->read($_data['info_id']); |
344 | 344 | |
345 | - if(!$this->definition->plugin_options['change_owner']) |
|
345 | + if (!$this->definition->plugin_options['change_owner']) |
|
346 | 346 | { |
347 | 347 | // Don't change addressbook of an existing contact |
348 | 348 | unset($_data['owner']); |
@@ -351,21 +351,21 @@ discard block |
||
351 | 351 | // Merge to deal with fields not in import record |
352 | 352 | $_data = array_merge($old, $_data); |
353 | 353 | $changed = $this->tracking->changed_fields($_data, $old); |
354 | - if(count($changed) == 0 && !$this->definition->plugin_options['update_timestamp']) |
|
354 | + if (count($changed) == 0 && !$this->definition->plugin_options['update_timestamp']) |
|
355 | 355 | { |
356 | 356 | break; |
357 | 357 | } |
358 | 358 | |
359 | 359 | // Fall through |
360 | 360 | case 'insert' : |
361 | - if ( $this->dry_run ) |
|
361 | + if ($this->dry_run) |
|
362 | 362 | { |
363 | 363 | //print_r($_data); |
364 | 364 | |
365 | 365 | // Check for link during dry run |
366 | - if($_data['link_custom']) |
|
366 | + if ($_data['link_custom']) |
|
367 | 367 | { |
368 | - list($app, $app_id2) = explode(':', $_data['link_custom'],2); |
|
368 | + list($app, $app_id2) = explode(':', $_data['link_custom'], 2); |
|
369 | 369 | $app_id = $this->link_by_cf($record_num, $app, $field, $app_id2); |
370 | 370 | } |
371 | 371 | |
@@ -375,12 +375,12 @@ discard block |
||
375 | 375 | else |
376 | 376 | { |
377 | 377 | $result = $this->boinfolog->write( |
378 | - $_data, true, 2,true, // 2 = dont touch modification date |
|
378 | + $_data, true, 2, true, // 2 = dont touch modification date |
|
379 | 379 | $this->definition->plugin_options['no_notification'] |
380 | 380 | ); |
381 | - if(!$result) |
|
381 | + if (!$result) |
|
382 | 382 | { |
383 | - if($result === false) |
|
383 | + if ($result === false) |
|
384 | 384 | { |
385 | 385 | $this->errors[$record_num] = lang('Permissions error - %1 could not %2', |
386 | 386 | $GLOBALS['egw']->accounts->id2name($_data['info_owner']), |
@@ -403,20 +403,20 @@ discard block |
||
403 | 403 | } |
404 | 404 | |
405 | 405 | // Process some additional fields |
406 | - if(!is_numeric($result)) |
|
406 | + if (!is_numeric($result)) |
|
407 | 407 | { |
408 | 408 | return $result; |
409 | 409 | } |
410 | 410 | $info_link_id = $_data['info_link_id']; |
411 | - foreach(array_keys(self::$special_fields) as $field) |
|
411 | + foreach (array_keys(self::$special_fields) as $field) |
|
412 | 412 | { |
413 | - if(!$_data[$field]) continue; |
|
414 | - if(strpos($field, 'link') === 0) |
|
413 | + if (!$_data[$field]) continue; |
|
414 | + if (strpos($field, 'link') === 0) |
|
415 | 415 | { |
416 | - list($app, $app_id) = explode(':', $_data[$field],2); |
|
416 | + list($app, $app_id) = explode(':', $_data[$field], 2); |
|
417 | 417 | |
418 | 418 | // Linking to another entry based on matching custom fields |
419 | - if($field == 'link_custom') |
|
419 | + if ($field == 'link_custom') |
|
420 | 420 | { |
421 | 421 | $app_id = $this->link_by_cf($record_num, $app, $field, $app_id); |
422 | 422 | } |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | { |
431 | 431 | $id = $_data['info_id'] ? $_data['info_id'] : (int)$result; |
432 | 432 | //echo "<p>linking infolog:$id with $app:$app_id</p>\n"; |
433 | - $link_id = Link::link('infolog',$id,$app,$app_id); |
|
433 | + $link_id = Link::link('infolog', $id, $app, $app_id); |
|
434 | 434 | if ($link_id && !$info_link_id) |
435 | 435 | { |
436 | 436 | $to_write = array( |
437 | 437 | 'info_id' => $id, |
438 | 438 | 'info_link_id' => $link_id, |
439 | 439 | ); |
440 | - $this->boinfolog->write($to_write,False,false,true,true); // last true = no notifications, as no real change |
|
440 | + $this->boinfolog->write($to_write, False, false, true, true); // last true = no notifications, as no real change |
|
441 | 441 | $info_link_id = $link_id; |
442 | 442 | } |
443 | 443 | } |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | // Set the record field, with some type checks |
460 | 460 | $set = function($record, $field, $value) |
461 | 461 | { |
462 | - if(is_array($record->$field)) |
|
462 | + if (is_array($record->$field)) |
|
463 | 463 | { |
464 | 464 | array_unshift($record->$field, $value['value']); |
465 | 465 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | }; |
471 | 471 | |
472 | 472 | // Set category |
473 | - if($overrides['cat_id'] && $record::$types['select-cat']) |
|
473 | + if ($overrides['cat_id'] && $record::$types['select-cat']) |
|
474 | 474 | { |
475 | - foreach($record::$types['select-cat'] as $field) |
|
475 | + foreach ($record::$types['select-cat'] as $field) |
|
476 | 476 | { |
477 | 477 | $set($record, $field, $overrides['cat_id']); |
478 | 478 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * preserv => array, |
519 | 519 | * ) |
520 | 520 | */ |
521 | - public function get_options_etpl(importexport_definition &$definition=null) |
|
521 | + public function get_options_etpl(importexport_definition &$definition = null) |
|
522 | 522 | { |
523 | 523 | // lets do it! |
524 | 524 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | // Extra conversion functions - must be static |
573 | 573 | public static function project_id($num_or_title) |
574 | 574 | { |
575 | - static $boprojects=null; |
|
575 | + static $boprojects = null; |
|
576 | 576 | |
577 | 577 | if (!$num_or_title) return false; |
578 | 578 | |
@@ -599,18 +599,18 @@ discard block |
||
599 | 599 | { |
600 | 600 | $app_id = false; |
601 | 601 | |
602 | - list($custom_field, $value) = explode(':',$_value); |
|
602 | + list($custom_field, $value) = explode(':', $_value); |
|
603 | 603 | // Find matching entry |
604 | - if($app && $custom_field && $value) |
|
604 | + if ($app && $custom_field && $value) |
|
605 | 605 | { |
606 | 606 | $cfs = Api\Storage\Customfields::get($app); |
607 | 607 | // Error if no custom fields, probably something wrong in definition |
608 | - if(!$cfs[$custom_field]) |
|
608 | + if (!$cfs[$custom_field]) |
|
609 | 609 | { |
610 | 610 | // Check for users specifing label instead of name |
611 | - foreach($cfs as $name => $settings) |
|
611 | + foreach ($cfs as $name => $settings) |
|
612 | 612 | { |
613 | - if(strtolower($settings['label']) == strtolower($custom_field)) |
|
613 | + if (strtolower($settings['label']) == strtolower($custom_field)) |
|
614 | 614 | { |
615 | 615 | $custom_field = $name; |
616 | 616 | break; |
@@ -619,23 +619,23 @@ discard block |
||
619 | 619 | } |
620 | 620 | |
621 | 621 | // Couldn't find field, give an error - something's wrong |
622 | - if(!$cfs[$custom_field] && !$cfs[substr($custom_field,1)]) { |
|
622 | + if (!$cfs[$custom_field] && !$cfs[substr($custom_field, 1)]) { |
|
623 | 623 | $this->errors[$record_num] .= lang('No custom field "%1" for %2.', |
624 | 624 | $custom_field, lang($app)); |
625 | 625 | return false; |
626 | 626 | } |
627 | - if($custom_field[0] != '#') $custom_field = '#' . $custom_field; |
|
627 | + if ($custom_field[0] != '#') $custom_field = '#'.$custom_field; |
|
628 | 628 | |
629 | 629 | // Search |
630 | - if(Link::get_registry($app, 'query')) |
|
630 | + if (Link::get_registry($app, 'query')) |
|
631 | 631 | { |
632 | - $options = array('filter' => array("$custom_field = " . $GLOBALS['egw']->db->quote($value))); |
|
632 | + $options = array('filter' => array("$custom_field = ".$GLOBALS['egw']->db->quote($value))); |
|
633 | 633 | $result = Link::query($app, '', $options); |
634 | 634 | |
635 | 635 | // Only one allowed |
636 | - if(count($result) != 1) |
|
636 | + if (count($result) != 1) |
|
637 | 637 | { |
638 | - $this->warnings[$record_num] .= ($this->warnings[$record_num] ? "\n" : '') . |
|
638 | + $this->warnings[$record_num] .= ($this->warnings[$record_num] ? "\n" : ''). |
|
639 | 639 | lang('Unable to link to %3 by custom field "%1": "%4". %2 matches.', |
640 | 640 | $custom_field, count($result), lang($app), $options['filter'][0] |
641 | 641 | ); |
@@ -21,13 +21,13 @@ |
||
21 | 21 | $bo = new infolog_tracking(new infolog_bo()); |
22 | 22 | $this->export_fields = array('info_id' => 'Infolog ID', 'pm_id' => 'Project ID', 'project' => 'Project Name') + $bo->field2label; |
23 | 23 | // Add in created date, in the appropriate place |
24 | - $first = array_splice($this->export_fields, 0, array_search('info_datemodified',array_keys($this->export_fields))); |
|
24 | + $first = array_splice($this->export_fields, 0, array_search('info_datemodified', array_keys($this->export_fields))); |
|
25 | 25 | $this->export_fields = array_merge($first, array('info_created'=>'creation'), $this->export_fields); |
26 | 26 | |
27 | 27 | // Custom fields |
28 | 28 | unset($this->export_fields['custom']); // Heading, not a real field |
29 | 29 | $custom = Api\Storage\Customfields::get('infolog', true); |
30 | - foreach($custom as $name => $data) { |
|
30 | + foreach ($custom as $name => $data) { |
|
31 | 31 | $this->export_fields['#'.$name] = $data['label']; |
32 | 32 | } |
33 | 33 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | class infolog_wizard_export_csv extends importexport_wizard_basic_export_csv |
16 | 16 | { |
17 | - public function __construct() { |
|
17 | + public function __construct() |
|
18 | + { |
|
18 | 19 | parent::__construct(); |
19 | 20 | |
20 | 21 | // Field mapping |
@@ -27,7 +28,8 @@ discard block |
||
27 | 28 | // Custom fields |
28 | 29 | unset($this->export_fields['custom']); // Heading, not a real field |
29 | 30 | $custom = Api\Storage\Customfields::get('infolog', true); |
30 | - foreach($custom as $name => $data) { |
|
31 | + foreach($custom as $name => $data) |
|
32 | + { |
|
31 | 33 | $this->export_fields['#'.$name] = $data['label']; |
32 | 34 | } |
33 | 35 | } |
@@ -109,8 +109,8 @@ |
||
109 | 109 | */ |
110 | 110 | public function get_selectors_etpl() { |
111 | 111 | return array( |
112 | - 'name' => 'infolog.export_csv_selectors', |
|
113 | - 'content' => 'search' |
|
114 | - ); |
|
112 | + 'name' => 'infolog.export_csv_selectors', |
|
113 | + 'content' => 'search' |
|
114 | + ); |
|
115 | 115 | } |
116 | 116 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @param egw_record $_definition |
25 | 25 | */ |
26 | - public function export( $_stream, importexport_definition $_definition) { |
|
26 | + public function export($_stream, importexport_definition $_definition) { |
|
27 | 27 | $options = $_definition->plugin_options; |
28 | 28 | $this->bo = new infolog_bo(); |
29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $ids = array(); |
34 | 34 | $query = array(); |
35 | - switch($options['selection']) |
|
35 | + switch ($options['selection']) |
|
36 | 36 | { |
37 | 37 | case 'search': |
38 | 38 | $query = array_merge(Api\Cache::getSession('infolog', 'session_data'), $query); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | break; |
46 | 46 | default: |
47 | - $ids = $this->selection = explode(',',$options['selection']); |
|
47 | + $ids = $this->selection = explode(',', $options['selection']); |
|
48 | 48 | break; |
49 | 49 | } |
50 | 50 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function get_filename() |
91 | 91 | { |
92 | - if(is_array($this->selection) && count($this->selection) == 1) |
|
92 | + if (is_array($this->selection) && count($this->selection) == 1) |
|
93 | 93 | { |
94 | 94 | return $this->bo->link_title(current($this->selection)); |
95 | 95 | } |
@@ -16,19 +16,24 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * export iCal plugin of infolog |
18 | 18 | */ |
19 | -class infolog_export_ical extends infolog_export_csv { |
|
19 | +class infolog_export_ical extends infolog_export_csv |
|
20 | +{ |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Exports records as defined in $_definition |
23 | 24 | * |
24 | 25 | * @param egw_record $_definition |
25 | 26 | */ |
26 | - public function export( $_stream, importexport_definition $_definition) { |
|
27 | + public function export( $_stream, importexport_definition $_definition) |
|
28 | + { |
|
27 | 29 | $options = $_definition->plugin_options; |
28 | 30 | $this->bo = new infolog_bo(); |
29 | 31 | |
30 | 32 | $limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
31 | - if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('infolog'); |
|
33 | + if (!$limit_exception) |
|
34 | + { |
|
35 | + $export_limit = Api\Storage\Merge::getExportLimit('infolog'); |
|
36 | + } |
|
32 | 37 | |
33 | 38 | $ids = array(); |
34 | 39 | $query = array(); |
@@ -57,7 +62,8 @@ discard block |
||
57 | 62 | * |
58 | 63 | * @return string name |
59 | 64 | */ |
60 | - public static function get_name() { |
|
65 | + public static function get_name() |
|
66 | + { |
|
61 | 67 | return lang('Infolog iCal export'); |
62 | 68 | } |
63 | 69 | |
@@ -66,7 +72,8 @@ discard block |
||
66 | 72 | * |
67 | 73 | * @return string descriprion |
68 | 74 | */ |
69 | - public static function get_description() { |
|
75 | + public static function get_description() |
|
76 | + { |
|
70 | 77 | return lang("Exports in iCal format."); |
71 | 78 | } |
72 | 79 | |
@@ -75,11 +82,13 @@ discard block |
||
75 | 82 | * |
76 | 83 | * @return string suffix |
77 | 84 | */ |
78 | - public static function get_filesuffix() { |
|
85 | + public static function get_filesuffix() |
|
86 | + { |
|
79 | 87 | return 'ics'; |
80 | 88 | } |
81 | 89 | |
82 | - public static function get_mimetype() { |
|
90 | + public static function get_mimetype() |
|
91 | + { |
|
83 | 92 | return 'text/infolog'; |
84 | 93 | } |
85 | 94 | |
@@ -118,7 +127,8 @@ discard block |
||
118 | 127 | * returns selectors of this plugin |
119 | 128 | * |
120 | 129 | */ |
121 | - public function get_selectors_etpl() { |
|
130 | + public function get_selectors_etpl() |
|
131 | + { |
|
122 | 132 | return array( |
123 | 133 | 'name' => 'infolog.export_csv_selectors', |
124 | 134 | 'content' => 'search' |
@@ -225,7 +225,7 @@ |
||
225 | 225 | |
226 | 226 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
227 | 227 | $link['link_id'] != $info['info_link_id'] && |
228 | - ($link['app'] != $action || $link['id'] != $action_id) && |
|
228 | + ($link['app'] != $action || $link['id'] != $action_id) && |
|
229 | 229 | ($show_links == 'all' || ($show_links == 'links') === ($link['app'] != Link::VFS_APPNAME))) |
230 | 230 | { |
231 | 231 | $info['filelinks'][] = $link; |
@@ -97,7 +97,10 @@ discard block |
||
97 | 97 | */ |
98 | 98 | function __construct(Etemplate $etemplate = null) |
99 | 99 | { |
100 | - if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') Api\Translation::add_app('infolog'); |
|
100 | + if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') |
|
101 | + { |
|
102 | + Api\Translation::add_app('infolog'); |
|
103 | + } |
|
101 | 104 | |
102 | 105 | // Make sure Global category is infolog - on first load, it may not be |
103 | 106 | if($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
@@ -169,13 +172,19 @@ discard block |
||
169 | 172 | $done = $info['info_status'] == 'done' || $info['info_status'] == 'billed' || $info['info_status'] == 'cancelled'; //cancelled is regarded as a completed status as well in bo |
170 | 173 | // regard an infolog as done/billed/cancelled if its percentage is 100% when there is to status like the above for that type |
171 | 174 | if (!$done && !isset($this->bo->status[$info['info_type']]['done']) && !isset($this->bo->status[$info['info_type']]['billed']) && |
172 | - !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) $done = true ; |
|
175 | + !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) |
|
176 | + { |
|
177 | + $done = true ; |
|
178 | + } |
|
173 | 179 | $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']] . ($done ? '_done' : ''); |
174 | 180 | if (!$done && $info['info_enddate'] < $this->bo->user_time_now) |
175 | 181 | { |
176 | 182 | $info['end_class'] = 'infolog_overdue'; |
177 | 183 | } |
178 | - if (!isset($info['info_anz_subs'])) $info['info_anz_subs'] = $this->bo->anzSubs($id); |
|
184 | + if (!isset($info['info_anz_subs'])) |
|
185 | + { |
|
186 | + $info['info_anz_subs'] = $this->bo->anzSubs($id); |
|
187 | + } |
|
179 | 188 | $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id |
180 | 189 | $info['info_percent'] = (int) $info['info_percent'].'%'; |
181 | 190 | $editrights = $this->bo->check_access($info,Acl::EDIT); |
@@ -208,12 +217,21 @@ discard block |
||
208 | 217 | { |
209 | 218 | $info['class'] .= 'rowNoSubs '; |
210 | 219 | } |
211 | - if ($info['info_id_parent']) $info['class'] .= 'infolog_rowHasParent '; |
|
212 | - if ($info['info_anz_subs'] > 0) $info['class'] .= 'infolog_rowHasSubs '; |
|
220 | + if ($info['info_id_parent']) |
|
221 | + { |
|
222 | + $info['class'] .= 'infolog_rowHasParent '; |
|
223 | + } |
|
224 | + if ($info['info_anz_subs'] > 0) |
|
225 | + { |
|
226 | + $info['class'] .= 'infolog_rowHasSubs '; |
|
227 | + } |
|
213 | 228 | |
214 | 229 | $info['row_mod'] = $info['info_datemodified']; |
215 | 230 | |
216 | - if (!$show_links) $show_links = $this->prefs['show_links']; |
|
231 | + if (!$show_links) |
|
232 | + { |
|
233 | + $show_links = $this->prefs['show_links']; |
|
234 | + } |
|
217 | 235 | if (($show_links != 'none' && $show_links != 'no_describtion' || |
218 | 236 | $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) && |
219 | 237 | (isset($info['links']) || ($info['links'] = Link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true)))) |
@@ -223,9 +241,16 @@ discard block |
||
223 | 241 | { |
224 | 242 | // incl. link modification time into row_mod (link's lastmod is always in server-time!) |
225 | 243 | $link_mod = Api\DateTime::server2user($link['lastmod']); |
226 | - if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod; |
|
244 | + if ($info['row_mod'] < $link_mod) |
|
245 | + { |
|
246 | + $info['row_mod'] = $link_mod; |
|
247 | + } |
|
227 | 248 | |
228 | - if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
249 | + if ($link['deleted']) |
|
250 | + { |
|
251 | + continue; |
|
252 | + } |
|
253 | + // skip deleted links, but incl. them in row_mod! |
|
229 | 254 | |
230 | 255 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
231 | 256 | $link['link_id'] != $info['info_link_id'] && |
@@ -238,14 +263,20 @@ discard block |
||
238 | 263 | { |
239 | 264 | $info['pm_id'] = $link['id']; |
240 | 265 | } |
241 | - if ($link['app'] == 'timesheet') $timesheets[] = $link['id']; |
|
266 | + if ($link['app'] == 'timesheet') |
|
267 | + { |
|
268 | + $timesheets[] = $link['id']; |
|
269 | + } |
|
242 | 270 | } |
243 | 271 | if ($this->prefs['show_times'] && isset($GLOBALS['egw_info']['user']['apps']['timesheet']) && $timesheets) |
244 | 272 | { |
245 | 273 | $sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets); |
246 | 274 | $info['info_sum_timesheets'] = $sum['duration']; |
247 | 275 | // incl. max timesheet modification in row_mod |
248 | - if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified']; |
|
276 | + if ($info['row_mod'] < $sum['max_modified']) |
|
277 | + { |
|
278 | + $info['row_mod'] = $sum['max_modified']; |
|
279 | + } |
|
249 | 280 | } |
250 | 281 | } |
251 | 282 | $info['info_type_label'] = $this->bo->enums['type'][$info['info_type']]; |
@@ -260,10 +291,13 @@ discard block |
||
260 | 291 | } |
261 | 292 | $readonlys["edit_percent[$id]"] = true; |
262 | 293 | } |
263 | - elseif($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
294 | + elseif($readonlys["edit_percent[$id]"]) |
|
295 | + { |
|
296 | + // show percent, but button is switched off |
|
264 | 297 | { |
265 | 298 | $info['info_percent2'] = $info['info_percent']; |
266 | 299 | } |
300 | + } |
|
267 | 301 | if ($this->prefs['show_id'] == 1 || $this->prefs['show_id'] == 2 && $details) |
268 | 302 | { |
269 | 303 | $info['info_number'] = $info['info_id']; |
@@ -339,10 +373,16 @@ discard block |
||
339 | 373 | |
340 | 374 | $GLOBALS['egw']->session->commit_session(); |
341 | 375 | $orginal_colfilter = $query['col_filter']; |
342 | - if (isset($parent_id)) $query['col_filter']['info_id_parent'] = (string)$parent_id; |
|
376 | + if (isset($parent_id)) |
|
377 | + { |
|
378 | + $query['col_filter']['info_id_parent'] = (string)$parent_id; |
|
379 | + } |
|
343 | 380 | |
344 | 381 | //echo "<p>infolog_ui.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]',col_filter=".print_r($query['col_filter'],True).",sort=$query[sort],order=$query[order])</p>\n"; |
345 | - if (!isset($query['start'])) $query['start'] = 0; |
|
382 | + if (!isset($query['start'])) |
|
383 | + { |
|
384 | + $query['start'] = 0; |
|
385 | + } |
|
346 | 386 | |
347 | 387 | // handle action and linked filter (show only entries linked to a certain other entry) |
348 | 388 | $link_filters = array(); |
@@ -371,7 +411,10 @@ discard block |
||
371 | 411 | $app = $link['app']; |
372 | 412 | $id = $link['id']; |
373 | 413 | } |
374 | - if(!is_array($id)) $id = explode(',',$id); |
|
414 | + if(!is_array($id)) |
|
415 | + { |
|
416 | + $id = explode(',',$id); |
|
417 | + } |
|
375 | 418 | if (!($linked = Link::get_links_multiple($app,$id,true,'infolog','',$query['col_filter']['info_status'] == 'deleted'))) |
376 | 419 | { |
377 | 420 | $rows = array(); // no infologs linked to selected link --> no rows to return |
@@ -420,7 +463,10 @@ discard block |
||
420 | 463 | } |
421 | 464 | } |
422 | 465 | // Framework\Template change forces the UI to do a full update first, no point in getting rows right now |
423 | - if($old_template && $old_template != $query['template']) return 0; |
|
466 | + if($old_template && $old_template != $query['template']) |
|
467 | + { |
|
468 | + return 0; |
|
469 | + } |
|
424 | 470 | |
425 | 471 | // do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific |
426 | 472 | // so we have to check that as well |
@@ -481,7 +527,10 @@ discard block |
||
481 | 527 | $parent_first = !empty($parents) && count($parents) == 1; |
482 | 528 | $parent_index = 0; |
483 | 529 | // et2 nextmatch listens to total, and only displays that many rows, so add parent in or we'll lose the last row |
484 | - if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
530 | + if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) |
|
531 | + { |
|
532 | + $query['total']++; |
|
533 | + } |
|
485 | 534 | |
486 | 535 | // Check to see if we need to remove description |
487 | 536 | foreach($infos as $id => $info) |
@@ -509,7 +558,10 @@ discard block |
||
509 | 558 | { |
510 | 559 | foreach(array_keys($main) as $n) |
511 | 560 | { |
512 | - if ($n[0] == '#' && !in_array($n, $columselection)) unset($main[$n]); |
|
561 | + if ($n[0] == '#' && !in_array($n, $columselection)) |
|
562 | + { |
|
563 | + unset($main[$n]); |
|
564 | + } |
|
513 | 565 | } |
514 | 566 | break; |
515 | 567 | } |
@@ -526,8 +578,14 @@ discard block |
||
526 | 578 | } |
527 | 579 | unset($links); |
528 | 580 | |
529 | - if ($query['cat_id']) $rows['no_cat_id'] = true; |
|
530 | - if ($query['no_actions']) $rows['no_actions'] = true; |
|
581 | + if ($query['cat_id']) |
|
582 | + { |
|
583 | + $rows['no_cat_id'] = true; |
|
584 | + } |
|
585 | + if ($query['no_actions']) |
|
586 | + { |
|
587 | + $rows['no_actions'] = true; |
|
588 | + } |
|
531 | 589 | $rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']); |
532 | 590 | if($clear_status_filter) |
533 | 591 | { |
@@ -571,7 +629,11 @@ discard block |
||
571 | 629 | $GLOBALS['egw_info']['flags']['app_header'] = implode(': ', $headers); |
572 | 630 | } |
573 | 631 | |
574 | - if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
632 | + if (isset($linked)) |
|
633 | + { |
|
634 | + $query['col_filter']['linked'] = $linked; |
|
635 | + } |
|
636 | + // add linked back to the colfilter |
|
575 | 637 | |
576 | 638 | return $query['total']; |
577 | 639 | } |
@@ -588,7 +650,10 @@ discard block |
||
588 | 650 | $set = array(); |
589 | 651 | if ((int)$data['id'] && ($info = $this->bo->read($data['id']))) |
590 | 652 | { |
591 | - if ($info['info_cat']) $set['cat_id'] = $info['info_cat']; |
|
653 | + if ($info['info_cat']) |
|
654 | + { |
|
655 | + $set['cat_id'] = $info['info_cat']; |
|
656 | + } |
|
592 | 657 | if ($info['info_used_time']) |
593 | 658 | { |
594 | 659 | $set['ts_duration'] = $info['info_used_time']; |
@@ -639,7 +704,10 @@ discard block |
||
639 | 704 | 'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted'] |
640 | 705 | )); |
641 | 706 | unset($event['entry_id']); |
642 | - if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
707 | + if (!$event['end']) |
|
708 | + { |
|
709 | + $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
710 | + } |
|
643 | 711 | |
644 | 712 | // Match Api\Categories by name |
645 | 713 | $event['category'] = $GLOBALS['egw']->categories->name2id(Api\Categories::id2name($infolog['info_cat'])); |
@@ -698,7 +766,10 @@ discard block |
||
698 | 766 | // Copy same custom fields |
699 | 767 | foreach(array_keys(Api\Storage\Customfields::get('calendar')) as $name) |
700 | 768 | { |
701 | - if ($this->bo->customfields[$name]) $event['#'.$name] = $infolog['#'.$name]; |
|
769 | + if ($this->bo->customfields[$name]) |
|
770 | + { |
|
771 | + $event['#'.$name] = $infolog['#'.$name]; |
|
772 | + } |
|
702 | 773 | } |
703 | 774 | //error_log(__METHOD__.'('.array2string($data).') infolog='.array2string($infolog).' returning '.array2string($event)); |
704 | 775 | return $event; |
@@ -870,13 +941,19 @@ discard block |
||
870 | 941 | $values['nm']['sort'] = 'DESC'; |
871 | 942 | } |
872 | 943 | |
873 | - if (!$values['nm']['session_for'] && $this->called_by) $values['nm']['session_for'] = $this->called_by; |
|
944 | + if (!$values['nm']['session_for'] && $this->called_by) |
|
945 | + { |
|
946 | + $values['nm']['session_for'] = $this->called_by; |
|
947 | + } |
|
874 | 948 | |
875 | 949 | $action_id = $values['action_id'] = $action ? $action_id : $nm['action_id']; |
876 | 950 | $action_title = $values['action_title'] = $action ? $action_title : $nm['action_title']; |
877 | 951 | $action = $values['action'] = $action ? $action : $nm['action']; |
878 | 952 | } |
879 | - if($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
953 | + if($_GET['search']) |
|
954 | + { |
|
955 | + $values['nm']['search'] = $_GET['search']; |
|
956 | + } |
|
880 | 957 | |
881 | 958 | if ($values['nm']['add']) |
882 | 959 | { |
@@ -888,7 +965,10 @@ discard block |
||
888 | 965 | switch ($action) |
889 | 966 | { |
890 | 967 | case 'sp': |
891 | - if (!is_array($action_id) && strpos($action_id, 'infolog:') === 0) $action_id = (int)substr($action_id, 8); |
|
968 | + if (!is_array($action_id) && strpos($action_id, 'infolog:') === 0) |
|
969 | + { |
|
970 | + $action_id = (int)substr($action_id, 8); |
|
971 | + } |
|
892 | 972 | if ((is_array($action_id) && !$this->bo->read(current($action_id))) || !$this->bo->read($action_id)) |
893 | 973 | { |
894 | 974 | $action = ''; |
@@ -935,7 +1015,10 @@ discard block |
||
935 | 1015 | // Allow add actions even when there's no rows |
936 | 1016 | $values['nm']['placeholder_actions'] = array('new'); |
937 | 1017 | |
938 | - if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
1018 | + if(!isset($values['nm']['filter2'])) |
|
1019 | + { |
|
1020 | + $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
1021 | + } |
|
939 | 1022 | |
940 | 1023 | // disable columns for main entry as set in the pref for details or no details |
941 | 1024 | $values['nm']['columnselection_pref'] = 'nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows') |
@@ -960,7 +1043,10 @@ discard block |
||
960 | 1043 | { |
961 | 1044 | foreach (array_keys($values['nm']['col_filter']) as $colfk) |
962 | 1045 | { |
963 | - if (is_int($colfk)) unset($values['nm']['col_filter']); |
|
1046 | + if (is_int($colfk)) |
|
1047 | + { |
|
1048 | + unset($values['nm']['col_filter']); |
|
1049 | + } |
|
964 | 1050 | } |
965 | 1051 | } |
966 | 1052 | $values['action'] = $persist['action'] = $values['nm']['action'] = $action; |
@@ -1003,7 +1089,10 @@ discard block |
||
1003 | 1089 | // does not take implicit rights as delegated into account, so they will not be available as filters |
1004 | 1090 | foreach($this->bo->group_owners as $type => $group) |
1005 | 1091 | { |
1006 | - if (!isset($this->bo->grants[$group])) unset($sel_options['info_type'][$type]); |
|
1092 | + if (!isset($this->bo->grants[$group])) |
|
1093 | + { |
|
1094 | + unset($sel_options['info_type'][$type]); |
|
1095 | + } |
|
1007 | 1096 | } |
1008 | 1097 | |
1009 | 1098 | |
@@ -1384,7 +1473,10 @@ discard block |
||
1384 | 1473 | return $failed == 0; |
1385 | 1474 | |
1386 | 1475 | case 'document': |
1387 | - if (!$settings) $settings = $this->prefs['default_document']; |
|
1476 | + if (!$settings) |
|
1477 | + { |
|
1478 | + $settings = $this->prefs['default_document']; |
|
1479 | + } |
|
1388 | 1480 | $document_merge = new infolog_merge(); |
1389 | 1481 | $msg = $document_merge->download($settings, $checked, '', $this->prefs['document_dir']); |
1390 | 1482 | $failed = count($checked); |
@@ -1592,11 +1684,16 @@ discard block |
||
1592 | 1684 | #_debug_array($info); |
1593 | 1685 | $status = $info['info_status']; |
1594 | 1686 | // closed stati assumed array('done','billed','cancelled') |
1595 | - if (isset($this->bo->status[$info['info_type']]['done'])) { |
|
1687 | + if (isset($this->bo->status[$info['info_type']]['done'])) |
|
1688 | + { |
|
1596 | 1689 | $status ='done'; |
1597 | - } elseif (isset($this->bo->status[$info['info_type']]['billed'])) { |
|
1690 | + } |
|
1691 | + elseif (isset($this->bo->status[$info['info_type']]['billed'])) |
|
1692 | + { |
|
1598 | 1693 | $status ='billed'; |
1599 | - } elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) { |
|
1694 | + } |
|
1695 | + elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) |
|
1696 | + { |
|
1600 | 1697 | $status ='cancelled'; |
1601 | 1698 | } |
1602 | 1699 | #_debug_array($status); |
@@ -1610,17 +1707,25 @@ discard block |
||
1610 | 1707 | $this->bo->write($values, true,true,true,$skip_notification); |
1611 | 1708 | |
1612 | 1709 | $query = array('action'=>'sp','action_id'=>$info_id); |
1613 | - if (!$closesingle) { |
|
1710 | + if (!$closesingle) |
|
1711 | + { |
|
1614 | 1712 | foreach((array)$this->bo->search($query) as $info) |
1615 | 1713 | { |
1616 | - if ($info['info_id_parent'] == $info_id) // search also returns linked entries! |
|
1714 | + if ($info['info_id_parent'] == $info_id) |
|
1617 | 1715 | { |
1618 | - $this->close($info['info_id'],$referer,$closesingle,$skip_notification); // we call ourselfs recursive to process subs from subs too |
|
1716 | + // search also returns linked entries! |
|
1717 | + { |
|
1718 | + $this->close($info['info_id'],$referer,$closesingle,$skip_notification); |
|
1719 | + } |
|
1720 | + // we call ourselfs recursive to process subs from subs too |
|
1619 | 1721 | } |
1620 | 1722 | } |
1621 | 1723 | } |
1622 | 1724 | } |
1623 | - if ($referer) $this->tmpl->location($referer); |
|
1725 | + if ($referer) |
|
1726 | + { |
|
1727 | + $this->tmpl->location($referer); |
|
1728 | + } |
|
1624 | 1729 | } |
1625 | 1730 | |
1626 | 1731 | /** |
@@ -1636,10 +1741,13 @@ discard block |
||
1636 | 1741 | $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
1637 | 1742 | $referer = is_array($values) ? $values['referer'] : $_referer; |
1638 | 1743 | |
1639 | - if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) // entries without subs get confirmed by javascript |
|
1744 | + if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) |
|
1745 | + { |
|
1746 | + // entries without subs get confirmed by javascript |
|
1640 | 1747 | { |
1641 | 1748 | $values = array('delete' => true); |
1642 | 1749 | } |
1750 | + } |
|
1643 | 1751 | //echo "<p>infolog_ui::delete(".print_r($values,true).",'$referer','$called_by') info_id=$info_id</p>\n"; |
1644 | 1752 | |
1645 | 1753 | if (is_array($values) || $info_id <= 0) |
@@ -1648,11 +1756,16 @@ discard block |
||
1648 | 1756 | { |
1649 | 1757 | $deleted = $this->bo->delete($info_id,$values['delete_subs'],$values['info_id_parent'], $skip_notification); |
1650 | 1758 | } |
1651 | - if ($called_by) // direct call from the same request |
|
1759 | + if ($called_by) |
|
1760 | + { |
|
1761 | + // direct call from the same request |
|
1652 | 1762 | { |
1653 | 1763 | return $deleted ? lang('InfoLog entry deleted') : ''; |
1654 | 1764 | } |
1655 | - if ($values['called_by'] == 'edit') // we run in the edit popup => give control back to edit |
|
1765 | + } |
|
1766 | + if ($values['called_by'] == 'edit') |
|
1767 | + { |
|
1768 | + // we run in the edit popup => give control back to edit |
|
1656 | 1769 | { |
1657 | 1770 | $this->edit(array( |
1658 | 1771 | 'info_id' => $info_id, |
@@ -1661,6 +1774,7 @@ discard block |
||
1661 | 1774 | 'msg' => $deleted ? lang('Infolog entry deleted') : '', |
1662 | 1775 | )); |
1663 | 1776 | } |
1777 | + } |
|
1664 | 1778 | return $referer ? $this->tmpl->location($referer) : $this->index(); |
1665 | 1779 | } |
1666 | 1780 | $readonlys = $values = array(); |
@@ -1709,10 +1823,17 @@ discard block |
||
1709 | 1823 | $no_popup = $content['no_popup']; unset($content['no_popup']); |
1710 | 1824 | |
1711 | 1825 | $button = @key($content['button']); |
1712 | - if (!$button && $action) $button = $action; // action selectbox |
|
1826 | + if (!$button && $action) |
|
1827 | + { |
|
1828 | + $button = $action; |
|
1829 | + } |
|
1830 | + // action selectbox |
|
1713 | 1831 | //info_cc expects an comma separated string |
1714 | 1832 | //error_log(__METHOD__.__LINE__.array2string($content)); |
1715 | - if (empty($content['info_cc'])) $content['info_cc'] = ""; |
|
1833 | + if (empty($content['info_cc'])) |
|
1834 | + { |
|
1835 | + $content['info_cc'] = ""; |
|
1836 | + } |
|
1716 | 1837 | if (is_array($content['info_cc'])) |
1717 | 1838 | { |
1718 | 1839 | foreach($content['info_cc'] as $i => $value) |
@@ -1722,7 +1843,10 @@ discard block |
||
1722 | 1843 | //error_log(__METHOD__.__LINE__.$value.'->'.array2string($addresses[0])); |
1723 | 1844 | $content['info_cc'][$i]=$addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
1724 | 1845 | } |
1725 | - if (!empty($content['info_cc'])) $content['info_cc'] = implode(',',$content['info_cc']); |
|
1846 | + if (!empty($content['info_cc'])) |
|
1847 | + { |
|
1848 | + $content['info_cc'] = implode(',',$content['info_cc']); |
|
1849 | + } |
|
1726 | 1850 | } |
1727 | 1851 | unset($content['button']); |
1728 | 1852 | if ($button) |
@@ -1806,9 +1930,12 @@ discard block |
||
1806 | 1930 | $content['link_to']['to_app'] = 'infolog'; |
1807 | 1931 | $content['link_to']['to_id'] = $info_id; |
1808 | 1932 | |
1809 | - if ($info_link_id && strpos($info_link_id,':') !== false) // updating info_link_id if necessary |
|
1933 | + if ($info_link_id && strpos($info_link_id,':') !== false) |
|
1934 | + { |
|
1935 | + // updating info_link_id if necessary |
|
1810 | 1936 | { |
1811 | 1937 | list($app,$id) = explode(':',$info_link_id); |
1938 | + } |
|
1812 | 1939 | $link = Link::get_link('infolog',$info_id,$app,$id); |
1813 | 1940 | if ((int) $content['info_link_id'] != (int) $link['link_id']) |
1814 | 1941 | { |
@@ -1838,12 +1965,19 @@ discard block |
||
1838 | 1965 | } |
1839 | 1966 | elseif ($button == 'delete' && $info_id > 0) |
1840 | 1967 | { |
1841 | - if (!$referer && $action) $referer = array( |
|
1968 | + if (!$referer && $action) |
|
1969 | + { |
|
1970 | + $referer = array( |
|
1842 | 1971 | 'menuaction' => 'infolog.infolog_ui.index', |
1843 | 1972 | 'action' => $action, |
1844 | 1973 | 'action_id' => $action_id |
1845 | 1974 | ); |
1846 | - if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first |
|
1975 | + } |
|
1976 | + if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) |
|
1977 | + { |
|
1978 | + return; |
|
1979 | + } |
|
1980 | + // checks ACL first |
|
1847 | 1981 | |
1848 | 1982 | Framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
1849 | 1983 | } |
@@ -1893,7 +2027,11 @@ discard block |
||
1893 | 2027 | $type = $type ? $type : $_REQUEST['type']; |
1894 | 2028 | $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : |
1895 | 2029 | Api\Header\Referer::get('/index.php?menuaction=infolog.infolog_ui.index')); |
1896 | - if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer |
|
2030 | + if (strpos($referer, 'msg=') !== false) |
|
2031 | + { |
|
2032 | + $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); |
|
2033 | + } |
|
2034 | + // remove previou/old msg from referer |
|
1897 | 2035 | $no_popup = $_GET['no_popup']; |
1898 | 2036 | $print = (int) $_REQUEST['print']; |
1899 | 2037 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
@@ -1910,7 +2048,11 @@ discard block |
||
1910 | 2048 | { |
1911 | 2049 | $content['info_cat'] = $this->prefs['cat_add_default']; |
1912 | 2050 | } |
1913 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
2051 | + if ($_GET['msg']) |
|
2052 | + { |
|
2053 | + $content['msg'] = strip_tags($_GET['msg']); |
|
2054 | + } |
|
2055 | + // dont allow HTML! |
|
1914 | 2056 | |
1915 | 2057 | switch($this->prefs['set_start']) |
1916 | 2058 | { |
@@ -1921,13 +2063,19 @@ discard block |
||
1921 | 2063 | if ((int)$content['info_link_id'] > 0 && !Link::get_link($content['info_link_id'])) |
1922 | 2064 | { |
1923 | 2065 | $content['info_link_id'] = 0; // link has been deleted |
1924 | - if (!$content['info_custom_link']) $content['info_from'] = ''; |
|
2066 | + if (!$content['info_custom_link']) |
|
2067 | + { |
|
2068 | + $content['info_from'] = ''; |
|
2069 | + } |
|
1925 | 2070 | } |
1926 | - if (!$info_id && $action_id && $action == 'sp') // new SubProject |
|
2071 | + if (!$info_id && $action_id && $action == 'sp') |
|
2072 | + { |
|
2073 | + // new SubProject |
|
1927 | 2074 | { |
1928 | 2075 | if (!$this->bo->check_access($action_id,Acl::ADD)) |
1929 | 2076 | { |
1930 | 2077 | return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); |
2078 | + } |
|
1931 | 2079 | } |
1932 | 2080 | } |
1933 | 2081 | else |
@@ -1961,10 +2109,16 @@ discard block |
||
1961 | 2109 | case 'copy': |
1962 | 2110 | $info_id = 0; |
1963 | 2111 | $this->create_copy($content, $action == 'sp'); |
1964 | - if ($action == 'sp') // for sub-entries use type or category, like for new entries |
|
2112 | + if ($action == 'sp') |
|
2113 | + { |
|
2114 | + // for sub-entries use type or category, like for new entries |
|
1965 | 2115 | { |
1966 | 2116 | if ($type) $content['info_type'] = $type; |
1967 | - if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
2117 | + } |
|
2118 | + if (is_numeric($_REQUEST['cat_id'])) |
|
2119 | + { |
|
2120 | + $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
2121 | + } |
|
1968 | 2122 | } |
1969 | 2123 | unset($action); // it get stored in $content and will cause an other copy after [apply] |
1970 | 2124 | break; |
@@ -1993,7 +2147,10 @@ discard block |
||
1993 | 2147 | { |
1994 | 2148 | foreach((array)$set['link_app'] as $i => $l_app) |
1995 | 2149 | { |
1996 | - if (($l_id=$set['link_id'][$i])) Link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
2150 | + if (($l_id=$set['link_id'][$i])) |
|
2151 | + { |
|
2152 | + Link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
2153 | + } |
|
1997 | 2154 | } |
1998 | 2155 | unset($set['link_app']); |
1999 | 2156 | unset($set['link_id']); |
@@ -2012,8 +2169,15 @@ discard block |
||
2012 | 2169 | break; // normal edit |
2013 | 2170 | } |
2014 | 2171 | case 'new': // new entry, set some defaults, if not set by infolog_set hook |
2015 | - if (empty($content['info_startdate'])) $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
2016 | - if (empty($content['info_priority'])) $content['info_priority'] = 1; // normal |
|
2172 | + if (empty($content['info_startdate'])) |
|
2173 | + { |
|
2174 | + $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
2175 | + } |
|
2176 | + if (empty($content['info_priority'])) |
|
2177 | + { |
|
2178 | + $content['info_priority'] = 1; |
|
2179 | + } |
|
2180 | + // normal |
|
2017 | 2181 | $content['info_owner'] = $this->user; |
2018 | 2182 | if ($type != '' && empty($content['info_type'])) |
2019 | 2183 | { |
@@ -2023,8 +2187,14 @@ discard block |
||
2023 | 2187 | { |
2024 | 2188 | $content['info_type'] = $GLOBALS['egw_info']['user']['preferences']['infolog']['preferred_type']; |
2025 | 2189 | } |
2026 | - if (empty($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2027 | - if (empty($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2190 | + if (empty($content['info_status'])) |
|
2191 | + { |
|
2192 | + $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2193 | + } |
|
2194 | + if (empty($content['info_percent'])) |
|
2195 | + { |
|
2196 | + $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2197 | + } |
|
2028 | 2198 | break; |
2029 | 2199 | } |
2030 | 2200 | if (!isset($this->bo->enums['type'][$content['info_type']])) |
@@ -2128,7 +2298,10 @@ discard block |
||
2128 | 2298 | |
2129 | 2299 | $content['duration_format'] = $this->duration_format; |
2130 | 2300 | $content['hours_per_workday'] = $this->hours_per_workday; |
2131 | - if ($this->prefs['show_id']) $content['info_number'] = $info_id; |
|
2301 | + if ($this->prefs['show_id']) |
|
2302 | + { |
|
2303 | + $content['info_number'] = $info_id; |
|
2304 | + } |
|
2132 | 2305 | |
2133 | 2306 | // Check no notification preference, update if type changed |
2134 | 2307 | if($content['info_type'] != $content['old_type']) |
@@ -2219,7 +2392,10 @@ discard block |
||
2219 | 2392 | //$content['info_des'] = substr($content['info_des'],0,1793); |
2220 | 2393 | //echo "<p>infolog_ui.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); |
2221 | 2394 | //$content['info_cc'] is expected (by the widget) to be an array of emailaddresses, but is stored as comma separated string |
2222 | - if (!empty($content['info_cc'])&&!is_array($content['info_cc']))$content['info_cc'] = explode(',',$content['info_cc']); |
|
2395 | + if (!empty($content['info_cc'])&&!is_array($content['info_cc'])) |
|
2396 | + { |
|
2397 | + $content['info_cc'] = explode(',',$content['info_cc']); |
|
2398 | + } |
|
2223 | 2399 | $preserve = array_merge( $preserv, array( // preserved values |
2224 | 2400 | 'info_id' => $info_id, |
2225 | 2401 | 'action' => $action, |
@@ -2249,7 +2425,11 @@ discard block |
||
2249 | 2425 | foreach ($exclude_fields as $field) |
2250 | 2426 | { |
2251 | 2427 | unset($content[$field]); |
2252 | - if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
2428 | + if ($field == 'info_from') |
|
2429 | + { |
|
2430 | + unset($content['info_link_id']); |
|
2431 | + } |
|
2432 | + // both together is called contact in UI |
|
2253 | 2433 | } |
2254 | 2434 | if ($create_sub) |
2255 | 2435 | { |
@@ -2277,13 +2457,25 @@ discard block |
||
2277 | 2457 | $content['info_type'] = $types[0]; |
2278 | 2458 | } |
2279 | 2459 | // get a consistent status, percent and date-completed |
2280 | - if (!isset($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2281 | - if (!isset($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2460 | + if (!isset($content['info_status'])) |
|
2461 | + { |
|
2462 | + $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
|
2463 | + } |
|
2464 | + if (!isset($content['info_percent'])) |
|
2465 | + { |
|
2466 | + $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
|
2467 | + } |
|
2282 | 2468 | $content['info_datecompleted'] =$content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
2283 | 2469 | |
2284 | - if (!isset($content['info_cat'])) $content['info_cat'] = $this->prefs['cat_add_default']; |
|
2470 | + if (!isset($content['info_cat'])) |
|
2471 | + { |
|
2472 | + $content['info_cat'] = $this->prefs['cat_add_default']; |
|
2473 | + } |
|
2285 | 2474 | |
2286 | - if(!is_array($content['link_to'])) $content['link_to'] = array(); |
|
2475 | + if(!is_array($content['link_to'])) |
|
2476 | + { |
|
2477 | + $content['link_to'] = array(); |
|
2478 | + } |
|
2287 | 2479 | $content['link_to']['to_app'] = 'infolog'; |
2288 | 2480 | $content['link_to']['to_id'] = 0; |
2289 | 2481 | // Get links to be copied, if not excluded |
@@ -2621,7 +2813,10 @@ discard block |
||
2621 | 2813 | } |
2622 | 2814 | foreach($this->bo->customfields as $name => $data) |
2623 | 2815 | { |
2624 | - if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) continue; |
|
2816 | + if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) |
|
2817 | + { |
|
2818 | + continue; |
|
2819 | + } |
|
2625 | 2820 | |
2626 | 2821 | $fields['#'.$name] = array( |
2627 | 2822 | 'label' => $data['label'], |
@@ -55,32 +55,32 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @var string |
57 | 57 | */ |
58 | - var $duration_format = ','; // comma is necessary! |
|
58 | + var $duration_format = ','; // comma is necessary! |
|
59 | 59 | |
60 | 60 | var $icons = array( |
61 | 61 | 'type' => array( |
62 | - 'task' => 'task.gif', 'task_alt' => 'Task', |
|
63 | - 'phone' => 'phone.gif', 'phone_alt' => 'Phonecall', |
|
64 | - 'note' => 'note.gif', 'note_alt' => 'Note', |
|
65 | - 'confirm' => 'confirm.gif', 'confirm_alt' => 'Confirmation', |
|
66 | - 'reject' => 'reject.gif', 'reject_alt' => 'Reject', |
|
67 | - 'email' => 'email.gif', 'email_alt' => 'Email' ), |
|
62 | + 'task' => 'task.gif', 'task_alt' => 'Task', |
|
63 | + 'phone' => 'phone.gif', 'phone_alt' => 'Phonecall', |
|
64 | + 'note' => 'note.gif', 'note_alt' => 'Note', |
|
65 | + 'confirm' => 'confirm.gif', 'confirm_alt' => 'Confirmation', |
|
66 | + 'reject' => 'reject.gif', 'reject_alt' => 'Reject', |
|
67 | + 'email' => 'email.gif', 'email_alt' => 'Email' ), |
|
68 | 68 | 'action' => array( |
69 | - 'new' => 'new.gif', 'new_alt' => 'Add Sub', |
|
70 | - 'view' => 'view.gif', 'view_alt' => 'View Subs', |
|
71 | - 'parent' => 'parent.gif', 'parent_alt' => 'View other Subs', |
|
72 | - 'edit' => 'edit.gif', 'edit_alt' => 'Edit', |
|
73 | - 'addfile' => 'addfile.gif', 'addfile_alt' => 'Add a file', |
|
74 | - 'delete' => 'delete.gif', 'delete_alt' => 'Delete', |
|
75 | - 'close' => 'done.gif', 'close_alt' => 'Close' , |
|
76 | - 'close_all' => 'done_all.gif', 'close_all_alt' => 'Close' ), |
|
69 | + 'new' => 'new.gif', 'new_alt' => 'Add Sub', |
|
70 | + 'view' => 'view.gif', 'view_alt' => 'View Subs', |
|
71 | + 'parent' => 'parent.gif', 'parent_alt' => 'View other Subs', |
|
72 | + 'edit' => 'edit.gif', 'edit_alt' => 'Edit', |
|
73 | + 'addfile' => 'addfile.gif', 'addfile_alt' => 'Add a file', |
|
74 | + 'delete' => 'delete.gif', 'delete_alt' => 'Delete', |
|
75 | + 'close' => 'done.gif', 'close_alt' => 'Close', |
|
76 | + 'close_all' => 'done_all.gif', 'close_all_alt' => 'Close' ), |
|
77 | 77 | 'status' => array( |
78 | - 'billed' => 'billed.gif', 'billed_alt' => 'billed', |
|
79 | - 'done' => 'done.gif', 'done_alt' => 'done', |
|
78 | + 'billed' => 'billed.gif', 'billed_alt' => 'billed', |
|
79 | + 'done' => 'done.gif', 'done_alt' => 'done', |
|
80 | 80 | 'will-call' => 'will-call.gif', 'will-call_alt' => 'will-call', |
81 | - 'call' => 'call.gif', 'call_alt' => 'call', |
|
82 | - 'ongoing' => 'ongoing.gif', 'ongoing_alt' => 'ongoing', |
|
83 | - 'offer' => 'offer.gif', 'offer_alt' => 'offer' ) |
|
81 | + 'call' => 'call.gif', 'call_alt' => 'call', |
|
82 | + 'ongoing' => 'ongoing.gif', 'ongoing_alt' => 'ongoing', |
|
83 | + 'offer' => 'offer.gif', 'offer_alt' => 'offer' ) |
|
84 | 84 | ); |
85 | 85 | var $filters; |
86 | 86 | var $messages = array( |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') Api\Translation::add_app('infolog'); |
101 | 101 | |
102 | 102 | // Make sure Global category is infolog - on first load, it may not be |
103 | - if($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
|
103 | + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name) |
|
104 | 104 | { |
105 | 105 | $GLOBALS['egw']->categories = new Api\Categories(); |
106 | 106 | } |
107 | 107 | |
108 | 108 | $this->bo = new infolog_bo(); |
109 | 109 | |
110 | - if($etemplate === null) |
|
110 | + if ($etemplate === null) |
|
111 | 111 | { |
112 | 112 | $etemplate = new Etemplate(); |
113 | 113 | } |
@@ -115,18 +115,18 @@ discard block |
||
115 | 115 | |
116 | 116 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
117 | 117 | |
118 | - $this->prefs =& $GLOBALS['egw_info']['user']['preferences']['infolog']; |
|
118 | + $this->prefs = & $GLOBALS['egw_info']['user']['preferences']['infolog']; |
|
119 | 119 | |
120 | 120 | // read the duration format from project-manager |
121 | 121 | if ($GLOBALS['egw_info']['apps']['projectmanager']) |
122 | 122 | { |
123 | 123 | $pm_config = Api\Config::read('projectmanager'); |
124 | - $this->duration_format = str_replace(',','',implode('', (array)$pm_config['duration_units'])); |
|
124 | + $this->duration_format = str_replace(',', '', implode('', (array)$pm_config['duration_units'])); |
|
125 | 125 | //error_log(__METHOD__."() ".__LINE__." duration_format=$this->duration_format, duration_unit=".array2string($pm_config['duration_units'])); |
126 | 126 | $this->hours_per_workday = $pm_config['hours_per_workday']; |
127 | 127 | unset($pm_config); |
128 | 128 | } |
129 | - $this->filters =& $this->bo->filters; |
|
129 | + $this->filters = & $this->bo->filters; |
|
130 | 130 | /* these are just for testing of the notifications |
131 | 131 | for($i = -1; $i <= 3; ++$i) |
132 | 132 | { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $this->filters['responsible-open-date'.date('Y-m-d',time()+$i*24*60*60)] = "responsible starting in $i day(s)"; |
146 | 146 | } |
147 | 147 | */ |
148 | - $GLOBALS['infolog_ui'] =& $this; // make ourself availible for ExecMethod of get_rows function |
|
148 | + $GLOBALS['infolog_ui'] = & $this; // make ourself availible for ExecMethod of get_rows function |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param int $details |
160 | 160 | * @return array |
161 | 161 | */ |
162 | - function get_info($info,&$readonlys,$action='',$action_id='',$show_links=false,$details = 1) |
|
162 | + function get_info($info, &$readonlys, $action = '', $action_id = '', $show_links = false, $details = 1) |
|
163 | 163 | { |
164 | 164 | if (!is_array($info)) |
165 | 165 | { |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | $done = $info['info_status'] == 'done' || $info['info_status'] == 'billed' || $info['info_status'] == 'cancelled'; //cancelled is regarded as a completed status as well in bo |
170 | 170 | // regard an infolog as done/billed/cancelled if its percentage is 100% when there is to status like the above for that type |
171 | 171 | if (!$done && !isset($this->bo->status[$info['info_type']]['done']) && !isset($this->bo->status[$info['info_type']]['billed']) && |
172 | - !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) $done = true ; |
|
173 | - $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']] . ($done ? '_done' : ''); |
|
172 | + !isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent'] == 100) $done = true; |
|
173 | + $info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']].($done ? '_done' : ''); |
|
174 | 174 | if (!$done && $info['info_enddate'] < $this->bo->user_time_now) |
175 | 175 | { |
176 | 176 | $info['end_class'] = 'infolog_overdue'; |
177 | 177 | } |
178 | 178 | if (!isset($info['info_anz_subs'])) $info['info_anz_subs'] = $this->bo->anzSubs($id); |
179 | - $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id |
|
180 | - $info['info_percent'] = (int) $info['info_percent'].'%'; |
|
181 | - $editrights = $this->bo->check_access($info,Acl::EDIT); |
|
179 | + $this->bo->link_id2from($info, $action, $action_id); // unset from for $action:$action_id |
|
180 | + $info['info_percent'] = (int)$info['info_percent'].'%'; |
|
181 | + $editrights = $this->bo->check_access($info, Acl::EDIT); |
|
182 | 182 | $isresposible = $this->bo->is_responsible($info); |
183 | 183 | if ((!($editrights || // edit rights or more then standard responsible rights |
184 | - $isresposible && array_diff($this->bo->responsible_edit,array('info_status','info_percent','info_datecompleted'))))) |
|
184 | + $isresposible && array_diff($this->bo->responsible_edit, array('info_status', 'info_percent', 'info_datecompleted'))))) |
|
185 | 185 | { |
186 | 186 | $info['class'] .= 'rowNoEdit '; |
187 | 187 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | { |
201 | 201 | $info['class'] .= 'rowNoCloseAll '; |
202 | 202 | } |
203 | - if (!$this->bo->check_access($info,Acl::DELETE)) |
|
203 | + if (!$this->bo->check_access($info, Acl::DELETE)) |
|
204 | 204 | { |
205 | 205 | $info['class'] .= 'rowNoDelete '; |
206 | 206 | } |
207 | - if (!$this->bo->check_access($info,Acl::ADD)) |
|
207 | + if (!$this->bo->check_access($info, Acl::ADD)) |
|
208 | 208 | { |
209 | 209 | $info['class'] .= 'rowNoSubs '; |
210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if (!$show_links) $show_links = $this->prefs['show_links']; |
217 | 217 | if (($show_links != 'none' && $show_links != 'no_describtion' || |
218 | 218 | $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) && |
219 | - (isset($info['links']) || ($info['links'] = Link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true)))) |
|
219 | + (isset($info['links']) || ($info['links'] = Link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true, true)))) |
|
220 | 220 | { |
221 | 221 | $timesheets = array(); |
222 | 222 | foreach ($info['links'] as $link) |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $link_mod = Api\DateTime::server2user($link['lastmod']); |
226 | 226 | if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod; |
227 | 227 | |
228 | - if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
228 | + if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod! |
|
229 | 229 | |
230 | 230 | if ($show_links != 'none' && $show_links != 'no_describtion' && |
231 | 231 | $link['link_id'] != $info['info_link_id'] && |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | if ($this->prefs['show_times'] && isset($GLOBALS['egw_info']['user']['apps']['timesheet']) && $timesheets) |
244 | 244 | { |
245 | - $sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets); |
|
245 | + $sum = ExecMethod('timesheet.timesheet_bo.sum', $timesheets); |
|
246 | 246 | $info['info_sum_timesheets'] = $sum['duration']; |
247 | 247 | // incl. max timesheet modification in row_mod |
248 | 248 | if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified']; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | $readonlys["edit_percent[$id]"] = true; |
262 | 262 | } |
263 | - elseif($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
263 | + elseif ($readonlys["edit_percent[$id]"]) // show percent, but button is switched off |
|
264 | 264 | { |
265 | 265 | $info['info_percent2'] = $info['info_percent']; |
266 | 266 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | protected static function filter(array $query) |
282 | 282 | { |
283 | 283 | $filter = $query['filter'] ? 'filter' : ($query['cat_id'] ? 'cat_id' : null); |
284 | - foreach((array)$query['col_filter'] as $name => $value) |
|
284 | + foreach ((array)$query['col_filter'] as $name => $value) |
|
285 | 285 | { |
286 | 286 | if ((string)$value !== '') |
287 | 287 | { |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @param array &$readonlys |
302 | 302 | * @return int |
303 | 303 | */ |
304 | - function get_rows(&$query,&$rows,&$readonlys) |
|
304 | + function get_rows(&$query, &$rows, &$readonlys) |
|
305 | 305 | { |
306 | 306 | //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()); |
307 | 307 | if (!$query['csv_export']) |
@@ -318,20 +318,20 @@ discard block |
||
318 | 318 | } |
319 | 319 | //error_log(__METHOD__."() prefs[listNoSubs]=".array2string($this->prefs['listNoSubs'])." --> parent_id=$parent_id"); |
320 | 320 | unset($query['col_filter']['parent_id']); |
321 | - if(!$query['action']) |
|
321 | + if (!$query['action']) |
|
322 | 322 | { |
323 | 323 | Api\Cache::setSession('infolog', $query['session_for'].'session_data', |
324 | - array_diff_key ($query, array_flip(array('rows','actions','action_links','placeholder_actions')))); |
|
324 | + array_diff_key($query, array_flip(array('rows', 'actions', 'action_links', 'placeholder_actions')))); |
|
325 | 325 | } |
326 | 326 | $query['actions'] = $this->get_actions($query); |
327 | 327 | $query['row_id'] = 'info_id'; |
328 | 328 | $query['row_modified'] = 'row_mod'; |
329 | 329 | $query['parent_id'] = 'info_id_parent'; |
330 | 330 | $query['is_parent'] = 'info_anz_subs'; |
331 | - $query['action_var'] = 'multi_action'; // as 'action' is already used in infolog |
|
331 | + $query['action_var'] = 'multi_action'; // as 'action' is already used in infolog |
|
332 | 332 | } |
333 | 333 | // nextmatch opened an infolog containing children --> do not filter them, always show all children |
334 | - elseif($query['csv_export'] === 'children') |
|
334 | + elseif ($query['csv_export'] === 'children') |
|
335 | 335 | { |
336 | 336 | $query['filter'] = $query['search'] = $query['cat_id'] = ''; |
337 | 337 | $query['col_filter'] = array('info_id_parent' => $query['col_filter']['info_id_parent']); |
@@ -353,17 +353,17 @@ discard block |
||
353 | 353 | $links['linked'] = array(); |
354 | 354 | unset($query['col_filter']['linked']); |
355 | 355 | } |
356 | - if($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id']) |
|
356 | + if ($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id']) |
|
357 | 357 | { |
358 | 358 | $link_filters['action'] = array('app'=>$query['action'], 'id' => $query['action_id']); |
359 | 359 | $links['action'] = array(); |
360 | 360 | } |
361 | - foreach($link_filters as $key => $link) |
|
361 | + foreach ($link_filters as $key => $link) |
|
362 | 362 | { |
363 | - if(!is_array($link)) |
|
363 | + if (!is_array($link)) |
|
364 | 364 | { |
365 | 365 | // Legacy string style |
366 | - list($app,$id) = explode(':',$link); |
|
366 | + list($app, $id) = explode(':', $link); |
|
367 | 367 | } |
368 | 368 | else |
369 | 369 | { |
@@ -371,25 +371,25 @@ discard block |
||
371 | 371 | $app = $link['app']; |
372 | 372 | $id = $link['id']; |
373 | 373 | } |
374 | - if(!is_array($id)) $id = explode(',',$id); |
|
375 | - if (!($linked = Link::get_links_multiple($app,$id,true,'infolog','',$query['col_filter']['info_status'] == 'deleted'))) |
|
374 | + if (!is_array($id)) $id = explode(',', $id); |
|
375 | + if (!($linked = Link::get_links_multiple($app, $id, true, 'infolog', '', $query['col_filter']['info_status'] == 'deleted'))) |
|
376 | 376 | { |
377 | - $rows = array(); // no infologs linked to selected link --> no rows to return |
|
377 | + $rows = array(); // no infologs linked to selected link --> no rows to return |
|
378 | 378 | return 0; |
379 | 379 | } |
380 | 380 | |
381 | 381 | |
382 | - foreach($linked as $infos) |
|
382 | + foreach ($linked as $infos) |
|
383 | 383 | { |
384 | - $links[$key] = array_merge($links[$key],$infos); |
|
384 | + $links[$key] = array_merge($links[$key], $infos); |
|
385 | 385 | } |
386 | 386 | $links[$key] = array_unique($links[$key]); |
387 | - if($key == 'linked') |
|
387 | + if ($key == 'linked') |
|
388 | 388 | { |
389 | 389 | $linked = array('app' => $app, 'id' => $id, 'title' => (count($id) == 1 ? Link::title($app, $id) : lang('multiple'))); |
390 | 390 | } |
391 | 391 | } |
392 | - if(count($links)) |
|
392 | + if (count($links)) |
|
393 | 393 | { |
394 | 394 | $query['col_filter']['info_id'] = count($links) > 1 ? call_user_func_array('array_intersect', $links) : $links[$key]; |
395 | 395 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $old_template = $query['template']; |
399 | 399 | |
400 | 400 | // Reset custom, type-specific template if type was cleared (without changing it for home) |
401 | - if(!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0) |
|
401 | + if (!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0) |
|
402 | 402 | { |
403 | 403 | $query['template'] = 'infolog.index.rows'; |
404 | 404 | } |
@@ -409,10 +409,10 @@ discard block |
||
409 | 409 | if ($tpl->read('infolog.index.rows.'.$query['col_filter']['info_type'])) |
410 | 410 | { |
411 | 411 | $query['template'] = $tpl->name; |
412 | - $query['custom_fields'] = true; // read the custom fields too |
|
412 | + $query['custom_fields'] = true; // read the custom fields too |
|
413 | 413 | } |
414 | 414 | // If status is not valid for selected type, clear status filter |
415 | - if($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' && |
|
415 | + if ($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' && |
|
416 | 416 | !in_array($query['col_filter']['info_status'], array_keys($this->bo->status[$query['col_filter']['info_type']]))) |
417 | 417 | { |
418 | 418 | $query['col_filter']['info_status'] = ''; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } |
421 | 421 | } |
422 | 422 | // Framework\Template change forces the UI to do a full update first, no point in getting rows right now |
423 | - if($old_template && $old_template != $query['template']) return 0; |
|
423 | + if ($old_template && $old_template != $query['template']) return 0; |
|
424 | 424 | |
425 | 425 | // do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific |
426 | 426 | // so we have to check that as well |
@@ -433,14 +433,14 @@ discard block |
||
433 | 433 | |
434 | 434 | if (!$query['selectcols'] && $columselection) |
435 | 435 | { |
436 | - $columselection = is_array($columselection) ? $columselection : explode(',',$columselection); |
|
436 | + $columselection = is_array($columselection) ? $columselection : explode(',', $columselection); |
|
437 | 437 | } |
438 | 438 | else |
439 | 439 | { |
440 | - $columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',',$query['selectcols'])) : array(); |
|
440 | + $columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',', $query['selectcols'])) : array(); |
|
441 | 441 | } |
442 | 442 | // do we need to query the cf's |
443 | - $query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields',$columselection)); |
|
443 | + $query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields', $columselection)); |
|
444 | 444 | |
445 | 445 | $infos = $this->bo->search($query); |
446 | 446 | $query['col_filter'] = $orginal_colfilter; |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | $query['default_cols'] = '!cat_id,info_datemodified,info_used_time_info_planned_time,info_used_time_info_planned_time_info_replanned_time,info_id'; |
459 | 459 | } |
460 | 460 | // 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) |
461 | - $this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']],'info_used_time_info_planned_time') !== false; |
|
461 | + $this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']], 'info_used_time_info_planned_time') !== false; |
|
462 | 462 | |
463 | 463 | // query all links and sub counts in one go |
464 | 464 | if ($infos && (!$query['csv_export'] || !is_array($query['csv_export']))) |
465 | 465 | { |
466 | - $links = Link::get_links_multiple('infolog',array_keys($infos),true,'','link_lastmod DESC',true); // true=incl. deleted |
|
466 | + $links = Link::get_links_multiple('infolog', array_keys($infos), true, '', 'link_lastmod DESC', true); // true=incl. deleted |
|
467 | 467 | $anzSubs = $this->bo->anzSubs(array_keys($infos)); |
468 | 468 | } |
469 | 469 | $rows = array(); |
@@ -474,26 +474,26 @@ discard block |
||
474 | 474 | $parents = $query['action'] == 'sp' && $query['action_id'] ? (array)$query['action_id'] : array(); |
475 | 475 | if (!empty($parents) && count($parents) == 1 && is_array($query['action_id'])) |
476 | 476 | { |
477 | - $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header |
|
477 | + $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | 481 | $parent_first = !empty($parents) && count($parents) == 1; |
482 | 482 | $parent_index = 0; |
483 | 483 | // et2 nextmatch listens to total, and only displays that many rows, so add parent in or we'll lose the last row |
484 | - if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
484 | + if ($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++; |
|
485 | 485 | |
486 | 486 | // Check to see if we need to remove description |
487 | - foreach($infos as $id => $info) |
|
487 | + foreach ($infos as $id => $info) |
|
488 | 488 | { |
489 | 489 | if (!$query['csv_export'] || !is_array($query['csv_export'])) |
490 | 490 | { |
491 | - $info['links'] =& $links[$id]; |
|
491 | + $info['links'] = & $links[$id]; |
|
492 | 492 | $info['info_anz_subs'] = (int)$anzSubs[$id]; |
493 | - $info = $this->get_info($info,$readonlys,null,null,false,$details); |
|
493 | + $info = $this->get_info($info, $readonlys, null, null, false, $details); |
|
494 | 494 | } |
495 | 495 | // for subs view ('sp') add parent(s) in front of subs once(!) |
496 | - if ( $parent_first && ($main = $this->bo->read($query['action_id'])) || |
|
496 | + if ($parent_first && ($main = $this->bo->read($query['action_id'])) || |
|
497 | 497 | $parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false && |
498 | 498 | ($main = $this->bo->read($info['info_id_parent']))) |
499 | 499 | { |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | // as read() always read them all, while search() only reads the selected ones |
504 | 504 | if ($query['custom_fields']) |
505 | 505 | { |
506 | - foreach($columselection as $col) |
|
506 | + foreach ($columselection as $col) |
|
507 | 507 | { |
508 | 508 | if ($col[0] == '#') |
509 | 509 | { |
510 | - foreach(array_keys($main) as $n) |
|
510 | + foreach (array_keys($main) as $n) |
|
511 | 511 | { |
512 | 512 | if ($n[0] == '#' && !in_array($n, $columselection)) unset($main[$n]); |
513 | 513 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | } |
518 | 518 | $parent_first = false; |
519 | - if($query['start'] == 0) |
|
519 | + if ($query['start'] == 0) |
|
520 | 520 | { |
521 | 521 | array_splice($rows, $id, 0, array($main)); |
522 | 522 | unset($parents[$parent_index]); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | if ($query['cat_id']) $rows['no_cat_id'] = true; |
530 | 530 | if ($query['no_actions']) $rows['no_actions'] = true; |
531 | 531 | $rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']); |
532 | - if($clear_status_filter) |
|
532 | + if ($clear_status_filter) |
|
533 | 533 | { |
534 | 534 | $rows['info_status'] = ''; |
535 | 535 | } |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $headers[] = lang($this->filters[$query['filter']]); |
561 | 561 | } |
562 | 562 | if ($query['action'] && ($title = $query['action_title'] || is_array($query['action_id']) ? |
563 | - $query['action_title'] : Link::title($query['action']=='sp'?'infolog':$query['action'],$query['action_id']))) |
|
563 | + $query['action_title'] : Link::title($query['action'] == 'sp' ? 'infolog' : $query['action'], $query['action_id']))) |
|
564 | 564 | { |
565 | 565 | $headers[] = $title; |
566 | 566 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $GLOBALS['egw_info']['flags']['app_header'] = implode(': ', $headers); |
572 | 572 | } |
573 | 573 | |
574 | - if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
574 | + if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter |
|
575 | 575 | |
576 | 576 | return $query['total']; |
577 | 577 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $set['ts_unitprice'] = $info['info_price']; |
603 | 603 | } |
604 | 604 | |
605 | - foreach(Link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true) as $link) |
|
605 | + foreach (Link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true) as $link) |
|
606 | 606 | { |
607 | 607 | if ($link['app'] != 'timesheet' && $link['app'] != Link::VFS_APPNAME) |
608 | 608 | { |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | { |
629 | 629 | return $data; |
630 | 630 | } |
631 | - $event = array_merge($data,array( |
|
631 | + $event = array_merge($data, array( |
|
632 | 632 | 'category' => $GLOBALS['egw']->categories->check_list(Acl::READ, $infolog['info_cat']), |
633 | 633 | 'priority' => $infolog['info_priority'] + 1, |
634 | 634 | 'public' => $infolog['info_access'] != 'private', |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | 'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted'] |
640 | 640 | )); |
641 | 641 | unset($event['entry_id']); |
642 | - if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60; |
|
642 | + if (!$event['end']) $event['end'] = $event['start'] + (int)$GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60; |
|
643 | 643 | |
644 | 644 | // Match Api\Categories by name |
645 | 645 | $event['category'] = $GLOBALS['egw']->categories->name2id(Api\Categories::id2name($infolog['info_cat'])); |
@@ -648,38 +648,38 @@ discard block |
||
648 | 648 | $event['owner'] = $user = $GLOBALS['egw_info']['user']['account_id']; |
649 | 649 | |
650 | 650 | // add/modify participants according to prefs |
651 | - $prefs = explode(',',$this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user'); |
|
651 | + $prefs = explode(',', $this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user'); |
|
652 | 652 | |
653 | 653 | // if no default participants (selected calendars) --> remove all |
654 | - if (!in_array('selected',$prefs)) |
|
654 | + if (!in_array('selected', $prefs)) |
|
655 | 655 | { |
656 | 656 | $event['participants'] = $event['participant_types'] = array(); |
657 | 657 | } |
658 | 658 | // Add responsible as participant |
659 | - if (in_array('responsible',$prefs)) |
|
659 | + if (in_array('responsible', $prefs)) |
|
660 | 660 | { |
661 | - foreach($infolog['info_responsible'] as $responsible) |
|
661 | + foreach ($infolog['info_responsible'] as $responsible) |
|
662 | 662 | { |
663 | 663 | $event['participants'][$responsible] = $event['participant_types']['u'][$responsible] = |
664 | - calendar_so::combine_status($user==$responsible?'A':'U'); |
|
664 | + calendar_so::combine_status($user == $responsible ? 'A' : 'U'); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | // Add linked contact as participant |
668 | - if (in_array('contact',$prefs) && $infolog['info_link']['app'] == 'addressbook') |
|
668 | + if (in_array('contact', $prefs) && $infolog['info_link']['app'] == 'addressbook') |
|
669 | 669 | { |
670 | - $event['participants'][calendar_so::combine_user('c',$infolog['info_link']['id'])] = |
|
670 | + $event['participants'][calendar_so::combine_user('c', $infolog['info_link']['id'])] = |
|
671 | 671 | $event['participant_types']['c'][$infolog['info_link']['id']] = calendar_so::combine_status('U'); |
672 | 672 | } |
673 | - if (in_array('owner',$prefs)) |
|
673 | + if (in_array('owner', $prefs)) |
|
674 | 674 | { |
675 | 675 | $event['participants'][$infolog['info_owner']] = $event['participant_types']['u'][$infolog['info_owner']] = |
676 | - calendar_so::combine_status('A',1,'CHAIR'); |
|
676 | + calendar_so::combine_status('A', 1, 'CHAIR'); |
|
677 | 677 | } |
678 | 678 | // Add current user, if set or no other participants, which is not allowed |
679 | - if (in_array('user',$prefs)) |
|
679 | + if (in_array('user', $prefs)) |
|
680 | 680 | { |
681 | 681 | $event['participants'][$user] = $event['participant_types']['u'][$user] = |
682 | - calendar_so::combine_status('A',1,'CHAIR'); |
|
682 | + calendar_so::combine_status('A', 1, 'CHAIR'); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | // Add infolog link to calendar entry |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $event['link_id'][] = $infolog['info_link']['id']; |
688 | 688 | |
689 | 689 | // Copy infolog's links |
690 | - foreach(Link::get_links('infolog',$infolog['info_id'],'','link_lastmod DESC',true) as $link) |
|
690 | + foreach (Link::get_links('infolog', $infolog['info_id'], '', 'link_lastmod DESC', true) as $link) |
|
691 | 691 | { |
692 | 692 | if ($link['app'] != Link::VFS_APPNAME) |
693 | 693 | { |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | } |
697 | 697 | } |
698 | 698 | // Copy same custom fields |
699 | - foreach(array_keys(Api\Storage\Customfields::get('calendar')) as $name) |
|
699 | + foreach (array_keys(Api\Storage\Customfields::get('calendar')) as $name) |
|
700 | 700 | { |
701 | 701 | if ($this->bo->customfields[$name]) $event['#'.$name] = $infolog['#'.$name]; |
702 | 702 | } |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | public function cal_to_include($args) |
718 | 718 | { |
719 | 719 | $nm = Api\Cache::getSession('infolog', 'session_data'); |
720 | - if($nm) |
|
720 | + if ($nm) |
|
721 | 721 | { |
722 | 722 | $args['order'] = $nm['order']; |
723 | 723 | $args['sort'] = $nm['sort']; |
@@ -737,9 +737,9 @@ discard block |
||
737 | 737 | * @param string $own_referer='' this is our own referer |
738 | 738 | * @param string $action_title='' app_header for the action, if '' we try the link-title |
739 | 739 | */ |
740 | - function index($values = null,$action='',$action_id='',$called_as=0,$extra_app_header=False,$return_html=False,$own_referer='',$action_title='') |
|
740 | + function index($values = null, $action = '', $action_id = '', $called_as = 0, $extra_app_header = False, $return_html = False, $own_referer = '', $action_title = '') |
|
741 | 741 | { |
742 | - unset($extra_app_header); // not used, but dont want to change signature |
|
742 | + unset($extra_app_header); // not used, but dont want to change signature |
|
743 | 743 | if (is_array($values)) |
744 | 744 | { |
745 | 745 | $called_as = $values['called_as']; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | elseif ($own_referer === '') |
749 | 749 | { |
750 | 750 | $own_referer = Api\Header\Referer::get(); |
751 | - if (strpos($own_referer,'menuaction=infolog.infolog_ui.edit') !== false) |
|
751 | + if (strpos($own_referer, 'menuaction=infolog.infolog_ui.edit') !== false) |
|
752 | 752 | { |
753 | 753 | $own_referer = Api\Cache::getSession('infolog', 'own_session'); |
754 | 754 | } |
@@ -759,11 +759,11 @@ discard block |
||
759 | 759 | } |
760 | 760 | |
761 | 761 | // Handle legacy buttons like actions |
762 | - if(is_array($values)) |
|
762 | + if (is_array($values)) |
|
763 | 763 | { |
764 | - foreach(array('document', 'view', 'delete') as $button) |
|
764 | + foreach (array('document', 'view', 'delete') as $button) |
|
765 | 765 | { |
766 | - if(isset($values['nm']['rows'][$button])) |
|
766 | + if (isset($values['nm']['rows'][$button])) |
|
767 | 767 | { |
768 | 768 | $id = @key($values['nm']['rows'][$button]); |
769 | 769 | $values['nm']['multi_action'] = $button; |
@@ -783,27 +783,27 @@ discard block |
||
783 | 783 | // Some processing to add values in for links and cats |
784 | 784 | $multi_action = $values['nm']['multi_action']; |
785 | 785 | // Action has an additional action - add / delete, etc. Buttons named <multi-action>_action[action_name] |
786 | - if(in_array($multi_action, array('link', 'responsible', 'startdate', 'enddate'))) |
|
786 | + if (in_array($multi_action, array('link', 'responsible', 'startdate', 'enddate'))) |
|
787 | 787 | { |
788 | 788 | // eTemplate ignores the _popup namespace, but et2 doesn't |
789 | - if($values[$multi_action.'_popup']) |
|
789 | + if ($values[$multi_action.'_popup']) |
|
790 | 790 | { |
791 | - $popup =& $values[$multi_action.'_popup']; |
|
791 | + $popup = & $values[$multi_action.'_popup']; |
|
792 | 792 | } |
793 | 793 | else |
794 | 794 | { |
795 | - $popup =& $values; |
|
795 | + $popup = & $values; |
|
796 | 796 | } |
797 | - $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action']); |
|
798 | - if($multi_action == 'link') |
|
797 | + $values['nm']['multi_action'] .= '_'.key($popup[$multi_action.'_action']); |
|
798 | + if ($multi_action == 'link') |
|
799 | 799 | { |
800 | - $popup[$multi_action] = $popup['link']['app'] . ':'.$popup['link']['id']; |
|
800 | + $popup[$multi_action] = $popup['link']['app'].':'.$popup['link']['id']; |
|
801 | 801 | } |
802 | - else if(is_array($popup[$multi_action])) |
|
802 | + else if (is_array($popup[$multi_action])) |
|
803 | 803 | { |
804 | - $popup[$multi_action] = implode(',',$popup[$multi_action]); |
|
804 | + $popup[$multi_action] = implode(',', $popup[$multi_action]); |
|
805 | 805 | } |
806 | - $values['nm']['multi_action'] .= '_' . $popup[$multi_action]; |
|
806 | + $values['nm']['multi_action'] .= '_'.$popup[$multi_action]; |
|
807 | 807 | unset($values[$multi_action.'_popup']); |
808 | 808 | unset($values[$multi_action]); |
809 | 809 | } |
@@ -811,18 +811,18 @@ discard block |
||
811 | 811 | if ($this->action($values['nm']['multi_action'], $values['nm']['selected'], $values['nm']['select_all'], |
812 | 812 | $success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications'])) |
813 | 813 | { |
814 | - $msg .= lang('%1 entries %2',$success,$action_msg); |
|
814 | + $msg .= lang('%1 entries %2', $success, $action_msg); |
|
815 | 815 | Framework::message($msg); |
816 | 816 | } |
817 | - elseif(is_null($msg)) |
|
817 | + elseif (is_null($msg)) |
|
818 | 818 | { |
819 | - $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
820 | - Framework::message($msg,'error'); |
|
819 | + $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
820 | + Framework::message($msg, 'error'); |
|
821 | 821 | } |
822 | - elseif($msg) |
|
822 | + elseif ($msg) |
|
823 | 823 | { |
824 | - $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); |
|
825 | - Framework::message($msg,'error'); |
|
824 | + $msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed); |
|
825 | + Framework::message($msg, 'error'); |
|
826 | 826 | } |
827 | 827 | unset($values['nm']['multi_action']); |
828 | 828 | unset($values['nm']['select_all']); |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $action_id = 0; |
846 | 846 | $action_title = ''; |
847 | 847 | } |
848 | - if($_GET['ajax'] === 'true') |
|
848 | + if ($_GET['ajax'] === 'true') |
|
849 | 849 | { |
850 | 850 | $nm['action'] = ''; |
851 | 851 | $nm['action_id'] = 0; |
@@ -861,8 +861,7 @@ discard block |
||
861 | 861 | |
862 | 862 | if (isset($_GET['filter']) && $_GET['filter'] != 'default' || !isset($values['nm']['filter']) && !$this->called_by) |
863 | 863 | { |
864 | - $values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] : |
|
865 | - $this->prefs['defaultFilter']; |
|
864 | + $values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] : $this->prefs['defaultFilter']; |
|
866 | 865 | } |
867 | 866 | if (!isset($values['nm']['order']) || !$values['nm']['order']) |
868 | 867 | { |
@@ -876,14 +875,14 @@ discard block |
||
876 | 875 | $action_title = $values['action_title'] = $action ? $action_title : $nm['action_title']; |
877 | 876 | $action = $values['action'] = $action ? $action : $nm['action']; |
878 | 877 | } |
879 | - if($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
878 | + if ($_GET['search']) $values['nm']['search'] = $_GET['search']; |
|
880 | 879 | |
881 | 880 | if ($values['nm']['add']) |
882 | 881 | { |
883 | 882 | $values['add'] = $values['nm']['add']; |
884 | 883 | unset($values['nm']['add']); |
885 | 884 | } |
886 | - unset($values['nm']['rows']['checked']); // not longer used, but hides button actions |
|
885 | + unset($values['nm']['rows']['checked']); // not longer used, but hides button actions |
|
887 | 886 | |
888 | 887 | switch ($action) |
889 | 888 | { |
@@ -908,7 +907,7 @@ discard block |
||
908 | 907 | $this->tmpl->read('infolog.index'); |
909 | 908 | $values['nm']['options-filter'] = $this->filters; |
910 | 909 | $values['nm']['get_rows'] = 'infolog.infolog_ui.get_rows'; |
911 | - $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'],array('all','no_describtion')) ? array() : array( |
|
910 | + $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'], array('all', 'no_describtion')) ? array() : array( |
|
912 | 911 | '' => 'default', |
913 | 912 | )) + array( |
914 | 913 | 'no_describtion' => 'no details', |
@@ -929,34 +928,34 @@ discard block |
||
929 | 928 | else |
930 | 929 | { |
931 | 930 | // Allow saving parent ID into favorites |
932 | - $values['nm']['favorites'] = array('action','action_id'); |
|
931 | + $values['nm']['favorites'] = array('action', 'action_id'); |
|
933 | 932 | } |
934 | 933 | |
935 | 934 | // Allow add actions even when there's no rows |
936 | 935 | $values['nm']['placeholder_actions'] = array('new'); |
937 | 936 | |
938 | - if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
937 | + if (!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref']; |
|
939 | 938 | |
940 | 939 | // disable columns for main entry as set in the pref for details or no details |
941 | 940 | $values['nm']['columnselection_pref'] = 'nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows') |
942 | - .($values['nm']['filter2']=='all' ? '-details' : ''); |
|
941 | + .($values['nm']['filter2'] == 'all' ? '-details' : ''); |
|
943 | 942 | if ($action == 'sp') |
944 | 943 | { |
945 | 944 | $pref = $values['nm']['columnselection_pref']; |
946 | - foreach(array('info_used_time_info_planned_time_info_replanned_time','info_datemodified','info_owner_info_responsible','customfields') as $name) |
|
945 | + foreach (array('info_used_time_info_planned_time_info_replanned_time', 'info_datemodified', 'info_owner_info_responsible', 'customfields') as $name) |
|
947 | 946 | { |
948 | - $values['main']['no_'.$name] = strpos($this->prefs[$pref],$name) === false; |
|
947 | + $values['main']['no_'.$name] = strpos($this->prefs[$pref], $name) === false; |
|
949 | 948 | } |
950 | 949 | if (!$values['main']['no_customfields']) |
951 | 950 | { |
952 | 951 | // set the column-header of the main table for the customfields. |
953 | - foreach(array_keys($this->bo->customfields) as $lname) |
|
952 | + foreach (array_keys($this->bo->customfields) as $lname) |
|
954 | 953 | { |
955 | - $values['main']['customfields'].=$lname."\n"; |
|
954 | + $values['main']['customfields'] .= $lname."\n"; |
|
956 | 955 | } |
957 | 956 | } |
958 | 957 | } |
959 | - if ($values['nm']['filter']=='bydate') |
|
958 | + if ($values['nm']['filter'] == 'bydate') |
|
960 | 959 | { |
961 | 960 | foreach (array_keys($values['nm']['col_filter']) as $colfk) |
962 | 961 | { |
@@ -989,7 +988,7 @@ discard block |
||
989 | 988 | { |
990 | 989 | $values['css'] .= '<style type="text/css">@media screen { .infoDes { '. |
991 | 990 | ' max-height: '. |
992 | - (($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35). // dono why em is not real lines |
|
991 | + (($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35).// dono why em is not real lines |
|
993 | 992 | 'em; overflow: auto; }}</style>'; |
994 | 993 | } |
995 | 994 | |
@@ -1001,13 +1000,13 @@ discard block |
||
1001 | 1000 | |
1002 | 1001 | // remove group-types user has not any rights to as filter |
1003 | 1002 | // does not take implicit rights as delegated into account, so they will not be available as filters |
1004 | - foreach($this->bo->group_owners as $type => $group) |
|
1003 | + foreach ($this->bo->group_owners as $type => $group) |
|
1005 | 1004 | { |
1006 | 1005 | if (!isset($this->bo->grants[$group])) unset($sel_options['info_type'][$type]); |
1007 | 1006 | } |
1008 | 1007 | |
1009 | 1008 | |
1010 | - return $this->tmpl->exec('infolog.infolog_ui.index',$values,$sel_options,$readonlys,$persist,$return_html ? -1 : 0); |
|
1009 | + return $this->tmpl->exec('infolog.infolog_ui.index', $values, $sel_options, $readonlys, $persist, $return_html ? -1 : 0); |
|
1011 | 1010 | } |
1012 | 1011 | |
1013 | 1012 | /** |
@@ -1022,9 +1021,9 @@ discard block |
||
1022 | 1021 | if ($this->bo->group_owners) |
1023 | 1022 | { |
1024 | 1023 | // remove types owned by groups the user has no edit grant |
1025 | - foreach($this->bo->group_owners as $type => $group) |
|
1024 | + foreach ($this->bo->group_owners as $type => $group) |
|
1026 | 1025 | { |
1027 | - if (!($this->bo->grants[$group] & Acl::EDIT)) |
|
1026 | + if (!($this->bo->grants[$group]&Acl::EDIT)) |
|
1028 | 1027 | { |
1029 | 1028 | unset($types[$type]); |
1030 | 1029 | } |
@@ -1041,7 +1040,7 @@ discard block |
||
1041 | 1040 | */ |
1042 | 1041 | private function get_actions(array $query) |
1043 | 1042 | { |
1044 | - for($i = 0; $i <= 100; $i += 10) |
|
1043 | + for ($i = 0; $i <= 100; $i += 10) |
|
1045 | 1044 | { |
1046 | 1045 | $percent[$i] = $i.'%'; |
1047 | 1046 | } |
@@ -1050,9 +1049,9 @@ discard block |
||
1050 | 1049 | $types_add = array(); |
1051 | 1050 | // Do not add deleted type to add or change menus |
1052 | 1051 | unset($types['delete']); |
1053 | - foreach($types as $type => &$data) |
|
1052 | + foreach ($types as $type => &$data) |
|
1054 | 1053 | { |
1055 | - $image_exists = Api\Image::find('infolog',$type); |
|
1054 | + $image_exists = Api\Image::find('infolog', $type); |
|
1056 | 1055 | $data = array( |
1057 | 1056 | 'caption' => $data, |
1058 | 1057 | 'icon' => $image_exists ? $type : 'infolog/navbar', |
@@ -1064,9 +1063,9 @@ discard block |
||
1064 | 1063 | |
1065 | 1064 | $icons = null; |
1066 | 1065 | $statis = $this->bo->get_status($query['col_filter']['info_type'], $icons); |
1067 | - foreach($statis as $type => &$data) |
|
1066 | + foreach ($statis as $type => &$data) |
|
1068 | 1067 | { |
1069 | - $image_exists = Api\Image::find('infolog',$icons[$type]); |
|
1068 | + $image_exists = Api\Image::find('infolog', $icons[$type]); |
|
1070 | 1069 | $data = array( |
1071 | 1070 | 'caption' => $data, |
1072 | 1071 | 'icon' => $image_exists ? $icons[$type] : 'infolog/status', |
@@ -1078,10 +1077,10 @@ discard block |
||
1078 | 1077 | 'caption' => 'Open', |
1079 | 1078 | 'default' => true, |
1080 | 1079 | 'allowOnMultiple' => false, |
1081 | - 'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.infolog.viewEntry':'', |
|
1080 | + 'onExecute' => Api\Header\UserAgent::mobile() ? 'javaScript:app.infolog.viewEntry' : '', |
|
1082 | 1081 | 'url' => 'menuaction=infolog.infolog_ui.edit&info_id=$id', |
1083 | 1082 | 'popup' => Link::get_registry('infolog', 'add_popup'), |
1084 | - 'group' => $group=1, |
|
1083 | + 'group' => $group = 1, |
|
1085 | 1084 | 'mobileViewTemplate' => 'view?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/infolog/templates/mobile/view.xet')) |
1086 | 1085 | ), |
1087 | 1086 | 'parent' => array( |
@@ -1157,7 +1156,7 @@ discard block |
||
1157 | 1156 | 'icon' => 'completed', |
1158 | 1157 | ), |
1159 | 1158 | 'cat' => Etemplate\Widget\Nextmatch::category_action( |
1160 | - 'infolog',$group,'Change category','cat_' |
|
1159 | + 'infolog', $group, 'Change category', 'cat_' |
|
1161 | 1160 | ), |
1162 | 1161 | 'startdate' => array( |
1163 | 1162 | 'caption' => 'Start date', |
@@ -1207,7 +1206,7 @@ discard block |
||
1207 | 1206 | 'onExecute' => 'javaScript:app.infolog.infolog_menu_print' |
1208 | 1207 | ) |
1209 | 1208 | ); |
1210 | - ++$group; // integration with other apps |
|
1209 | + ++$group; // integration with other apps |
|
1211 | 1210 | if ($GLOBALS['egw_info']['user']['apps']['filemanager']) |
1212 | 1211 | { |
1213 | 1212 | $actions['filemanager'] = array( |
@@ -1225,7 +1224,7 @@ discard block |
||
1225 | 1224 | 'caption' => 'Schedule appointment', |
1226 | 1225 | 'group' => $group, |
1227 | 1226 | 'url' => 'menuaction=calendar.calendar_uiforms.edit&'. |
1228 | - Link::get_registry('calendar', 'add_app') . '[]=infolog&'.Link::get_registry('calendar','add_id').'[]=$id', |
|
1227 | + Link::get_registry('calendar', 'add_app').'[]=infolog&'.Link::get_registry('calendar', 'add_id').'[]=$id', |
|
1229 | 1228 | 'allowOnMultiple' => false, |
1230 | 1229 | 'popup' => Link::get_registry('calendar', 'edit_popup') |
1231 | 1230 | ); |
@@ -1263,7 +1262,7 @@ discard block |
||
1263 | 1262 | 'hint' => 'Convert to a ticket', |
1264 | 1263 | 'group' => $group, |
1265 | 1264 | 'url' => 'menuaction=tracker.tracker_ui.edit&'. |
1266 | - Link::get_registry('tracker', 'add_app') . '[]=infolog&'.Link::get_registry('tracker','add_id').'[]=$id', |
|
1265 | + Link::get_registry('tracker', 'add_app').'[]=infolog&'.Link::get_registry('tracker', 'add_id').'[]=$id', |
|
1267 | 1266 | 'allowOnMultiple' => false, |
1268 | 1267 | 'popup' => Link::get_registry('tracker', 'add_popup'), |
1269 | 1268 | ); |
@@ -1276,7 +1275,7 @@ discard block |
||
1276 | 1275 | $actions['ical'] = array( |
1277 | 1276 | 'icon' => 'ical', |
1278 | 1277 | 'caption' => 'Export iCal', |
1279 | - 'postSubmit' => true, // download needs post submit to work |
|
1278 | + 'postSubmit' => true, // download needs post submit to work |
|
1280 | 1279 | 'group' => $group, |
1281 | 1280 | 'allowOnMultiple' => true, |
1282 | 1281 | 'hideOnMobile' => true |
@@ -1331,14 +1330,14 @@ discard block |
||
1331 | 1330 | $success = $failed = 0; |
1332 | 1331 | if ($use_all) |
1333 | 1332 | { |
1334 | - @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
1335 | - $query['num_rows'] = -1; // all |
|
1333 | + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
1334 | + $query['num_rows'] = -1; // all |
|
1336 | 1335 | $result = $readonlys = null; |
1337 | - $this->get_rows($query,$result,$readonlys); |
|
1336 | + $this->get_rows($query, $result, $readonlys); |
|
1338 | 1337 | $checked = array(); |
1339 | - foreach($result as $key => $info) |
|
1338 | + foreach ($result as $key => $info) |
|
1340 | 1339 | { |
1341 | - if(is_numeric($key)) |
|
1340 | + if (is_numeric($key)) |
|
1342 | 1341 | { |
1343 | 1342 | $checked[] = $info['info_id']; |
1344 | 1343 | } |
@@ -1349,29 +1348,29 @@ discard block |
||
1349 | 1348 | list($action, $settings) = explode('_', $_action, 2); |
1350 | 1349 | |
1351 | 1350 | // Actions that can handle a list of IDs |
1352 | - switch($action) |
|
1351 | + switch ($action) |
|
1353 | 1352 | { |
1354 | 1353 | case 'link': |
1355 | 1354 | list($add_remove, $link) = explode('_', $settings, 2); |
1356 | - list($app, $link_id) = explode(strpos($link,':') !== false ? ':' : ',', $link); |
|
1357 | - if(!$link_id) |
|
1355 | + list($app, $link_id) = explode(strpos($link, ':') !== false ? ':' : ',', $link); |
|
1356 | + if (!$link_id) |
|
1358 | 1357 | { |
1359 | 1358 | $action_msg = 'linked'; |
1360 | 1359 | $msg = lang('You need to select an entry for linking.'); |
1361 | 1360 | break; |
1362 | 1361 | } |
1363 | 1362 | $title = Link::title($app, $link_id); |
1364 | - foreach($checked as $id) |
|
1363 | + foreach ($checked as $id) |
|
1365 | 1364 | { |
1366 | - if(!$this->bo->check_access($id, Acl::EDIT)) |
|
1365 | + if (!$this->bo->check_access($id, Acl::EDIT)) |
|
1367 | 1366 | { |
1368 | 1367 | $failed++; |
1369 | 1368 | continue; |
1370 | 1369 | } |
1371 | - if($add_remove == 'add') |
|
1370 | + if ($add_remove == 'add') |
|
1372 | 1371 | { |
1373 | 1372 | $action_msg = lang('linked to %1', $title); |
1374 | - if(Link::link('infolog', $id, $app, $link_id)) |
|
1373 | + if (Link::link('infolog', $id, $app, $link_id)) |
|
1375 | 1374 | { |
1376 | 1375 | $success++; |
1377 | 1376 | } |
@@ -1398,20 +1397,20 @@ discard block |
||
1398 | 1397 | case 'ical': |
1399 | 1398 | // infolog_ical lets horde be auto-loaded, so it must go first |
1400 | 1399 | $boical = new infolog_ical(); |
1401 | - Api\Header\Content::type('todo.ics','text/calendar'); |
|
1400 | + Api\Header\Content::type('todo.ics', 'text/calendar'); |
|
1402 | 1401 | echo $boical->exportvCalendar($checked); |
1403 | 1402 | exit(); |
1404 | 1403 | |
1405 | 1404 | } |
1406 | 1405 | |
1407 | 1406 | // Actions that need to loop |
1408 | - foreach($checked as $id) |
|
1407 | + foreach ($checked as $id) |
|
1409 | 1408 | { |
1410 | - if(!$entry = $this->bo->read($id)) |
|
1409 | + if (!$entry = $this->bo->read($id)) |
|
1411 | 1410 | { |
1412 | 1411 | continue; |
1413 | 1412 | } |
1414 | - switch($action) |
|
1413 | + switch ($action) |
|
1415 | 1414 | { |
1416 | 1415 | case 'close': |
1417 | 1416 | $action_msg = lang('closed'); |
@@ -1421,8 +1420,8 @@ discard block |
||
1421 | 1420 | |
1422 | 1421 | case 'delete': |
1423 | 1422 | $action_msg = $settings == 'sub' ? lang(' (and children) deleted') : lang('deleted'); |
1424 | - $result = $this->bo->delete($id, $settings=='sub', false, $skip_notifications); |
|
1425 | - if($result == true) |
|
1423 | + $result = $this->bo->delete($id, $settings == 'sub', false, $skip_notifications); |
|
1424 | + if ($result == true) |
|
1426 | 1425 | { |
1427 | 1426 | $success++; |
1428 | 1427 | } |
@@ -1435,14 +1434,14 @@ discard block |
||
1435 | 1434 | case 'type': |
1436 | 1435 | $action_msg = lang('changed type'); |
1437 | 1436 | // Dont allow to change the type, if user has no delete rights from the group-owner |
1438 | - if ($id && !($this->bo->grants[$entry['info_owner']] & Acl::DELETE)) |
|
1437 | + if ($id && !($this->bo->grants[$entry['info_owner']]&Acl::DELETE)) |
|
1439 | 1438 | { |
1440 | 1439 | $failed++; |
1441 | 1440 | break; |
1442 | 1441 | } |
1443 | 1442 | $entry['info_type'] = $settings; |
1444 | 1443 | try { |
1445 | - $this->bo->write($entry, true,true,true,$skip_notifications,true); // Throw exceptions |
|
1444 | + $this->bo->write($entry, true, true, true, $skip_notifications, true); // Throw exceptions |
|
1446 | 1445 | } |
1447 | 1446 | catch (Api\Exception\WrongUserinput $e) |
1448 | 1447 | { |
@@ -1457,11 +1456,11 @@ discard block |
||
1457 | 1456 | $action_msg = lang('changed completion to %1%', $settings); |
1458 | 1457 | $entry['info_percent'] = $settings; |
1459 | 1458 | // Done and not-started entries will get changed right back if we don't change the status too |
1460 | - if(in_array($entry['info_status'],array('not-started','done','billed','cancelled','archive'))) |
|
1459 | + if (in_array($entry['info_status'], array('not-started', 'done', 'billed', 'cancelled', 'archive'))) |
|
1461 | 1460 | { |
1462 | 1461 | $entry['info_status'] = 'ongoing'; |
1463 | 1462 | } |
1464 | - if($entry['info_percent'] == 0) |
|
1463 | + if ($entry['info_percent'] == 0) |
|
1465 | 1464 | { |
1466 | 1465 | $entry['info_status'] = 'not-started'; |
1467 | 1466 | } |
@@ -1469,7 +1468,7 @@ discard block |
||
1469 | 1468 | { |
1470 | 1469 | $entry['info_status'] = 'done'; |
1471 | 1470 | } |
1472 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1471 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1473 | 1472 | { |
1474 | 1473 | $success++; |
1475 | 1474 | } |
@@ -1481,24 +1480,23 @@ discard block |
||
1481 | 1480 | |
1482 | 1481 | case 'undelete': // set it to valid status != 'deleted' for that type |
1483 | 1482 | $settings = isset($this->bo->status[$entry['info_type']]['done']) ? |
1484 | - $this->bo->status[$entry['info_type']]['done'] : |
|
1485 | - $this->bo->status['defaults'][$entry['info_type']]; |
|
1483 | + $this->bo->status[$entry['info_type']]['done'] : $this->bo->status['defaults'][$entry['info_type']]; |
|
1486 | 1484 | // fall-through |
1487 | 1485 | case 'status': |
1488 | - if(isset($this->bo->status[$entry['info_type']][$settings])) |
|
1486 | + if (isset($this->bo->status[$entry['info_type']][$settings])) |
|
1489 | 1487 | { |
1490 | 1488 | $action_msg = lang('changed status to %1', lang($this->bo->status[$entry['info_type']][$settings])); |
1491 | - if(!in_array($settings,array('done','billed','cancelled','archive')) && $entry['info_percent'] == 100) |
|
1489 | + if (!in_array($settings, array('done', 'billed', 'cancelled', 'archive')) && $entry['info_percent'] == 100) |
|
1492 | 1490 | { |
1493 | 1491 | // Done entries will get changed right back if we don't change the completion too |
1494 | 1492 | $entry['info_percent'] = 10; |
1495 | 1493 | } |
1496 | - if(in_array($settings, array('not-started')) && $entry['info_percent'] > 0) |
|
1494 | + if (in_array($settings, array('not-started')) && $entry['info_percent'] > 0) |
|
1497 | 1495 | { |
1498 | 1496 | $entry['info_percent'] = 0; |
1499 | 1497 | } |
1500 | 1498 | $entry['info_status'] = $settings; |
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 | } |
@@ -1511,7 +1509,7 @@ discard block |
||
1511 | 1509 | break; |
1512 | 1510 | |
1513 | 1511 | case 'cat': |
1514 | - if($settings) |
|
1512 | + if ($settings) |
|
1515 | 1513 | { |
1516 | 1514 | $cat_name = Api\Categories::id2name($settings); |
1517 | 1515 | $action_msg = lang('changed category to %1', $cat_name); |
@@ -1521,7 +1519,7 @@ discard block |
||
1521 | 1519 | $action_msg = lang('removed category'); |
1522 | 1520 | } |
1523 | 1521 | $entry['info_cat'] = $settings; |
1524 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1522 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1525 | 1523 | { |
1526 | 1524 | $success++; |
1527 | 1525 | } |
@@ -1533,15 +1531,15 @@ discard block |
||
1533 | 1531 | |
1534 | 1532 | case 'responsible': |
1535 | 1533 | list($add_remove, $user_str) = explode('_', $settings, 2); |
1536 | - $action_msg = ($add_remove == 'ok' ? lang('changed') : ($add_remove == 'add' ? lang('added') : lang('removed'))) . ' '; |
|
1534 | + $action_msg = ($add_remove == 'ok' ? lang('changed') : ($add_remove == 'add' ? lang('added') : lang('removed'))).' '; |
|
1537 | 1535 | $names = array(); |
1538 | 1536 | $users = explode(',', $user_str); |
1539 | - foreach($users as $account_id) |
|
1537 | + foreach ($users as $account_id) |
|
1540 | 1538 | { |
1541 | 1539 | $names[] = Api\Accounts::username($account_id); |
1542 | 1540 | } |
1543 | 1541 | $action_msg .= implode(', ', $names); |
1544 | - if($add_remove == 'ok') |
|
1542 | + if ($add_remove == 'ok') |
|
1545 | 1543 | { |
1546 | 1544 | $entry['info_responsible'] = (array)$users; |
1547 | 1545 | } |
@@ -1550,7 +1548,7 @@ discard block |
||
1550 | 1548 | $function = $add_remove == 'add' ? 'array_merge' : 'array_diff'; |
1551 | 1549 | $entry['info_responsible'] = array_unique($function($entry['info_responsible'], (array)$users)); |
1552 | 1550 | } |
1553 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1551 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1554 | 1552 | { |
1555 | 1553 | $success++; |
1556 | 1554 | } |
@@ -1565,7 +1563,7 @@ discard block |
||
1565 | 1563 | list($ok, $date) = explode('_', $settings, 2); |
1566 | 1564 | $entry[$field] = $date ? Api\DateTime::to($date, 'ts') : null; |
1567 | 1565 | $action_msg = lang('changed'); |
1568 | - if($this->bo->write($entry, true,true,true,$skip_notifications)) |
|
1566 | + if ($this->bo->write($entry, true, true, true, $skip_notifications)) |
|
1569 | 1567 | { |
1570 | 1568 | $success++; |
1571 | 1569 | } |
@@ -1586,10 +1584,10 @@ discard block |
||
1586 | 1584 | * @param string $_referer='' |
1587 | 1585 | * @param boolean $closesingle=false |
1588 | 1586 | */ |
1589 | - function close($values=0,$_referer='',$closesingle=false,$skip_notification = false) |
|
1587 | + function close($values = 0, $_referer = '', $closesingle = false, $skip_notification = false) |
|
1590 | 1588 | { |
1591 | 1589 | //echo "<p>".__METHOD__."($values,$referer,$closeall)</p>\n"; |
1592 | - $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1590 | + $info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1593 | 1591 | $referer = is_array($values) ? $values['referer'] : $_referer; |
1594 | 1592 | |
1595 | 1593 | if ($info_id) |
@@ -1599,11 +1597,11 @@ discard block |
||
1599 | 1597 | $status = $info['info_status']; |
1600 | 1598 | // closed stati assumed array('done','billed','cancelled') |
1601 | 1599 | if (isset($this->bo->status[$info['info_type']]['done'])) { |
1602 | - $status ='done'; |
|
1600 | + $status = 'done'; |
|
1603 | 1601 | } elseif (isset($this->bo->status[$info['info_type']]['billed'])) { |
1604 | - $status ='billed'; |
|
1602 | + $status = 'billed'; |
|
1605 | 1603 | } elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) { |
1606 | - $status ='cancelled'; |
|
1604 | + $status = 'cancelled'; |
|
1607 | 1605 | } |
1608 | 1606 | #_debug_array($status); |
1609 | 1607 | $values = array( |
@@ -1613,15 +1611,15 @@ discard block |
||
1613 | 1611 | 'info_percent'=> 100, |
1614 | 1612 | 'info_datecompleted' => $this->bo->now_su, |
1615 | 1613 | ); |
1616 | - $this->bo->write($values, true,true,true,$skip_notification); |
|
1614 | + $this->bo->write($values, true, true, true, $skip_notification); |
|
1617 | 1615 | |
1618 | - $query = array('action'=>'sp','action_id'=>$info_id); |
|
1616 | + $query = array('action'=>'sp', 'action_id'=>$info_id); |
|
1619 | 1617 | if (!$closesingle) { |
1620 | - foreach((array)$this->bo->search($query) as $info) |
|
1618 | + foreach ((array)$this->bo->search($query) as $info) |
|
1621 | 1619 | { |
1622 | 1620 | if ($info['info_id_parent'] == $info_id) // search also returns linked entries! |
1623 | 1621 | { |
1624 | - $this->close($info['info_id'],$referer,$closesingle,$skip_notification); // we call ourselfs recursive to process subs from subs too |
|
1622 | + $this->close($info['info_id'], $referer, $closesingle, $skip_notification); // we call ourselfs recursive to process subs from subs too |
|
1625 | 1623 | } |
1626 | 1624 | } |
1627 | 1625 | } |
@@ -1637,9 +1635,9 @@ discard block |
||
1637 | 1635 | * @param string $called_by |
1638 | 1636 | * @param boolean $skip_notification Do not send notification of deletion |
1639 | 1637 | */ |
1640 | - function delete($values=0,$_referer='',$called_by='',$skip_notification=False) |
|
1638 | + function delete($values = 0, $_referer = '', $called_by = '', $skip_notification = False) |
|
1641 | 1639 | { |
1642 | - $info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1640 | + $info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id'])); |
|
1643 | 1641 | $referer = is_array($values) ? $values['referer'] : $_referer; |
1644 | 1642 | |
1645 | 1643 | if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id)) // entries without subs get confirmed by javascript |
@@ -1650,9 +1648,9 @@ discard block |
||
1650 | 1648 | |
1651 | 1649 | if (is_array($values) || $info_id <= 0) |
1652 | 1650 | { |
1653 | - if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id,Acl::DELETE)) |
|
1651 | + if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id, Acl::DELETE)) |
|
1654 | 1652 | { |
1655 | - $deleted = $this->bo->delete($info_id,$values['delete_subs'],$values['info_id_parent'], $skip_notification); |
|
1653 | + $deleted = $this->bo->delete($info_id, $values['delete_subs'], $values['info_id_parent'], $skip_notification); |
|
1656 | 1654 | } |
1657 | 1655 | if ($called_by) // direct call from the same request |
1658 | 1656 | { |
@@ -1662,7 +1660,7 @@ discard block |
||
1662 | 1660 | { |
1663 | 1661 | $this->edit(array( |
1664 | 1662 | 'info_id' => $info_id, |
1665 | - 'button' => array('deleted' => true), // not delete! |
|
1663 | + 'button' => array('deleted' => true), // not delete! |
|
1666 | 1664 | 'referer' => $referer, |
1667 | 1665 | 'msg' => $deleted ? lang('Infolog entry deleted') : '', |
1668 | 1666 | )); |
@@ -1670,7 +1668,7 @@ discard block |
||
1670 | 1668 | return $referer ? $this->tmpl->location($referer) : $this->index(); |
1671 | 1669 | } |
1672 | 1670 | $readonlys = $values = array(); |
1673 | - $values['main'][1] = $this->get_info($info_id,$readonlys['main']); |
|
1671 | + $values['main'][1] = $this->get_info($info_id, $readonlys['main']); |
|
1674 | 1672 | |
1675 | 1673 | $this->tmpl->read('infolog.delete'); |
1676 | 1674 | |
@@ -1691,7 +1689,7 @@ discard block |
||
1691 | 1689 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete'); |
1692 | 1690 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete'); |
1693 | 1691 | |
1694 | - $this->tmpl->exec('infolog.infolog_ui.delete',$values,array(),$readonlys,$persist,$called_by == 'edit' ? 2 : 0); |
|
1692 | + $this->tmpl->exec('infolog.infolog_ui.delete', $values, array(), $readonlys, $persist, $called_by == 'edit' ? 2 : 0); |
|
1695 | 1693 | } |
1696 | 1694 | |
1697 | 1695 | /** |
@@ -1703,68 +1701,68 @@ discard block |
||
1703 | 1701 | * @param string $type Type of log-entry: note,todo,task |
1704 | 1702 | * @param string $referer array with param/get-vars of the refering page |
1705 | 1703 | */ |
1706 | - function edit($content = null,$action = '',$action_id=0,$type='',$referer='') |
|
1704 | + function edit($content = null, $action = '', $action_id = 0, $type = '', $referer = '') |
|
1707 | 1705 | { |
1708 | 1706 | if (($submit = is_array($content))) |
1709 | 1707 | { |
1710 | 1708 | //echo "infolog_ui::edit: content="; _debug_array($content); |
1711 | 1709 | $info_id = $content['info_id']; |
1712 | - $action = $content['action']; unset($content['action']); |
|
1710 | + $action = $content['action']; unset($content['action']); |
|
1713 | 1711 | $action_id = $content['action_id']; unset($content['action_id']); |
1714 | - $referer = $content['referer']; unset($content['referer']); |
|
1715 | - $no_popup = $content['no_popup']; unset($content['no_popup']); |
|
1712 | + $referer = $content['referer']; unset($content['referer']); |
|
1713 | + $no_popup = $content['no_popup']; unset($content['no_popup']); |
|
1716 | 1714 | |
1717 | 1715 | $button = @key($content['button']); |
1718 | - if (!$button && $action) $button = $action; // action selectbox |
|
1716 | + if (!$button && $action) $button = $action; // action selectbox |
|
1719 | 1717 | //info_cc expects an comma separated string |
1720 | 1718 | //error_log(__METHOD__.__LINE__.array2string($content)); |
1721 | 1719 | if (empty($content['info_cc'])) $content['info_cc'] = ""; |
1722 | 1720 | if (is_array($content['info_cc'])) |
1723 | 1721 | { |
1724 | - foreach($content['info_cc'] as $i => $value) |
|
1722 | + foreach ($content['info_cc'] as $i => $value) |
|
1725 | 1723 | { |
1726 | 1724 | //imap_rfc822 should not be used, but it works reliable here, until we have some regex solution or use horde stuff |
1727 | 1725 | $addresses = imap_rfc822_parse_adrlist($value, ''); |
1728 | 1726 | //error_log(__METHOD__.__LINE__.$value.'->'.array2string($addresses[0])); |
1729 | - $content['info_cc'][$i]=$addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
|
1727 | + $content['info_cc'][$i] = $addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox; |
|
1730 | 1728 | } |
1731 | - if (!empty($content['info_cc'])) $content['info_cc'] = implode(',',$content['info_cc']); |
|
1729 | + if (!empty($content['info_cc'])) $content['info_cc'] = implode(',', $content['info_cc']); |
|
1732 | 1730 | } |
1733 | 1731 | unset($content['button']); |
1734 | 1732 | if ($button) |
1735 | 1733 | { |
1736 | 1734 | // Copy or schedule Infolog |
1737 | - if (in_array($button,array('copy','schedule','ical','tracker'))) |
|
1735 | + if (in_array($button, array('copy', 'schedule', 'ical', 'tracker'))) |
|
1738 | 1736 | { |
1739 | 1737 | $action = $button; |
1740 | - if (!$info_id || $this->bo->check_access($info_id,Acl::EDIT)) |
|
1738 | + if (!$info_id || $this->bo->check_access($info_id, Acl::EDIT)) |
|
1741 | 1739 | { |
1742 | - $button = 'apply'; // need to store infolog first |
|
1740 | + $button = 'apply'; // need to store infolog first |
|
1743 | 1741 | } |
1744 | 1742 | } |
1745 | 1743 | //Validate the enddate must be grather than startdate |
1746 | 1744 | if (!empty($content['info_enddate']) && !empty($content['info_startdate'])) |
1747 | 1745 | { |
1748 | - $duration_date = $content['info_enddate']-$content['info_startdate']; |
|
1746 | + $duration_date = $content['info_enddate'] - $content['info_startdate']; |
|
1749 | 1747 | if ($duration_date < 0) |
1750 | 1748 | { |
1751 | 1749 | $this->tmpl->set_validation_error('info_startdate', lang('Startdate must be before Enddate!!!')); |
1752 | - $button = $action = ''; // stop save or apply |
|
1750 | + $button = $action = ''; // stop save or apply |
|
1753 | 1751 | } |
1754 | 1752 | } |
1755 | 1753 | //echo "<p>infolog_ui::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content); |
1756 | 1754 | if (($button == 'save' || $button == 'apply') && isset($content['info_subject']) && empty($content['info_subject'])) |
1757 | 1755 | { |
1758 | - $this->tmpl->set_validation_error('info_subject',lang('Field must not be empty !!!')); |
|
1759 | - $button = $action = ''; // stop save or apply |
|
1756 | + $this->tmpl->set_validation_error('info_subject', lang('Field must not be empty !!!')); |
|
1757 | + $button = $action = ''; // stop save or apply |
|
1760 | 1758 | } |
1761 | 1759 | if (($button == 'save' || $button == 'apply') && $info_id) |
1762 | 1760 | { |
1763 | 1761 | $old = $this->bo->read($info_id); |
1764 | - if (!($edit_acl = $this->bo->check_access($info_id,Acl::EDIT))) |
|
1762 | + if (!($edit_acl = $this->bo->check_access($info_id, Acl::EDIT))) |
|
1765 | 1763 | { |
1766 | 1764 | $status_only = $this->bo->is_responsible($old); |
1767 | - $undelete = $this->bo->check_access($old,infolog_bo::ACL_UNDELETE); |
|
1765 | + $undelete = $this->bo->check_access($old, infolog_bo::ACL_UNDELETE); |
|
1768 | 1766 | } |
1769 | 1767 | // enddate in the past gives warning |
1770 | 1768 | if (isset($content['info_enddate']) |
@@ -1777,46 +1775,45 @@ discard block |
||
1777 | 1775 | } |
1778 | 1776 | if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete)) |
1779 | 1777 | { |
1780 | - $operation = $info_id ? 'edit' : 'add'; |
|
1778 | + $operation = $info_id ? 'edit' : 'add'; |
|
1781 | 1779 | |
1782 | 1780 | if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) |
1783 | 1781 | { |
1784 | - $content['info_link_id'] = 0; // as field has to be int |
|
1782 | + $content['info_link_id'] = 0; // as field has to be int |
|
1785 | 1783 | } |
1786 | 1784 | $active_tab = $content['tabs']; |
1787 | 1785 | if (!($info_id = $this->bo->write($content, true, true, true, $content['no_notifications']))) |
1788 | 1786 | { |
1789 | - $content['msg'] = $info_id !== 0 || !$content['info_id'] ? lang('Error: saving the entry') : |
|
1790 | - lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
|
1791 | - lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'. |
|
1792 | - htmlspecialchars(Egw::link('/index.php',array( |
|
1787 | + $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 />'. |
|
1788 | + lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.', '<a href="'. |
|
1789 | + htmlspecialchars(Egw::link('/index.php', array( |
|
1793 | 1790 | 'menuaction' => 'infolog.infolog_ui.edit', |
1794 | 1791 | 'info_id' => $content['info_id'], |
1795 | 1792 | 'no_popup' => $no_popup, |
1796 | 1793 | 'referer' => $referer, |
1797 | - ))).'">','</a>'); |
|
1798 | - $button = $action = ''; // not exiting edit |
|
1794 | + ))).'">', '</a>'); |
|
1795 | + $button = $action = ''; // not exiting edit |
|
1799 | 1796 | $info_id = $content['info_id']; |
1800 | 1797 | } |
1801 | 1798 | else |
1802 | 1799 | { |
1803 | - $GLOBALS['egw']->preferences->add('infolog','preferred_type',$content['info_type']); |
|
1804 | - $GLOBALS['egw']->preferences->save_repository(false,'user',false); |
|
1800 | + $GLOBALS['egw']->preferences->add('infolog', 'preferred_type', $content['info_type']); |
|
1801 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', false); |
|
1805 | 1802 | $content['msg'] = lang('InfoLog entry saved'); |
1806 | - Framework::refresh_opener($content['msg'],'infolog',$info_id,$operation); |
|
1803 | + Framework::refresh_opener($content['msg'], 'infolog', $info_id, $operation); |
|
1807 | 1804 | } |
1808 | 1805 | $content['tabs'] = $active_tab; |
1809 | 1806 | |
1810 | - $pm_links = Link::get_links('infolog',$content['info_id'],'projectmanager'); |
|
1807 | + $pm_links = Link::get_links('infolog', $content['info_id'], 'projectmanager'); |
|
1811 | 1808 | |
1812 | 1809 | $content['link_to']['to_app'] = 'infolog'; |
1813 | 1810 | $content['link_to']['to_id'] = $info_id; |
1814 | 1811 | |
1815 | - if ($info_link_id && strpos($info_link_id,':') !== false) // updating info_link_id if necessary |
|
1812 | + if ($info_link_id && strpos($info_link_id, ':') !== false) // updating info_link_id if necessary |
|
1816 | 1813 | { |
1817 | - list($app,$id) = explode(':',$info_link_id); |
|
1818 | - $link = Link::get_link('infolog',$info_id,$app,$id); |
|
1819 | - if ((int) $content['info_link_id'] != (int) $link['link_id']) |
|
1814 | + list($app, $id) = explode(':', $info_link_id); |
|
1815 | + $link = Link::get_link('infolog', $info_id, $app, $id); |
|
1816 | + if ((int)$content['info_link_id'] != (int)$link['link_id']) |
|
1820 | 1817 | { |
1821 | 1818 | $content['info_link_id'] = $link['link_id']; |
1822 | 1819 | |
@@ -1828,7 +1825,7 @@ discard block |
||
1828 | 1825 | 'info_owner' => $content['info_owner'], |
1829 | 1826 | ); |
1830 | 1827 | //echo "<p>updating info_link_id: ".print_r($to_write,true)."</p>\n"; |
1831 | - $this->bo->write($to_write,False,true,true,true); // last true = no notifications, as no real change |
|
1828 | + $this->bo->write($to_write, False, true, true, true); // last true = no notifications, as no real change |
|
1832 | 1829 | |
1833 | 1830 | // Do not override info_contact if is already filled with contact |
1834 | 1831 | if ($content['info_contact']) |
@@ -1838,12 +1835,12 @@ discard block |
||
1838 | 1835 | } |
1839 | 1836 | |
1840 | 1837 | // we need eg. the new modification date, for further updates |
1841 | - $content = array_merge($content,$to_write); |
|
1838 | + $content = array_merge($content, $to_write); |
|
1842 | 1839 | } |
1843 | 1840 | } |
1844 | 1841 | |
1845 | 1842 | // Need to purge description history after encryption? |
1846 | - if($content['clean_history']) |
|
1843 | + if ($content['clean_history']) |
|
1847 | 1844 | { |
1848 | 1845 | $history = new Api\Storage\History('infolog'); |
1849 | 1846 | $record_count = $history->delete_field($info_id, 'De'); |
@@ -1856,33 +1853,33 @@ discard block |
||
1856 | 1853 | 'action' => $action, |
1857 | 1854 | 'action_id' => $action_id |
1858 | 1855 | ); |
1859 | - if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return; // checks ACL first |
|
1856 | + if (!($content['msg'] = $this->delete($info_id, $referer, 'edit'))) return; // checks ACL first |
|
1860 | 1857 | |
1861 | - Framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
|
1858 | + Framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete'); |
|
1862 | 1859 | } |
1863 | 1860 | // called again after delete confirmation dialog |
1864 | - elseif ($button == 'deleted' && $content['msg']) |
|
1861 | + elseif ($button == 'deleted' && $content['msg']) |
|
1865 | 1862 | { |
1866 | - Framework::refresh_opener($content['msg'],'infolog',$info_id,'delete'); |
|
1863 | + Framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete'); |
|
1867 | 1864 | } |
1868 | 1865 | if ($button == 'save' || $button == 'cancel' || $button == 'delete' || $button == 'deleted') |
1869 | 1866 | { |
1870 | 1867 | if ($no_popup) |
1871 | 1868 | { |
1872 | - Egw::redirect_link($referer,array('msg' => $content['msg'])); |
|
1869 | + Egw::redirect_link($referer, array('msg' => $content['msg'])); |
|
1873 | 1870 | } |
1874 | 1871 | Framework::window_close(); |
1875 | 1872 | } |
1876 | 1873 | } |
1877 | 1874 | // 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 |
1878 | - if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']])) |
|
1875 | + if (!array_key_exists($content['info_status'], $this->bo->status[$content['info_type']])) |
|
1879 | 1876 | { |
1880 | 1877 | $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
1881 | 1878 | // Make sure we don't end up with invalid status / percent combinations |
1882 | 1879 | if ($content['info_status'] != 'done') |
1883 | 1880 | { |
1884 | 1881 | $content['info_datecompleted'] = ''; |
1885 | - if((int)$content['info_percent'] === 100) |
|
1882 | + if ((int)$content['info_percent'] === 100) |
|
1886 | 1883 | { |
1887 | 1884 | $content['info_percent'] = 10; |
1888 | 1885 | } |
@@ -1891,7 +1888,7 @@ discard block |
||
1891 | 1888 | { |
1892 | 1889 | $content['info_percent'] = 100; |
1893 | 1890 | } |
1894 | - if($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0) |
|
1891 | + if ($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0) |
|
1895 | 1892 | { |
1896 | 1893 | $content['info_percent'] = 10; |
1897 | 1894 | } |
@@ -1900,18 +1897,17 @@ discard block |
||
1900 | 1897 | else // new call via GET |
1901 | 1898 | { |
1902 | 1899 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
1903 | - $action = $action ? $action : $_REQUEST['action']; |
|
1900 | + $action = $action ? $action : $_REQUEST['action']; |
|
1904 | 1901 | $action_id = $action_id ? $action_id : $_REQUEST['action_id']; |
1905 | - $info_id = $content ? $content : $_REQUEST['info_id']; |
|
1906 | - $type = $type ? $type : $_REQUEST['type']; |
|
1907 | - $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : |
|
1908 | - Api\Header\Referer::get('/index.php?menuaction=infolog.infolog_ui.index')); |
|
1909 | - if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer |
|
1902 | + $info_id = $content ? $content : $_REQUEST['info_id']; |
|
1903 | + $type = $type ? $type : $_REQUEST['type']; |
|
1904 | + $referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : Api\Header\Referer::get('/index.php?menuaction=infolog.infolog_ui.index')); |
|
1905 | + if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/', '\\1', $referer); // remove previou/old msg from referer |
|
1910 | 1906 | $no_popup = $_GET['no_popup']; |
1911 | - $print = (int) $_REQUEST['print']; |
|
1907 | + $print = (int)$_REQUEST['print']; |
|
1912 | 1908 | //echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; |
1913 | 1909 | |
1914 | - if (($content = $this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id )) === false) |
|
1910 | + if (($content = $this->bo->read($info_id || $action != 'sp' ? $info_id : $action_id)) === false) |
|
1915 | 1911 | { |
1916 | 1912 | Framework::window_close(lang('Permission denied!')); |
1917 | 1913 | } |
@@ -1923,29 +1919,29 @@ discard block |
||
1923 | 1919 | { |
1924 | 1920 | $content['info_cat'] = $this->prefs['cat_add_default']; |
1925 | 1921 | } |
1926 | - if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
1922 | + if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML! |
|
1927 | 1923 | |
1928 | - switch($this->prefs['set_start']) |
|
1924 | + switch ($this->prefs['set_start']) |
|
1929 | 1925 | { |
1930 | - 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; |
|
1926 | + 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; |
|
1931 | 1927 | case 'datetime': $set_startdate = $this->bo->user_time_now; break; |
1932 | 1928 | case 'empty': $set_startdate = 0; break; |
1933 | 1929 | } |
1934 | 1930 | if ((int)$content['info_link_id'] > 0 && !Link::get_link($content['info_link_id'])) |
1935 | 1931 | { |
1936 | - $content['info_link_id'] = 0; // link has been deleted |
|
1932 | + $content['info_link_id'] = 0; // link has been deleted |
|
1937 | 1933 | if (!$content['info_custom_link']) $content['info_from'] = ''; |
1938 | 1934 | } |
1939 | 1935 | if (!$info_id && $action_id && $action == 'sp') // new SubProject |
1940 | 1936 | { |
1941 | - if (!$this->bo->check_access($action_id,Acl::ADD)) |
|
1937 | + if (!$this->bo->check_access($action_id, Acl::ADD)) |
|
1942 | 1938 | { |
1943 | - return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); |
|
1939 | + return $referer ? $this->tmpl->location($referer) : $this->index(0, $action, $action_id); |
|
1944 | 1940 | } |
1945 | 1941 | } |
1946 | 1942 | else |
1947 | 1943 | { |
1948 | - $undelete = $this->bo->check_access($content,infolog_bo::ACL_UNDELETE); |
|
1944 | + $undelete = $this->bo->check_access($content, infolog_bo::ACL_UNDELETE); |
|
1949 | 1945 | } |
1950 | 1946 | $content['links'] = $content['link_to'] = array( |
1951 | 1947 | 'to_id' => $info_id, |
@@ -1953,12 +1949,12 @@ discard block |
||
1953 | 1949 | ); |
1954 | 1950 | } |
1955 | 1951 | // new call via GET or some actions handled here, as they can happen both ways ($_GET[action] or button/action in GUI) |
1956 | - if (!$submit || in_array($action,array('sp','copy','schedule','ical','to_tracker'))) |
|
1952 | + if (!$submit || in_array($action, array('sp', 'copy', 'schedule', 'ical', 'to_tracker'))) |
|
1957 | 1953 | { |
1958 | 1954 | switch ($action) |
1959 | 1955 | { |
1960 | 1956 | case 'schedule': |
1961 | - Egw::redirect_link('/index.php',array( |
|
1957 | + Egw::redirect_link('/index.php', array( |
|
1962 | 1958 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
1963 | 1959 | 'link_app' => 'infolog', |
1964 | 1960 | 'link_id' => $info_id, |
@@ -1966,7 +1962,7 @@ discard block |
||
1966 | 1962 | break; |
1967 | 1963 | case 'ical': |
1968 | 1964 | $boical = new infolog_ical(); |
1969 | - $result = $boical->exportVTODO($content,'2.0','PUBLISH',false); |
|
1965 | + $result = $boical->exportVTODO($content, '2.0', 'PUBLISH', false); |
|
1970 | 1966 | Api\Header\Content::type('todo.ics', 'text/calendar'); |
1971 | 1967 | echo $result; |
1972 | 1968 | exit(); |
@@ -1977,23 +1973,23 @@ discard block |
||
1977 | 1973 | if ($action == 'sp') // for sub-entries use type or category, like for new entries |
1978 | 1974 | { |
1979 | 1975 | if ($type) $content['info_type'] = $type; |
1980 | - if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int) $_REQUEST['cat_id']; |
|
1976 | + if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int)$_REQUEST['cat_id']; |
|
1981 | 1977 | } |
1982 | - unset($action); // it get stored in $content and will cause an other copy after [apply] |
|
1978 | + unset($action); // it get stored in $content and will cause an other copy after [apply] |
|
1983 | 1979 | break; |
1984 | 1980 | case 'to_tracker': |
1985 | - Egw::redirect_link('/index.php',array( |
|
1981 | + Egw::redirect_link('/index.php', array( |
|
1986 | 1982 | 'menuaction' => 'tracker.tracker_ui.edit', |
1987 | 1983 | Link::get_registry('tracker', 'add_app').'[]' => 'infolog', |
1988 | - Link::get_registry('tracker','add_id').'[]' => $info_id, |
|
1984 | + Link::get_registry('tracker', 'add_id').'[]' => $info_id, |
|
1989 | 1985 | )); |
1990 | 1986 | break; |
1991 | 1987 | case 'projectmanager': |
1992 | 1988 | $content['pm_id'] = $action_id; |
1993 | 1989 | default: // to allow other apps to participate |
1994 | 1990 | $content['info_subject'] = Link::title($action, $id); |
1995 | - $action_ids = explode(',',$action_id); |
|
1996 | - if(count($action_ids) == 1) |
|
1991 | + $action_ids = explode(',', $action_id); |
|
1992 | + if (count($action_ids) == 1) |
|
1997 | 1993 | { |
1998 | 1994 | $content['info_contact'] = array('app' => $action, 'id' => $action_id); |
1999 | 1995 | } |
@@ -2002,11 +1998,11 @@ discard block |
||
2002 | 1998 | Link::link('infolog', $content['link_to']['to_id'], $action, $id); |
2003 | 1999 | |
2004 | 2000 | // calling "infolog_set" hook for first, in case app wants to set some more values |
2005 | - if (!$n && ($set = Api\Hooks::single(array('location'=>'infolog_set','id'=>$action_id),$action))) |
|
2001 | + if (!$n && ($set = Api\Hooks::single(array('location'=>'infolog_set', 'id'=>$action_id), $action))) |
|
2006 | 2002 | { |
2007 | - foreach((array)$set['link_app'] as $i => $l_app) |
|
2003 | + foreach ((array)$set['link_app'] as $i => $l_app) |
|
2008 | 2004 | { |
2009 | - if (($l_id=$set['link_id'][$i])) Link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id); |
|
2005 | + if (($l_id = $set['link_id'][$i])) Link::link('infolog', $content['link_to']['to_id'], $l_app, $l_id); |
|
2010 | 2006 | } |
2011 | 2007 | unset($set['link_app']); |
2012 | 2008 | unset($set['link_id']); |
@@ -2020,12 +2016,12 @@ discard block |
||
2020 | 2016 | { |
2021 | 2017 | if (!isset($pm_links)) |
2022 | 2018 | { |
2023 | - $pm_links = Link::get_links('infolog',$info_id,'projectmanager'); |
|
2019 | + $pm_links = Link::get_links('infolog', $info_id, 'projectmanager'); |
|
2024 | 2020 | } |
2025 | - break; // normal edit |
|
2021 | + break; // normal edit |
|
2026 | 2022 | } |
2027 | 2023 | case 'new': // new entry, set some defaults, if not set by infolog_set hook |
2028 | - if (empty($content['info_startdate'])) $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate; |
|
2024 | + if (empty($content['info_startdate'])) $content['info_startdate'] = (int)$_GET['startdate'] ? (int)$_GET['startdate'] : $set_startdate; |
|
2029 | 2025 | if (empty($content['info_priority'])) $content['info_priority'] = 1; // normal |
2030 | 2026 | $content['info_owner'] = $this->user; |
2031 | 2027 | if ($type != '' && empty($content['info_type'])) |
@@ -2050,9 +2046,9 @@ discard block |
||
2050 | 2046 | if ($this->bo->group_owners) |
2051 | 2047 | { |
2052 | 2048 | // remove types owned by groups the user has no edit grant (current type is made readonly) |
2053 | - foreach($this->bo->group_owners as $type => $group) |
|
2049 | + foreach ($this->bo->group_owners as $type => $group) |
|
2054 | 2050 | { |
2055 | - if (!($this->bo->grants[$group] & Acl::EDIT)) |
|
2051 | + if (!($this->bo->grants[$group]&Acl::EDIT)) |
|
2056 | 2052 | { |
2057 | 2053 | if ($type == $content['info_type']) |
2058 | 2054 | { |
@@ -2070,7 +2066,7 @@ discard block |
||
2070 | 2066 | { |
2071 | 2067 | $content['info_owner'] = $this->bo->group_owners[$content['info_type']]; |
2072 | 2068 | // Dont allow to change the type, if user has no delete rights from the group-owner |
2073 | - if ($info_id && !($this->bo->grants[$content['info_owner']] & Acl::DELETE)) |
|
2069 | + if ($info_id && !($this->bo->grants[$content['info_owner']]&Acl::DELETE)) |
|
2074 | 2070 | { |
2075 | 2071 | //echo "<p>setting type to r/o as user has no delete rights from group #$group</p>\n"; |
2076 | 2072 | $readonlys['info_type'] = true; |
@@ -2078,7 +2074,7 @@ discard block |
||
2078 | 2074 | // disable info_access for group-owners |
2079 | 2075 | $readonlys['info_access'] = true; |
2080 | 2076 | } |
2081 | - elseif($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g') |
|
2077 | + elseif ($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g') |
|
2082 | 2078 | { |
2083 | 2079 | $content['info_owner'] = $this->user; |
2084 | 2080 | } |
@@ -2092,17 +2088,17 @@ discard block |
||
2092 | 2088 | // for no edit rights or implizit edit of responsible user make all fields readonly, but status and percent |
2093 | 2089 | if ($info_id && !$this->bo->check_access($content, Acl::EDIT) && !$undelete) |
2094 | 2090 | { |
2095 | - $readonlys['__ALL__'] = true; // make all fields not explicitly set readonly |
|
2091 | + $readonlys['__ALL__'] = true; // make all fields not explicitly set readonly |
|
2096 | 2092 | if ($this->bo->is_responsible($content)) |
2097 | 2093 | { |
2098 | - foreach($this->bo->responsible_edit as $name) |
|
2094 | + foreach ($this->bo->responsible_edit as $name) |
|
2099 | 2095 | { |
2100 | 2096 | $readonlys[$name] = false; |
2101 | 2097 | } |
2102 | 2098 | $readonlys['timestamp'] = $readonlys['info_des']; |
2103 | 2099 | $readonlys['button[edit]'] = $readonlys['button[save]'] = $readonlys['button[apply]'] = $readonlys['no_notifications'] = false; |
2104 | 2100 | } |
2105 | - $readonlys['action'] = $readonlys['button[cancel]'] = false; // always allowed |
|
2101 | + $readonlys['action'] = $readonlys['button[cancel]'] = false; // always allowed |
|
2106 | 2102 | } |
2107 | 2103 | elseif (!$info_id) |
2108 | 2104 | { |
@@ -2117,14 +2113,14 @@ discard block |
||
2117 | 2113 | |
2118 | 2114 | if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($content, Acl::DELETE))) |
2119 | 2115 | { |
2120 | - $content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not |
|
2116 | + $content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not |
|
2121 | 2117 | } |
2122 | 2118 | $GLOBALS['egw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]); |
2123 | 2119 | |
2124 | 2120 | // use a typ-specific template (infolog.edit.xyz), if one exists, otherwise fall back to the generic one |
2125 | 2121 | if (!$this->tmpl->read('infolog.edit.'.$content['info_type'])) |
2126 | 2122 | { |
2127 | - $this->tmpl->read($print ? 'infolog.edit.print':'infolog.edit'); |
|
2123 | + $this->tmpl->read($print ? 'infolog.edit.print' : 'infolog.edit'); |
|
2128 | 2124 | } |
2129 | 2125 | if ($this->bo->has_customfields($content['info_type'])) |
2130 | 2126 | { |
@@ -2136,7 +2132,7 @@ discard block |
||
2136 | 2132 | } |
2137 | 2133 | if (!isset($GLOBALS['egw_info']['user']['apps']['projectmanager'])) |
2138 | 2134 | { |
2139 | - $readonlys['tabs']['project'] = true; // disable the project tab |
|
2135 | + $readonlys['tabs']['project'] = true; // disable the project tab |
|
2140 | 2136 | } |
2141 | 2137 | |
2142 | 2138 | $content['duration_format'] = $this->duration_format; |
@@ -2144,15 +2140,14 @@ discard block |
||
2144 | 2140 | if ($this->prefs['show_id']) $content['info_number'] = $info_id; |
2145 | 2141 | |
2146 | 2142 | // Check no notification preference, update if type changed |
2147 | - if($content['info_type'] != $content['old_type']) |
|
2143 | + if ($content['info_type'] != $content['old_type']) |
|
2148 | 2144 | { |
2149 | 2145 | $content['no_notifications'] = in_array($content['info_type'], !is_array($this->prefs['no_notification_types']) ? |
2150 | - explode(',',$this->prefs['no_notification_types']): |
|
2151 | - $this->prefs['no_notification_types'] |
|
2146 | + explode(',', $this->prefs['no_notification_types']) : $this->prefs['no_notification_types'] |
|
2152 | 2147 | ); |
2153 | 2148 | } |
2154 | 2149 | |
2155 | - $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
|
2150 | + $content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty! |
|
2156 | 2151 | |
2157 | 2152 | $old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id']; |
2158 | 2153 | unset($content['old_pm_id']); |
@@ -2170,7 +2165,7 @@ discard block |
||
2170 | 2165 | 'Pr' => $this->bo->enums['priority'], |
2171 | 2166 | 'Ow' => 'select-account', |
2172 | 2167 | //'Ac', // info_access: private||public |
2173 | - 'St' => (array)$this->bo->status[$content['info_type']]+array('deleted' => 'deleted'), |
|
2168 | + 'St' => (array)$this->bo->status[$content['info_type']] + array('deleted' => 'deleted'), |
|
2174 | 2169 | 'Pe' => 'select-percent', |
2175 | 2170 | 'Co' => 'date-time', |
2176 | 2171 | 'st' => 'date-time', |
@@ -2187,7 +2182,7 @@ discard block |
||
2187 | 2182 | ); |
2188 | 2183 | $history_stati = array(); |
2189 | 2184 | $tracking = new infolog_tracking($this); |
2190 | - foreach($tracking->field2history as $field => $history) |
|
2185 | + foreach ($tracking->field2history as $field => $history) |
|
2191 | 2186 | { |
2192 | 2187 | $history_stati[$history] = $tracking->field2label[$field]; |
2193 | 2188 | } |
@@ -2232,8 +2227,8 @@ discard block |
||
2232 | 2227 | //$content['info_des'] = substr($content['info_des'],0,1793); |
2233 | 2228 | //echo "<p>infolog_ui.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); |
2234 | 2229 | //$content['info_cc'] is expected (by the widget) to be an array of emailaddresses, but is stored as comma separated string |
2235 | - if (!empty($content['info_cc'])&&!is_array($content['info_cc']))$content['info_cc'] = explode(',',$content['info_cc']); |
|
2236 | - $preserve = array_merge( $preserv, array( // preserved values |
|
2230 | + if (!empty($content['info_cc']) && !is_array($content['info_cc']))$content['info_cc'] = explode(',', $content['info_cc']); |
|
2231 | + $preserve = array_merge($preserv, array( // preserved values |
|
2237 | 2232 | 'info_id' => $info_id, |
2238 | 2233 | 'action' => $action, |
2239 | 2234 | 'action_id' => $action_id, |
@@ -2242,7 +2237,7 @@ discard block |
||
2242 | 2237 | 'old_pm_id' => $old_pm_id, |
2243 | 2238 | 'old_type' => $content['info_type'], |
2244 | 2239 | )); |
2245 | - $this->tmpl->exec('infolog.infolog_ui.edit',$content,$sel_options,$readonlys,$preserve,$no_popup ? 0 : 2); |
|
2240 | + $this->tmpl->exec('infolog.infolog_ui.edit', $content, $sel_options, $readonlys, $preserve, $no_popup ? 0 : 2); |
|
2246 | 2241 | } |
2247 | 2242 | |
2248 | 2243 | /** |
@@ -2253,16 +2248,16 @@ discard block |
||
2253 | 2248 | * @param array &$content |
2254 | 2249 | * @param boolean $create_sub true: create a sub-entry instead of a copy, default false to create a copy |
2255 | 2250 | */ |
2256 | - private function create_copy(array &$content, $create_sub=false) |
|
2251 | + private function create_copy(array &$content, $create_sub = false) |
|
2257 | 2252 | { |
2258 | - $info_id = $content['info_id']; // it will be unset by exclude-fields |
|
2253 | + $info_id = $content['info_id']; // it will be unset by exclude-fields |
|
2259 | 2254 | |
2260 | 2255 | // empty fields configured to be excluded (also contains id, uid, ...) |
2261 | 2256 | $exclude_fields = $create_sub ? $this->bo->sub_excludefields : $this->bo->copy_excludefields; |
2262 | 2257 | foreach ($exclude_fields as $field) |
2263 | 2258 | { |
2264 | 2259 | unset($content[$field]); |
2265 | - if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
2260 | + if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI |
|
2266 | 2261 | } |
2267 | 2262 | if ($create_sub) |
2268 | 2263 | { |
@@ -2271,9 +2266,9 @@ discard block |
||
2271 | 2266 | // no startdate or startdate in the past --> set startdate from pref |
2272 | 2267 | if (!isset($content['info_startdate']) || $content['info_startdate'] < $this->bo->user_time_now) |
2273 | 2268 | { |
2274 | - switch($this->prefs['set_start']) |
|
2269 | + switch ($this->prefs['set_start']) |
|
2275 | 2270 | { |
2276 | - 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 | + 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; |
|
2277 | 2272 | case 'datetime': $set_startdate = $this->bo->user_time_now; break; |
2278 | 2273 | case 'empty': $set_startdate = 0; break; |
2279 | 2274 | } |
@@ -2292,17 +2287,17 @@ discard block |
||
2292 | 2287 | // get a consistent status, percent and date-completed |
2293 | 2288 | if (!isset($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; |
2294 | 2289 | if (!isset($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%'; |
2295 | - $content['info_datecompleted'] =$content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
|
2290 | + $content['info_datecompleted'] = $content['info_status'] == 'done' ? $this->bo->user_time_now : 0; |
|
2296 | 2291 | |
2297 | 2292 | if (!isset($content['info_cat'])) $content['info_cat'] = $this->prefs['cat_add_default']; |
2298 | 2293 | |
2299 | - if(!is_array($content['link_to'])) $content['link_to'] = array(); |
|
2294 | + if (!is_array($content['link_to'])) $content['link_to'] = array(); |
|
2300 | 2295 | $content['link_to']['to_app'] = 'infolog'; |
2301 | 2296 | $content['link_to']['to_id'] = 0; |
2302 | 2297 | // Get links to be copied, if not excluded |
2303 | - if (!in_array('link_to',$exclude_fields) || !in_array('attachments',$exclude_fields)) |
|
2298 | + if (!in_array('link_to', $exclude_fields) || !in_array('attachments', $exclude_fields)) |
|
2304 | 2299 | { |
2305 | - foreach(Link::get_links($content['link_to']['to_app'], $info_id) as $link) |
|
2300 | + foreach (Link::get_links($content['link_to']['to_app'], $info_id) as $link) |
|
2306 | 2301 | { |
2307 | 2302 | if ($link['app'] != Link::VFS_APPNAME && !in_array('link_to', $exclude_fields)) |
2308 | 2303 | { |
@@ -2326,24 +2321,23 @@ discard block |
||
2326 | 2321 | if (!isset($content['info_contact']) || empty($content['info_contact']) || $content['info_contact'] === 'copy:') |
2327 | 2322 | { |
2328 | 2323 | $linkinfos = Link::get_link($info_link_id); |
2329 | - $content['info_contact'] = $linkinfos['link_app1']=='infolog'? |
|
2330 | - array('app' => $linkinfos['link_app2'], 'id' => $linkinfos['link_id2']): |
|
2331 | - array('app' => $linkinfos['link_app1'], 'id' => $linkinfos['link_id1']); |
|
2324 | + $content['info_contact'] = $linkinfos['link_app1'] == 'infolog' ? |
|
2325 | + array('app' => $linkinfos['link_app2'], 'id' => $linkinfos['link_id2']) : array('app' => $linkinfos['link_app1'], 'id' => $linkinfos['link_id1']); |
|
2332 | 2326 | if ($content['info_contact']['app'] == 'projectmanager') |
2333 | 2327 | { |
2334 | - $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2']; |
|
2328 | + $content['pm_id'] = $linkinfos['link_app1'] == 'projectmanager' ? $linkinfos['link_id1'] : $linkinfos['link_id2']; |
|
2335 | 2329 | } |
2336 | 2330 | } |
2337 | 2331 | unset($content['info_link_id']); |
2338 | 2332 | } |
2339 | - $content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(Acl::ADD,0,$this->owner) ? $this->user : $this->owner; |
|
2333 | + $content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(Acl::ADD, 0, $this->owner) ? $this->user : $this->owner; |
|
2340 | 2334 | |
2341 | 2335 | if (!empty($content['info_subject'])) |
2342 | 2336 | { |
2343 | 2337 | if ($create_sub) |
2344 | 2338 | { |
2345 | 2339 | $config = Api\Config::read('infolog'); |
2346 | - $prefix = lang(empty($config['sub_prefix']) ? 'Re:': $config['sub_prefix']); |
|
2340 | + $prefix = lang(empty($config['sub_prefix']) ? 'Re:' : $config['sub_prefix']); |
|
2347 | 2341 | } |
2348 | 2342 | else |
2349 | 2343 | { |
@@ -2353,11 +2347,11 @@ discard block |
||
2353 | 2347 | } |
2354 | 2348 | if (!$create_sub) |
2355 | 2349 | { |
2356 | - $content['msg'] .= ($content['msg']?"\n":'').lang('%1 copied - the copy can now be edited', lang(Link::get_registry('infolog','entry'))); |
|
2350 | + $content['msg'] .= ($content['msg'] ? "\n" : '').lang('%1 copied - the copy can now be edited', lang(Link::get_registry('infolog', 'entry'))); |
|
2357 | 2351 | } |
2358 | 2352 | } |
2359 | 2353 | |
2360 | - function icon($cat,$id,$status='') |
|
2354 | + function icon($cat, $id, $status = '') |
|
2361 | 2355 | { |
2362 | 2356 | if (!$status || !($icon = $this->icons[$cat][$id.'_'.$status])) |
2363 | 2357 | { |
@@ -2374,7 +2368,7 @@ discard block |
||
2374 | 2368 | $alt = $id; |
2375 | 2369 | } |
2376 | 2370 | } |
2377 | - return $icon ? Api\Html::image('infolog',$icon,lang($alt),'border=0') : lang($alt); |
|
2371 | + return $icon ? Api\Html::image('infolog', $icon, lang($alt), 'border=0') : lang($alt); |
|
2378 | 2372 | } |
2379 | 2373 | |
2380 | 2374 | /** |
@@ -2422,28 +2416,28 @@ discard block |
||
2422 | 2416 | 'info_cc' => 'CC', |
2423 | 2417 | ); |
2424 | 2418 | // add customfields to field list |
2425 | - foreach(Api\Storage\Customfields::get('infolog') as $name => $data) |
|
2419 | + foreach (Api\Storage\Customfields::get('infolog') as $name => $data) |
|
2426 | 2420 | { |
2427 | 2421 | $excludefields['#'.$name] = $data['label']; |
2428 | 2422 | } |
2429 | 2423 | $sub_excludefields = $excludefields; |
2430 | - unset($sub_excludefields['info_id_parent']); // always set to parent! |
|
2424 | + unset($sub_excludefields['info_id_parent']); // always set to parent! |
|
2431 | 2425 | |
2432 | 2426 | $config = Api\Config::read('infolog'); |
2433 | 2427 | Api\Translation::add_app('infolog'); |
2434 | 2428 | |
2435 | - if($content) |
|
2429 | + if ($content) |
|
2436 | 2430 | { |
2437 | 2431 | // Save |
2438 | 2432 | $button = key($content['button']); |
2439 | - if($button == 'save' || $button == 'apply') |
|
2433 | + if ($button == 'save' || $button == 'apply') |
|
2440 | 2434 | { |
2441 | - $this->bo->responsible_edit = array('info_status','info_percent','info_datecompleted'); |
|
2435 | + $this->bo->responsible_edit = array('info_status', 'info_percent', 'info_datecompleted'); |
|
2442 | 2436 | |
2443 | 2437 | if ($content['responsible_edit']) |
2444 | 2438 | { |
2445 | - $extra = array_intersect($content['responsible_edit'],array_keys($fields)); |
|
2446 | - $this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit,$extra)); |
|
2439 | + $extra = array_intersect($content['responsible_edit'], array_keys($fields)); |
|
2440 | + $this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit, $extra)); |
|
2447 | 2441 | } |
2448 | 2442 | Api\Config::save_value('copy_excludefields', $content['copy_excludefields'] ? $content['copy_excludefields'] : null, 'infolog'); |
2449 | 2443 | Api\Config::save_value('sub_excludefields', $content['sub_excludefields'] ? $content['sub_excludefields'] : array('*NONE*'), 'infolog'); |
@@ -2454,12 +2448,12 @@ discard block |
||
2454 | 2448 | Api\Config::save_value('sub_prefix', $content['sub_prefix'], 'infolog'); |
2455 | 2449 | Api\Config::save_value('allow_past_due_date', $content['allow_past_due_date'], 'infolog'); |
2456 | 2450 | // Notifications |
2457 | - $notifications =& $config[infolog_tracking::CUSTOM_NOTIFICATION]; |
|
2451 | + $notifications = & $config[infolog_tracking::CUSTOM_NOTIFICATION]; |
|
2458 | 2452 | $notifications[$content['notification_type']] = $content['notification']; |
2459 | - Api\Config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications,'infolog'); |
|
2453 | + Api\Config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications, 'infolog'); |
|
2460 | 2454 | } |
2461 | 2455 | |
2462 | - if($button == 'save' || $button == 'cancel') |
|
2456 | + if ($button == 'save' || $button == 'cancel') |
|
2463 | 2457 | { |
2464 | 2458 | Egw::redirect_link('/index.php', array( |
2465 | 2459 | 'menuaction' => 'admin.admin_ui.index', |
@@ -2482,7 +2476,7 @@ discard block |
||
2482 | 2476 | $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Site configuration'); |
2483 | 2477 | |
2484 | 2478 | // Load selected custom notification |
2485 | - if(!$content['notification_type']) |
|
2479 | + if (!$content['notification_type']) |
|
2486 | 2480 | { |
2487 | 2481 | $content['notification_type'] = '~global~'; |
2488 | 2482 | } |
@@ -2506,7 +2500,7 @@ discard block |
||
2506 | 2500 | ); |
2507 | 2501 | $preserve['notification_old_type'] = $content['notification_type']; |
2508 | 2502 | $this->tmpl->read('infolog.config'); |
2509 | - $this->tmpl->exec('infolog.infolog_ui.admin',$content,$sel_options,array(),$preserve); |
|
2503 | + $this->tmpl->exec('infolog.infolog_ui.admin', $content, $sel_options, array(), $preserve); |
|
2510 | 2504 | } |
2511 | 2505 | |
2512 | 2506 | /** |
@@ -2515,13 +2509,13 @@ discard block |
||
2515 | 2509 | * @param array $mailContent = null content of mail |
2516 | 2510 | * @return array |
2517 | 2511 | */ |
2518 | - function mail_import(array $mailContent=null) |
|
2512 | + function mail_import(array $mailContent = null) |
|
2519 | 2513 | { |
2520 | 2514 | // It would get called from compose as a popup with egw_data |
2521 | 2515 | if (!is_array($mailContent) && ($_GET['egw_data'])) |
2522 | 2516 | { |
2523 | 2517 | // get the mail raw data |
2524 | - Link::get_data ($_GET['egw_data']); |
|
2518 | + Link::get_data($_GET['egw_data']); |
|
2525 | 2519 | return false; |
2526 | 2520 | } |
2527 | 2521 | |
@@ -2552,7 +2546,7 @@ discard block |
||
2552 | 2546 | function hook_view($args) |
2553 | 2547 | { |
2554 | 2548 | // Load JS for infolog actions |
2555 | - Framework::includeJS('.','app','infolog'); |
|
2549 | + Framework::includeJS('.', 'app', 'infolog'); |
|
2556 | 2550 | |
2557 | 2551 | switch ($args['location']) |
2558 | 2552 | { |
@@ -2580,7 +2574,7 @@ discard block |
||
2580 | 2574 | { |
2581 | 2575 | return False; |
2582 | 2576 | } |
2583 | - $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks |
|
2577 | + $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks |
|
2584 | 2578 | |
2585 | 2579 | // Set to calling app, so actions wind up in the correct place client side |
2586 | 2580 | $GLOBALS['egw_info']['flags']['currentapp'] = $app; |
@@ -2588,11 +2582,11 @@ discard block |
||
2588 | 2582 | Api\Translation::add_app('infolog'); |
2589 | 2583 | |
2590 | 2584 | // Still want infolog Api\Categories though |
2591 | - $GLOBALS['egw']->categories = new Api\Categories('','infolog'); |
|
2592 | - $this->index(null,$app,$args[$view_id],array( |
|
2585 | + $GLOBALS['egw']->categories = new Api\Categories('', 'infolog'); |
|
2586 | + $this->index(null, $app, $args[$view_id], array( |
|
2593 | 2587 | 'menuaction' => $view, |
2594 | 2588 | isset($view_id2) ? $view_id2 : $view_id => $args[$view_id] |
2595 | - ),True); |
|
2589 | + ), True); |
|
2596 | 2590 | } |
2597 | 2591 | |
2598 | 2592 | /** |
@@ -2601,25 +2595,25 @@ discard block |
||
2601 | 2595 | * @param string $type infolog type to include only the matching custom fields if set |
2602 | 2596 | * @return array |
2603 | 2597 | */ |
2604 | - function csv_export_fields($type=null) |
|
2598 | + function csv_export_fields($type = null) |
|
2605 | 2599 | { |
2606 | 2600 | $fields = array( |
2607 | 2601 | 'info_type' => lang('Type'), |
2608 | 2602 | 'info_from' => lang('Contact'), |
2609 | 2603 | // 'info_link_id' => lang('primary link'), |
2610 | - 'info_cat' => array('label' => lang('Category'),'type' => 'select-cat'), |
|
2604 | + 'info_cat' => array('label' => lang('Category'), 'type' => 'select-cat'), |
|
2611 | 2605 | 'info_priority' => lang('Priority'), |
2612 | - 'info_owner' => array('label' => lang('Owner'),'type' => 'select-account'), |
|
2606 | + 'info_owner' => array('label' => lang('Owner'), 'type' => 'select-account'), |
|
2613 | 2607 | 'info_access' => lang('Access'), |
2614 | 2608 | 'info_status' => lang('Status'), |
2615 | 2609 | 'info_percent' => lang('Completed'), |
2616 | 2610 | 'info_datecompleted' => lang('Date completed'), |
2617 | 2611 | 'info_datemodified' => lang('Last modified'), |
2618 | - 'info_modifier' => array('label' => lang('Modifier'),'type' => 'select-account'), |
|
2612 | + 'info_modifier' => array('label' => lang('Modifier'), 'type' => 'select-account'), |
|
2619 | 2613 | 'info_location' => lang('Location'), |
2620 | 2614 | 'info_startdate' => lang('Startdate'), |
2621 | 2615 | 'info_enddate' => lang('Enddate'), |
2622 | - 'info_responsible' => array('label' => lang('Responsible'),'type' => 'select-account'), |
|
2616 | + 'info_responsible' => array('label' => lang('Responsible'), 'type' => 'select-account'), |
|
2623 | 2617 | 'info_subject' => lang('Subject'), |
2624 | 2618 | 'info_des' => lang('Description'), |
2625 | 2619 | 'info_id' => lang('Id'), |
@@ -2629,13 +2623,13 @@ discard block |
||
2629 | 2623 | 'pl_id' => lang('pricelist'), |
2630 | 2624 | 'info_price' => lang('price'), |
2631 | 2625 | ); |
2632 | - foreach($this->bo->timestamps as $name) |
|
2626 | + foreach ($this->bo->timestamps as $name) |
|
2633 | 2627 | { |
2634 | - $fields[$name] = array('label' => $fields[$name],'type' => 'date-time'); |
|
2628 | + $fields[$name] = array('label' => $fields[$name], 'type' => 'date-time'); |
|
2635 | 2629 | } |
2636 | - foreach($this->bo->customfields as $name => $data) |
|
2630 | + foreach ($this->bo->customfields as $name => $data) |
|
2637 | 2631 | { |
2638 | - if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) continue; |
|
2632 | + if ($data['type2'] && $type && !in_array($type, explode(',', $data['type2']))) continue; |
|
2639 | 2633 | |
2640 | 2634 | $fields['#'.$name] = array( |
2641 | 2635 | 'label' => $data['label'], |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | // List each custom field |
35 | 35 | unset($this->mapping_fields['custom']); |
36 | 36 | $custom = Api\Storage\Customfields::get('infolog'); |
37 | - foreach($custom as $name => $data) { |
|
37 | + foreach ($custom as $name => $data) { |
|
38 | 38 | $this->mapping_fields['#'.$name] = $data['label']; |
39 | 39 | } |
40 | 40 | |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | # Skipped for now (or forever) |
63 | 63 | function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv) |
64 | 64 | { |
65 | - if($this->debug) error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
65 | + if ($this->debug) error_log(__METHOD__.'->$content '.print_r($content, true)); |
|
66 | 66 | unset($content['no_owner_map']); |
67 | 67 | // Check that record owner has access |
68 | 68 | $access = true; |
69 | - if($content['record_owner']) |
|
69 | + if ($content['record_owner']) |
|
70 | 70 | { |
71 | 71 | $bo = new infolog_bo(); |
72 | - $access = $bo->check_access(0,Acl::EDIT, $content['record_owner']); |
|
72 | + $access = $bo->check_access(0, Acl::EDIT, $content['record_owner']); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // return from step60 |
76 | 76 | if ($content['step'] == 'wizard_step60') |
77 | 77 | { |
78 | - if(!$access) { |
|
78 | + if (!$access) { |
|
79 | 79 | $step = $content['step']; |
80 | 80 | unset($content['step']); |
81 | 81 | return $step; |
@@ -83,34 +83,34 @@ discard block |
||
83 | 83 | switch (array_search('pressed', $content['button'])) |
84 | 84 | { |
85 | 85 | case 'next': |
86 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
86 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
87 | 87 | case 'previous' : |
88 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
88 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
89 | 89 | case 'finish': |
90 | 90 | return 'wizard_finish'; |
91 | 91 | default : |
92 | - return $this->wizard_step60($content,$sel_options,$readonlys,$preserv); |
|
92 | + return $this->wizard_step60($content, $sel_options, $readonlys, $preserv); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | // init step60 |
96 | 96 | else |
97 | 97 | { |
98 | 98 | $content['msg'] = $this->steps['wizard_step60']; |
99 | - if(!$access) { |
|
100 | - $content['msg'] .= "\n* " . lang('Owner does not have edit rights'); |
|
99 | + if (!$access) { |
|
100 | + $content['msg'] .= "\n* ".lang('Owner does not have edit rights'); |
|
101 | 101 | } |
102 | 102 | $content['step'] = 'wizard_step60'; |
103 | - if(!array_key_exists($content['record_owner']) && $content['plugin_options']) { |
|
103 | + if (!array_key_exists($content['record_owner']) && $content['plugin_options']) { |
|
104 | 104 | $content['record_owner'] = $content['plugin_options']['record_owner']; |
105 | 105 | } |
106 | - if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) { |
|
106 | + if (!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) { |
|
107 | 107 | $content['owner_from_csv'] = $content['plugin_options']['owner_from_csv']; |
108 | 108 | } |
109 | - if(!array_key_exists($content['change_owner']) && $content['plugin_options']) { |
|
109 | + if (!array_key_exists($content['change_owner']) && $content['plugin_options']) { |
|
110 | 110 | $content['change_owner'] = $content['plugin_options']['change_owner']; |
111 | 111 | } |
112 | 112 | |
113 | - if(!in_array('info_owner', $content['field_mapping'])) { |
|
113 | + if (!in_array('info_owner', $content['field_mapping'])) { |
|
114 | 114 | $content['no_owner_map'] = true; |
115 | 115 | } |
116 | 116 |
@@ -34,7 +34,8 @@ discard block |
||
34 | 34 | // List each custom field |
35 | 35 | unset($this->mapping_fields['custom']); |
36 | 36 | $custom = Api\Storage\Customfields::get('infolog'); |
37 | - foreach($custom as $name => $data) { |
|
37 | + foreach($custom as $name => $data) |
|
38 | + { |
|
38 | 39 | $this->mapping_fields['#'.$name] = $data['label']; |
39 | 40 | } |
40 | 41 | |
@@ -62,7 +63,10 @@ discard block |
||
62 | 63 | # Skipped for now (or forever) |
63 | 64 | function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv) |
64 | 65 | { |
65 | - if($this->debug) error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
66 | + if($this->debug) |
|
67 | + { |
|
68 | + error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
69 | + } |
|
66 | 70 | unset($content['no_owner_map']); |
67 | 71 | // Check that record owner has access |
68 | 72 | $access = true; |
@@ -75,7 +79,8 @@ discard block |
||
75 | 79 | // return from step60 |
76 | 80 | if ($content['step'] == 'wizard_step60') |
77 | 81 | { |
78 | - if(!$access) { |
|
82 | + if(!$access) |
|
83 | + { |
|
79 | 84 | $step = $content['step']; |
80 | 85 | unset($content['step']); |
81 | 86 | return $step; |
@@ -96,21 +101,26 @@ discard block |
||
96 | 101 | else |
97 | 102 | { |
98 | 103 | $content['msg'] = $this->steps['wizard_step60']; |
99 | - if(!$access) { |
|
104 | + if(!$access) |
|
105 | + { |
|
100 | 106 | $content['msg'] .= "\n* " . lang('Owner does not have edit rights'); |
101 | 107 | } |
102 | 108 | $content['step'] = 'wizard_step60'; |
103 | - if(!array_key_exists($content['record_owner']) && $content['plugin_options']) { |
|
109 | + if(!array_key_exists($content['record_owner']) && $content['plugin_options']) |
|
110 | + { |
|
104 | 111 | $content['record_owner'] = $content['plugin_options']['record_owner']; |
105 | 112 | } |
106 | - if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) { |
|
113 | + if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) |
|
114 | + { |
|
107 | 115 | $content['owner_from_csv'] = $content['plugin_options']['owner_from_csv']; |
108 | 116 | } |
109 | - if(!array_key_exists($content['change_owner']) && $content['plugin_options']) { |
|
117 | + if(!array_key_exists($content['change_owner']) && $content['plugin_options']) |
|
118 | + { |
|
110 | 119 | $content['change_owner'] = $content['plugin_options']['change_owner']; |
111 | 120 | } |
112 | 121 | |
113 | - if(!in_array('info_owner', $content['field_mapping'])) { |
|
122 | + if(!in_array('info_owner', $content['field_mapping'])) |
|
123 | + { |
|
114 | 124 | $content['no_owner_map'] = true; |
115 | 125 | } |
116 | 126 |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | var $productName = ''; |
68 | 68 | |
69 | 69 | /** |
70 | - * Shall we use the UID extensions of the description field? |
|
71 | - * |
|
72 | - * @var boolean |
|
73 | - */ |
|
70 | + * Shall we use the UID extensions of the description field? |
|
71 | + * |
|
72 | + * @var boolean |
|
73 | + */ |
|
74 | 74 | var $uidExtension = false; |
75 | 75 | |
76 | 76 | /** |
@@ -509,10 +509,10 @@ discard block |
||
509 | 509 | * @param boolean $merge =false merge data with existing entry (no longer used) |
510 | 510 | * @param int $user =null delegate new task to this account_id, default null |
511 | 511 | * @param string $charset =null The encoding charset for $text. Defaults to |
512 | - * utf-8 for new format, iso-8859-1 for old format. |
|
513 | - * @param string $caldav_name =null CalDAV URL name-part for new entries |
|
514 | - * @param array $callback_data =null array with callback and further parameters, first param is task to save |
|
515 | - * signature array callback($task, $param1, ...) |
|
512 | + * utf-8 for new format, iso-8859-1 for old format. |
|
513 | + * @param string $caldav_name =null CalDAV URL name-part for new entries |
|
514 | + * @param array $callback_data =null array with callback and further parameters, first param is task to save |
|
515 | + * signature array callback($task, $param1, ...) |
|
516 | 516 | * @return int|boolean integer info_id or false on error |
517 | 517 | */ |
518 | 518 | function importVTODO(&$_vcalData, $_taskID=-1, $merge=false, $user=null, $charset=null, $caldav_name=null, |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @param int $contentID =null infolog_id (or null, if unkown) |
598 | 598 | * @param boolean $relax =false if true, a weaker match algorithm is used |
599 | 599 | * @param string $charset The encoding charset for $text. Defaults to |
600 | - * utf-8 for new format, iso-8859-1 for old format. |
|
600 | + * utf-8 for new format, iso-8859-1 for old format. |
|
601 | 601 | * |
602 | 602 | * @return array of infolog_ids of matching entries |
603 | 603 | */ |
@@ -642,8 +642,8 @@ discard block |
||
642 | 642 | * @param string $_vcalData VTODO data |
643 | 643 | * @param int $_taskID =-1 infolog_id of the entry |
644 | 644 | * @param string $charset The encoding charset for $text. Defaults to |
645 | - * utf-8 for new format, iso-8859-1 for old format. |
|
646 | - * |
|
645 | + * utf-8 for new format, iso-8859-1 for old format. |
|
646 | + * |
|
647 | 647 | * @return array infolog entry or false on error |
648 | 648 | */ |
649 | 649 | function vtodotoegw($_vcalData, $_taskID=-1, $charset=null) |
@@ -1010,8 +1010,8 @@ discard block |
||
1010 | 1010 | * @param int $_noteID =-1 info_id, default -1 = new entry |
1011 | 1011 | * @param boolean $merge =false merge data with existing entry (no longer used) |
1012 | 1012 | * @param string $charset The encoding charset for $text. Defaults to |
1013 | - * utf-8 for new format, iso-8859-1 for old format. |
|
1014 | - * |
|
1013 | + * utf-8 for new format, iso-8859-1 for old format. |
|
1014 | + * |
|
1015 | 1015 | * @return int|boolean integer info_id or false on error |
1016 | 1016 | */ |
1017 | 1017 | function importVNOTE(&$_vcalData, $_type, $_noteID=-1, $merge=false, $charset=null) |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | * @param int $contentID=null infolog_id (or null, if unkown) |
1046 | 1046 | * @param boolean $relax=false if true, a weaker match algorithm is used |
1047 | 1047 | * @param string $charset The encoding charset for $text. Defaults to |
1048 | - * utf-8 for new format, iso-8859-1 for old format. |
|
1048 | + * utf-8 for new format, iso-8859-1 for old format. |
|
1049 | 1049 | * |
1050 | 1050 | * @return infolog_id of a matching entry or false, if nothing was found |
1051 | 1051 | */ |
@@ -1067,8 +1067,8 @@ discard block |
||
1067 | 1067 | * @param string $_type content type (eg.g text/plain) |
1068 | 1068 | * @param int $_noteID =-1 infolog_id of the entry |
1069 | 1069 | * @param string $charset The encoding charset for $text. Defaults to |
1070 | - * utf-8 for new format, iso-8859-1 for old format. |
|
1071 | - * |
|
1070 | + * utf-8 for new format, iso-8859-1 for old format. |
|
1071 | + * |
|
1072 | 1072 | * @return array infolog entry or false on error |
1073 | 1073 | */ |
1074 | 1074 | function vnotetoegw($_data, $_type, $_noteID=-1, $charset=null) |
@@ -23,39 +23,39 @@ discard block |
||
23 | 23 | * @var array $priority_egw2ical conversion of the priority egw => ical |
24 | 24 | */ |
25 | 25 | var $priority_egw2ical = array( |
26 | - 0 => 9, // low |
|
27 | - 1 => 5, // normal |
|
28 | - 2 => 3, // high |
|
29 | - 3 => 1, // urgent |
|
26 | + 0 => 9, // low |
|
27 | + 1 => 5, // normal |
|
28 | + 2 => 3, // high |
|
29 | + 3 => 1, // urgent |
|
30 | 30 | ); |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @var array $priority_ical2egw conversion of the priority ical => egw |
34 | 34 | */ |
35 | 35 | var $priority_ical2egw = array( |
36 | - 9 => 0, 8 => 0, 7 => 0, // low |
|
37 | - 6 => 1, 5 => 1, 4 => 1, 0 => 1, // normal |
|
38 | - 3 => 2, 2 => 2, // high |
|
39 | - 1 => 3, // urgent |
|
36 | + 9 => 0, 8 => 0, 7 => 0, // low |
|
37 | + 6 => 1, 5 => 1, 4 => 1, 0 => 1, // normal |
|
38 | + 3 => 2, 2 => 2, // high |
|
39 | + 1 => 3, // urgent |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @var array $priority_egw2funambol conversion of the priority egw => funambol |
44 | 44 | */ |
45 | 45 | var $priority_egw2funambol = array( |
46 | - 0 => 0, // low |
|
47 | - 1 => 1, // normal |
|
48 | - 2 => 2, // high |
|
49 | - 3 => 2, // urgent |
|
46 | + 0 => 0, // low |
|
47 | + 1 => 1, // normal |
|
48 | + 2 => 2, // high |
|
49 | + 3 => 2, // urgent |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @var array $priority_funambol2egw conversion of the priority funambol => egw |
54 | 54 | */ |
55 | 55 | var $priority_funambol2egw = array( |
56 | - 0 => 0, // low |
|
57 | - 1 => 1, // normal |
|
58 | - 2 => 3, // high |
|
56 | + 0 => 0, // low |
|
57 | + 1 => 1, // normal |
|
58 | + 2 => 3, // high |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @var boolean |
104 | 104 | */ |
105 | 105 | var $log = false; |
106 | - var $logfile="/tmp/log-infolog-vcal"; |
|
106 | + var $logfile = "/tmp/log-infolog-vcal"; |
|
107 | 107 | |
108 | 108 | |
109 | 109 | /** |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @param string $charset ='UTF-8' |
128 | 128 | * @return string|boolean string with vCal or false on error (eg. no permission to read the event) |
129 | 129 | */ |
130 | - function exportVCalendar(array $tasks, $_version='2.0', $_method=null, $charset='UTF-8') |
|
130 | + function exportVCalendar(array $tasks, $_version = '2.0', $_method = null, $charset = 'UTF-8') |
|
131 | 131 | { |
132 | 132 | $vcal = new Horde_Icalendar; |
133 | 133 | |
134 | - foreach($tasks as $task) |
|
134 | + foreach ($tasks as $task) |
|
135 | 135 | { |
136 | 136 | if (!$this->exportVTODO($task, $_version, $_method, $charset, $vcal)) |
137 | 137 | { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return string|boolean string with vCal or false on error (eg. no permission to read the event) |
154 | 154 | */ |
155 | - function exportVTODO($task, $_version='2.0',$_method='PUBLISH', $charset='UTF-8',Horde_Icalendar $vcal=null) |
|
155 | + function exportVTODO($task, $_version = '2.0', $_method = 'PUBLISH', $charset = 'UTF-8', Horde_Icalendar $vcal = null) |
|
156 | 156 | { |
157 | 157 | if (is_array($task)) |
158 | 158 | { |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | { |
178 | 178 | if (!preg_match('/\[UID:.+\]/m', $taskData['info_des'])) |
179 | 179 | { |
180 | - $taskData['info_des'] .= "\n[UID:" . $taskData['info_uid'] . "]"; |
|
180 | + $taskData['info_des'] .= "\n[UID:".$taskData['info_uid']."]"; |
|
181 | 181 | if ($taskData['info_id_parent'] != '') |
182 | 182 | { |
183 | - $taskData['info_des'] .= "\n[PARENT_UID:" . $taskData['info_id_parent'] . "]"; |
|
183 | + $taskData['info_des'] .= "\n[PARENT_UID:".$taskData['info_id_parent']."]"; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | |
197 | 197 | if ($this->log) |
198 | 198 | { |
199 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
200 | - array2string($taskData)."\n",3,$this->logfile); |
|
199 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
200 | + array2string($taskData)."\n", 3, $this->logfile); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | if (!isset($vcal)) $vcal = new Horde_Icalendar; |
204 | - $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
205 | - strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']),array(),false); |
|
206 | - $vcal->setAttribute('VERSION',$_version,array(),false); |
|
207 | - if ($_method) $vcal->setAttribute('METHOD',$_method,array(),false); |
|
204 | + $vcal->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
205 | + strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']), array(), false); |
|
206 | + $vcal->setAttribute('VERSION', $_version, array(), false); |
|
207 | + if ($_method) $vcal->setAttribute('METHOD', $_method, array(), false); |
|
208 | 208 | |
209 | 209 | $tzid = $this->tzid; |
210 | 210 | if ($tzid && $tzid != 'UTC') |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - $vevent = Horde_Icalendar::newComponent('VTODO',$vcal); |
|
225 | + $vevent = Horde_Icalendar::newComponent('VTODO', $vcal); |
|
226 | 226 | |
227 | 227 | if (!isset($this->clientProperties['SUMMARY']['Size'])) |
228 | 228 | { |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | $noTruncate = $this->clientProperties[$field]['NoTruncate']; |
248 | 248 | if ($this->log && $size > 0) |
249 | 249 | { |
250 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
251 | - "() $field Size: $size, NoTruncate: " . |
|
252 | - ($noTruncate ? 'TRUE' : 'FALSE') . "\n",3,$this->logfile); |
|
250 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
251 | + "() $field Size: $size, NoTruncate: ". |
|
252 | + ($noTruncate ? 'TRUE' : 'FALSE')."\n", 3, $this->logfile); |
|
253 | 253 | } |
254 | 254 | //Horde::logMessage("VTODO $field Size: $size, NoTruncate: " . |
255 | 255 | // ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | { |
267 | 267 | if ($this->log) |
268 | 268 | { |
269 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
270 | - "() $field omitted due to maximum size $size\n",3,$this->logfile); |
|
269 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
270 | + "() $field omitted due to maximum size $size\n", 3, $this->logfile); |
|
271 | 271 | } |
272 | 272 | //Horde::logMessage("VTODO $field omitted due to maximum size $size", |
273 | 273 | // __FILE__, __LINE__, PEAR_LOG_WARNING); |
274 | 274 | continue; // skip field |
275 | 275 | } |
276 | 276 | // truncate the value to size |
277 | - $value = substr($value, 0, $size -1); |
|
277 | + $value = substr($value, 0, $size - 1); |
|
278 | 278 | if ($this->log) |
279 | 279 | { |
280 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . |
|
281 | - "() $field truncated to maximum size $size\n",3,$this->logfile); |
|
280 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
|
281 | + "() $field truncated to maximum size $size\n", 3, $this->logfile); |
|
282 | 282 | } |
283 | 283 | //Horde::logMessage("VTODO $field truncated to maximum size $size", |
284 | 284 | // __FILE__, __LINE__, PEAR_LOG_INFO); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | if ($_version == '1.0' && preg_match('/[^\x20-\x7F]/', $value)) |
299 | 299 | { |
300 | - $options['CHARSET'] = $charset; |
|
300 | + $options['CHARSET'] = $charset; |
|
301 | 301 | switch ($this->productManufacturer) |
302 | 302 | { |
303 | 303 | case 'groupdav': |
@@ -340,23 +340,23 @@ discard block |
||
340 | 340 | self::setDateOrTime($vevent, 'COMPLETED', $taskData['info_datecompleted'], $tzid); |
341 | 341 | } |
342 | 342 | |
343 | - $vevent->setAttribute('DTSTAMP',time()); |
|
343 | + $vevent->setAttribute('DTSTAMP', time()); |
|
344 | 344 | $vevent->setAttribute('CREATED', $taskData['info_created']); |
345 | 345 | $vevent->setAttribute('LAST-MODIFIED', $taskData['info_datemodified']); |
346 | - $vevent->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE'); |
|
347 | - $vevent->setAttribute('STATUS',$this->status2vtodo($taskData['info_status'])); |
|
346 | + $vevent->setAttribute('CLASS', $taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE'); |
|
347 | + $vevent->setAttribute('STATUS', $this->status2vtodo($taskData['info_status'])); |
|
348 | 348 | // we try to preserv the original infolog status as X-INFOLOG-STATUS, so we can restore it, if the user does not modify STATUS |
349 | - $vevent->setAttribute('X-INFOLOG-STATUS',$taskData['info_status']); |
|
350 | - $vevent->setAttribute('PERCENT-COMPLETE',$taskData['info_percent']); |
|
349 | + $vevent->setAttribute('X-INFOLOG-STATUS', $taskData['info_status']); |
|
350 | + $vevent->setAttribute('PERCENT-COMPLETE', $taskData['info_percent']); |
|
351 | 351 | if ($this->productManufacturer == 'funambol' && |
352 | 352 | (strpos($this->productName, 'outlook') !== false |
353 | 353 | || strpos($this->productName, 'pocket pc') !== false)) |
354 | 354 | { |
355 | - $priority = (int) $this->priority_egw2funambol[$taskData['info_priority']]; |
|
355 | + $priority = (int)$this->priority_egw2funambol[$taskData['info_priority']]; |
|
356 | 356 | } |
357 | 357 | else |
358 | 358 | { |
359 | - $priority = (int) $this->priority_egw2ical[$taskData['info_priority']]; |
|
359 | + $priority = (int)$this->priority_egw2ical[$taskData['info_priority']]; |
|
360 | 360 | } |
361 | 361 | $vevent->setAttribute('PRIORITY', $priority); |
362 | 362 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | (count($taskData['info_responsible']) > 1 || |
366 | 366 | $taskData['info_responsible'][0] != $taskData['info_onwer'])) |
367 | 367 | { |
368 | - if (($url = $GLOBALS['egw']->accounts->id2name($taskData['info_owner'],'account_email'))) |
|
368 | + if (($url = $GLOBALS['egw']->accounts->id2name($taskData['info_owner'], 'account_email'))) |
|
369 | 369 | { |
370 | 370 | $url = 'MAILTO:'.$url; |
371 | 371 | } |
@@ -373,13 +373,13 @@ discard block |
||
373 | 373 | { |
374 | 374 | $url = 'urn:uuid:'.Api\CalDAV::generate_uid('accounts', $taskData['info_owner']); |
375 | 375 | } |
376 | - $vevent->setAttribute('ORGANIZER',$url,array( |
|
377 | - 'CN' => $GLOBALS['egw']->accounts->id2name($taskData['info_owner'],'account_fullname'), |
|
376 | + $vevent->setAttribute('ORGANIZER', $url, array( |
|
377 | + 'CN' => $GLOBALS['egw']->accounts->id2name($taskData['info_owner'], 'account_fullname'), |
|
378 | 378 | 'X-EGROUPWARE-UID' => $taskData['info_owner'], |
379 | 379 | ), true); |
380 | - foreach($taskData['info_responsible'] as $responsible) |
|
380 | + foreach ($taskData['info_responsible'] as $responsible) |
|
381 | 381 | { |
382 | - if (($url = $GLOBALS['egw']->accounts->id2name($responsible,'account_email'))) |
|
382 | + if (($url = $GLOBALS['egw']->accounts->id2name($responsible, 'account_email'))) |
|
383 | 383 | { |
384 | 384 | $url = 'MAILTO:'.$url; |
385 | 385 | } |
@@ -389,15 +389,15 @@ discard block |
||
389 | 389 | } |
390 | 390 | if ($responsible > 0) |
391 | 391 | { |
392 | - $vevent->setAttribute('ATTENDEE',$url,array( |
|
393 | - 'CN' => $GLOBALS['egw']->accounts->id2name($responsible,'account_fullname'), |
|
392 | + $vevent->setAttribute('ATTENDEE', $url, array( |
|
393 | + 'CN' => $GLOBALS['egw']->accounts->id2name($responsible, 'account_fullname'), |
|
394 | 394 | 'CUTYPE' => 'INDIVIDUAL', |
395 | 395 | 'X-EGROUPWARE-UID' => $responsible, |
396 | 396 | ), true); |
397 | 397 | } |
398 | 398 | elseif ($responsible < 0) |
399 | 399 | { |
400 | - $vevent->setAttribute('ATTENDEE',$url,array( |
|
400 | + $vevent->setAttribute('ATTENDEE', $url, array( |
|
401 | 401 | 'CN' => $GLOBALS['egw']->accounts->id2name($responsible), |
402 | 402 | 'CUTYPE' => 'GROUP', |
403 | 403 | 'X-EGROUPWARE-UID' => $responsible, |
@@ -408,17 +408,17 @@ discard block |
||
408 | 408 | // for CalDAV add all X-Properties previously parsed |
409 | 409 | if ($this->productManufacturer == 'groupdav') |
410 | 410 | { |
411 | - foreach($taskData as $name => $value) |
|
411 | + foreach ($taskData as $name => $value) |
|
412 | 412 | { |
413 | 413 | if (substr($name, 0, 2) == '##') |
414 | 414 | { |
415 | 415 | if ($name[2] == ':') |
416 | 416 | { |
417 | 417 | if (($v = json_php_unserialize($value)) && is_array($v)) $value = $v; |
418 | - foreach((array)$value as $compvData) |
|
418 | + foreach ((array)$value as $compvData) |
|
419 | 419 | { |
420 | - $comp = Horde_Icalendar::newComponent(substr($name,3), $vevent); |
|
421 | - $comp->parsevCalendar($compvData,substr($name,3)); |
|
420 | + $comp = Horde_Icalendar::newComponent(substr($name, 3), $vevent); |
|
421 | + $comp->parsevCalendar($compvData, substr($name, 3)); |
|
422 | 422 | $vevent->addComponent($comp); |
423 | 423 | } |
424 | 424 | } |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | $retval = $vcal->exportvCalendar(); |
439 | 439 | if ($this->log) |
440 | 440 | { |
441 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
442 | - array2string($retval)."\n",3,$this->logfile); |
|
441 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
442 | + array2string($retval)."\n", 3, $this->logfile); |
|
443 | 443 | } |
444 | 444 | // Horde::logMessage("exportVTODO:\n" . print_r($retval, true), |
445 | 445 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | } |
469 | 469 | $tz = self::$tz_cache[$tzid]; |
470 | 470 | } |
471 | - elseif(is_null($tzid)) |
|
471 | + elseif (is_null($tzid)) |
|
472 | 472 | { |
473 | 473 | $tz = Api\DateTime::$user_timezone; |
474 | 474 | } |
@@ -476,9 +476,9 @@ discard block |
||
476 | 476 | { |
477 | 477 | $tz = Api\DateTime::$server_timezone; |
478 | 478 | } |
479 | - if (!is_a($time,'DateTime')) |
|
479 | + if (!is_a($time, 'DateTime')) |
|
480 | 480 | { |
481 | - $time = new Api\DateTime($time,Api\DateTime::$server_timezone); |
|
481 | + $time = new Api\DateTime($time, Api\DateTime::$server_timezone); |
|
482 | 482 | } |
483 | 483 | $time->setTimezone($tz); |
484 | 484 | |
@@ -527,24 +527,24 @@ discard block |
||
527 | 527 | * signature array callback($task, $param1, ...) |
528 | 528 | * @return int|boolean integer info_id or false on error |
529 | 529 | */ |
530 | - function importVTODO(&$_vcalData, $_taskID=-1, $merge=false, $user=null, $charset=null, $caldav_name=null, |
|
531 | - array $callback_data=null) |
|
530 | + function importVTODO(&$_vcalData, $_taskID = -1, $merge = false, $user = null, $charset = null, $caldav_name = null, |
|
531 | + array $callback_data = null) |
|
532 | 532 | { |
533 | - unset($merge); // no longer used, but required by function signature |
|
533 | + unset($merge); // no longer used, but required by function signature |
|
534 | 534 | |
535 | 535 | if ($this->tzid) |
536 | 536 | { |
537 | 537 | date_default_timezone_set($this->tzid); |
538 | 538 | } |
539 | - $taskData = $this->vtodotoegw($_vcalData,$_taskID, $charset); |
|
539 | + $taskData = $this->vtodotoegw($_vcalData, $_taskID, $charset); |
|
540 | 540 | if ($this->tzid) |
541 | 541 | { |
542 | 542 | date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); |
543 | 543 | } |
544 | 544 | |
545 | - if($this->entry_callback && is_callable($this->entry_callback)) |
|
545 | + if ($this->entry_callback && is_callable($this->entry_callback)) |
|
546 | 546 | { |
547 | - if(!call_user_func_array($this->entry_callback, array(&$taskData))) |
|
547 | + if (!call_user_func_array($this->entry_callback, array(&$taskData))) |
|
548 | 548 | { |
549 | 549 | // Callback cancelled entry |
550 | 550 | return false; |
@@ -575,8 +575,8 @@ discard block |
||
575 | 575 | |
576 | 576 | if ($this->log) |
577 | 577 | { |
578 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
579 | - array2string($taskData)."\n",3,$this->logfile); |
|
578 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
579 | + array2string($taskData)."\n", 3, $this->logfile); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | if ($caldav_name) |
@@ -585,18 +585,18 @@ discard block |
||
585 | 585 | } |
586 | 586 | |
587 | 587 | // make sure not to empty fields not supported by iCal or not allowed to change by CalDAV |
588 | - if ($_taskID > 0 && ($old = $this->read($_taskID,true,'server'))) |
|
588 | + if ($_taskID > 0 && ($old = $this->read($_taskID, true, 'server'))) |
|
589 | 589 | { |
590 | 590 | // remove all values supported by iCal standard |
591 | 591 | $old = array_diff_key($old, array_flip(array( |
592 | - 'info_subject','info_des','info_location','info_cat','info_responsible', |
|
593 | - 'info_startdate','info_enddate','info_priority','info_location', |
|
594 | - 'info_access','info_status','info_percent','info_datecompleted', |
|
592 | + 'info_subject', 'info_des', 'info_location', 'info_cat', 'info_responsible', |
|
593 | + 'info_startdate', 'info_enddate', 'info_priority', 'info_location', |
|
594 | + 'info_access', 'info_status', 'info_percent', 'info_datecompleted', |
|
595 | 595 | ))); |
596 | 596 | // remove all iCal fields not supported by EGroupware (stored like custom fields) |
597 | - foreach(array_keys($old) as $name) |
|
597 | + foreach (array_keys($old) as $name) |
|
598 | 598 | { |
599 | - if (substr($name,0,2) == '##') unset($old[$name]); |
|
599 | + if (substr($name, 0, 2) == '##') unset($old[$name]); |
|
600 | 600 | } |
601 | 601 | // merge in again all infolog fields not supported by iCal or not allowed to change |
602 | 602 | $taskData = array_merge($taskData, $old); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @return array of infolog_ids of matching entries |
623 | 623 | */ |
624 | - function searchVTODO($_vcalData, $contentID=null, $relax=false, $charset=null) |
|
624 | + function searchVTODO($_vcalData, $contentID = null, $relax = false, $charset = null) |
|
625 | 625 | { |
626 | 626 | $result = array(); |
627 | 627 | |
@@ -666,12 +666,12 @@ discard block |
||
666 | 666 | * |
667 | 667 | * @return array infolog entry or false on error |
668 | 668 | */ |
669 | - function vtodotoegw($_vcalData, $_taskID=-1, $charset=null) |
|
669 | + function vtodotoegw($_vcalData, $_taskID = -1, $charset = null) |
|
670 | 670 | { |
671 | 671 | if ($this->log) |
672 | 672 | { |
673 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n" . |
|
674 | - array2string($_vcalData)."\n",3,$this->logfile); |
|
673 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n". |
|
674 | + array2string($_vcalData)."\n", 3, $this->logfile); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | $vcal = new Horde_Icalendar; |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | if ($this->log) |
685 | 685 | { |
686 | 686 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
687 | - "(): No vCalendar Container found!\n",3,$this->logfile); |
|
687 | + "(): No vCalendar Container found!\n", 3, $this->logfile); |
|
688 | 688 | } |
689 | 689 | return false; |
690 | 690 | } |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | if ($this->log) |
708 | 708 | { |
709 | 709 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
710 | - "(): Not a vTODO container, skipping...\n",3,$this->logfile); |
|
710 | + "(): Not a vTODO container, skipping...\n", 3, $this->logfile); |
|
711 | 711 | } |
712 | 712 | continue; |
713 | 713 | } |
@@ -734,24 +734,23 @@ discard block |
||
734 | 734 | ($this->_status2vtodo[$x_infolog_status] === 'COMPLETED') != is_scalar($completed)) |
735 | 735 | { |
736 | 736 | $percent_completed = $component->getAttributeDefault('PERCENT-COMPLETE', null); |
737 | - $status = $completed && is_scalar($completed) ? 'COMPLETED' : |
|
738 | - ($percent_completed && is_scalar($percent_completed) && $percent_completed > 0 ? 'IN-PROCESS' : 'NEEDS-ACTION'); |
|
737 | + $status = $completed && is_scalar($completed) ? 'COMPLETED' : ($percent_completed && is_scalar($percent_completed) && $percent_completed > 0 ? 'IN-PROCESS' : 'NEEDS-ACTION'); |
|
739 | 738 | $component->setAttribute('STATUS', $status); |
740 | 739 | if (!is_scalar($percent_completed)) |
741 | 740 | { |
742 | 741 | $component->setAttribute('PERCENT-COMPLETE', $percent_completed = $status == 'COMPLETED' ? |
743 | 742 | 100 : ($status == 'NEEDS-ACTION' ? 0 : 10)); |
744 | 743 | } |
745 | - if ($this->log) error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n",3,$this->logfile); |
|
744 | + if ($this->log) error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n", 3, $this->logfile); |
|
746 | 745 | } |
747 | 746 | // new task without status --> set a default status of NEEDS-ACTION, as otherwise task is marked closed |
748 | - elseif($_taskID <= 0 && !is_scalar($x_infolog_status) && !is_scalar($completed)) |
|
747 | + elseif ($_taskID <= 0 && !is_scalar($x_infolog_status) && !is_scalar($completed)) |
|
749 | 748 | { |
750 | 749 | $component->setAttribute('STATUS', 'NEEDS-ACTION'); |
751 | 750 | } |
752 | 751 | else |
753 | 752 | { |
754 | - if ($this->log) error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed)?'='.$completed:' not set')." --> leaving status and percent unchanged",3,$this->logfile); |
|
753 | + if ($this->log) error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed) ? '='.$completed : ' not set')." --> leaving status and percent unchanged", 3, $this->logfile); |
|
755 | 754 | } |
756 | 755 | } |
757 | 756 | foreach ($component->getAllAttributes() as $attribute) |
@@ -795,7 +794,7 @@ discard block |
||
795 | 794 | case 'DURATION': |
796 | 795 | if (!isset($taskData['info_startdate'])) |
797 | 796 | { |
798 | - $taskData['info_startdate'] = $component->getAttributeDefault('DTSTART', null); |
|
797 | + $taskData['info_startdate'] = $component->getAttributeDefault('DTSTART', null); |
|
799 | 798 | } |
800 | 799 | $attribute['value'] += $taskData['info_startdate']; |
801 | 800 | $taskData['##DURATION'] = $attribute['value']; |
@@ -807,11 +806,11 @@ discard block |
||
807 | 806 | break; |
808 | 807 | |
809 | 808 | case 'COMPLETED': |
810 | - $taskData['info_datecompleted'] = self::date2ts($attribute['value']); |
|
809 | + $taskData['info_datecompleted'] = self::date2ts($attribute['value']); |
|
811 | 810 | break; |
812 | 811 | |
813 | 812 | case 'DTSTART': |
814 | - $taskData['info_startdate'] = self::date2ts($attribute['value']); |
|
813 | + $taskData['info_startdate'] = self::date2ts($attribute['value']); |
|
815 | 814 | break; |
816 | 815 | |
817 | 816 | case 'PRIORITY': |
@@ -821,16 +820,16 @@ discard block |
||
821 | 820 | (strpos($this->productName, 'outlook') !== false |
822 | 821 | || strpos($this->productName, 'pocket pc') !== false)) |
823 | 822 | { |
824 | - $taskData['info_priority'] = (int) $this->priority_funambol2egw[$attribute['value']]; |
|
823 | + $taskData['info_priority'] = (int)$this->priority_funambol2egw[$attribute['value']]; |
|
825 | 824 | } |
826 | 825 | else |
827 | 826 | { |
828 | - $taskData['info_priority'] = (int) $this->priority_ical2egw[$attribute['value']]; |
|
827 | + $taskData['info_priority'] = (int)$this->priority_ical2egw[$attribute['value']]; |
|
829 | 828 | } |
830 | 829 | } |
831 | 830 | else |
832 | 831 | { |
833 | - $taskData['info_priority'] = 1; // default = normal |
|
832 | + $taskData['info_priority'] = 1; // default = normal |
|
834 | 833 | } |
835 | 834 | break; |
836 | 835 | |
@@ -853,7 +852,7 @@ discard block |
||
853 | 852 | case 'CATEGORIES': |
854 | 853 | if (!empty($attribute['value'])) |
855 | 854 | { |
856 | - $cats = $this->find_or_add_categories(explode(',',$attribute['value']), $_taskID); |
|
855 | + $cats = $this->find_or_add_categories(explode(',', $attribute['value']), $_taskID); |
|
857 | 856 | $taskData['info_cat'] = $cats[0]; |
858 | 857 | } |
859 | 858 | break; |
@@ -866,7 +865,7 @@ discard block |
||
866 | 865 | break; |
867 | 866 | |
868 | 867 | case 'PERCENT-COMPLETE': |
869 | - $taskData['info_percent'] = (int) $attribute['value']; |
|
868 | + $taskData['info_percent'] = (int)$attribute['value']; |
|
870 | 869 | break; |
871 | 870 | |
872 | 871 | case 'ATTENDEE': |
@@ -915,10 +914,10 @@ discard block |
||
915 | 914 | break; |
916 | 915 | } |
917 | 916 | // store included, but unsupported components like valarm as x-properties |
918 | - foreach($component->getComponents() as $comp) |
|
917 | + foreach ($component->getComponents() as $comp) |
|
919 | 918 | { |
920 | 919 | $name = '##:'.strtoupper($comp->getType()); |
921 | - $compvData = $comp->exportvCalendar($comp,'utf-8'); |
|
920 | + $compvData = $comp->exportvCalendar($comp, 'utf-8'); |
|
922 | 921 | if (isset($taskData[$name])) |
923 | 922 | { |
924 | 923 | $taskData[$name] = array($taskData[$name]); |
@@ -931,8 +930,8 @@ discard block |
||
931 | 930 | } |
932 | 931 | if ($this->log) |
933 | 932 | { |
934 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n" . |
|
935 | - ($taskData ? array2string($taskData) : 'FALSE') . "\n",3,$this->logfile); |
|
933 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n". |
|
934 | + ($taskData ? array2string($taskData) : 'FALSE')."\n", 3, $this->logfile); |
|
936 | 935 | } |
937 | 936 | return $taskData; |
938 | 937 | } |
@@ -946,14 +945,14 @@ discard block |
||
946 | 945 | * |
947 | 946 | * @return string|boolean VNOTE representation of the infolog entry or false on error |
948 | 947 | */ |
949 | - function exportVNOTE($_noteID, $_type, $charset='UTF-8') |
|
948 | + function exportVNOTE($_noteID, $_type, $charset = 'UTF-8') |
|
950 | 949 | { |
951 | - if(!($note = $this->read($_noteID, true, 'server'))) return false; |
|
950 | + if (!($note = $this->read($_noteID, true, 'server'))) return false; |
|
952 | 951 | |
953 | 952 | $note = Api\Translation::convert($note, |
954 | 953 | Api\Translation::charset(), $charset); |
955 | 954 | |
956 | - switch ($_type) |
|
955 | + switch ($_type) |
|
957 | 956 | { |
958 | 957 | case 'text/plain': |
959 | 958 | $txt = $note['info_subject']."\n\n".$note['info_des']; |
@@ -967,10 +966,10 @@ discard block |
||
967 | 966 | Api\Translation::charset(), $charset); |
968 | 967 | } |
969 | 968 | $vnote = new Horde_Icalendar_Vnote(); |
970 | - $vnote->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
969 | + $vnote->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
|
971 | 970 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
972 | 971 | $vnote->setAttribute('VERSION', '1.1'); |
973 | - foreach (array( 'SUMMARY' => $note['info_subject'], |
|
972 | + foreach (array('SUMMARY' => $note['info_subject'], |
|
974 | 973 | 'BODY' => $note['info_des'], |
975 | 974 | 'CATEGORIES' => $note['info_cat'], |
976 | 975 | ) as $field => $value) |
@@ -978,7 +977,7 @@ discard block |
||
978 | 977 | $options = array(); |
979 | 978 | if (preg_match('/[^\x20-\x7F]/', $value)) |
980 | 979 | { |
981 | - $options['CHARSET'] = $charset; |
|
980 | + $options['CHARSET'] = $charset; |
|
982 | 981 | switch ($this->productManufacturer) |
983 | 982 | { |
984 | 983 | case 'groupdav': |
@@ -1008,21 +1007,21 @@ discard block |
||
1008 | 1007 | } |
1009 | 1008 | if ($note['info_startdate']) |
1010 | 1009 | { |
1011 | - $vnote->setAttribute('CREATED',$note['info_startdate']); |
|
1010 | + $vnote->setAttribute('CREATED', $note['info_startdate']); |
|
1012 | 1011 | } |
1013 | 1012 | else |
1014 | 1013 | { |
1015 | - $vnote->setAttribute('CREATED',$GLOBALS['egw']->contenthistory->getTSforAction('infolog_note',$_noteID,'add')); |
|
1014 | + $vnote->setAttribute('CREATED', $GLOBALS['egw']->contenthistory->getTSforAction('infolog_note', $_noteID, 'add')); |
|
1016 | 1015 | } |
1017 | - $vnote->setAttribute('LAST-MODIFIED',$GLOBALS['egw']->contenthistory->getTSforAction('infolog_note',$_noteID,'modify')); |
|
1016 | + $vnote->setAttribute('LAST-MODIFIED', $GLOBALS['egw']->contenthistory->getTSforAction('infolog_note', $_noteID, 'modify')); |
|
1018 | 1017 | |
1019 | 1018 | #$vnote->setAttribute('CLASS',$taskData['info_access'] == 'public' ? 'PUBLIC' : 'PRIVATE'); |
1020 | 1019 | |
1021 | 1020 | $retval = $vnote->exportvCalendar(); |
1022 | 1021 | if ($this->log) |
1023 | 1022 | { |
1024 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
1025 | - array2string($retval)."\n",3,$this->logfile); |
|
1023 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
1024 | + array2string($retval)."\n", 3, $this->logfile); |
|
1026 | 1025 | } |
1027 | 1026 | return $retval; |
1028 | 1027 | } |
@@ -1041,25 +1040,25 @@ discard block |
||
1041 | 1040 | * |
1042 | 1041 | * @return int|boolean integer info_id or false on error |
1043 | 1042 | */ |
1044 | - function importVNOTE(&$_vcalData, $_type, $_noteID=-1, $merge=false, $charset=null) |
|
1043 | + function importVNOTE(&$_vcalData, $_type, $_noteID = -1, $merge = false, $charset = null) |
|
1045 | 1044 | { |
1046 | - unset($merge); // no longer used, but required by function signature |
|
1045 | + unset($merge); // no longer used, but required by function signature |
|
1047 | 1046 | if ($this->log) |
1048 | 1047 | { |
1049 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
1050 | - array2string($_vcalData)."\n",3,$this->logfile); |
|
1048 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
1049 | + array2string($_vcalData)."\n", 3, $this->logfile); |
|
1051 | 1050 | } |
1052 | 1051 | |
1053 | 1052 | if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID, $charset))) return false; |
1054 | 1053 | |
1055 | - if($_noteID > 0) $note['info_id'] = $_noteID; |
|
1054 | + if ($_noteID > 0) $note['info_id'] = $_noteID; |
|
1056 | 1055 | |
1057 | 1056 | if (empty($note['info_status'])) $note['info_status'] = 'done'; |
1058 | 1057 | |
1059 | 1058 | if ($this->log) |
1060 | 1059 | { |
1061 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" . |
|
1062 | - array2string($note)."\n",3,$this->logfile); |
|
1060 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n". |
|
1061 | + array2string($note)."\n", 3, $this->logfile); |
|
1063 | 1062 | } |
1064 | 1063 | |
1065 | 1064 | return $this->write($note, true, true, false); |
@@ -1076,7 +1075,7 @@ discard block |
||
1076 | 1075 | * |
1077 | 1076 | * @return infolog_id of a matching entry or false, if nothing was found |
1078 | 1077 | */ |
1079 | - function searchVNOTE($_vcalData, $_type, $contentID=null, $relax=false, $charset=null) |
|
1078 | + function searchVNOTE($_vcalData, $_type, $contentID = null, $relax = false, $charset = null) |
|
1080 | 1079 | { |
1081 | 1080 | if (!($note = $this->vnotetoegw($_vcalData, $_type, $contentID, $charset))) return array(); |
1082 | 1081 | |
@@ -1098,12 +1097,12 @@ discard block |
||
1098 | 1097 | * |
1099 | 1098 | * @return array infolog entry or false on error |
1100 | 1099 | */ |
1101 | - function vnotetoegw($_data, $_type, $_noteID=-1, $charset=null) |
|
1100 | + function vnotetoegw($_data, $_type, $_noteID = -1, $charset = null) |
|
1102 | 1101 | { |
1103 | 1102 | if ($this->log) |
1104 | 1103 | { |
1105 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n" . |
|
1106 | - array2string($_data)."\n",3,$this->logfile); |
|
1104 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n". |
|
1105 | + array2string($_data)."\n", 3, $this->logfile); |
|
1107 | 1106 | } |
1108 | 1107 | $note = false; |
1109 | 1108 | |
@@ -1157,7 +1156,7 @@ discard block |
||
1157 | 1156 | case 'CATEGORIES': |
1158 | 1157 | if ($attribute['value']) |
1159 | 1158 | { |
1160 | - $cats = $this->find_or_add_categories(explode(',',$attribute['value']), $_noteID); |
|
1159 | + $cats = $this->find_or_add_categories(explode(',', $attribute['value']), $_noteID); |
|
1161 | 1160 | $note['info_cat'] = $cats[0]; |
1162 | 1161 | } |
1163 | 1162 | break; |
@@ -1168,8 +1167,8 @@ discard block |
||
1168 | 1167 | } |
1169 | 1168 | if ($this->log) |
1170 | 1169 | { |
1171 | - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n" . |
|
1172 | - ($note ? array2string($note) : 'FALSE') ."\n",3,$this->logfile); |
|
1170 | + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_type, $_noteID)\n". |
|
1171 | + ($note ? array2string($note) : 'FALSE')."\n", 3, $this->logfile); |
|
1173 | 1172 | } |
1174 | 1173 | return $note; |
1175 | 1174 | } |
@@ -1182,7 +1181,7 @@ discard block |
||
1182 | 1181 | * @param string $_productManufacturer |
1183 | 1182 | * @param string $_productName |
1184 | 1183 | */ |
1185 | - function setSupportedFields($_productManufacturer='', $_productName='') |
|
1184 | + function setSupportedFields($_productManufacturer = '', $_productName = '') |
|
1186 | 1185 | { |
1187 | 1186 | $state = &$_SESSION['SyncML.state']; |
1188 | 1187 | if (isset($state)) |
@@ -1234,10 +1233,10 @@ discard block |
||
1234 | 1233 | if ($this->log) |
1235 | 1234 | { |
1236 | 1235 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. |
1237 | - '(' . $this->productManufacturer . |
|
1238 | - ', '. $this->productName .', ' . |
|
1239 | - ($this->tzid ? $this->tzid : Api\DateTime::$user_timezone->getName()) . |
|
1240 | - ")\n" , 3, $this->logfile); |
|
1236 | + '('.$this->productManufacturer. |
|
1237 | + ', '.$this->productName.', '. |
|
1238 | + ($this->tzid ? $this->tzid : Api\DateTime::$user_timezone->getName()). |
|
1239 | + ")\n", 3, $this->logfile); |
|
1241 | 1240 | } |
1242 | 1241 | |
1243 | 1242 | //Horde::logMessage('setSupportedFields(' . $this->productManufacturer . ', ' |
@@ -114,7 +114,10 @@ discard block |
||
114 | 114 | function __construct(&$_clientProperties = array()) |
115 | 115 | { |
116 | 116 | parent::__construct(); |
117 | - if ($this->log) $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-infolog-vcal"; |
|
117 | + if ($this->log) |
|
118 | + { |
|
119 | + $this->logfile = $GLOBALS['egw_info']['server']['temp_dir']."/log-infolog-vcal"; |
|
120 | + } |
|
118 | 121 | $this->clientProperties = $_clientProperties; |
119 | 122 | } |
120 | 123 | |
@@ -160,7 +163,10 @@ discard block |
||
160 | 163 | } |
161 | 164 | else |
162 | 165 | { |
163 | - if (!($taskData = $this->read($task, true, 'server'))) return false; |
|
166 | + if (!($taskData = $this->read($task, true, 'server'))) |
|
167 | + { |
|
168 | + return false; |
|
169 | + } |
|
164 | 170 | } |
165 | 171 | |
166 | 172 | if ($taskData['info_id_parent']) |
@@ -200,11 +206,17 @@ discard block |
||
200 | 206 | array2string($taskData)."\n",3,$this->logfile); |
201 | 207 | } |
202 | 208 | |
203 | - if (!isset($vcal)) $vcal = new Horde_Icalendar; |
|
209 | + if (!isset($vcal)) |
|
210 | + { |
|
211 | + $vcal = new Horde_Icalendar; |
|
212 | + } |
|
204 | 213 | $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware InfoLog '.$GLOBALS['egw_info']['apps']['infolog']['version'].'//'. |
205 | 214 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']),array(),false); |
206 | 215 | $vcal->setAttribute('VERSION',$_version,array(),false); |
207 | - if ($_method) $vcal->setAttribute('METHOD',$_method,array(),false); |
|
216 | + if ($_method) |
|
217 | + { |
|
218 | + $vcal->setAttribute('METHOD',$_method,array(),false); |
|
219 | + } |
|
208 | 220 | |
209 | 221 | $tzid = $this->tzid; |
210 | 222 | if ($tzid && $tzid != 'UTC') |
@@ -284,7 +296,10 @@ discard block |
||
284 | 296 | // __FILE__, __LINE__, PEAR_LOG_INFO); |
285 | 297 | } |
286 | 298 | |
287 | - if (empty($value) && ($size < 0 || $noTruncate)) continue; |
|
299 | + if (empty($value) && ($size < 0 || $noTruncate)) |
|
300 | + { |
|
301 | + continue; |
|
302 | + } |
|
288 | 303 | |
289 | 304 | if ($field == 'RELATED-TO') |
290 | 305 | { |
@@ -414,7 +429,10 @@ discard block |
||
414 | 429 | { |
415 | 430 | if ($name[2] == ':') |
416 | 431 | { |
417 | - if (($v = json_php_unserialize($value)) && is_array($v)) $value = $v; |
|
432 | + if (($v = json_php_unserialize($value)) && is_array($v)) |
|
433 | + { |
|
434 | + $value = $v; |
|
435 | + } |
|
418 | 436 | foreach((array)$value as $compvData) |
419 | 437 | { |
420 | 438 | $comp = Horde_Icalendar::newComponent(substr($name,3), $vevent); |
@@ -550,7 +568,10 @@ discard block |
||
550 | 568 | return false; |
551 | 569 | } |
552 | 570 | } |
553 | - if (!$taskData) return false; |
|
571 | + if (!$taskData) |
|
572 | + { |
|
573 | + return false; |
|
574 | + } |
|
554 | 575 | |
555 | 576 | // keep the dates |
556 | 577 | $this->time2time($taskData, $this->tzid, false); |
@@ -596,7 +617,10 @@ discard block |
||
596 | 617 | // remove all iCal fields not supported by EGroupware (stored like custom fields) |
597 | 618 | foreach(array_keys($old) as $name) |
598 | 619 | { |
599 | - if (substr($name,0,2) == '##') unset($old[$name]); |
|
620 | + if (substr($name,0,2) == '##') |
|
621 | + { |
|
622 | + unset($old[$name]); |
|
623 | + } |
|
600 | 624 | } |
601 | 625 | // merge in again all infolog fields not supported by iCal or not allowed to change |
602 | 626 | $taskData = array_merge($taskData, $old); |
@@ -742,7 +766,10 @@ discard block |
||
742 | 766 | $component->setAttribute('PERCENT-COMPLETE', $percent_completed = $status == 'COMPLETED' ? |
743 | 767 | 100 : ($status == 'NEEDS-ACTION' ? 0 : 10)); |
744 | 768 | } |
745 | - if ($this->log) error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n",3,$this->logfile); |
|
769 | + if ($this->log) |
|
770 | + { |
|
771 | + error_log(__METHOD__."() setting STATUS='$status' and PERCENT-COMPLETE=$percent_completed from COMPLETED and X-INFOLOG-STATUS='$x_infolog_status'\n",3,$this->logfile); |
|
772 | + } |
|
746 | 773 | } |
747 | 774 | // new task without status --> set a default status of NEEDS-ACTION, as otherwise task is marked closed |
748 | 775 | elseif($_taskID <= 0 && !is_scalar($x_infolog_status) && !is_scalar($completed)) |
@@ -751,12 +778,18 @@ discard block |
||
751 | 778 | } |
752 | 779 | else |
753 | 780 | { |
754 | - if ($this->log) error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed)?'='.$completed:' not set')." --> leaving status and percent unchanged",3,$this->logfile); |
|
781 | + if ($this->log) |
|
782 | + { |
|
783 | + error_log(__METHOD__."() no STATUS, X-INFOLOG-STATUS='$x_infolog_status', COMPLETED".(is_scalar($completed)?'='.$completed:' not set')." --> leaving status and percent unchanged",3,$this->logfile); |
|
784 | + } |
|
755 | 785 | } |
756 | 786 | } |
757 | 787 | foreach ($component->getAllAttributes() as $attribute) |
758 | 788 | { |
759 | - if (!$attribute['value'] && $attribute['value'] !== '0') continue; |
|
789 | + if (!$attribute['value'] && $attribute['value'] !== '0') |
|
790 | + { |
|
791 | + continue; |
|
792 | + } |
|
760 | 793 | |
761 | 794 | switch ($attribute['name']) |
762 | 795 | { |
@@ -948,7 +981,10 @@ discard block |
||
948 | 981 | */ |
949 | 982 | function exportVNOTE($_noteID, $_type, $charset='UTF-8') |
950 | 983 | { |
951 | - if(!($note = $this->read($_noteID, true, 'server'))) return false; |
|
984 | + if(!($note = $this->read($_noteID, true, 'server'))) |
|
985 | + { |
|
986 | + return false; |
|
987 | + } |
|
952 | 988 | |
953 | 989 | $note = Api\Translation::convert($note, |
954 | 990 | Api\Translation::charset(), $charset); |
@@ -1050,11 +1086,20 @@ discard block |
||
1050 | 1086 | array2string($_vcalData)."\n",3,$this->logfile); |
1051 | 1087 | } |
1052 | 1088 | |
1053 | - if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID, $charset))) return false; |
|
1089 | + if (!($note = $this->vnotetoegw($_vcalData, $_type, $_noteID, $charset))) |
|
1090 | + { |
|
1091 | + return false; |
|
1092 | + } |
|
1054 | 1093 | |
1055 | - if($_noteID > 0) $note['info_id'] = $_noteID; |
|
1094 | + if($_noteID > 0) |
|
1095 | + { |
|
1096 | + $note['info_id'] = $_noteID; |
|
1097 | + } |
|
1056 | 1098 | |
1057 | - if (empty($note['info_status'])) $note['info_status'] = 'done'; |
|
1099 | + if (empty($note['info_status'])) |
|
1100 | + { |
|
1101 | + $note['info_status'] = 'done'; |
|
1102 | + } |
|
1058 | 1103 | |
1059 | 1104 | if ($this->log) |
1060 | 1105 | { |
@@ -1078,9 +1123,15 @@ discard block |
||
1078 | 1123 | */ |
1079 | 1124 | function searchVNOTE($_vcalData, $_type, $contentID=null, $relax=false, $charset=null) |
1080 | 1125 | { |
1081 | - if (!($note = $this->vnotetoegw($_vcalData, $_type, $contentID, $charset))) return array(); |
|
1126 | + if (!($note = $this->vnotetoegw($_vcalData, $_type, $contentID, $charset))) |
|
1127 | + { |
|
1128 | + return array(); |
|
1129 | + } |
|
1082 | 1130 | |
1083 | - if ($contentID) $note['info_id'] = $contentID; |
|
1131 | + if ($contentID) |
|
1132 | + { |
|
1133 | + $note['info_id'] = $contentID; |
|
1134 | + } |
|
1084 | 1135 | |
1085 | 1136 | unset($note['info_startdate']); |
1086 | 1137 | |
@@ -1132,7 +1183,10 @@ discard block |
||
1132 | 1183 | { |
1133 | 1184 | $_data = Api\Translation::convert($_data, $charset, 'utf-8'); |
1134 | 1185 | } |
1135 | - if (!$vnote->parsevCalendar($_data, 'VCALENDAR')) return false; |
|
1186 | + if (!$vnote->parsevCalendar($_data, 'VCALENDAR')) |
|
1187 | + { |
|
1188 | + return false; |
|
1189 | + } |
|
1136 | 1190 | |
1137 | 1191 | $components = $vnote->getComponent(); |
1138 | 1192 | foreach ($components as $component) |
@@ -23,10 +23,10 @@ |
||
23 | 23 | if ($setup_info['infolog']['version'] != $GLOBALS['egw_info']['apps']['infolog']['version']) |
24 | 24 | { |
25 | 25 | $GLOBALS['egw']->framework->render('<p style="text-align: center; color:red; font-weight: bold;">'.lang('Your database is NOT up to date (%1 vs. %2), please run %3setup%4 to update your database.', |
26 | - $setup_info['infolog']['version'],$GLOBALS['egw_info']['apps']['infolog']['version'], |
|
27 | - '<a href="../setup/">','</a>')."</p>\n"); |
|
26 | + $setup_info['infolog']['version'], $GLOBALS['egw_info']['apps']['infolog']['version'], |
|
27 | + '<a href="../setup/">', '</a>')."</p>\n"); |
|
28 | 28 | exit(); |
29 | 29 | } |
30 | 30 | unset($setup_info); |
31 | 31 | |
32 | -ExecMethod('infolog.infolog_ui.index','reset_action_view'); |
|
32 | +ExecMethod('infolog.infolog_ui.index', 'reset_action_view'); |