You are here

function globallink_get_submission_from_nid in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.6 globallink_node.inc \globallink_get_submission_from_nid()

Gets submission name from nid.

Parameters

int $nid: The node id to pass in.

Return value

string The name of the submission.

File

./globallink_node.inc, line 395

Code

function globallink_get_submission_from_nid($nid) {
  $query = db_select('globallink_core', 'tc');
  $query
    ->condition('status', array(
    'Sent for Translations',
    'Error',
  ), 'IN');
  $query
    ->condition('nid', $nid, '=');
  $query
    ->distinct();
  $query
    ->fields('tc');
  $results = $query
    ->execute();
  foreach ($results as $row) {

    // Return the first one
    return $row->submission;
  }
}