You are here

function ctools_get_roles in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 ctools.module \ctools_get_roles()

Get a list of roles in the system.

Return value

An array of role names keyed by role ID.

4 calls to ctools_get_roles()
ctools_plugin_example_example_role_ctools_access_settings in ctools_plugin_example/plugins/access/example_role.inc
Settings form for the 'by role' access plugin.
ctools_plugin_example_example_role_ctools_access_summary in ctools_plugin_example/plugins/access/example_role.inc
Provide a summary description based upon the checked roles.
ctools_role_ctools_access_settings in plugins/access/role.inc
Settings form for the 'by role' access plugin
ctools_role_ctools_access_summary in plugins/access/role.inc
Provide a summary description based upon the checked roles.

File

./ctools.module, line 225
CTools primary module file.

Code

function ctools_get_roles() {
  static $roles = NULL;
  if (!isset($roles)) {
    $roles = array();
    $result = db_query("SELECT r.rid, r.name FROM {role} r ORDER BY r.name");
    while ($obj = db_fetch_object($result)) {
      $roles[$obj->rid] = $obj->name;
    }
  }
  return $roles;
}