You are here

function _webform_component_roles_component_roles in Webform Component Roles 6

Same name and namespace in other branches
  1. 7 webform_component_roles.module \_webform_component_roles_component_roles()

Fetch the roles of a component by the webform node ID and component ID.

Parameters

int $nid: The node ID that the webform belongs.

int $cid: The component ID within that webform.

Return value

array An array of role ID's.

1 call to _webform_component_roles_component_roles()
webform_component_roles_form_webform_component_edit_form_alter in ./webform_component_roles.module
Implements hook_form_FORM_ID_alter() for webform_component_edit_form().

File

./webform_component_roles.module, line 289
This module adds a list of checkboxes for each Drupal role to the webform component edit form. It then only allows those roles to view that webform component when the webform is viewed.

Code

function _webform_component_roles_component_roles($nid, $cid) {
  $result = db_query('SELECT rid, perms FROM {webform_component_roles} WHERE nid = %d and cid = %d', $nid, $cid);
  $rids = array();
  while ($row = db_fetch_object($result)) {
    $rids[$row->rid] = $row->perms;
  }
  return $rids;
}