You are here

function mobile_tools_roles_overview in Mobile Tools 7.2

Same name in this branch
  1. 7.2 mobile_tools_roles/mobile_tools_roles.module \mobile_tools_roles_overview()
  2. 7.2 mobile_tools_roles/mobile_tools_roles.inc \mobile_tools_roles_overview()
Same name and namespace in other branches
  1. 5 mobile_tools.module \mobile_tools_roles_overview()
  2. 6.3 mobile_tools_roles.module \mobile_tools_roles_overview()
  3. 6 mobile_tools_roles.inc \mobile_tools_roles_overview()

@todo Please document this function.

See also

http://drupal.org/node/1354

2 calls to mobile_tools_roles_overview()
mobile_tools_roles_configuration_form in mobile_tools_roles/mobile_tools_roles.module
Configuration form for configuring the mobile context in the permission system
mobile_tools_roles_configuration_form in mobile_tools_roles/mobile_tools_roles.inc
Configuration form for configuring the mobile context in the permission system

File

mobile_tools_roles/mobile_tools_roles.module, line 116
Contains the functionality to add mobile user roles

Code

function mobile_tools_roles_overview() {
  $output = '';
  $query = "SELECT * FROM {mobile_tools_roles_relations}";
  $result = db_query($query);
  $rows = array();
  foreach ($result as $item) {
    $query = "SELECT * FROM {role} WHERE rid = %d";
    $result1 = db_query("SELECT * FROM {role} WHERE rid = :rid", array(
      ':rid' => $item->rid,
    ));
    $result2 = db_query("SELECT * FROM {role} WHERE rid = :rid", array(
      ':rid' => $item->mrid,
    ));
    $rows[] = array(
      $result1
        ->fetchObject()->name,
      $result2
        ->fetchObject()->name,
    );
  }
  $headers = array(
    "original role",
    "mobile role",
  );
  if (count($rows) == 0) {
    $output .= '<div class="message">No Mobile roles were assigned</div>';
  }
  else {
    $output .= theme('table', array(
      'header' => $headers,
      'rows' => $rows,
    ));
    $output .= '<br>' . t('Configure the !permissions', array(
      '!permissions' => l('permissions', 'admin/user/permissions'),
    )) . '<br />';
  }
  return $output;
}