function globallink_entity_get_active_submission_by_nid in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink_entity/globallink_entity.inc \globallink_entity_get_active_submission_by_nid()
- 7.6 globallink_entity/globallink_entity.inc \globallink_entity_get_active_submission_by_nid()
Gets active entity submission by node ID.
Parameters
string $nid: The entity node ID.
Return value
array Associative array representing the active entity submission.
1 call to globallink_entity_get_active_submission_by_nid()
- globallink_entity_dashboard_form in globallink_entity/
globallink_entity_send.inc - Builds form to create an entity submission.
File
- globallink_entity/
globallink_entity.inc, line 482
Code
function globallink_entity_get_active_submission_by_nid($nid) {
$query = db_select('globallink_document', 'gd');
$query
->join('globallink_submission', 'gs', 'gd.submission_rid = gs.rid');
$query
->condition('gd.object_id', $nid, '=');
$query
->condition('gd.entity_type', GLOBALLINK_ENTITY_TYPE_ENTITY, '=');
$or = db_or();
$or
->condition('gd.target_status', GLOBALLINK_STATUS_TRANSLATION_SENT, '=');
$or
->condition('gd.target_status', GLOBALLINK_STATUS_TRANSLATION_COMPLETED, '=');
$or
->condition('gd.target_status', GLOBALLINK_STATUS_TRANSLATION_ERROR, '=');
$query
->condition($or);
$query
->fields('gd');
$query
->fields('gs', array(
'submission',
'source_lang_code',
'source_lang_name',
'sub_target_lang_code',
'sub_target_lang_name',
));
$results = $query
->execute()
->fetchAll();
return $results;
}