You are here

public static function LingotekConfigChunk::getSegmentIdsById in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.4 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::getSegmentIdsById()
  2. 7.5 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::getSegmentIdsById()

Return the segments by lid (from locales source) for a given chunk ID

Parameters

int: the ID of a chunk of configuration segments

Return value

array an array of lids from locales_source

File

lib/Drupal/lingotek/LingotekConfigChunk.php, line 152
Defines LingotekConfigChunk.

Class

LingotekConfigChunk
A class wrapper for Lingotek-specific behavior on ConfigChunks.

Code

public static function getSegmentIdsById($chunk_id) {
  $textgroups = "-1,'" . implode("','", self::getTextgroupsForTranslation()) . "'";
  $result = db_query(" SELECT ls.lid\n                        FROM {locales_source} ls\n                        WHERE ls.lid >= :minLid\n                        AND ls.lid <= :maxLid\n                        AND LENGTH(ls.source) < :maxLen\n                        AND ls.textgroup IN ({$textgroups})\n                        ", array(
    ':minLid' => self::minLid($chunk_id),
    ':maxLid' => self::maxLid($chunk_id),
    ':maxLen' => LINGOTEK_CONFIG_MAX_SOURCE_LENGTH,
  ));
  return $result
    ->fetchCol();
}