You are here

function globallink_entity_get_translated_enties in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.5 globallink_entity/globallink_entity.inc \globallink_entity_get_translated_enties()

Gets number of translated entities.

Parameters

string $pd4: The project director details.

array $globallink_arr: Array of GlobalLink objects.

Return value

int The number of translated entities.

2 calls to globallink_entity_get_translated_enties()
globallink_auto_receive in ./globallink.module
Automatically receives translated contents.
globallink_entity_receive_form_submit in globallink_entity/globallink_entity_receive.inc
Handles entity form submission.

File

globallink_entity/globallink_entity.inc, line 500

Code

function globallink_entity_get_translated_enties($pd4, &$globallink_arr) {
  try {
    $count = 0;
    foreach ($globallink_arr as $globallink) {
      if (!$globallink->sourceDeleted) {
        $globallink->targetXML = globallink_download_target_resource($pd4, $globallink->targetTicket);
        if (isset($globallink->targetXML)) {
          $count++;
          globallink_entity_update_entity($globallink);
          if ($globallink->status != 'Error') {
            globallink_send_download_confirmation($globallink->targetTicket, $pd4);
            globallink_entity_update_status($globallink);
          }
          else {
            $count--;
          }
        }
      }
    }
  } catch (SoapFault $se) {
    watchdog('GlobalLink', 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
      '%function' => __FUNCTION__,
      '%faultcode' => $se->faultcode,
      '%faultstring' => $se->faultstring,
    ), WATCHDOG_ERROR);
    form_set_error('', t('Web Services Error: @faultcode - @faultstring', array(
      '@faultcode' => $se->faultcode,
      '@faultstring' => $se->faultstring,
    )));
  } catch (Exception $e) {
    watchdog('GlobalLink', 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
      '%function' => __FUNCTION__,
      '%file' => $e
        ->getFile(),
      '%line' => $e
        ->getLine(),
      '%code' => $e
        ->getCode(),
      '%message' => $e
        ->getMessage(),
    ), WATCHDOG_ERROR);
    form_set_error('', t('Error: @message', array(
      '@message' => $e
        ->getMessage(),
    )));
  }
  return $count;
}