You are here

function prepare_blocks_button_submit in GlobalLink Connect for Drupal 7.7

Block batch sets .

1 string reference to 'prepare_blocks_button_submit'
globallink_useful_tools in ./globallink_settings.inc
Globallink Useful Tools form.

File

./globallink_settings.inc, line 671

Code

function prepare_blocks_button_submit($form, &$form_state) {
  $batch = array(
    'operations' => array(),
    'finished' => 'globallink_settings_blocks_batch_finished',
    'title' => t('Updating Blocks'),
    'init_message' => t('Update blocks is starting.'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Update blocks has encountered an error.'),
    'file' => drupal_get_path('module', 'globallink') . '/globallink_settings.inc',
  );
  $progress = 0;
  $limit = 5;
  $result = db_query("SELECT * FROM {block} WHERE  i18n_mode = :i18n_mode", array(
    ':i18n_mode' => 0,
  ))
    ->fetchAll();
  $max = count($result);
  while ($progress <= $max) {
    $batch['operations'][] = array(
      'globallink_settings_blocks_process',
      array(
        $progress,
        $limit,
        $result,
      ),
    );
    $progress = $progress + $limit;
  }
  batch_set($batch);
}