function GLExchange::uploadTranslationKit in GlobalLink Connect for Drupal 7.7
* Uploads preliminary delivery file to project director * *
Parameters
* $fileName: * Filename that requires translation * @param * $data * File data (String) * @return Response message
File
- gl_ws/
glc/ GLExchange.php, line 956
Class
Code
function uploadTranslationKit($fileName, $data) {
$result = "";
$resourceInfo = new ResourceInfo();
$resourceInfo->name = $fileName;
$resourceInfo->size = strlen($data);
// Upload file
$workflowRequestTicket = $this->workflowService
->upload($resourceInfo, $data)->return;
// Wait until upload is done, or print error message if it failed
$uploadFinished = false;
while (!$uploadFinished) {
// Create delay between two checkUploadAction calls
sleep(DELAY_TIME);
$uploadActionResult = $this->workflowService
->checkUploadAction($workflowRequestTicket);
$uploadFinished = $uploadActionResult->processingFinished->booleanValue;
if ($uploadFinished && isset($uploadActionResult->messages)) {
foreach ($uploadActionResult->messages as &$message) {
$result = $result + $message + ";";
}
}
}
return $result;
}