You are here

function get_cancelled_targets_by_documents in GlobalLink Connect for Drupal 7.7

2 calls to get_cancelled_targets_by_documents()
globallink_background_import in ./globallink_background_jobs.inc
Imports the documents
globallink_background_pull in ./globallink_background_jobs.inc
Pull submissions or documents

File

gl_ws/gl_ws_receive_translations.inc, line 16

Code

function get_cancelled_targets_by_documents($pd_obj, $document_tickets) {
  if (globallink_debug_enabled()) {
    watchdog(GLOBALLINK_MODULE, 'Connecting to PD - %pd', array(
      '%pd' => print_r($pd_obj, TRUE),
    ), WATCHDOG_DEBUG);
  }
  $cancelled_arr = array();
  $connectorConfig = new PDConfig();
  $connectorConfig->url = $pd_obj->url;
  $connectorConfig->username = $pd_obj->username;
  $connectorConfig->password = $pd_obj->password;
  $connectorConfig->userAgent = $pd_obj->userAgent;
  $glExchange = new GLExchange($connectorConfig);
  $targets_arr = $glExchange
    ->getCancelledTargetsByDocuments($document_tickets, $pd_obj->maxTargetCount);
  if (is_null($targets_arr) || empty($targets_arr)) {
    return $cancelled_arr;
  }
  if (count($targets_arr) > 0) {
    foreach ($targets_arr as $target) {
      $tgt_locale = str_replace('-', '_', $target->targetLocale);
      if (isset($cancelled_arr[$tgt_locale])) {
        $cancelled_arr[$tgt_locale][] = $target->documentTicket;
      }
      else {
        $cancelled_arr[$tgt_locale] = array();
        $cancelled_arr[$tgt_locale][] = $target->documentTicket;
      }
    }
  }
  return $cancelled_arr;
}