You are here

function _support_access_tickets in Support Ticketing System 6

Same name and namespace in other branches
  1. 7 support.module \_support_access_tickets()
4 calls to _support_access_tickets()
support_access_clients in ./support.module
Custom permissions function.
support_filter_form in ./support.module
Form builder; Return form for support ticket listing filters.
support_page_form in ./support.module
Display tickets
support_page_user in ./support.user.inc

File

./support.module, line 3568
support.module

Code

function _support_access_tickets($count = TRUE) {
  static $clients = NULL;
  if (is_null($clients)) {
    $clients = array();
    $result = db_query('SELECT clid, name FROM {support_client} WHERE status = 1');
    while ($client = db_fetch_object($result)) {
      if (user_access('administer support') || user_access("access {$client->name} tickets")) {
        $clients[$client->clid] = $client->name;
      }
    }
  }
  if ($count) {
    return count($clients);
  }
  else {
    return $clients;
  }
}