You are here

public function PDDocument::getDocumentInfo in GlobalLink Connect for Drupal 7.7

File

gl_ws/glc/model/Document.inc.php, line 40

Class

PDDocument

Code

public function getDocumentInfo($submission) {
  $documentInfo = new DocumentInfo();
  $documentInfo->projectTicket = $submission->project->ticket;
  $documentInfo->name = $this->name;
  $documentInfo->sourceLocale = $this->sourceLanguage;
  if ($submission->ticket != "") {
    $documentInfo->submissionTicket = $submission->ticket;
  }
  $i = 0;
  if (isset($this->metadata)) {
    $metadatas = array();
    foreach ($this->metadata as $k => $v) {
      $metadata = new Metadata();
      $metadata->key = substr($k, 0, 255);
      $metadata->value = substr($v, 0, 1024);
      $metadatas[$i++] = $metadata;
    }
    $documentInfo->metadata = $metadatas;
  }
  if (isset($this->clientIdentifier)) {
    $documentInfo->clientIdentifier = $this->clientIdentifier;
  }
  if (isset($this->instructions)) {
    $documentInfo->instructions = $this->instructions;
  }
  else {
    $documentInfo->instructions = $submission->instructions;
  }
  $documentInfo->targetInfos = $this
    ->getTargetInfos();
  return $documentInfo;
}