示例#1
0
文件: delete.php 项目: nemein/openpsa
 /**
  * @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_delete($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     $this->_group = new midcom_db_group($args[0]);
     if (array_key_exists('org_openpsa_user_deleteok', $_POST)) {
         $delete_succeeded = $this->_group->delete();
         $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
         if ($delete_succeeded) {
             // Update the index
             $indexer = midcom::get('indexer');
             $indexer->delete($this->_group->guid);
             return new midcom_response_relocate('');
         } else {
             // Failure, give a message
             midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get("failed to delete group, reason") . ' ' . midcom_connection::get_error_string(), 'error');
             return new midcom_response_relocate($prefix . 'group/' . $this->_group->guid . '/');
         }
     }
     $data['view'] = midcom_helper_datamanager2_handler::get_view_controller($this, $this->_group);
     $data['group'] = $this->_group;
     org_openpsa_widgets_tree::add_head_elements();
     $this->add_breadcrumb('groups/', $this->_l10n->get('groups'));
     $this->add_breadcrumb('', sprintf($this->_l10n_midcom->get('delete %s'), $this->_group->get_label()));
     $this->bind_view_to_object($this->_group);
 }
示例#2
0
文件: view.php 项目: nemein/openpsa
 /**
  * @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_view($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface');
     $this->_group = new midcom_db_group($args[0]);
     $data['group'] = $this->_group;
     $data['view'] = midcom_helper_datamanager2_handler::get_view_controller($this, $this->_group);
     org_openpsa_widgets_tree::add_head_elements();
     org_openpsa_widgets_grid::add_head_elements();
     $this->add_breadcrumb('groups/', $this->_l10n->get('groups'));
     $this->add_breadcrumb('', $this->_group->get_label());
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/edit/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get("edit"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e'));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/delete/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get("delete"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:delete')));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/privileges/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("permissions"), MIDCOM_TOOLBAR_ICON => 'midgard.admin.asgard/permissions-16.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:privileges')));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/notifications/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("notification settings"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock-discussion.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:update')));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "create/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba')));
     $this->bind_view_to_object($this->_group);
 }
示例#3
0
文件: edit.php 项目: nemein/openpsa
 /**
  * @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_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     $this->_group = new midcom_db_group($args[0]);
     $data['controller'] = $this->get_controller('simple', $this->_group);
     switch ($data['controller']->process_form()) {
         case 'save':
             midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.user'), sprintf($this->_l10n->get('group %s saved'), $this->_group->get_label()));
             // Fall-through
         // Fall-through
         case 'cancel':
             return new midcom_response_relocate('group/' . $this->_group->guid . '/');
     }
     $this->add_breadcrumb('groups/', $this->_l10n->get('groups'));
     $this->add_breadcrumb('', sprintf($this->_l10n_midcom->get('edit %s'), $this->_group->get_label()));
     org_openpsa_helpers::dm2_savecancel($this);
     $this->bind_view_to_object($this->_group);
 }
示例#4
0
文件: create.php 项目: nemein/openpsa
 /**
  * @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_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     if (count($args) > 0) {
         // Get the organization
         $this->_group = new midcom_db_group($args[0]);
         $this->_group->require_do('midgard:create');
         midcom::get('head')->set_pagetitle($this->_group->official);
         $this->add_breadcrumb('group/' . $this->_group->guid . '/', $this->_group->get_label());
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.user'), sprintf($this->_l10n->get('person %s created'), $this->_person->name));
             $this->_master->create_account($this->_person, $data["controller"]->formmanager);
             return new midcom_response_relocate('view/' . $this->_person->guid . '/');
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->add_breadcrumb('', sprintf($this->_l10n->get('create person')));
     org_openpsa_helpers::dm2_savecancel($this);
 }