You are here

function rules_scheduler_form in Rules 7.2

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

Form for deletion of tasks by component.

1 string reference to 'rules_scheduler_form'
rules_scheduler_schedule_page in rules_scheduler/rules_scheduler.admin.inc
Schedule page with a view for the scheduled tasks.

File

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

Code

function rules_scheduler_form($form, &$form_state) {
  $result = db_select('rules_scheduler', 'r')
    ->fields('r', array(
    'config',
  ))
    ->distinct()
    ->execute();
  $config_options = array_intersect_key(rules_get_components(TRUE), $result
    ->fetchAllAssoc('config'));

  // Fieldset for canceling by component name.
  $form['delete_by_config'] = array(
    '#type' => 'fieldset',
    '#title' => t('Delete tasks by component name'),
    '#disabled' => empty($config_options),
  );
  $form['delete_by_config']['config'] = array(
    '#title' => t('Component'),
    '#type' => 'select',
    '#options' => $config_options,
    '#description' => t('Select the component for which to delete all scheduled tasks.'),
    '#required' => TRUE,
  );
  $form['delete_by_config']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Delete tasks'),
    '#submit' => array(
      'rules_scheduler_form_delete_by_config_submit',
    ),
  );
  return $form;
}