You are here

function lingotek_get_workbench_moderation_state_select in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.4 lingotek.sync.inc \lingotek_get_workbench_moderation_state_select()
1 call to lingotek_get_workbench_moderation_state_select()
lingotek_workbench_moderation_bulk_select in ./lingotek.sync.inc

File

./lingotek.sync.inc, line 677
Sync and management

Code

function lingotek_get_workbench_moderation_state_select($wb_state, $nids = array()) {
  $sub_query = db_select('workbench_moderation_node_history', 'wb1')
    ->condition('nid', $nids, 'IN')
    ->groupBy('nid');
  $sub_query
    ->addExpression('MAX(hid)', 'hid');
  $query = db_select('workbench_moderation_node_history', 'wb2')
    ->fields('wb2', array(
    'nid',
  ))
    ->condition('hid', $sub_query, 'IN')
    ->condition('state', $wb_state);
  $result = $query
    ->execute()
    ->fetchCol(0);
  return $result;
}