Beispiel #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_create($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     midcom::get('auth')->require_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba');
     if (count($args) > 0) {
         // Get the organization
         $this->_group = new org_openpsa_contacts_group_dba($args[0]);
         $this->_group->require_do('midgard:create');
         midcom::get('head')->set_pagetitle($this->_group->official);
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             // Index the person
             $indexer = new org_openpsa_contacts_midcom_indexer($this->_topic);
             $indexer->index($data['controller']->datamanager);
             return new midcom_response_relocate("person/{$this->_person->guid}/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_group, $this);
     $this->add_breadcrumb("", sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('person')));
 }
Beispiel #2
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_edit($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     // Check if we get the group
     $this->_group = new org_openpsa_contacts_group_dba($args[0]);
     $this->_group->require_do('midgard:update');
     if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) {
         $this->_type = 'group';
     } else {
         $this->_type = 'organization';
     }
     $data['controller'] = $this->get_controller('simple', $this->_group);
     switch ($data['controller']->process_form()) {
         case 'save':
             $indexer = new org_openpsa_contacts_midcom_indexer($this->_topic);
             $indexer->index($data['controller']->datamanager);
             // *** FALL-THROUGH ***
         // *** FALL-THROUGH ***
         case 'cancel':
             $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
             return new midcom_response_relocate($prefix . "group/" . $this->_group->guid . "/");
     }
     $root_group = org_openpsa_contacts_interface::find_root_group();
     if ($this->_group->owner && $this->_group->owner != $root_group->id) {
         $data['parent_group'] = new org_openpsa_contacts_group_dba($this->_group->owner);
     } else {
         $data['parent_group'] = false;
     }
     $data['group'] =& $this->_group;
     org_openpsa_helpers::dm2_savecancel($this);
     $this->bind_view_to_object($this->_group);
     midcom::get('head')->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_group->official));
     org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_group, $this);
     $this->add_breadcrumb("", sprintf($this->_l10n_midcom->get('edit %s'), $this->_l10n->get($this->_type)));
 }
Beispiel #3
0
 /**
  * Handler method for listing group members
  *
  * @param string $handler_id Name of the used handler
  * @param mixed $args Array containing the variable arguments passed to the handler
  * @param mixed &$data Data passed to the show method
  */
 public function _handler_view($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     // Get the requested group object
     $this->_group = new org_openpsa_contacts_group_dba($args[0]);
     $data['group'] = $this->_group;
     if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) {
         $this->_type = 'group';
         $data['group_tree'] = $this->_master->get_group_tree();
         $data['members_grid'] = new org_openpsa_widgets_grid('members_grid', 'json');
         org_openpsa_widgets_tree::add_head_elements();
     } else {
         $this->_type = 'organization';
         $root_group = org_openpsa_contacts_interface::find_root_group();
         if ($this->_group->owner != $root_group->id) {
             $data['parent_group'] = $this->_group->get_parent();
         } else {
             $data['parent_group'] = false;
         }
         //pass billing-data if invoices is installed
         if (midcom::get('componentloader')->is_installed('org.openpsa.invoices')) {
             $qb_billing_data = org_openpsa_invoices_billing_data_dba::new_query_builder();
             $qb_billing_data->add_constraint('linkGuid', '=', $this->_group->guid);
             $billing_data = $qb_billing_data->execute();
             if (count($billing_data) > 0) {
                 $this->_request_data['billing_data'] = $billing_data[0];
             }
         }
         // This handler uses Ajax, include the handler javascripts
         midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . "/org.openpsa.helpers/ajaxutils.js");
         org_openpsa_widgets_ui::enable_ui_tab();
     }
     $data['view'] = midcom_helper_datamanager2_handler::get_view($this, $this->_group);
     // Add toolbar items
     $this->_populate_toolbar();
     $this->bind_view_to_object($this->_group);
     midcom::get('head')->set_pagetitle($this->_group->official);
     org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_group, $this);
 }
Beispiel #4
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_create($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     $this->_type = $args[0];
     $this->_parent_group = false;
     if (count($args) > 1) {
         // Get the parent organization
         $this->_parent_group = new org_openpsa_contacts_group_dba($args[1]);
         $this->_parent_group->require_do('midgard:create');
     } else {
         // This is a root level organization, require creation permissions under the component root group
         midcom::get('auth')->require_user_do('midgard:create', null, 'org_openpsa_contacts_group_dba');
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             // Index the organization
             $indexer = new org_openpsa_contacts_midcom_indexer($this->_topic);
             $indexer->index($data['controller']->datamanager);
             // Relocate to group view
             return new midcom_response_relocate("group/" . $this->_group->guid . "/");
         case 'cancel':
             if ($this->_parent_group) {
                 return new midcom_response_relocate("group/" . $this->_parent_group->guid . "/");
             } else {
                 return new midcom_response_relocate('');
             }
     }
     $this->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.helper.datamanager2/legacy.css");
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     midcom::get('head')->set_pagetitle($this->_l10n->get("create organization"));
     org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_parent_group, $this);
     $this->add_breadcrumb("", sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_type)));
 }