You are here

function _hacked_report_batch in Hacked! 7.3

Compute the report data for hacked.

1 call to _hacked_report_batch()
hacked_report_form_submit in ./hacked.forms.inc

File

./hacked.helpers.inc, line 179
Contain list of helpers for the module.

Code

function _hacked_report_batch($operation, $projects = NULL) {
  $batch_operations = [];
  switch ($operation) {
    case HACKED_OP_CHECK_SELECTED:
      $selected_projects = array_intersect_key(_hacked_get_projects(), $projects);
      foreach ($selected_projects as $project) {
        $batch_operations[] = [
          '_hacked_check_project',
          [
            $project,
          ],
        ];
      }
      break;
    case HACKED_OP_RESTORE_SELECTED:
      $selected_projects = array_intersect_key(_hacked_get_projects(), $projects);
      foreach ($selected_projects as $project) {
        $batch_operations[] = [
          '_hacked_restore_project',
          [
            $project,
          ],
        ];
      }
      break;
    case HACKED_OP_CHECK_ALL:
      foreach (_hacked_get_projects() as $project) {
        $batch_operations[] = [
          '_hacked_check_project',
          [
            $project,
          ],
        ];
      }
      break;
    case HACKED_OP_RESTORE_ALL:
      foreach (_hacked_get_projects() as $project) {
        $batch_operations[] = [
          '_hacked_restore_project',
          [
            $project,
          ],
        ];
      }
      break;
  }
  $batch = [
    'operations' => $batch_operations,
    //'finished' => 'hacked_build_report_batch_finished',

    //'file' => drupal_get_path('module', 'hacked') . '/hacked.report.inc',
    'title' => t('Building report'),
  ];
  batch_set($batch);
}