You are here

function PDProject::__construct in GlobalLink Connect for Drupal 7.7

File

gl_ws/glc/model/Project.inc.php, line 38

Class

PDProject

Code

function __construct($externalProject) {
  $this->name = $externalProject->projectInfo->name;
  $this->shortcode = $externalProject->projectInfo->shortCode;
  $this->ticket = $externalProject->ticket;
  $i = 0;
  if (isset($externalProject->projectLanguageDirections) && is_array($externalProject->projectLanguageDirections)) {
    foreach ($externalProject->projectLanguageDirections as $externalLanguageDirection) {
      $this->languageDirections[$i++] = new PDLanguageDirection($externalLanguageDirection);
    }
  }
  elseif (isset($externalProject->projectLanguageDirections)) {
    $this->languageDirections[$i++] = new PDLanguageDirection($externalProject->projectLanguageDirections);
  }
  $i = 0;
  if (isset($externalProject->fileFormatProfiles) && is_array($externalProject->fileFormatProfiles)) {
    foreach ($externalProject->fileFormatProfiles as $fileFormatProfile) {
      $this->fileFormats[$i++] = $fileFormatProfile->profileName;
    }
  }
  elseif (isset($externalProject->fileFormatProfiles)) {
    $this->fileFormats[$i++] = $externalProject->fileFormatProfiles->profileName;
  }
  $i = 0;
  if (isset($externalProject->workflowDefinitions) && is_array($externalProject->workflowDefinitions)) {
    foreach ($externalProject->workflowDefinitions as $externalWorkflowDefinition) {
      $this->workflows[$i++] = new PDWorkflow($externalWorkflowDefinition);
    }
  }
  elseif (isset($externalProject->workflowDefinitions)) {
    $this->workflows[$i++] = new PDWorkflow($externalProject->workflowDefinitions);
  }
  $i = 0;
  if (isset($externalProject->projectCustomFieldConfiguration) && is_array($externalProject->projectCustomFieldConfiguration)) {
    foreach ($externalProject->projectCustomFieldConfiguration as $externalCustomField) {
      $this->customAttributes[$i++] = new PDCustomAttribute($externalCustomField);
    }
  }
  elseif (isset($externalProject->projectCustomFieldConfiguration)) {
    $this->customAttributes[$i++] = new PDCustomAttribute($externalProject->projectCustomFieldConfiguration);
  }
}