1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* EGroupware - Wizard for user CSV import |
4
|
|
|
* |
5
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
6
|
|
|
* @package calendar |
7
|
|
|
* @subpackage importexport |
8
|
|
|
* @link http://www.egroupware.org |
9
|
|
|
* @author Nathan Gray |
10
|
|
|
* @version $Id$ |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
use EGroupware\Api; |
14
|
|
|
|
15
|
|
|
class calendar_wizard_import_ical |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* List of steps. Key is the function, value is the translated title. |
19
|
|
|
*/ |
20
|
|
|
public $steps; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* List of eTemplates to use for each step. You can override this with your own etemplates steps. |
24
|
|
|
*/ |
25
|
|
|
protected $step_templates = array( |
26
|
|
|
'wizard_step55' => 'calendar.import.conditions' |
27
|
|
|
); |
28
|
|
|
/** |
29
|
|
|
* constructor |
30
|
|
|
*/ |
31
|
|
|
function __construct() |
32
|
|
|
{ |
33
|
|
|
$this->steps = array( |
34
|
|
|
'wizard_step55' => lang('Edit conditions'), |
35
|
|
|
); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
39
|
|
|
{ |
40
|
|
|
$result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv); |
41
|
|
|
$content['msg'] .= "\n*" ; |
42
|
|
|
|
43
|
|
|
return $result; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
// Conditions |
47
|
|
|
function wizard_step55(&$content, &$sel_options, &$readonlys, &$preserv) |
48
|
|
|
{ |
49
|
|
|
// return from step55 |
50
|
|
|
if ($content['step'] == 'wizard_step55') |
51
|
|
|
{ |
52
|
|
View Code Duplication |
switch (array_search('pressed', $content['button'])) |
53
|
|
|
{ |
54
|
|
|
case 'next': |
55
|
|
|
return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
56
|
|
|
case 'previous' : |
57
|
|
|
return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
58
|
|
|
case 'finish': |
59
|
|
|
return 'wizard_finish'; |
60
|
|
|
default : |
61
|
|
|
return $this->wizard_step55($content,$sel_options,$readonlys,$preserv); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
// init step30 |
65
|
|
|
else |
66
|
|
|
{ |
67
|
|
|
$content['text'] = $this->steps['wizard_step55']; |
68
|
|
|
$content['step'] = 'wizard_step55'; |
69
|
|
View Code Duplication |
if(!$content['skip_conflicts'] && array_key_exists('skip_conflicts', $content['plugin_options'])) |
70
|
|
|
{ |
71
|
|
|
$content['skip_conflicts'] = $content['plugin_options']['skip_conflicts']; |
72
|
|
|
} |
73
|
|
|
$preserv = $content; |
74
|
|
|
unset ($preserv['button']); |
75
|
|
|
|
76
|
|
|
// No real conditions, but we share a template |
77
|
|
|
$content['no_conditions'] = true; |
78
|
|
|
|
79
|
|
|
return $this->step_templates[$content['step']]; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
return $result; |
|
|
|
|
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.