Ejemplo n.º 1
0
 /**
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_list($handler_id, array $args, array &$data)
 {
     midcom::get()->skip_page_style = true;
     if ($handler_id == 'mycontacts_xml') {
         midcom::get('auth')->require_valid_user('basic');
         midcom::get('cache')->content->content_type("text/xml; charset=UTF-8");
         midcom::get()->header("Content-type: text/xml; charset=UTF-8");
     } else {
         midcom::get('auth')->require_valid_user();
         $data['widget_config'] = midcom_helper_datamanager2_widget_autocomplete::get_widget_config('contact');
         $data['widget_config']['id_field'] = 'guid';
     }
     $mycontacts = new org_openpsa_contacts_mycontacts();
     $data['mycontacts'] = $mycontacts->list_members();
 }
Ejemplo n.º 2
0
 /**
  * Helper function that populates the toolbar with the necessary items
  *
  * @param string $handler_id the ID of the current handler
  */
 private function _populate_toolbar($handler_id)
 {
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "person/edit/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_contact->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e'));
     $siteconfig = org_openpsa_core_siteconfig::get_instance();
     $invoices_url = $siteconfig->get_node_full_url('org.openpsa.invoices');
     $user_url = $siteconfig->get_node_full_url('org.openpsa.user');
     if ($invoices_url && midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) {
         $billing_data_url = "create/" . $this->_contact->guid . "/";
         $qb_billing_data = org_openpsa_invoices_billing_data_dba::new_query_builder();
         $qb_billing_data->add_constraint('linkGuid', '=', $this->_contact->guid);
         $billing_data = $qb_billing_data->execute();
         if (count($billing_data) > 0) {
             $billing_data_url = $billing_data[0]->guid . "/";
         }
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $invoices_url . "billingdata/" . $billing_data_url, MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('edit billingdata'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_contact->can_do('midgard:update')));
     }
     if ($user_url && (midcom_connection::get_user() == $this->_contact->id || midcom::get('auth')->can_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface'))) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $user_url . "view/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('user management', 'org.openpsa.user'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png'));
     }
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "person/delete/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_contact->can_do('midgard:delete'), MIDCOM_TOOLBAR_ACCESSKEY => 'd'));
     $mycontacts = new org_openpsa_contacts_mycontacts();
     if ($mycontacts->is_member($this->_contact->guid)) {
         // We're buddies, show remove button
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "mycontacts/remove/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('remove from my contacts'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png'));
     } else {
         // We're not buddies, show add button
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "mycontacts/add/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('add to my contacts'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person.png'));
     }
 }