Code Duplication    Length = 62-70 lines in 2 locations

src/controllers/TypesController.php 1 location

@@ 23-84 (lines=62) @@
20
    /**
21
     * Default method to render the controller according to the action parameter.
22
     */
23
    public function render()
24
    {
25
        if ('tree' == $this->action) {
26
            return $this->doTree();
27
        }
28
29
        $this->printHeader();
30
        $this->printBody();
31
32
        switch ($this->action) {
33
            case 'create_comp':
34
                if (isset($_POST['cancel'])) {
35
                    $this->doDefault();
36
                } else {
37
                    $this->doCreateComposite();
38
                }
39
40
                break;
41
            case 'create_enum':
42
                if (isset($_POST['cancel'])) {
43
                    $this->doDefault();
44
                } else {
45
                    $this->doCreateEnum();
46
                }
47
48
                break;
49
            case 'save_create':
50
                if (isset($_POST['cancel'])) {
51
                    $this->doDefault();
52
                } else {
53
                    $this->doSaveCreate();
54
                }
55
56
                break;
57
            case 'create':
58
                $this->doCreate();
59
60
                break;
61
            case 'drop':
62
                if (isset($_POST['cancel'])) {
63
                    $this->doDefault();
64
                } else {
65
                    $this->doDrop(false);
66
                }
67
68
                break;
69
            case 'confirm_drop':
70
                $this->doDrop(true);
71
72
                break;
73
            case 'properties':
74
                $this->doProperties();
75
76
                break;
77
            default:
78
                $this->doDefault();
79
80
                break;
81
        }
82
83
        return $this->printFooter();
84
    }
85
86
    /**
87
     * Show default list of types in the database.

src/controllers/ViewpropertiesController.php 1 location

@@ 25-94 (lines=70) @@
22
    /**
23
     * Default method to render the controller according to the action parameter.
24
     */
25
    public function render()
26
    {
27
        if ('tree' == $this->action) {
28
            return $this->doTree();
29
        }
30
31
        $this->printHeader($this->headerTitle('', '', $_REQUEST[$this->subject]));
32
        $this->printBody();
33
34
        switch ($this->action) {
35
            case 'save_edit':
36
                if (isset($_POST['cancel'])) {
37
                    $this->doDefinition();
38
                } else {
39
                    $this->doSaveEdit();
40
                }
41
42
                break;
43
            case 'edit':
44
                $this->doEdit();
45
46
                break;
47
            case 'export':
48
                $this->doExport();
49
50
                break;
51
            case 'definition':
52
                $this->doDefinition();
53
54
                break;
55
            case 'properties':
56
                if (isset($_POST['cancel'])) {
57
                    $this->doDefault();
58
                } else {
59
                    $this->doProperties();
60
                }
61
62
                break;
63
            case 'alter':
64
                if (isset($_POST['alter'])) {
65
                    $this->doAlter(false);
66
                } else {
67
                    $this->doDefault();
68
                }
69
70
                break;
71
            case 'confirm_alter':
72
                $this->doAlter(true);
73
74
                break;
75
            /*case 'drop':
76
            if (isset($_POST['drop'])) {
77
            $this->doDrop(false);
78
            } else {
79
            $this->doDefault();
80
            }
81
82
            break;
83
            case 'confirm_drop':
84
            $this->doDrop(true);
85
86
            break;*/
87
            default:
88
                $this->doDefault();
89
90
                break;
91
        }
92
93
        $this->printFooter();
94
    }
95
96
    /**
97
     * Function to save after editing a view.