You are here

function path_access_admin_role_configure in Path Access 6

Menu callback; displays the configuration form.

1 string reference to 'path_access_admin_role_configure'
path_access_menu in ./path_access.module
Implementation of hook_menu().

File

./path_access.module, line 137
Restricts access to any Drupal path on a per-role basis.

Code

function path_access_admin_role_configure() {
  $roleid = (int) arg(4);
  $settings = db_fetch_array(db_query('SELECT * FROM {path_access} pa INNER JOIN {role} r ON pa.rid = r.rid WHERE pa.rid = %d', $roleid));

  // Obtain role name for the page if there is no existing path settings for this role id.
  if (!$settings) {
    $rolename = db_result(db_query('SELECT name FROM {role} WHERE rid = %d', $roleid));
    db_query("INSERT INTO {path_access} (rid, pages, visibility) VALUES (%d, '', 0)", $roleid);
  }
  else {
    $rolename = $settings['name'];
  }
  drupal_set_title(t("Path access for '%role' role", array(
    '%role' => $rolename,
  )));
  return drupal_get_form('path_access_admin_configure_form', $settings);
}