You are here

function lingotek_grid_filter_submit in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_grid_filter_submit()
  2. 7.4 lingotek.bulk_grid.inc \lingotek_grid_filter_submit()
  3. 7.6 lingotek.bulk_grid.inc \lingotek_grid_filter_submit()

Submit function for The Grid's filters (header, column, and filter fieldsets) Adds filters to the session variable so the query can use them after the page load

2 calls to lingotek_grid_filter_submit()
lingotek_entity_delete_form_submit in ./lingotek.bulk_grid.inc
Submit handler for the lingotek_entity_delete form.
lingotek_filters_popup in ./lingotek.bulk_grid.inc
2 string references to 'lingotek_grid_filter_submit'
lingotek_filters_popup_form in ./lingotek.bulk_grid.inc
lingotek_grid_customize_form in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 492
Bulk Grid form

Code

function lingotek_grid_filter_submit($form, $form_state) {
  $stselected = FALSE;
  $lselected = FALSE;

  // we have to add some of these keys to the session because otherwise they are not saved after the form submission
  if (isset($form_state['clicked_button']) && $form_state['clicked_button']['#name'] != 'op') {
    $_SESSION['button'] = $form_state['clicked_button']['#name'];
  }
  if (isset($form_state['values'])) {
    foreach ($form_state['values'] as $key => $value) {
      $add_key_to_session = FALSE;
      $nest = NULL;
      if (strpos($key, '__filter')) {
        $add_key_to_session = TRUE;
        $nest = 'grid_filters';

        //stored in $_SESSION['grid_filters'][$key]
      }
      elseif (strpos($key, '__custom')) {
        $add_key_to_session = TRUE;
        $nest = 'grid_custom';

        //stored in $_SESSION['grid_custom'][$key]
      }

      // if we want this key, add it to the session
      if ($add_key_to_session) {
        if (is_null($nest)) {
          $_SESSION[$key] = $value;
        }
        else {
          $_SESSION[$nest][str_replace('__filter', '', $key)] = $value;
        }
      }
    }
  }
}