You are here

function globallink_entity_form_clear_submit in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.6 globallink_entity/globallink_entity_send.inc \globallink_entity_form_clear_submit()

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

1 string reference to 'globallink_entity_form_clear_submit'
globallink_entity_dashboard_form in globallink_entity/globallink_entity_send.inc
Builds form to create an entity submission.

File

globallink_entity/globallink_entity_send.inc, line 1179

Code

function globallink_entity_form_clear_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  if ($op != t('Clear "Changed" Status')) {
    return;
  }
  $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_entity_source_locale']);
    $nid_arr = array();
    foreach ($nids as $nvid) {
      list($nid, $vid) = explode('-', $nvid, 2);
      array_push($nid_arr, $nid);
    }
    globallink_entity_update_change_flag($nid_arr, $source, $tgt_arr);
    drupal_set_message(t('Status has been cleared successfully for selected record(s).'));
  }
}