public static function LingotekSync::getTargetNodeCountByStatus in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.3 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetNodeCountByStatus()
- 7.4 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 568 - 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_entity_metadata', 'l')
->fields('l');
$query
->condition('entity_type', 'node');
$query
->condition('entity_key', $target_key);
$query
->condition('value', $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) {
$drupal_language_code = Lingotek::convertLingotek2Drupal($lingotek_locale, TRUE);
$query = db_select('node', 'n');
$query
->leftJoin('lingotek_entity_metadata', 'l', 'l.entity_id = n.nid
AND l.entity_type = \'node\'
AND l.entity_key = \'profile\'
AND l.value != \'DISABLED\'');
$query
->condition('n.language', $drupal_language_code);
$query
->addExpression('COUNT(*)', 'cnt');
$result = $query
->execute()
->fetchField();
$count += $result;
}
return $count;
}