You are here

function prepare_taxonomy_button_submit in GlobalLink Connect for Drupal 7.7

Taxonomy batch set.

1 string reference to 'prepare_taxonomy_button_submit'
globallink_translations_settings_taxonomy in ./globallink_settings.inc
Taxonomy create form.

File

./globallink_settings.inc, line 1261

Code

function prepare_taxonomy_button_submit($form, &$form_state) {
  $batch = array(
    'operations' => array(),
    'finished' => 'globallink_settings_taxonomy_batch_finished',
    'title' => t('Updating Taxonomy'),
    'init_message' => t('Update Taxonomy is starting.'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Update Taxonomy has encountered an error.'),
    'file' => drupal_get_path('module', 'globallink') . '/globallink_settings.inc',
  );
  $progress = 0;
  $limit = 10;
  $values = $form_state['values'];
  $resultTaxonomyVocabulary = db_query("SELECT * FROM {taxonomy_vocabulary}")
    ->fetchAll();
  $resultTaxonomyTermdata = db_query("SELECT * FROM {taxonomy_term_data} WHERE language = :language", array(
    ':language' => "und",
  ))
    ->fetchAll();
  $max = count($resultTaxonomyVocabulary);
  while ($progress <= $max) {
    $batch['operations'][] = array(
      'globallink_settings_taxonomy_process',
      array(
        $progress,
        $limit,
        $resultTaxonomyVocabulary,
        $resultTaxonomyTermdata,
        $values,
      ),
    );
    $progress = $progress + $limit;
  }
  batch_set($batch);
}