You are here

function lingotek_count_node_targets in Lingotek Translation 7.2

Gets the current sync counts from the lingotek table for the LANGUAGE TARGETS.

Defaults to CURRENT.

1 call to lingotek_count_node_targets()
lingotek_get_target_status in ./lingotek.dashboard.inc
Get the status of the target given by locale

File

./lingotek.dashboard.inc, line 272
Lingotek Dashboard.

Code

function lingotek_count_node_targets($status = LINGOTEK_TARGET_SYNC_STATUS_CURRENT, $lingotek_locale) {
  $node_language_target_key = 'target_sync_status_' . $lingotek_locale;
  $query = db_select('lingotek', 'l')
    ->fields('l');
  $query
    ->condition('lingokey', $node_language_target_key);
  $query
    ->condition('lingovalue', $status);
  $result = $query
    ->countQuery()
    ->execute()
    ->fetchAssoc();
  if (is_array($result)) {
    $count = array_shift($result);
  }
  else {
    $count = 0;
  }
  return $count;
}