You are here

function lingotek_batch_identify_content in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.3 lingotek.batch.inc \lingotek_batch_identify_content()
  2. 7.4 lingotek.batch.inc \lingotek_batch_identify_content()

Batch Create: Lingotek Identify Content - create informative lingonode data (in lingotek table) for pre-existing content

1 call to lingotek_batch_identify_content()
lingotek_cleanup_utility in ./lingotek.util.inc
1 string reference to 'lingotek_batch_identify_content'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.batch.inc, line 194

Code

function lingotek_batch_identify_content($front = FALSE) {
  $result = db_query('SELECT DISTINCT nid FROM {lingotek}');
  $existing_nids = $result
    ->fetchCol();
  $operations = array();
  foreach (lingotek_get_content_types(TRUE) as $type) {
    $nodes = node_load_multiple(array(), array(
      'type' => $type,
    ));
    foreach ($nodes as $node) {
      if (!in_array($node->nid, $existing_nids)) {

        // Add content nodes to lingotek table, to indicate that they are machine translatable nodes
        $operations[] = array(
          'lingotek_set_node_sync_status',
          array(
            $node->nid,
            LINGOTEK_NODE_SYNC_STATUS_EDITED,
          ),
        );
      }
    }
  }
  $batch = array(
    'title' => t('Identifying Translatable Content'),
    'operations' => $operations,
    'finished' => 'lingotek_batch_identify_content_finished',
  );
  batch_set($batch);
  if ($front) {
    batch_process('<front>');

    // Needed if not inside a form _submit handler.  Setting redirect in batch_process.
  }
}