You are here

function globallink_node_form_clear_submit in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.5 globallink_send_translations.inc \globallink_node_form_clear_submit()

Handles clearing the "Changed" status on GlobalLink nodes that have been sent.

1 string reference to 'globallink_node_form_clear_submit'
globallink_dashboard_node_form in ./globallink_send_translations.inc
Builds form to create a GlobalLink submission.

File

./globallink_send_translations.inc, line 1197

Code

function globallink_node_form_clear_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  if ($op == t('Clear "Changed" Status')) {
    $nids = array_filter($form_state['input']['table']);
    if (count($nids) == 0) {
      form_set_error('', t('No items selected.'));
    }
    else {
      $tgt_arr = $form_state['input']['submission_target_locale'];
      $source = globallink_get_locale_code($GLOBALS['globallink_source_locale']);
      $nid_arr = array();
      foreach ($nids as $nvid) {
        list($nid, $vid) = explode('-', $nvid, 2);
        array_push($nid_arr, $nid);
      }
      globallink_update_node_change_flag($nid_arr, $source, $tgt_arr);
      drupal_set_message(t('Status has been cleared successfully for selected record(s).'));
    }
  }
}