Add members column in roles and other UI tidying
This commit is contained in:
+23
-14
@@ -21,7 +21,7 @@ $sql = mysqli_query(
|
|||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="alert alert-warning text-center"><strong>Roles are still in development. Permissions may not be fully enforced.</strong></div>
|
<div class="alert alert-info text-center"><strong>Roles are still in development. Permissions may not be fully enforced.</strong></div>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
@@ -54,22 +54,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_name&order=<?php echo $disp; ?>">
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_name&order=<?php echo $disp; ?>">
|
||||||
Name <?php if ($sort == 'user_role_name') { echo $order_icon; } ?>
|
Role <?php if ($sort == 'user_role_name') { echo $order_icon; } ?>
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_description&order=<?php echo $disp; ?>">
|
|
||||||
Description <?php if ($sort == 'user_role_description') { echo $order_icon; } ?>
|
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
|
<th>Members</th>
|
||||||
<th>
|
<th>
|
||||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_is_admin&order=<?php echo $disp; ?>">
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_is_admin&order=<?php echo $disp; ?>">
|
||||||
Admin <?php if ($sort == 'user_role_is_admin') { echo $order_icon; } ?>
|
Admin <?php if ($sort == 'user_role_is_admin') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
|
||||||
User count
|
|
||||||
</th>
|
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -87,16 +80,32 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(users.user_id) FROM users LEFT JOIN user_settings on users.user_id = user_settings.user_id WHERE user_role = $role_id AND user_archived_at IS NULL");
|
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(users.user_id) FROM users LEFT JOIN user_settings on users.user_id = user_settings.user_id WHERE user_role = $role_id AND user_archived_at IS NULL");
|
||||||
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
|
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
|
||||||
|
|
||||||
|
$sql_users = mysqli_query($mysqli, "SELECT * FROM users LEFT JOIN user_settings on users.user_id = user_settings.user_id WHERE user_role = $role_id AND user_archived_at IS NULL");
|
||||||
|
// Initialize an empty array to hold user names
|
||||||
|
$user_names = [];
|
||||||
|
|
||||||
|
// Fetch each row and store the user_name in the array
|
||||||
|
while($row = mysqli_fetch_assoc($sql_users)) {
|
||||||
|
$user_names[] = nullable_htmlentities($row['user_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the array of user names to a comma-separated string
|
||||||
|
$user_names_string = implode(",", $user_names) ;
|
||||||
|
|
||||||
|
if (empty($user_names_string)) {
|
||||||
|
$user_names_string = "-";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editRoleModal<?php echo $role_id; ?>">
|
<a class="text-dark text-bold" href="#" data-toggle="modal" data-target="#editRoleModal<?php echo $role_id; ?>">
|
||||||
<div class="text-secondary"><?php echo $role_name; ?></div>
|
<?php echo $role_name; ?>
|
||||||
</a>
|
</a>
|
||||||
|
<div class="text-secondary"><?php echo $role_description; ?></div>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $role_description; ?></td>
|
<td><?php echo $user_names_string; ?></td>
|
||||||
<td><?php echo $role_admin ? 'Yes' : 'No' ; ?></td>
|
<td><?php echo $role_admin ? 'Yes' : 'No' ; ?></td>
|
||||||
<td class="text-center"><?php echo $role_user_count ?></td>
|
|
||||||
<td>
|
<td>
|
||||||
<?php if ($role_id !== 3) { ?>
|
<?php if ($role_id !== 3) { ?>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user