You are here

function _support_get_state in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support.module \_support_get_state()
2 calls to _support_get_state()
support_page_form in ./support.module
Display tickets
support_page_user in ./support.user.inc

File

./support.module, line 3138
support.module

Code

function _support_get_state($state) {
  if ($state == 'all') {
    return 0;
  }
  else {
    if ($state == 'all open') {
      return -1;
    }
    else {
      if ($state == 'my open') {
        return -2;
      }
      else {
        if ($state == SUPPORT_STATE_CLOSED) {
          $result = db_query("SELECT sid FROM {support_states} WHERE isclosed = :isclosed", array(
            ':isclosed' => 1,
          ));
          $states = array();
          foreach ($result as $state) {
            $states[$state->sid] = $state->sid;
          }
          return $states;
        }
      }
    }
  }
  $sid = db_query("SELECT sid FROM {support_states} WHERE state = :state", array(
    ':state' => $state,
  ))
    ->fetchField();
  if (!$sid) {
    $sid = _support_state_default();
  }
  return $sid;
}