You are here

function hacked_report_form_submit in Hacked! 7.3

File

./hacked.forms.inc, line 90
The forms

Code

function hacked_report_form_submit($form, $form_state) {
  $operation = $form_state['triggering_element']['#parents'][0];
  $core = array_filter($form_state['values']['table-core']);
  $modules = array_filter($form_state['values']['table-modules']);
  $themes = array_filter($form_state['values']['table-themes']);
  $selected_projects = array_merge($core, $modules, $themes);
  if (($operation == HACKED_OP_CHECK_SELECTED || $operation == HACKED_OP_RESTORE_SELECTED) && empty($selected_projects)) {
    drupal_set_message(t('No items selected.'), 'error');
    return;
  }
  switch ($operation) {
    case HACKED_OP_CHECK_SELECTED:
      _hacked_report_batch(HACKED_OP_CHECK_SELECTED, $selected_projects);
      break;
    case HACKED_OP_RESTORE_SELECTED:
      _hacked_report_batch(HACKED_OP_RESTORE_SELECTED, $selected_projects);
      break;
    case HACKED_OP_CHECK_ALL:
      _hacked_report_batch(HACKED_OP_CHECK_ALL);
      break;
    case HACKED_OP_RESTORE_ALL:
      _hacked_report_batch(HACKED_OP_RESTORE_ALL);
      break;
  }
}