public static function LingotekSync::getTargetNodeCountByStatus in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetNodeCountByStatus()
- 7.3 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetNodeCountByStatus()
- 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetNodeCountByStatus()
- 7.6 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetNodeCountByStatus()
1 call to LingotekSync::getTargetNodeCountByStatus()
- LingotekSync::getTargetCountByStatus in lib/
Drupal/ lingotek/ LingotekSync.php
File
- lib/
Drupal/ lingotek/ LingotekSync.php, line 391 - LingotekSync
Class
- LingotekSync
- A utility class for Lingotek Syncing.
Code
public static function getTargetNodeCountByStatus($status, $lingotek_locale) {
$target_prefix = 'target_sync_status_';
$target_key = $target_prefix . $lingotek_locale;
$query = db_select('lingotek', 'l')
->fields('l');
$query
->condition('lingokey', $target_key);
$query
->condition('lingovalue', $status);
$result = $query
->countQuery()
->execute()
->fetchAssoc();
$count = 0;
if (is_array($result)) {
$count = array_shift($result);
}
// count nodes having this language as the source as current
if ($status == LingotekSync::STATUS_CURRENT) {
$nids = LingotekSync::getAllNodeIds();
$drupal_language_code = Lingotek::convertLingotek2Drupal($lingotek_locale, TRUE);
$query = db_select('node', 'n');
$query
->join('lingotek', 'l', 'l.nid = n.nid
AND l.lingokey = \'node_sync_status\'
AND l.lingovalue != \'' . LingotekSync::STATUS_DISABLED . '\'
AND l.lingovalue != \'' . LingotekSync::STATUS_TARGET . '\'');
$query
->condition('n.language', $drupal_language_code);
if (count($nids)) {
$query
->condition('n.nid', $nids, 'IN');
// nodes sent to lingotek
}
$query
->addExpression('COUNT(*)', 'cnt');
$result = $query
->execute()
->fetchField();
$count += $result;
}
return $count;
}