@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | * @param string &$content=null content to create some replacements only if they are use |
| 64 | 64 | * @return array|boolean |
| 65 | 65 | */ |
| 66 | - protected function get_replacements($id,&$content=null) |
|
| 66 | + protected function get_replacements($id, &$content = null) |
|
| 67 | 67 | { |
| 68 | 68 | if (!($replacements = $this->infolog_replacements($id, '', $content))) |
| 69 | 69 | { |
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | - if (!(strpos($content,'$$info_contact/') === false)) |
|
| 72 | + if (!(strpos($content, '$$info_contact/') === false)) |
|
| 73 | 73 | { |
| 74 | 74 | // Check to see if it's actually a contact, then load |
| 75 | - if(is_array($replacements['$$info_link$$']) && $replacements['$$info_link$$']['app'] == 'addressbook') |
|
| 75 | + if (is_array($replacements['$$info_link$$']) && $replacements['$$info_link$$']['app'] == 'addressbook') |
|
| 76 | 76 | { |
| 77 | - $replacements += $this->contact_replacements($replacements['$$info_link$$']['id'],'info_contact'); |
|
| 77 | + $replacements += $this->contact_replacements($replacements['$$info_link$$']['id'], 'info_contact'); |
|
| 78 | 78 | } |
| 79 | - if(is_array($replacements['$$info_link$$'])) unset($replacements['$$info_link$$']); |
|
| 79 | + if (is_array($replacements['$$info_link$$'])) unset($replacements['$$info_link$$']); |
|
| 80 | 80 | } |
| 81 | 81 | return $replacements; |
| 82 | 82 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param string $prefix='' prefix like eg. 'erole' |
| 89 | 89 | * @return array|boolean |
| 90 | 90 | */ |
| 91 | - public function infolog_replacements($id,$prefix='', &$content = '') |
|
| 91 | + public function infolog_replacements($id, $prefix = '', &$content = '') |
|
| 92 | 92 | { |
| 93 | 93 | $record = new infolog_egw_record($id); |
| 94 | 94 | $info = array(); |
@@ -96,33 +96,33 @@ discard block |
||
| 96 | 96 | // Convert to human friendly values |
| 97 | 97 | $types = infolog_egw_record::$types; |
| 98 | 98 | $_selects = $this->bo->enums + array('status' => $this->bo->status[$record->info_type]); |
| 99 | - foreach($_selects as $name => $value) |
|
| 99 | + foreach ($_selects as $name => $value) |
|
| 100 | 100 | { |
| 101 | 101 | $selects['info_'.$name] = $value; |
| 102 | - if(!in_array('info_'.$name, $types['select'])) $types['select'][] = 'info_'.$name; |
|
| 102 | + if (!in_array('info_'.$name, $types['select'])) $types['select'][] = 'info_'.$name; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if($content && strpos($content, '$$#') !== FALSE) |
|
| 105 | + if ($content && strpos($content, '$$#') !== FALSE) |
|
| 106 | 106 | { |
| 107 | 107 | $this->cf_link_to_expand($record->get_record_array(), $content, $info); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | importexport_export_csv::convert($record, $types, 'infolog', $selects); |
| 111 | - if($record->info_contact) |
|
| 111 | + if ($record->info_contact) |
|
| 112 | 112 | { |
| 113 | 113 | $array['info_contact'] = $array['info_link']['title']; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Set any missing custom fields, or the marker will stay |
| 117 | 117 | $array = $record->get_record_array(); |
| 118 | - foreach($this->bo->customfields as $name => $field) |
|
| 118 | + foreach ($this->bo->customfields as $name => $field) |
|
| 119 | 119 | { |
| 120 | - if(!$array['#'.$name]) |
|
| 120 | + if (!$array['#'.$name]) |
|
| 121 | 121 | { |
| 122 | 122 | $array['#'.$name] = ''; |
| 123 | 123 | } |
| 124 | 124 | // Format date cfs per user Api\Preferences |
| 125 | - if($field['type'] == 'date' || $field['type'] == 'date-time') |
|
| 125 | + if ($field['type'] == 'date' || $field['type'] == 'date-time') |
|
| 126 | 126 | { |
| 127 | 127 | $this->date_fields[] = '#'.$name; |
| 128 | 128 | $array['#'.$name] = Api\DateTime::to($array['#'.$name], $field['type'] == 'date' ? true : ''); |
@@ -133,16 +133,16 @@ discard block |
||
| 133 | 133 | $array += $this->get_all_links('infolog', $id, $prefix, $content); |
| 134 | 134 | |
| 135 | 135 | // Timesheet time |
| 136 | - if(strpos($content, 'info_sum_timesheets')) |
|
| 136 | + if (strpos($content, 'info_sum_timesheets')) |
|
| 137 | 137 | { |
| 138 | - $links = Link::get_links('infolog',$id,'timesheet'); |
|
| 139 | - $sum = ExecMethod('timesheet.timesheet_bo.sum',$links); |
|
| 138 | + $links = Link::get_links('infolog', $id, 'timesheet'); |
|
| 139 | + $sum = ExecMethod('timesheet.timesheet_bo.sum', $links); |
|
| 140 | 140 | $info['$$info_sum_timesheets$$'] = $sum['duration']; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Check for linked project ID |
| 144 | 144 | $links = Link::get_links('infolog', $id, 'projectmanager'); |
| 145 | - foreach($links as $app_id) |
|
| 145 | + foreach ($links as $app_id) |
|
| 146 | 146 | { |
| 147 | 147 | $array['pm_id'] = $app_id; |
| 148 | 148 | $array['project'] = Link::title('projectmanager', $app_id); |
@@ -151,18 +151,18 @@ discard block |
||
| 151 | 151 | if (strpos($content, '$$project/') !== false && $array['pm_id'] && class_exists('projectmanager_merge')) |
| 152 | 152 | { |
| 153 | 153 | $pm_merge = new projectmanager_merge($array['pm_id']); |
| 154 | - $info += $pm_merge->projectmanager_replacements($array['pm_id'],'project',$content); |
|
| 154 | + $info += $pm_merge->projectmanager_replacements($array['pm_id'], 'project', $content); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | // Add markers |
| 158 | - foreach($array as $key => &$value) |
|
| 158 | + foreach ($array as $key => &$value) |
|
| 159 | 159 | { |
| 160 | - if(!$value) $value = ''; |
|
| 161 | - $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
|
| 160 | + if (!$value) $value = ''; |
|
| 161 | + $info['$$'.($prefix ? $prefix.'/' : '').$key.'$$'] = $value; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // Add parent |
| 165 | - if($record->info_id_parent) |
|
| 165 | + if ($record->info_id_parent) |
|
| 166 | 166 | { |
| 167 | 167 | $info += $this->infolog_replacements($record->info_id_parent, 'info_id_parent', $content); |
| 168 | 168 | } |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | $tracking = new infolog_tracking($this->bo); |
| 187 | 187 | $fields = array('info_id' => lang('Infolog ID'), 'pm_id' => lang('Project ID'), 'project' => lang('Project name')) + $tracking->field2label + array('info_sum_timesheets' => lang('Used time')); |
| 188 | 188 | Api\Translation::add_app('projectmanager'); |
| 189 | - foreach($fields as $name => $label) |
|
| 189 | + foreach ($fields as $name => $label) |
|
| 190 | 190 | { |
| 191 | - if (in_array($name,array('custom'))) continue; // dont show them |
|
| 191 | + if (in_array($name, array('custom'))) continue; // dont show them |
|
| 192 | 192 | |
| 193 | - if (in_array($name,array('info_subject', 'info_des')) && $n&1) // main values, which should be in the first column |
|
| 193 | + if (in_array($name, array('info_subject', 'info_des')) && $n&1) // main values, which should be in the first column |
|
| 194 | 194 | { |
| 195 | 195 | echo "</tr>\n"; |
| 196 | 196 | $n++; |
@@ -203,26 +203,26 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
| 205 | 205 | $contact_custom = false; |
| 206 | - foreach($this->bo->customfields as $name => $field) |
|
| 206 | + foreach ($this->bo->customfields as $name => $field) |
|
| 207 | 207 | { |
| 208 | - echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label'].($field['type'] == 'select-account' ? '*':'')."</td></tr>\n"; |
|
| 209 | - if($field['type'] == 'select-account') $contact_custom = true; |
|
| 208 | + echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label'].($field['type'] == 'select-account' ? '*' : '')."</td></tr>\n"; |
|
| 209 | + if ($field['type'] == 'select-account') $contact_custom = true; |
|
| 210 | 210 | } |
| 211 | - if($contact_custom) |
|
| 211 | + if ($contact_custom) |
|
| 212 | 212 | { |
| 213 | - echo '<tr><td /><td colspan="3">* '.lang('Addressbook placeholders available'). '</td></tr>'; |
|
| 213 | + echo '<tr><td /><td colspan="3">* '.lang('Addressbook placeholders available').'</td></tr>'; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | echo '<tr><td colspan="4"><h3>'.lang('Parent').":</h3></td></tr>"; |
| 217 | - echo '<tr><td>{{info_id_parent/info_subject}}</td><td colspan="3">'.lang('All other %1 fields are valid',lang('infolog'))."</td></tr>\n"; |
|
| 217 | + echo '<tr><td>{{info_id_parent/info_subject}}</td><td colspan="3">'.lang('All other %1 fields are valid', lang('infolog'))."</td></tr>\n"; |
|
| 218 | 218 | |
| 219 | 219 | echo '<tr><td colspan="4"><h3>'.lang('Contact fields').':</h3></td></tr>'; |
| 220 | 220 | $i = 0; |
| 221 | - foreach($this->contacts->contact_fields as $name => $label) |
|
| 221 | + foreach ($this->contacts->contact_fields as $name => $label) |
|
| 222 | 222 | { |
| 223 | - if (in_array($name,array('tid','label','geo'))) continue; // dont show them, as they are not used in the UI atm. |
|
| 223 | + if (in_array($name, array('tid', 'label', 'geo'))) continue; // dont show them, as they are not used in the UI atm. |
|
| 224 | 224 | |
| 225 | - if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) // main values, which should be in the first column |
|
| 225 | + if (in_array($name, array('email', 'org_name', 'tel_work', 'url')) && $n&1) // main values, which should be in the first column |
|
| 226 | 226 | { |
| 227 | 227 | echo "</tr>\n"; |
| 228 | 228 | $i++; |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
| 237 | - foreach($this->contacts->customfields as $name => $field) |
|
| 237 | + foreach ($this->contacts->customfields as $name => $field) |
|
| 238 | 238 | { |
| 239 | 239 | echo '<tr><td>{{info_contact/#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n"; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>"; |
| 243 | - foreach(array( |
|
| 243 | + foreach (array( |
|
| 244 | 244 | 'link' => lang('HTML link to the current record'), |
| 245 | 245 | 'links' => lang('Titles of any entries linked to the current record, excluding attached files'), |
| 246 | 246 | 'attachments' => lang('List of files linked to the current record'), |