Commit 1a2d7ca4 authored by yas's avatar yas
Browse files

Added confirmation form to activity audit

parent ab659eb8
......@@ -66,8 +66,8 @@ function cloud_activity_audit_menu() {
);
$items['reports/activity_audit/%/delete'] = array(
'title' => 'Delete',
'page callback' => '_cloud_activity_audit_delete',
'page arguments' => array(2),
'page callback' => 'drupal_get_form',
'page arguments' => array('_cloud_activity_audit_delete', 2),
'access arguments' => array('access audit report'),
'file' => '',
'type' => MENU_CALLBACK,
......@@ -324,14 +324,21 @@ function cloud_activity_audit_get_entry($sort_column, $query_args) {
}
/**
* Delete an Audit entry
* redirect to audit listing page
* Deletes an Audit entry via confirm_form.
*
* @param $audit_id
* This is audit-id
* @return return a form
* Id of activity audit.
*/
function _cloud_activity_audit_delete($audit_id = '') {
$id = $audit_id;
function _cloud_activity_audit_delete($form, $form_state, $audit_id = '') {
$form['audit_id'] = array('#type' => 'hidden', '#value' => $audit_id);
return confirm_form($form, t('Are you sure you want to delete this item?'), CLOUD_ACTIVITY_AUDIT_PATH . '/report');
}
/**
* Submit of delete form.
*/
function _cloud_activity_audit_delete_submit($form, &$form_state) {
$id = $form_state['values']['audit_id'];
cloud_activity_audit_log( array(
'type' => 'user_activity',
......@@ -345,9 +352,7 @@ function _cloud_activity_audit_delete($audit_id = '') {
->execute();
drupal_set_message(t('Audit has been deleted successfully.'));
drupal_goto(CLOUD_ACTIVITY_AUDIT_PATH . '/report');
return;
$form_state['redirect'] = CLOUD_ACTIVITY_AUDIT_PATH . '/report';
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment