You are here

function globallink_create_document_info in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.6 gl_ws/gl_ws_send_translations.inc \globallink_create_document_info()
1 call to globallink_create_document_info()
globallink_send_documents_for_translation_to_pd in gl_ws/gl_ws_send_translations.inc

File

gl_ws/gl_ws_send_translations.inc, line 112

Code

function globallink_create_document_info($project_ticket, &$globallink, $client_identifier) {
  $md_arr = array();
  $metadata = new Metadata();
  $metadata->key = 'type';
  $metadata->value = $globallink->metadata;
  array_push($md_arr, $metadata);
  $metadata = new Metadata();
  $metadata->key = 'type_id';
  if ($globallink->metadata != 'node' && $globallink->metadata != 'entity') {
    $metadata->value = $globallink->otherObjectId;
  }
  else {
    $metadata->value = $globallink->nid;
  }
  array_push($md_arr, $metadata);
  $document_info = new DocumentInfo();
  $document_info->metadata = $md_arr;
  $document_info->projectTicket = $project_ticket;
  $document_info->sourceLocale = $globallink->sourceLocale;
  $document_info->name = $globallink->sourceFileName;
  $document_info->clientIdentifier = $client_identifier;
  $date_requested = new Date();
  $date_requested->date = $globallink->dueDate;
  $date_requested->critical = FALSE;
  $document_info->dateRequested = $date_requested;
  $document_info->instructions = $globallink->submissionInstructions;
  $target_infos = array();
  $count = 0;
  foreach ($globallink->targetLocale as $value) {
    $target_infos[$count] = globallink_create_target_info($value, $globallink);
    $count++;
  }
  $document_info->targetInfos = $target_infos;
  return $document_info;
}