コード例 #1
0
ファイル: billingdata.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)
 {
     $this->_billing_data = new org_openpsa_invoices_billing_data_dba($args[0]);
     $this->_billing_data->require_do('midgard:delete');
     $this->_linked_object = midcom::get('dbfactory')->get_object_by_guid($this->_billing_data->linkGuid);
     $this->_controller = midcom_helper_datamanager2_handler::get_delete_controller();
     $this->_process_billing_form();
     $data['datamanager'] = midcom_helper_datamanager2_handler::get_view_controller($this, $this->_billing_data);
     $this->_prepare_output('delete');
 }
コード例 #2
0
ファイル: account.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)
 {
     // Check if we get the person
     $this->_person = new midcom_db_person($args[0]);
     $this->_person->require_do('midgard:update');
     if ($this->_person->id != midcom_connection::get_user()) {
         midcom::get('auth')->require_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     }
     $this->_account = new midcom_core_account($this->_person);
     if (!$this->_account->get_username()) {
         // Account needs to be created first, relocate
         return new midcom_response_relocate("view/" . $this->_person->guid . "/");
     }
     $data['controller'] = midcom_helper_datamanager2_handler::get_delete_controller();
     switch ($data['controller']->process_form()) {
         case 'delete':
             if (!$this->_account->delete()) {
                 throw new midcom_error("Failed to delete account for {$this->_person->guid}, last Midgard error was: " . midcom_connection::get_error_string());
             }
             //Fall-through
         //Fall-through
         case 'cancel':
             return new midcom_response_relocate('view/' . $this->_person->guid . "/");
     }
     $this->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.helper.datamanager2/legacy.css");
     midcom::get('head')->enable_jquery();
     midcom::get('head')->set_pagetitle("{$this->_person->firstname} {$this->_person->lastname}");
     $this->_prepare_request_data();
     $this->_update_breadcrumb_line('delete account');
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this, 'delete');
 }
コード例 #3
0
ファイル: admin.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_valid_user();
     $this->_document = $this->_load_document($args[0]);
     $this->_document->require_do('midgard:delete');
     $data['controller'] = midcom_helper_datamanager2_handler::get_delete_controller();
     switch ($data['controller']->process_form()) {
         case 'delete':
             if ($this->_document->delete()) {
                 // Update the index
                 $indexer = midcom::get('indexer');
                 $indexer->delete($this->_document->guid);
                 // Redirect to the directory
                 return new midcom_response_relocate('');
             } else {
                 // Failure, give a message
                 midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.documents'), $this->_l10n->get("failed to delete document, reason ") . midcom_connection::get_error_string(), 'error');
             }
             //Fall-through
         //Fall-through
         case 'cancel':
             return new midcom_response_relocate("document/" . $this->_document->guid . "/");
     }
     $data['document_dm'] = $this->_datamanager;
     $data['document'] = $this->_document;
     org_openpsa_helpers::dm2_savecancel($this, 'delete');
     $this->_update_breadcrumb_line('delete');
 }
コード例 #4
0
ファイル: crud.php プロジェクト: nemein/openpsa
 /**
  * Displays an object delete confirmation view.
  *
  * Note, that the object for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation object
  *
  * @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)
 {
     $this->_mode = 'delete';
     $this->_load_object($handler_id, $args, $data);
     $this->_object->require_do('midgard:delete');
     $this->_load_schemadb();
     $this->_load_datamanager();
     $this->_controller = midcom_helper_datamanager2_handler::get_delete_controller();
     switch ($this->_controller->process_form()) {
         case 'delete':
             // Deletion confirmed, try doing it.
             if (!$this->_object->delete()) {
                 throw new midcom_error("Failed to delete object {$this->_object->guid}, last Midgard error was: " . midcom_connection::get_error_string());
             }
             // Update the index
             $indexer = midcom::get('indexer');
             $indexer->delete($this->_object->guid);
             // Show user interface message
             // midcom::get('uimessages')->add($this->_l10n->get('net.nehmer.blog'), sprintf($this->_l10n->get('object %s deleted'), $title));
             // Delete ok, relocating to welcome.
             return new midcom_response_relocate('');
         case 'cancel':
             return new midcom_response_relocate($this->_get_object_url());
     }
     $this->_prepare_request_data();
     // Call the per-component metadata methods
     $this->_populate_toolbar($handler_id);
     $this->_update_title($handler_id);
     $this->_update_breadcrumb($handler_id);
     // Let MidCOM know about the object
     midcom::get('metadata')->set_request_metadata($this->_object->metadata->revised, $this->_object->guid);
     $this->bind_view_to_object($this->_object, $this->_datamanager->schema->name);
     $this->_handler_callback($handler_id, $args, $data);
 }