@@ -42,30 +42,25 @@ discard block |
||
| 42 | 42 | $buttons = array(); |
| 43 | 43 | if ($this->_group->can_do('midgard:update')) |
| 44 | 44 | { |
| 45 | - $buttons = array |
|
| 46 | - ( |
|
| 47 | - $workflow->get_button("group/edit/{$this->_group->guid}/", array |
|
| 48 | - ( |
|
| 45 | + $buttons = array( |
|
| 46 | + $workflow->get_button("group/edit/{$this->_group->guid}/", array( |
|
| 49 | 47 | MIDCOM_TOOLBAR_ACCESSKEY => 'e', |
| 50 | 48 | )), |
| 51 | - $workflow->get_button("group/create/organization/{$this->_group->guid}/", array |
|
| 52 | - ( |
|
| 49 | + $workflow->get_button("group/create/organization/{$this->_group->guid}/", array( |
|
| 53 | 50 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create suborganization'), |
| 54 | 51 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
| 55 | 52 | )), |
| 56 | - $workflow->get_button("group/create/group/{$this->_group->guid}/", array |
|
| 57 | - ( |
|
| 53 | + $workflow->get_button("group/create/group/{$this->_group->guid}/", array( |
|
| 58 | 54 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create subgroup'), |
| 59 | 55 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
| 60 | 56 | )) |
| 61 | 57 | ); |
| 62 | 58 | } |
| 63 | 59 | |
| 64 | - if ( midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba') |
|
| 60 | + if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba') |
|
| 65 | 61 | && $this->_group->can_do('midgard:create')) |
| 66 | 62 | { |
| 67 | - $buttons[] = $workflow->get_button("person/create/{$this->_group->guid}/", array |
|
| 68 | - ( |
|
| 63 | + $buttons[] = $workflow->get_button("person/create/{$this->_group->guid}/", array( |
|
| 69 | 64 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), |
| 70 | 65 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', |
| 71 | 66 | )); |
@@ -73,11 +68,10 @@ discard block |
||
| 73 | 68 | |
| 74 | 69 | $siteconfig = org_openpsa_core_siteconfig::get_instance(); |
| 75 | 70 | $user_url = $siteconfig->get_node_full_url('org.openpsa.user'); |
| 76 | - if ( $user_url |
|
| 71 | + if ($user_url |
|
| 77 | 72 | && midcom::get()->auth->can_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface')) |
| 78 | 73 | { |
| 79 | - $buttons[] = array |
|
| 80 | - ( |
|
| 74 | + $buttons[] = array( |
|
| 81 | 75 | MIDCOM_TOOLBAR_URL => $user_url . "group/{$this->_group->guid}/", |
| 82 | 76 | MIDCOM_TOOLBAR_LABEL => $this->_i18n->get_string('user management', 'org.openpsa.user'), |
| 83 | 77 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png', |
@@ -103,8 +103,7 @@ discard block |
||
| 103 | 103 | if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) |
| 104 | 104 | { |
| 105 | 105 | midcom_show_style('show-group-other'); |
| 106 | - } |
|
| 107 | - else |
|
| 106 | + } else |
|
| 108 | 107 | { |
| 109 | 108 | midcom_show_style('show-group'); |
| 110 | 109 | } |
@@ -128,16 +127,14 @@ discard block |
||
| 128 | 127 | $data['group_tree'] = $this->_master->get_group_tree(); |
| 129 | 128 | $data['members_grid'] = new org_openpsa_widgets_grid('members_grid', 'json'); |
| 130 | 129 | org_openpsa_widgets_tree::add_head_elements(); |
| 131 | - } |
|
| 132 | - else |
|
| 130 | + } else |
|
| 133 | 131 | { |
| 134 | 132 | $this->_type = 'organization'; |
| 135 | 133 | $root_group = org_openpsa_contacts_interface::find_root_group(); |
| 136 | 134 | if ($this->_group->owner != $root_group->id) |
| 137 | 135 | { |
| 138 | 136 | $data['parent_group'] = $this->_group->get_parent(); |
| 139 | - } |
|
| 140 | - else |
|
| 137 | + } else |
|
| 141 | 138 | { |
| 142 | 139 | $data['parent_group'] = false; |
| 143 | 140 | } |
@@ -59,8 +59,7 @@ |
||
| 59 | 59 | |
| 60 | 60 | midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_l10n->get($this->_type))); |
| 61 | 61 | |
| 62 | - $workflow = $this->get_workflow('datamanager2', array |
|
| 63 | - ( |
|
| 62 | + $workflow = $this->get_workflow('datamanager2', array( |
|
| 64 | 63 | 'controller' => $this->get_controller('simple', $this->_group), |
| 65 | 64 | 'save_callback' => array($this, 'save_callback') |
| 66 | 65 | )); |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) |
| 52 | 52 | { |
| 53 | 53 | $this->_type = 'group'; |
| 54 | - } |
|
| 55 | - else |
|
| 54 | + } else |
|
| 56 | 55 | { |
| 57 | 56 | $this->_type = 'organization'; |
| 58 | 57 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $this->_group = new org_openpsa_contacts_group_dba(); |
| 76 | 76 | |
| 77 | - if ( $this->_type == 'organization' |
|
| 77 | + if ($this->_type == 'organization' |
|
| 78 | 78 | && $this->_parent_group) |
| 79 | 79 | { |
| 80 | 80 | $this->_group->owner = (int) $this->_parent_group->id; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | $this->_group->name = time(); |
| 88 | 88 | |
| 89 | - if (! $this->_group->create()) |
|
| 89 | + if (!$this->_group->create()) |
|
| 90 | 90 | { |
| 91 | 91 | debug_print_r('We operated on this object:', $this->_group); |
| 92 | 92 | throw new midcom_error("Failed to create a new group. Error: " . midcom_connection::get_error_string()); |
@@ -119,8 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_type))); |
| 121 | 121 | |
| 122 | - $workflow = $this->get_workflow('datamanager2', array |
|
| 123 | - ( |
|
| 122 | + $workflow = $this->get_workflow('datamanager2', array( |
|
| 124 | 123 | 'controller' => $this->get_controller('create'), |
| 125 | 124 | 'save_callback' => array($this, 'save_callback') |
| 126 | 125 | )); |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | // Set the default type to "department" |
| 56 | 56 | $defaults['object_type'] = org_openpsa_contacts_group_dba::DEPARTMENT; |
| 57 | - } |
|
| 58 | - else |
|
| 57 | + } else |
|
| 59 | 58 | { |
| 60 | 59 | $defaults['owner'] = org_openpsa_contacts_interface::find_root_group()->id; |
| 61 | 60 | } |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | && $this->_parent_group) |
| 79 | 78 | { |
| 80 | 79 | $this->_group->owner = (int) $this->_parent_group->id; |
| 81 | - } |
|
| 82 | - else |
|
| 80 | + } else |
|
| 83 | 81 | { |
| 84 | 82 | $root_group = org_openpsa_contacts_interface::find_root_group(); |
| 85 | 83 | $this->_group->owner = (int) $root_group->id; |
@@ -110,8 +108,7 @@ discard block |
||
| 110 | 108 | // Get the parent organization |
| 111 | 109 | $this->_parent_group = new org_openpsa_contacts_group_dba($args[1]); |
| 112 | 110 | $this->_parent_group->require_do('midgard:create'); |
| 113 | - } |
|
| 114 | - else |
|
| 111 | + } else |
|
| 115 | 112 | { |
| 116 | 113 | // This is a root level organization, require creation permissions under the component root group |
| 117 | 114 | midcom::get()->auth->require_user_do('midgard:create', null, 'org_openpsa_contacts_group_dba'); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // Handle automatic wildcards |
| 84 | 84 | $auto_wildcards = $this->_config->get('auto_wildcards'); |
| 85 | - if ( $auto_wildcards |
|
| 85 | + if ($auto_wildcards |
|
| 86 | 86 | && strpos($this->_query_string_processed, '%') === false) |
| 87 | 87 | { |
| 88 | 88 | switch ($auto_wildcards) |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function _show_search_type($handler_id, array &$data) |
| 134 | 134 | { |
| 135 | - if ( $this->_view == 'foaf' |
|
| 135 | + if ($this->_view == 'foaf' |
|
| 136 | 136 | && sizeof($this->_persons) > 0) |
| 137 | 137 | { |
| 138 | 138 | midcom_show_style('foaf-header'); |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | return $this->_prepare_json_reply(); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if ( count($this->_groups) == 1 |
|
| 172 | + if (count($this->_groups) == 1 |
|
| 173 | 173 | && count($this->_persons) == 0) |
| 174 | 174 | { |
| 175 | 175 | return new midcom_response_relocate('group/' . $this->_groups[0]->guid . '/'); |
| 176 | 176 | } |
| 177 | - if ( count($this->_groups) == 0 |
|
| 177 | + if (count($this->_groups) == 0 |
|
| 178 | 178 | && count($this->_persons) == 1) |
| 179 | 179 | { |
| 180 | 180 | return new midcom_response_relocate('person/' . $this->_persons[0]->guid . '/'); |
@@ -193,8 +193,7 @@ discard block |
||
| 193 | 193 | $data = array(); |
| 194 | 194 | foreach ($this->_persons as $person) |
| 195 | 195 | { |
| 196 | - $data[] = array |
|
| 197 | - ( |
|
| 196 | + $data[] = array( |
|
| 198 | 197 | 'category' => $this->_l10n->get('persons'), |
| 199 | 198 | 'label' => $person->get_label(), |
| 200 | 199 | 'value' => $person->get_label(), |
@@ -203,8 +202,7 @@ discard block |
||
| 203 | 202 | } |
| 204 | 203 | foreach ($this->_groups as $group) |
| 205 | 204 | { |
| 206 | - $data[] = array |
|
| 207 | - ( |
|
| 205 | + $data[] = array( |
|
| 208 | 206 | 'category' => $this->_l10n->get('groups'), |
| 209 | 207 | 'label' => $group->get_label(), |
| 210 | 208 | 'value' => $group->get_label(), |
@@ -222,21 +220,18 @@ discard block |
||
| 222 | 220 | $buttons = array(); |
| 223 | 221 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba')) |
| 224 | 222 | { |
| 225 | - $buttons[] = $workflow->get_button('person/create/', array |
|
| 226 | - ( |
|
| 223 | + $buttons[] = $workflow->get_button('person/create/', array( |
|
| 227 | 224 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), |
| 228 | 225 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', |
| 229 | 226 | )); |
| 230 | 227 | } |
| 231 | 228 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_group_dba')) |
| 232 | 229 | { |
| 233 | - $buttons[] = $workflow->get_button('group/create/organization/', array |
|
| 234 | - ( |
|
| 230 | + $buttons[] = $workflow->get_button('group/create/organization/', array( |
|
| 235 | 231 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create organization'), |
| 236 | 232 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
| 237 | 233 | )); |
| 238 | - $buttons[] = $workflow->get_button('group/create/group/', array |
|
| 239 | - ( |
|
| 234 | + $buttons[] = $workflow->get_button('group/create/group/', array( |
|
| 240 | 235 | MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('group')), |
| 241 | 236 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
| 242 | 237 | )); |
@@ -259,7 +254,7 @@ discard block |
||
| 259 | 254 | |
| 260 | 255 | midcom_show_style('search-header'); |
| 261 | 256 | |
| 262 | - if ( count($this->_groups) == 0 |
|
| 257 | + if (count($this->_groups) == 0 |
|
| 263 | 258 | && count($this->_persons) == 0 |
| 264 | 259 | && $this->_query_string) |
| 265 | 260 | { |
@@ -265,8 +265,7 @@ |
||
| 265 | 265 | { |
| 266 | 266 | //No results at all (from any of the queries) |
| 267 | 267 | midcom_show_style('search-empty'); |
| 268 | - } |
|
| 269 | - else |
|
| 268 | + } else |
|
| 270 | 269 | { |
| 271 | 270 | if (count($this->_groups) > 0) |
| 272 | 271 | { |
@@ -72,10 +72,8 @@ discard block |
||
| 72 | 72 | if ($data['person_rss_url']) |
| 73 | 73 | { |
| 74 | 74 | // We've autoprobed that this contact has a RSS feed available, link it |
| 75 | - midcom::get()->head->add_link_head |
|
| 76 | - ( |
|
| 77 | - array |
|
| 78 | - ( |
|
| 75 | + midcom::get()->head->add_link_head( |
|
| 76 | + array( |
|
| 79 | 77 | 'rel' => 'alternate', |
| 80 | 78 | 'type' => 'application/rss+xml', |
| 81 | 79 | 'title' => sprintf($this->_l10n->get('rss feed of person %s'), $this->_contact->name), |
@@ -105,8 +103,7 @@ discard block |
||
| 105 | 103 | $buttons = array(); |
| 106 | 104 | if ($this->_contact->can_do('midgard:update')) |
| 107 | 105 | { |
| 108 | - $buttons[] = $workflow->get_button("person/edit/{$this->_contact->guid}/", array |
|
| 109 | - ( |
|
| 106 | + $buttons[] = $workflow->get_button("person/edit/{$this->_contact->guid}/", array( |
|
| 110 | 107 | MIDCOM_TOOLBAR_ACCESSKEY => 'e', |
| 111 | 108 | )); |
| 112 | 109 | } |
@@ -115,24 +112,22 @@ discard block |
||
| 115 | 112 | $invoices_url = $siteconfig->get_node_full_url('org.openpsa.invoices'); |
| 116 | 113 | $user_url = $siteconfig->get_node_full_url('org.openpsa.user'); |
| 117 | 114 | |
| 118 | - if ( $invoices_url |
|
| 115 | + if ($invoices_url |
|
| 119 | 116 | && midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) |
| 120 | 117 | { |
| 121 | 118 | if ($this->_contact->can_do('midgard:update')) |
| 122 | 119 | { |
| 123 | - $buttons[] = $workflow->get_button($invoices_url . "billingdata/" . $this->_contact->guid . '/', array |
|
| 124 | - ( |
|
| 120 | + $buttons[] = $workflow->get_button($invoices_url . "billingdata/" . $this->_contact->guid . '/', array( |
|
| 125 | 121 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('edit billingdata'), |
| 126 | 122 | )); |
| 127 | 123 | } |
| 128 | 124 | } |
| 129 | 125 | |
| 130 | - if ( $user_url |
|
| 131 | - && ( midcom_connection::get_user() == $this->_contact->id |
|
| 126 | + if ($user_url |
|
| 127 | + && (midcom_connection::get_user() == $this->_contact->id |
|
| 132 | 128 | || midcom::get()->auth->can_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface'))) |
| 133 | 129 | { |
| 134 | - $buttons[] = array |
|
| 135 | - ( |
|
| 130 | + $buttons[] = array( |
|
| 136 | 131 | MIDCOM_TOOLBAR_URL => $user_url . "view/{$this->_contact->guid}/", |
| 137 | 132 | MIDCOM_TOOLBAR_LABEL => $this->_i18n->get_string('user management', 'org.openpsa.user'), |
| 138 | 133 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png', |
@@ -150,8 +145,7 @@ discard block |
||
| 150 | 145 | if ($mycontacts->is_member($this->_contact->guid)) |
| 151 | 146 | { |
| 152 | 147 | // We're buddies, show remove button |
| 153 | - $buttons[] = array |
|
| 154 | - ( |
|
| 148 | + $buttons[] = array( |
|
| 155 | 149 | MIDCOM_TOOLBAR_URL => "mycontacts/remove/{$this->_contact->guid}/", |
| 156 | 150 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('remove from my contacts'), |
| 157 | 151 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', |
@@ -160,8 +154,7 @@ discard block |
||
| 160 | 154 | else |
| 161 | 155 | { |
| 162 | 156 | // We're not buddies, show add button |
| 163 | - $buttons[] = array |
|
| 164 | - ( |
|
| 157 | + $buttons[] = array( |
|
| 165 | 158 | MIDCOM_TOOLBAR_URL => "mycontacts/add/{$this->_contact->guid}/", |
| 166 | 159 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('add to my contacts'), |
| 167 | 160 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person.png', |
@@ -215,7 +208,7 @@ discard block |
||
| 215 | 208 | public function _show_group_memberships($handler_id, array &$data) |
| 216 | 209 | { |
| 217 | 210 | // This is most likely a dynamic_load |
| 218 | - if ( count($data['organizations']) == 0 |
|
| 211 | + if (count($data['organizations']) == 0 |
|
| 219 | 212 | && count($data['groups']) == 0) |
| 220 | 213 | { |
| 221 | 214 | midcom_show_style('show-person-groups-empty'); |
@@ -156,8 +156,7 @@ discard block |
||
| 156 | 156 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('remove from my contacts'), |
| 157 | 157 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', |
| 158 | 158 | ); |
| 159 | - } |
|
| 160 | - else |
|
| 159 | + } else |
|
| 161 | 160 | { |
| 162 | 161 | // We're not buddies, show add button |
| 163 | 162 | $buttons[] = array |
@@ -220,8 +219,7 @@ discard block |
||
| 220 | 219 | { |
| 221 | 220 | midcom_show_style('show-person-groups-empty'); |
| 222 | 221 | |
| 223 | - } |
|
| 224 | - else |
|
| 222 | + } else |
|
| 225 | 223 | { |
| 226 | 224 | $this->_show_memberships('organizations'); |
| 227 | 225 | $this->_show_memberships('groups'); |
@@ -241,8 +239,7 @@ discard block |
||
| 241 | 239 | try |
| 242 | 240 | { |
| 243 | 241 | $this->_request_data['group'] = org_openpsa_contacts_group_dba::get_cached($member->gid); |
| 244 | - } |
|
| 245 | - catch (midcom_error $e) |
|
| 242 | + } catch (midcom_error $e) |
|
| 246 | 243 | { |
| 247 | 244 | $e->log(); |
| 248 | 245 | continue; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $this->_person = new org_openpsa_contacts_person_dba(); |
| 59 | 59 | |
| 60 | - if (! $this->_person->create()) |
|
| 60 | + if (!$this->_person->create()) |
|
| 61 | 61 | { |
| 62 | 62 | debug_print_r('We operated on this object:', $this->_person); |
| 63 | 63 | throw new midcom_error("Failed to create a new person, cannot continue. Error: " . midcom_connection::get_error_string()); |
@@ -84,8 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('person'))); |
| 86 | 86 | |
| 87 | - $workflow = $this->get_workflow('datamanager2', array |
|
| 88 | - ( |
|
| 87 | + $workflow = $this->get_workflow('datamanager2', array( |
|
| 89 | 88 | 'controller' => $this->get_controller('create'), |
| 90 | 89 | 'save_callback' => array($this, 'save_callback') |
| 91 | 90 | )); |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | if ($this->_group->orgOpenpsaObtype >= org_openpsa_contacts_group_dba::ORGANIZATION) |
| 42 | 42 | { |
| 43 | 43 | $defaults['organizations'] = array($this->_group->id); |
| 44 | - } |
|
| 45 | - else if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) |
|
| 44 | + } else if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) |
|
| 46 | 45 | { |
| 47 | 46 | $defaults['groups'] = array($this->_group->id); |
| 48 | 47 | } |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $this->_load_schemadb(); |
| 61 | 61 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
| 62 | - $this->_controller->schemadb =& $this->_schemadb; |
|
| 62 | + $this->_controller->schemadb = & $this->_schemadb; |
|
| 63 | 63 | $this->_controller->set_storage($this->_contact, $this->_schema); |
| 64 | - if (! $this->_controller->initialize()) |
|
| 64 | + if (!$this->_controller->initialize()) |
|
| 65 | 65 | { |
| 66 | 66 | throw new midcom_error("Failed to initialize a DM2 controller instance for contact {$this->_contact->id}."); |
| 67 | 67 | } |
@@ -82,8 +82,7 @@ discard block |
||
| 82 | 82 | $this->_load_controller(); |
| 83 | 83 | midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_l10n->get('person'))); |
| 84 | 84 | |
| 85 | - $workflow = $this->get_workflow('datamanager2', array |
|
| 86 | - ( |
|
| 85 | + $workflow = $this->get_workflow('datamanager2', array( |
|
| 87 | 86 | 'controller' => $this->_controller, |
| 88 | 87 | 'save_callback' => array($this, 'save_callback') |
| 89 | 88 | )); |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | $buttons = array(); |
| 28 | 28 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba')) |
| 29 | 29 | { |
| 30 | - $buttons[] = $workflow->get_button('person/create/', array |
|
| 31 | - ( |
|
| 30 | + $buttons[] = $workflow->get_button('person/create/', array( |
|
| 32 | 31 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), |
| 33 | 32 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', |
| 34 | 33 | )); |
@@ -36,13 +35,11 @@ discard block |
||
| 36 | 35 | |
| 37 | 36 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_group_dba')) |
| 38 | 37 | { |
| 39 | - $buttons[] = $workflow->get_button("group/create/organization/", array |
|
| 40 | - ( |
|
| 38 | + $buttons[] = $workflow->get_button("group/create/organization/", array( |
|
| 41 | 39 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create organization'), |
| 42 | 40 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
| 43 | 41 | )); |
| 44 | - $buttons[] = $workflow->get_button("group/create/group/", array |
|
| 45 | - ( |
|
| 42 | + $buttons[] = $workflow->get_button("group/create/group/", array( |
|
| 46 | 43 | MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('group')), |
| 47 | 44 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
| 48 | 45 | )); |
@@ -51,8 +48,7 @@ discard block |
||
| 51 | 48 | $p_merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config); |
| 52 | 49 | if ($p_merger->merge_needed()) |
| 53 | 50 | { |
| 54 | - $buttons[] = array |
|
| 55 | - ( |
|
| 51 | + $buttons[] = array( |
|
| 56 | 52 | MIDCOM_TOOLBAR_URL => 'duplicates/person/', |
| 57 | 53 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('merge persons'), |
| 58 | 54 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/repair.png', |
@@ -61,11 +57,10 @@ discard block |
||
| 61 | 57 | } |
| 62 | 58 | $this->_view_toolbar->add_items($buttons); |
| 63 | 59 | |
| 64 | - if ( $this->_topic->can_do('midgard:update') |
|
| 60 | + if ($this->_topic->can_do('midgard:update') |
|
| 65 | 61 | && $this->_topic->can_do('midcom:component_config')) |
| 66 | 62 | { |
| 67 | - $this->_node_toolbar->add_item($workflow->get_button('config/', array |
|
| 68 | - ( |
|
| 63 | + $this->_node_toolbar->add_item($workflow->get_button('config/', array( |
|
| 69 | 64 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
| 70 | 65 | MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'), |
| 71 | 66 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png', |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | private function load_next() |
| 47 | 47 | { |
| 48 | - $i =& $this->_request_data['loop_i']; |
|
| 48 | + $i = & $this->_request_data['loop_i']; |
|
| 49 | 49 | while ($i < 100) |
| 50 | 50 | { |
| 51 | 51 | debug_add("Loop iteration {$i}"); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | continue; |
| 80 | 80 | } |
| 81 | 81 | // Make sure we actually have enough rights to do this |
| 82 | - if ( !$person1->can_do('midgard:update') |
|
| 82 | + if (!$person1->can_do('midgard:update') |
|
| 83 | 83 | || !$person1->can_do('midgard:delete') |
| 84 | 84 | || !$person2->can_do('midgard:update') |
| 85 | 85 | || !$person2->can_do('midgard:delete')) |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | 91 | // Extra sanity check (in case of semi-successful not-duplicate mark) |
| 92 | - if ( $person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
| 92 | + if ($person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
| 93 | 93 | || $person2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person1->guid)) |
| 94 | 94 | { |
| 95 | 95 | debug_add("It seems these two (#{$person1->id} and #{$person2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | continue; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $this->_request_data['probability'] = (float)$param->value; |
|
| 100 | + $this->_request_data['probability'] = (float) $param->value; |
|
| 101 | 101 | $this->_request_data['person1'] = $person1; |
| 102 | 102 | $this->_request_data['person2'] = $person2; |
| 103 | 103 | break; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | private function process_submit() |
| 108 | 108 | { |
| 109 | - if ( !empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
| 109 | + if (!empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
| 110 | 110 | && !empty($_POST['org_openpsa_contacts_handler_duplicates_person_options']) |
| 111 | 111 | && count($_POST['org_openpsa_contacts_handler_duplicates_person_options']) == 2) |
| 112 | 112 | { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $option1->require_do('midgard:update'); |
| 119 | 119 | $option2->require_do('midgard:update'); |
| 120 | - if ( $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
| 120 | + if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
| 121 | 121 | && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) |
| 122 | 122 | { |
| 123 | 123 | // Clear the possible duplicate parameters |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | if ($keep == $option1->guid) |
| 143 | 143 | { |
| 144 | - $person1 =& $option1; |
|
| 145 | - $person2 =& $option2; |
|
| 144 | + $person1 = & $option1; |
|
| 145 | + $person2 = & $option2; |
|
| 146 | 146 | } |
| 147 | 147 | else if ($keep == $option2->guid) |
| 148 | 148 | { |
| 149 | - $person1 =& $option2; |
|
| 150 | - $person2 =& $option1; |
|
| 149 | + $person1 = & $option2; |
|
| 150 | + $person2 = & $option1; |
|
| 151 | 151 | } |
| 152 | 152 | else |
| 153 | 153 | { |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $person1 = new org_openpsa_contacts_person_dba($param->parentguid); |
| 74 | 74 | $person2 = new org_openpsa_contacts_person_dba($param->name); |
| 75 | - } |
|
| 76 | - catch (midcom_error $e) |
|
| 75 | + } catch (midcom_error $e) |
|
| 77 | 76 | { |
| 78 | 77 | $i++; |
| 79 | 78 | continue; |
@@ -126,8 +125,7 @@ discard block |
||
| 126 | 125 | |
| 127 | 126 | // TODO: Localize |
| 128 | 127 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), "Keeping both \"{$option1->name}\" and \"{$option2->name}\", they will not be marked as duplicates in the future", 'ok'); |
| 129 | - } |
|
| 130 | - else |
|
| 128 | + } else |
|
| 131 | 129 | { |
| 132 | 130 | $errstr = midcom_connection::get_error_string(); |
| 133 | 131 | // Failed to set as not duplicate, clear parameter that might have been set (could have only been the first) |
@@ -136,20 +134,17 @@ discard block |
||
| 136 | 134 | // TODO: Localize |
| 137 | 135 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), "Failed to mark #{$option1->id} and # {$option2->id} as not duplicates, errstr: {$errstr}", 'error'); |
| 138 | 136 | } |
| 139 | - } |
|
| 140 | - else |
|
| 137 | + } else |
|
| 141 | 138 | { |
| 142 | 139 | if ($keep == $option1->guid) |
| 143 | 140 | { |
| 144 | 141 | $person1 =& $option1; |
| 145 | 142 | $person2 =& $option2; |
| 146 | - } |
|
| 147 | - else if ($keep == $option2->guid) |
|
| 143 | + } else if ($keep == $option2->guid) |
|
| 148 | 144 | { |
| 149 | 145 | $person1 =& $option2; |
| 150 | 146 | $person2 =& $option1; |
| 151 | - } |
|
| 152 | - else |
|
| 147 | + } else |
|
| 153 | 148 | { |
| 154 | 149 | throw new midcom_error('Something weird happened (basically we got bogus data)'); |
| 155 | 150 | } |
@@ -160,8 +155,7 @@ discard block |
||
| 160 | 155 | { |
| 161 | 156 | $merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config); |
| 162 | 157 | $merger->merge_delete($person1, $person2); |
| 163 | - } |
|
| 164 | - catch (midcom_error $e) |
|
| 158 | + } catch (midcom_error $e) |
|
| 165 | 159 | { |
| 166 | 160 | // TODO: Localize |
| 167 | 161 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), 'Merge failed, errstr: ' . $e->getMessage(), 'error'); |
@@ -182,8 +176,7 @@ discard block |
||
| 182 | 176 | if (!$this->_request_data['notfound']) |
| 183 | 177 | { |
| 184 | 178 | midcom_show_style('show-duplicate-persons'); |
| 185 | - } |
|
| 186 | - else |
|
| 179 | + } else |
|
| 187 | 180 | { |
| 188 | 181 | midcom_show_style('show-duplicate-persons-notfound'); |
| 189 | 182 | } |