You are here

function get_tpt_entity_sent_rows in GlobalLink Connect for Drupal 7.7

Same name and namespace in other branches
  1. 7.5 globallink_entity/globallink_entity.module \get_tpt_entity_sent_rows()
  2. 7.6 globallink_entity/globallink_entity.module \get_tpt_entity_sent_rows()

Gets entity rows that have been sent for translation.

Parameters

string $nid: The entity node ID.

string $source: The target language of the entity.

Return value

array Array of entity rows that have been sent for translation.

File

globallink_entity/globallink_entity.module, line 183
GlobalLink entity translation module.

Code

function get_tpt_entity_sent_rows($nid, $source) {
  module_load_include('inc', 'globallink', 'globallink');
  $arr = array();
  $query = db_select('globallink_document', 'gd')
    ->fields('gd')
    ->condition('object_id', $nid, '=')
    ->condition('entity_type', GLOBALLINK_ENTITY_TYPE_ENTITY, '=')
    ->condition('target_status', array(
    GLOBALLINK_STATUS_TRANSLATION_SENT,
    GLOBALLINK_STATUS_TRANSLATION_ERROR,
    GLOBALLINK_STATUS_TRANSLATION_COMPLETED,
  ), 'IN');
  $result = $query
    ->execute()
    ->fetchAll();
  foreach ($result as $row) {
    $arr[] = globallink_get_drupal_locale_code($row->target_lang_code);
  }
  return $arr;
}