You are here

function lingotek_mark_phases_complete_submit in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.page.inc \lingotek_mark_phases_complete_submit()
  2. 7.2 lingotek.page.inc \lingotek_mark_phases_complete_submit()
  3. 7.4 lingotek.page.inc \lingotek_mark_phases_complete_submit()
  4. 7.5 lingotek.page.inc \lingotek_mark_phases_complete_submit()
  5. 7.6 lingotek.page.inc \lingotek_mark_phases_complete_submit()

Submit handler for the lingotek_mark_phases_complete form.

File

./lingotek.page.inc, line 536
Lingotek Tab for Nodes

Code

function lingotek_mark_phases_complete_submit($form, $form_state) {
  if (!empty($form_state['values']['phases'])) {
    $api = LingotekApi::instance();
    $errors = FALSE;
    foreach ($form_state['values']['phases'] as $phase_id) {
      if ($phase_id) {
        if (!$api
          ->markPhaseComplete($phase_id)) {
          $errors = TRUE;
        }
      }
    }
    if (!$errors) {
      drupal_set_message(t('All selected phases were marked as complete.'));
    }
    else {
      drupal_set_message(t('There were errors marking one or more phases as complete.'), 'error');
    }
  }
  else {
    drupal_set_message(t('No phases were selected.'), 'error');
  }
}