You are here

function rules_scheduler_delete_task in Rules 6

Same name and namespace in other branches
  1. 7.2 rules_scheduler/rules_scheduler.admin.inc \rules_scheduler_delete_task()

Confirmation form for deleting single tasks.

1 string reference to 'rules_scheduler_delete_task'
rules_scheduler_menu in rules_scheduler/rules_scheduler.module
Implementation of hook_menu().

File

rules_scheduler/rules_scheduler.admin.inc, line 128
Admin form for scheduling

Code

function rules_scheduler_delete_task(&$form_state, $task) {
  $form = array();
  $form_state['task'] = $task;
  $path = array();
  $path['path'] = isset($_GET['destination']) ? $_GET['destination'] : RULES_SCHEDULER_PATH;
  $title = t('Are you sure you want to delete task %tid?', array(
    '%tid' => $task['tid'],
  ));
  if (!empty($task['identifier'])) {
    $msg = t('This task refers to the custom identifier %id and rule set %ruleset, it will be executed on %date. The delete action cannot be undone.', array(
      '%ruleset' => $task['set_name'],
      '%id' => $task['identifier'],
      '%date' => format_date(rules_gmstrtotime($task['date'])),
    ));
  }
  else {
    $msg = t('This task refers to the rule set %ruleset and will be executed on %date. The delete action cannot be undone.', array(
      '%ruleset' => $task['set_name'],
      '%id' => $task['identifier'],
      '%date' => $task['date'],
    ));
  }
  return confirm_form($form, $title, $path, $msg, t('Delete'), t('Cancel'));
}