You are here

function lingotek_batch_identify_content in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 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
Clean-up utility
1 string reference to 'lingotek_batch_identify_content'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.batch.inc, line 266
Central location for batch create functions, before control is handed off to individual batch command files.

Code

function lingotek_batch_identify_content($front = FALSE) {
  LingotekLog::trace(__METHOD__);
  $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(
          'LingotekSync::setNodeStatus',
          array(
            $node->nid,
            LingotekSync::STATUS_EDITED,
          ),
        );
      }
    }
  }
  $batch = array(
    'title' => t('Identifying Translatable Content'),
    'operations' => $operations,
  );
  batch_set($batch);
  if ($front) {
    batch_process('<front>');

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