You are here

function globallink_beans_get_translation_status in GlobalLink Connect for Drupal 7.6

Gets bean translation status.

Parameters

string $bnid: The bean ID.

string $tgt_locale: The target locale.

string $title: The translation title.

Return value

string Status message.

1 call to globallink_beans_get_translation_status()
globallink_beans_receive_form in globallink_beans/globallink_beans_receive.inc
Builds form to receive a beans submission.

File

globallink_beans/globallink_beans.inc, line 881

Code

function globallink_beans_get_translation_status($bnid, $tgt_locale, &$title) {
  $query = db_select('globallink_core_beans', 'gcb');
  $query
    ->condition('object_id', $bnid, '=');
  $query
    ->condition('target', $tgt_locale, '=');
  $query
    ->distinct();
  $query
    ->fields('gcb');
  $results = $query
    ->execute();
  foreach ($results as $row) {
    $title = $row->title;
    $entity_arr = entity_load('bean', array(
      $bnid,
    ));
    $key = key($entity_arr);
    $entity = $entity_arr[$key];
    if (empty($entity)) {
      return 'Source Deleted';
    }
    elseif ($row->status == 'Sent for Translations') {
      return 'Translation Completed';
    }
    elseif ($row->status == 'Error') {
      return 'Error';
    }
  }
  return 'Sent for Translations';
}