You are here

function lingotek_add_target_sync_status_to_all_nodes in Lingotek Translation 7.2

When a new MT language is added, add a Target status tag to every node.

1 call to lingotek_add_target_sync_status_to_all_nodes()
lingotek_add_target_language in ./lingotek.util.inc
Adds the target language as being enabled.

File

./lingotek.sync.inc, line 97
Content translation management and sync functions.

Code

function lingotek_add_target_sync_status_to_all_nodes($lingotek_locale) {
  $query = db_select('lingotek', 'l')
    ->fields('l');
  $query
    ->condition('lingokey', 'node_sync_status');
  $result = $query
    ->execute();
  while ($record = $result
    ->fetchAssoc()) {

    // If the Node is CURRENT or PENDING, then we just need to pull down the new translation (because the source will have been uploaded), so set the Node and Target to PENDING.
    if ($record['lingovalue'] == LINGOTEK_NODE_SYNC_STATUS_CURRENT) {
      lingotek_set_target_sync_status($record['nid'], $lingotek_locale, LINGOTEK_TARGET_SYNC_STATUS_PENDING);
    }
    else {

      // Otherwise, set it to EDITED
      lingotek_set_node_sync_status($record['nid'], LINGOTEK_NODE_SYNC_STATUS_EDITED);
      lingotek_set_target_sync_status($record['nid'], $lingotek_locale, LINGOTEK_TARGET_SYNC_STATUS_EDITED);
    }
  }
}