You are here

function scanner_undo_confirm_form in Search and Replace Scanner 6

Same name and namespace in other branches
  1. 5.2 scanner.module \scanner_undo_confirm_form()
  2. 7 scanner.module \scanner_undo_confirm_form()
1 string reference to 'scanner_undo_confirm_form'
scanner_menu in ./scanner.module
Implementation of hook_menu().

File

./scanner.module, line 587
Search and Replace Scanner - works on all nodes text content.

Code

function scanner_undo_confirm_form() {
  $undo_id = $_GET['undo_id'];
  if ($undo_id > 0) {
    $undo = db_fetch_object(db_query('SELECT undo_id, searched, replaced FROM {scanner} WHERE undo_id = %d', $undo_id));
  }
  if ($undo->undo_id > 0) {
    $form['info'] = array(
      '#value' => '<h2>' . t('Do you want to undo:') . '</h2>' . '<h3>' . t('Searched for:') . '</h3>' . '<p>[<em>' . check_plain($undo->searched) . '</em>]</p>' . '<h3>' . t('Replaced with:') . '</h3>' . '<p>[<em>' . check_plain($undo->replaced) . '</em>]</p>',
    );
    $form['undo_id'] = array(
      '#type' => 'hidden',
      '#value' => $undo->undo_id,
    );
    $form['confirm'] = array(
      '#type' => 'submit',
      '#value' => t('Yes, Continue'),
    );
    $form['cancel'] = array(
      '#type' => 'submit',
      '#value' => t('No, Cancel'),
    );
  }
  else {
    $form['info'] = array(
      '#value' => '<h2>' . t('No undo event was found') . '</h2>',
    );
  }
  return $form;
}