function globallink_dashboard_node_form_submit in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.5 globallink_send_translations.inc \globallink_dashboard_node_form_submit()
Handles GlobalLink form submission.
File
- ./
globallink_send_translations.inc, line 1302
Code
function globallink_dashboard_node_form_submit($form, &$form_state) {
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
$submission_details = array();
$pd4 = globallink_get_project_director_details();
if ($op != t('Send for Translation')) {
return;
}
try {
$nids = array_filter($form_state['values']['table']);
$submission_name = $form_state['values']['submission_name'];
$source_locale = $form_state['values']['submission_source_locale'];
$target_locale_arr = $form_state['values']['submission_target_locale'];
$submission_details['instructions'] = $form_state['values']['submission_instructions'];
$submission_details['submitter'] = $form_state['values']['submission_submitter'];
$submission_priority = $form_state['values']['submission_pd_priority'];
foreach ($target_locale_arr as $key => $target) {
if ($target == FALSE) {
unset($target_locale_arr[$key]);
}
}
watchdog('GlobalLink', 'Sending submission - %submission_name', array(
'%submission_name' => $submission_name,
), WATCHDOG_INFO);
$due_date = globallink_convert_date_to_timestamp($form_state['values']['submission_due_date']);
$project_code = $form_state['values']['submission_pd_project'];
$updated_globalLink_arr = globallink_send_for_translations($nids, $pd4, $submission_name, $due_date, $project_code, $source_locale, $target_locale_arr, $submission_details, $submission_priority);
if (count($updated_globalLink_arr) > 0) {
globallink_update_node_ticket_id($updated_globalLink_arr, $project_code);
drupal_set_message(t('Content has been successfully sent for translations.'));
}
else {
if (empty($_SESSION['messages']['warning'])) {
drupal_set_message(t('Content is empty and has not been sent for translations.'), 'warning');
}
}
if (isset($_GET['rnid'])) {
unset($_GET['rnid']);
}
} catch (SoapFault $se) {
watchdog(TPT_OBJECT_TYPE_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(TPT_OBJECT_TYPE_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(),
)));
}
}