You are here

function globallink_block_get_translation_status in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.5 globallink_block/globallink_block.inc \globallink_block_get_translation_status()

Gets block translation status.

Parameters

string $bid: The block ID.

string $tgt_locale: The target locale.

string $title: The translation title.

Return value

string Status message.

1 call to globallink_block_get_translation_status()
globallink_block_receive_form in globallink_block/globallink_block_receive.inc
Builds form to receive a block submission.

File

globallink_block/globallink_block.inc, line 309

Code

function globallink_block_get_translation_status($bid, $tgt_locale, &$title) {
  $query = db_select('globallink_core_block', 'tco');
  $query
    ->condition('object_id', $bid, '=');
  $query
    ->condition('target', $tgt_locale, '=');
  $query
    ->distinct();
  $query
    ->fields('tco');
  $results = $query
    ->execute();
  foreach ($results as $row) {
    $title = $row->title;
    $s_block = block_custom_block_get($bid);
    if (!$s_block || is_null($s_block)) {
      return 'Source Deleted';
    }
    elseif ($row->status == 'Sent for Translations') {
      return 'Translation Completed';
    }
    elseif ($row->status == 'Error') {
      return 'Error';
    }
  }
  return 'Sent for Translations';
}