You are here

function _ldap_query_get_queries in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_query/ldap_query.inc \_ldap_query_get_queries()
  2. 7 ldap_query/ldap_query.inc \_ldap_query_get_queries()

See ldap_query_get_servers()

1 call to _ldap_query_get_queries()
ldap_query_get_queries in ldap_query/ldap_query.module
Return ldap query objects.

File

ldap_query/ldap_query.inc, line 10

Code

function _ldap_query_get_queries($qid, $type, $flatten, $reset) {
  ldap_servers_module_load_include('php', 'ldap_query', 'LdapQueryAdmin.class');
  static $queries;
  if ($reset) {
    $queries = [];
  }
  if (!isset($queries['all'])) {
    $queries['all'] = LdapQueryAdmin::getLdapQueryObjects('all', 'all');
  }
  if (!isset($queries['enabled'])) {
    $queries['enabled'] = [];
    foreach ($queries['all'] as $_qid => $ldap_query) {
      if ($ldap_query->status == 1) {
        $queries['enabled'][$_qid] = $ldap_query;
      }
    }
  }
  if ($qid) {
    if (!isset($queries[$type][$qid])) {
      return FALSE;
    }
    return $flatten ? $queries[$type][$qid] : $queries[$type];
  }
  if (isset($queries[$type])) {
    return $queries[$type];
  }
}