You are here

function node_gallery_batch_sorting_callback in Node Gallery 6.3

1 string reference to 'node_gallery_batch_sorting_callback'
node_gallery_sort_images_form_submit in ./node_gallery.pages.inc

File

./node_gallery.inc, line 1056
Shared functions for node_gallery

Code

function node_gallery_batch_sorting_callback($images, &$context) {
  if (empty($context['sandbox'])) {
    $context['sandbox']['iterator'] = 0;
    $context['sandbox']['count'] = count($images);
    $context['results']['gid'] = $images[0]['gid'];
  }
  $context['results'][] = drupal_write_record('node_gallery_images', $images[$context['sandbox']['iterator']], 'nid');
  $context['sandbox']['iterator']++;
  if ($context['sandbox']['iterator'] < $context['sandbox']['count']) {
    $context['finished'] = $context['sandbox']['iterator'] / (double) $context['sandbox']['count'];
  }
  else {
    $context['finished'] = 1;
  }
}