You are here

public static function LingotekSync::getDocIdsByStatus in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.3 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getDocIdsByStatus()
1 call to LingotekSync::getDocIdsByStatus()
LingotekSync::getDownloadableReport in lib/Drupal/lingotek/LingotekSync.php

File

lib/Drupal/lingotek/LingotekSync.php, line 702
LingotekSync

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

public static function getDocIdsByStatus($status, $source) {
  $doc_ids = array();

  // retrieve document IDs from nodes
  $nids = self::getNodeIdsByStatus($status, $source);
  if (!empty($nids)) {
    $query = db_select('lingotek', 'l');
    $query
      ->fields('l', array(
      'lingovalue',
    ));
    $query
      ->condition('lingokey', 'document_id');
    $query
      ->condition('nid', $nids);
    $result = $query
      ->execute();
    $doc_ids = $result
      ->fetchCol();
  }
  if (variable_get('lingotek_translate_config', 0)) {

    // retrieve document IDs from config chunks
    $cids = self::getChunkIdsByStatus($status);
    if (!empty($cids)) {
      $query = db_select('lingotek_config_metadata', 'meta');
      $query
        ->fields('meta', array(
        'value',
      ));
      $query
        ->condition('config_key', 'document_id');
      $query
        ->condition('id', $cids);
      $result = $query
        ->execute();
      $doc_ids = array_merge($doc_ids, $result
        ->fetchCol());
    }
  }
  return $doc_ids;
}