function _mobile_tools_roles_overview in Mobile Tools 6.2
Helper function to display an overview of mobile roles.
1 call to _mobile_tools_roles_overview()
- mobile_tools_roles_configuration_form in modules/
mobile_tools_roles/ mobile_tools_roles.admin.inc - Configuration form for creating mobile user roles.
File
- modules/
mobile_tools_roles/ mobile_tools_roles.admin.inc, line 98 - Generate configuration form and save settings.
Code
function _mobile_tools_roles_overview() {
// Create a variable to hold the table output
$output = '';
// Build a query to select all of the current Mobile Tools Roles relations
$query = "SELECT * FROM {mobile_tools_roles_relations}";
// Execute the query
$result = db_query($query);
// Create an array to store the table rows
$rows = array();
// Process all of the currently available relations
while ($item = db_fetch_object($result)) {
// Build a query to select all of the roles which match a given role ID
$query = "SELECT * FROM {role} WHERE rid = %d";
// Execute the query for the current relation's role ID
$result1 = db_query($query, $item->rid);
// Execute the query for the current relation's mobile role ID
$result2 = db_query($query, $item->mrid);
// Retrieve the name of the role associated with the role ID and mobile row ID
$rows[] = array(
l(db_fetch_object($result1)->name, 'admin/user/permissions/' . $item->rid),
l(db_fetch_object($result2)->name, 'admin/user/permissions/' . $item->mrid),
);
}
// Create an array of table headers
$headers = array(
t('Original role'),
t('Mobile role'),
);
// Display the table if there are any rows available
if (count($rows) != 0) {
$output = theme('table', $headers, $rows);
}
return $output;
}