Code Duplication    Length = 10-11 lines in 4 locations

lib/midgard/admin/asgard/toolbar.php 2 locations

@@ 65-74 (lines=10) @@
62
            }
63
        }
64
65
        if ($object->can_do('midgard:update'))
66
        {
67
            $buttons[] = array
68
            (
69
                MIDCOM_TOOLBAR_URL => $this->_generate_url('edit', $object),
70
                MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('edit', 'midcom'),
71
                MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
72
                MIDCOM_TOOLBAR_ACCESSKEY => 'e',
73
            );
74
        }
75
76
        if ($object->can_do('midgard:create'))
77
        {
@@ 169-178 (lines=10) @@
166
            }
167
        }
168
169
        if ($object->can_do('midgard:delete'))
170
        {
171
            $buttons[] = array
172
            (
173
                MIDCOM_TOOLBAR_URL => $this->_generate_url('delete', $object),
174
                MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('delete', 'midcom'),
175
                MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png',
176
                MIDCOM_TOOLBAR_ACCESSKEY => 'd',
177
            );
178
        }
179
180
        if (   midcom::get()->config->get('midcom_services_rcs_enable')
181
            && $object->can_do('midgard:update')

lib/org/openpsa/contacts/handler/frontpage.php 1 location

@@ 52-61 (lines=10) @@
49
        }
50
51
        $p_merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config);
52
        if ($p_merger->merge_needed())
53
        {
54
            $buttons[] = array
55
            (
56
                MIDCOM_TOOLBAR_URL => 'duplicates/person/',
57
                MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('merge persons'),
58
                MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/repair.png',
59
                MIDCOM_TOOLBAR_ENABLED => midcom::get()->auth->can_user_do('midgard:update', null, 'org_openpsa_contacts_person_dba'),
60
            );
61
        }
62
        $this->_view_toolbar->add_items($buttons);
63
64
        if (   $this->_topic->can_do('midgard:update')

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

@@ 149-159 (lines=11) @@
146
                MIDCOM_TOOLBAR_ENABLED => $this->_campaign->can_do('midgard:update'),
147
            );
148
        }
149
        else
150
        {
151
            // Import button if we have permissions to create users
152
            $buttons[] = array
153
            (
154
                MIDCOM_TOOLBAR_URL => "campaign/import/{$this->_campaign->guid}/",
155
                MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('import subscribers'),
156
                MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people.png',
157
                MIDCOM_TOOLBAR_ENABLED => midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba'),
158
            );
159
        }
160
        $buttons[] = array
161
        (
162
            MIDCOM_TOOLBAR_URL => "campaign/export/csv/{$this->_campaign->guid}/",