@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | function __construct() |
| 57 | 57 | { |
| 58 | 58 | // we cant deal with notice and warnings, as we are on ajax! |
| 59 | - error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); |
|
| 59 | + error_reporting(E_ALL&~E_NOTICE&~E_WARNING); |
|
| 60 | 60 | $GLOBALS['egw']->translation->add_app(self::_appname); |
| 61 | 61 | $GLOBALS['egw_info']['flags']['currentapp'] = self::_appname; |
| 62 | 62 | |
| 63 | 63 | $this->etpl = new etemplate_new(); |
| 64 | - $this->clock = html::image(self::_appname,'clock'); |
|
| 64 | + $this->clock = html::image(self::_appname, 'clock'); |
|
| 65 | 65 | $this->steps = array( |
| 66 | 66 | 'wizard_step10' => lang('Choose an application'), |
| 67 | 67 | 'wizard_step20' => lang('Choose a plugin'), |
@@ -78,18 +78,18 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param array $content=null |
| 80 | 80 | */ |
| 81 | - function index($content = null,$msg='') |
|
| 81 | + function index($content = null, $msg = '') |
|
| 82 | 82 | { |
| 83 | 83 | $filter = array('name' => '*'); |
| 84 | 84 | |
| 85 | - if($GLOBALS['egw_info']['user']['apps']['admin']) { |
|
| 85 | + if ($GLOBALS['egw_info']['user']['apps']['admin']) { |
|
| 86 | 86 | // Any public definition |
| 87 | - $filter[] = '(owner=0 OR owner IS NULL OR allowed_users IS NOT NULL OR owner = ' . $GLOBALS['egw_info']['user']['account_id'] . ')'; |
|
| 87 | + $filter[] = '(owner=0 OR owner IS NULL OR allowed_users IS NOT NULL OR owner = '.$GLOBALS['egw_info']['user']['account_id'].')'; |
|
| 88 | 88 | } else { |
| 89 | 89 | // Filter private definitions |
| 90 | 90 | $filter['owner'] = $GLOBALS['egw_info']['user']['account_id']; |
| 91 | 91 | $config = config::read('phpgwapi'); |
| 92 | - if($config['export_limit'] == 'no' && !bo_merge::is_export_limit_excepted()) { |
|
| 92 | + if ($config['export_limit'] == 'no' && !bo_merge::is_export_limit_excepted()) { |
|
| 93 | 93 | $filter['type'] = 'import'; |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | if (isset($content['nm']['rows']['delete'])) |
| 101 | 101 | { |
| 102 | 102 | $content['nm']['action'] = 'delete'; |
| 103 | - $content['nm']['selected'] = array_keys($content['nm']['rows']['delete'],'pressed'); |
|
| 103 | + $content['nm']['selected'] = array_keys($content['nm']['rows']['delete'], 'pressed'); |
|
| 104 | 104 | } |
| 105 | - elseif(($button = array_search('pressed',$content['nm']['rows'])) !== false) |
|
| 105 | + elseif (($button = array_search('pressed', $content['nm']['rows'])) !== false) |
|
| 106 | 106 | { |
| 107 | 107 | $selected = $content['nm']['rows']['selected']; |
| 108 | - if(count($selected) < 1 || !is_array($selected)) common::egw_exit(); |
|
| 108 | + if (count($selected) < 1 || !is_array($selected)) common::egw_exit(); |
|
| 109 | 109 | switch ($button) |
| 110 | 110 | { |
| 111 | 111 | case 'delete_selected' : |
@@ -127,54 +127,54 @@ discard block |
||
| 127 | 127 | else |
| 128 | 128 | { |
| 129 | 129 | // Action has an additional parameter |
| 130 | - if(in_array($content['nm']['action'], array('owner', 'allowed'))) |
|
| 130 | + if (in_array($content['nm']['action'], array('owner', 'allowed'))) |
|
| 131 | 131 | { |
| 132 | 132 | $action = $content['nm']['action']; |
| 133 | - if($content['nm']['action'] == 'allowed') |
|
| 133 | + if ($content['nm']['action'] == 'allowed') |
|
| 134 | 134 | { |
| 135 | 135 | $content['allowed'] = $content['allowed_popup']['allowed_private'] == 'true' ? null : ( |
| 136 | - $content['allowed_popup']['all_users']=='true' ? 'all' : implode(',',$content['allowed_popup']['allowed']) |
|
| 136 | + $content['allowed_popup']['all_users'] == 'true' ? 'all' : implode(',', $content['allowed_popup']['allowed']) |
|
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | 139 | else |
| 140 | 140 | { |
| 141 | 141 | $content['owner'] = $content['owner_popup']['owner']; |
| 142 | 142 | } |
| 143 | - if(is_array($content[$content['nm']['action']])) |
|
| 143 | + if (is_array($content[$content['nm']['action']])) |
|
| 144 | 144 | { |
| 145 | - $content[$content['nm']['action']] = implode(',',$content[$content['nm']['action']]); |
|
| 145 | + $content[$content['nm']['action']] = implode(',', $content[$content['nm']['action']]); |
|
| 146 | 146 | } |
| 147 | - $content['nm']['action'] .= '_' . $content[$action]; |
|
| 147 | + $content['nm']['action'] .= '_'.$content[$action]; |
|
| 148 | 148 | unset($content[$action]); |
| 149 | 149 | unset($content['allowed_popup']); |
| 150 | 150 | } |
| 151 | - if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'], |
|
| 152 | - $success,$failed,$action_msg,'index',$msg)) |
|
| 151 | + if ($this->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'], |
|
| 152 | + $success, $failed, $action_msg, 'index', $msg)) |
|
| 153 | 153 | { |
| 154 | - $msg .= lang('%1 definition(s) %2',$success,$action_msg); |
|
| 154 | + $msg .= lang('%1 definition(s) %2', $success, $action_msg); |
|
| 155 | 155 | } |
| 156 | - elseif(empty($msg)) |
|
| 156 | + elseif (empty($msg)) |
|
| 157 | 157 | { |
| 158 | - $msg .= lang('%1 definition(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
| 158 | + $msg .= lang('%1 definition(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if(!is_array($content['nm'])) { |
|
| 164 | + if (!is_array($content['nm'])) { |
|
| 165 | 165 | $content['nm'] = array( |
| 166 | 166 | 'get_rows' => 'importexport.importexport_definitions_ui.get_rows', |
| 167 | 167 | 'no_cat' => true, |
| 168 | 168 | 'no_filter' => true, |
| 169 | 169 | 'no_filter2' => true, |
| 170 | - 'csv_fields' => false, // Disable CSV export, uses own export |
|
| 171 | - 'default_cols' => '!actions', // switch legacy actions column and row off by default |
|
| 170 | + 'csv_fields' => false, // Disable CSV export, uses own export |
|
| 171 | + 'default_cols' => '!actions', // switch legacy actions column and row off by default |
|
| 172 | 172 | 'row_id' => 'definition_id', |
| 173 | 173 | 'placeholder_actions' => array('add') |
| 174 | 174 | ); |
| 175 | - if($_GET['application']) $content['nm']['col_filter']['application'] = $_GET['application']; |
|
| 175 | + if ($_GET['application']) $content['nm']['col_filter']['application'] = $_GET['application']; |
|
| 176 | 176 | } |
| 177 | - if(egw_session::appsession('index', 'importexport')) |
|
| 177 | + if (egw_session::appsession('index', 'importexport')) |
|
| 178 | 178 | { |
| 179 | 179 | $content['nm'] = array_merge($content['nm'], egw_session::appsession('index', 'importexport')); |
| 180 | 180 | } |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | ); |
| 192 | 192 | foreach ($this->plugins as $appname => $options) |
| 193 | 193 | { |
| 194 | - if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) { |
|
| 194 | + if ($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) { |
|
| 195 | 195 | $sel_options['application'][$appname] = lang($appname); |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | - if($msg) $content['msg'] = $msg; |
|
| 198 | + if ($msg) $content['msg'] = $msg; |
|
| 199 | 199 | |
| 200 | 200 | $etpl = new etemplate_new(self::_appname.'.definition_index'); |
| 201 | - return $etpl->exec( self::_appname.'.importexport_definitions_ui.index', $content, $sel_options, $readonlys, $preserv ); |
|
| 201 | + return $etpl->exec(self::_appname.'.importexport_definitions_ui.index', $content, $sel_options, $readonlys, $preserv); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | private function get_actions() { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | 289 | // Unset admin actions |
| 290 | - if(!$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 290 | + if (!$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 291 | 291 | { |
| 292 | 292 | unset($actions['schedule']); |
| 293 | 293 | } |
@@ -306,27 +306,27 @@ discard block |
||
| 306 | 306 | * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup |
| 307 | 307 | * @return boolean true if all actions succeded, false otherwise |
| 308 | 308 | */ |
| 309 | - function action($action,$selected,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg) |
|
| 309 | + function action($action, $selected, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg) |
|
| 310 | 310 | { |
| 311 | 311 | //error_log( __METHOD__."('$action', ".array2string($selected).', '.array2string($use_all).",,, '$session_name')"); |
| 312 | 312 | if ($use_all) |
| 313 | 313 | { |
| 314 | 314 | // get the whole selection |
| 315 | - $old_query = $query = is_array($session_name) ? $session_name : egw_session::appsession($session_name,'importexport'); |
|
| 315 | + $old_query = $query = is_array($session_name) ? $session_name : egw_session::appsession($session_name, 'importexport'); |
|
| 316 | 316 | |
| 317 | - @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
| 318 | - $query['num_rows'] = -1; // all |
|
| 319 | - $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
| 320 | - $this->get_rows($query,$rows,$readonlys); |
|
| 317 | + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small |
|
| 318 | + $query['num_rows'] = -1; // all |
|
| 319 | + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
| 320 | + $this->get_rows($query, $rows, $readonlys); |
|
| 321 | 321 | |
| 322 | 322 | $selected = array(); |
| 323 | - foreach($rows as $row) { |
|
| 323 | + foreach ($rows as $row) { |
|
| 324 | 324 | $selected[] = $row['definition_id']; |
| 325 | 325 | } |
| 326 | - if(!is_array($session_name)) |
|
| 326 | + if (!is_array($session_name)) |
|
| 327 | 327 | { |
| 328 | 328 | // Restore old query |
| 329 | - egw_session::appsession($session_name, 'importexport',$old_query); |
|
| 329 | + egw_session::appsession($session_name, 'importexport', $old_query); |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
@@ -335,10 +335,10 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $bodefinitions = new importexport_definitions_bo(false, true); |
| 337 | 337 | |
| 338 | - switch($action) { |
|
| 338 | + switch ($action) { |
|
| 339 | 339 | case 'execute': |
| 340 | 340 | // There's probably a way to do this in just JS, all the info should be there... |
| 341 | - foreach($selected as $id) { |
|
| 341 | + foreach ($selected as $id) { |
|
| 342 | 342 | $definition = $bodefinitions->read((int)$id); |
| 343 | 343 | $link = egw::link('/index.php', array( |
| 344 | 344 | 'menuaction' => 'importexport.importexport_'.$definition['type'].'_ui.'.$definition['type'].'_dialog', |
@@ -349,14 +349,14 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | break; |
| 351 | 351 | case 'allowed': |
| 352 | - $action = 'allowed_users';// Field is allowed_users, popup doesn't like _ |
|
| 352 | + $action = 'allowed_users'; // Field is allowed_users, popup doesn't like _ |
|
| 353 | 353 | case 'owner': |
| 354 | - $action_msg = lang('changed'. ' ' . $action); |
|
| 355 | - foreach($selected as $id) { |
|
| 354 | + $action_msg = lang('changed'.' '.$action); |
|
| 355 | + foreach ($selected as $id) { |
|
| 356 | 356 | $definition = $bodefinitions->read((int)$id); |
| 357 | - if($definition['definition_id']) { |
|
| 357 | + if ($definition['definition_id']) { |
|
| 358 | 358 | // Prevent private with no owner |
| 359 | - if(!$definition['owner'] && !$settings) $definition['owner'] = $GLOBALS['egw_info']['user']['account_id']; |
|
| 359 | + if (!$definition['owner'] && !$settings) $definition['owner'] = $GLOBALS['egw_info']['user']['account_id']; |
|
| 360 | 360 | |
| 361 | 361 | $definition[$action] = $settings; |
| 362 | 362 | $bodefinitions->save($definition); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $mime_type = ($GLOBALS['egw']->html->user_agent == 'msie' || $GLOBALS['egw']->html->user_agent == 'opera') ? |
| 375 | 375 | 'application/octetstream' : 'application/octet-stream'; |
| 376 | 376 | $name = 'importexport_definition.xml'; |
| 377 | - header('Content-Type: ' . $mime_type); |
|
| 377 | + header('Content-Type: '.$mime_type); |
|
| 378 | 378 | header('Content-Disposition: attachment; filename="'.$name.'"'); |
| 379 | 379 | echo $bodefinitions->export($selected); |
| 380 | 380 | common::egw_exit(); |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | case 'copy': |
| 384 | 384 | $action_msg = lang('copied'); |
| 385 | 385 | // Should only be one selected |
| 386 | - foreach($selected as $id) { |
|
| 386 | + foreach ($selected as $id) { |
|
| 387 | 387 | $definition = $bodefinitions->read((int)$id); |
| 388 | - if($definition['definition_id']) { |
|
| 388 | + if ($definition['definition_id']) { |
|
| 389 | 389 | unset($definition['definition_id']); |
| 390 | - $definition['name'] = $settings ? $settings : $definition['name'] . ' copy'; |
|
| 390 | + $definition['name'] = $settings ? $settings : $definition['name'].' copy'; |
|
| 391 | 391 | try { |
| 392 | 392 | $bodefinitions->save($definition); |
| 393 | 393 | } catch (Exception $e) { |
| 394 | 394 | try { |
| 395 | - $definition['name'] .= ' ' . $GLOBALS['egw_info']['user']['account_lid']; |
|
| 395 | + $definition['name'] .= ' '.$GLOBALS['egw_info']['user']['account_lid']; |
|
| 396 | 396 | $bodefinitions->save($definition); |
| 397 | 397 | } catch (Exception $ex) { |
| 398 | 398 | $failed++; |
@@ -407,16 +407,16 @@ discard block |
||
| 407 | 407 | case 'createexport': |
| 408 | 408 | $action_msg = lang('created'); |
| 409 | 409 | // Should only be one selected |
| 410 | - foreach($selected as $id) { |
|
| 410 | + foreach ($selected as $id) { |
|
| 411 | 411 | $definition = new importexport_definition($id); |
| 412 | 412 | try { |
| 413 | 413 | $export = $bodefinitions->export_from_import($definition); |
| 414 | 414 | $export->save(); |
| 415 | 415 | } catch (Exception $e) { |
| 416 | - if($export) |
|
| 416 | + if ($export) |
|
| 417 | 417 | { |
| 418 | 418 | try { |
| 419 | - $export->name = $export->name.' ' . $GLOBALS['egw_info']['user']['account_lid']; |
|
| 419 | + $export->name = $export->name.' '.$GLOBALS['egw_info']['user']['account_lid']; |
|
| 420 | 420 | $export->save(); |
| 421 | 421 | } catch (Exception $ex) { |
| 422 | 422 | $failed++; |
@@ -438,13 +438,13 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | public function get_rows(&$query, &$rows, &$readonlys) { |
| 440 | 440 | $rows = array(); |
| 441 | - egw_session::appsession('index','importexport',$query); |
|
| 441 | + egw_session::appsession('index', 'importexport', $query); |
|
| 442 | 442 | |
| 443 | 443 | // Special handling for allowed users 'private' |
| 444 | - if($query['col_filter']['allowed_users'] == 'private') |
|
| 444 | + if ($query['col_filter']['allowed_users'] == 'private') |
|
| 445 | 445 | { |
| 446 | 446 | unset($query['col_filter']['allowed_users']); |
| 447 | - $query['col_filter'][] = 'allowed_users = ' . $GLOBALS['egw']->db->quote(',,'); |
|
| 447 | + $query['col_filter'][] = 'allowed_users = '.$GLOBALS['egw']->db->quote(',,'); |
|
| 448 | 448 | } |
| 449 | 449 | $bodefinitions = new importexport_definitions_bo($query['col_filter'], true); |
| 450 | 450 | // We don't care about readonlys for the UI |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | */ |
| 460 | 460 | function edit() |
| 461 | 461 | { |
| 462 | - if(!$_definition = $_GET['definition']) |
|
| 462 | + if (!$_definition = $_GET['definition']) |
|
| 463 | 463 | { |
| 464 | 464 | $content = array( |
| 465 | 465 | 'edit' => true, |
@@ -468,11 +468,11 @@ discard block |
||
| 468 | 468 | ); |
| 469 | 469 | |
| 470 | 470 | // Jump to a step |
| 471 | - if($_GET['step']) |
|
| 471 | + if ($_GET['step']) |
|
| 472 | 472 | { |
| 473 | 473 | $content['edit'] = false; |
| 474 | 474 | // Wizard will process previous step, then advance |
| 475 | - $content['step'] = $this->get_step($_GET['step'],-1); |
|
| 475 | + $content['step'] = $this->get_step($_GET['step'], -1); |
|
| 476 | 476 | $content['button']['next'] = 'pressed'; |
| 477 | 477 | $this->wizard($content); |
| 478 | 478 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | return; |
| 485 | 485 | } |
| 486 | - if(is_numeric($_GET['definition'])) |
|
| 486 | + if (is_numeric($_GET['definition'])) |
|
| 487 | 487 | { |
| 488 | 488 | $definition = (int)$_GET['definition']; |
| 489 | 489 | } |
@@ -495,31 +495,31 @@ discard block |
||
| 495 | 495 | $definition = $bodefinitions->read($definition); |
| 496 | 496 | $definition['edit'] = true; |
| 497 | 497 | // Jump to a step |
| 498 | - if($_GET['step']) |
|
| 498 | + if ($_GET['step']) |
|
| 499 | 499 | { |
| 500 | 500 | $definition['edit'] = false; |
| 501 | 501 | // Wizard will process previous step, then advance |
| 502 | - $definition['step'] = $_GET['step'];; |
|
| 502 | + $definition['step'] = $_GET['step']; ; |
|
| 503 | 503 | $definition['button'] = array('next' => 'pressed'); |
| 504 | 504 | } |
| 505 | 505 | $this->wizard($definition); |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - function wizard($content = null, $msg='') |
|
| 508 | + function wizard($content = null, $msg = '') |
|
| 509 | 509 | { |
| 510 | 510 | $this->etpl->read('importexport.wizardbox'); |
| 511 | 511 | |
| 512 | - if(is_array($content) &&! $content['edit']) |
|
| 512 | + if (is_array($content) && !$content['edit']) |
|
| 513 | 513 | { |
| 514 | - if(self::_debug) error_log('importexport.wizard->$content '. print_r($content,true)); |
|
| 514 | + if (self::_debug) error_log('importexport.wizard->$content '.print_r($content, true)); |
|
| 515 | 515 | //foreach($content as $key => $val) error_log(" $key : ".array2string($val)); |
| 516 | 516 | // fetch plugin object |
| 517 | - if($content['plugin'] && $content['application']) |
|
| 517 | + if ($content['plugin'] && $content['application']) |
|
| 518 | 518 | { |
| 519 | - $wizard_name = $content['application'] . '_wizard_' . str_replace($content['application'] . '_', '', $content['plugin']); |
|
| 519 | + $wizard_name = $content['application'].'_wizard_'.str_replace($content['application'].'_', '', $content['plugin']); |
|
| 520 | 520 | |
| 521 | 521 | // we need to deal with the wizard object if exists |
| 522 | - if (file_exists(EGW_SERVER_ROOT . '/'. $content['application']."/inc/class.$wizard_name.inc.php")) |
|
| 522 | + if (file_exists(EGW_SERVER_ROOT.'/'.$content['application']."/inc/class.$wizard_name.inc.php")) |
|
| 523 | 523 | { |
| 524 | 524 | $wizard_plugin = $wizard_name; |
| 525 | 525 | } |
@@ -528,38 +528,38 @@ discard block |
||
| 528 | 528 | $wizard_plugin = $content['plugin']; |
| 529 | 529 | } |
| 530 | 530 | // App translations |
| 531 | - if($content['application']) translation::add_app($content['application']); |
|
| 531 | + if ($content['application']) translation::add_app($content['application']); |
|
| 532 | 532 | |
| 533 | 533 | $this->plugin = is_object($GLOBALS['egw']->$wizard_plugin) ? $GLOBALS['egw']->$wizard_plugin : new $wizard_plugin; |
| 534 | 534 | |
| 535 | 535 | // Global object needs to be the same, or references to plugin don't work |
| 536 | - if(!is_object($GLOBALS['egw']->importexport_definitions_ui) || $GLOBALS['egw']->importexport_definitions_ui !== $this) |
|
| 537 | - $GLOBALS['egw']->importexport_definitions_ui =& $this; |
|
| 536 | + if (!is_object($GLOBALS['egw']->importexport_definitions_ui) || $GLOBALS['egw']->importexport_definitions_ui !== $this) |
|
| 537 | + $GLOBALS['egw']->importexport_definitions_ui = & $this; |
|
| 538 | 538 | } |
| 539 | 539 | // deal with buttons even if we are not on ajax |
| 540 | - if(isset($content['button']) && array_search('pressed',$content['button']) === false && count($content['button']) == 1) |
|
| 540 | + if (isset($content['button']) && array_search('pressed', $content['button']) === false && count($content['button']) == 1) |
|
| 541 | 541 | { |
| 542 | 542 | $button = array_keys($content['button']); |
| 543 | 543 | $content['button'] = array($button[0] => 'pressed'); |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | // post process submitted step |
| 547 | - if($content['step']) |
|
| 547 | + if ($content['step']) |
|
| 548 | 548 | { |
| 549 | - if(!$this->can_edit($content)) |
|
| 549 | + if (!$this->can_edit($content)) |
|
| 550 | 550 | { |
| 551 | 551 | // Each step changes definition, reload it |
| 552 | 552 | $bodefinitions = new importexport_definitions_bo(); |
| 553 | 553 | $definition = $bodefinitions->read($content); |
| 554 | 554 | $content = $definition + array('step' => $content['step'], 'button' => $content['button']); |
| 555 | 555 | } |
| 556 | - if(!key_exists($content['step'],$this->steps)) |
|
| 556 | + if (!key_exists($content['step'], $this->steps)) |
|
| 557 | 557 | { |
| 558 | - $next_step = $this->plugin->{$content['step']}($content,$sel_options,$readonlys,$preserv); |
|
| 558 | + $next_step = $this->plugin->{$content['step']}($content, $sel_options, $readonlys, $preserv); |
|
| 559 | 559 | } |
| 560 | 560 | else |
| 561 | 561 | { |
| 562 | - $next_step = $this->{$content['step']}($content,$sel_options,$readonlys,$preserv); |
|
| 562 | + $next_step = $this->{$content['step']}($content, $sel_options, $readonlys, $preserv); |
|
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 | else |
@@ -571,23 +571,23 @@ discard block |
||
| 571 | 571 | $sel_options = $readonlys = $preserv = array(); |
| 572 | 572 | |
| 573 | 573 | // Disable finish button if required fields are missing |
| 574 | - if(!$content['name'] || !$content['type'] || !$content['plugin']) |
|
| 574 | + if (!$content['name'] || !$content['type'] || !$content['plugin']) |
|
| 575 | 575 | { |
| 576 | 576 | $readonlys['button[finish]'] = true; |
| 577 | 577 | } |
| 578 | 578 | do |
| 579 | 579 | { |
| 580 | - if(!key_exists($next_step,$this->steps)) |
|
| 580 | + if (!key_exists($next_step, $this->steps)) |
|
| 581 | 581 | { |
| 582 | - $this->wizard_content_template = $this->plugin->$next_step($content,$sel_options,$readonlys,$preserv); |
|
| 582 | + $this->wizard_content_template = $this->plugin->$next_step($content, $sel_options, $readonlys, $preserv); |
|
| 583 | 583 | } |
| 584 | 584 | else |
| 585 | 585 | { |
| 586 | - $this->wizard_content_template = $this->$next_step($content,$sel_options,$readonlys,$preserv); |
|
| 586 | + $this->wizard_content_template = $this->$next_step($content, $sel_options, $readonlys, $preserv); |
|
| 587 | 587 | } |
| 588 | - if($this->wizard_content_template == self::SKIP) |
|
| 588 | + if ($this->wizard_content_template == self::SKIP) |
|
| 589 | 589 | { |
| 590 | - if(!key_exists($content['step'],$this->steps)) |
|
| 590 | + if (!key_exists($content['step'], $this->steps)) |
|
| 591 | 591 | { |
| 592 | 592 | $next_step = $this->plugin->{$content['step']}($content); |
| 593 | 593 | } |
@@ -596,9 +596,9 @@ discard block |
||
| 596 | 596 | $next_step = $this->{$content['step']}($content); |
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | - } while($this->wizard_content_template == self::SKIP); |
|
| 599 | + } while ($this->wizard_content_template == self::SKIP); |
|
| 600 | 600 | |
| 601 | - if(!$this->can_edit($content)) |
|
| 601 | + if (!$this->can_edit($content)) |
|
| 602 | 602 | { |
| 603 | 603 | $readonlys[$this->wizard_content_template] = true; |
| 604 | 604 | $preserve = $content; |
@@ -607,21 +607,21 @@ discard block |
||
| 607 | 607 | |
| 608 | 608 | unset($content['button']); |
| 609 | 609 | $content['wizard_content'] = $this->wizard_content_template; |
| 610 | - $this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv,2); |
|
| 610 | + $this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard', $content, $sel_options, $readonlys, $preserv, 2); |
|
| 611 | 611 | } |
| 612 | 612 | else |
| 613 | 613 | { |
| 614 | 614 | // initial content |
| 615 | 615 | $sel_options = $readonlys = $preserv = array(); |
| 616 | 616 | $readonlys['button[previous]'] = true; |
| 617 | - if($content['edit']) |
|
| 617 | + if ($content['edit']) |
|
| 618 | 618 | { |
| 619 | 619 | unset ($content['edit']); |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | $this->wizard_content_template = $this->wizard_step10($content, $sel_options, $readonlys, $preserv); |
| 623 | 623 | |
| 624 | - if(!$this->can_edit($content)) |
|
| 624 | + if (!$this->can_edit($content)) |
|
| 625 | 625 | { |
| 626 | 626 | $readonlys[$this->wizard_content_template] = true; |
| 627 | 627 | $preserve = $content; |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | $content['wizard_content'] = $this->wizard_content_template; |
| 632 | - $this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv,2); |
|
| 632 | + $this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard', $content, $sel_options, $readonlys, $preserv, 2); |
|
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | |
@@ -640,31 +640,31 @@ discard block |
||
| 640 | 640 | * @param int $step_width |
| 641 | 641 | * @return string containing function name of next step |
| 642 | 642 | */ |
| 643 | - function get_step ($curr_step, $step_width) |
|
| 643 | + function get_step($curr_step, $step_width) |
|
| 644 | 644 | { |
| 645 | 645 | /*if($content['plugin'] && $content['application']&& !is_object($this->plugin)) |
| 646 | 646 | { |
| 647 | 647 | $plugin_definition = $this->plugins[$content['application']][$content['plugin']]['definition']; |
| 648 | 648 | if($plugin_definition) $this->plugin = new $plugin_definition; |
| 649 | 649 | }*/ |
| 650 | - if(is_object($this->plugin) && is_array($this->plugin->steps)) |
|
| 650 | + if (is_object($this->plugin) && is_array($this->plugin->steps)) |
|
| 651 | 651 | { |
| 652 | - $steps = array_merge($this->steps,$this->plugin->steps); |
|
| 653 | - $steps = array_flip($steps); asort($steps); $steps = array_flip($steps); |
|
| 652 | + $steps = array_merge($this->steps, $this->plugin->steps); |
|
| 653 | + $steps = array_flip($steps); asort($steps); $steps = array_flip($steps); |
|
| 654 | 654 | } |
| 655 | 655 | else |
| 656 | 656 | { |
| 657 | 657 | $steps = $this->steps; |
| 658 | 658 | } |
| 659 | 659 | $step_keys = array_keys($steps); |
| 660 | - $nn = array_search($curr_step,$step_keys)+(int)$step_width; |
|
| 661 | - return (key_exists($nn,$step_keys)) ? $step_keys[$nn] : 'wizard_finish'; |
|
| 660 | + $nn = array_search($curr_step, $step_keys) + (int)$step_width; |
|
| 661 | + return (key_exists($nn, $step_keys)) ? $step_keys[$nn] : 'wizard_finish'; |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | |
| 665 | 665 | function wizard_step10(&$content, &$sel_options, &$readonlys, &$preserv) |
| 666 | 666 | { |
| 667 | - if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step10->$content '.print_r($content,true)); |
|
| 667 | + if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step10->$content '.print_r($content, true)); |
|
| 668 | 668 | |
| 669 | 669 | // return from step10 |
| 670 | 670 | if ($content['step'] == 'wizard_step10') |
@@ -672,11 +672,11 @@ discard block |
||
| 672 | 672 | switch (array_search('pressed', $content['button'])) |
| 673 | 673 | { |
| 674 | 674 | case 'next': |
| 675 | - return $this->get_step($content['step'],1); |
|
| 675 | + return $this->get_step($content['step'], 1); |
|
| 676 | 676 | case 'finish': |
| 677 | 677 | return 'wizard_finish'; |
| 678 | 678 | default : |
| 679 | - return $this->wizard_step10($content,$sel_options,$readonlys,$preserv); |
|
| 679 | + return $this->wizard_step10($content, $sel_options, $readonlys, $preserv); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | } |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | $content['text'] = $this->steps['wizard_step10']; |
| 687 | 687 | foreach ($this->plugins as $appname => $options) |
| 688 | 688 | { |
| 689 | - if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) { |
|
| 689 | + if ($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) { |
|
| 690 | 690 | $sel_options['application'][$appname] = lang($appname); |
| 691 | 691 | } |
| 692 | 692 | } |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | // get plugin |
| 703 | 703 | function wizard_step20(&$content, &$sel_options, &$readonlys, &$preserv) |
| 704 | 704 | { |
| 705 | - if(self::_debug) error_log('importexport.' . get_class($this) . '::wizard_step20->$content '.print_r($content,true)); |
|
| 705 | + if (self::_debug) error_log('importexport.'.get_class($this).'::wizard_step20->$content '.print_r($content, true)); |
|
| 706 | 706 | |
| 707 | 707 | // return from step20 |
| 708 | 708 | if ($content['step'] == 'wizard_step20') |
@@ -711,21 +711,21 @@ discard block |
||
| 711 | 711 | { |
| 712 | 712 | case 'next': |
| 713 | 713 | // There's no real reason the plugin has to come from any of these, as long as it has a $steps variable |
| 714 | - if($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv || strpos(get_class($this->plugin), 'import') !== false) { |
|
| 714 | + if ($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv || strpos(get_class($this->plugin), 'import') !== false) { |
|
| 715 | 715 | $content['type'] = 'import'; |
| 716 | - } elseif($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv || strpos(get_class($this->plugin),'export') !== false) { |
|
| 716 | + } elseif ($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv || strpos(get_class($this->plugin), 'export') !== false) { |
|
| 717 | 717 | $content['type'] = 'export'; |
| 718 | 718 | } else { |
| 719 | 719 | throw new egw_exception('Invalid plugin'); |
| 720 | 720 | } |
| 721 | - return $this->get_step($content['step'],1); |
|
| 721 | + return $this->get_step($content['step'], 1); |
|
| 722 | 722 | case 'previous' : |
| 723 | 723 | $readonlys['button[previous]'] = true; |
| 724 | - return $this->get_step($content['step'],-1); |
|
| 724 | + return $this->get_step($content['step'], -1); |
|
| 725 | 725 | case 'finish': |
| 726 | 726 | return 'wizard_finish'; |
| 727 | 727 | default : |
| 728 | - return $this->wizard_step20($content,$sel_options,$readonlys,$preserv); |
|
| 728 | + return $this->wizard_step20($content, $sel_options, $readonlys, $preserv); |
|
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | // init step20 |
@@ -734,8 +734,8 @@ discard block |
||
| 734 | 734 | $content['text'] = $this->steps['wizard_step20']; |
| 735 | 735 | $config = config::read('phpgwapi'); |
| 736 | 736 | foreach ($this->plugins[$content['application']] as $type => $plugins) { |
| 737 | - if($config['export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $type == 'export') continue; |
|
| 738 | - foreach($plugins as $plugin => $name) { |
|
| 737 | + if ($config['export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $type == 'export') continue; |
|
| 738 | + foreach ($plugins as $plugin => $name) { |
|
| 739 | 739 | $sel_options['plugin'][$plugin] = $name; |
| 740 | 740 | } |
| 741 | 741 | } |
@@ -751,15 +751,15 @@ discard block |
||
| 751 | 751 | // name |
| 752 | 752 | function wizard_step21(&$content, &$sel_options, &$readonlys, &$preserv) |
| 753 | 753 | { |
| 754 | - if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step21->$content '.print_r($content,true)); |
|
| 754 | + if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step21->$content '.print_r($content, true)); |
|
| 755 | 755 | |
| 756 | 756 | // Check for duplicate name |
| 757 | 757 | $duplicate = isset($content['duplicate_error']); |
| 758 | - if($content['name'] && !$duplicate) |
|
| 758 | + if ($content['name'] && !$duplicate) |
|
| 759 | 759 | { |
| 760 | 760 | try { |
| 761 | 761 | $check_definition = new importexport_definition($content['name']); |
| 762 | - if($check_definition && $check_definition->definition_id && $check_definition->definition_id != $content['definition_id']) |
|
| 762 | + if ($check_definition && $check_definition->definition_id && $check_definition->definition_id != $content['definition_id']) |
|
| 763 | 763 | { |
| 764 | 764 | throw new Exception('Already exists'); |
| 765 | 765 | } |
@@ -769,21 +769,21 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | // Try some suggestions |
| 771 | 771 | $suggestions = array( |
| 772 | - $content['name'] .'-'. $GLOBALS['egw_info']['user']['account_lid'], |
|
| 773 | - $content['name'] .'-'. $GLOBALS['egw_info']['user']['account_id'], |
|
| 774 | - $content['name'] .'-'. egw_time::to('now', true), |
|
| 772 | + $content['name'].'-'.$GLOBALS['egw_info']['user']['account_lid'], |
|
| 773 | + $content['name'].'-'.$GLOBALS['egw_info']['user']['account_id'], |
|
| 774 | + $content['name'].'-'.egw_time::to('now', true), |
|
| 775 | 775 | //$content['name'] .'-'. rand(0,100), |
| 776 | 776 | ); |
| 777 | - foreach($suggestions as $key => $suggestion) { |
|
| 777 | + foreach ($suggestions as $key => $suggestion) { |
|
| 778 | 778 | $sug_definition = new importexport_definition($suggestion); |
| 779 | - if($sug_definition->definition_id) { |
|
| 779 | + if ($sug_definition->definition_id) { |
|
| 780 | 780 | unset($suggestions[$key]); |
| 781 | 781 | } |
| 782 | 782 | } |
| 783 | - if($suggestions) { |
|
| 784 | - $content['duplicate_error'] .= ' '. lang('Try')." \n" . implode("\n", $suggestions); |
|
| 783 | + if ($suggestions) { |
|
| 784 | + $content['duplicate_error'] .= ' '.lang('Try')." \n".implode("\n", $suggestions); |
|
| 785 | 785 | } |
| 786 | - return $this->get_step($content['step'],0); |
|
| 786 | + return $this->get_step($content['step'], 0); |
|
| 787 | 787 | } |
| 788 | 788 | } |
| 789 | 789 | |
@@ -793,19 +793,19 @@ discard block |
||
| 793 | 793 | switch (array_search('pressed', $content['button'])) |
| 794 | 794 | { |
| 795 | 795 | case 'next': |
| 796 | - return $this->get_step($content['step'],1); |
|
| 796 | + return $this->get_step($content['step'], 1); |
|
| 797 | 797 | case 'previous' : |
| 798 | - return $this->get_step($content['step'],-1); |
|
| 798 | + return $this->get_step($content['step'], -1); |
|
| 799 | 799 | case 'finish': |
| 800 | 800 | return 'wizard_finish'; |
| 801 | 801 | default : |
| 802 | - return $this->wizard_step21($content,$sel_options,$readonlys,$preserv); |
|
| 802 | + return $this->wizard_step21($content, $sel_options, $readonlys, $preserv); |
|
| 803 | 803 | } |
| 804 | 804 | } |
| 805 | 805 | // init step21 |
| 806 | 806 | else |
| 807 | 807 | { |
| 808 | - $content['text'] = $this->steps['wizard_step21'] . ($duplicate ? "\n".$content['duplicate_error'] : ''); |
|
| 808 | + $content['text'] = $this->steps['wizard_step21'].($duplicate ? "\n".$content['duplicate_error'] : ''); |
|
| 809 | 809 | $content['step'] = 'wizard_step21'; |
| 810 | 810 | unset($content['duplicate_error']); |
| 811 | 811 | $preserv = $content; |
@@ -817,17 +817,16 @@ discard block |
||
| 817 | 817 | // allowed users |
| 818 | 818 | function wizard_step90(&$content, &$sel_options, &$readonlys, &$preserv) |
| 819 | 819 | { |
| 820 | - if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step90->$content '.print_r($content,true)); |
|
| 820 | + if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step90->$content '.print_r($content, true)); |
|
| 821 | 821 | |
| 822 | 822 | // return from step90 |
| 823 | 823 | if ($content['step'] == 'wizard_step90') |
| 824 | 824 | { |
| 825 | - if($this->can_edit($content)) |
|
| 825 | + if ($this->can_edit($content)) |
|
| 826 | 826 | { |
| 827 | - $content['owner'] = $content['just_me'] || !$GLOBALS['egw']->acl->check('share_definitions', EGW_ACL_READ,'importexport') ? |
|
| 828 | - ($content['owner'] ? $content['owner'] : $GLOBALS['egw_info']['user']['account_id']) : |
|
| 829 | - null; |
|
| 830 | - $content['allowed_users'] = $content['just_me'] ? '' : ($content['all_users'] ? 'all' : implode(',',$content['allowed_users'])); |
|
| 827 | + $content['owner'] = $content['just_me'] || !$GLOBALS['egw']->acl->check('share_definitions', EGW_ACL_READ, 'importexport') ? |
|
| 828 | + ($content['owner'] ? $content['owner'] : $GLOBALS['egw_info']['user']['account_id']) : null; |
|
| 829 | + $content['allowed_users'] = $content['just_me'] ? '' : ($content['all_users'] ? 'all' : implode(',', $content['allowed_users'])); |
|
| 831 | 830 | unset($content['just_me']); |
| 832 | 831 | } |
| 833 | 832 | |
@@ -835,12 +834,12 @@ discard block |
||
| 835 | 834 | switch (array_search('pressed', $content['button'])) |
| 836 | 835 | { |
| 837 | 836 | case 'previous' : |
| 838 | - return $this->get_step($content['step'],-1); |
|
| 837 | + return $this->get_step($content['step'], -1); |
|
| 839 | 838 | case 'next': |
| 840 | 839 | case 'finish': |
| 841 | 840 | return 'wizard_finish'; |
| 842 | 841 | default : |
| 843 | - return $this->wizard_step90($content,$sel_options,$readonlys,$preserv); |
|
| 842 | + return $this->wizard_step90($content, $sel_options, $readonlys, $preserv); |
|
| 844 | 843 | } |
| 845 | 844 | } |
| 846 | 845 | // init step90 |
@@ -851,10 +850,10 @@ discard block |
||
| 851 | 850 | $preserv = $content; |
| 852 | 851 | |
| 853 | 852 | // Set owner for non-admins |
| 854 | - $content['just_me'] = ((!$content['allowed_users'] || !$content['allowed_users'][0] && count($content['allowed_users']) ==1) && $content['owner']); |
|
| 855 | - $content['all_users'] = is_array($content['allowed_users']) && array_key_exists('0',$content['allowed_users']) && $content['allowed_users'][0] == 'all' || |
|
| 853 | + $content['just_me'] = ((!$content['allowed_users'] || !$content['allowed_users'][0] && count($content['allowed_users']) == 1) && $content['owner']); |
|
| 854 | + $content['all_users'] = is_array($content['allowed_users']) && array_key_exists('0', $content['allowed_users']) && $content['allowed_users'][0] == 'all' || |
|
| 856 | 855 | $content['allowed_users'] == 'all'; |
| 857 | - if(!$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport') && !$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 856 | + if (!$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport') && !$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 858 | 857 | { |
| 859 | 858 | $content['allowed_users'] = array(); |
| 860 | 859 | $readonlys['allowed_users'] = true; |
@@ -870,11 +869,11 @@ discard block |
||
| 870 | 869 | ) |
| 871 | 870 | ); |
| 872 | 871 | // Hide 'just me' checkbox, users get confused by read-only |
| 873 | - if($readonlys['just_me'] || !$this->can_edit($content)) |
|
| 872 | + if ($readonlys['just_me'] || !$this->can_edit($content)) |
|
| 874 | 873 | { |
| 875 | 874 | $content['no_just_me'] = true; |
| 876 | 875 | } |
| 877 | - if($readonlys['all_users'] || !$this->can_edit($content)) |
|
| 876 | + if ($readonlys['all_users'] || !$this->can_edit($content)) |
|
| 878 | 877 | { |
| 879 | 878 | $content['no_all_users'] = true; |
| 880 | 879 | } |
@@ -887,7 +886,7 @@ discard block |
||
| 887 | 886 | |
| 888 | 887 | function wizard_finish(&$content) |
| 889 | 888 | { |
| 890 | - if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_finish->$content '.print_r($content,true)); |
|
| 889 | + if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_finish->$content '.print_r($content, true)); |
|
| 891 | 890 | // Take out some UI leavings |
| 892 | 891 | unset($content['text']); |
| 893 | 892 | unset($content['step']); |
@@ -897,26 +896,26 @@ discard block |
||
| 897 | 896 | $bodefinitions->save($content); |
| 898 | 897 | // This message is displayed if browser cant close window |
| 899 | 898 | $content['msg'] = lang('ImportExport wizard finished successfully!'); |
| 900 | - egw_framework::refresh_opener('','importexport'); |
|
| 899 | + egw_framework::refresh_opener('', 'importexport'); |
|
| 901 | 900 | egw_framework::window_close(); |
| 902 | 901 | return 'importexport.wizard_close'; |
| 903 | 902 | } |
| 904 | 903 | |
| 905 | - function import_definition($content='') |
|
| 904 | + function import_definition($content = '') |
|
| 906 | 905 | { |
| 907 | 906 | $bodefinitions = new importexport_definitions_bo(); |
| 908 | 907 | if (is_array($content)) |
| 909 | 908 | { |
| 910 | - if($content['import_file']['tmp_name']) |
|
| 909 | + if ($content['import_file']['tmp_name']) |
|
| 911 | 910 | { |
| 912 | 911 | $result = $bodefinitions->import($content['import_file']['tmp_name']); |
| 913 | - $msg = lang('%1 definitions %2', count($result), lang('imported')) ."\n". implode("\n", array_keys($result)); |
|
| 912 | + $msg = lang('%1 definitions %2', count($result), lang('imported'))."\n".implode("\n", array_keys($result)); |
|
| 914 | 913 | return $this->index(null, $msg); |
| 915 | 914 | } |
| 916 | - if($content['update']) |
|
| 915 | + if ($content['update']) |
|
| 917 | 916 | { |
| 918 | 917 | $applist = importexport_helper_functions::get_apps('all', true); |
| 919 | - foreach($applist as $appname) { |
|
| 918 | + foreach ($applist as $appname) { |
|
| 920 | 919 | importexport_helper_functions::load_defaults($appname); |
| 921 | 920 | } |
| 922 | 921 | return $this->index(); |
@@ -926,7 +925,7 @@ discard block |
||
| 926 | 925 | { |
| 927 | 926 | $content = array(); |
| 928 | 927 | $etpl = new etemplate(self::_appname.'.import_definition'); |
| 929 | - return $etpl->exec(self::_appname.'.importexport_definitions_ui.import_definition',$content,array(),$readonlys,$preserv); |
|
| 928 | + return $etpl->exec(self::_appname.'.importexport_definitions_ui.import_definition', $content, array(), $readonlys, $preserv); |
|
| 930 | 929 | } |
| 931 | 930 | } |
| 932 | 931 | |
@@ -936,17 +935,17 @@ discard block |
||
| 936 | 935 | */ |
| 937 | 936 | protected function can_edit(Array $definition) |
| 938 | 937 | { |
| 939 | - if($definition['owner'] && $definition['owner'] == $GLOBALS['egw_info']['user']['account_id']) |
|
| 938 | + if ($definition['owner'] && $definition['owner'] == $GLOBALS['egw_info']['user']['account_id']) |
|
| 940 | 939 | { |
| 941 | 940 | // Definition belongs to user |
| 942 | 941 | return true; |
| 943 | 942 | } |
| 944 | - elseif($definition['definition_id'] && !$definition['owner'] && $GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 943 | + elseif ($definition['definition_id'] && !$definition['owner'] && $GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 945 | 944 | { |
| 946 | 945 | // Definition is unowned, and user is an admin |
| 947 | 946 | return true; |
| 948 | 947 | } |
| 949 | - elseif(!$definition['definition_id']) |
|
| 948 | + elseif (!$definition['definition_id']) |
|
| 950 | 949 | { |
| 951 | 950 | // Definition is in-progress, not saved yet |
| 952 | 951 | return true; |
@@ -959,26 +958,26 @@ discard block |
||
| 959 | 958 | */ |
| 960 | 959 | public function site_config($content = array()) |
| 961 | 960 | { |
| 962 | - if(!$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 961 | + if (!$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 963 | 962 | { |
| 964 | 963 | egw::redirect_link('/home'); |
| 965 | 964 | } |
| 966 | - if($content['save']) |
|
| 965 | + if ($content['save']) |
|
| 967 | 966 | { |
| 968 | 967 | unset($content['save']); |
| 969 | 968 | |
| 970 | 969 | // ACL |
| 971 | - $GLOBALS['egw']->acl->delete_repository(self::_appname, 'definition',false); |
|
| 972 | - $GLOBALS['egw']->acl->delete_repository(self::_appname, 'share_definition',false); |
|
| 970 | + $GLOBALS['egw']->acl->delete_repository(self::_appname, 'definition', false); |
|
| 971 | + $GLOBALS['egw']->acl->delete_repository(self::_appname, 'share_definition', false); |
|
| 973 | 972 | |
| 974 | - foreach($content['share_definition'] as $group) |
|
| 973 | + foreach ($content['share_definition'] as $group) |
|
| 975 | 974 | { |
| 976 | - $GLOBALS['egw']->acl->add_repository(self::_appname, 'share_definition', $group,EGW_ACL_READ); |
|
| 975 | + $GLOBALS['egw']->acl->add_repository(self::_appname, 'share_definition', $group, EGW_ACL_READ); |
|
| 977 | 976 | } |
| 978 | 977 | unset($content['share_definition']); |
| 979 | 978 | |
| 980 | 979 | // Other config |
| 981 | - foreach($content as $key=>$value) |
|
| 980 | + foreach ($content as $key=>$value) |
|
| 982 | 981 | { |
| 983 | 982 | config::save_value($key, $value, 'importexport'); |
| 984 | 983 | } |
@@ -988,18 +987,18 @@ discard block |
||
| 988 | 987 | |
| 989 | 988 | $data = config::read(self::_appname); |
| 990 | 989 | $data['share_definition'] = $GLOBALS['egw']->acl->get_ids_for_location('share_definition', EGW_ACL_READ, self::_appname); |
| 991 | - $sel_options['import_charsets'] = array_combine(mb_list_encodings(),mb_list_encodings()); |
|
| 990 | + $sel_options['import_charsets'] = array_combine(mb_list_encodings(), mb_list_encodings()); |
|
| 992 | 991 | |
| 993 | 992 | // Remove 'standard' encodings to prevent doubles |
| 994 | - foreach($GLOBALS['egw']->translation->get_installed_charsets() as $charset => $label) |
|
| 993 | + foreach ($GLOBALS['egw']->translation->get_installed_charsets() as $charset => $label) |
|
| 995 | 994 | { |
| 996 | 995 | unset($sel_options['import_charsets'][strtoupper($charset)]); |
| 997 | 996 | } |
| 998 | 997 | |
| 999 | - if(!$data['update']) $data['update'] = 'request'; |
|
| 998 | + if (!$data['update']) $data['update'] = 'request'; |
|
| 1000 | 999 | |
| 1001 | - $GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration') . ' - ' . lang(self::_appname); |
|
| 1000 | + $GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration').' - '.lang(self::_appname); |
|
| 1002 | 1001 | $etpl = new etemplate(self::_appname.'.config'); |
| 1003 | - $etpl->exec(self::_appname.'.importexport_definitions_ui.site_config',$data,$sel_options,$readonlys,$preserv); |
|
| 1002 | + $etpl->exec(self::_appname.'.importexport_definitions_ui.site_config', $data, $sel_options, $readonlys, $preserv); |
|
| 1004 | 1003 | } |
| 1005 | 1004 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param egw_record $_definition |
| 31 | 31 | */ |
| 32 | - public function export( $_stream, importexport_definition $_definition) |
|
| 32 | + public function export($_stream, importexport_definition $_definition) |
|
| 33 | 33 | { |
| 34 | 34 | $options = $_definition->plugin_options; |
| 35 | 35 | |
@@ -41,46 +41,46 @@ discard block |
||
| 41 | 41 | $this->export_object->set_mapping($options['mapping']); |
| 42 | 42 | |
| 43 | 43 | $ids = array(); |
| 44 | - switch($options['selection']) |
|
| 44 | + switch ($options['selection']) |
|
| 45 | 45 | { |
| 46 | 46 | case 'search': |
| 47 | - $query = array_merge((array)$GLOBALS['egw']->session->appsession('session_data','infolog'), $query); |
|
| 47 | + $query = array_merge((array)$GLOBALS['egw']->session->appsession('session_data', 'infolog'), $query); |
|
| 48 | 48 | // Fall through |
| 49 | 49 | case 'filter': |
| 50 | 50 | case 'all': |
| 51 | 51 | // do we need to query the cf's |
| 52 | 52 | $query['custom_fields'] = false; |
| 53 | - foreach($options['mapping'] + (array)$_definition->filter as $field => $map) { |
|
| 54 | - if($field[0] == '#') |
|
| 53 | + foreach ($options['mapping'] + (array)$_definition->filter as $field => $map) { |
|
| 54 | + if ($field[0] == '#') |
|
| 55 | 55 | { |
| 56 | 56 | $query['custom_fields'] = true; |
| 57 | 57 | $query['selectcols'] .= ",$field"; |
| 58 | 58 | |
| 59 | - if($GLOBALS['egw_info']['user']['apps'][$this->bo->customfields[substr($field,1)]['type']]) |
|
| 59 | + if ($GLOBALS['egw_info']['user']['apps'][$this->bo->customfields[substr($field, 1)]['type']]) |
|
| 60 | 60 | { |
| 61 | - $cf_links[$field] = $this->bo->customfields[substr($field,1)]['type']; |
|
| 61 | + $cf_links[$field] = $this->bo->customfields[substr($field, 1)]['type']; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | - if($options['selection'] == 'filter') |
|
| 65 | + if ($options['selection'] == 'filter') |
|
| 66 | 66 | { |
| 67 | 67 | $fields = importexport_helper_functions::get_filter_fields($_definition->application, $this); |
| 68 | 68 | $query['col_filter'] = $_definition->filter; |
| 69 | 69 | |
| 70 | 70 | // Backend expects a string |
| 71 | - if($query['col_filter']['info_responsible']) |
|
| 71 | + if ($query['col_filter']['info_responsible']) |
|
| 72 | 72 | { |
| 73 | - $query['col_filter']['info_responsible'] = implode(',',$query['col_filter']['info_responsible']); |
|
| 73 | + $query['col_filter']['info_responsible'] = implode(',', $query['col_filter']['info_responsible']); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Handle ranges |
| 77 | - foreach($query['col_filter'] as $field => $value) |
|
| 77 | + foreach ($query['col_filter'] as $field => $value) |
|
| 78 | 78 | { |
| 79 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
| 79 | + if (!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
| 80 | 80 | |
| 81 | 81 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
| 82 | - if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
| 83 | - if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
| 82 | + if ($value['from']) $query['col_filter'][] = "$field >= ".(int)$value['from']; |
|
| 83 | + if ($value['to']) $query['col_filter'][] = "$field <= ".(int)$value['to']; |
|
| 84 | 84 | unset($query['col_filter'][$field]); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // Pre-load any cfs that are links |
| 95 | 95 | $cf_preload = array(); |
| 96 | - foreach($cf_links as $field => $app) |
|
| 96 | + foreach ($cf_links as $field => $app) |
|
| 97 | 97 | { |
| 98 | - foreach($selection as &$row) |
|
| 98 | + foreach ($selection as &$row) |
|
| 99 | 99 | { |
| 100 | - if($row[$field]) $cf_preload[$app][] = $row[$field]; |
|
| 100 | + if ($row[$field]) $cf_preload[$app][] = $row[$field]; |
|
| 101 | 101 | } |
| 102 | - if($cf_preload[$app]){ |
|
| 102 | + if ($cf_preload[$app]) { |
|
| 103 | 103 | $selects[$field] = egw_link::titles($app, $cf_preload[$app]); |
| 104 | 104 | //error_log('Preload ' . $field . '['.$app . ']: ' . implode(',',$cf_preload[$app])); |
| 105 | 105 | } |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $this->export_records($this->export_object, $options, $selection, $ids); |
| 109 | 109 | $query['start'] += $query['num_rows']; |
| 110 | - } while($query['start'] < $query['total']); |
|
| 110 | + } while ($query['start'] < $query['total']); |
|
| 111 | 111 | |
| 112 | 112 | return $this->export_object; |
| 113 | 113 | break; |
| 114 | 114 | default: |
| 115 | - $ids = $selection = explode(',',$options['selection']); |
|
| 115 | + $ids = $selection = explode(',', $options['selection']); |
|
| 116 | 116 | $this->export_records($this->export_object, $options, $selection, $ids); |
| 117 | 117 | break; |
| 118 | 118 | } |
@@ -122,38 +122,38 @@ discard block |
||
| 122 | 122 | protected function export_records(&$export_object, $options, &$selection, $ids = array()) |
| 123 | 123 | { |
| 124 | 124 | // Pre-load links all at once |
| 125 | - if($ids && $options['mapping']['info_link_id']) |
|
| 125 | + if ($ids && $options['mapping']['info_link_id']) |
|
| 126 | 126 | { |
| 127 | 127 | $links = egw_link::get_links_multiple('infolog', $ids, true, '!'.egw_link::VFS_APPNAME); |
| 128 | - foreach($links as $id => $link) { |
|
| 129 | - if(!is_array($selection[$id])) break; |
|
| 128 | + foreach ($links as $id => $link) { |
|
| 129 | + if (!is_array($selection[$id])) break; |
|
| 130 | 130 | $selection[$id]['info_link_id'] = $link = array_pop($link); |
| 131 | - if(!$options['convert']) |
|
| 131 | + if (!$options['convert']) |
|
| 132 | 132 | { |
| 133 | - $selection[$id]['info_link_id'] = $link['app'].':'. $link['id']; |
|
| 133 | + $selection[$id]['info_link_id'] = $link['app'].':'.$link['id']; |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | // If exporting PM fields, pre-load them all at once |
| 138 | - if($ids && ($options['mapping']['pm_id'] || $options['mapping']['project'])) |
|
| 138 | + if ($ids && ($options['mapping']['pm_id'] || $options['mapping']['project'])) |
|
| 139 | 139 | { |
| 140 | 140 | $projects = egw_link::get_links_multiple('infolog', $ids, true, 'projectmanager'); |
| 141 | - foreach($projects as $id => $links) |
|
| 141 | + foreach ($projects as $id => $links) |
|
| 142 | 142 | { |
| 143 | - if(!is_array($selection[$id])) break; |
|
| 143 | + if (!is_array($selection[$id])) break; |
|
| 144 | 144 | $selection[$id]['pm_id'] = current($links); |
| 145 | 145 | $selection[$id]['project'] = egw_link::title('projectmanager', $selection[$id]['pm_id']); |
| 146 | - $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',$selection[$id]['pm_id']); |
|
| 146 | + $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist', $selection[$id]['pm_id']); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | foreach ($selection as $_identifier) |
| 151 | 151 | { |
| 152 | - if(!is_array($_identifier)) |
|
| 152 | + if (!is_array($_identifier)) |
|
| 153 | 153 | { |
| 154 | 154 | $record = new infolog_egw_record($_identifier); |
| 155 | - if($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
| 156 | - if($project = $projects[$record->info_id]) |
|
| 155 | + if ($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
| 156 | + if ($project = $projects[$record->info_id]) |
|
| 157 | 157 | { |
| 158 | 158 | $record->pm_id = current($project); |
| 159 | 159 | $record->project = egw_link::title('projectmanager', $record->pm_id); |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | $record->set_record($_identifier); |
| 166 | 166 | } |
| 167 | 167 | // Some conversion |
| 168 | - if($options['convert']) |
|
| 168 | + if ($options['convert']) |
|
| 169 | 169 | { |
| 170 | 170 | $this->selects['info_status'] = $this->bo->get_status($record->info_type); |
| 171 | 171 | importexport_export_csv::convert($record, infolog_egw_record::$types, 'infolog', $this->selects); |
| 172 | 172 | $this->convert($record); |
| 173 | 173 | |
| 174 | 174 | // Force 0 times to '' |
| 175 | - foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field) |
|
| 175 | + foreach (array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field) |
|
| 176 | 176 | { |
| 177 | - if($record->$field == 0) $record->$field = ''; |
|
| 177 | + if ($record->$field == 0) $record->$field = ''; |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | else |
| 181 | 181 | { |
| 182 | 182 | // Implode arrays, so they don't say 'Array' |
| 183 | - foreach($record->get_record_array() as $key => $value) |
|
| 183 | + foreach ($record->get_record_array() as $key => $value) |
|
| 184 | 184 | { |
| 185 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
| 185 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | $export_object->export_record($record); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function get_filename() |
| 233 | 233 | { |
| 234 | - if(is_object($this->export_object) && $this->export_object->get_num_of_records() == 1) |
|
| 234 | + if (is_object($this->export_object) && $this->export_object->get_num_of_records() == 1) |
|
| 235 | 235 | { |
| 236 | 236 | return $this->export_object->record->get_title(); |
| 237 | 237 | } |
@@ -263,18 +263,18 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $this->selects['info_type'] = $this->bo->enums['type']; |
| 265 | 265 | $this->selects['info_priority'] = $this->bo->enums['priority']; |
| 266 | - $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',false); |
|
| 266 | + $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist', false); |
|
| 267 | 267 | $this->selects['info_status'] = $this->bo->get_status(); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | public function get_filter_fields(Array &$filters) |
| 271 | 271 | { |
| 272 | - foreach($filters as $field_name => &$settings) |
|
| 272 | + foreach ($filters as $field_name => &$settings) |
|
| 273 | 273 | { |
| 274 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
| 274 | + if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
| 275 | 275 | |
| 276 | 276 | // Infolog can't handle ranges in custom fields due to the way searching is done. |
| 277 | - if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) unset($filters[$field_name]); |
|
| 277 | + if (strpos($field_name, '#') === 0 && strpos($settings['type'], 'date') === 0) unset($filters[$field_name]); |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * This is for something specific to Infolog, in addition to the normal conversions. |
| 285 | 285 | */ |
| 286 | - public static function convert(infolog_egw_record &$record) |
|
| 286 | + public static function convert(infolog_egw_record&$record) |
|
| 287 | 287 | { |
| 288 | 288 | // Stub, for now |
| 289 | 289 | } |
@@ -18,7 +18,8 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public function __construct() { |
|
| 21 | + public function __construct() |
|
| 22 | + { |
|
| 22 | 23 | translation::add_app('infolog'); |
| 23 | 24 | $this->bo = new infolog_bo(); |
| 24 | 25 | $this->get_selects(); |
@@ -50,7 +51,8 @@ discard block |
||
| 50 | 51 | case 'all': |
| 51 | 52 | // do we need to query the cf's |
| 52 | 53 | $query['custom_fields'] = false; |
| 53 | - foreach($options['mapping'] + (array)$_definition->filter as $field => $map) { |
|
| 54 | + foreach($options['mapping'] + (array)$_definition->filter as $field => $map) |
|
| 55 | + { |
|
| 54 | 56 | if($field[0] == '#') |
| 55 | 57 | { |
| 56 | 58 | $query['custom_fields'] = true; |
@@ -76,11 +78,20 @@ discard block |
||
| 76 | 78 | // Handle ranges |
| 77 | 79 | foreach($query['col_filter'] as $field => $value) |
| 78 | 80 | { |
| 79 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
| 81 | + if(!is_array($value) || (!$value['from'] && !$value['to'])) |
|
| 82 | + { |
|
| 83 | + continue; |
|
| 84 | + } |
|
| 80 | 85 | |
| 81 | 86 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
| 82 | - if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
| 83 | - if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
| 87 | + if($value['from']) |
|
| 88 | + { |
|
| 89 | + $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
| 90 | + } |
|
| 91 | + if($value['to']) |
|
| 92 | + { |
|
| 93 | + $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
| 94 | + } |
|
| 84 | 95 | unset($query['col_filter'][$field]); |
| 85 | 96 | } |
| 86 | 97 | } |
@@ -97,9 +108,13 @@ discard block |
||
| 97 | 108 | { |
| 98 | 109 | foreach($selection as &$row) |
| 99 | 110 | { |
| 100 | - if($row[$field]) $cf_preload[$app][] = $row[$field]; |
|
| 111 | + if($row[$field]) |
|
| 112 | + { |
|
| 113 | + $cf_preload[$app][] = $row[$field]; |
|
| 114 | + } |
|
| 101 | 115 | } |
| 102 | - if($cf_preload[$app]){ |
|
| 116 | + if($cf_preload[$app]) |
|
| 117 | + { |
|
| 103 | 118 | $selects[$field] = egw_link::titles($app, $cf_preload[$app]); |
| 104 | 119 | //error_log('Preload ' . $field . '['.$app . ']: ' . implode(',',$cf_preload[$app])); |
| 105 | 120 | } |
@@ -125,8 +140,12 @@ discard block |
||
| 125 | 140 | if($ids && $options['mapping']['info_link_id']) |
| 126 | 141 | { |
| 127 | 142 | $links = egw_link::get_links_multiple('infolog', $ids, true, '!'.egw_link::VFS_APPNAME); |
| 128 | - foreach($links as $id => $link) { |
|
| 129 | - if(!is_array($selection[$id])) break; |
|
| 143 | + foreach($links as $id => $link) |
|
| 144 | + { |
|
| 145 | + if(!is_array($selection[$id])) |
|
| 146 | + { |
|
| 147 | + break; |
|
| 148 | + } |
|
| 130 | 149 | $selection[$id]['info_link_id'] = $link = array_pop($link); |
| 131 | 150 | if(!$options['convert']) |
| 132 | 151 | { |
@@ -140,7 +159,10 @@ discard block |
||
| 140 | 159 | $projects = egw_link::get_links_multiple('infolog', $ids, true, 'projectmanager'); |
| 141 | 160 | foreach($projects as $id => $links) |
| 142 | 161 | { |
| 143 | - if(!is_array($selection[$id])) break; |
|
| 162 | + if(!is_array($selection[$id])) |
|
| 163 | + { |
|
| 164 | + break; |
|
| 165 | + } |
|
| 144 | 166 | $selection[$id]['pm_id'] = current($links); |
| 145 | 167 | $selection[$id]['project'] = egw_link::title('projectmanager', $selection[$id]['pm_id']); |
| 146 | 168 | $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',$selection[$id]['pm_id']); |
@@ -152,7 +174,10 @@ discard block |
||
| 152 | 174 | if(!is_array($_identifier)) |
| 153 | 175 | { |
| 154 | 176 | $record = new infolog_egw_record($_identifier); |
| 155 | - if($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
| 177 | + if($link = $links[$record->info_id]) |
|
| 178 | + { |
|
| 179 | + $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
| 180 | + } |
|
| 156 | 181 | if($project = $projects[$record->info_id]) |
| 157 | 182 | { |
| 158 | 183 | $record->pm_id = current($project); |
@@ -174,7 +199,10 @@ discard block |
||
| 174 | 199 | // Force 0 times to '' |
| 175 | 200 | foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field) |
| 176 | 201 | { |
| 177 | - if($record->$field == 0) $record->$field = ''; |
|
| 202 | + if($record->$field == 0) |
|
| 203 | + { |
|
| 204 | + $record->$field = ''; |
|
| 205 | + } |
|
| 178 | 206 | } |
| 179 | 207 | } |
| 180 | 208 | else |
@@ -182,7 +210,10 @@ discard block |
||
| 182 | 210 | // Implode arrays, so they don't say 'Array' |
| 183 | 211 | foreach($record->get_record_array() as $key => $value) |
| 184 | 212 | { |
| 185 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
| 213 | + if(is_array($value)) |
|
| 214 | + { |
|
| 215 | + $record->$key = implode(',', $value); |
|
| 216 | + } |
|
| 186 | 217 | } |
| 187 | 218 | } |
| 188 | 219 | $export_object->export_record($record); |
@@ -271,10 +302,16 @@ discard block |
||
| 271 | 302 | { |
| 272 | 303 | foreach($filters as $field_name => &$settings) |
| 273 | 304 | { |
| 274 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
| 305 | + if($this->selects[$field_name]) |
|
| 306 | + { |
|
| 307 | + $settings['values'] = $this->selects[$field_name]; |
|
| 308 | + } |
|
| 275 | 309 | |
| 276 | 310 | // Infolog can't handle ranges in custom fields due to the way searching is done. |
| 277 | - if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) unset($filters[$field_name]); |
|
| 311 | + if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) |
|
| 312 | + { |
|
| 313 | + unset($filters[$field_name]); |
|
| 314 | + } |
|
| 278 | 315 | } |
| 279 | 316 | } |
| 280 | 317 | |