Code Duplication    Length = 10-12 lines in 10 locations

lib/net/nehmer/blog/handler/admin.php 1 location

@@ 77-87 (lines=11) @@
74
    /**
75
     * Internal helper, loads the controller for the current article. Any error triggers a 500.
76
     */
77
    private function _load_controller()
78
    {
79
        $this->_load_schemadb();
80
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
81
        $this->_controller->schemadb =& $this->_schemadb;
82
        $this->_controller->set_storage($this->_article);
83
        if (! $this->_controller->initialize())
84
        {
85
            throw new midcom_error("Failed to initialize a DM2 controller instance for article {$this->_article->id}.");
86
        }
87
    }
88
89
    /**
90
     * Displays an article edit view.

lib/net/nemein/wiki/handler/edit.php 1 location

@@ 59-69 (lines=11) @@
56
    /**
57
     * Internal helper, loads the controller for the current article. Any error triggers a 500.
58
     */
59
    private function _load_controller()
60
    {
61
        $this->_load_schemadb();
62
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
63
        $this->_controller->schemadb =& $this->_schemadb;
64
        $this->_controller->set_storage($this->_page);
65
        if (! $this->_controller->initialize())
66
        {
67
            throw new midcom_error("Failed to initialize a DM2 controller instance for article {$this->_article->id}.");
68
        }
69
    }
70
71
    /**
72
     * Check the edit request

lib/org/openpsa/contacts/handler/person/admin.php 1 location

@@ 58-68 (lines=11) @@
55
    /**
56
     * Internal helper, loads the controller for the current contact. Any error triggers a 500.
57
     */
58
    private function _load_controller()
59
    {
60
        $this->_load_schemadb();
61
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
62
        $this->_controller->schemadb =& $this->_schemadb;
63
        $this->_controller->set_storage($this->_contact, $this->_schema);
64
        if (! $this->_controller->initialize())
65
        {
66
            throw new midcom_error("Failed to initialize a DM2 controller instance for contact {$this->_contact->id}.");
67
        }
68
    }
69
70
    /**
71
     * Displays a contact edit view.

lib/org/openpsa/directmarketing/handler/campaign/admin.php 1 location

@@ 50-60 (lines=11) @@
47
    /**
48
     * Internal helper, loads the controller for the current campaign. Any error triggers a 500.
49
     */
50
    private function _load_controller()
51
    {
52
        $this->_load_schemadb();
53
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
54
        $this->_controller->schemadb =& $this->_schemadb;
55
        $this->_controller->set_storage($this->_campaign);
56
        if (! $this->_controller->initialize())
57
        {
58
            throw new midcom_error("Failed to initialize a DM2 controller instance for campaign {$this->_campaign->id}.");
59
        }
60
    }
61
62
    /**
63
     * Displays an campaign edit view.

lib/org/openpsa/directmarketing/handler/message/admin.php 1 location

@@ 50-60 (lines=11) @@
47
    /**
48
     * Internal helper, loads the controller for the current message. Any error triggers a 500.
49
     */
50
    private function _load_controller()
51
    {
52
        $this->_load_schemadb();
53
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
54
        $this->_controller->schemadb =& $this->_schemadb;
55
        $this->_controller->set_storage($this->_message);
56
        if (! $this->_controller->initialize())
57
        {
58
            throw new midcom_error("Failed to initialize a DM2 controller instance for message {$this->_message->id}.");
59
        }
60
    }
61
62
    /**
63
     * Displays an message edit view.

lib/org/openpsa/documents/handler/directory/edit.php 1 location

@@ 50-60 (lines=11) @@
47
    /**
48
     * Internal helper, loads the controller for the current directoy. Any error triggers a 500.
49
     */
50
    private function _load_edit_controller()
51
    {
52
        $this->_load_schemadb();
53
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
54
        $this->_controller->schemadb =& $this->_schemadb;
55
        $this->_controller->set_storage($this->_request_data['directory'], $this->_schema);
56
        if (! $this->_controller->initialize())
57
        {
58
            throw new midcom_error("Failed to initialize a DM2 controller instance for task {$this->_directory->id}.");
59
        }
60
    }
61
62
    /**
63
     * @param mixed $handler_id The ID of the handler.

lib/org/openpsa/documents/handler/document/admin.php 1 location

@@ 53-62 (lines=10) @@
50
    /**
51
     * Internal helper, loads the controller for the current document. Any error triggers a 500.
52
     */
53
    private function _load_edit_controller()
54
    {
55
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
56
        $this->_controller->schemadb =& $this->_schemadb;
57
        $this->_controller->set_storage($this->_document, $this->_schema);
58
        if (! $this->_controller->initialize())
59
        {
60
            throw new midcom_error( "Failed to initialize a DM2 controller instance for document {$this->_document->id}.");
61
        }
62
    }
63
64
    private function _load_document($guid)
65
    {

lib/org/openpsa/reports/handler/base.php 2 locations

@@ 92-101 (lines=10) @@
89
    /**
90
     * Internal helper, loads the controller for the current salesproject. Any error triggers a 500.
91
     */
92
    private function _load_edit_controller()
93
    {
94
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
95
        $this->_controller->schemadb =& $this->_schemadb;
96
        $this->_controller->set_storage($this->_request_data['query'], 'default');
97
        if (! $this->_controller->initialize())
98
        {
99
            throw new midcom_error("Failed to initialize a DM2 controller instance for document {$this->_document->id}.");
100
        }
101
    }
102
103
    /**
104
     * This is what Datamanager calls to actually create a query
@@ 136-147 (lines=12) @@
133
    /**
134
     * Internal helper, fires up the creation mode controller. Any error triggers a 500.
135
     */
136
    private function _load_create_controller()
137
    {
138
        $this->_load_schemadb();
139
        $this->_controller = midcom_helper_datamanager2_controller::create('create');
140
        $this->_controller->schemadb =& $this->_schemadb;
141
        $this->_controller->schemaname = 'default';
142
        $this->_controller->callback_object =& $this;
143
        if (! $this->_controller->initialize())
144
        {
145
            throw new midcom_error("Failed to initialize a DM2 create controller.");
146
        }
147
    }
148
149
    /**
150
     * @param mixed $handler_id The ID of the handler.

lib/org/openpsa/sales/handler/edit.php 1 location

@@ 54-64 (lines=11) @@
51
    /**
52
     * Internal helper, loads the controller for the current salesproject. Any error triggers a 500.
53
     */
54
    private function _load_edit_controller()
55
    {
56
        $this->_load_schemadb();
57
        $this->_controller = midcom_helper_datamanager2_controller::create('simple');
58
        $this->_controller->schemadb =& $this->_schemadb;
59
        $this->_controller->set_storage($this->_salesproject, $this->_schema);
60
        if (! $this->_controller->initialize())
61
        {
62
            throw new midcom_error("Failed to initialize a DM2 controller instance for salesproject {$this->_salesproject->id}.");
63
        }
64
    }
65
66
    /**
67
     * Internal helper, fires up the creation mode controller. Any error triggers a 500.