You are here

function _notifications_scheduler_create_batch in Notifications 7

Send to a list of subscriptions @todo Create batch

1 call to _notifications_scheduler_create_batch()
notifications_scheduler_admin_send_form_submit in notifications_scheduler/notifications_scheduler.admin.inc
Actually send notifications

File

notifications_scheduler/notifications_scheduler.admin.inc, line 187

Code

function _notifications_scheduler_create_batch($event, $sids, $step = 100) {

  // Split the destinations into chunks of smaller size
  $chunks = array_chunk($sids, $step);
  $operations = array();
  foreach ($chunks as $list) {
    $operations[] = array(
      '_notifications_scheduler_batch_send',
      array(
        $event,
        $list,
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'title' => t('Sending notifications'),
    'init_message' => t('Starting sending'),
    'error_message' => t('Error sending notifications'),
    'file' => drupal_get_path('module', 'notifications_scheduler') . '/notifications_scheduler.admin.inc',
    'finished' => '_notifications_scheduler_batch_send_finished',
  );
  return $batch;
}