You are here

function _support_available_clients in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support.module \_support_available_clients()

Find all clients we have permission to view/edit.

13 calls to _support_available_clients()
support_client_fetch_one_action_form in ./support.module
support_form_alter in ./support.module
Customize comment form for ticket followups.
support_overview_page_user in support_overview/support_overview.module
support_overview_page_users in support_overview/support_overview.module
support_overview_summary in support_overview/support_overview.module
Display support ticket overview, highlighting ticket queues with tickets older than a configurable age limit.

... See full list

File

./support.module, line 3111
support.module

Code

function _support_available_clients($account = NULL) {
  global $user;
  static $valid = array();
  if (is_null($account) || !isset($account->uid)) {
    $account = $user;
  }
  if (!isset($valid[$account->uid])) {
    $clients = _support_clients_load();
    if (!empty($clients)) {
      foreach ($clients as $clid => $name) {
        if (user_access('administer support', $account) || user_access("access {$name} tickets", $account)) {
          $valid[$account->uid][$clid] = $name;
        }
      }
    }
    else {
      watchdog('support', t('There are no support clients configured/enabled.'), NULL, WATCHDOG_WARNING, l(t('add client'), 'admin/support/clients/add'));
    }
  }
  return isset($valid[$account->uid]) ? $valid[$account->uid] : array();
}