You are here

function rules_scheduler_delete_task in Rules 7.2

Same name and namespace in other branches
  1. 6 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
Implements hook_menu().

File

rules_scheduler/rules_scheduler.admin.inc, line 77
Admin forms for scheduling.

Code

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