You are here

public static function LingotekConfigSet::getLidsToUpdate in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekConfigSet.php \LingotekConfigSet::getLidsToUpdate()

Get all lids marked as current or not, in the lingotek_config_map table

Parameters

int $current: 1 to get lids of all current segments, 0 to get lids for segments that are not current

array $lids: a subset of lids to check, defaults to look for all current segments

1 call to LingotekConfigSet::getLidsToUpdate()
lingotek_grid_upload_edited in ./lingotek.bulk_grid.inc

File

lib/Drupal/lingotek/LingotekConfigSet.php, line 956
Defines LingotekConfigSet.

Class

LingotekConfigSet
A class wrapper for Lingotek-specific behavior on ConfigSets.

Code

public static function getLidsToUpdate($current = 0, $lids = 'all') {
  $textgroups = array_merge(array(
    -1,
  ), LingotekConfigSet::getTextgroupsForTranslation());
  $query = db_select('lingotek_config_map', 'lcm')
    ->fields('lcm', array(
    'lid',
  ));
  if ($lids !== 'all') {
    $query
      ->condition('lcm.lid', $lids, 'IN');
  }
  $query
    ->join('locales_source', 'ls', "lcm.lid = ls.lid");
  $query
    ->condition('ls.textgroup', $textgroups, 'IN');
  $query
    ->join('locales_target', 'lt', "lcm.lid = lt.lid");
  $or = db_or();
  $or
    ->condition('lcm.current', $current);
  $or
    ->condition('lt.i18n_status', 1);
  $query
    ->condition($or);
  $lids = $query
    ->execute()
    ->fetchCol();
  return array_unique($lids);
}